refactor dialogue handling for various game entities

This commit is contained in:
2026-03-23 22:58:22 +01:00
parent 04c5192e0e
commit 8961dd0e1b
11 changed files with 98 additions and 49 deletions

View File

@@ -46,6 +46,7 @@ public class Player extends Entity {
getPlayerImage();
getPlayerAttackImage();
getGuardImages();
setDialogue();
}
// DEFAULT
@@ -262,7 +263,6 @@ public class Player extends Entity {
if(index == 999) return;
//if(!panel.keyH.spacePressed) return; //Only uncomment if text should only appear if player hits space
attackCancel = true;
panel.gameState = GameState.DIALOGUE;
panel.npc[panel.currentMap.getIndex()][index].speak();
}
public void speak() {
@@ -281,9 +281,7 @@ public class Player extends Entity {
attack = getAttack();
defense = getDefense();
panel.playSE(8);
panel.gameState = GameState.DIALOGUE;
panel.ui.currentDialogue = "You are level " + level + " now!\nYou feel stronger!";
startDialogue(this,0);
}
public void selectItem() {
int itemIndex = panel.ui.getItemIndex(panel.ui.playerSlotCol, panel.ui.playerSlotRow);
@@ -363,6 +361,9 @@ public class Player extends Entity {
inventory.add(currentShield);
inventory.add(new KeyObj(panel));
}
public void setDialogue() {
dialogue[0][0] = "You are level " + level + " now!\nYou feel stronger!";
}
public int getAttack() {
attackArea = currentWeapon.attackArea;
return attack = strength * currentWeapon.attackValue;