summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game/battles
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-06-30 06:21:50 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2015-06-30 06:21:50 +0200
commitd74bcf9bf390418df35d94b54d59df0170033f65 (patch)
tree2ceae1bd287c42b4f109c47d2360199d6076a156 /core/src/ch/asynk/tankontank/game/battles
parent06868b70f82ed30e46ea3fd012a0befc8380bbad (diff)
downloadRustAndDust-d74bcf9bf390418df35d94b54d59df0170033f65.zip
RustAndDust-d74bcf9bf390418df35d94b54d59df0170033f65.tar.gz
TankOnTank -> CreepingArmor
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/battles')
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/BattleCommon.java151
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java150
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java124
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java118
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/BattleLastStand.java136
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/BattleNightAction.java153
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/BattleStabToTheFlank.java143
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/BattleTest.java128
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/Factory.java192
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/MapA.java77
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/MapB.java75
11 files changed, 0 insertions, 1447 deletions
diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java
deleted file mode 100644
index 413b8ab..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import java.util.Random;
-import java.util.HashMap;
-import java.util.ArrayList;
-
-import ch.asynk.tankontank.game.Army;
-import ch.asynk.tankontank.game.Battle;
-import ch.asynk.tankontank.game.Player;
-import ch.asynk.tankontank.game.Ctrl;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Zone;
-import ch.asynk.tankontank.game.Hex;
-import ch.asynk.tankontank.game.HexSet;
-import ch.asynk.tankontank.game.Unit;
-import ch.asynk.tankontank.game.Unit.UnitId;
-import ch.asynk.tankontank.game.State.StateType;
-
-public abstract class BattleCommon implements Battle
-{
- protected final static Random random = new Random();
-
- protected Factory.MapType mapType;
- protected String name;
- protected String description;
- protected Factory factory;
- protected Player usPlayer;
- protected Player gePlayer;
- protected ArrayList<Zone> entryZone = new ArrayList<Zone>();
- protected ArrayList<Zone> exitZone = new ArrayList<Zone>();
- protected HashMap<Unit, Zone> unitEntry = new HashMap<Unit, Zone>();
- protected HashMap<Unit, Zone> unitExit = new HashMap<Unit, Zone>();
-
- public BattleCommon(Factory factory)
- {
- this.factory = factory;
- }
-
- @Override
- public void init()
- {
- this.usPlayer = factory.getPlayer(Army.US);
- this.gePlayer = factory.getPlayer(Army.GE);
- }
-
- @Override
- public String toString()
- {
- return getName();
- }
-
- @Override
- public String getName()
- {
- return name;
- }
-
- @Override
- public String getDescription()
- {
- return description;
- }
-
- @Override
- public Factory.MapType getMapType()
- {
- return mapType;
- }
-
- @Override
- public Map getMap()
- {
- return factory.getMap(mapType);
- }
-
- @Override
- public Player opponent(Player player)
- {
- if (player == usPlayer)
- return gePlayer;
- return usPlayer;
- }
-
- @Override
- public boolean deploymentDone(Player player)
- {
- return player.isDeploymentDone();
- }
-
- @Override
- public StateType getState(Player player)
- {
- if (!player.isDeploymentDone())
- return StateType.DEPLOYMENT;
- return StateType.SELECT;
- }
-
- @Override
- public boolean getReinforcement(Ctrl ctrl, Map map)
- {
- return false;
- }
-
- @Override
- public Zone getEntryZone(Unit unit)
- {
- return unitEntry.get(unit);
- }
-
- @Override
- public Zone getExitZone(Unit unit)
- {
- return unitExit.get(unit);
- }
-
- public void addEntryZone(Zone entry)
- {
- entryZone.add(entry);
- }
-
- public void addExitZone(Zone exit)
- {
- exitZone.add(exit);
- exit.enable(Hex.EXIT, true);
- }
-
- public void addReinforcement(Player player, Zone entryZone, UnitId unitId)
- {
- addReinforcement(player, entryZone, unitId, false);
- }
-
- public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId)
- {
- addReinforcement(player, entryZone, exitZone, unitId, false);
- }
-
- public void addReinforcement(Player player, Zone entryZone, UnitId unitId, boolean ace)
- {
- addReinforcement(player, entryZone, null, unitId, ace);
- }
-
- public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId, boolean ace)
- {
- Unit unit = factory.getUnit(unitId);
- unit.setAce(ace);
- player.addReinforcement(unit);
- unitEntry.put(unit, entryZone);
- if (exitZone != null)
- unitExit.put(unit, exitZone);
- }
-}
diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java b/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java
deleted file mode 100644
index bcc08f2..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import ch.asynk.tankontank.game.Army;
-import ch.asynk.tankontank.game.Player;
-import ch.asynk.tankontank.game.Ctrl;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Zone;
-import ch.asynk.tankontank.game.Unit;
-import ch.asynk.tankontank.game.Unit.UnitId;
-import ch.asynk.tankontank.ui.Position;
-import ch.asynk.tankontank.engine.Orientation;
-
-public class BattleCounterAttack extends BattleCommon
-{
- public BattleCounterAttack(Factory factory)
- {
- super(factory);
- name = "Counterattack";
- mapType = Factory.MapType.MAP_B;
- }
-
- @Override
- public Position getHudPosition(Player player)
- {
- return (player.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT);
- }
-
- @Override
- public Player getPlayer()
- {
- if (!gePlayer.isDeploymentDone())
- return gePlayer;
- if (!usPlayer.isDeploymentDone())
- return usPlayer;
- if (gePlayer.getTurnDone() == usPlayer.getTurnDone())
- return gePlayer;
- return usPlayer;
- }
-
- public Player checkVictory(Ctrl ctrl)
- {
- if (ctrl.opponent.unitsLeft() == 0)
- return ctrl.player;
-
- if (gePlayer.withdrawed() >= 3)
- return gePlayer;
-
- if ((ctrl.player.getTurnDone() < 9) || (ctrl.opponent.getTurnDone() < 9))
- return null;
-
- return usPlayer;
- }
-
- @Override
- public boolean getReinforcement(Ctrl ctrl, Map map)
- {
- if (ctrl.player.is(Army.GE))
- return false;
- if (ctrl.player.getCurrentTurn() != 5)
- return false;
-
- // hex row 1
- Zone usEntry = new Zone(map, 9);
- usEntry.allowedMoves = (Orientation.SOUTH.s | Orientation.SOUTH_EAST.s | Orientation.SOUTH_WEST.s);
- usEntry.add(map.getHex(9, 0));
- usEntry.add(map.getHex(9, 1));
- usEntry.add(map.getHex(10, 2));
- usEntry.add(map.getHex(10, 3));
- usEntry.add(map.getHex(11, 4));
- usEntry.add(map.getHex(11, 5));
- usEntry.add(map.getHex(12, 6));
- usEntry.add(map.getHex(12, 7));
- usEntry.add(map.getHex(13, 8));
- addEntryZone(usEntry);
-
- addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN);
- addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN);
- addReinforcement(usPlayer, usEntry, UnitId.US_PRIEST);
-
- return true;
- }
-
- @Override
- public void setup(Ctrl ctrl, Map map)
- {
- // hex row 1
- Zone geExit = new Zone(map, 9);
- geExit.orientation = Orientation.NORTH;
- geExit.add(map.getHex(9, 0));
- geExit.add(map.getHex(9, 1));
- geExit.add(map.getHex(10, 2));
- geExit.add(map.getHex(10, 3));
- geExit.add(map.getHex(11, 4));
- geExit.add(map.getHex(11, 5));
- geExit.add(map.getHex(12, 6));
- geExit.add(map.getHex(12, 7));
- geExit.add(map.getHex(13, 8));
- addExitZone(geExit);
-
- // hex rows 8-9
- Zone geEntry = new Zone(map, 18);
- geEntry.orientation = Orientation.NORTH;
- for (int i = 0; i < 2; i++) {
- geEntry.add(map.getHex((1 + i), 0));
- geEntry.add(map.getHex((1 + i), 1));
- geEntry.add(map.getHex((2 + i), 2));
- geEntry.add(map.getHex((2 + i), 3));
- geEntry.add(map.getHex((3 + i), 4));
- geEntry.add(map.getHex((3 + i), 5));
- geEntry.add(map.getHex((4 + i), 6));
- geEntry.add(map.getHex((4 + i), 7));
- geEntry.add(map.getHex((5 + i), 8));
- }
- addEntryZone(geEntry);
-
- 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);
- addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_PANZER_IV);
- addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_PANZER_IV);
- addReinforcement(gePlayer, geEntry, geExit, UnitId.GE_WESPE);
-
- // hex rows 1-4
- Zone usEntry = new Zone(map, 36);
- usEntry.orientation = Orientation.SOUTH;
- for (int i = 0; i < 4; i++) {
- usEntry.add(map.getHex((6 + i), 0));
- usEntry.add(map.getHex((6 + i), 1));
- usEntry.add(map.getHex((7 + i), 2));
- usEntry.add(map.getHex((7 + i), 3));
- usEntry.add(map.getHex((8 + i), 4));
- usEntry.add(map.getHex((8 + i), 5));
- usEntry.add(map.getHex((9 + i), 6));
- usEntry.add(map.getHex((9 + i), 7));
- usEntry.add(map.getHex((10 + i), 8));
- }
- addEntryZone(usEntry);
-
- 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
deleted file mode 100644
index e3436cf..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import ch.asynk.tankontank.game.Army;
-import ch.asynk.tankontank.game.Player;
-import ch.asynk.tankontank.game.Ctrl;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Hex;
-import ch.asynk.tankontank.game.HexSet;
-import ch.asynk.tankontank.game.Zone;
-import ch.asynk.tankontank.game.Unit;
-import ch.asynk.tankontank.game.Unit.UnitId;
-import ch.asynk.tankontank.ui.Position;
-import ch.asynk.tankontank.engine.Orientation;
-
-public class BattleFrontalAssault extends BattleCommon
-{
- public BattleFrontalAssault(Factory factory)
- {
- super(factory);
- name = "Frontal Assault";
- mapType = Factory.MapType.MAP_A;
- }
-
-
- @Override
- public Player getPlayer()
- {
- if (!gePlayer.isDeploymentDone()) {
- int n = gePlayer.reinforcement();
- if (n > 4)
- return gePlayer;
- else {
- if (usPlayer.isDeploymentDone())
- return gePlayer;
- else
- return usPlayer;
- }
- }
- if (gePlayer.getTurnDone() == usPlayer.getTurnDone())
- return usPlayer;
- return gePlayer;
- }
-
- @Override
- public Position getHudPosition(Player player)
- {
- return (player.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT);
- }
-
- @Override
- public boolean deploymentDone(Player player)
- {
- if (player.isDeploymentDone())
- return true;
- return ((player.is(Army.GE) && (gePlayer.reinforcement.size() == 4)));
- }
-
- @Override
- public Player checkVictory(Ctrl ctrl)
- {
- if (ctrl.opponent.unitsLeft() == 0)
- return ctrl.player;
-
- if ((ctrl.player.getTurnDone() < 10) || (ctrl.opponent.getTurnDone() < 10))
- return null;
-
- if (ctrl.map.objectives.count(Army.US) >= 2)
- return usPlayer;
- else
- return gePlayer;
- }
-
- @Override
- public void setup(Ctrl ctrl, Map map)
- {
- // G9, E6, H4
- map.addObjective(2, 2, Army.NONE);
- map.addObjective(6, 4, Army.NONE);
- map.addObjective(6, 1, Army.NONE);
-
- // hex rows E-H
- Zone geEntry = new Zone(map, 38);
- geEntry.orientation = Orientation.NORTH_WEST;
- for (int i = 2; i < 12; i++)
- geEntry.add(map.getHex(i, 4));
- for (int i = 2; i < 11; i++)
- geEntry.add(map.getHex(i, 3));
- for (int i = 1; i < 11; i++)
- geEntry.add(map.getHex(i, 2));
- for (int i = 1; i < 10; i++)
- geEntry.add(map.getHex(i, 1));
- addEntryZone(geEntry);
-
- 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);
- addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV);
-
- // hex rows A-B
- Zone usEntry = new Zone(map, 19);
- usEntry.orientation = Orientation.SOUTH_EAST;
- for (int i = 4; i < 14; i++)
- usEntry.add(map.getHex(i, 8));
- for (int i = 4; i < 13; i++)
- usEntry.add(map.getHex(i, 7));
- addEntryZone(usEntry);
-
- 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
deleted file mode 100644
index 0bb6e7e..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import ch.asynk.tankontank.game.Zone;
-import ch.asynk.tankontank.game.Army;
-import ch.asynk.tankontank.game.Player;
-import ch.asynk.tankontank.game.Ctrl;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Hex;
-import ch.asynk.tankontank.game.HexSet;
-import ch.asynk.tankontank.game.Unit;
-import ch.asynk.tankontank.game.Unit.UnitId;
-import ch.asynk.tankontank.ui.Position;
-import ch.asynk.tankontank.engine.Orientation;
-
-public class BattleHeadToHead extends BattleCommon
-{
- private Army firstArmy;
-
- public BattleHeadToHead(Factory factory)
- {
- super(factory);
- name = "Head To Head";
- firstArmy = ((random.nextInt(2) == 0) ? Army.US : Army.GE);
- mapType = Factory.MapType.MAP_A;
- }
-
- @Override
- public Player getPlayer()
- {
- if (gePlayer.getTurnDone() == usPlayer.getTurnDone())
- return ((firstArmy == Army.US) ? usPlayer : gePlayer);
- else
- return ((firstArmy == Army.US) ? gePlayer : usPlayer);
- }
-
- @Override
- public Position getHudPosition(Player player)
- {
- return (player.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT);
- }
-
- @Override
- public Player checkVictory(Ctrl ctrl)
- {
- if (ctrl.opponent.unitsLeft() == 0)
- return ctrl.player;
-
- if ((ctrl.player.getTurnDone() < 10) || (ctrl.opponent.getTurnDone() < 10))
- return null;
-
- if (ctrl.map.objectives.count(Army.US) >= 2)
- return usPlayer;
- if (ctrl.map.objectives.count(Army.GE) >= 2)
- return gePlayer;
-
- return null;
- }
-
- @Override
- public void setup(Ctrl ctrl, Map map)
- {
- // end deployment
- usPlayer.turnEnd();
- gePlayer.turnEnd();
-
- // B6, E6, H4
- map.addObjective(7, 7, Army.NONE);
- map.addObjective(6, 4, Army.NONE);
- map.addObjective(6, 1, Army.NONE);
-
- // southern hex row
- Zone geEntry = new Zone(map, 9);
- geEntry.allowedMoves = (Orientation.NORTH.s | Orientation.NORTH_EAST.s | Orientation.NORTH_WEST.s);
- geEntry.add(map.getHex(0, 0));
- geEntry.add(map.getHex(1, 1));
- geEntry.add(map.getHex(1, 2));
- geEntry.add(map.getHex(2, 3));
- geEntry.add(map.getHex(2, 4));
- geEntry.add(map.getHex(3, 5));
- geEntry.add(map.getHex(3, 6));
- geEntry.add(map.getHex(4, 7));
- geEntry.add(map.getHex(4, 8));
- addEntryZone(geEntry);
-
- 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);
- addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV);
-
- // northern hex row
- Zone usEntry = new Zone(map, 9);
- usEntry.allowedMoves = (Orientation.SOUTH.s | Orientation.SOUTH_EAST.s | Orientation.SOUTH_WEST.s);
- usEntry.add(map.getHex(9, 0));
- usEntry.add(map.getHex(9, 1));
- usEntry.add(map.getHex(10, 2));
- usEntry.add(map.getHex(10, 3));
- usEntry.add(map.getHex(11, 4));
- usEntry.add(map.getHex(11, 5));
- usEntry.add(map.getHex(12, 6));
- usEntry.add(map.getHex(12, 7));
- usEntry.add(map.getHex(13, 8));
- addEntryZone(usEntry);
-
- 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
deleted file mode 100644
index a8b1952..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/BattleLastStand.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import ch.asynk.tankontank.game.Zone;
-import ch.asynk.tankontank.game.Army;
-import ch.asynk.tankontank.game.Player;
-import ch.asynk.tankontank.game.Ctrl;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Hex;
-import ch.asynk.tankontank.game.HexSet;
-import ch.asynk.tankontank.game.Unit;
-import ch.asynk.tankontank.game.Unit.UnitId;
-import ch.asynk.tankontank.ui.Position;
-import ch.asynk.tankontank.engine.Orientation;
-
-public class BattleLastStand extends BattleCommon
-{
- public BattleLastStand(Factory factory)
- {
- super(factory);
- name = "Last Stand";
- mapType = Factory.MapType.MAP_B;
- }
-
- @Override
- public Position getHudPosition(Player player)
- {
- return (player.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT);
- }
-
- @Override
- public Player getPlayer()
- {
- if (!gePlayer.isDeploymentDone())
- return gePlayer;
- if (!usPlayer.isDeploymentDone())
- return usPlayer;
- if (gePlayer.getTurnDone() == usPlayer.getTurnDone())
- return usPlayer;
- return gePlayer;
- }
-
- public Player checkVictory(Ctrl ctrl)
- {
- if (ctrl.opponent.unitsLeft() == 0)
- return ctrl.player;
-
- if ((ctrl.player.getTurnDone() < 8) || (ctrl.opponent.getTurnDone() < 8))
- return null;
-
- int gePoints = usPlayer.casualties();
- int usPoints = gePlayer.casualties();
- usPoints += ctrl.map.objectives.count(Army.US);
- for (Unit unit : gePlayer.casualties) {
- if (unit.isAce())
- usPoints += 1;
- }
-
- if (usPoints > gePoints)
- return usPlayer;
- else
- return gePlayer;
- }
-
- @Override
- public void setup(Ctrl ctrl, Map map)
- {
- // A7, E6, F6, G10
- map.addObjective(7, 8, Army.NONE);
- map.addObjective(6, 4, Army.NONE);
- map.addObjective(5, 3, Army.NONE);
- map.addObjective(1, 2, Army.NONE);
-
- // 1 hex of E7
- Zone geEntry = new Zone(map, 7);
- geEntry.orientation = Orientation.NORTH;
- geEntry.add(map.getHex(5, 5));
- geEntry.add(map.getHex(4, 4));
- geEntry.add(map.getHex(4, 3));
- geEntry.add(map.getHex(5, 3));
- geEntry.add(map.getHex(6, 4));
- geEntry.add(map.getHex(6, 5));
- geEntry.add(map.getHex(5, 4));
- addEntryZone(geEntry);
-
- addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER, true);
- addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER);
- addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER);
-
- // hex rows 7-10
- geEntry = new Zone(map, 32);
- geEntry.orientation = Orientation.NORTH;
- for (int i = 0; i < 4; i++) {
- geEntry.add(map.getHex(i, 0));
- geEntry.add(map.getHex((i + 1), 2));
- geEntry.add(map.getHex((i + 2), 4));
- geEntry.add(map.getHex((i + 3), 6));
- geEntry.add(map.getHex((i + 4), 8));
- }
- for (int i = 0; i < 3; i++) {
- geEntry.add(map.getHex((i + 1), 1));
- geEntry.add(map.getHex((i + 2), 3));
- geEntry.add(map.getHex((i + 3), 5));
- geEntry.add(map.getHex((i + 4), 7));
- }
- addEntryZone(geEntry);
-
- addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV);
- addReinforcement(gePlayer, geEntry, UnitId.GE_WESPE);
-
- // hex rows hex row 1 + E2 + C2
- Zone usEntry = new Zone(map, 11);
- usEntry.orientation = Orientation.SOUTH;
- usEntry.add(map.getHex(9, 0));
- usEntry.add(map.getHex(9, 1));
- usEntry.add(map.getHex(10, 2));
- usEntry.add(map.getHex(10, 3));
- usEntry.add(map.getHex(11, 4));
- usEntry.add(map.getHex(11, 5));
- usEntry.add(map.getHex(12, 6));
- usEntry.add(map.getHex(12, 7));
- usEntry.add(map.getHex(13, 8));
- usEntry.add(map.getHex(10, 4));
- usEntry.add(map.getHex(11, 6));
- addEntryZone(usEntry);
-
- 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);
- }
-}
diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleNightAction.java b/core/src/ch/asynk/tankontank/game/battles/BattleNightAction.java
deleted file mode 100644
index ddcb9ae..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/BattleNightAction.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import ch.asynk.tankontank.game.Zone;
-import ch.asynk.tankontank.game.Army;
-import ch.asynk.tankontank.game.Player;
-import ch.asynk.tankontank.game.Ctrl;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Hex;
-import ch.asynk.tankontank.game.HexSet;
-import ch.asynk.tankontank.game.Unit;
-import ch.asynk.tankontank.game.Unit.UnitId;
-import ch.asynk.tankontank.ui.Position;
-import ch.asynk.tankontank.engine.Orientation;
-import ch.asynk.tankontank.engine.Meteorology;
-
-public class BattleNightAction extends BattleCommon
-{
- public BattleNightAction(Factory factory)
- {
- super(factory);
- name = "Night Action";
- mapType = Factory.MapType.MAP_B;
- }
-
- @Override
- public Position getHudPosition(Player player)
- {
- return (player.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT);
- }
-
- @Override
- public Player getPlayer()
- {
- if (!gePlayer.isDeploymentDone() || gePlayer.getCurrentTurn() == 1)
- return gePlayer;
- if (gePlayer.getTurnDone() > usPlayer.getTurnDone())
- return usPlayer;
- return gePlayer;
- }
-
- private boolean isClear(Map map, int col, int row)
- {
- Hex hex = map.getHex(col, row);
- Unit unit = hex.getUnit();
- if ((unit != null) && unit.is(Army.GE)) {
- map.selectHex(hex);
- return false;
- }
- map.showMove(hex);
- return true;
- }
-
- public Player checkVictory(Ctrl ctrl)
- {
- if (ctrl.opponent.unitsLeft() == 0)
- return ctrl.player;
-
- if ((ctrl.player.getTurnDone() < 9) || (ctrl.opponent.getTurnDone() < 9))
- return null;
-
- Map map = ctrl.map;
- boolean clear = true;
- clear &= isClear(map, 4, 8);
- clear &= isClear(map, 5, 8);
- clear &= isClear(map, 6, 8);
- clear &= isClear(map, 7, 8);
- clear &= isClear(map, 8, 8);
- clear &= isClear(map, 8, 7);
- clear &= isClear(map, 8, 6);
- boolean upLeft = clear;
- clear = true;
- clear &= isClear(map, 8, 6);
- clear &= isClear(map, 9, 6);
- clear &= isClear(map, 10, 6);
- clear &= isClear(map, 11, 6);
- clear &= isClear(map, 12, 6);
- boolean upRight = clear;
- clear = true;
- clear &= isClear(map, 1, 2);
- clear &= isClear(map, 2, 3);
- clear &= isClear(map, 3, 3);
- clear &= isClear(map, 4, 3);
- clear &= isClear(map, 5, 3);
- clear &= isClear(map, 6, 4);
- clear &= isClear(map, 7, 4);
- clear &= isClear(map, 8, 4);
- boolean bottomLeft = clear;
- clear &= isClear(map, 8, 4);
- clear &= isClear(map, 9, 4);
- clear &= isClear(map, 10, 4);
- clear &= isClear(map, 11, 4);
- clear = true;
- boolean bottomRight = clear;
- // clear &= isClear(map, 8, 6);
- // clear &= isClear(map, 8, 5);
- // clear &= isClear(map, 8, 4);
- // clear = true;
- // boolean link = clear;
-
- if ((!upLeft || !upRight) && (!bottomLeft || !bottomRight))
- return gePlayer;
- return usPlayer;
- }
-
- @Override
- public void setup(Ctrl ctrl, Map map)
- {
- map.meteorology.day = Meteorology.Day.NIGHT;
-
- // hex row I
- Zone geEntry = new Zone(map, 10);
- geEntry.orientation = Orientation.NORTH_EAST;
- for (int i = 0; i < 10; i++)
- geEntry.add(map.getHex(i, 0));
- addEntryZone(geEntry);
-
- 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);
- addReinforcement(gePlayer, geEntry, UnitId.GE_INFANTRY);
- addReinforcement(gePlayer, geEntry, UnitId.GE_INFANTRY);
-
- // hex rows A-B
- Zone usEntry = new Zone(map, 19);
- usEntry.orientation = Orientation.SOUTH;
- for (int i = 0; i < 10; i++) {
- usEntry.add(map.getHex((4 + i), 8));
- usEntry.add(map.getHex((3 + i), 6));
- usEntry.add(map.getHex((2 + i), 4));
- usEntry.add(map.getHex((1 + i), 2));
- }
- for (int i = 0; i < 9; i++) {
- usEntry.add(map.getHex((4 + i), 7));
- usEntry.add(map.getHex((3 + i), 5));
- usEntry.add(map.getHex((2 + i), 3));
- }
- addEntryZone(usEntry);
-
- addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN_HQ);
- addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN_HQ);
- addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN);
- addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN);
- addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN);
- addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE);
- addReinforcement(usPlayer, usEntry, UnitId.US_AT_GUN);
- addReinforcement(usPlayer, usEntry, UnitId.US_INFANTRY);
- addReinforcement(usPlayer, usEntry, UnitId.US_INFANTRY);
- }
-}
diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleStabToTheFlank.java b/core/src/ch/asynk/tankontank/game/battles/BattleStabToTheFlank.java
deleted file mode 100644
index 5e910d4..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/BattleStabToTheFlank.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import ch.asynk.tankontank.game.Zone;
-import ch.asynk.tankontank.game.Army;
-import ch.asynk.tankontank.game.Player;
-import ch.asynk.tankontank.game.Ctrl;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Hex;
-import ch.asynk.tankontank.game.HexSet;
-import ch.asynk.tankontank.game.Unit;
-import ch.asynk.tankontank.game.Unit.UnitId;
-import ch.asynk.tankontank.ui.Position;
-import ch.asynk.tankontank.engine.Orientation;
-
-public class BattleStabToTheFlank extends BattleCommon
-{
- public BattleStabToTheFlank(Factory factory)
- {
- super(factory);
- name = "Stab To The Flank";
- mapType = Factory.MapType.MAP_B;
- }
-
- @Override
- public Position getHudPosition(Player player)
- {
- return (player.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT);
- }
-
- @Override
- public Player getPlayer()
- {
- if (!usPlayer.isDeploymentDone() || usPlayer.getCurrentTurn() == 1)
- return usPlayer;
- if (usPlayer.getTurnDone() > gePlayer.getTurnDone())
- return gePlayer;
- return usPlayer;
- }
-
- public Player checkVictory(Ctrl ctrl)
- {
- if (ctrl.opponent.unitsLeft() == 0)
- return ctrl.player;
-
- if ((ctrl.player.getTurnDone() < 9) || (ctrl.opponent.getTurnDone() < 9))
- return null;
-
- int gePoints = usPlayer.casualties();
- int usPoints = gePlayer.casualties();
- usPoints += ctrl.map.objectives.count(Army.US);
-
- int withdrawed = usPlayer.withdrawed();
- if (withdrawed == 0)
- gePoints += 1;
- else
- usPoints += withdrawed;
-
- if (usPoints > gePoints)
- return usPlayer;
- else
- return gePlayer;
- }
-
- @Override
- public boolean getReinforcement(Ctrl ctrl, Map map)
- {
- if (ctrl.player.is(Army.US))
- return false;
- if (ctrl.player.getCurrentTurn() != 3)
- return false;
-
- // hex rows I
- Zone geEntry = new Zone(map, 9);
- geEntry.allowedMoves = (Orientation.SOUTH_WEST.s | Orientation.NORTH_WEST.s);
- for (int i = 0; i < 10; i++)
- geEntry.add(map.getHex(i, 0));
- addEntryZone(geEntry);
-
- addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER, true);
-
- return true;
- }
-
- @Override
- public void setup(Ctrl ctrl, Map map)
- {
- // F6, E6
- map.addHoldObjective(5, 3, Army.NONE);
- map.addObjective(6, 4, Army.NONE);
-
- // hex rows D-I
- Zone geEntry = new Zone(map, 57);
- geEntry.orientation = Orientation.NORTH;
- for (int i = 3; i < 12; i++)
- geEntry.add(map.getHex(i, 5));
- for (int i = 2; i < 12; i++)
- geEntry.add(map.getHex(i, 4));
- for (int i = 2; i < 11; i++)
- geEntry.add(map.getHex(i, 3));
- for (int i = 1; i < 11; i++)
- geEntry.add(map.getHex(i, 2));
- for (int i = 1; i < 10; i++)
- geEntry.add(map.getHex(i, 1));
- for (int i = 0; i < 10; i++)
- geEntry.add(map.getHex(i, 0));
-
- addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV_HQ);
- addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV_HQ);
- addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV);
- addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV);
- addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV);
- addReinforcement(gePlayer, geEntry, UnitId.GE_AT_GUN);
- addReinforcement(gePlayer, geEntry, UnitId.GE_INFANTRY);
-
- // hex row I
- Zone usExit = new Zone(map, 10);
- usExit.orientation = Orientation.NORTH_EAST;
- for (int i = 0; i < 10; i++)
- geEntry.add(map.getHex(i, 0));
- addExitZone(usExit);
-
- // hex rows A-B
- Zone usEntry = new Zone(map, 19);
- usEntry.orientation = Orientation.SOUTH_EAST;
- for (int i = 4; i < 13; i++) {
- usEntry.add(map.getHex(i, 8));
- usEntry.add(map.getHex(i, 7));
- }
- usEntry.add(map.getHex(13, 8));
- addEntryZone(usEntry);
-
- addReinforcement(usPlayer, usEntry, usExit, UnitId.US_SHERMAN_HQ);
- addReinforcement(usPlayer, usEntry, usExit, UnitId.US_SHERMAN_HQ);
- addReinforcement(usPlayer, usEntry, usExit, UnitId.US_SHERMAN);
- addReinforcement(usPlayer, usEntry, usExit, UnitId.US_SHERMAN);
- addReinforcement(usPlayer, usEntry, usExit, UnitId.US_SHERMAN);
- addReinforcement(usPlayer, usEntry, usExit, UnitId.US_SHERMAN);
- addReinforcement(usPlayer, usEntry, usExit, UnitId.US_SHERMAN);
- addReinforcement(usPlayer, usEntry, usExit, UnitId.US_INFANTRY);
- addReinforcement(usPlayer, usEntry, usExit, UnitId.US_INFANTRY);
- addReinforcement(usPlayer, usEntry, usExit, UnitId.US_PRIEST);
- }
-}
diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleTest.java b/core/src/ch/asynk/tankontank/game/battles/BattleTest.java
deleted file mode 100644
index e844d15..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/BattleTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import ch.asynk.tankontank.game.Army;
-import ch.asynk.tankontank.game.Player;
-import ch.asynk.tankontank.game.Ctrl;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Hex;
-import ch.asynk.tankontank.game.HexSet;
-import ch.asynk.tankontank.game.Zone;
-import ch.asynk.tankontank.game.Unit;
-import ch.asynk.tankontank.game.Unit.UnitId;
-import ch.asynk.tankontank.ui.Position;
-import ch.asynk.tankontank.engine.Orientation;
-
-public class BattleTest extends BattleCommon
-{
- private Zone usExit;
-
- public BattleTest(Factory factory)
- {
- super(factory);
- name = "*** Test ***";
- mapType = Factory.MapType.MAP_B;
- }
-
- @Override
- public Player getPlayer()
- {
- if (!gePlayer.isDeploymentDone())
- return gePlayer;
-
- if (gePlayer.getTurnDone() == usPlayer.getTurnDone())
- return usPlayer;
- return gePlayer;
- }
-
- @Override
- public Position getHudPosition(Player player)
- {
- return (player.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT);
- }
-
- @Override
- public Player checkVictory(Ctrl ctrl)
- {
- if (usPlayer.getTurnDone() > 2)
- return usPlayer;
- return null;
- }
-
- @Override
- public boolean getReinforcement(Ctrl ctrl, Map map)
- {
- if (ctrl.player.is(Army.GE))
- return false;
- if (ctrl.player.getCurrentTurn() != 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(usPlayer, usEntry, usExit, UnitId.US_WOLVERINE);
-
- return true;
- }
-
- private Unit setUnit(Map map, Player player, UnitId unitId, int col, int row, Orientation orientation, Zone exitZone)
- {
- return setUnit(map, player, unitId, col, row, orientation, false, exitZone);
- }
-
- private Unit setUnit(Map map, Player player, UnitId unitId, int col, int row, Orientation orientation, boolean ace, Zone exitZone)
- {
- Unit u = factory.getUnit(unitId);
- u.setAce(ace);
- if (exitZone != null)
- unitExit.put(u, exitZone);
- map.setOnBoard(u, map.getHex(col, row), orientation);
- return u;
- }
-
- @Override
- public void setup(Ctrl ctrl, Map map)
- {
- map.addObjective(6, 4, Army.NONE);
- map.addHoldObjective(5, 3, Army.NONE);
- map.addObjective(3, 4, Army.NONE);
- map.addHoldObjective(3, 3, Army.NONE);
-
- ctrl.player = gePlayer;
- setUnit(map, gePlayer, UnitId.GE_WESPE, 5, 8, Orientation.NORTH, null);
- setUnit(map, gePlayer, UnitId.GE_TIGER, 6, 4, Orientation.NORTH, null);
- setUnit(map, gePlayer, UnitId.GE_PANZER_IV, 4, 5, Orientation.NORTH_WEST, null);
- setUnit(map, gePlayer, UnitId.GE_INFANTRY, 1, 2, Orientation.NORTH_WEST, null);
- setUnit(map, gePlayer, UnitId.GE_KINGTIGER, 1, 1, Orientation.NORTH_WEST, null);
- Zone geEntry = new Zone(map, 6);
- geEntry.orientation = Orientation.NORTH;
- geEntry.add(map.getHex(1, 2));
- geEntry.add(map.getHex(1, 1));
- geEntry.add(map.getHex(3, 3));
- geEntry.add(map.getHex(3, 4));
- geEntry.add(map.getHex(4, 0));
- geEntry.add(map.getHex(5, 0));
- addEntryZone(geEntry);
- addReinforcement(gePlayer, geEntry, UnitId.GE_AT_GUN);
-
- usExit = new Zone(map, 9);
- usExit.orientation = Orientation.NORTH;
- usExit.add(map.getHex(11, 4));
- usExit.add(map.getHex(11, 5));
- usExit.add(map.getHex(12, 6));
- addExitZone(usExit);
-
- ctrl.player = usPlayer;
- usPlayer.casualty(factory.getUnit(UnitId.US_SHERMAN_HQ));
- setUnit(map, usPlayer, UnitId.US_PRIEST, 10, 8, Orientation.SOUTH_EAST, usExit);
- setUnit(map, usPlayer, UnitId.US_SHERMAN, 7, 3, Orientation.SOUTH, true, usExit);
- setUnit(map, usPlayer, UnitId.US_SHERMAN_HQ, 8, 4, Orientation.SOUTH, usExit);
- setUnit(map, usPlayer, UnitId.US_WOLVERINE, 9, 7, Orientation.SOUTH_EAST, usExit);
- setUnit(map, usPlayer, UnitId.US_PERSHING, 6, 6, Orientation.NORTH_EAST, usExit);
- setUnit(map, usPlayer, UnitId.US_INFANTRY, 5, 3, Orientation.NORTH_WEST, usExit);
- setUnit(map, usPlayer, UnitId.US_AT_GUN, 10, 3, Orientation.SOUTH, usExit);
- usPlayer.turnEnd();
- map.init();
- map.turnDone();
- }
-}
diff --git a/core/src/ch/asynk/tankontank/game/battles/Factory.java b/core/src/ch/asynk/tankontank/game/battles/Factory.java
deleted file mode 100644
index 7002e43..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/Factory.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import com.badlogic.gdx.utils.Disposable;
-import com.badlogic.gdx.graphics.g2d.TextureAtlas;
-
-import ch.asynk.tankontank.TankOnTank;
-import ch.asynk.tankontank.engine.Board;
-import ch.asynk.tankontank.game.Player;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Hex;
-import ch.asynk.tankontank.game.Army;
-import ch.asynk.tankontank.game.Unit;
-import ch.asynk.tankontank.game.Unit.UnitId;
-import ch.asynk.tankontank.game.Unit.UnitType;
-import ch.asynk.tankontank.game.Battle;
-import ch.asynk.tankontank.game.battles.BattleHeadToHead;
-import ch.asynk.tankontank.game.battles.BattleFrontalAssault;
-import ch.asynk.tankontank.game.battles.BattleLastStand;
-import ch.asynk.tankontank.game.battles.BattleCounterAttack;
-import ch.asynk.tankontank.game.battles.BattleStabToTheFlank;
-import ch.asynk.tankontank.game.battles.BattleNightAction;
-import ch.asynk.tankontank.game.battles.BattleTest;
-
-public class Factory implements Board.TileBuilder, Disposable
-{
- public enum MapType
- {
- MAP_A,
- MAP_B
- }
-
- public enum Scenarios
- {
- FAKE
- }
-
- public boolean assetsLoaded;
- public TextureAtlas hudAtlas;
- public TextureAtlas pawnsAtlas;
- public TextureAtlas pawnOverlaysAtlas;
- public TextureAtlas tileOverlaysAtlas;
- public Battle battles[];
- private final TankOnTank game;
-
- public Factory(final TankOnTank game)
- {
- this.game = game;
- this.assetsLoaded = false;
- battles = new Battle[] {
- new BattleHeadToHead(this),
- new BattleFrontalAssault(this),
- new BattleLastStand(this),
- new BattleCounterAttack(this),
- new BattleStabToTheFlank(this),
- new BattleNightAction(this),
- new BattleTest(this),
- };
- }
-
- public void assetsLoaded()
- {
- if (assetsLoaded) return;
- int i = game.config.graphics.i;
- this.hudAtlas = game.manager.get("data/hud.atlas", TextureAtlas.class);
- this.tileOverlaysAtlas = game.manager.get("data/hex-overlays.atlas", TextureAtlas.class);
- this.pawnsAtlas = game.manager.get(String.format("data/units%d.atlas", i), TextureAtlas.class);
- this.pawnOverlaysAtlas = game.manager.get(String.format("data/unit-overlays%d.atlas", i), TextureAtlas.class);
- this.assetsLoaded = true;
- }
-
- @Override
- public void dispose()
- {
- if (!assetsLoaded) return;
- hudAtlas.dispose();
- pawnsAtlas.dispose();
- pawnOverlaysAtlas.dispose();
- tileOverlaysAtlas.dispose();
- this.assetsLoaded = false;
- }
-
- private Board.Config config()
- {
- Board.Config cfg = new Board.Config();
- cfg.cols = 10;
- cfg.rows = 9;
- cfg.x0 = 86;
- cfg.y0 = 182;
- cfg.w = 189;
- cfg.dw = 94;
- cfg.s = 110;
- cfg.dh = 53.6f;
- cfg.h = cfg.s + cfg.dh;
- cfg.slope = (cfg.dh / (float) cfg.dw);
-
- return cfg;
- }
-
- public Map getMap(MapType t)
- {
- Board.Config cfg = config();
-
- Map m = null;
- switch(t) {
- case MAP_A:
- m = new MapA(game, config(), "data/map_a.png");
- break;
- case MAP_B:
- m = new MapB(game, config(), "data/map_b.png");
- break;
- }
-
- return m;
- }
-
- public Player getPlayer(Army army)
- {
- if (army == Army.US)
- return new Player(game, Army.US, 10);
- else
- return new Player(game, Army.GE, 10);
- }
-
- public Unit getUnit(UnitId id)
- {
- Unit u = null;
- UnitType ut = UnitType.HARD_TARGET;
- UnitType utHq = UnitType.HARD_TARGET_HQ;
- switch(id) {
- case GE_AT_GUN:
- ut = UnitType.AT_GUN;
- u = new Unit(Army.GE, id, ut, 3, 8, 9, 1, "ge-at-gun", "ge-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case GE_INFANTRY:
- ut = UnitType.INFANTRY;
- u = new Unit(Army.GE, id, ut, 1, 7, 10, 1, "ge-infantry", "ge-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case GE_KINGTIGER:
- u = new Unit(Army.GE, id, ut, 3, 12, 1, "ge-kingtiger", "ge-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case GE_PANZER_IV:
- u = new Unit(Army.GE, id, ut, 2, 9, 2, "ge-panzer-iv", "ge-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case GE_PANZER_IV_HQ:
- u = new Unit(Army.GE, id, utHq, 2, 9, 2, "ge-panzer-iv", "ge-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case GE_TIGER:
- u = new Unit(Army.GE, id, ut, 3, 11, 1, "ge-tiger", "ge-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case GE_WESPE:
- ut = UnitType.ARTILLERY;
- u = new Unit(Army.GE, id, ut, 5, 8, 1, "ge-wespe", "ge-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case US_AT_GUN:
- ut = UnitType.AT_GUN;
- u = new Unit(Army.US, id, ut, 1, 7, 10, 1, "us-at-gun", "us-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case US_INFANTRY:
- ut = UnitType.INFANTRY;
- u = new Unit(Army.US, id, ut, 1, 7, 10, 1, "us-infantry", "us-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case US_PERSHING:
- u = new Unit(Army.US, id, ut, 3, 10, 2, "us-pershing", "us-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case US_PERSHING_HQ:
- u = new Unit(Army.US, id, utHq, 3, 10, 2, "us-pershing", "us-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case US_PRIEST:
- ut = UnitType.ARTILLERY;
- u = new Unit(Army.US, id, ut, 5, 8, 1, "us-priest", "us-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case US_SHERMAN:
- u = new Unit(Army.US, id, ut, 2, 9, 2, "us-sherman", "us-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case US_SHERMAN_HQ:
- u = new Unit(Army.US, id, utHq, 2, 9, 2, "us-sherman", "us-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- case US_WOLVERINE:
- u = new Unit(Army.US, id, ut, 3, 8, 3, "us-wolverine", "us-head", pawnsAtlas, pawnOverlaysAtlas);
- break;
- }
-
- return u;
- }
-
- public Hex getNewTile(float x, float y, int col, int row, boolean offmap)
- {
- Hex hex = new Hex(x, y, col, row, tileOverlaysAtlas);
- if (offmap) hex.terrain = Hex.Terrain.OFFMAP;
- return hex;
- }
-}
diff --git a/core/src/ch/asynk/tankontank/game/battles/MapA.java b/core/src/ch/asynk/tankontank/game/battles/MapA.java
deleted file mode 100644
index 3f18e39..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/MapA.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import ch.asynk.tankontank.TankOnTank;
-import ch.asynk.tankontank.engine.Board;
-import ch.asynk.tankontank.engine.Orientation;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Hex;
-
-public class MapA extends Map
-{
- public MapA(final TankOnTank game, Board.Config cfg, String textureName)
- {
- super(game, cfg, textureName);
- }
-
- @Override
- protected void setup()
- {
- getHex(5, 1).terrain = Hex.Terrain.HILLS;
- getHex(7, 3).terrain = Hex.Terrain.HILLS;
- getHex(7, 8).terrain = Hex.Terrain.HILLS;
- getHex(8, 8).terrain = Hex.Terrain.HILLS;
-
- getHex(5, 0).terrain = Hex.Terrain.WOODS;
- getHex(6, 0).terrain = Hex.Terrain.WOODS;
- getHex(3, 3).terrain = Hex.Terrain.WOODS;
- getHex(4, 3).terrain = Hex.Terrain.WOODS;
- getHex(10, 7).terrain = Hex.Terrain.WOODS;
- getHex(11, 7).terrain = Hex.Terrain.WOODS;
- getHex(11, 8).terrain = Hex.Terrain.WOODS;
-
- getHex(6, 1).terrain = Hex.Terrain.TOWN;
- getHex(2, 2).terrain = Hex.Terrain.TOWN;
- getHex(6, 4).terrain = Hex.Terrain.TOWN;
- getHex(10, 5).terrain = Hex.Terrain.TOWN;
- getHex(7, 7).terrain = Hex.Terrain.TOWN;
- getHex(4, 6).terrain = Hex.Terrain.TOWN;
-
- getHex(10, 1).terrain = Hex.Terrain.OFFMAP;
- getHex(11, 3).terrain = Hex.Terrain.OFFMAP;
- getHex(12, 5).terrain = Hex.Terrain.OFFMAP;
- getHex(13, 7).terrain = Hex.Terrain.OFFMAP;
-
- int N = Orientation.NORTH.s;
- int S = Orientation.SOUTH.s;
- int NE = Orientation.NORTH_EAST.s;
- int NW = Orientation.NORTH_WEST.s;
- int SE = Orientation.SOUTH_EAST.s;
- int SW = Orientation.SOUTH_WEST.s;
-
- getHex(6, 1).roads = (NW | SW);
- for (int i = 1; i < 11; i++) {
- if (i == 6)
- getHex(i, 2).roads = (NE | S | SW);
- else if (i == 7)
- getHex(i, 2).roads = (N | SE);
- else
- getHex(i, 2).roads = (N | S);
- }
- getHex(6, 3).roads = (NE | SW);
- getHex(6, 4).roads = (N | NE | SW);
- getHex(7, 4).roads = (N | S);
- getHex(8, 4).roads = (NW | S);
- getHex(6, 5).roads = (NE | SW);
- getHex(8, 5).roads = (N | SW);
- getHex(9, 5).roads = (N | S | NE);
- getHex(10, 5).roads = (N | S);
- getHex(11, 5).roads = (N | S);
- getHex(3, 6).roads = (N | S);
- getHex(4, 6).roads = (N | S);
- getHex(5, 6).roads = (N | S);
- getHex(6, 6).roads = (NE | NW | S);
- getHex(8, 6).roads = (NE | SW);
- getHex(7, 7).roads = (N | SE);
- getHex(8, 7).roads = (NE | S);
- }
-}
diff --git a/core/src/ch/asynk/tankontank/game/battles/MapB.java b/core/src/ch/asynk/tankontank/game/battles/MapB.java
deleted file mode 100644
index c0f23a2..0000000
--- a/core/src/ch/asynk/tankontank/game/battles/MapB.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package ch.asynk.tankontank.game.battles;
-
-import ch.asynk.tankontank.TankOnTank;
-import ch.asynk.tankontank.engine.Board;
-import ch.asynk.tankontank.engine.Orientation;
-import ch.asynk.tankontank.game.Map;
-import ch.asynk.tankontank.game.Hex;
-
-public class MapB extends Map
-{
- public MapB(final TankOnTank game, Board.Config cfg, String textureName)
- {
- super(game, cfg, textureName);
- }
-
- @Override
- protected void setup()
- {
- getHex(4, 0).terrain = Hex.Terrain.HILLS;
- getHex(5, 0).terrain = Hex.Terrain.HILLS;
- getHex(1, 1).terrain = Hex.Terrain.HILLS;
- getHex(9, 7).terrain = Hex.Terrain.HILLS;
- getHex(10, 7).terrain = Hex.Terrain.HILLS;
-
- getHex(3, 0).terrain = Hex.Terrain.WOODS;
- getHex(6, 0).terrain = Hex.Terrain.WOODS;
- getHex(8, 1).terrain = Hex.Terrain.WOODS;
- getHex(9, 2).terrain = Hex.Terrain.WOODS;
- getHex(4, 5).terrain = Hex.Terrain.WOODS;
- getHex(5, 6).terrain = Hex.Terrain.WOODS;
- getHex(6, 6).terrain = Hex.Terrain.WOODS;
- getHex(11, 8).terrain = Hex.Terrain.WOODS;
-
- getHex(1, 2).terrain = Hex.Terrain.TOWN;
- getHex(5, 3).terrain = Hex.Terrain.TOWN;
- getHex(6, 4).terrain = Hex.Terrain.TOWN;
- getHex(7, 8).terrain = Hex.Terrain.TOWN;
-
- getHex(10, 1).terrain = Hex.Terrain.OFFMAP;
- getHex(11, 3).terrain = Hex.Terrain.OFFMAP;
- getHex(12, 5).terrain = Hex.Terrain.OFFMAP;
- getHex(13, 7).terrain = Hex.Terrain.OFFMAP;
-
- int N = Orientation.NORTH.s;
- int S = Orientation.SOUTH.s;
- int NE = Orientation.NORTH_EAST.s;
- int NW = Orientation.NORTH_WEST.s;
- int SE = Orientation.SOUTH_EAST.s;
- int SW = Orientation.SOUTH_WEST.s;
-
- getHex(1, 2).roads = (S | NW);
- getHex(2, 3).roads = (SE | N);
- getHex(3, 3).roads = (S | N);
- getHex(4, 3).roads = (S | N);
- getHex(5, 3).roads = (S | NW);
- getHex(6, 4).roads = (SE | N);
- getHex(7, 4).roads = (S | N);
- getHex(8, 4).roads = (S | SW | N);
- getHex(9, 4).roads = (S | N);
- getHex(10, 4).roads = (S | N);
- getHex(11, 4).roads = (S | N);
- getHex(4, 8).roads = (S | N);
- getHex(5, 8).roads = (S | N);
- getHex(6, 8).roads = (S | N);
- getHex(7, 8).roads = (S | N);
- getHex(8, 8).roads = (S | NE);
- getHex(8, 7).roads = (SW | NE);
- getHex(8, 6).roads = (SW | NE | N);
- getHex(8, 5).roads = (SW | NE);
- getHex(9, 6).roads = (S | N);
- getHex(10, 6).roads = (S | N);
- getHex(11, 6).roads = (S | N);
- getHex(12, 6).roads = (S | N);
- }
-}