From a998017ddd80c311635ce860056ec43beeee66f2 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Mon, 5 Jun 2023 23:18:12 -0400 Subject: [PATCH] [LTR] Implement Elrond, Lord of Rivendell --- .../mage/cards/e/ElrondLordOfRivendell.java | 49 +++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + .../IfAbilityHasResolvedXTimesEffect.java | 4 ++ 3 files changed, 54 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/ElrondLordOfRivendell.java diff --git a/Mage.Sets/src/mage/cards/e/ElrondLordOfRivendell.java b/Mage.Sets/src/mage/cards/e/ElrondLordOfRivendell.java new file mode 100644 index 0000000000..1edaef9302 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/ElrondLordOfRivendell.java @@ -0,0 +1,49 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility; +import mage.abilities.effects.common.IfAbilityHasResolvedXTimesEffect; +import mage.abilities.effects.keyword.ScryEffect; +import mage.abilities.effects.keyword.TheRingTemptsYouEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.StaticFilters; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ElrondLordOfRivendell extends CardImpl { + + public ElrondLordOfRivendell(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.ELF); + this.subtype.add(SubType.NOBLE); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // Whenever Elrond, Lord of Rivendell or another creature enters the battlefield under your control, scry 1. If this is the second time this ability has resolved this turn, the Ring tempts you. + Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility( + new ScryEffect(1, false), + StaticFilters.FILTER_PERMANENT_CREATURE, false, true + ); + ability.addEffect(new IfAbilityHasResolvedXTimesEffect(2, new TheRingTemptsYouEffect())); + this.addAbility(ability); + } + + private ElrondLordOfRivendell(final ElrondLordOfRivendell card) { + super(card); + } + + @Override + public ElrondLordOfRivendell copy() { + return new ElrondLordOfRivendell(this); + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index e22a471548..9982344d4b 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -37,6 +37,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Dunedain Blade", 6, Rarity.COMMON, mage.cards.d.DunedainBlade.class)); cards.add(new SetCardInfo("Easterling Vanguard", 83, Rarity.COMMON, mage.cards.e.EasterlingVanguard.class)); cards.add(new SetCardInfo("Eastfarthing Farmer", 8, Rarity.COMMON, mage.cards.e.EastfarthingFarmer.class)); + cards.add(new SetCardInfo("Elrond, Lord of Rivendell", 49, Rarity.UNCOMMON, mage.cards.e.ElrondLordOfRivendell.class)); cards.add(new SetCardInfo("Fall of Gil-galad", 165, Rarity.RARE, mage.cards.f.FallOfGilGalad.class)); cards.add(new SetCardInfo("Fangorn, Tree Shepherd", 166, Rarity.RARE, mage.cards.f.FangornTreeShepherd.class)); cards.add(new SetCardInfo("Fiery Inscription", 126, Rarity.UNCOMMON, mage.cards.f.FieryInscription.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/IfAbilityHasResolvedXTimesEffect.java b/Mage/src/main/java/mage/abilities/effects/common/IfAbilityHasResolvedXTimesEffect.java index d345479907..8cd237ff56 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/IfAbilityHasResolvedXTimesEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/IfAbilityHasResolvedXTimesEffect.java @@ -18,6 +18,10 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect { private final int resolutionNumber; private final Effect effect; + public IfAbilityHasResolvedXTimesEffect(int resolutionNumber, Effect effect) { + this(effect.getOutcome(), resolutionNumber, effect); + } + public IfAbilityHasResolvedXTimesEffect(Outcome outcome, int resolutionNumber, Effect effect) { super(outcome); this.resolutionNumber = resolutionNumber;