From 8570cd88d9163a8bbd3626c9b8d2ed086b6ea64d Mon Sep 17 00:00:00 2001 From: theelk801 Date: Wed, 31 May 2023 08:38:03 -0400 Subject: [PATCH] [LTR] Implement Council's Deliberation --- .../mage/cards/c/CouncilsDeliberation.java | 80 +++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 81 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CouncilsDeliberation.java diff --git a/Mage.Sets/src/mage/cards/c/CouncilsDeliberation.java b/Mage.Sets/src/mage/cards/c/CouncilsDeliberation.java new file mode 100644 index 0000000000..81f1d03434 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CouncilsDeliberation.java @@ -0,0 +1,80 @@ +package mage.cards.c; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.costs.common.ExileSourceFromGraveCost; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.events.GameEvent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CouncilsDeliberation extends CardImpl { + + public CouncilsDeliberation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); + + // Draw a card. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); + + // Whenever you scry, if you control an Island, you may exile Council's Deliberation from your graveyard. If you do, draw a card. + this.addAbility(new CouncilsDeliberationTriggeredAbility()); + } + + private CouncilsDeliberation(final CouncilsDeliberation card) { + super(card); + } + + @Override + public CouncilsDeliberation copy() { + return new CouncilsDeliberation(this); + } +} + +class CouncilsDeliberationTriggeredAbility extends TriggeredAbilityImpl { + + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.ISLAND); + + CouncilsDeliberationTriggeredAbility() { + super(Zone.GRAVEYARD, new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new ExileSourceFromGraveCost())); + } + + private CouncilsDeliberationTriggeredAbility(final CouncilsDeliberationTriggeredAbility ability) { + super(ability); + } + + @Override + public CouncilsDeliberationTriggeredAbility copy() { + return new CouncilsDeliberationTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SCRIED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return isControlledBy(event.getPlayerId()); + } + + @Override + public boolean checkInterveningIfClause(Game game) { + return game.getBattlefield().contains(filter, this, game, 1); + } + + @Override + public String getRule() { + return "Whenever you scry, if you control an Island, you may exile {this} from your graveyard. If you do, draw a card."; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index b87b2cb2b4..a5c63ef7cc 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -24,6 +24,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Bilbo, Retired Burglar", 196, Rarity.UNCOMMON, mage.cards.b.BilboRetiredBurglar.class)); cards.add(new SetCardInfo("Call of the Ring", 79, Rarity.RARE, mage.cards.c.CallOfTheRing.class)); cards.add(new SetCardInfo("Cast into the Fire", 118, Rarity.COMMON, mage.cards.c.CastIntoTheFire.class)); + cards.add(new SetCardInfo("Council's Deliberation", 48, Rarity.UNCOMMON, mage.cards.c.CouncilsDeliberation.class)); cards.add(new SetCardInfo("Dunedain Blade", 6, Rarity.COMMON, mage.cards.d.DunedainBlade.class)); cards.add(new SetCardInfo("Dunland Crebain", 82, Rarity.COMMON, mage.cards.d.DunlandCrebain.class)); cards.add(new SetCardInfo("Forest", 270, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));