From 418f4435ba6fdb6ed382c87076216a5f34591ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 31 Mar 2016 11:46:05 +0200 Subject: Battle: hasReinforcement() -> setNextTurn() --- core/src/ch/asynk/rustanddust/game/Battle.java | 2 -- core/src/ch/asynk/rustanddust/game/Ctrl.java | 2 +- .../ch/asynk/rustanddust/game/battles/Battle00.java | 5 +---- .../rustanddust/game/battles/BattleCommon.java | 8 ++------ .../asynk/rustanddust/game/battles/BattleTest.java | 21 ++++++++------------- 5 files changed, 12 insertions(+), 26 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Battle.java b/core/src/ch/asynk/rustanddust/game/Battle.java index f2d874b..168f5ee 100644 --- a/core/src/ch/asynk/rustanddust/game/Battle.java +++ b/core/src/ch/asynk/rustanddust/game/Battle.java @@ -36,7 +36,5 @@ public interface Battle extends Marshal public boolean isDeploymentDone(); - public boolean hasReinforcement(); - public State.StateType getState(); } diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 6b5ec1a..93e473a 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -328,7 +328,7 @@ public abstract class Ctrl implements Disposable if (battle.turnDone()) hud.victory(battle.getPlayer(), battle.getOpponent()); else { - if (battle.hasReinforcement()) + if (battle.getPlayer().hasReinforcement()) hud.notify("You have reinforcement", 2, Position.MIDDLE_CENTER, true); hud.update(); if (!battle.getPlayer().canDoSomething()) { diff --git a/core/src/ch/asynk/rustanddust/game/battles/Battle00.java b/core/src/ch/asynk/rustanddust/game/battles/Battle00.java index 949ca04..ba61483 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/Battle00.java +++ b/core/src/ch/asynk/rustanddust/game/battles/Battle00.java @@ -37,10 +37,7 @@ public class Battle00 extends BattleCommon } @Override - public boolean hasReinforcement() - { - return false; - } + public void setNextTurn() { } // SETUP diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index eef5cc7..975cc46 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -36,6 +36,7 @@ public abstract class BattleCommon implements Battle protected abstract Player getWinner(); protected abstract void setup(); protected abstract void deployPlayer(); + protected abstract void setNextTurn(); private int d6() { @@ -149,6 +150,7 @@ public abstract class BattleCommon implements Battle currentPlayer.turnStart(getActionPoints()); } turnCount += 1; + setNextTurn(); map.turnDone(); return ret; } @@ -210,12 +212,6 @@ public abstract class BattleCommon implements Battle } @Override - public boolean hasReinforcement() - { - return false; - } - - @Override public StateType getState() { if (!currentPlayer.isDeploymentDone()) diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java index d66dae6..86d4c32 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java @@ -34,20 +34,15 @@ public class BattleTest extends BattleCommon } @Override - public boolean hasReinforcement() + public void setNextTurn() { - if (currentPlayer.is(Army.GE)) - return false; - if (currentPlayer.getTurn() != 2) - return false; - - Zone usEntry = new Zone(map, 1); - usEntry.allowedMoves = (Orientation.SOUTH.s | Orientation.SOUTH_EAST.s | Orientation.SOUTH_WEST.s); - usEntry.add(map.getHex(12, 6)); - addEntryZone(usEntry); - addReinforcement(currentPlayer, usEntry, usExit, UnitCode.US_WOLVERINE); - - return true; + if (turnCount == 3) { + Zone usEntry = new Zone(map, 1); + usEntry.allowedMoves = (Orientation.SOUTH.s | Orientation.SOUTH_EAST.s | Orientation.SOUTH_WEST.s); + usEntry.add(map.getHex(12, 6)); + addEntryZone(usEntry); + addReinforcement(currentPlayer, usEntry, usExit, UnitCode.US_WOLVERINE); + } } // SETUP -- cgit v1.1-2-g2b99