summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r--core/src/ch/asynk/rustanddust/game/Battle.java11
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java6
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java6
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleTest.java13
4 files changed, 14 insertions, 22 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Battle.java b/core/src/ch/asynk/rustanddust/game/Battle.java
index abf91db..7cd3b37 100644
--- a/core/src/ch/asynk/rustanddust/game/Battle.java
+++ b/core/src/ch/asynk/rustanddust/game/Battle.java
@@ -1,10 +1,7 @@
package ch.asynk.rustanddust.game;
-import ch.asynk.rustanddust.game.Zone;
-import ch.asynk.rustanddust.game.Unit;
-import ch.asynk.rustanddust.game.Player;
-import ch.asynk.rustanddust.game.battles.Factory.MapType;
import ch.asynk.rustanddust.ui.Position;
+import ch.asynk.rustanddust.game.battles.Factory.MapType;
public interface Battle
{
@@ -20,9 +17,9 @@ public interface Battle
public void changePlayer();
- public Player checkVictory(Ctrl ctrl);
+ public Player getVictor();
- public boolean getReinforcement(Ctrl ctrl);
+ public boolean hasReinforcement();
public Zone getEntryZone(Unit unit);
@@ -34,5 +31,5 @@ public interface Battle
public boolean deploymentDone();
- public Map setup(Ctrl ctrl);
+ public Map setup();
}
diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java
index 807abe8..f389d2d 100644
--- a/core/src/ch/asynk/rustanddust/game/Ctrl.java
+++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java
@@ -57,7 +57,7 @@ public class Ctrl implements Disposable
this.cfg = game.config;
game.ctrl = this;
- this.map = battle.setup(this);
+ this.map = battle.setup();
this.selectState = new StateSelect();
this.pathState = new StateMove();
@@ -114,7 +114,7 @@ public class Ctrl implements Disposable
{
battle.getPlayer().turnStart();
// hud.notify(battle.getPlayer().getName() + "'s turn", 2, Position.MIDDLE_CENTER, true);
- if (battle.getReinforcement(this))
+ if (battle.hasReinforcement())
hud.notify("You have reinforcement", 2, Position.MIDDLE_CENTER, true);
hud.update();
setState(battle.getState());
@@ -123,7 +123,7 @@ public class Ctrl implements Disposable
private void endPlayerTurn()
{
battle.getPlayer().turnEnd();
- Player winner = battle.checkVictory(this);
+ Player winner = battle.getVictor();
if (winner != null)
hud.victory(winner, ((winner == battle.getPlayer()) ? battle.getOpponent() : battle.getPlayer()));
}
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
index 9292095..10534c8 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
@@ -7,11 +7,9 @@ import java.util.ArrayList;
import ch.asynk.rustanddust.game.Army;
import ch.asynk.rustanddust.game.Battle;
import ch.asynk.rustanddust.game.Player;
-import ch.asynk.rustanddust.game.Ctrl;
import ch.asynk.rustanddust.game.Map;
import ch.asynk.rustanddust.game.Zone;
import ch.asynk.rustanddust.game.Hex;
-import ch.asynk.rustanddust.game.HexSet;
import ch.asynk.rustanddust.game.Unit;
import ch.asynk.rustanddust.game.Unit.UnitId;
import ch.asynk.rustanddust.game.State.StateType;
@@ -63,7 +61,7 @@ public abstract class BattleCommon implements Battle
}
@Override
- public Map setup(Ctrl ctrl)
+ public Map setup()
{
this.map = factory.getMap(mapType);
this.usPlayer = factory.getPlayer(Army.US);
@@ -105,7 +103,7 @@ public abstract class BattleCommon implements Battle
}
@Override
- public boolean getReinforcement(Ctrl ctrl)
+ public boolean hasReinforcement()
{
return false;
}
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
index 1532efd..b9b6333 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
@@ -2,10 +2,7 @@ package ch.asynk.rustanddust.game.battles;
import ch.asynk.rustanddust.game.Army;
import ch.asynk.rustanddust.game.Player;
-import ch.asynk.rustanddust.game.Ctrl;
import ch.asynk.rustanddust.game.Map;
-import ch.asynk.rustanddust.game.Hex;
-import ch.asynk.rustanddust.game.HexSet;
import ch.asynk.rustanddust.game.Zone;
import ch.asynk.rustanddust.game.Unit;
import ch.asynk.rustanddust.game.Unit.UnitId;
@@ -30,15 +27,15 @@ public class BattleTest extends BattleCommon
}
@Override
- public Player checkVictory(Ctrl ctrl)
+ public Player getVictor()
{
if (usPlayer.getTurnDone() > 2)
- return usPlayer;
+ return usPlayer;
return null;
}
@Override
- public boolean getReinforcement(Ctrl ctrl)
+ public boolean hasReinforcement()
{
if (currentPlayer.is(Army.GE))
return false;
@@ -55,9 +52,9 @@ public class BattleTest extends BattleCommon
}
@Override
- public Map setup(Ctrl ctrl)
+ public Map setup()
{
- super.setup(ctrl);
+ super.setup();
map.addObjective(5, 2, Army.NONE);
map.addHoldObjective(5, 3, Army.NONE);