From fd1e142a4e7af2c9055de50bbc8cb6e0b6597a24 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sat, 17 Jan 2026 09:30:45 -0500 Subject: [PATCH] [ECL] Implement End-Blaze Epiphany --- .../src/mage/cards/e/EndBlazeEpiphany.java | 79 +++++++++++++++++++ Mage.Sets/src/mage/sets/LorwynEclipsed.java | 2 + ...WhenTargetDiesDelayedTriggeredAbility.java | 1 + 3 files changed, 82 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/EndBlazeEpiphany.java diff --git a/Mage.Sets/src/mage/cards/e/EndBlazeEpiphany.java b/Mage.Sets/src/mage/cards/e/EndBlazeEpiphany.java new file mode 100644 index 00000000000..4572eabe11a --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EndBlazeEpiphany.java @@ -0,0 +1,79 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.delayed.WhenTargetDiesDelayedTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.GetXValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.ExileTopXMayPlayUntilEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EndBlazeEpiphany extends CardImpl { + + public EndBlazeEpiphany(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{R}"); + + // End-Blaze Epiphany deals X damage to target creature. When that creature dies this turn, exile a number of cards from the top of your library equal to its power, then choose a card exiled this way. Until the end of your next turn, you may play that card. + this.getSpellAbility().addEffect(new DamageTargetEffect(GetXValue.instance)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect( + new WhenTargetDiesDelayedTriggeredAbility(new ExileTopXMayPlayUntilEffect( + EndBlazeEpiphanyValue.instance, true, Duration.UntilEndOfYourNextTurn + ).setText("exile a number of cards from the top of your library equal to its power, " + + "then choose a card exiled this way. Until the end of your next turn, you may play that card")) + )); + } + + private EndBlazeEpiphany(final EndBlazeEpiphany card) { + super(card); + } + + @Override + public EndBlazeEpiphany copy() { + return new EndBlazeEpiphany(this); + } +} + +enum EndBlazeEpiphanyValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return Optional + .ofNullable((Permanent) effect.getValue("creatureDied")) + .map(MageObject::getPower) + .map(MageInt::getValue) + .orElse(0); + } + + @Override + public EndBlazeEpiphanyValue copy() { + return this; + } + + @Override + public String getMessage() { + return ""; + } + + @Override + public String toString() { + return "1"; + } +} diff --git a/Mage.Sets/src/mage/sets/LorwynEclipsed.java b/Mage.Sets/src/mage/sets/LorwynEclipsed.java index 94ab632cb47..e4816cf6c76 100644 --- a/Mage.Sets/src/mage/sets/LorwynEclipsed.java +++ b/Mage.Sets/src/mage/sets/LorwynEclipsed.java @@ -144,6 +144,8 @@ public final class LorwynEclipsed extends ExpansionSet { cards.add(new SetCardInfo("Emptiness", 222, Rarity.MYTHIC, mage.cards.e.Emptiness.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Emptiness", 294, Rarity.MYTHIC, mage.cards.e.Emptiness.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Encumbered Reejerey", 14, Rarity.UNCOMMON, mage.cards.e.EncumberedReejerey.class)); + cards.add(new SetCardInfo("End-Blaze Epiphany", 134, Rarity.RARE, mage.cards.e.EndBlazeEpiphany.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("End-Blaze Epiphany", 364, Rarity.RARE, mage.cards.e.EndBlazeEpiphany.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Enraged Flamecaster", 135, Rarity.COMMON, mage.cards.e.EnragedFlamecaster.class)); cards.add(new SetCardInfo("Evershrike's Gift", 15, Rarity.UNCOMMON, mage.cards.e.EvershrikesGift.class)); cards.add(new SetCardInfo("Evolving Wilds", 264, Rarity.COMMON, mage.cards.e.EvolvingWilds.class)); diff --git a/Mage/src/main/java/mage/abilities/common/delayed/WhenTargetDiesDelayedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/delayed/WhenTargetDiesDelayedTriggeredAbility.java index 1e0b599c360..5c148ffc0fd 100644 --- a/Mage/src/main/java/mage/abilities/common/delayed/WhenTargetDiesDelayedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/delayed/WhenTargetDiesDelayedTriggeredAbility.java @@ -87,6 +87,7 @@ public class WhenTargetDiesDelayedTriggeredAbility extends DelayedTriggeredAbili getEffects().setTargetPointer(new FixedTarget(permanent.getControllerId())); break; } + getEffects().setValue("creatureDied", zEvent.getTarget()); return true; } }