From 434c1dd96a8f7ff91503b87d54624c7582e213f1 Mon Sep 17 00:00:00 2001 From: Yazan Alaamer Date: Fri, 3 Feb 2023 22:40:16 +0100 Subject: [PATCH] refactoring: fix endless hp glitch --- src/main/java/game/StartDarkSoulsGame.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/game/StartDarkSoulsGame.java b/src/main/java/game/StartDarkSoulsGame.java index d622a0f..ffa3338 100644 --- a/src/main/java/game/StartDarkSoulsGame.java +++ b/src/main/java/game/StartDarkSoulsGame.java @@ -22,7 +22,7 @@ public class StartDarkSoulsGame { Container con; TitelScreenHandler tsHandler= new TitelScreenHandler(); ChoiceHandler choiceHandler = new ChoiceHandler(); - int playerHP, monsterHP, AshuraRing; + int playerHP, monsterHP, AshuraRing, fill_hp; String position, weapon; public StartDarkSoulsGame() { @@ -195,10 +195,14 @@ public class StartDarkSoulsGame { choice3.setText("Go south"); choice4.setText("Go West"); } - public void north() { + public void north() { position= "north"; + if (fill_hp < 1) { mainTextArea.setText("You Are at Siofra River.\n this Water is blessed Drink it. \n (+ 2HP)"); playerHP = playerHP +2; + fill_hp++; + } + else { mainTextArea.setText("You can only dring 1 time");} hpLabelNumber.setText(""+ playerHP); choice1.setText("GO south"); choice2.setText("");