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

@@ -42,13 +42,12 @@ public class ChestObj extends Entity {
panel.playSE(3);
StringBuilder sb = new StringBuilder();
sb.append("You open the chest and find a ").append(loot.name).append("!");
if(panel.player.inventory.size() == panel.player.maxInvSize) {
if(!panel.player.canObtainItem(loot)) {
sb.append("\nBut your inventory is full...");
panel.ui.currentDialogue = sb.toString();
return;
}
sb.append("\nYou obtain the ").append(loot.name).append("!");
panel.player.inventory.add(loot);
down1 = image2;
opened = true;
panel.ui.currentDialogue = sb.toString();