From e24cbc4eb715496ad3661ee8aca7a390aa436aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 17 Nov 2014 22:40:46 +0100 Subject: Player: add ArrayList escaped, int escaped(), unitEscape(Unit) --- core/src/ch/asynk/tankontank/game/Player.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 units; public ArrayList casualties; public ArrayList reinforcement; + public ArrayList escaped; public int actionCount; public int lostEngagementCount; @@ -33,6 +34,7 @@ public class Player this.units = new ArrayList(n); this.casualties = new ArrayList(n); this.reinforcement = new ArrayList(n); + this.escaped = new ArrayList(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); -- cgit v1.1-2-g2b99