diff options
| author | ilotterytea <iltsu@alright.party> | 2024-04-28 22:49:08 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-04-28 22:49:08 +0500 |
| commit | 353377e482d0f887019797a01229b9032ea36dd2 (patch) | |
| tree | 8778fd0fe4fe6cdea6451b8933de22e4c3e6a6c2 | |
| parent | 8171efef5325dc524f71a706b85b16f1bd34bd5d (diff) | |
upd: item price depend on amount of purchased items
| -rw-r--r-- | core/src/com/ilotterytea/maxoning/screens/GameScreen.java | 2 | ||||
| -rw-r--r-- | core/src/com/ilotterytea/maxoning/screens/game/shop/ShopUI.java | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/core/src/com/ilotterytea/maxoning/screens/GameScreen.java b/core/src/com/ilotterytea/maxoning/screens/GameScreen.java index 555e87e..f514ae3 100644 --- a/core/src/com/ilotterytea/maxoning/screens/GameScreen.java +++ b/core/src/com/ilotterytea/maxoning/screens/GameScreen.java @@ -539,7 +539,7 @@ public class GameScreen implements Screen, InputProcessor { shopUI.createSavegameUI(this.player); shopUI.createShopTitleUI(); shopUI.createShopControlUI(); - shopUI.createShopListUI(); + shopUI.createShopListUI(this.player); } @Override diff --git a/core/src/com/ilotterytea/maxoning/screens/game/shop/ShopUI.java b/core/src/com/ilotterytea/maxoning/screens/game/shop/ShopUI.java index 2203ad9..a691045 100644 --- a/core/src/com/ilotterytea/maxoning/screens/game/shop/ShopUI.java +++ b/core/src/com/ilotterytea/maxoning/screens/game/shop/ShopUI.java @@ -146,7 +146,7 @@ public class ShopUI { this.stage.addActor(table); } - public void createShopListUI() { + public void createShopListUI(final MaxonSavegame player) { Table table = new Table(); table.setWidth(Math.percentFromValue(25f, Gdx.graphics.getWidth())); @@ -155,7 +155,11 @@ public class ShopUI { table.align(Align.center); table.pad(10f); - for (MaxonItem item : this.items) { + for (final MaxonItem item : this.items) { + int amount = (int) player.inv.stream().filter(c -> c == item.id).count(); + + double price = item.price * java.lang.Math.pow(1.15f, amount + this.multiplier.getMultiplier()); + item.price = (float) price; PurchaseItem purchaseItem = new PurchaseItem(this.skin, item); table.add(purchaseItem).width(table.getWidth()).padBottom(5f).row(); |
