From b016e0fa71b5eebdb85fce1b4a29ec04da280f0d Mon Sep 17 00:00:00 2001 From: jimga150 Date: Wed, 14 Aug 2024 21:10:16 -0400 Subject: [PATCH] [BLB] Implement Wishing Well (#12633) --- Mage.Sets/src/mage/cards/w/WishingWell.java | 96 +++++++++++++++++++++ Mage.Sets/src/mage/sets/Bloomburrow.java | 1 + 2 files changed, 97 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WishingWell.java diff --git a/Mage.Sets/src/mage/cards/w/WishingWell.java b/Mage.Sets/src/mage/cards/w/WishingWell.java new file mode 100644 index 00000000000..307c698c3ed --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WishingWell.java @@ -0,0 +1,96 @@ +package mage.cards.w; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.MayCastTargetCardEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.common.FilterInstantOrSorceryCard; +import mage.filter.predicate.mageobject.ManaValuePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author jimga150 + */ +public final class WishingWell extends CardImpl { + + public WishingWell(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}{U}"); + + + // {T}: Put a coin counter on Wishing Well. + // When you do, you may cast target instant or sorcery card with mana value equal to the number of coin counters + // on Wishing Well from your graveyard without paying its mana cost. If that spell would be put into your + // graveyard, exile it instead. Activate only as a sorcery. + this.addAbility(new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new WishingWellEffect(), new TapSourceCost())); + } + + private WishingWell(final WishingWell card) { + super(card); + } + + @Override + public WishingWell copy() { + return new WishingWell(this); + } +} + +// Based on AjaniNacatlAvengerZeroEffect and AetherVialEffect +class WishingWellEffect extends OneShotEffect { + + WishingWellEffect() { + super(Outcome.PutCreatureInPlay); + staticText = "Put a coin counter on {this}. " + + "When you do, you may cast target instant or sorcery card with mana value equal to the number of coin " + + "counters on {this} from your graveyard without paying its mana cost. If that spell would be put " + + "into your graveyard, exile it instead"; + } + + private WishingWellEffect(final WishingWellEffect effect) { + super(effect); + } + + @Override + public WishingWellEffect copy() { + return new WishingWellEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + + if (!new AddCountersSourceEffect(CounterType.COIN.createInstance(), true).apply(game, source)) { + return false; + } + + Permanent permanent = source.getSourcePermanentOrLKI(game); + if (permanent == null) { + return false; + } + int count = permanent.getCounters(game).getCount(CounterType.COIN); + + FilterInstantOrSorceryCard filter = new FilterInstantOrSorceryCard("instant or sorcery card with mana value " + count); + filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, count)); + + ReflexiveTriggeredAbility reflexive = new ReflexiveTriggeredAbility( + new MayCastTargetCardEffect(CastManaAdjustment.WITHOUT_PAYING_MANA_COST, true), + true, + "When you do, you may cast target instant or sorcery card with mana value equal to the number of " + + "coin counters on {this} from your graveyard without paying its mana cost. If that spell " + + "would be put into your graveyard, exile it instead" + ); + reflexive.addTarget(new TargetCardInYourGraveyard(filter)); + game.fireReflexiveTriggeredAbility(reflexive, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Bloomburrow.java b/Mage.Sets/src/mage/sets/Bloomburrow.java index 7a4250d6c1f..265dead90f4 100644 --- a/Mage.Sets/src/mage/sets/Bloomburrow.java +++ b/Mage.Sets/src/mage/sets/Bloomburrow.java @@ -272,6 +272,7 @@ public final class Bloomburrow extends ExpansionSet { cards.add(new SetCardInfo("Wick, the Whorled Mind", 120, Rarity.RARE, mage.cards.w.WickTheWhorledMind.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Wick, the Whorled Mind", 314, Rarity.RARE, mage.cards.w.WickTheWhorledMind.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Wildfire Howl", 162, Rarity.UNCOMMON, mage.cards.w.WildfireHowl.class)); + cards.add(new SetCardInfo("Wishing Well", 81, Rarity.RARE, mage.cards.w.WishingWell.class)); cards.add(new SetCardInfo("Ygra, Eater of All", 241, Rarity.MYTHIC, mage.cards.y.YgraEaterOfAll.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Ygra, Eater of All", 294, Rarity.MYTHIC, mage.cards.y.YgraEaterOfAll.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Zoraline, Cosmos Caller", 242, Rarity.RARE, mage.cards.z.ZoralineCosmosCaller.class));