summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-17 22:40:46 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-17 22:40:46 +0100
commite24cbc4eb715496ad3661ee8aca7a390aa436aea (patch)
tree8b5bd455efc5b5830a131589c97e312b9f15152c /core/src/ch/asynk/tankontank/game
parentae80a5a5121d432a3caba4232ec86c464fd09fc4 (diff)
downloadRustAndDust-e24cbc4eb715496ad3661ee8aca7a390aa436aea.zip
RustAndDust-e24cbc4eb715496ad3661ee8aca7a390aa436aea.tar.gz
Player: add ArrayList<Unit> escaped, int escaped(), unitEscape(Unit)
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r--core/src/ch/asynk/tankontank/game/Player.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java
index 636fdd5..ffca1a2 100644
--- a/core/src/ch/asynk/tankontank/game/Player.java
+++ b/core/src/ch/asynk/tankontank/game/Player.java
@@ -22,6 +22,7 @@ public class Player
public ArrayList<Unit> units;
public ArrayList<Unit> casualties;
public ArrayList<Unit> reinforcement;
+ public ArrayList<Unit> escaped;
public int actionCount;
public int lostEngagementCount;
@@ -33,6 +34,7 @@ public class Player
this.units = new ArrayList<Unit>(n);
this.casualties = new ArrayList<Unit>(n);
this.reinforcement = new ArrayList<Unit>(n);
+ this.escaped = new ArrayList<Unit>(n);
this.turn = 0;
this.apSpent = 0;
this.actionPoints = 0;
@@ -94,6 +96,11 @@ public class Player
return casualties.size();
}
+ public int escaped()
+ {
+ return escaped.size();
+ }
+
public void addUnit(Unit unit)
{
units.add(unit);
@@ -122,6 +129,12 @@ public class Player
casualties.add(unit);
}
+ public void unitEscape(Unit unit)
+ {
+ units.remove(unit);
+ escaped.add(unit);
+ }
+
public int getAp()
{
return ((apSpent < actionPoints) ? (apSpent + 1) : apSpent);