From 2d433baf18930bc1d9c4c0995aaea930071a7285 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sat, 20 Dec 2025 09:26:10 -0500 Subject: [PATCH] [FIC] Implement Judgment of Alexander --- .../src/mage/cards/j/JudgmentOfAlexander.java | 122 ++++++++++++++++++ .../src/mage/sets/FinalFantasyCommander.java | 1 + 2 files changed, 123 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/j/JudgmentOfAlexander.java diff --git a/Mage.Sets/src/mage/cards/j/JudgmentOfAlexander.java b/Mage.Sets/src/mage/cards/j/JudgmentOfAlexander.java new file mode 100644 index 00000000000..5dece809bf6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/j/JudgmentOfAlexander.java @@ -0,0 +1,122 @@ +package mage.cards.j; + +import mage.abilities.Ability; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.PreventionEffectData; +import mage.abilities.effects.PreventionEffectImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.CommanderPredicate; +import mage.game.Game; +import mage.game.events.DamagePlayerEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class JudgmentOfAlexander extends CardImpl { + + public JudgmentOfAlexander(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}"); + + // Prevent all damage that would be dealt to you this turn by sources your opponents control. Whenever damage from a creature is prevented this way, each commander creature you control deals damage equal to its power to that creature. + this.getSpellAbility().addEffect(new JudgmentOfAlexanderPreventionEffect()); + } + + private JudgmentOfAlexander(final JudgmentOfAlexander card) { + super(card); + } + + @Override + public JudgmentOfAlexander copy() { + return new JudgmentOfAlexander(this); + } +} + +class JudgmentOfAlexanderPreventionEffect extends PreventionEffectImpl { + + JudgmentOfAlexanderPreventionEffect() { + super(Duration.EndOfTurn, Integer.MAX_VALUE, false, false); + staticText = "prevent all damage that would be dealt to you this turn by sources your opponents control. " + + "Whenever damage from a creature is prevented this way, each commander creature you control " + + "deals damage equal to its power to that creature"; + } + + private JudgmentOfAlexanderPreventionEffect(final JudgmentOfAlexanderPreventionEffect effect) { + super(effect); + } + + @Override + public JudgmentOfAlexanderPreventionEffect copy() { + return new JudgmentOfAlexanderPreventionEffect(this); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return super.applies(event, source, game) + && event instanceof DamagePlayerEvent + && event.getAmount() >= 1 + && source.isControlledBy(event.getTargetId()) + && game.getOpponents(source.getControllerId()) + .contains(game.getControllerId(event.getSourceId())); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + PreventionEffectData data = preventDamageAction(event, source, game); + if (data.getPreventedDamage() <1) { + return false; + } + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (permanent != null && permanent.isCreature(game)) { + game.fireReflexiveTriggeredAbility(new ReflexiveTriggeredAbility(new JudgmentOfAlexanderDamageEffect(permanent, game), false), source); + } + return false; + } +} + +class JudgmentOfAlexanderDamageEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent(); + + static { + filter.add(CommanderPredicate.instance); + } + + JudgmentOfAlexanderDamageEffect(Permanent permanent, Game game) { + super(Outcome.Benefit); + this.setTargetPointer(new FixedTarget(permanent, game)); + staticText = "each commander creature you control deals damage equal to its power to that creature"; + } + + private JudgmentOfAlexanderDamageEffect(final JudgmentOfAlexanderDamageEffect effect) { + super(effect); + } + + @Override + public JudgmentOfAlexanderDamageEffect copy() { + return new JudgmentOfAlexanderDamageEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (permanent == null) { + return false; + } + for (Permanent commander : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { + permanent.damage(commander.getPower().getValue(), commander.getId(), source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java index e09fb6f3701..d569cba84e5 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java +++ b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java @@ -234,6 +234,7 @@ public final class FinalFantasyCommander extends ExpansionSet { cards.add(new SetCardInfo("Into the Story", 266, Rarity.UNCOMMON, mage.cards.i.IntoTheStory.class)); cards.add(new SetCardInfo("Island", 479, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Isolated Chapel", 405, Rarity.RARE, mage.cards.i.IsolatedChapel.class)); + cards.add(new SetCardInfo("Judgment of Alexander", 455, Rarity.RARE, mage.cards.j.JudgmentOfAlexander.class)); cards.add(new SetCardInfo("Jungle Shrine", 406, Rarity.UNCOMMON, mage.cards.j.JungleShrine.class)); cards.add(new SetCardInfo("Kefka, Dancing Mad", 174, Rarity.RARE, mage.cards.k.KefkaDancingMad.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Kefka, Dancing Mad", 84, Rarity.RARE, mage.cards.k.KefkaDancingMad.class, NON_FULL_USE_VARIOUS));