diff options
Diffstat (limited to 'core/src/ch')
3 files changed, 22 insertions, 21 deletions
diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java index 49e9d8d..eecad83 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java @@ -18,8 +18,6 @@ public abstract class BattleCommon implements Battle protected String name; protected String description; - protected Army firstArmy; - protected Army secondArmy; protected Factory factory; protected ArrayList<EntryPoint> entryPoints = new ArrayList<EntryPoint>(); protected HashMap<Unit, EntryPoint> pawnEntry = new HashMap<Unit, EntryPoint>(); @@ -45,22 +43,6 @@ public abstract class BattleCommon implements Battle return description; } - public void randomizeArmies() - { - if (random.nextInt(2) == 0) { - firstArmy = Army.US; - secondArmy = Army.GE; - } else { - firstArmy = Army.GE; - secondArmy = Army.US; - } - } - - public Player getPlayer(boolean first, boolean deploymentPhase) - { - return factory.getPlayer((first ? firstArmy : secondArmy)); - } - public EntryPoint getEntryPoint(Unit unit) { return pawnEntry.get(unit); diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java b/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java index 4571772..22cb230 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java @@ -19,8 +19,6 @@ public class BattleFrontalAssault extends BattleCommon public BattleFrontalAssault(Factory factory) { super(factory); - firstArmy = Army.GE; - secondArmy = Army.US; name = "Frontal Assault"; } @@ -31,6 +29,12 @@ public class BattleFrontalAssault extends BattleCommon } @Override + public Player getPlayer(boolean first, boolean deploymentPhase) + { + return factory.getPlayer((first ? Army.GE : Army.US)); + } + + @Override public Position getHudPosition(Player player) { return (player.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT); diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java b/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java index 14efe77..7d6286f 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java @@ -16,11 +16,20 @@ import ch.asynk.tankontank.engine.Orientation; public class BattleHeadToHead extends BattleCommon { + private Army firstArmy; + private Army secondArmy; + public BattleHeadToHead(Factory factory) { super(factory); - randomizeArmies(); name = "Head To Head"; + if (random.nextInt(2) == 0) { + firstArmy = Army.US; + secondArmy = Army.GE; + } else { + firstArmy = Army.GE; + secondArmy = Army.US; + } } @Override @@ -30,6 +39,12 @@ public class BattleHeadToHead extends BattleCommon } @Override + public Player getPlayer(boolean first, boolean deploymentPhase) + { + return factory.getPlayer((first ? firstArmy : secondArmy)); + } + + @Override public Position getHudPosition(Player player) { return (player.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT); |