Skip to content

Commit fbf84fa

Browse files
committed
Fix discount not applying
1 parent 209dada commit fbf84fa

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Scenes/ShopScene/Scripts/ShopScene.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ public override void _Input(InputEvent @event)
103103
GetViewport().SetInputAsHandled();
104104
}
105105
}
106+
if (@event is InputEventKey eventKey && eventKey.Pressed && !eventKey.Echo)
107+
{
108+
if (eventKey.Keycode == Key.Key0)
109+
{
110+
StageProducer.PlayerStats.Money += 999;
111+
UpdateMoneyLabel();
112+
}
113+
}
106114
}
107115

108116
private void UpdateMoneyLabel()
@@ -168,7 +176,8 @@ private void AddShopItem(GridContainer container, IDisplayable item, int basePri
168176

169177
private int GetPrice(int basePrice)
170178
{
171-
return Math.Max(basePrice * (1 - StageProducer.PlayerStats.DiscountPercent / 100), 0); //Price can't go negative
179+
return (int)
180+
Math.Max(basePrice * (1 - (float)StageProducer.PlayerStats.DiscountPercent / 100), 0); //Price can't go negative
172181
}
173182

174183
private IDisplayable _currentItem;

0 commit comments

Comments
 (0)