[FIC] Implement Coin of Fate (#13624)

This commit is contained in:
Balázs Kristóf 2025-05-29 16:14:46 +02:00 committed by Failure
parent 46d1795c5c
commit 08ff9c54a7
2 changed files with 110 additions and 0 deletions

View file

@ -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<UUID> 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;
}
}

View file

@ -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));