Explorar el Código

reimplemented character win and lose detection

Hudriwudri hace 5 años
padre
commit
8ffa41bb91
Se han modificado 1 ficheros con 10 adiciones y 5 borrados
  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)