diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-08 22:24:33 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-08 22:24:33 +0100 |
commit | 91fd50e89569c9b104f8aa3a85dc1a02f3748eb9 (patch) | |
tree | 4f9a4510c41534be41373b391044c1eb4d794f2b /core/src/ch/asynk/rustanddust/game/battles | |
parent | dfc3f46b764d710b7fe1b1b6c37f7ed08989cf97 (diff) | |
download | RustAndDust-91fd50e89569c9b104f8aa3a85dc1a02f3748eb9.zip RustAndDust-91fd50e89569c9b104f8aa3a85dc1a02f3748eb9.tar.gz |
Battle: owns map, set it and bath player in setup(Ctrl)
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/battles')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java | 18 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/BattleTest.java | 9 |
2 files changed, 15 insertions, 12 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index 4585fdd..9292095 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -24,6 +24,7 @@ public abstract class BattleCommon implements Battle protected String name; protected String description; protected Factory factory; + protected Map map; protected Player currentPlayer; protected Player usPlayer; protected Player gePlayer; @@ -38,13 +39,6 @@ public abstract class BattleCommon implements Battle } @Override - public void init() - { - this.usPlayer = factory.getPlayer(Army.US); - this.gePlayer = factory.getPlayer(Army.GE); - } - - @Override public String toString() { return getName(); @@ -69,9 +63,13 @@ public abstract class BattleCommon implements Battle } @Override - public Map getMap() + public Map setup(Ctrl ctrl) { - return factory.getMap(mapType); + this.map = factory.getMap(mapType); + this.usPlayer = factory.getPlayer(Army.US); + this.gePlayer = factory.getPlayer(Army.GE); + + return this.map; } @Override @@ -107,7 +105,7 @@ public abstract class BattleCommon implements Battle } @Override - public boolean getReinforcement(Ctrl ctrl, Map map) + public boolean getReinforcement(Ctrl ctrl) { return false; } diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java index df3ff2a..7faa0cc 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java @@ -38,7 +38,7 @@ public class BattleTest extends BattleCommon } @Override - public boolean getReinforcement(Ctrl ctrl, Map map) + public boolean getReinforcement(Ctrl ctrl) { if (currentPlayer.is(Army.GE)) return false; @@ -70,8 +70,10 @@ public class BattleTest extends BattleCommon } @Override - public void setup(Ctrl ctrl, Map map) + public Map setup(Ctrl ctrl) { + super.setup(ctrl); + map.addObjective(5, 2, Army.NONE); map.addHoldObjective(5, 3, Army.NONE); map.addObjective(3, 4, Army.NONE); @@ -83,6 +85,7 @@ public class BattleTest extends BattleCommon 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)); @@ -112,5 +115,7 @@ public class BattleTest extends BattleCommon map.init(); map.turnDone(); currentPlayer = gePlayer; + + return this.map; } } |