[BLB] Implement Wishing Well (#12633)

This commit is contained in:
jimga150 2024-08-14 21:10:16 -04:00 committed by GitHub
parent 1e414442b3
commit b016e0fa71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 97 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));