summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java37
1 files changed, 31 insertions, 6 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java
index 4a2c403..bc44fd9 100644
--- a/core/src/ch/asynk/rustanddust/game/Ctrl.java
+++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java
@@ -112,12 +112,24 @@ public abstract class Ctrl implements Disposable
setState(battle.getState());
- if (!synched) {
- map.prepareReplayLastAction();
- setState(StateType.REPLAY);
- } else {
- this.hud.notify(battle.toString(), 2, Position.MIDDLE_CENTER, false);
+ switch(game.config.loadMode) {
+ case REPLAY_ALL:
+ // TODO REPLAY_ALL
+ break;
+ case REPLAY_LAST:
+ map.prepareReplayLastTurn();
+ setState(StateType.REPLAY);
+ break;
+ case LOAD:
+ if (synched) {
+ this.hud.notify(battle.toString(), 2, Position.MIDDLE_CENTER, false);
+ } else {
+ map.prepareReplayLastAction();
+ setState(StateType.REPLAY);
+ }
+ break;
}
+
}
@Override
@@ -269,8 +281,11 @@ public abstract class Ctrl implements Disposable
nextState = completeAction();
}
- if (stateType == StateType.ANIMATION)
+ if (stateType == StateType.ANIMATION) {
this.blockMap = hud.dialogActive();
+ if (nextState == StateType.REPLAY)
+ completeReplay();
+ }
hud.playerInfo.blockEndOfTurn(nextState != StateType.SELECT);
@@ -328,6 +343,16 @@ public abstract class Ctrl implements Disposable
return nextState;
}
+ private void completeReplay()
+ {
+ StateType nextState = replayState.execute();
+
+ if (nextState == StateType.DONE) {
+ battle.getPlayer().burnDownOneAp();
+ hud.update();
+ }
+ }
+
private State getNextState(StateType nextState)
{
RustAndDust.debug("Ctrl", String.format(" %s -> %s : %s", stateType, nextState, battle.getPlayer()));