diff options
Diffstat (limited to 'core/src/ch')
11 files changed, 1 insertions, 1039 deletions
diff --git a/core/src/ch/asynk/rustanddust/RustAndDust.java b/core/src/ch/asynk/rustanddust/RustAndDust.java index f6f0c22..3e4d70d 100644 --- a/core/src/ch/asynk/rustanddust/RustAndDust.java +++ b/core/src/ch/asynk/rustanddust/RustAndDust.java @@ -88,10 +88,6 @@ public class RustAndDust extends Game public void loadGameAssets() { - if (config.battle.getMapType() == Factory.MapType.MAP_A) - manager.load("data/map_a.png", Texture.class); - if (config.battle.getMapType() == Factory.MapType.MAP_B) - manager.load("data/map_b.png", Texture.class); if (config.battle.getMapType() == Factory.MapType.MAP_00) manager.load("data/map_00.png", Texture.class); int i = config.graphics.i; @@ -119,10 +115,6 @@ public class RustAndDust extends Game private void unloadGameAssets() { - if (config.battle.getMapType() == Factory.MapType.MAP_A) - manager.unload("data/map_a.png"); - if (config.battle.getMapType() == Factory.MapType.MAP_B) - manager.unload("data/map_b.png"); if (config.battle.getMapType() == Factory.MapType.MAP_00) manager.unload("data/map_00.png"); int i = config.graphics.i; diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCounterAttack.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCounterAttack.java deleted file mode 100644 index cea1d13..0000000 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCounterAttack.java +++ /dev/null @@ -1,150 +0,0 @@ -package ch.asynk.rustanddust.game.battles; - -import ch.asynk.rustanddust.game.Army; -import ch.asynk.rustanddust.game.Player; -import ch.asynk.rustanddust.game.Ctrl; -import ch.asynk.rustanddust.game.Map; -import ch.asynk.rustanddust.game.Zone; -import ch.asynk.rustanddust.game.Unit; -import ch.asynk.rustanddust.game.Unit.UnitId; -import ch.asynk.rustanddust.ui.Position; -import ch.asynk.rustanddust.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/rustanddust/game/battles/BattleFrontalAssault.java b/core/src/ch/asynk/rustanddust/game/battles/BattleFrontalAssault.java deleted file mode 100644 index 372e045..0000000 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleFrontalAssault.java +++ /dev/null @@ -1,124 +0,0 @@ -package ch.asynk.rustanddust.game.battles; - -import ch.asynk.rustanddust.game.Army; -import ch.asynk.rustanddust.game.Player; -import ch.asynk.rustanddust.game.Ctrl; -import ch.asynk.rustanddust.game.Map; -import ch.asynk.rustanddust.game.Hex; -import ch.asynk.rustanddust.game.HexSet; -import ch.asynk.rustanddust.game.Zone; -import ch.asynk.rustanddust.game.Unit; -import ch.asynk.rustanddust.game.Unit.UnitId; -import ch.asynk.rustanddust.ui.Position; -import ch.asynk.rustanddust.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/rustanddust/game/battles/BattleHeadToHead.java b/core/src/ch/asynk/rustanddust/game/battles/BattleHeadToHead.java deleted file mode 100644 index 0d88846..0000000 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleHeadToHead.java +++ /dev/null @@ -1,118 +0,0 @@ -package ch.asynk.rustanddust.game.battles; - -import ch.asynk.rustanddust.game.Zone; -import ch.asynk.rustanddust.game.Army; -import ch.asynk.rustanddust.game.Player; -import ch.asynk.rustanddust.game.Ctrl; -import ch.asynk.rustanddust.game.Map; -import ch.asynk.rustanddust.game.Hex; -import ch.asynk.rustanddust.game.HexSet; -import ch.asynk.rustanddust.game.Unit; -import ch.asynk.rustanddust.game.Unit.UnitId; -import ch.asynk.rustanddust.ui.Position; -import ch.asynk.rustanddust.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/rustanddust/game/battles/BattleLastStand.java b/core/src/ch/asynk/rustanddust/game/battles/BattleLastStand.java deleted file mode 100644 index f898ce9..0000000 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleLastStand.java +++ /dev/null @@ -1,136 +0,0 @@ -package ch.asynk.rustanddust.game.battles; - -import ch.asynk.rustanddust.game.Zone; -import ch.asynk.rustanddust.game.Army; -import ch.asynk.rustanddust.game.Player; -import ch.asynk.rustanddust.game.Ctrl; -import ch.asynk.rustanddust.game.Map; -import ch.asynk.rustanddust.game.Hex; -import ch.asynk.rustanddust.game.HexSet; -import ch.asynk.rustanddust.game.Unit; -import ch.asynk.rustanddust.game.Unit.UnitId; -import ch.asynk.rustanddust.ui.Position; -import ch.asynk.rustanddust.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/rustanddust/game/battles/BattleNightAction.java b/core/src/ch/asynk/rustanddust/game/battles/BattleNightAction.java deleted file mode 100644 index f9817db..0000000 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleNightAction.java +++ /dev/null @@ -1,153 +0,0 @@ -package ch.asynk.rustanddust.game.battles; - -import ch.asynk.rustanddust.game.Zone; -import ch.asynk.rustanddust.game.Army; -import ch.asynk.rustanddust.game.Player; -import ch.asynk.rustanddust.game.Ctrl; -import ch.asynk.rustanddust.game.Map; -import ch.asynk.rustanddust.game.Hex; -import ch.asynk.rustanddust.game.HexSet; -import ch.asynk.rustanddust.game.Unit; -import ch.asynk.rustanddust.game.Unit.UnitId; -import ch.asynk.rustanddust.ui.Position; -import ch.asynk.rustanddust.engine.Orientation; -import ch.asynk.rustanddust.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/rustanddust/game/battles/BattleStabToTheFlank.java b/core/src/ch/asynk/rustanddust/game/battles/BattleStabToTheFlank.java deleted file mode 100644 index c45bac4..0000000 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleStabToTheFlank.java +++ /dev/null @@ -1,143 +0,0 @@ -package ch.asynk.rustanddust.game.battles; - -import ch.asynk.rustanddust.game.Zone; -import ch.asynk.rustanddust.game.Army; -import ch.asynk.rustanddust.game.Player; -import ch.asynk.rustanddust.game.Ctrl; -import ch.asynk.rustanddust.game.Map; -import ch.asynk.rustanddust.game.Hex; -import ch.asynk.rustanddust.game.HexSet; -import ch.asynk.rustanddust.game.Unit; -import ch.asynk.rustanddust.game.Unit.UnitId; -import ch.asynk.rustanddust.ui.Position; -import ch.asynk.rustanddust.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/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java index a237bca..e4bf08f 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java @@ -20,7 +20,7 @@ public class BattleTest extends BattleCommon { super(factory); name = "*** Test ***"; - mapType = Factory.MapType.MAP_B; + mapType = Factory.MapType.MAP_00; } @Override diff --git a/core/src/ch/asynk/rustanddust/game/battles/Factory.java b/core/src/ch/asynk/rustanddust/game/battles/Factory.java index 0f232c4..fbe6d20 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/Factory.java +++ b/core/src/ch/asynk/rustanddust/game/battles/Factory.java @@ -13,12 +13,6 @@ import ch.asynk.rustanddust.game.Unit; import ch.asynk.rustanddust.game.Unit.UnitId; import ch.asynk.rustanddust.game.Unit.UnitType; import ch.asynk.rustanddust.game.Battle; -import ch.asynk.rustanddust.game.battles.BattleHeadToHead; -import ch.asynk.rustanddust.game.battles.BattleFrontalAssault; -import ch.asynk.rustanddust.game.battles.BattleLastStand; -import ch.asynk.rustanddust.game.battles.BattleCounterAttack; -import ch.asynk.rustanddust.game.battles.BattleStabToTheFlank; -import ch.asynk.rustanddust.game.battles.BattleNightAction; import ch.asynk.rustanddust.game.battles.BattleTest; public class Factory implements Board.TileBuilder, Disposable @@ -48,12 +42,6 @@ public class Factory implements Board.TileBuilder, Disposable 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), }; } @@ -87,12 +75,6 @@ public class Factory implements Board.TileBuilder, Disposable case MAP_00: m = new Map00(game, "data/map_00.png", "data/hex.png"); break; - case MAP_A: - m = new MapA(game, "data/map_a.png", "data/hex.png"); - break; - case MAP_B: - m = new MapB(game, "data/map_b.png", "data/hex.png"); - break; } return m; diff --git a/core/src/ch/asynk/rustanddust/game/battles/MapA.java b/core/src/ch/asynk/rustanddust/game/battles/MapA.java deleted file mode 100644 index 8e772b8..0000000 --- a/core/src/ch/asynk/rustanddust/game/battles/MapA.java +++ /dev/null @@ -1,95 +0,0 @@ -package ch.asynk.rustanddust.game.battles; - -import ch.asynk.rustanddust.RustAndDust; -import ch.asynk.rustanddust.engine.Board; -import ch.asynk.rustanddust.engine.Orientation; -import ch.asynk.rustanddust.game.Map; -import ch.asynk.rustanddust.game.Hex; - -public class MapA extends Map -{ - public MapA(final RustAndDust game, String map, String hex) - { - super(game, map, hex); - } - - @Override - protected Board.Config getConfig() - { - 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; - } - - @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/rustanddust/game/battles/MapB.java b/core/src/ch/asynk/rustanddust/game/battles/MapB.java deleted file mode 100644 index f882f69..0000000 --- a/core/src/ch/asynk/rustanddust/game/battles/MapB.java +++ /dev/null @@ -1,93 +0,0 @@ -package ch.asynk.rustanddust.game.battles; - -import ch.asynk.rustanddust.RustAndDust; -import ch.asynk.rustanddust.engine.Board; -import ch.asynk.rustanddust.engine.Orientation; -import ch.asynk.rustanddust.game.Map; -import ch.asynk.rustanddust.game.Hex; - -public class MapB extends Map -{ - public MapB(final RustAndDust game, String map, String hex) - { - super(game, map, hex); - } - - @Override - protected Board.Config getConfig() - { - 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; - } - - @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); - } -} |