浏览代码

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)