From f76a7bf9db7361dfd8290a161db383093b80ea3c Mon Sep 17 00:00:00 2001 From: im-inuenc Date: Sat, 15 Mar 2025 00:55:43 +0000 Subject: [PATCH] Implement [FIC] Y'shtola, Night's Blessed (#13381) Co-authored-by: im-inuenc --- .../mage/cards/y/YshtolaNightsBlessed.java | 94 +++++++++++++++++++ .../src/mage/sets/FinalFantasyCommander.java | 4 + 2 files changed, 98 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/y/YshtolaNightsBlessed.java diff --git a/Mage.Sets/src/mage/cards/y/YshtolaNightsBlessed.java b/Mage.Sets/src/mage/cards/y/YshtolaNightsBlessed.java new file mode 100644 index 00000000000..d3e1214ef55 --- /dev/null +++ b/Mage.Sets/src/mage/cards/y/YshtolaNightsBlessed.java @@ -0,0 +1,94 @@ +package mage.cards.y; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.hint.ConditionHint; +import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; +import mage.constants.*; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.filter.FilterSpell; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ManaValuePredicate; +import mage.game.Game; +import mage.watchers.common.PlayerLostLifeWatcher; + +/** + * + * @author inuenc + */ +public final class YshtolaNightsBlessed extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("a noncreature spell with mana value 3 or greater"); + + static { + filter.add(Predicates.not(CardType.CREATURE.getPredicate())); + filter.add(new ManaValuePredicate(ComparisonType.MORE_THAN, 2)); + } + + public YshtolaNightsBlessed(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}{B}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.CAT); + this.subtype.add(SubType.WARLOCK); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // At the beginning of each end step, if a player lost 4 or more life this turn, you draw a card. + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new BeginningOfEndStepTriggeredAbility( + TargetController.ANY, + new DrawCardSourceControllerEffect(1), + false + ), YshtolaNightsBlessedCondition.instance, "At the beginning of each end step, " + + "if a player lost 4 or more life this turn, you draw a card." + ).addHint(new ConditionHint(YshtolaNightsBlessedCondition.instance, "A player lost 4 or more life this turn"))); + + // Whenever you cast a noncreature spell with mana value 3 or greater, Y'shtola deals 2 damage to each opponent and you gain 2 life. + Ability ability = new SpellCastControllerTriggeredAbility( + new DamagePlayersEffect( + 2, TargetController.OPPONENT, "Y'shtola"), + filter, false + ); + ability.addEffect(new GainLifeEffect(2).setText("and you gain 2 life")); + this.addAbility(ability); + } + + private YshtolaNightsBlessed(final YshtolaNightsBlessed card) { + super(card); + } + + @Override + public YshtolaNightsBlessed copy() { + return new YshtolaNightsBlessed(this); + } +} + +enum YshtolaNightsBlessedCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class); + if (watcher == null) { + return false; + } + return game + .getState() + .getPlayersInRange(source.getControllerId(), game) + .stream() + .anyMatch(uuid -> watcher.getLifeLost(uuid) > 3); + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java index 2ab48df6768..4ff84c01c39 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java +++ b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java @@ -20,5 +20,9 @@ public final class FinalFantasyCommander extends ExpansionSet { this.hasBasicLands = false; cards.add(new SetCardInfo("Terra, Herald of Hope", 4, Rarity.MYTHIC, mage.cards.t.TerraHeraldOfHope.class)); + cards.add(new SetCardInfo("Y'shtola, Night's Blessed", 7, Rarity.MYTHIC, mage.cards.y.YshtolaNightsBlessed.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Y'shtola, Night's Blessed", 191, Rarity.MYTHIC, mage.cards.y.YshtolaNightsBlessed.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Y'shtola, Night's Blessed", 215, Rarity.MYTHIC, mage.cards.y.YshtolaNightsBlessed.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Y'shtola, Night's Blessed", 226, Rarity.MYTHIC, mage.cards.y.YshtolaNightsBlessed.class, NON_FULL_USE_VARIOUS)); } }