summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/game/battles
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-15 11:52:34 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-15 11:52:34 +0100
commit449f45bb28524af653d7bd646eb98522793837c7 (patch)
tree2a50f5203480d83b12d38204751a2bbe6034ddb0 /core/src/ch/asynk/rustanddust/game/battles
parentbe277ec213266c749296a41aeab45bcdeba2b1b3 (diff)
downloadRustAndDust-449f45bb28524af653d7bd646eb98522793837c7.zip
RustAndDust-449f45bb28524af653d7bd646eb98522793837c7.tar.gz
Unit: 'add boolean hq' attribute, get rid of setAce()
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/battles')
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java13
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleTest.java13
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/Factory.java36
3 files changed, 25 insertions, 37 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
index 5d97460..c103ca8 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
@@ -176,23 +176,22 @@ public abstract class BattleCommon implements Battle
public void addReinforcement(Player player, Zone entryZone, UnitId unitId)
{
- addReinforcement(player, entryZone, unitId, false);
+ addReinforcement(player, entryZone, unitId, false, false);
}
public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId)
{
- addReinforcement(player, entryZone, exitZone, unitId, false);
+ addReinforcement(player, entryZone, exitZone, unitId, false, false);
}
- public void addReinforcement(Player player, Zone entryZone, UnitId unitId, boolean ace)
+ public void addReinforcement(Player player, Zone entryZone, UnitId unitId, boolean hq, boolean ace)
{
- addReinforcement(player, entryZone, null, unitId, ace);
+ addReinforcement(player, entryZone, null, unitId, hq, ace);
}
- public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId, boolean ace)
+ public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId, boolean hq, boolean ace)
{
- Unit unit = factory.getUnit(unitId);
- unit.setAce(ace);
+ Unit unit = factory.getUnit(unitId, hq, ace);
player.addReinforcement(unit);
unitEntry.put(unit, entryZone);
if (exitZone != null)
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
index fc6f453..4772d9d 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
@@ -95,10 +95,10 @@ public class BattleTest extends BattleCommon
addExitZone(usExit);
currentPlayer = usPlayer;
- usPlayer.casualty(factory.getUnit(UnitId.US_SHERMAN_HQ));
+ usPlayer.casualty(factory.getUnit(UnitId.US_SHERMAN, true, false));
setUnit(map, usPlayer, UnitId.US_PRIEST, 7, 6, Orientation.SOUTH_EAST, usExit);
- setUnit(map, usPlayer, UnitId.US_SHERMAN, 8, 4, Orientation.SOUTH, true, usExit);
- setUnit(map, usPlayer, UnitId.US_SHERMAN_HQ, 7, 3, Orientation.SOUTH, usExit);
+ setUnit(map, usPlayer, UnitId.US_SHERMAN, 8, 4, Orientation.SOUTH, false, true, usExit);
+ setUnit(map, usPlayer, UnitId.US_SHERMAN, 7, 3, Orientation.SOUTH, true, false, usExit);
setUnit(map, usPlayer, UnitId.US_WOLVERINE, 11, 7, Orientation.SOUTH_EAST, usExit);
setUnit(map, usPlayer, UnitId.US_PERSHING, 6, 5, Orientation.SOUTH, usExit);
setUnit(map, usPlayer, UnitId.US_INFANTRY, 5, 3, Orientation.NORTH_EAST, usExit);
@@ -109,13 +109,12 @@ public class BattleTest extends BattleCommon
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);
+ return setUnit(map, player, unitId, col, row, orientation, false, false, exitZone);
}
- private Unit setUnit(Map map, Player player, UnitId unitId, int col, int row, Orientation orientation, boolean ace, Zone exitZone)
+ private Unit setUnit(Map map, Player player, UnitId unitId, int col, int row, Orientation orientation, boolean hq, boolean ace, Zone exitZone)
{
- Unit u = factory.getUnit(unitId);
- u.setAce(ace);
+ Unit u = factory.getUnit(unitId, hq, ace);
if (exitZone != null)
unitExit.put(u, exitZone);
map.setOnBoard(u, map.getHex(col, row), orientation);
diff --git a/core/src/ch/asynk/rustanddust/game/battles/Factory.java b/core/src/ch/asynk/rustanddust/game/battles/Factory.java
index 3203c3c..5dff7f6 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/Factory.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/Factory.java
@@ -86,62 +86,52 @@ public class Factory implements Board.TileBuilder, Disposable
return new Player(game, Army.GE, 10);
}
- public Unit getUnit(UnitId id)
+ public Unit getUnit(UnitId id, boolean hq, boolean ace)
{
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);
+ u = new Unit(Army.GE, id, ut, hq, ace, 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);
+ u = new Unit(Army.GE, id, ut, hq, ace, 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);
+ u = new Unit(Army.GE, id, ut, hq, ace, 3, 12, -1, 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);
+ u = new Unit(Army.GE, id, ut, hq, ace, 2, 9, -1, 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);
+ u = new Unit(Army.GE, id, ut, hq, ace, 3, 11, -1, 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);
+ u = new Unit(Army.GE, id, ut, hq, ace, 5, 8, -1, 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);
+ u = new Unit(Army.US, id, ut, hq, ace, 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);
+ u = new Unit(Army.US, id, ut, hq, ace, 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);
+ u = new Unit(Army.US, id, ut, hq, ace, 3, 10, -1, 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);
+ u = new Unit(Army.US, id, ut, hq, ace, 5, 8, -1, 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);
+ u = new Unit(Army.US, id, ut, hq, ace, 2, 9, -1, 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);
+ u = new Unit(Army.US, id, ut, hq, ace, 3, 8, -1, 3, "us-wolverine", "us-head", pawnsAtlas, pawnOverlaysAtlas);
break;
}