diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-12-30 23:31:20 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-12-30 23:31:20 +0100 |
commit | 48656bf850e8ba6fdc7bbeb05ffd4df4406eeda6 (patch) | |
tree | e44ed046fbfc2f69871b625286719e60f5e3bb8e /core | |
parent | ddec3b80f791750cafc7d814a043a73297c44fdd (diff) | |
download | RustAndDust-48656bf850e8ba6fdc7bbeb05ffd4df4406eeda6.zip RustAndDust-48656bf850e8ba6fdc7bbeb05ffd4df4406eeda6.tar.gz |
Battle: add public MapType getMapType();
Diffstat (limited to 'core')
9 files changed, 23 insertions, 41 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Battle.java b/core/src/ch/asynk/tankontank/game/Battle.java index 9f69d4c..7bbd962 100644 --- a/core/src/ch/asynk/tankontank/game/Battle.java +++ b/core/src/ch/asynk/tankontank/game/Battle.java @@ -3,6 +3,7 @@ package ch.asynk.tankontank.game; import ch.asynk.tankontank.game.Zone; import ch.asynk.tankontank.game.Unit; import ch.asynk.tankontank.game.Player; +import ch.asynk.tankontank.game.battles.Factory.MapType; import ch.asynk.tankontank.ui.Position; public interface Battle @@ -15,6 +16,8 @@ public interface Battle public Player opponent(Player player); + public MapType getMapType(); + public Map getMap(); public Player checkVictory(Ctrl ctrl); diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java index cf60324..dd5cb6d 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java @@ -19,6 +19,7 @@ public abstract class BattleCommon implements Battle { protected final static Random random = new Random(); + protected Factory.MapType mapType; protected String name; protected String description; protected Factory factory; @@ -55,6 +56,18 @@ public abstract class BattleCommon implements Battle } @Override + public Factory.MapType getMapType() + { + return mapType; + } + + @Override + public Map getMap() + { + return factory.getMap(mapType); + } + + @Override public Player opponent(Player player) { if (player == usPlayer) diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java b/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java index 646e31d..1c31609 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleCounterAttack.java @@ -16,12 +16,7 @@ public class BattleCounterAttack extends BattleCommon { super(factory); name = "Counterattack"; - } - - @Override - public Map getMap() - { - return factory.getMap(Factory.MapType.MAP_B); + mapType = Factory.MapType.MAP_B; } @Override diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java b/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java index 861e93e..e3436cf 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java @@ -18,13 +18,9 @@ public class BattleFrontalAssault extends BattleCommon { super(factory); name = "Frontal Assault"; + mapType = Factory.MapType.MAP_A; } - @Override - public Map getMap() - { - return factory.getMap(Factory.MapType.MAP_A); - } @Override public Player getPlayer() diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java b/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java index ed25465..0bb6e7e 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java @@ -21,12 +21,7 @@ public class BattleHeadToHead extends BattleCommon super(factory); name = "Head To Head"; firstArmy = ((random.nextInt(2) == 0) ? Army.US : Army.GE); - } - - @Override - public Map getMap() - { - return factory.getMap(Factory.MapType.MAP_A); + mapType = Factory.MapType.MAP_A; } @Override diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleLastStand.java b/core/src/ch/asynk/tankontank/game/battles/BattleLastStand.java index e284ab3..a8b1952 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleLastStand.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleLastStand.java @@ -18,12 +18,7 @@ public class BattleLastStand extends BattleCommon { super(factory); name = "Last Stand"; - } - - @Override - public Map getMap() - { - return factory.getMap(Factory.MapType.MAP_B); + mapType = Factory.MapType.MAP_B; } @Override diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleNightAction.java b/core/src/ch/asynk/tankontank/game/battles/BattleNightAction.java index 8a942e9..ddcb9ae 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleNightAction.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleNightAction.java @@ -19,12 +19,7 @@ public class BattleNightAction extends BattleCommon { super(factory); name = "Night Action"; - } - - @Override - public Map getMap() - { - return factory.getMap(Factory.MapType.MAP_B); + mapType = Factory.MapType.MAP_B; } @Override diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleStabToTheFlank.java b/core/src/ch/asynk/tankontank/game/battles/BattleStabToTheFlank.java index 91d2ced..2f5b7b8 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleStabToTheFlank.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleStabToTheFlank.java @@ -18,12 +18,7 @@ public class BattleStabToTheFlank extends BattleCommon { super(factory); name = "Stab To The Flank"; - } - - @Override - public Map getMap() - { - return factory.getMap(Factory.MapType.MAP_B); + mapType = Factory.MapType.MAP_B; } @Override diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleTest.java b/core/src/ch/asynk/tankontank/game/battles/BattleTest.java index f0128f7..dfaf9fc 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleTest.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleTest.java @@ -18,12 +18,7 @@ public class BattleTest extends BattleCommon { super(factory); name = "*** Test ***"; - } - - @Override - public Map getMap() - { - return factory.getMap(Factory.MapType.MAP_B); + mapType = Factory.MapType.MAP_B; } @Override |