diff --git a/Mage.Sets/src/mage/cards/i/InvaderParasite.java b/Mage.Sets/src/mage/cards/i/InvaderParasite.java index 87754e3d489..9f9197a62b7 100644 --- a/Mage.Sets/src/mage/cards/i/InvaderParasite.java +++ b/Mage.Sets/src/mage/cards/i/InvaderParasite.java @@ -54,15 +54,18 @@ import mage.target.targetpointer.FixedTarget; public class InvaderParasite extends CardImpl { public InvaderParasite(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); this.subtype.add("Insect"); this.power = new MageInt(3); this.toughness = new MageInt(2); + // Imprint - When Invader Parasite enters the battlefield, exile target land. Ability ability = new EntersBattlefieldTriggeredAbility(new InvaderParasiteImprintEffect(), false); ability.addTarget(new TargetLandPermanent()); this.addAbility(ability); + + // Whenever a land with the same name as the exiled card enters the battlefield under an opponent's control, Invader Parasite deals 2 damage to that player. this.addAbility(new InvaderParasiteTriggeredAbility()); } @@ -77,6 +80,7 @@ public class InvaderParasite extends CardImpl { } class InvaderParasiteImprintEffect extends OneShotEffect { + InvaderParasiteImprintEffect() { super(Outcome.Exile); staticText = "exile target land"; @@ -104,6 +108,7 @@ class InvaderParasiteImprintEffect extends OneShotEffect { } class InvaderParasiteTriggeredAbility extends TriggeredAbilityImpl { + InvaderParasiteTriggeredAbility() { super(Zone.BATTLEFIELD, new DamageTargetEffect(2)); } @@ -125,12 +130,12 @@ class InvaderParasiteTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { - Permanent p = game.getPermanent(event.getTargetId()); + Permanent targetPermanent = game.getPermanent(event.getTargetId()); Permanent sourcePermanent = game.getPermanent(getSourceId()); - if (p != null && sourcePermanent != null) { + if (targetPermanent != null && sourcePermanent != null) { if (sourcePermanent.getImprinted().size() > 0) { Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0)); - if (p.getName().equals(imprintedCard.getName())) { + if (imprintedCard != null && targetPermanent.getName().equals(imprintedCard.getName())) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } diff --git a/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java b/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java index 989b558f609..80812218084 100644 --- a/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java @@ -29,6 +29,8 @@ package mage.abilities.mana; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import mage.Mana; import mage.abilities.Abilities; import mage.abilities.Ability; @@ -161,6 +163,7 @@ class AnyColorLandsProduceManaEffect extends ManaEffect { } private Mana getManaTypes(Game game, Ability source) { + Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "needed to identify endless loop causing cards: {0}", source.getSourceObject(game).getName()); List lands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); Mana types = new Mana(); for (Permanent land : lands) { diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 5208ed7ad28..4b6c31e4ad4 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -3293,6 +3293,9 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) { + if (card == null) { + return false; + } boolean result = false; // Zone fromZone = game.getState().getZone(card.getId()); if (card.moveToZone(Zone.GRAVEYARD, sourceId, game, fromZone != null ? fromZone == Zone.BATTLEFIELD : false)) { @@ -3317,6 +3320,9 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName) { + if (card == null) { + return false; + } boolean result = false; if (card.moveToZone(Zone.LIBRARY, sourceId, game, toTop)) { if (!game.isSimulation()) { @@ -3346,6 +3352,9 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone, boolean withName) { + if (card == null) { + return false; + } boolean result = false; if (card.moveToExile(exileId, exileName, sourceId, game)) { if (!game.isSimulation()) {