From a2c8b71271f06ceb8252b34cdd5fe2791f82de60 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Wed, 21 May 2025 13:16:18 -0400 Subject: [PATCH] [FIC] Implement Rejoin the Fight --- .../src/mage/cards/r/RejoinTheFight.java | 91 +++++++++++++++++++ .../src/mage/sets/FinalFantasyCommander.java | 2 + 2 files changed, 93 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RejoinTheFight.java diff --git a/Mage.Sets/src/mage/cards/r/RejoinTheFight.java b/Mage.Sets/src/mage/cards/r/RejoinTheFight.java new file mode 100644 index 00000000000..6edd8604bb2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RejoinTheFight.java @@ -0,0 +1,91 @@ +package mage.cards.r; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.MillCardsControllerEffect; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RejoinTheFight extends CardImpl { + + public RejoinTheFight(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{B}"); + + // Mill three cards. Then starting with the next opponent in turn order, each opponent chooses a creature card in your graveyard that hasn't been chosen. Return each card chosen this way to the battlefield under your control. + this.getSpellAbility().addEffect(new MillCardsControllerEffect(3)); + this.getSpellAbility().addEffect(new RejoinTheFightEffect()); + } + + private RejoinTheFight(final RejoinTheFight card) { + super(card); + } + + @Override + public RejoinTheFight copy() { + return new RejoinTheFight(this); + } +} + +class RejoinTheFightEffect extends OneShotEffect { + + RejoinTheFightEffect() { + super(Outcome.Benefit); + staticText = "Then starting with the next opponent in turn order, each opponent chooses " + + "a creature card in your graveyard that hasn't been chosen. " + + "Return each card chosen this way to the battlefield under your control"; + } + + private RejoinTheFightEffect(final RejoinTheFightEffect effect) { + super(effect); + } + + @Override + public RejoinTheFightEffect copy() { + return new RejoinTheFightEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Cards cards = new CardsImpl(controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game)); + if (cards.isEmpty()) { + return false; + } + Cards toPlay = new CardsImpl(); + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + if (cards.isEmpty()) { + break; + } + Player opponent = game.getPlayer(opponentId); + if (opponent == null) { + continue; + } + TargetCard target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE); + target.withNotTarget(true); + opponent.choose(outcome, cards, target, source, game); + Card card = game.getCard(target.getFirstTarget()); + if (card == null) { + continue; + } + game.informPlayers(opponent.getLogName() + " chooses " + card.getLogName()); + toPlay.add(card); + cards.remove(card); + } + return controller.moveCards(toPlay, Zone.BATTLEFIELD, source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java index fe98cf0a157..bc64161d818 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java +++ b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java @@ -252,6 +252,8 @@ public final class FinalFantasyCommander extends ExpansionSet { cards.add(new SetCardInfo("Reanimate", 282, Rarity.RARE, mage.cards.r.Reanimate.class)); cards.add(new SetCardInfo("Red XIII, Proud Warrior", 181, Rarity.RARE, mage.cards.r.RedXIIIProudWarrior.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Red XIII, Proud Warrior", 91, Rarity.RARE, mage.cards.r.RedXIIIProudWarrior.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Rejoin the Fight", 118, Rarity.RARE, mage.cards.r.RejoinTheFight.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Rejoin the Fight", 49, Rarity.RARE, mage.cards.r.RejoinTheFight.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Relic of Legends", 354, Rarity.UNCOMMON, mage.cards.r.RelicOfLegends.class)); cards.add(new SetCardInfo("Resourceful Defense", 251, Rarity.RARE, mage.cards.r.ResourcefulDefense.class)); cards.add(new SetCardInfo("Rise of the Dark Realms", 283, Rarity.MYTHIC, mage.cards.r.RiseOfTheDarkRealms.class));