From 87e8b67b2e43a62e34481c628aa226db714bb00e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 16 Sep 2019 20:04:16 -0400 Subject: [PATCH] Implemented Forever Young --- Mage.Sets/src/mage/cards/f/ForeverYoung.java | 80 +++++++++++++++++++ Mage.Sets/src/mage/sets/ThroneOfEldraine.java | 1 + Utils/mtg-cards-data.txt | 2 +- 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/f/ForeverYoung.java diff --git a/Mage.Sets/src/mage/cards/f/ForeverYoung.java b/Mage.Sets/src/mage/cards/f/ForeverYoung.java new file mode 100644 index 0000000000..abfe7a967f --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/ForeverYoung.java @@ -0,0 +1,80 @@ +package mage.cards.f; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.Collection; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class ForeverYoung extends CardImpl { + + public ForeverYoung(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}"); + + // Put any number of target creature cards from your graveyard on top of your library. + this.getSpellAbility().addEffect(new ForeverYoungEffect()); + this.getSpellAbility().addTarget(new TargetCardInYourGraveyard( + 0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CREATURES_YOUR_GRAVEYARD + )); + + // Draw a card. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); + } + + private ForeverYoung(final ForeverYoung card) { + super(card); + } + + @Override + public ForeverYoung copy() { + return new ForeverYoung(this); + } +} + +class ForeverYoungEffect extends OneShotEffect { + + ForeverYoungEffect() { + super(Outcome.Benefit); + staticText = "Put any number of target creature cards from your graveyard on top of your library."; + } + + private ForeverYoungEffect(final ForeverYoungEffect effect) { + super(effect); + } + + @Override + public ForeverYoungEffect copy() { + return new ForeverYoungEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + return player.putCardsOnTopOfLibrary(new CardsImpl( + source.getTargets() + .stream() + .map(Target::getTargets) + .flatMap(Collection::stream) + .map(game::getCard) + .collect(Collectors.toSet()) + ), game, source, true); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index 3bf52b7555..ca0c963400 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -87,6 +87,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Fires of Invention", 125, Rarity.RARE, mage.cards.f.FiresOfInvention.class)); cards.add(new SetCardInfo("Flaxen Intruder", 155, Rarity.UNCOMMON, mage.cards.f.FlaxenIntruder.class)); cards.add(new SetCardInfo("Folio of Fancies", 46, Rarity.RARE, mage.cards.f.FolioOfFancies.class)); + cards.add(new SetCardInfo("Forever Young", 89, Rarity.COMMON, mage.cards.f.ForeverYoung.class)); cards.add(new SetCardInfo("Foulmire Knight", 90, Rarity.UNCOMMON, mage.cards.f.FoulmireKnight.class)); cards.add(new SetCardInfo("Frogify", 47, Rarity.UNCOMMON, mage.cards.f.Frogify.class)); cards.add(new SetCardInfo("Gadwick, the Wizened", 48, Rarity.RARE, mage.cards.g.GadwickTheWizened.class)); diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index dd3f235d56..332d5b69f2 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -36052,7 +36052,7 @@ Witching Well|Throne of Eldraine|74|C|{U}|Artifact|||When Witching Well enters t Ayara, First of Locthwain|Throne of Eldraine|75|R|{B}{B}{B}|Legendary Creature - Elf Noble|2|3|Whenever Ayara, First of Locthwain or another black creature enters the battlefield under your control, each opponent loses 1 life and you gain 1 life.${T}, Sacrifice another black creature: Draw a card.| Bake into a Pie|Throne of Eldraine|76|C|{2}{B}{B}|Instant|||Destroy target creature. Create a Food token.| Belle of the Brawl|Throne of Eldraine|78|U|{2}{B}|Creature - Human Knight|3|2|Menace$Whenever Belle of the Brawl attacks, other Knights you control get +1/+0 until end of turn.| -Blacklace Paragon|Throne of Eldraine|79|R|{1}{B}|Creature - Human Knight|3|1|Flash$When Blacklace Paragon enters the battlefield, target Knight gains deathtouch and lifelink until end of turn.| +Blacklance Paragon|Throne of Eldraine|79|R|{1}{B}|Creature - Human Knight|3|1|Flash$When Blacklance Paragon enters the battlefield, target Knight gains deathtouch and lifelink until end of turn.| Bog Naughty|Throne of Eldraine|80|U|{3}{B}{B}|Creature - Faerie|3|3|Flying${2}{B}, Sacrifice a Food: Target creature gets -3/-3 until end of turn.| Cauldron Familiar|Throne of Eldraine|81|U|{B}|Creature - Cat|1|1|When Cauldron Familiar enters the battlefield, each opponent loses 1 life and you gain 1 life.$Sacrifice a Food: Return Cauldron Familiar from your graveyard to the battlefield.| The Cauldron of Eternity|Throne of Eldraine|82|M|{10}{B}{B}|Legendary Artifact|||This spell costs {2} less for each creature card in your graveyard.$Whenever a creature you control dies, put it on the bottom of its owner's library.${2}{B}, {T}, Pay 2 life: Return target card from your graveyard to the battlefield. Activate this ability only any time you could cast a sorcery.|