Skip to content

Commit 2fe467e

Browse files
committed
[FIC] Implement Coin of Fate
1 parent 370e1db commit 2fe467e

File tree

2 files changed

+110
-0
lines changed

2 files changed

+110
-0
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
package mage.cards.c;
2+
3+
import java.util.Set;
4+
import java.util.UUID;
5+
6+
import mage.abilities.Ability;
7+
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
8+
import mage.abilities.common.SimpleActivatedAbility;
9+
import mage.abilities.costs.common.ExileFromGraveCost;
10+
import mage.abilities.costs.common.SacrificeSourceCost;
11+
import mage.abilities.costs.mana.ManaCostsImpl;
12+
import mage.abilities.effects.OneShotEffect;
13+
import mage.abilities.effects.common.BecomesMonarchSourceEffect;
14+
import mage.abilities.effects.keyword.SurveilEffect;
15+
import mage.abilities.hint.common.MonarchHint;
16+
import mage.cards.*;
17+
import mage.constants.CardType;
18+
import mage.constants.Outcome;
19+
import mage.constants.Zone;
20+
import mage.filter.StaticFilters;
21+
import mage.game.Game;
22+
import mage.players.Player;
23+
import mage.target.TargetCard;
24+
import mage.target.common.TargetCardInYourGraveyard;
25+
import mage.target.common.TargetOpponent;
26+
27+
/**
28+
* @author balazskristof
29+
*/
30+
public final class CoinOfFate extends CardImpl {
31+
32+
public CoinOfFate(UUID ownerId, CardSetInfo setInfo) {
33+
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{W}");
34+
35+
// When this artifact enters, surveil 1.
36+
this.addAbility(new EntersBattlefieldTriggeredAbility(new SurveilEffect(1)));
37+
38+
// {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.
39+
Ability ability = new SimpleActivatedAbility(new CoinOfFateEffect(), new ManaCostsImpl<>("{3}{W}")).addHint(MonarchHint.instance);
40+
ability.addEffect(new BecomesMonarchSourceEffect());
41+
ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(2, StaticFilters.FILTER_CARD_CREATURES), true));
42+
ability.addCost(new SacrificeSourceCost());
43+
this.addAbility(ability);
44+
}
45+
46+
private CoinOfFate(final CoinOfFate card) {
47+
super(card);
48+
}
49+
50+
@Override
51+
public CoinOfFate copy() {
52+
return new CoinOfFate(this);
53+
}
54+
}
55+
56+
class CoinOfFateEffect extends OneShotEffect {
57+
58+
public CoinOfFateEffect() {
59+
super(Outcome.Benefit);
60+
staticText = "An opponent chooses one of the exiled cards. "
61+
+ "You put that card on the bottom of your library and return the other to the battlefield tapped";
62+
}
63+
64+
private CoinOfFateEffect(final CoinOfFateEffect effect) {
65+
super(effect);
66+
}
67+
68+
@Override
69+
public CoinOfFateEffect copy() {
70+
return new CoinOfFateEffect(this);
71+
}
72+
73+
@Override
74+
public boolean apply(Game game, Ability source) {
75+
Player controller = game.getPlayer(source.getControllerId());
76+
if (controller == null) {
77+
return false;
78+
}
79+
Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source));
80+
if (cards.isEmpty()) {
81+
return false;
82+
}
83+
Player opponent;
84+
Set<UUID> opponents = game.getOpponents(controller.getId());
85+
if (opponents.size() == 1) {
86+
opponent = game.getPlayer(opponents.iterator().next());
87+
} else {
88+
TargetOpponent targetOpponent = new TargetOpponent(true);
89+
controller.chooseTarget(Outcome.Detriment, targetOpponent, source, game);
90+
opponent = game.getPlayer(targetOpponent.getFirstTarget());
91+
}
92+
if (opponent == null) {
93+
return false;
94+
}
95+
TargetCard targetCard = new TargetCard(Zone.EXILED, StaticFilters.FILTER_CARD_CREATURE);
96+
targetCard.withChooseHint("card to put on the bottom of opponent's library, the other is put onto the battlefield tapped");
97+
opponent.chooseTarget(Outcome.Benefit, cards, targetCard, source, game);
98+
Card cardToLibrary = game.getCard(targetCard.getFirstTarget());
99+
if (cardToLibrary != null) {
100+
controller.moveCardToLibraryWithInfo(cardToLibrary, source, game, Zone.EXILED, false, true);
101+
cards.remove(cardToLibrary);
102+
}
103+
if (!cards.isEmpty()) {
104+
controller.moveCards(game.getCard(cards.iterator().next()), Zone.BATTLEFIELD, source, game, true, false, true, null);
105+
}
106+
return true;
107+
}
108+
}

Mage.Sets/src/mage/sets/FinalFantasyCommander.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ private FinalFantasyCommander() {
9292
cards.add(new SetCardInfo("Cloud, Ex-SOLDIER", 202, Rarity.MYTHIC, mage.cards.c.CloudExSOLDIER.class, NON_FULL_USE_VARIOUS));
9393
cards.add(new SetCardInfo("Cloud, Ex-SOLDIER", 210, Rarity.MYTHIC, mage.cards.c.CloudExSOLDIER.class, NON_FULL_USE_VARIOUS));
9494
cards.add(new SetCardInfo("Cloud, Ex-SOLDIER", 221, Rarity.MYTHIC, mage.cards.c.CloudExSOLDIER.class, NON_FULL_USE_VARIOUS));
95+
cards.add(new SetCardInfo("Coin of Fate", 15, Rarity.RARE, mage.cards.c.CoinOfFate.class, NON_FULL_USE_VARIOUS));
96+
cards.add(new SetCardInfo("Coin of Fate", 104, Rarity.RARE, mage.cards.c.CoinOfFate.class, NON_FULL_USE_VARIOUS));
9597
cards.add(new SetCardInfo("Collective Effort", 237, Rarity.RARE, mage.cards.c.CollectiveEffort.class));
9698
cards.add(new SetCardInfo("Colossus Hammer", 338, Rarity.UNCOMMON, mage.cards.c.ColossusHammer.class));
9799
cards.add(new SetCardInfo("Combustible Gearhulk", 292, Rarity.MYTHIC, mage.cards.c.CombustibleGearhulk.class));

0 commit comments

Comments
 (0)