summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/game/battles
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/battles')
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/Battle00.java13
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java18
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleTest.java35
3 files changed, 33 insertions, 33 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/battles/Battle00.java b/core/src/ch/asynk/rustanddust/game/battles/Battle00.java
index ba61483..2b0279f 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/Battle00.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/Battle00.java
@@ -4,6 +4,7 @@ import ch.asynk.rustanddust.game.Army;
import ch.asynk.rustanddust.game.Player;
import ch.asynk.rustanddust.game.Zone;
import ch.asynk.rustanddust.game.Unit.UnitCode;
+import ch.asynk.rustanddust.game.Ctrl;
import ch.asynk.rustanddust.game.Factory;
import ch.asynk.rustanddust.ui.Position;
import ch.asynk.rustanddust.engine.Orientation;
@@ -52,17 +53,17 @@ public class Battle00 extends BattleCommon
}
@Override
- protected void deployPlayer()
+ protected void deployPlayer(final Ctrl ctrl)
{
if (currentPlayer.army == Army.US)
- setupUS(currentPlayer);
+ setupUS(ctrl, currentPlayer);
else
- setupGE(currentPlayer);
+ setupGE(ctrl, currentPlayer);
}
- private void setupUS(final Player p)
+ private void setupUS(final Ctrl ctrl, final Player p)
{
- setUnit(map, p, UnitCode.US_AT_GUN, 11, 7, Orientation.SOUTH, null);
+ setUnit(ctrl, p, UnitCode.US_AT_GUN, 11, 7, Orientation.SOUTH, null);
Zone usEntry = new Zone(map, 10);
usEntry.orientation = Orientation.SOUTH;
@@ -87,7 +88,7 @@ public class Battle00 extends BattleCommon
addReinforcement(p, usEntry, UnitCode.US_PRIEST);
}
- private void setupGE(final Player p)
+ private void setupGE(final Ctrl ctrl, final Player p)
{
Zone geEntry = new Zone(map, 8);
geEntry.orientation = Orientation.NORTH;
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
index a70698b..20f6a25 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
@@ -23,7 +23,6 @@ public abstract class BattleCommon implements Battle
{
protected final static Random random = new Random(System.currentTimeMillis());
- private Ctrl ctrl;
protected final Factory factory;
protected int _id;
@@ -37,7 +36,7 @@ public abstract class BattleCommon implements Battle
protected abstract Player getWinner();
protected abstract void setup();
- protected abstract void deployPlayer();
+ protected abstract void deployPlayer(final Ctrl ctrl);
protected abstract void setNextTurn();
private int d6()
@@ -70,9 +69,8 @@ public abstract class BattleCommon implements Battle
@Override public Factory.MapType getMapType() { return mapType; }
@Override
- public Map init(Ctrl ctrl)
+ public Map init()
{
- this.ctrl = ctrl;
this.map = factory.getMap(getMapType());
setup();
this.turnCount = 0;
@@ -91,13 +89,13 @@ public abstract class BattleCommon implements Battle
}
@Override
- public void initialDeployment()
+ public void initialDeployment(final Ctrl ctrl)
{
this.currentPlayer = players[0];
- deployPlayer();
+ deployPlayer(ctrl);
this.currentPlayer = players[1];
- deployPlayer();
+ deployPlayer(ctrl);
this.currentPlayer = players[0];
}
@@ -253,12 +251,12 @@ public abstract class BattleCommon implements Battle
if (exitZone != null) unit.exitZone = exitZone;
}
- protected Unit setUnit(Map map, Player player, UnitCode unitCode, int col, int row, Orientation orientation, Zone exitZone)
+ protected Unit setUnit(Ctrl ctrl, Player player, UnitCode unitCode, int col, int row, Orientation orientation, Zone exitZone)
{
- return setUnit(map, player, unitCode, col, row, orientation, false, false, exitZone);
+ return setUnit(ctrl, player, unitCode, col, row, orientation, false, false, exitZone);
}
- protected Unit setUnit(Map map, Player player, UnitCode unitCode, int col, int row, Orientation orientation, boolean hq, boolean ace, Zone exitZone)
+ protected Unit setUnit(Ctrl ctrl, Player player, UnitCode unitCode, int col, int row, Orientation orientation, boolean hq, boolean ace, Zone exitZone)
{
Unit unit = factory.getUnit(unitCode, hq, ace);
if (exitZone != null) unit.exitZone = exitZone;
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
index 86d4c32..a9a7a91 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
@@ -4,6 +4,7 @@ import ch.asynk.rustanddust.game.Army;
import ch.asynk.rustanddust.game.Player;
import ch.asynk.rustanddust.game.Zone;
import ch.asynk.rustanddust.game.Unit.UnitCode;
+import ch.asynk.rustanddust.game.Ctrl;
import ch.asynk.rustanddust.game.Factory;
import ch.asynk.rustanddust.ui.Position;
import ch.asynk.rustanddust.engine.Orientation;
@@ -60,21 +61,21 @@ public class BattleTest extends BattleCommon
}
@Override
- protected void deployPlayer()
+ protected void deployPlayer(final Ctrl ctrl)
{
if (currentPlayer.army == Army.US)
- setupUS(currentPlayer);
+ setupUS(ctrl, currentPlayer);
else
- setupGE(currentPlayer);
+ setupGE(ctrl, currentPlayer);
}
- private void setupGE(final Player p)
+ private void setupGE(final Ctrl ctrl, final Player p)
{
- setUnit(map, p, UnitCode.GE_WESPE, 6, 8, Orientation.NORTH, null);
- setUnit(map, p, UnitCode.GE_TIGER, 5, 2, Orientation.NORTH, null);
- setUnit(map, p, UnitCode.GE_PANZER_IV, 4, 5, Orientation.NORTH_WEST, null);
- setUnit(map, p, UnitCode.GE_INFANTRY, 1, 2, Orientation.NORTH_WEST, null);
- setUnit(map, p, UnitCode.GE_KINGTIGER, 1, 1, Orientation.NORTH_WEST, null);
+ setUnit(ctrl, p, UnitCode.GE_WESPE, 6, 8, Orientation.NORTH, null);
+ setUnit(ctrl, p, UnitCode.GE_TIGER, 5, 2, Orientation.NORTH, null);
+ setUnit(ctrl, p, UnitCode.GE_PANZER_IV, 4, 5, Orientation.NORTH_WEST, null);
+ setUnit(ctrl, p, UnitCode.GE_INFANTRY, 1, 2, Orientation.NORTH_WEST, null);
+ setUnit(ctrl, p, UnitCode.GE_KINGTIGER, 1, 1, Orientation.NORTH_WEST, null);
Zone geEntry = new Zone(map, 6);
geEntry.orientation = Orientation.NORTH;
@@ -86,7 +87,7 @@ public class BattleTest extends BattleCommon
addReinforcement(p, geEntry, UnitCode.GE_AT_GUN);
}
- private void setupUS(final Player p)
+ private void setupUS(final Ctrl ctrl, final Player p)
{
usExit = new Zone(map, 9);
usExit.orientation = Orientation.NORTH;
@@ -96,12 +97,12 @@ public class BattleTest extends BattleCommon
addExitZone(usExit);
p.casualty(factory.getUnit(UnitCode.US_SHERMAN, true, false));
- setUnit(map, p, UnitCode.US_PRIEST, 7, 6, Orientation.SOUTH_EAST, usExit);
- setUnit(map, p, UnitCode.US_SHERMAN, 8, 4, Orientation.SOUTH, false, true, usExit);
- setUnit(map, p, UnitCode.US_SHERMAN, 7, 3, Orientation.SOUTH, true, false, usExit);
- setUnit(map, p, UnitCode.US_WOLVERINE, 11, 7, Orientation.SOUTH_EAST, usExit);
- setUnit(map, p, UnitCode.US_PERSHING, 6, 5, Orientation.SOUTH, usExit);
- setUnit(map, p, UnitCode.US_INFANTRY, 5, 3, Orientation.NORTH_EAST, usExit);
- setUnit(map, p, UnitCode.US_AT_GUN, 6, 1, Orientation.SOUTH, usExit);
+ setUnit(ctrl, p, UnitCode.US_PRIEST, 7, 6, Orientation.SOUTH_EAST, usExit);
+ setUnit(ctrl, p, UnitCode.US_SHERMAN, 8, 4, Orientation.SOUTH, false, true, usExit);
+ setUnit(ctrl, p, UnitCode.US_SHERMAN, 7, 3, Orientation.SOUTH, true, false, usExit);
+ setUnit(ctrl, p, UnitCode.US_WOLVERINE, 11, 7, Orientation.SOUTH_EAST, usExit);
+ setUnit(ctrl, p, UnitCode.US_PERSHING, 6, 5, Orientation.SOUTH, usExit);
+ setUnit(ctrl, p, UnitCode.US_INFANTRY, 5, 3, Orientation.NORTH_EAST, usExit);
+ setUnit(ctrl, p, UnitCode.US_AT_GUN, 6, 1, Orientation.SOUTH, usExit);
}
}