Implemented Smothering Tithe

This commit is contained in:
Evan Kranzler 2019-01-04 11:08:55 -05:00
parent 161c4ee1dd
commit d6dc4c2fcf
2 changed files with 75 additions and 0 deletions

View file

@ -0,0 +1,74 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.common.DrawCardOpponentTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.token.TreasureToken;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SmotheringTithe extends CardImpl {
public SmotheringTithe(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
// Whenever an opponent draws a card, that player may pay {2}. If the player doesn't, you create a colorless Treasure artifact token with "{T}, Sacrifice this artifact: Add one mana of any color."
this.addAbility(new DrawCardOpponentTriggeredAbility(
new SmotheringTitheEffect(), false, true
));
}
private SmotheringTithe(final SmotheringTithe card) {
super(card);
}
@Override
public SmotheringTithe copy() {
return new SmotheringTithe(this);
}
}
class SmotheringTitheEffect extends OneShotEffect {
SmotheringTitheEffect() {
super(Outcome.Benefit);
staticText = "that player may pay {2}. If the player doesn't, " +
"you create a colorless Treasure artifact token " +
"with \"{T}, Sacrifice this artifact: Add one mana of any color.\"";
}
private SmotheringTitheEffect(final SmotheringTitheEffect effect) {
super(effect);
}
@Override
public SmotheringTitheEffect copy() {
return new SmotheringTitheEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player == null) {
return false;
}
Cost cost = new GenericManaCost(2);
if (!player.chooseUse(Outcome.Detriment, "Pay {2} to prevent this effect?", source, game)
|| !cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
return new CreateTokenEffect(new TreasureToken()).apply(game, source);
}
return false;
}
}

View file

@ -89,6 +89,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("Simic Guildgate", 258, Rarity.COMMON, mage.cards.s.SimicGuildgate.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Simic Locket", 240, Rarity.COMMON, mage.cards.s.SimicLocket.class));
cards.add(new SetCardInfo("Skarrgan Hellkite", 114, Rarity.MYTHIC, mage.cards.s.SkarrganHellkite.class));
cards.add(new SetCardInfo("Smothering Tithe", 22, Rarity.RARE, mage.cards.s.SmotheringTithe.class));
cards.add(new SetCardInfo("Spawn of Mayhem", 85, Rarity.MYTHIC, mage.cards.s.SpawnOfMayhem.class));
cards.add(new SetCardInfo("Sphinx of Foresight", 55, Rarity.RARE, mage.cards.s.SphinxOfForesight.class));
cards.add(new SetCardInfo("Sphinx's Insight", 209, Rarity.COMMON, mage.cards.s.SphinxsInsight.class));