Преглед на файлове

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)