diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-17 17:01:32 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-17 17:01:32 +0100 |
commit | 5b8ce8c14305b4fffe650fc05ede973371709d72 (patch) | |
tree | 9f5504b87092bfb1e56bcccf20c9aeda7063f38a /core | |
parent | 5f5e780e47a6dd041e741b24f9818ee5b9c0d2a9 (diff) | |
download | RustAndDust-5b8ce8c14305b4fffe650fc05ede973371709d72.zip RustAndDust-5b8ce8c14305b4fffe650fc05ede973371709d72.tar.gz |
BattleCommon: remove getPlayer(boolean, boolean) and Army first/second
Diffstat (limited to 'core')
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); |