From 61e316649277416df4c995db36c77e174318aeea Mon Sep 17 00:00:00 2001 From: Scott Crawford Date: Wed, 3 May 2017 19:37:41 -0700 Subject: [PATCH] Path of Peace implemented Path of Peace --- Mage.Sets/src/mage/cards/p/PathOfPeace.java | 43 ++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/cards/p/PathOfPeace.java b/Mage.Sets/src/mage/cards/p/PathOfPeace.java index 797eb517ae..66c048bb5a 100644 --- a/Mage.Sets/src/mage/cards/p/PathOfPeace.java +++ b/Mage.Sets/src/mage/cards/p/PathOfPeace.java @@ -28,13 +28,20 @@ package mage.cards.p; import java.util.UUID; +import mage.abilities.Ability; +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.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; /** * - * @author anonymous + * @author Scott-Crawford */ public class PathOfPeace extends CardImpl { @@ -43,6 +50,10 @@ public class PathOfPeace extends CardImpl { // Destroy target creature. Its owner gains 4 life. + this.getSpellAbility().addEffect(new PathOfPeaceEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + + } public PathOfPeace(final PathOfPeace card) { @@ -54,3 +65,33 @@ public class PathOfPeace extends CardImpl { return new PathOfPeace(this); } } + +class PathOfPeaceEffect extends OneShotEffect { + + public PathOfPeaceEffect() { + super(Outcome.DestroyPermanent); + 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)); + if (controller != null && target != null) { + target.destroy(source.getSourceId(), game, false); + Player player = game.getPlayer(target.getOwnerId()); + player.gainLife(4, game); + return true; + } + return false; + } +}