From 0d830c49a3d61876f18e2b3248ab5c547cbf21af Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sun, 18 Jun 2023 10:26:28 -0400 Subject: [PATCH] [LTR] Implement Errand-Rider of Gondor --- .../src/mage/cards/e/ErrandRiderOfGondor.java | 90 +++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 91 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/ErrandRiderOfGondor.java diff --git a/Mage.Sets/src/mage/cards/e/ErrandRiderOfGondor.java b/Mage.Sets/src/mage/cards/e/ErrandRiderOfGondor.java new file mode 100644 index 00000000000..4089f0f0e05 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/ErrandRiderOfGondor.java @@ -0,0 +1,90 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.hint.ConditionHint; +import mage.abilities.hint.Hint; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInHand; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ErrandRiderOfGondor extends CardImpl { + + private static final Hint hint = new ConditionHint( + new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_CONTROLLED_CREATURE_LEGENDARY), + "You control a legendary creature" + ); + + public ErrandRiderOfGondor(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // When Errand-Rider of Gondor enters the battlefield, draw a card. Then if you don't control a legendary creature, put a card from your hand on the bottom of your library. + this.addAbility(new EntersBattlefieldTriggeredAbility(new ErrandRiderOfGondorEffect()).addHint(hint)); + } + + private ErrandRiderOfGondor(final ErrandRiderOfGondor card) { + super(card); + } + + @Override + public ErrandRiderOfGondor copy() { + return new ErrandRiderOfGondor(this); + } +} + +class ErrandRiderOfGondorEffect extends OneShotEffect { + + ErrandRiderOfGondorEffect() { + super(Outcome.Benefit); + staticText = "draw a card. Then if you don't control a legendary creature, " + + "put a card from your hand on the bottom of your library"; + } + + private ErrandRiderOfGondorEffect(final ErrandRiderOfGondorEffect effect) { + super(effect); + } + + @Override + public ErrandRiderOfGondorEffect copy() { + return new ErrandRiderOfGondorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + player.drawCards(1, source, game); + if (game.getBattlefield().contains( + StaticFilters.FILTER_CONTROLLED_CREATURE_LEGENDARY, source, game, 1 + ) || player.getHand().isEmpty()) { + return true; + } + TargetCard target = new TargetCardInHand(); + player.choose(outcome, player.getHand(), target, source, game); + Card card = game.getCard(target.getFirstTarget()); + return card == null || player.putCardsOnBottomOfLibrary(card, game, source, false); + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index ac6fbaf4cdf..77029418983 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -67,6 +67,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Eowyn, Lady of Rohan", 10, Rarity.UNCOMMON, mage.cards.e.EowynLadyOfRohan.class)); cards.add(new SetCardInfo("Erebor Flamesmith", 122, Rarity.COMMON, mage.cards.e.EreborFlamesmith.class)); cards.add(new SetCardInfo("Erkenbrand, Lord of Westfold", 123, Rarity.UNCOMMON, mage.cards.e.ErkenbrandLordOfWestfold.class)); + cards.add(new SetCardInfo("Errand-Rider of Gondor", 11, Rarity.COMMON, mage.cards.e.ErrandRiderOfGondor.class)); cards.add(new SetCardInfo("Escape from Orthanc", 12, Rarity.COMMON, mage.cards.e.EscapeFromOrthanc.class)); cards.add(new SetCardInfo("Esquire of the King", 13, Rarity.COMMON, mage.cards.e.EsquireOfTheKing.class)); cards.add(new SetCardInfo("Fall of Cair Andros", 124, Rarity.RARE, mage.cards.f.FallOfCairAndros.class));