From d6c95fd78fe16cd089f58111a1df07b8bd251e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 19 Nov 2014 11:03:40 +0100 Subject: Battles: cleanup --- .../game/battles/BattleCounterAttack.java | 39 ++++++++++------------ .../game/battles/BattleFrontalAssault.java | 22 ++++++------ .../tankontank/game/battles/BattleHeadToHead.java | 22 ++++++------ .../tankontank/game/battles/BattleLastStand.java | 19 +++++------ 4 files changed, 48 insertions(+), 54 deletions(-) diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java b/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java index bab0695..c268ea3 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java @@ -62,6 +62,20 @@ public class BattleCounterAttack extends BattleCommon return false; } + public Player checkVictory(Ctrl ctrl) + { + if (ctrl.opponent.unitsLeft() == 0) + return ctrl.player; + + if (gePlayer.escaped() >= 3) + return gePlayer; + + if ((ctrl.player.getTurn() < 9) || (ctrl.opponent.getTurn() < 9)) + return null; + + return usPlayer; + } + @Override public boolean getReinforcement(Ctrl ctrl, Map map) { @@ -90,26 +104,9 @@ public class BattleCounterAttack extends BattleCommon return true; } - public Player checkVictory(Ctrl ctrl) - { - if (ctrl.opponent.unitsLeft() == 0) - return ctrl.player; - - if (gePlayer.escaped() >= 3) - return gePlayer; - - if ((ctrl.player.getTurn() < 9) || (ctrl.opponent.getTurn() < 9)) - return null; - - return usPlayer; - } - @Override public void setup(Ctrl ctrl, Map map) { - Player gePlayer = ctrl.getPlayer(Army.GE); - Player usPlayer = ctrl.getPlayer(Army.US); - Zone geExit = new Zone(map, 9); geExit.orientation = Orientation.NORTH; geExit.add(map.getHex(9, 0)); @@ -138,10 +135,10 @@ public class BattleCounterAttack extends BattleCommon } addEntryZone(geEntry); - addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_TIGER); - addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_TIGER); addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_PANZER_IV_HQ); addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_PANZER_IV_HQ); + addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_TIGER); + addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_TIGER); addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_PANZER_IV); addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_PANZER_IV); addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_PANZER_IV); @@ -164,10 +161,10 @@ public class BattleCounterAttack extends BattleCommon } addEntryZone(usEntry); - addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); - addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN_HQ); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN_HQ); + addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); + addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); } diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java b/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java index 992c81a..c9931bc 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java @@ -63,12 +63,6 @@ public class BattleFrontalAssault extends BattleCommon } @Override - public boolean getReinforcement(Ctrl ctrl, Map map) - { - return false; - } - - @Override public Player checkVictory(Ctrl ctrl) { if (ctrl.opponent.unitsLeft() == 0) @@ -91,6 +85,12 @@ public class BattleFrontalAssault extends BattleCommon } @Override + public boolean getReinforcement(Ctrl ctrl, Map map) + { + return false; + } + + @Override public void setup(Ctrl ctrl, Map map) { objectives = new TileSet(map, 3); @@ -111,10 +111,10 @@ public class BattleFrontalAssault extends BattleCommon geEntry.add(map.getHex(i, 1)); addEntryZone(geEntry); - addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER); - addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER); addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV_HQ); addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV_HQ); + addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER); + addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER); addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV); addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV); addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV); @@ -128,16 +128,16 @@ public class BattleFrontalAssault extends BattleCommon usEntry.add(map.getHex(i, 7)); addEntryZone(usEntry); - addReinforcement(usPlayer, usEntry, UnitId.US_PRIEST); - addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); - addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN_HQ); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN_HQ); + addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); + addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); + addReinforcement(usPlayer, usEntry, UnitId.US_PRIEST); } } diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java b/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java index 4ab72a3..83baeb7 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java @@ -59,12 +59,6 @@ public class BattleHeadToHead extends BattleCommon } @Override - public boolean getReinforcement(Ctrl ctrl, Map map) - { - return false; - } - - @Override public Player checkVictory(Ctrl ctrl) { if (ctrl.opponent.unitsLeft() == 0) @@ -94,6 +88,12 @@ public class BattleHeadToHead extends BattleCommon } @Override + public boolean getReinforcement(Ctrl ctrl, Map map) + { + return false; + } + + @Override public void setup(Ctrl ctrl, Map map) { gePlayer.deploymentDone(); @@ -118,10 +118,10 @@ public class BattleHeadToHead extends BattleCommon geEntry.add(map.getHex(4, 8)); addEntryZone(geEntry); - addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER); - addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER); addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV_HQ); addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV_HQ); + addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER); + addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER); addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV); addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV); addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV); @@ -141,14 +141,14 @@ public class BattleHeadToHead extends BattleCommon usEntry.add(map.getHex(13, 8)); addEntryZone(usEntry); - addReinforcement(usPlayer, usEntry, UnitId.US_PRIEST); - addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); - addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN_HQ); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN_HQ); + addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); + addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); + addReinforcement(usPlayer, usEntry, UnitId.US_PRIEST); } } diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleLastStand.java b/core/src/ch/asynk/tankontank/game/battles/BattleLastStand.java index 74e23ac..fc458a6 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleLastStand.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleLastStand.java @@ -62,12 +62,6 @@ public class BattleLastStand extends BattleCommon return false; } - @Override - public boolean getReinforcement(Ctrl ctrl, Map map) - { - return false; - } - public Player checkVictory(Ctrl ctrl) { if (ctrl.opponent.unitsLeft() == 0) @@ -95,11 +89,14 @@ public class BattleLastStand extends BattleCommon } @Override - public void setup(Ctrl ctrl, Map map) + public boolean getReinforcement(Ctrl ctrl, Map map) { - Player gePlayer = ctrl.getPlayer(Army.GE); - Player usPlayer = ctrl.getPlayer(Army.US); + return false; + } + @Override + public void setup(Ctrl ctrl, Map map) + { objectives = new TileSet(map, 4); objectives.add(map.getHex(7, 8)); objectives.add(map.getHex(6, 4)); @@ -157,10 +154,10 @@ public class BattleLastStand extends BattleCommon usEntry.add(map.getHex(11, 6)); addEntryZone(usEntry); - addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); - addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN_HQ); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN_HQ); + addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); + addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); -- cgit v1.1-2-g2b99