* Fixed that player turn counter was not reset if game was reset (e.g. Karn Liberated).

This commit is contained in:
LevelX2 2014-05-10 18:21:22 +02:00
parent 8e56d06121
commit e93cd580dd
2 changed files with 7 additions and 1 deletions

View file

@ -85,7 +85,7 @@ class CantCastSerraAvengerEffect extends ReplacementEffectImpl<CantCastSerraAven
public CantCastSerraAvengerEffect() { public CantCastSerraAvengerEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment); super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "You can't cast Serra Avenger during your first, second, or third turns of the game"; staticText = "You can't cast {this} during your first, second, or third turns of the game";
} }
public CantCastSerraAvengerEffect(final CantCastSerraAvengerEffect effect) { public CantCastSerraAvengerEffect(final CantCastSerraAvengerEffect effect) {
@ -115,6 +115,7 @@ class CantCastSerraAvengerEffect extends ReplacementEffectImpl<CantCastSerraAven
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) { if (event.getType() == EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
// it can be cast on other players turn 1 - 3 if some effect let allow you to do this
if (controller != null && controller.getTurns() <= 3 && game.getActivePlayerId().equals(source.getControllerId())) { if (controller != null && controller.getTurns() <= 3 && game.getActivePlayerId().equals(source.getControllerId())) {
return true; return true;
} }

View file

@ -336,6 +336,10 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
} }
} }
/**
* Cast e.g. from Karn Liberated to restart the current game
* @param game
*/
@Override @Override
public void init(Game game) { public void init(Game game) {
init(game, false); init(game, false);
@ -359,6 +363,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
this.timerTimeout = false; this.timerTimeout = false;
this.idleTimeout = false; this.idleTimeout = false;
this.turns = 0;
this.passed = false; this.passed = false;
this.passedTurn = false; this.passedTurn = false;
this.passedAllTurns = false; this.passedAllTurns = false;