From 2832cb9335dc664da864222f309bff0d33474075 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 4 May 2017 10:26:34 +0200 Subject: [PATCH] * Some minor changes to Misfortune's Gain and Path of Peace. --- .../src/mage/cards/m/MisfortunesGain.java | 25 ++++++++++--------- Mage.Sets/src/mage/cards/p/PathOfPeace.java | 25 ++++++++++--------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/Mage.Sets/src/mage/cards/m/MisfortunesGain.java b/Mage.Sets/src/mage/cards/m/MisfortunesGain.java index f9440cee85..c7f9048371 100644 --- a/Mage.Sets/src/mage/cards/m/MisfortunesGain.java +++ b/Mage.Sets/src/mage/cards/m/MisfortunesGain.java @@ -33,8 +33,8 @@ import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.game.Game; import mage.constants.Outcome; +import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; @@ -47,10 +47,9 @@ public class MisfortunesGain extends CardImpl { public MisfortunesGain(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{W}"); - // Destroy target creature. Its owner gains 4 life. - this.getSpellAbility().addEffect(new PathOfPeaceEffect()); + this.getSpellAbility().addEffect(new MisfortunesGainEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } @@ -65,30 +64,32 @@ public class MisfortunesGain extends CardImpl { } class MisfortunesGainEffect extends OneShotEffect { - + public MisfortunesGainEffect() { super(Outcome.DestroyPermanent); - this.staticText = "Destroy target creature. Its owner gains 4 life."; + this.staticText = "Destroy target creature. Its owner gains 4 life"; } - + public MisfortunesGainEffect(final MisfortunesGainEffect effect) { super(effect); } - + @Override public MisfortunesGainEffect copy() { return new MisfortunesGainEffect(this); } - + @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - Permanent target = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); + Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && target != null) { target.destroy(source.getSourceId(), game, false); - Player player = game.getPlayer(target.getOwnerId()); - player.gainLife(4, game); - return true; + Player owner = game.getPlayer(target.getOwnerId()); + if (owner != null) { + owner.gainLife(4, game); + } + return true; } return false; } diff --git a/Mage.Sets/src/mage/cards/p/PathOfPeace.java b/Mage.Sets/src/mage/cards/p/PathOfPeace.java index 630a77f7ec..94e307ae4b 100644 --- a/Mage.Sets/src/mage/cards/p/PathOfPeace.java +++ b/Mage.Sets/src/mage/cards/p/PathOfPeace.java @@ -33,8 +33,8 @@ import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.game.Game; import mage.constants.Outcome; +import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; @@ -47,11 +47,10 @@ public class PathOfPeace extends CardImpl { public PathOfPeace(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{W}"); - // Destroy target creature. Its owner gains 4 life. this.getSpellAbility().addEffect(new PathOfPeaceEffect()); - this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } public PathOfPeace(final PathOfPeace card) { @@ -65,30 +64,32 @@ public class PathOfPeace extends CardImpl { } class PathOfPeaceEffect extends OneShotEffect { - + public PathOfPeaceEffect() { super(Outcome.DestroyPermanent); - this.staticText = "Destroy target creature. Its owner gains 4 life."; + this.staticText = "Destroy target creature. Its owner gains 4 life"; } - + public PathOfPeaceEffect(final PathOfPeaceEffect effect) { super(effect); } - + @Override public PathOfPeaceEffect copy() { return new PathOfPeaceEffect(this); } - + @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - Permanent target = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); + Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && target != null) { target.destroy(source.getSourceId(), game, false); - Player player = game.getPlayer(target.getOwnerId()); - player.gainLife(4, game); - return true; + Player owner = game.getPlayer(target.getOwnerId()); + if (owner != null) { + owner.gainLife(4, game); + } + return true; } return false; }