diff --git a/Mage.Sets/src/mage/cards/a/AetherCharge.java b/Mage.Sets/src/mage/cards/a/AetherCharge.java index 6563c83d1498..091d0f168c34 100644 --- a/Mage.Sets/src/mage/cards/a/AetherCharge.java +++ b/Mage.Sets/src/mage/cards/a/AetherCharge.java @@ -1,7 +1,5 @@ - package mage.cards.a; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -20,8 +18,9 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetOpponentOrPlaneswalker; +import java.util.UUID; + /** - * * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public final class AetherCharge extends CardImpl { @@ -69,7 +68,7 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.isCreature() && permanent.hasSubtype(SubType.BEAST, game) + if (permanent != null && permanent.isCreature() && permanent.hasSubtype(SubType.BEAST, game) && permanent.isControlledBy(this.controllerId)) { Effect effect = this.getEffects().get(0); effect.setValue("damageSource", event.getTargetId()); diff --git a/Mage.Sets/src/mage/cards/a/AngelicChorus.java b/Mage.Sets/src/mage/cards/a/AngelicChorus.java index 7bf37261066b..e9c789a5553c 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicChorus.java +++ b/Mage.Sets/src/mage/cards/a/AngelicChorus.java @@ -1,7 +1,5 @@ - package mage.cards.a; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; @@ -16,14 +14,15 @@ import mage.game.permanent.Permanent; import mage.players.Player; +import java.util.UUID; + /** - * * @author Backfir3 */ public final class AngelicChorus extends CardImpl { public AngelicChorus(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}"); // Whenever a creature enters the battlefield under your control, you gain life equal to its toughness. this.addAbility(new AngelicChorusTriggeredAbility()); @@ -57,7 +56,8 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.isCreature() + if (permanent != null + && permanent.isCreature() && permanent.isControlledBy(this.controllerId)) { this.getEffects().get(0).setValue("lifeSource", event.getTargetId()); return true; diff --git a/Mage.Sets/src/mage/cards/a/ArchonOfRedemption.java b/Mage.Sets/src/mage/cards/a/ArchonOfRedemption.java index 4107f3f99019..c450ed30746d 100644 --- a/Mage.Sets/src/mage/cards/a/ArchonOfRedemption.java +++ b/Mage.Sets/src/mage/cards/a/ArchonOfRedemption.java @@ -1,7 +1,5 @@ - package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; @@ -16,6 +14,8 @@ import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; +import java.util.UUID; + /** * @author Loki */ @@ -66,7 +66,8 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.isControlledBy(getControllerId()) + if (permanent != null + && permanent.isControlledBy(getControllerId()) && permanent.isCreature() && (permanent.getId().equals(getSourceId()) || (permanent.getAbilities().contains(FlyingAbility.getInstance())))) { diff --git a/Mage.Sets/src/mage/cards/a/AwesomePresence.java b/Mage.Sets/src/mage/cards/a/AwesomePresence.java index f8f3dad61ea2..2d45ef5aedad 100644 --- a/Mage.Sets/src/mage/cards/a/AwesomePresence.java +++ b/Mage.Sets/src/mage/cards/a/AwesomePresence.java @@ -1,29 +1,28 @@ package mage.cards.a; -import java.util.UUID; -import mage.constants.SubType; -import mage.target.common.TargetCreaturePermanent; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.PayCostToAttackBlockEffectImpl; -import mage.abilities.effects.PayCostToAttackBlockEffectImpl.RestrictType; import mage.abilities.effects.common.AttachEffect; -import mage.constants.Outcome; -import mage.target.TargetPermanent; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; /** - * * @author jeffwadsworth */ public final class AwesomePresence extends CardImpl { @@ -63,7 +62,7 @@ public AwesomePresenceRestrictionEffect(ManaCosts manaCosts) { + " can't be blocked " + "unless defending player pays " + (manaCosts == null ? "" : manaCosts.getText() - + " for each creature they control that's blocking it"); + + " for each creature they control that's blocking it"); } public AwesomePresenceRestrictionEffect(AwesomePresenceRestrictionEffect effect) { @@ -77,13 +76,12 @@ public boolean applies(GameEvent event, Ability source, Game game) { Permanent enchantment = game.getPermanent(source.getSourceId()); if (blockingCreature != null && enchantedAttackingCreature != null + && enchantment != null && enchantment.isAttachedTo(enchantedAttackingCreature.getId())) { Player defendingPlayer = game.getPlayer(blockingCreature.getControllerId()); if (defendingPlayer != null) { - if (manaCosts.canPay(source, source.getSourceId(), defendingPlayer.getId(), game) - && manaCosts.pay(source, game, source.getSourceId(), defendingPlayer.getId(), false)) { - return false; - } + return !manaCosts.canPay(source, source.getSourceId(), defendingPlayer.getId(), game) + || !manaCosts.pay(source, game, source.getSourceId(), defendingPlayer.getId(), false); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/Burgeoning.java b/Mage.Sets/src/mage/cards/b/Burgeoning.java index e273d6e36237..c907a81828e4 100644 --- a/Mage.Sets/src/mage/cards/b/Burgeoning.java +++ b/Mage.Sets/src/mage/cards/b/Burgeoning.java @@ -1,7 +1,5 @@ - package mage.cards.b; -import java.util.UUID; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect; import mage.cards.CardImpl; @@ -14,6 +12,8 @@ import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; +import java.util.UUID; + /** * @author duncant */ @@ -54,7 +54,7 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanent(event.getTargetId()); - return game.getOpponents(controllerId).contains(land.getControllerId()); + return land != null && game.getOpponents(controllerId).contains(land.getControllerId()); } @Override diff --git a/Mage.Sets/src/mage/cards/c/CityOfTraitors.java b/Mage.Sets/src/mage/cards/c/CityOfTraitors.java index aa507b2a60d8..39b86b5b1a32 100644 --- a/Mage.Sets/src/mage/cards/c/CityOfTraitors.java +++ b/Mage.Sets/src/mage/cards/c/CityOfTraitors.java @@ -1,8 +1,5 @@ - package mage.cards.c; -import java.util.Objects; -import java.util.UUID; import mage.Mana; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.common.TapSourceCost; @@ -17,14 +14,16 @@ import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; +import java.util.Objects; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class CityOfTraitors extends CardImpl { public CityOfTraitors(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.LAND},""); + super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); // When you play another land, sacrifice City of Traitors. this.addAbility(new CityOfTraitorsTriggeredAbility()); @@ -61,7 +60,8 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanent(event.getTargetId()); - return land.isLand() + return land != null + && land.isLand() && land.isControlledBy(this.controllerId) && !Objects.equals(event.getTargetId(), this.getSourceId()); } diff --git a/Mage.Sets/src/mage/cards/d/DirtcowlWurm.java b/Mage.Sets/src/mage/cards/d/DirtcowlWurm.java index 99beb6611547..fb402a7a6ccb 100644 --- a/Mage.Sets/src/mage/cards/d/DirtcowlWurm.java +++ b/Mage.Sets/src/mage/cards/d/DirtcowlWurm.java @@ -1,7 +1,5 @@ - package mage.cards.d; -import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; @@ -16,14 +14,15 @@ import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; +import java.util.UUID; + /** - * * @author fireshoes */ public final class DirtcowlWurm extends CardImpl { public DirtcowlWurm(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}"); this.subtype.add(SubType.WURM); this.power = new MageInt(3); this.toughness = new MageInt(4); @@ -59,7 +58,7 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanent(event.getTargetId()); - return game.getOpponents(controllerId).contains(land.getControllerId()); + return land != null && game.getOpponents(controllerId).contains(land.getControllerId()); } @Override diff --git a/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java b/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java index b51a555a73a2..ec1d2b26cada 100644 --- a/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java +++ b/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java @@ -1,7 +1,5 @@ - package mage.cards.f; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -11,8 +9,8 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; +import mage.constants.SubType; import mage.constants.Zone; import mage.game.Game; import mage.game.events.EntersTheBattlefieldEvent; @@ -22,14 +20,15 @@ import mage.players.Player; import mage.target.common.TargetAnyTarget; +import java.util.UUID; + /** - * * @author BetaSteward */ public final class FlayerOfTheHatebound extends CardImpl { public FlayerOfTheHatebound(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}"); this.subtype.add(SubType.DEVIL); this.power = new MageInt(4); @@ -71,7 +70,8 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD + if (permanent != null + && ((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD && permanent.isOwnedBy(controllerId) && permanent.isCreature()) { Effect effect = this.getEffects().get(0); diff --git a/Mage.Sets/src/mage/cards/f/FreyalisesWinds.java b/Mage.Sets/src/mage/cards/f/FreyalisesWinds.java index 1c5b0a092208..3065e087af8b 100644 --- a/Mage.Sets/src/mage/cards/f/FreyalisesWinds.java +++ b/Mage.Sets/src/mage/cards/f/FreyalisesWinds.java @@ -1,6 +1,5 @@ package mage.cards.f; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.BecomesTappedTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -9,19 +8,16 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.PhaseStep; -import mage.constants.Zone; +import mage.constants.*; import mage.counters.CounterType; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class FreyalisesWinds extends CardImpl { @@ -73,8 +69,11 @@ public boolean apply(Game game, Ability source) { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent permanentUntapping = game.getPermanent(event.getTargetId()); - permanentUntapping.removeCounters(CounterType.WIND.createInstance(), game); - return true; + if (permanentUntapping != null) { + permanentUntapping.removeCounters(CounterType.WIND.createInstance(), game); + return true; + } + return false; } @Override diff --git a/Mage.Sets/src/mage/cards/j/Jokulmorder.java b/Mage.Sets/src/mage/cards/j/Jokulmorder.java index dfe4138831a0..121acc632a36 100644 --- a/Mage.Sets/src/mage/cards/j/Jokulmorder.java +++ b/Mage.Sets/src/mage/cards/j/Jokulmorder.java @@ -1,4 +1,3 @@ - package mage.cards.j; import mage.MageInt; @@ -27,7 +26,6 @@ import java.util.UUID; /** - * * @author fireshoes */ public final class Jokulmorder extends CardImpl { @@ -85,7 +83,8 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanent(event.getTargetId()); - return land.hasSubtype(SubType.ISLAND, game) + return land != null + && land.hasSubtype(SubType.ISLAND, game) && land.isControlledBy(this.controllerId); } diff --git a/Mage.Sets/src/mage/cards/l/LashknifeBarrier.java b/Mage.Sets/src/mage/cards/l/LashknifeBarrier.java index 994ea460f785..7d7a3538ad04 100644 --- a/Mage.Sets/src/mage/cards/l/LashknifeBarrier.java +++ b/Mage.Sets/src/mage/cards/l/LashknifeBarrier.java @@ -1,7 +1,5 @@ - package mage.cards.l; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -18,15 +16,15 @@ import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; +import java.util.UUID; + /** - * * @author LoneFox - */ public final class LashknifeBarrier extends CardImpl { public LashknifeBarrier(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); // When Lashknife Barrier enters the battlefield, draw a card. this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1))); @@ -79,7 +77,7 @@ public boolean checksEventType(GameEvent event, Game game) { @Override public boolean applies(GameEvent event, Ability source, Game game) { Permanent creature = game.getPermanent(event.getTargetId()); - return creature.isControlledBy(source.getControllerId()); + return creature != null && creature.isControlledBy(source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/r/RoninWarclub.java b/Mage.Sets/src/mage/cards/r/RoninWarclub.java index d3f6624f420a..0d4faf7a7b92 100644 --- a/Mage.Sets/src/mage/cards/r/RoninWarclub.java +++ b/Mage.Sets/src/mage/cards/r/RoninWarclub.java @@ -1,7 +1,5 @@ - package mage.cards.r; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -12,8 +10,8 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; +import mage.constants.SubType; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; @@ -22,23 +20,24 @@ import mage.target.Target; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class RoninWarclub extends CardImpl { public RoninWarclub(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); this.subtype.add(SubType.EQUIPMENT); // Equipped creature gets +2/+1. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 1))); - + // Whenever a creature enters the battlefield under your control, attach Ronin Warclub to that creature. Ability ability = new RoninWarclubTriggeredAbility(); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); - + // Equip {5} ({5}: Attach to target creature you control. Equip only as a sorcery.) this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(5))); } @@ -51,11 +50,11 @@ public RoninWarclub(final RoninWarclub card) { public RoninWarclub copy() { return new RoninWarclub(this); } - + private class RoninWarclubTriggeredAbility extends TriggeredAbilityImpl { public RoninWarclubTriggeredAbility() { - super(Zone.BATTLEFIELD, new RoninWarclubAttachEffect(), false); + super(Zone.BATTLEFIELD, new RoninWarclubAttachEffect(), false); } public RoninWarclubTriggeredAbility(RoninWarclubTriggeredAbility ability) { @@ -70,8 +69,9 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.isCreature() - && (permanent.isControlledBy(this.controllerId))) { + if (permanent != null + && permanent.isCreature() + && permanent.isControlledBy(this.controllerId)) { if (!this.getTargets().isEmpty()) { // remove previous target @@ -94,7 +94,7 @@ public RoninWarclubTriggeredAbility copy() { return new RoninWarclubTriggeredAbility(this); } } - + private static class RoninWarclubAttachEffect extends OneShotEffect { public RoninWarclubAttachEffect() { diff --git a/Mage.Sets/src/mage/cards/s/SilverfurPartisan.java b/Mage.Sets/src/mage/cards/s/SilverfurPartisan.java index 57fe9aff3593..427708d1de9c 100644 --- a/Mage.Sets/src/mage/cards/s/SilverfurPartisan.java +++ b/Mage.Sets/src/mage/cards/s/SilverfurPartisan.java @@ -1,6 +1,7 @@ package mage.cards.s; import mage.MageInt; +import mage.MageObject; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.CreateTokenEffect; @@ -14,14 +15,12 @@ import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.game.permanent.token.WolfToken; -import mage.game.stack.Spell; +import mage.game.stack.StackObject; import mage.target.targetpointer.FixedTarget; + import java.util.UUID; -import mage.MageObject; -import mage.game.stack.StackObject; /** - * * @author fireshoes */ public final class SilverfurPartisan extends CardImpl { @@ -79,8 +78,7 @@ public boolean checkTrigger(GameEvent event, Game game) { && permanent.isControlledBy(this.controllerId) && (permanent.hasSubtype(SubType.WOLF, game) || permanent.hasSubtype(SubType.WEREWOLF, game))) { - if (object instanceof Spell - || object instanceof StackObject) { + if (object instanceof StackObject) { if (object.isInstant() || object.isSorcery()) { if (getTargets().isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/u/UnconventionalTactics.java b/Mage.Sets/src/mage/cards/u/UnconventionalTactics.java index 81b45ca9078d..49c18999add0 100644 --- a/Mage.Sets/src/mage/cards/u/UnconventionalTactics.java +++ b/Mage.Sets/src/mage/cards/u/UnconventionalTactics.java @@ -1,7 +1,5 @@ - package mage.cards.u; -import java.util.UUID; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.Effect; @@ -24,8 +22,9 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author spjspj */ public final class UnconventionalTactics extends CardImpl { @@ -91,12 +90,10 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.isCreature() + return permanent != null + && permanent.isCreature() && permanent.isControlledBy(this.controllerId) - && filter.match(permanent, game)) { - return true; - } - return false; + && filter.match(permanent, game); } @Override diff --git a/Mage.Sets/src/mage/cards/w/WarstormSurge.java b/Mage.Sets/src/mage/cards/w/WarstormSurge.java index 71475721b2d7..747e7ea93bf0 100644 --- a/Mage.Sets/src/mage/cards/w/WarstormSurge.java +++ b/Mage.Sets/src/mage/cards/w/WarstormSurge.java @@ -1,7 +1,5 @@ - package mage.cards.w; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -18,14 +16,15 @@ import mage.players.Player; import mage.target.common.TargetAnyTarget; +import java.util.UUID; + /** - * * @author North */ public final class WarstormSurge extends CardImpl { public WarstormSurge(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{5}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{5}{R}"); // Whenever a creature enters the battlefield under your control, it deals damage equal to its power to any target. Ability ability = new WarstormSurgeTriggeredAbility(); @@ -61,7 +60,8 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.isCreature() + if (permanent != null + && permanent.isCreature() && permanent.isControlledBy(this.controllerId)) { Effect effect = this.getEffects().get(0); effect.setValue("damageSource", event.getTargetId()); diff --git a/Mage/src/main/java/mage/abilities/common/ControllerPlaysLandTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/ControllerPlaysLandTriggeredAbility.java index 252203870dc6..f741ee9feb57 100644 --- a/Mage/src/main/java/mage/abilities/common/ControllerPlaysLandTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/ControllerPlaysLandTriggeredAbility.java @@ -14,7 +14,6 @@ import mage.game.permanent.Permanent; /** - * * @author jeffwadsworth */ public class ControllerPlaysLandTriggeredAbility extends TriggeredAbilityImpl { @@ -35,7 +34,7 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanent(event.getTargetId()); - return land.getControllerId().equals(controllerId); + return land != null && land.getControllerId().equals(controllerId); } @Override diff --git a/Mage/src/main/java/mage/abilities/common/OpponentPlaysLandTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/OpponentPlaysLandTriggeredAbility.java index 7249b6679e4c..d8c7ba42e06c 100644 --- a/Mage/src/main/java/mage/abilities/common/OpponentPlaysLandTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/OpponentPlaysLandTriggeredAbility.java @@ -13,7 +13,6 @@ import mage.game.permanent.Permanent; /** - * * @author jeffwadsworth */ public class OpponentPlaysLandTriggeredAbility extends TriggeredAbilityImpl { @@ -34,7 +33,7 @@ public boolean checkEventType(GameEvent event, Game game) { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanent(event.getTargetId()); - return game.getOpponents(controllerId).contains(land.getControllerId()); + return land != null && game.getOpponents(controllerId).contains(land.getControllerId()); } @Override diff --git a/Mage/src/main/java/mage/abilities/common/TurnedFaceUpAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/TurnedFaceUpAllTriggeredAbility.java index b28e53858339..6b954afe1a9e 100644 --- a/Mage/src/main/java/mage/abilities/common/TurnedFaceUpAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/TurnedFaceUpAllTriggeredAbility.java @@ -1,5 +1,3 @@ - - package mage.abilities.common; import mage.MageObject; @@ -14,7 +12,6 @@ import mage.target.targetpointer.FixedTarget; /** - * * @author LevelX2 */ @@ -27,7 +24,7 @@ public TurnedFaceUpAllTriggeredAbility(Effect effect, FilterPermanent filter) { this(effect, filter, false); } - public TurnedFaceUpAllTriggeredAbility(Effect effect, FilterPermanent filter, boolean setTargetPointer) { + public TurnedFaceUpAllTriggeredAbility(Effect effect, FilterPermanent filter, boolean setTargetPointer) { this(Zone.BATTLEFIELD, effect, filter, setTargetPointer, false); } @@ -60,7 +57,7 @@ public boolean checkTrigger(GameEvent event, Game game) { if (!event.getTargetId().equals(getSourceId())) { MageObject sourceObj = this.getSourceObject(game); if (sourceObj != null) { - if (sourceObj instanceof Card && ((Card)sourceObj).isFaceDown(game)) { + if (sourceObj instanceof Card && ((Card) sourceObj).isFaceDown(game)) { // if face down and it's not itself that is turned face up, it does not trigger return false; } @@ -70,9 +67,9 @@ public boolean checkTrigger(GameEvent event, Game game) { } } Permanent permanent = game.getPermanent(event.getTargetId()); - if (filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { if (setTargetPointer) { - for (Effect effect: getEffects()) { + for (Effect effect : getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); } }