summaryrefslogtreecommitdiff
path: root/core/src/kz/ilotterytea/maxon/screens
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-06-11 21:35:55 +0500
committerilotterytea <iltsu@alright.party>2024-06-11 21:35:55 +0500
commit0ebab77637f3f09fb4d0dac50b52981e96c347ae (patch)
treeb2dbeb7c19dbd008a804df847dddf54a52607162 /core/src/kz/ilotterytea/maxon/screens
parent8af98ac84fdcef1295fbc82137d6b65a703d4388 (diff)
feat: unlock pets
Diffstat (limited to 'core/src/kz/ilotterytea/maxon/screens')
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java
index 71af190..1ee7a90 100644
--- a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java
+++ b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java
@@ -292,6 +292,29 @@ public class ShopUI {
private void updatePurchaseItems() {
for (final PetWidget widget : this.petWidgets) {
+ if (!savegame.getUnlockedPets().contains(widget.getPet().getId())) {
+ double price = widget.getPrice() / 4.0f;
+ double price2 = widget.getPrice() / 1.5f;
+
+ if (!widget.isLocked()) {
+ widget.setLocked(true);
+ }
+
+ widget.setDisabled(true);
+
+ if (price > savegame.getMoney()) {
+ widget.setVisible(false);
+ } else if (price < savegame.getMoney() && price2 > savegame.getMoney()){
+ widget.setVisible(true);
+ } else {
+ widget.setVisible(true);
+ widget.setLocked(false);
+ savegame.getUnlockedPets().add(widget.getPet().getId());
+ }
+
+ continue;
+ }
+
int amount = savegame.getPurchasedPets().getOrDefault(widget.getPet().getId(), 0);
double price = widget.getPet().getPrice() * java.lang.Math.pow(1.15f, amount + multiplier.getMultiplier());