summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-09 16:38:34 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-09 16:38:34 +0100
commit287f4591ce83aaaec4ab7e5bcca61964a1403dcc (patch)
treeca7c1a4f724861ecbe18f171555f68a3571e102d /core/src/ch/asynk
parent4b49e456ef6e98127c953ff67c5d71f40c571f02 (diff)
downloadRustAndDust-287f4591ce83aaaec4ab7e5bcca61964a1403dcc.zip
RustAndDust-287f4591ce83aaaec4ab7e5bcca61964a1403dcc.tar.gz
Battle: use getWinner() and getNextPlayer()
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/rustanddust/game/Battle.java2
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java11
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleTest.java2
3 files changed, 10 insertions, 5 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Battle.java b/core/src/ch/asynk/rustanddust/game/Battle.java
index 86d95a7..c54f9f4 100644
--- a/core/src/ch/asynk/rustanddust/game/Battle.java
+++ b/core/src/ch/asynk/rustanddust/game/Battle.java
@@ -21,8 +21,6 @@ public interface Battle
public void start();
- public Player getVictor();
-
public boolean actionDone();
public boolean turnDone();
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
index 0cc2189..e84961f 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
@@ -31,6 +31,8 @@ public abstract class BattleCommon implements Battle
protected HashMap<Unit, Zone> unitEntry = new HashMap<Unit, Zone>();
protected HashMap<Unit, Zone> unitExit = new HashMap<Unit, Zone>();
+ public abstract Player getWinner();
+
public BattleCommon(Factory factory)
{
this.factory = factory;
@@ -85,17 +87,22 @@ public abstract class BattleCommon implements Battle
{
map.turnDone();
currentPlayer.turnEnd();
- Player winner = getVictor();
+ Player winner = getWinner();
if (winner != null) {
currentPlayer = winner;
return true;
} else {
- currentPlayer = getOpponent();
+ currentPlayer = getNextPlayer();
currentPlayer.turnStart();
return false;
}
}
+ public Player getNextPlayer()
+ {
+ return getOpponent();
+ }
+
@Override
public Player getPlayer()
{
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
index f161a36..fc6f453 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
@@ -37,7 +37,7 @@ public class BattleTest extends BattleCommon
}
@Override
- public Player getVictor()
+ public Player getWinner()
{
if (usPlayer.getTurnDone() > 2)
return usPlayer;