Fixed bug #187 were targets in graveyard got illegal (happens only in games vs. AI). Bug was caused by zoneChangeCounter increased by AI simulation.

This commit is contained in:
LevelX2 2013-04-06 16:53:51 +02:00
parent 6a4a3923a6
commit d473796373
3 changed files with 7 additions and 6 deletions

View file

@ -62,7 +62,7 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect<ReturnF
if (card != null) {
Player player = game.getPlayer(card.getOwnerId());
if (player != null) {
card.moveToZone(Zone.HAND, source.getId(), game, false);
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
return true;
}
}

View file

@ -118,7 +118,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
secondSideCard = card.secondSideCard;
nightCard = card.nightCard;
}
zoneChangeCounter = card.zoneChangeCounter;
if (card.info != null) {
info = new HashMap<String, String>();
info.putAll(card.info);

View file

@ -173,10 +173,11 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
this.attackOption = game.attackOption;
this.state = game.state.copy();
// Issue 350
this.gameCards = game.gameCards;
// for (Map.Entry<UUID, Card> entry: game.gameCards.entrySet()) {
// this.gameCards.put(entry.getKey(), entry.getValue().copy());
// }
// this.gameCards = game.gameCards;
// issue #187 (else zoneChangeCounter modified by AI -> illegal target)
for (Map.Entry<UUID, Card> entry: game.gameCards.entrySet()) {
this.gameCards.put(entry.getKey(), entry.getValue().copy());
}
this.simulation = game.simulation;
this.gameOptions = game.gameOptions;
this.lki.putAll(game.lki);