diff --git a/Mage.Sets/src/mage/cards/c/ContainmentPriest.java b/Mage.Sets/src/mage/cards/c/ContainmentPriest.java index 5eec1de7e6d..e3cffabc67c 100644 --- a/Mage.Sets/src/mage/cards/c/ContainmentPriest.java +++ b/Mage.Sets/src/mage/cards/c/ContainmentPriest.java @@ -1,4 +1,3 @@ - package mage.cards.c; import java.util.UUID; @@ -29,7 +28,7 @@ import mage.watchers.common.CreatureWasCastWatcher; public final class ContainmentPriest extends CardImpl { public ContainmentPriest(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.CLERIC); @@ -76,11 +75,10 @@ class ContainmentPriestReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (controller != null) { Card card = game.getCard(event.getTargetId()); if (card != null) { - controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, zEvent.getFromZone(), true); + controller.moveCardsToExile(card, source, game, true, null, null); } return true; diff --git a/Mage.Sets/src/mage/cards/m/Mistcaller.java b/Mage.Sets/src/mage/cards/m/Mistcaller.java new file mode 100644 index 00000000000..88f7d3952ed --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/Mistcaller.java @@ -0,0 +1,112 @@ +package mage.cards.m; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.keyword.TransformAbility; +import mage.cards.Card; +import mage.constants.SubType; +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.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.players.Player; +import mage.watchers.common.CreatureWasCastWatcher; + +/** + * + * @author TheElk801 + */ +public final class Mistcaller extends CardImpl { + + public Mistcaller(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}"); + + this.subtype.add(SubType.MERFOLK); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Sacrifice Mistcaller: Until end of turn, if a nontoken creature would enter the battlefield and it wasn't cast, exile it instead. + this.addAbility(new SimpleActivatedAbility( + new ContainmentPriestReplacementEffect(), + new SacrificeSourceCost() + ), new CreatureWasCastWatcher()); + } + + public Mistcaller(final Mistcaller card) { + super(card); + } + + @Override + public Mistcaller copy() { + return new Mistcaller(this); + } +} + +class ContainmentPriestReplacementEffect extends ReplacementEffectImpl { + + public ContainmentPriestReplacementEffect() { + super(Duration.EndOfTurn, Outcome.Exile); + staticText = "until end of turn, if a nontoken creature would enter the battlefield and it wasn't cast, exile it instead"; + } + + public ContainmentPriestReplacementEffect(final ContainmentPriestReplacementEffect effect) { + super(effect); + } + + @Override + public ContainmentPriestReplacementEffect copy() { + return new ContainmentPriestReplacementEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Card card = game.getCard(event.getTargetId()); + if (card != null) { + controller.moveCardsToExile(card, source, game, true, null, null); + } + return true; + + } + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; // Token create the create Token event + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD) { + Card card = game.getCard(event.getTargetId()); + Object entersTransformed = game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + event.getTargetId()); + if (entersTransformed instanceof Boolean && (Boolean) entersTransformed && card.getSecondCardFace() != null) { + card = card.getSecondCardFace(); + } + if (card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly + CreatureWasCastWatcher watcher = (CreatureWasCastWatcher) game.getState().getWatchers().get(CreatureWasCastWatcher.class.getSimpleName()); + if (watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId())) { + return true; + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2019.java b/Mage.Sets/src/mage/sets/CoreSet2019.java index 1afaacc44d7..8896c258b74 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2019.java +++ b/Mage.Sets/src/mage/sets/CoreSet2019.java @@ -116,6 +116,7 @@ public final class CoreSet2019 extends ExpansionSet { cards.add(new SetCardInfo("Militia Bugler", 29, Rarity.UNCOMMON, mage.cards.m.MilitiaBugler.class)); cards.add(new SetCardInfo("Mirror Image", 61, Rarity.UNCOMMON, mage.cards.m.MirrorImage.class)); cards.add(new SetCardInfo("Mist-Cloaked Herald", 310, Rarity.COMMON, mage.cards.m.MistCloakedHerald.class)); + cards.add(new SetCardInfo("Mistcaller", 62, Rarity.RARE, mage.cards.m.Mistcaller.class)); cards.add(new SetCardInfo("Murder", 110, Rarity.UNCOMMON, mage.cards.m.Murder.class)); cards.add(new SetCardInfo("Nexus of Fate", 306, Rarity.MYTHIC, mage.cards.n.NexusOfFate.class)); cards.add(new SetCardInfo("Nicol Bolas, the Arisen", 218, Rarity.MYTHIC, mage.cards.n.NicolBolasTheArisen.class));