* Fixed a bug of spell copy that caused that added spliced spells were not copied.

This commit is contained in:
LevelX2 2016-02-14 13:42:46 +01:00
parent 1835671f3d
commit 6726f48669
25 changed files with 198 additions and 199 deletions

View file

@ -139,10 +139,8 @@ public class Spell extends StackObjImpl implements Card {
payNoMana |= spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE);
if (ignoreAbility) {
ignoreAbility = false;
} else {
if (!spellAbility.activate(game, payNoMana)) {
return false;
}
} else if (!spellAbility.activate(game, payNoMana)) {
return false;
}
}
return true;
@ -630,9 +628,21 @@ public class Spell extends StackObjImpl implements Card {
return new Spell(this);
}
public Spell copySpell() {
// replaced card.copy by copy (card content should no longer be changed)
return new Spell(this.card, this.ability.copySpell(), this.controllerId, this.fromZone);
public Spell copySpell(UUID newController) {
Spell copy = new Spell(this.card, this.ability.copySpell(), this.controllerId, this.fromZone);
boolean firstDone = false;
for (SpellAbility spellAbility : this.getSpellAbilities()) {
if (!firstDone) {
firstDone = true;
continue;
}
SpellAbility newAbility = spellAbility.copy(); // e.g. spliced spell
newAbility.newId();
copy.addSpellAbility(newAbility);
}
copy.setCopy(true);
copy.setControllerId(newController);
return copy;
}
@Override