From a3a2f89237b0a150aafa64249fa0de6a1102bc00 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Sat, 24 Jun 2023 02:14:09 +0200 Subject: [PATCH] [LTR] Implement Shadowfax, Lord of Horses (#10503) --- .../mage/cards/s/ShadowfaxLordOfHorses.java | 109 ++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 110 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/ShadowfaxLordOfHorses.java diff --git a/Mage.Sets/src/mage/cards/s/ShadowfaxLordOfHorses.java b/Mage.Sets/src/mage/cards/s/ShadowfaxLordOfHorses.java new file mode 100644 index 00000000000..b9d17a6e2bf --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/ShadowfaxLordOfHorses.java @@ -0,0 +1,109 @@ +package mage.cards.s; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.Card; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCardInHand; + +/** + * + * @author Susucr + */ +public final class ShadowfaxLordOfHorses extends CardImpl { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent(SubType.HORSE, "Horses"); + + public ShadowfaxLordOfHorses(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{W}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HORSE); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Horses you control have haste. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield, filter))); + + // Whenever Shadowfax, Lord of Horses attacks, you may put a creature card + // with lesser power from your hand onto the battlefield tapped and attacking. + this.addAbility(new AttacksTriggeredAbility(new ShadowfaxLordOfHorsesEffect())); + } + + private ShadowfaxLordOfHorses(final ShadowfaxLordOfHorses card) { + super(card); + } + + @Override + public ShadowfaxLordOfHorses copy() { + return new ShadowfaxLordOfHorses(this); + } +} + +class ShadowfaxLordOfHorsesEffect extends OneShotEffect { + + ShadowfaxLordOfHorsesEffect() { + super(Outcome.PutCreatureInPlay); + staticText = "you may put a creature card with lesser power " + + "from your hand onto the battlefield tapped and attacking."; + } + + private ShadowfaxLordOfHorsesEffect(final ShadowfaxLordOfHorsesEffect effect) { + super(effect); + } + + @Override + public ShadowfaxLordOfHorsesEffect copy() { + return new ShadowfaxLordOfHorsesEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + + Permanent shadowfax = source.getSourcePermanentOrLKI(game); + if (shadowfax == null) { + return false; + } + + FilterCreatureCard filter = new FilterCreatureCard("a creature card with lesser power"); + filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, shadowfax.getPower().getValue())); + TargetCardInHand target = new TargetCardInHand(0,1,filter); + target.setNotTarget(true); + + if (!player.choose(outcome, player.getHand(), target, source, game)) { + return false; + } + + Card card = game.getCard(target.getFirstTarget()); + if(card == null) { + return false; + } + + player.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, true, null); + Permanent permanent = game.getPermanent(card.getId()); + if (permanent != null) { + game.getCombat().addAttackingCreature(permanent.getId(), game); + } + + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index e59b4d21598..444c5235a80 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -219,6 +219,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Scroll of Isildur", 69, Rarity.RARE, mage.cards.s.ScrollOfIsildur.class)); cards.add(new SetCardInfo("Second Breakfast", 29, Rarity.COMMON, mage.cards.s.SecondBreakfast.class)); cards.add(new SetCardInfo("Shadow Summoning", 226, Rarity.UNCOMMON, mage.cards.s.ShadowSummoning.class)); + cards.add(new SetCardInfo("Shadowfax, Lord of Horses", 227, Rarity.UNCOMMON, mage.cards.s.ShadowfaxLordOfHorses.class)); cards.add(new SetCardInfo("Shagrat, Loot Bearer", 228, Rarity.RARE, mage.cards.s.ShagratLootBearer.class)); cards.add(new SetCardInfo("Shelob's Ambush", 108, Rarity.COMMON, mage.cards.s.ShelobsAmbush.class)); cards.add(new SetCardInfo("Shire Scarecrow", 249, Rarity.COMMON, mage.cards.s.ShireScarecrow.class));