From d40c09fea0dd823b5f20977af2a1bf65c2d2ceb9 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Thu, 8 Jun 2023 21:08:29 -0400 Subject: [PATCH] [LTR] Implement Scroll of Isildur --- .../src/mage/cards/s/ScrollOfIsildur.java | 106 ++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 107 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/ScrollOfIsildur.java diff --git a/Mage.Sets/src/mage/cards/s/ScrollOfIsildur.java b/Mage.Sets/src/mage/cards/s/ScrollOfIsildur.java new file mode 100644 index 0000000000..294ecc6091 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/ScrollOfIsildur.java @@ -0,0 +1,106 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.common.SagaAbility; +import mage.abilities.effects.Effects; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.effects.keyword.TheRingTemptsYouEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.TappedPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetArtifactPermanent; +import mage.target.common.TargetCreaturePermanent; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ScrollOfIsildur extends CardImpl { + + public ScrollOfIsildur(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); + + this.subtype.add(SubType.SAGA); + + // (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.) + SagaAbility sagaAbility = new SagaAbility(this); + + // I -- Gain control of up to one target artifact for as long as you control Scroll of Isildur. The Ring tempts you. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_I, + new Effects( + new GainControlTargetEffect(Duration.WhileControlled), new TheRingTemptsYouEffect() + ), new TargetArtifactPermanent(0, 1) + ); + + // II -- Tap up to two target creatures. Put a stun counter on each of them. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_II, SagaChapter.CHAPTER_II, + new Effects( + new TapTargetEffect(), new AddCountersTargetEffect(CounterType.STUN.createInstance()) + .setText("Put a stun counter on each of them") + ), new TargetCreaturePermanent(0, 2) + ); + + // III - Draw a card for each tapped creature target opponent controls. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_III, SagaChapter.CHAPTER_III, + new ScrollOfIsildurEffect(), new TargetOpponent() + ); + this.addAbility(sagaAbility); + } + + private ScrollOfIsildur(final ScrollOfIsildur card) { + super(card); + } + + @Override + public ScrollOfIsildur copy() { + return new ScrollOfIsildur(this); + } +} + +class ScrollOfIsildurEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent(); + + static { + filter.add(TappedPredicate.TAPPED); + } + + ScrollOfIsildurEffect() { + super(Outcome.Benefit); + staticText = "draw a card for each tapped creature target opponent controls"; + } + + private ScrollOfIsildurEffect(final ScrollOfIsildurEffect effect) { + super(effect); + } + + @Override + public ScrollOfIsildurEffect copy() { + return new ScrollOfIsildurEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (player == null || opponent == null) { + return false; + } + int count = game.getBattlefield().count(filter, opponent.getId(), source, game); + return count > 0 && player.drawCards(count, source, game) > 0; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index ef3b78a5f0..718dfd83b4 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -119,6 +119,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Saruman's Trickery", 68, Rarity.UNCOMMON, mage.cards.s.SarumansTrickery.class)); cards.add(new SetCardInfo("Sauron, the Lidless Eye", 288, Rarity.MYTHIC, mage.cards.s.SauronTheLidlessEye.class)); cards.add(new SetCardInfo("Sauron, the Necromancer", 106, Rarity.RARE, mage.cards.s.SauronTheNecromancer.class)); + 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("Shelob's Ambush", 108, Rarity.COMMON, mage.cards.s.ShelobsAmbush.class));