From 206c7ebfb251011693517177e1ec794164a9941b Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 6 Jan 2020 21:53:51 -0500 Subject: [PATCH] Implemented Eat to Extinction --- .../src/mage/cards/e/EatToExtinction.java | 71 +++++++++++++++++++ .../src/mage/sets/TherosBeyondDeath.java | 1 + 2 files changed, 72 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/EatToExtinction.java diff --git a/Mage.Sets/src/mage/cards/e/EatToExtinction.java b/Mage.Sets/src/mage/cards/e/EatToExtinction.java new file mode 100644 index 00000000000..ee60373bbda --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EatToExtinction.java @@ -0,0 +1,71 @@ +package mage.cards.e; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCreatureOrPlaneswalker; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EatToExtinction extends CardImpl { + + public EatToExtinction(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B}"); + + // Exile target creature or planeswalker. Look at the top card of your library. You may put that card into your graveyard. + this.getSpellAbility().addEffect(new ExileTargetEffect()); + this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker()); + this.getSpellAbility().addEffect(new EatToExtinctionEffect()); + } + + private EatToExtinction(final EatToExtinction card) { + super(card); + } + + @Override + public EatToExtinction copy() { + return new EatToExtinction(this); + } +} + +class EatToExtinctionEffect extends OneShotEffect { + + EatToExtinctionEffect() { + super(Outcome.Benefit); + staticText = "Look at the top card of your library. You may put that card into your graveyard."; + } + + private EatToExtinctionEffect(final EatToExtinctionEffect effect) { + super(effect); + } + + @Override + public EatToExtinctionEffect copy() { + return new EatToExtinctionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null || player.getLibrary().size() == 0) { + return false; + } + Card card = player.getLibrary().getFromTop(game); + player.lookAtCards("Top card of your library", card, game); + if (player.chooseUse(Outcome.AIDontUseIt, "Put the top card of your library into your graveyard?", source, game)) { + player.moveCards(card, Zone.GRAVEYARD, source, game); + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 280a90ef45c..9f09c44600e 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -52,6 +52,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Demon of Loathing", 292, Rarity.RARE, mage.cards.d.DemonOfLoathing.class)); cards.add(new SetCardInfo("Devourer of Memory", 213, Rarity.UNCOMMON, mage.cards.d.DevourerOfMemory.class)); cards.add(new SetCardInfo("Drag to the Underworld", 89, Rarity.UNCOMMON, mage.cards.d.DragToTheUnderworld.class)); + cards.add(new SetCardInfo("Eat to Extinction", 90, Rarity.RARE, mage.cards.e.EatToExtinction.class)); cards.add(new SetCardInfo("Eidolon of Philosophy", 48, Rarity.COMMON, mage.cards.e.EidolonOfPhilosophy.class)); cards.add(new SetCardInfo("Elspeth, Sun's Nemesis", 14, Rarity.MYTHIC, mage.cards.e.ElspethSunsNemesis.class)); cards.add(new SetCardInfo("Elspeth, Undaunted Hero", 270, Rarity.MYTHIC, mage.cards.e.ElspethUndauntedHero.class));