From 86e4dbebf375402df6c31b5b69c993e443989dfa Mon Sep 17 00:00:00 2001 From: theelk801 Date: Mon, 1 Apr 2024 10:53:42 -0400 Subject: [PATCH] [OTJ] Implement Return the Favor --- .../src/mage/cards/r/ReturnTheFavor.java | 69 +++++++++++++++++++ .../mage/sets/OutlawsOfThunderJunction.java | 1 + 2 files changed, 70 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/ReturnTheFavor.java diff --git a/Mage.Sets/src/mage/cards/r/ReturnTheFavor.java b/Mage.Sets/src/mage/cards/r/ReturnTheFavor.java new file mode 100644 index 00000000000..4061f712e46 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/ReturnTheFavor.java @@ -0,0 +1,69 @@ +package mage.cards.r; + +import mage.abilities.Mode; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.ChooseNewTargetsTargetEffect; +import mage.abilities.effects.common.CopyTargetStackAbilityEffect; +import mage.abilities.keyword.SpreeAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.FilterStackObject; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.other.NumberOfTargetsPredicate; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; +import mage.target.TargetStackObject; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ReturnTheFavor extends CardImpl { + + private static final FilterStackObject filter + = new FilterStackObject("instant spell, sorcery spell, activated ability, or triggered ability"); + private static final FilterStackObject filter2 = new FilterStackObject("spell or ability with a single target"); + + static { + filter.add(ReturnTheFavorPredicate.instance); + filter2.add(new NumberOfTargetsPredicate(1)); + } + + public ReturnTheFavor(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}{R}"); + + // Spree + this.addAbility(new SpreeAbility(this)); + + // + {1} -- Copy target instant spell, sorcery spell, activated ability, or triggered ability. You may choose new targets for the copy. + this.getSpellAbility().addEffect(new CopyTargetStackAbilityEffect()); + this.getSpellAbility().addTarget(new TargetStackObject(filter)); + this.getSpellAbility().withFirstModeCost(new GenericManaCost(1)); + + // + {1} -- Change the target of target spell or ability with a single target. + this.getSpellAbility().addMode(new Mode(new ChooseNewTargetsTargetEffect(true, true)) + .addTarget(new TargetStackObject(filter2)) + .withCost(new GenericManaCost(1))); + } + + private ReturnTheFavor(final ReturnTheFavor card) { + super(card); + } + + @Override + public ReturnTheFavor copy() { + return new ReturnTheFavor(this); + } +} + +enum ReturnTheFavorPredicate implements Predicate { + instance; + + @Override + public boolean apply(StackObject input, Game game) { + return !(input instanceof Spell) || input.isInstantOrSorcery(game); + } +} diff --git a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java index daf400026fc..6a31f2556e7 100644 --- a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java +++ b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java @@ -178,6 +178,7 @@ public final class OutlawsOfThunderJunction extends ExpansionSet { cards.add(new SetCardInfo("Redrock Sentinel", 247, Rarity.UNCOMMON, mage.cards.r.RedrockSentinel.class)); cards.add(new SetCardInfo("Requisition Raid", 26, Rarity.UNCOMMON, mage.cards.r.RequisitionRaid.class)); cards.add(new SetCardInfo("Resilient Roadrunner", 141, Rarity.UNCOMMON, mage.cards.r.ResilientRoadrunner.class)); + cards.add(new SetCardInfo("Return the Favor", 142, Rarity.UNCOMMON, mage.cards.r.ReturnTheFavor.class)); cards.add(new SetCardInfo("Rictus Robber", 102, Rarity.UNCOMMON, mage.cards.r.RictusRobber.class)); cards.add(new SetCardInfo("Rise of the Varmints", 179, Rarity.UNCOMMON, mage.cards.r.RiseOfTheVarmints.class)); cards.add(new SetCardInfo("Rodeo Pyromancers", 143, Rarity.COMMON, mage.cards.r.RodeoPyromancers.class));