Awesome bug fix (3h of debuging): 1. ReboundEffect was copied by Ascension. 2. Copied spells moved original spell to grave that caused later wrong changeZone event with from=GRAVEYARD to=GRAVEYARD instead of from=STACK to=GRAVEYARD.

This commit is contained in:
magenoxx 2011-05-20 21:02:29 +04:00
parent e1aa3c0587
commit 267ae4f559
3 changed files with 33 additions and 10 deletions

View file

@ -61,6 +61,7 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
private Card card;
private SpellAbility ability;
private UUID controllerId;
private boolean copiedSpell;
public Spell(Card card, SpellAbility ability, UUID controllerId) {
this.card = card;
@ -85,14 +86,18 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
else
result = true;
if (ability.getEffects().contains(ExileSpellEffect.getInstance()))
game.getExile().getPermanentExile().add(card);
else if (ability.getEffects().contains(ShuffleSpellEffect.getInstance())) {
card.moveToZone(Zone.LIBRARY, ability.getId(), game, false);
Player player = game.getPlayer(controllerId);
if (player != null) player.shuffleLibrary(game);
} else
card.moveToZone(Zone.GRAVEYARD, ability.getId(), game, false);
if (!copiedSpell) {
if (ability.getEffects().contains(ExileSpellEffect.getInstance()))
game.getExile().getPermanentExile().add(card);
else if (ability.getEffects().contains(ShuffleSpellEffect.getInstance())) {
card.moveToZone(Zone.LIBRARY, ability.getId(), game, false);
Player player = game.getPlayer(controllerId);
if (player != null) player.shuffleLibrary(game);
} else {
card.moveToZone(Zone.GRAVEYARD, ability.getId(), game, false);
}
}
return result;
}
//20091005 - 608.2b
@ -344,5 +349,9 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
public void assignNewId() {
throw new UnsupportedOperationException("Unsupported operation");
}
public void setCopiedSpell(boolean isCopied) {
this.copiedSpell = isCopied;
}
}