From 806ad0b70ba6e276afdd873076c66949bd8f4cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 19 Nov 2014 14:16:29 +0100 Subject: Player: turn is turnDone, inc at turnEnd() if deployment done --- core/src/ch/asynk/tankontank/game/Player.java | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java index 9bc1c2b..34f933f 100644 --- a/core/src/ch/asynk/tankontank/game/Player.java +++ b/core/src/ch/asynk/tankontank/game/Player.java @@ -140,24 +140,24 @@ public class Player return ((apSpent < actionPoints) ? (apSpent + 1) : apSpent); } - public int getTurn() + public int getTurnDone() { return turn; } - public boolean apExhausted() + public int getCurrentTurn() { - return (apSpent == actionPoints); + return (turn + 1); } - public boolean isDeploymentDone() + public boolean apExhausted() { - return deploymentDone; + return (apSpent == actionPoints); } - public void deploymentDone() + public boolean isDeploymentDone() { - deploymentDone = true; + return (deploymentDone || (reinforcement.size() == 0)); } public void burnDownOneAp() @@ -169,16 +169,19 @@ public class Player public void turnEnd() { + if (deploymentDone) + turn += 1; + else + deploymentDone = (reinforcement.size() == 0); } public void turnStart() { - if (!deploymentDone) - return; - turn += 1; - for (Unit unit : units) - unit.reset(); - computeActionPoints(); + if (isDeploymentDone()) { + for (Unit unit : units) + unit.reset(); + computeActionPoints(); + } } public int d6() -- cgit v1.1-2-g2b99