Переглянути джерело

reimplemented character win and lose detection

Hudriwudri 5 роки тому
батько
коміт
8ffa41bb91
1 змінених файлів з 10 додано та 5 видалено
  1. 10 5
      src/pathgame/gameplay/Player.java

+ 10 - 5
src/pathgame/gameplay/Player.java

@@ -220,20 +220,25 @@ public class Player
     {
         return abilities;
     }
-    
+
     public void setEnergySupply(int energySupply)
     {
         this.energySupply = energySupply;
     }
-    
+
     public void setObjectivesAmount(int objectivesAmount)
     {
         this.objectivesAmount = objectivesAmount;
     }
-    
-    public void getAbilities(PlayerAbilities playerAbilities)
+
+    public boolean hasWon()
     {
-        abilities = playerAbilities;
+        return objectivesVisited >= objectivesAmount;
+    }
+
+    public boolean hasLost()
+    {
+        return energyUsed >= energySupply;
     }
 
     public void reset(int energySupply, int objectivesAmount, PlayerAbilities abilities)