From a4f1149cf16517b26c13ee641dc0974448282d19 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 23 May 2019 22:32:31 -0400 Subject: [PATCH] Implemented Savage Swipe --- Mage.Sets/src/mage/cards/s/SavageSwipe.java | 86 +++++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SavageSwipe.java diff --git a/Mage.Sets/src/mage/cards/s/SavageSwipe.java b/Mage.Sets/src/mage/cards/s/SavageSwipe.java new file mode 100644 index 0000000000..40359b6849 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SavageSwipe.java @@ -0,0 +1,86 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.FightTargetsEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SavageSwipe extends CardImpl { + + private static final FilterPermanent filter = new FilterCreaturePermanent("creature you don't control"); + + static { + filter.add(new ControllerPredicate(TargetController.NOT_YOU)); + } + + public SavageSwipe(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}"); + + // Target creature you control gets +2/+2 until end of turn if its power is 2. Then it fights target creature you don't control. + this.getSpellAbility().addEffect(new SavageSwipeEffect()); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + } + + private SavageSwipe(final SavageSwipe card) { + super(card); + } + + @Override + public SavageSwipe copy() { + return new SavageSwipe(this); + } +} + +class SavageSwipeEffect extends OneShotEffect { + + SavageSwipeEffect() { + super(Outcome.Benefit); + staticText = "Target creature you control gets +2/+2 until end of turn if its power is 2. " + + "Then it fights target creature you don't control."; + } + + private SavageSwipeEffect(final SavageSwipeEffect effect) { + super(effect); + } + + @Override + public SavageSwipeEffect copy() { + return new SavageSwipeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null) { + return false; + } + if (permanent.getPower().getValue() == 2) { + ContinuousEffect effect = new BoostTargetEffect(2, 2, Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(permanent, game)); + game.addEffect(effect, source); + game.applyEffects(); + } + return new FightTargetsEffect().apply(game, source); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ModernHorizons.java b/Mage.Sets/src/mage/sets/ModernHorizons.java index a6c0c1b84b..a4c41fe81b 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons.java @@ -77,6 +77,7 @@ public final class ModernHorizons extends ExpansionSet { cards.add(new SetCardInfo("Ranger-Captain of Eos", 21, Rarity.MYTHIC, mage.cards.r.RangerCaptainOfEos.class)); cards.add(new SetCardInfo("Ravenous Giant", 143, Rarity.UNCOMMON, mage.cards.r.RavenousGiant.class)); cards.add(new SetCardInfo("Regrowth", 175, Rarity.UNCOMMON, mage.cards.r.Regrowth.class)); + cards.add(new SetCardInfo("Savage Swipe", 178, Rarity.COMMON, mage.cards.s.SavageSwipe.class)); cards.add(new SetCardInfo("Scour All Possibilities", 67, Rarity.COMMON, mage.cards.s.ScourAllPossibilities.class)); cards.add(new SetCardInfo("Scrapyard Recombiner", 227, Rarity.RARE, mage.cards.s.ScrapyardRecombiner.class)); cards.add(new SetCardInfo("Seasoned Pyromancer", 145, Rarity.MYTHIC, mage.cards.s.SeasonedPyromancer.class));