diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-24 19:41:17 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-24 19:41:17 +0100 |
commit | 5e685fffa25ebb54ec69a1c8ac525593c856eb64 (patch) | |
tree | 19e8971ec19429cc55aaf2bc581b50cda65149c7 /core | |
parent | a43b138ab8ec7279709fa0cdb686cdc3be026466 (diff) | |
download | RustAndDust-5e685fffa25ebb54ec69a1c8ac525593c856eb64.zip RustAndDust-5e685fffa25ebb54ec69a1c8ac525593c856eb64.tar.gz |
battles: add Battle00
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Factory.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/Battle00.java | 121 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/BattleTest.java | 2 |
3 files changed, 124 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Factory.java b/core/src/ch/asynk/rustanddust/game/Factory.java index eb3cb39..83968f6 100644 --- a/core/src/ch/asynk/rustanddust/game/Factory.java +++ b/core/src/ch/asynk/rustanddust/game/Factory.java @@ -9,6 +9,7 @@ import ch.asynk.rustanddust.engine.Board; import ch.asynk.rustanddust.game.Unit.UnitId; import ch.asynk.rustanddust.game.Unit.UnitType; import ch.asynk.rustanddust.game.battles.Map00; +import ch.asynk.rustanddust.game.battles.Battle00; import ch.asynk.rustanddust.game.battles.BattleTest; public class Factory implements Board.TileBuilder, Disposable @@ -51,6 +52,7 @@ public class Factory implements Board.TileBuilder, Disposable this.game = game; this.assetsLoaded = false; battles = new Battle[] { + new Battle00(this), new BattleTest(this), }; } diff --git a/core/src/ch/asynk/rustanddust/game/battles/Battle00.java b/core/src/ch/asynk/rustanddust/game/battles/Battle00.java new file mode 100644 index 0000000..d94c1ad --- /dev/null +++ b/core/src/ch/asynk/rustanddust/game/battles/Battle00.java @@ -0,0 +1,121 @@ +package ch.asynk.rustanddust.game.battles; + +import ch.asynk.rustanddust.game.Army; +import ch.asynk.rustanddust.game.Player; +import ch.asynk.rustanddust.game.Map; +import ch.asynk.rustanddust.game.Zone; +import ch.asynk.rustanddust.game.Unit.UnitId; +import ch.asynk.rustanddust.game.Factory; +import ch.asynk.rustanddust.ui.Position; +import ch.asynk.rustanddust.engine.Orientation; + +public class Battle00 extends BattleCommon +{ + public Battle00(Factory factory) + { + super(factory); + name = "Les Fleurs du mal"; + mapType = Factory.MapType.MAP_00; + } + + @Override + public Position getHudPosition() + { + return (currentPlayer.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT); + } + + @Override + public void start() + { + map.actionDone(); + map.turnDone(); + usPlayer.turnEnd(); + gePlayer.turnEnd(); + currentPlayer = usPlayer; + } + + @Override + public Player getWinner() + { + if (!abTurnDone()) + return null; + + if (gePlayer.unitsLeft() == 0) + return usPlayer; + if (usPlayer.unitsLeft() == 0) + return gePlayer; + + if (gePlayer.getTurnDone() <= 8) + return null; + + usPlayer.objectivesWon = map.objectivesCount(Army.US); + gePlayer.objectivesWon = map.objectivesCount(Army.GE); + + if (usPlayer.objectivesWon >= gePlayer.objectivesWon) { + return usPlayer; + } else { + return gePlayer; + } + } + + @Override + public boolean hasReinforcement() + { + return false; + } + + @Override + public Map setup() + { + super.setup(); + + map.addHoldObjective(5, 2, Army.NONE); + map.addObjective(11, 7, Army.US); + + currentPlayer = usPlayer; + setUnit(map, usPlayer, UnitId.US_AT_GUN, 11, 7, Orientation.SOUTH, null); + + Zone usEntry = new Zone(map, 10); + usEntry.orientation = Orientation.SOUTH; + usEntry.add(map.getHex(8, 0)); + usEntry.add(map.getHex(9, 0)); + usEntry.add(map.getHex(8, 1)); + usEntry.add(map.getHex(9, 1)); + usEntry.add(map.getHex(9, 2)); + usEntry.add(map.getHex(10, 2)); + usEntry.add(map.getHex(9, 3)); + usEntry.add(map.getHex(10, 3)); + usEntry.add(map.getHex(10, 4)); + usEntry.add(map.getHex(11, 4)); + addEntryZone(usEntry); + addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN, true, false); + addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); + addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); + addReinforcement(usPlayer, usEntry, UnitId.US_SHERMAN); + addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE, true, false); + addReinforcement(usPlayer, usEntry, UnitId.US_WOLVERINE); + addReinforcement(usPlayer, usEntry, UnitId.US_PERSHING); + addReinforcement(usPlayer, usEntry, UnitId.US_PRIEST); + + Zone geEntry = new Zone(map, 8); + geEntry.orientation = Orientation.NORTH; + geEntry.add(map.getHex(4, 8)); + geEntry.add(map.getHex(5, 8)); + geEntry.add(map.getHex(4, 7)); + geEntry.add(map.getHex(5, 7)); + geEntry.add(map.getHex(3, 6)); + geEntry.add(map.getHex(4, 6)); + geEntry.add(map.getHex(3, 5)); + geEntry.add(map.getHex(4, 5)); + addEntryZone(geEntry); + addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV, true, false); + addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV); + addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV); + addReinforcement(gePlayer, geEntry, UnitId.GE_PANZER_IV, true, false); + addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER); + addReinforcement(gePlayer, geEntry, UnitId.GE_TIGER); + addReinforcement(gePlayer, geEntry, UnitId.GE_WESPE); + + return this.map; + } +} diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java index 26fd14a..475d154 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java @@ -16,7 +16,7 @@ public class BattleTest extends BattleCommon public BattleTest(Factory factory) { super(factory); - name = "* Beta Test *"; + name = "* Alpha Test *"; mapType = Factory.MapType.MAP_00; } |