From 3fc930591935f48de2e8c0704f18129f347b1f98 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Fri, 3 Nov 2023 18:24:13 +0100 Subject: [PATCH] [LCI] Implement Malicious Eclipse --- .../src/mage/cards/m/MaliciousEclipse.java | 89 +++++++++++++++++++ .../src/mage/sets/TheLostCavernsOfIxalan.java | 1 + 2 files changed, 90 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MaliciousEclipse.java diff --git a/Mage.Sets/src/mage/cards/m/MaliciousEclipse.java b/Mage.Sets/src/mage/cards/m/MaliciousEclipse.java new file mode 100644 index 00000000000..b21b1cfb35e --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MaliciousEclipse.java @@ -0,0 +1,89 @@ +package mage.cards.m; + +import mage.abilities.Ability; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.continuous.BoostAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class MaliciousEclipse extends CardImpl { + + public MaliciousEclipse(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}"); + + // All creatures get -2/-2 until end of turn. If a creature an opponent controls would die this turn, exile it instead. + this.getSpellAbility().addEffect(new BoostAllEffect(-2, -2, Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new MaliciousEclipseReplacementEffect()); + } + + private MaliciousEclipse(final MaliciousEclipse card) { + super(card); + } + + @Override + public MaliciousEclipse copy() { + return new MaliciousEclipse(this); + } +} + +/** + * Inspired by {@link MaliciousMalfunction} + */ +class MaliciousEclipseReplacementEffect extends ReplacementEffectImpl { + + public MaliciousEclipseReplacementEffect() { + super(Duration.EndOfTurn, Outcome.Exile); + this.staticText = "If a creature an opponent controls would die this turn, exile it instead"; + } + + private MaliciousEclipseReplacementEffect(final MaliciousEclipseReplacementEffect effect) { + super(effect); + } + + @Override + public MaliciousEclipseReplacementEffect copy() { + return new MaliciousEclipseReplacementEffect(this); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Permanent permanent = ((ZoneChangeEvent) event).getTarget(); + if (permanent != null) { + Player player = game.getPlayer(permanent.getControllerId()); + if (player != null) { + return player.moveCards(permanent, Zone.EXILED, source, game); + } + } + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + return zEvent.getTarget() != null && + StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE.match( + zEvent.getTarget(), source.getControllerId(), + source, game) + && zEvent.isDiesEvent(); + } +} diff --git a/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java b/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java index 8fbf35a8ba2..be33ebceaac 100644 --- a/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java +++ b/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java @@ -120,6 +120,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Lodestone Needle", 62, Rarity.UNCOMMON, mage.cards.l.LodestoneNeedle.class)); cards.add(new SetCardInfo("Malamet War Scribe", 21, Rarity.UNCOMMON, mage.cards.m.MalametWarScribe.class)); cards.add(new SetCardInfo("Malcolm, Alluring Scoundrel", 63, Rarity.RARE, mage.cards.m.MalcolmAlluringScoundrel.class)); + cards.add(new SetCardInfo("Malicious Eclipse", 111, Rarity.UNCOMMON, mage.cards.m.MaliciousEclipse.class)); cards.add(new SetCardInfo("Master's Guide-Mural", 233, Rarity.UNCOMMON, mage.cards.m.MastersGuideMural.class)); cards.add(new SetCardInfo("Master's Manufactory", 233, Rarity.UNCOMMON, mage.cards.m.MastersManufactory.class)); cards.add(new SetCardInfo("Mastercraft Raptor", 164, Rarity.UNCOMMON, mage.cards.m.MastercraftRaptor.class));