From a867d2adb096cfea692744b8619baa0fb9174087 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 9 Jun 2023 09:54:51 -0400 Subject: [PATCH] [LTR] Implement The Ring Goes South --- .../src/mage/cards/t/TheRingGoesSouth.java | 96 +++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 97 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TheRingGoesSouth.java diff --git a/Mage.Sets/src/mage/cards/t/TheRingGoesSouth.java b/Mage.Sets/src/mage/cards/t/TheRingGoesSouth.java new file mode 100644 index 00000000000..d0e74bcb276 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheRingGoesSouth.java @@ -0,0 +1,96 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.keyword.TheRingTemptsYouEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +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 java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TheRingGoesSouth extends CardImpl { + + private static final Hint hint = new ValueHint( + "legendary creatures you control", + new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CONTROLLED_CREATURE_LEGENDARY) + ); + + public TheRingGoesSouth(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}"); + + // The Ring tempts you. Then reveal cards from the top of your library until you reveal X land cards, where X is the number of legendary creatures you control. Put those lands onto the battlefield tapped and the rest on the bottom of your library in a random order. + this.getSpellAbility().addEffect(new TheRingTemptsYouEffect()); + this.getSpellAbility().addEffect(new TheRingGoesSouthEffect()); + this.getSpellAbility().addHint(hint); + } + + private TheRingGoesSouth(final TheRingGoesSouth card) { + super(card); + } + + @Override + public TheRingGoesSouth copy() { + return new TheRingGoesSouth(this); + } +} + +class TheRingGoesSouthEffect extends OneShotEffect { + + TheRingGoesSouthEffect() { + super(Outcome.Benefit); + staticText = "Then reveal cards from the top of your library until you reveal X land cards, " + + "where X is the number of legendary creatures you control. Put those lands onto " + + "the battlefield tapped and the rest on the bottom of your library in a random order."; + } + + private TheRingGoesSouthEffect(final TheRingGoesSouthEffect effect) { + super(effect); + } + + @Override + public TheRingGoesSouthEffect copy() { + return new TheRingGoesSouthEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + int count = game.getBattlefield().count( + StaticFilters.FILTER_CONTROLLED_CREATURE_LEGENDARY, + source.getControllerId(), source, game + ); + if (player == null || count < 1) { + return false; + } + Cards cards = new CardsImpl(); + Cards lands = new CardsImpl(); + for (Card card : player.getLibrary().getCards(game)) { + cards.add(card); + if (card.isLand(game)) { + lands.add(card); + } + if (lands.size() >= count) { + break; + } + } + player.revealCards(source, cards, game); + player.moveCards( + lands.getCards(game), Zone.BATTLEFIELD, source, game, + true, false, false, null + ); + cards.retainZone(Zone.LIBRARY, game); + player.putCardsOnBottomOfLibrary(cards, game, source, false); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index f810b96d96a..9ccad4fd217 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -146,6 +146,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("The Bath Song", 40, Rarity.UNCOMMON, mage.cards.t.TheBathSong.class)); cards.add(new SetCardInfo("The Mouth of Sauron", 216, Rarity.UNCOMMON, mage.cards.t.TheMouthOfSauron.class)); cards.add(new SetCardInfo("The One Ring", 246, Rarity.MYTHIC, mage.cards.t.TheOneRing.class)); + cards.add(new SetCardInfo("The Ring Goes South", 186, Rarity.RARE, mage.cards.t.TheRingGoesSouth.class)); cards.add(new SetCardInfo("The Shire", 260, Rarity.RARE, mage.cards.t.TheShire.class)); cards.add(new SetCardInfo("Theoden, King of Rohan", 233, Rarity.UNCOMMON, mage.cards.t.TheodenKingOfRohan.class)); cards.add(new SetCardInfo("There and Back Again", 151, Rarity.RARE, mage.cards.t.ThereAndBackAgain.class));