From 66d31396fe2fcb774fe740da231a9872fd6eefc5 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 4 Jun 2022 14:08:45 -0400 Subject: [PATCH] [CLB] Implemented From the Catacombs --- .../src/mage/cards/f/FromTheCatacombs.java | 94 +++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + 2 files changed, 95 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FromTheCatacombs.java diff --git a/Mage.Sets/src/mage/cards/f/FromTheCatacombs.java b/Mage.Sets/src/mage/cards/f/FromTheCatacombs.java new file mode 100644 index 00000000000..9eda560ac01 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FromTheCatacombs.java @@ -0,0 +1,94 @@ +package mage.cards.f; + +import mage.abilities.Ability; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldWithCounterTargetEffect; +import mage.abilities.effects.common.TakeTheInitiativeEffect; +import mage.abilities.keyword.EscapeAbility; +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.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.target.common.TargetCardInGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FromTheCatacombs extends CardImpl { + + public FromTheCatacombs(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}{B}"); + + // Return target creature card from a graveyard to the battlefield with a corpse counter on it. If that creature would leave the battlefield, exile it instead of putting it anywhere else. + this.getSpellAbility().addEffect(new ReturnFromGraveyardToBattlefieldWithCounterTargetEffect(CounterType.CORPSE.createInstance())); + this.getSpellAbility().addEffect(new FromTheCatacombsEffect()); + this.getSpellAbility().addTarget(new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE)); + + // You take the initiative. + this.getSpellAbility().addEffect(new TakeTheInitiativeEffect().concatBy("
")); + + // Escape—{3}{B}{B}, Exile four other cards from your graveyard. + this.addAbility(new EscapeAbility(this, "Escape", 4)); + } + + private FromTheCatacombs(final FromTheCatacombs card) { + super(card); + } + + @Override + public FromTheCatacombs copy() { + return new FromTheCatacombs(this); + } +} + +class FromTheCatacombsEffect extends ReplacementEffectImpl { + + FromTheCatacombsEffect() { + super(Duration.Custom, Outcome.Exile); + staticText = "If that creature would leave the battlefield, exile it instead of putting it anywhere else"; + } + + private FromTheCatacombsEffect(final FromTheCatacombsEffect effect) { + super(effect); + } + + @Override + public FromTheCatacombsEffect copy() { + return new FromTheCatacombsEffect(this); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + ((ZoneChangeEvent) event).setToZone(Zone.EXILED); + 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) { + if (event.getTargetId().equals(source.getFirstTarget()) + && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD + && ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) { + return true; + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index cfe0a132de4..76927af6e3e 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -239,6 +239,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Forgotten Creation", 721, Rarity.RARE, mage.cards.f.ForgottenCreation.class)); cards.add(new SetCardInfo("Fractured Sanity", 722, Rarity.RARE, mage.cards.f.FracturedSanity.class)); cards.add(new SetCardInfo("Fraying Line", 314, Rarity.RARE, mage.cards.f.FrayingLine.class)); + cards.add(new SetCardInfo("From the Catacombs", 671, Rarity.RARE, mage.cards.f.FromTheCatacombs.class)); cards.add(new SetCardInfo("Frontline Medic", 693, Rarity.RARE, mage.cards.f.FrontlineMedic.class)); cards.add(new SetCardInfo("Galepowder Mage", 694, Rarity.RARE, mage.cards.g.GalepowderMage.class)); cards.add(new SetCardInfo("Game Trail", 894, Rarity.RARE, mage.cards.g.GameTrail.class));