Added extra turn attribute to GameState.

This commit is contained in:
LevelX2 2013-09-12 17:18:22 +02:00
parent 09017e7e3a
commit 8e19052d6d
3 changed files with 14 additions and 2 deletions

View file

@ -113,7 +113,7 @@ class ScionOfDarknessEffect extends OneShotEffect<ScionOfDarknessEffect> {
if (you.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
card.putOntoBattlefield(game, Zone.GRAVEYARD, id, you.getId());
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), you.getId());
return true;
}
}

View file

@ -558,10 +558,11 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
//20091005 - 500.7
while (getState().getTurnMods().extraTurn(player.getId())) {
state.setExtraTurn(true);
playTurn(player);
state.setTurnNum(state.getTurnNum() + 1);
}
state.setExtraTurn(false);
player = players.getNext(this);
}
}

View file

@ -97,6 +97,7 @@ public class GameState implements Serializable, Copyable<GameState> {
private Map<UUID, LookedAt> lookedAt = new HashMap<UUID, LookedAt>();
private Battlefield battlefield;
private int turnNum = 1;
private boolean extraTurn = false;
private boolean gameOver;
private boolean paused;
private ContinuousEffects effects;
@ -142,6 +143,7 @@ public class GameState implements Serializable, Copyable<GameState> {
this.lookedAt.putAll(state.lookedAt);
this.battlefield = state.battlefield.copy();
this.turnNum = state.turnNum;
this.extraTurn = state.extraTurn;
this.gameOver = state.gameOver;
this.effects = state.effects.copy();
for (TriggeredAbility trigger: state.triggered) {
@ -349,6 +351,14 @@ public class GameState implements Serializable, Copyable<GameState> {
this.turnNum = turnNum;
}
public boolean isExtraTurn() {
return extraTurn;
}
public void setExtraTurn(boolean extraTurn) {
this.extraTurn = extraTurn;
}
public boolean isGameOver() {
return this.gameOver;
}
@ -612,6 +622,7 @@ public class GameState implements Serializable, Copyable<GameState> {
revealed.clear();
lookedAt.clear();
turnNum = 0;
extraTurn = false;
gameOver = false;
specialActions.clear();
otherAbilities.clear();