* Neightveil Spector - Fixed a bug that casting with the Spector exiled Enchantment Auras were not handled correctly.

This commit is contained in:
LevelX2 2014-04-07 00:03:41 +02:00
parent 126d628d63
commit f77e709f6b
3 changed files with 11 additions and 2 deletions

View file

@ -70,7 +70,7 @@ public class EtherealArmor extends CardImpl<EtherealArmor> {
this.color.setWhite(true); this.color.setWhite(true);
// Enchant creature // Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent(); TargetPermanent auraTarget = new TargetCreaturePermanent(true);
this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());

View file

@ -44,6 +44,7 @@ import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import java.util.UUID; import java.util.UUID;
import mage.game.stack.Spell;
/** /**
* Cards with the Aura subtype don't change the zone they are in, if there is no * Cards with the Aura subtype don't change the zone they are in, if there is no
@ -89,12 +90,20 @@ public class AuraReplacementEffect extends ReplacementEffectImpl<AuraReplacement
UUID targetId = null; UUID targetId = null;
MageObject sourceObject = game.getObject(sourceId); MageObject sourceObject = game.getObject(sourceId);
if (sourceObject instanceof Spell) {
if (fromZone.equals(Zone.EXILED)) {
// cast from exile (e.g. Neightveil Spector) -> no replacement
return false;
}
}
if (sourceObject instanceof StackAbility) { if (sourceObject instanceof StackAbility) {
StackAbility stackAbility = (StackAbility) sourceObject; StackAbility stackAbility = (StackAbility) sourceObject;
if (!stackAbility.getEffects().isEmpty()) { if (!stackAbility.getEffects().isEmpty()) {
targetId = stackAbility.getEffects().get(0).getTargetPointer().getFirst(game, stackAbility); targetId = stackAbility.getEffects().get(0).getTargetPointer().getFirst(game, stackAbility);
} }
} }
if (targetId == null) { if (targetId == null) {
Target target = card.getSpellAbility().getTargets().get(0); Target target = card.getSpellAbility().getTargets().get(0);
Player player = game.getPlayer(card.getOwnerId()); Player player = game.getPlayer(card.getOwnerId());

View file

@ -107,7 +107,7 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
this.spellCards.add(spellCard.copy()); this.spellCards.add(spellCard.copy());
} }
if (spell.spellAbilities.get(0).equals(spell.ability)) { if (spell.spellAbilities.get(0).equals(spell.ability)) {
this.ability = spellAbilities.get(0); this.ability = this.spellAbilities.get(0);
} else { } else {
this.ability = spell.ability.copy(); this.ability = spell.ability.copy();
} }