fixed Nivmagus Elemental being able to infinitely exile copied spells (fixes #4092)

This commit is contained in:
Evan Kranzler 2017-10-10 16:23:03 -04:00
parent bef2137443
commit 80f21132eb
2 changed files with 12 additions and 8 deletions

View file

@ -57,20 +57,19 @@ public class NivmagusElemental extends CardImpl {
static { static {
filter.add(new ControllerPredicate(TargetController.YOU)); filter.add(new ControllerPredicate(TargetController.YOU));
filter.add(Predicates.or( filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY))); new CardTypePredicate(CardType.SORCERY)));
} }
public NivmagusElemental(UUID ownerId, CardSetInfo setInfo) { public NivmagusElemental(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{U/R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U/R}");
this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// Exile an instant or sorcery spell you control: Put two +1/+1 counters on Nivmagus Elemental. (That spell won't resolve.) // Exile an instant or sorcery spell you control: Put two +1/+1 counters on Nivmagus Elemental. (That spell won't resolve.)
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)),new ExileFromStackCost(new TargetSpell(filter))); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), new ExileFromStackCost(new TargetSpell(filter)));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -61,10 +61,15 @@ public class ExileFromStackCost extends CostImpl {
if (spellToExile == null) { if (spellToExile == null) {
return false; return false;
} }
spellToExile.moveToExile(null, "", ability.getSourceId(), game); String spellName = spellToExile.getName();
if (spellToExile.isCopy()) {
game.getStack().remove(spellToExile);
} else {
spellToExile.moveToExile(null, "", ability.getSourceId(), game);
}
paid = true; paid = true;
if (!game.isSimulation()) { if (!game.isSimulation()) {
game.informPlayers(player.getLogName() + " exiles " + spellToExile.getName() + " (as costs)"); game.informPlayers(player.getLogName() + " exiles " + spellName + " (as costs)");
} }
} }
} }