From 6d4c7cc67f7014d902e12888bcf63110de65bd0b Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sun, 11 Jun 2023 09:23:26 -0400 Subject: [PATCH] [LTR] Implement Landroval, Horizon Witness --- .../mage/cards/l/LandrovalHorizonWitness.java | 86 +++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LandrovalHorizonWitness.java diff --git a/Mage.Sets/src/mage/cards/l/LandrovalHorizonWitness.java b/Mage.Sets/src/mage/cards/l/LandrovalHorizonWitness.java new file mode 100644 index 0000000000..463ed7f90e --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LandrovalHorizonWitness.java @@ -0,0 +1,86 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterAttackingCreature; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.game.Game; +import mage.game.events.DefenderAttackedEvent; +import mage.game.events.GameEvent; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LandrovalHorizonWitness extends CardImpl { + + public LandrovalHorizonWitness(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.BIRD); + this.subtype.add(SubType.NOBLE); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever two or more creatures you control attack a player, target attacking creature without flying gains flying until end of turn. + this.addAbility(new LandrovalHorizonWitnessTriggeredAbility()); + } + + private LandrovalHorizonWitness(final LandrovalHorizonWitness card) { + super(card); + } + + @Override + public LandrovalHorizonWitness copy() { + return new LandrovalHorizonWitness(this); + } +} + +class LandrovalHorizonWitnessTriggeredAbility extends TriggeredAbilityImpl { + + private static final FilterPermanent filter + = new FilterAttackingCreature("attacking creature without flying"); + + static { + filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); + } + + LandrovalHorizonWitnessTriggeredAbility() { + super(Zone.BATTLEFIELD, new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn)); + this.addTarget(new TargetPermanent(filter)); + } + + private LandrovalHorizonWitnessTriggeredAbility(final LandrovalHorizonWitnessTriggeredAbility ability) { + super(ability); + } + + @Override + public LandrovalHorizonWitnessTriggeredAbility copy() { + return new LandrovalHorizonWitnessTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DEFENDER_ATTACKED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return isControlledBy(event.getPlayerId()) + && game.getPlayer(event.getTargetId()) != null + && ((DefenderAttackedEvent) event).getAttackers(game).size() >= 2; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index 29929a1f8f..92959e8e26 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -116,6 +116,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Ithilien Kingfisher", 58, Rarity.COMMON, mage.cards.i.IthilienKingfisher.class)); cards.add(new SetCardInfo("Knight of the Keep", 291, Rarity.COMMON, mage.cards.k.KnightOfTheKeep.class)); cards.add(new SetCardInfo("Knights of Dol Amroth", 59, Rarity.COMMON, mage.cards.k.KnightsOfDolAmroth.class)); + cards.add(new SetCardInfo("Landroval, Horizon Witness", 21, Rarity.UNCOMMON, mage.cards.l.LandrovalHorizonWitness.class)); cards.add(new SetCardInfo("Lash of the Balrog", 92, Rarity.COMMON, mage.cards.l.LashOfTheBalrog.class)); cards.add(new SetCardInfo("Last March of the Ents", 172, Rarity.MYTHIC, mage.cards.l.LastMarchOfTheEnts.class)); cards.add(new SetCardInfo("Legolas, Counter of Kills", 212, Rarity.UNCOMMON, mage.cards.l.LegolasCounterOfKills.class));