From 08ff9c54a73c43ba4225c5dbfe9a92eb6239c3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Krist=C3=B3f?= <20043803+balazskristof@users.noreply.github.com> Date: Thu, 29 May 2025 16:14:46 +0200 Subject: [PATCH] [FIC] Implement Coin of Fate (#13624) --- Mage.Sets/src/mage/cards/c/CoinOfFate.java | 108 ++++++++++++++++++ .../src/mage/sets/FinalFantasyCommander.java | 2 + 2 files changed, 110 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CoinOfFate.java diff --git a/Mage.Sets/src/mage/cards/c/CoinOfFate.java b/Mage.Sets/src/mage/cards/c/CoinOfFate.java new file mode 100644 index 00000000000..1abae9c1d69 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CoinOfFate.java @@ -0,0 +1,108 @@ +package mage.cards.c; + +import java.util.Set; +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.ExileFromGraveCost; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.BecomesMonarchSourceEffect; +import mage.abilities.effects.keyword.SurveilEffect; +import mage.abilities.hint.common.MonarchHint; +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.TargetCardInYourGraveyard; +import mage.target.common.TargetOpponent; + +/** + * @author balazskristof + */ +public final class CoinOfFate extends CardImpl { + + public CoinOfFate(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{W}"); + + // When this artifact enters, surveil 1. + this.addAbility(new EntersBattlefieldTriggeredAbility(new SurveilEffect(1))); + + // {3}{W},{T}, Exile two creature cards from your graveyard, Sacrifice this artifact: An opponent chooses one of the exiled cards. You put that card on the bottom of your library and return the other to the battlefield tapped. You become the monarch. + Ability ability = new SimpleActivatedAbility(new CoinOfFateEffect(), new ManaCostsImpl<>("{3}{W}")).addHint(MonarchHint.instance); + ability.addEffect(new BecomesMonarchSourceEffect()); + ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(2, StaticFilters.FILTER_CARD_CREATURES), true)); + ability.addCost(new SacrificeSourceCost()); + this.addAbility(ability); + } + + private CoinOfFate(final CoinOfFate card) { + super(card); + } + + @Override + public CoinOfFate copy() { + return new CoinOfFate(this); + } +} + +class CoinOfFateEffect extends OneShotEffect { + + public CoinOfFateEffect() { + super(Outcome.Benefit); + staticText = "An opponent chooses one of the exiled cards. " + + "You put that card on the bottom of your library and return the other to the battlefield tapped"; + } + + private CoinOfFateEffect(final CoinOfFateEffect effect) { + super(effect); + } + + @Override + public CoinOfFateEffect copy() { + return new CoinOfFateEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source)); + if (cards.isEmpty()) { + return false; + } + Player opponent; + Set opponents = game.getOpponents(controller.getId()); + if (opponents.size() == 1) { + opponent = game.getPlayer(opponents.iterator().next()); + } else { + TargetOpponent targetOpponent = new TargetOpponent(true); + controller.chooseTarget(Outcome.Detriment, targetOpponent, source, game); + opponent = game.getPlayer(targetOpponent.getFirstTarget()); + } + if (opponent == null) { + return false; + } + TargetCard targetCard = new TargetCard(Zone.EXILED, StaticFilters.FILTER_CARD_CREATURE); + targetCard.withChooseHint("card to put on the bottom of opponent's library, the other is put onto the battlefield tapped"); + opponent.chooseTarget(Outcome.Benefit, cards, targetCard, source, game); + Card cardToLibrary = game.getCard(targetCard.getFirstTarget()); + if (cardToLibrary != null) { + controller.moveCardToLibraryWithInfo(cardToLibrary, source, game, Zone.EXILED, false, true); + cards.remove(cardToLibrary); + } + if (!cards.isEmpty()) { + controller.moveCards(game.getCard(cards.iterator().next()), Zone.BATTLEFIELD, source, game, true, false, true, null); + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java index fbc3c40a14d..c20ecc17f03 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java +++ b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java @@ -96,6 +96,8 @@ public final class FinalFantasyCommander extends ExpansionSet { cards.add(new SetCardInfo("Cloud, Ex-SOLDIER", 202, Rarity.MYTHIC, mage.cards.c.CloudExSOLDIER.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Cloud, Ex-SOLDIER", 210, Rarity.MYTHIC, mage.cards.c.CloudExSOLDIER.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Cloud, Ex-SOLDIER", 221, Rarity.MYTHIC, mage.cards.c.CloudExSOLDIER.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Coin of Fate", 15, Rarity.RARE, mage.cards.c.CoinOfFate.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Coin of Fate", 104, Rarity.RARE, mage.cards.c.CoinOfFate.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Collective Effort", 237, Rarity.RARE, mage.cards.c.CollectiveEffort.class)); cards.add(new SetCardInfo("Colossus Hammer", 338, Rarity.UNCOMMON, mage.cards.c.ColossusHammer.class)); cards.add(new SetCardInfo("Combustible Gearhulk", 292, Rarity.MYTHIC, mage.cards.c.CombustibleGearhulk.class));