diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-01-25 12:59:47 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-01-27 22:26:28 +0100 |
commit | ea54afb0ce7fe12d5f96114d767244e7505a8a5c (patch) | |
tree | 6ae165ae965fba71addb6c72f1262b109f9f2057 | |
parent | bab2b2f6d21d41e446342683d4351575b37d3f14 (diff) | |
download | RustAndDust-ea54afb0ce7fe12d5f96114d767244e7505a8a5c.zip RustAndDust-ea54afb0ce7fe12d5f96114d767244e7505a8a5c.tar.gz |
Player: getTurnDone() + getCurrentTurn() -> getTurn(), turn is increased at turn start
6 files changed, 9 insertions, 16 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/OrderList.java b/core/src/ch/asynk/rustanddust/game/OrderList.java index 968aeda..5e7c295 100644 --- a/core/src/ch/asynk/rustanddust/game/OrderList.java +++ b/core/src/ch/asynk/rustanddust/game/OrderList.java @@ -70,7 +70,7 @@ public class OrderList extends IterableArray<Order> implements Json.Serializable { json.writeObjectStart("player"); json.writeValue("army", player.getName()); - json.writeValue("turn", player.getCurrentTurn()); + json.writeValue("turn", player.getTurn()); json.writeValue("aps", player.getAp()); json.writeObjectEnd(); json.writeArrayStart("commands"); diff --git a/core/src/ch/asynk/rustanddust/game/Player.java b/core/src/ch/asynk/rustanddust/game/Player.java index 4018307..ab233fe 100644 --- a/core/src/ch/asynk/rustanddust/game/Player.java +++ b/core/src/ch/asynk/rustanddust/game/Player.java @@ -133,16 +133,11 @@ public class Player return ((apSpent < actionPoints) ? (apSpent + 1) : apSpent); } - public int getTurnDone() + public int getTurn() { return turn; } - public int getCurrentTurn() - { - return (turn + 1); - } - public boolean apExhausted() { return (apSpent == actionPoints); @@ -174,10 +169,7 @@ public class Player public void turnEnd() { - if (deploymentDone) - turn += 1; - else - deploymentDone = (reinforcement.size() == 0); + deploymentDone = (reinforcement.size() == 0); for (Unit unit : units) unit.reset(); } @@ -187,6 +179,7 @@ public class Player if (isDeploymentDone()) { actionPoints = aps; apSpent = 0; + turn += 1; } } diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index 844b6cf..be55d2e 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -133,7 +133,7 @@ public abstract class BattleCommon implements Battle protected boolean turnDoneForBoth() { - return ((currentPlayer.getTurnDone() > 0) && (currentPlayer.getTurnDone() == getOpponent().getTurnDone())); + return ((currentPlayer.getTurn() > 0) && (currentPlayer.getTurn() == getOpponent().getTurn())); } protected Player getWinner(int minTurns) @@ -146,7 +146,7 @@ public abstract class BattleCommon implements Battle if (usPlayer.unitsLeft() == 0) return gePlayer; - if (gePlayer.getTurnDone() <= minTurns) + if (gePlayer.getTurn() <= minTurns) return null; usPlayer.objectivesWon = map.objectivesCount(Army.US); diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java index c4888e1..f54ed43 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java @@ -44,7 +44,7 @@ public class BattleTest extends BattleCommon { if (currentPlayer.is(Army.GE)) return false; - if (currentPlayer.getCurrentTurn() != 2) + if (currentPlayer.getTurn() != 2) return false; Zone usEntry = new Zone(map, 1); diff --git a/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java b/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java index ab5c368..515ba51 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java +++ b/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java @@ -103,7 +103,7 @@ public class PlayerInfo implements Disposable, Drawable, Animation public void update(Player player, Position position) { unitDock.hide(); - turns.write(String.format("%d", player.getCurrentTurn())); + turns.write(String.format("%d", player.getTurn())); aps.write(String.format("%d", player.getAp())); int r = player.reinforcement(); if (r == 0) { diff --git a/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java b/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java index f4f997a..9b2746c 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java +++ b/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java @@ -57,7 +57,7 @@ public class StatisticsPanel extends Patch public void show(Player winner, Player loser, Position position) { flag = ((winner.army == Army.US) ? usFlag : geFlag); - title.write("is triumphant in " + winner.getTurnDone() + " turns."); + title.write("is triumphant in " + winner.getTurn() + " turns."); stats1.write(winner.getStats()); stats2.write(loser.getStats()); |