summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-01-31 00:31:54 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-01-31 00:31:54 +0100
commita3e290c95be3a6201ad7c16a88e15719399a1144 (patch)
tree1032c153a34709ef440f9f2d1bcf544a75049f76
parent94d0faf3bd5736acb4b14d135c03464424905484 (diff)
downloadRustAndDust-a3e290c95be3a6201ad7c16a88e15719399a1144.zip
RustAndDust-a3e290c95be3a6201ad7c16a88e15719399a1144.tar.gz
Battle: code reorder
-rw-r--r--core/src/ch/asynk/rustanddust/game/Battle.java4
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java52
2 files changed, 26 insertions, 30 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Battle.java b/core/src/ch/asynk/rustanddust/game/Battle.java
index 03316bd..6101b37 100644
--- a/core/src/ch/asynk/rustanddust/game/Battle.java
+++ b/core/src/ch/asynk/rustanddust/game/Battle.java
@@ -13,14 +13,14 @@ public interface Battle
public MapType getMapType();
+ public Position getHudPosition();
+
public void setPlayerIds(int a, int b);
public Player getPlayer();
public Player getOpponent();
- public Position getHudPosition();
-
public void init(Ctrl ctrl);
public boolean actionDone();
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
index ab7bca4..a6a5c50 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
@@ -106,14 +106,14 @@ public abstract class BattleCommon implements Battle
this.currentPlayer = this.usPlayer;
setupUS();
map.actionDone();
- currentPlayer.turnEnd();
map.turnDone();
+ currentPlayer.turnEnd();
this.currentPlayer = this.gePlayer;
setupGE();
map.actionDone();
- currentPlayer.turnEnd();
map.turnDone();
+ currentPlayer.turnEnd();
this.currentPlayer = getFirstPlayer();
}
@@ -128,6 +128,22 @@ public abstract class BattleCommon implements Battle
return burn;
}
+ @Override
+ public boolean turnDone()
+ {
+ map.turnDone();
+ currentPlayer.turnEnd();
+ Player winner = getWinner();
+ if (winner != null) {
+ currentPlayer = winner;
+ return true;
+ } else {
+ currentPlayer = getOpponent();
+ currentPlayer.turnStart(getActionPoints());
+ return false;
+ }
+ }
+
protected boolean turnDoneForBoth()
{
return ((currentPlayer.getTurn() > 0) && (currentPlayer.getTurn() == getOpponent().getTurn()));
@@ -157,26 +173,6 @@ public abstract class BattleCommon implements Battle
return null;
}
- @Override
- public boolean turnDone()
- {
- map.turnDone();
- currentPlayer.turnEnd();
- Player winner = getWinner();
- if (winner != null) {
- currentPlayer = winner;
- return true;
- } else {
- currentPlayer = getNextPlayer();
- currentPlayer.turnStart(getActionPoints());
- return false;
- }
- }
-
- protected Player getNextPlayer()
- {
- return getOpponent();
- }
public void setPlayerIds(int a, int b)
{
@@ -203,17 +199,17 @@ public abstract class BattleCommon implements Battle
}
@Override
- public StateType getState()
+ public boolean hasReinforcement()
{
- if (!currentPlayer.isDeploymentDone())
- return StateType.DEPLOYMENT;
- return StateType.SELECT;
+ return false;
}
@Override
- public boolean hasReinforcement()
+ public StateType getState()
{
- return false;
+ if (!currentPlayer.isDeploymentDone())
+ return StateType.DEPLOYMENT;
+ return StateType.SELECT;
}
@Override