added stackable functionality to items and improved inventory management

This commit is contained in:
2025-12-13 12:13:01 +01:00
parent b380e218f6
commit 97da3982d1
9 changed files with 99 additions and 26 deletions

View File

@@ -21,16 +21,17 @@ public class PotionObj extends Entity {
description = "[" + name + "]\nHeals your life by " + value + ".";
price = 50;
stackable = true;
}
public void use(Entity entity) {
public boolean use(Entity entity) {
panel.gameState = GameState.DIALOGUE;
panel.ui.currentDialogue = "You drank a " + name + "!\n" +
"Your life has been recovered by " + value + ".";
entity.life += value;
if(panel.player.life > panel.player.maxLife) panel.player.life = panel.player.maxLife;
panel.playSE(2);
panel.player.inventory.remove(this);
return true;
}
}