From 4bf1ce9c0e4bb83bf4ba672431e61cc97ecde13d Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Fri, 4 Jun 2021 19:01:23 -0500 Subject: [PATCH] [MH2] Implemented Magus of the Bridge (#7886) --- .../src/mage/cards/m/MagusOfTheBridge.java | 99 +++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons2.java | 1 + 2 files changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MagusOfTheBridge.java diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheBridge.java b/Mage.Sets/src/mage/cards/m/MagusOfTheBridge.java new file mode 100644 index 0000000000..d87ec7c5b9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheBridge.java @@ -0,0 +1,99 @@ +package mage.cards.m; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.PutIntoGraveFromBattlefieldAllTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.ExileSourceEffect; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.ZombieToken; +import mage.players.Player; + +/** + * + * @author weirddan455 + */ +public final class MagusOfTheBridge extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a nontoken creature"); + + static { + filter.add(Predicates.not(TokenPredicate.instance)); + } + + public MagusOfTheBridge(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{B}{B}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Whenever a nontoken creature is put into your graveyard from the battlefield, create a 2/2 black Zombie creature token. + this.addAbility(new PutIntoGraveFromBattlefieldAllTriggeredAbility( + new CreateTokenEffect(new ZombieToken()), false, filter, false, true + )); + + // When a creature is put into an opponent's graveyard from the battlefield, exile Magus of the Bridge. + this.addAbility(new MagusOfTheBridgeTriggeredAbility()); + } + + private MagusOfTheBridge(final MagusOfTheBridge card) { + super(card); + } + + @Override + public MagusOfTheBridge copy() { + return new MagusOfTheBridge(this); + } +} + +class MagusOfTheBridgeTriggeredAbility extends TriggeredAbilityImpl { + + public MagusOfTheBridgeTriggeredAbility() { + super(Zone.BATTLEFIELD, new ExileSourceEffect()); + } + + private MagusOfTheBridgeTriggeredAbility(final MagusOfTheBridgeTriggeredAbility ability) { + super(ability); + } + + @Override + public MagusOfTheBridgeTriggeredAbility copy() { + return new MagusOfTheBridgeTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.isDiesEvent()) { + Permanent permanent = zEvent.getTarget(); + Player controller = game.getPlayer(getControllerId()); + return permanent != null && controller != null + && permanent.isCreature() && controller.hasOpponent(permanent.getOwnerId(), game); + } + return false; + } + + @Override + public String getRule() { + return "When a creature is put into an opponent's graveyard from the battlefield, " + super.getRule(); + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons2.java b/Mage.Sets/src/mage/sets/ModernHorizons2.java index 4f57f4f9e1..15d49034e0 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons2.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons2.java @@ -169,6 +169,7 @@ public final class ModernHorizons2 extends ExpansionSet { cards.add(new SetCardInfo("Lonis, Cryptozoologist", 204, Rarity.RARE, mage.cards.l.LonisCryptozoologist.class)); cards.add(new SetCardInfo("Lose Focus", 49, Rarity.COMMON, mage.cards.l.LoseFocus.class)); cards.add(new SetCardInfo("Lucid Dreams", 50, Rarity.UNCOMMON, mage.cards.l.LucidDreams.class)); + cards.add(new SetCardInfo("Magus of the Bridge", 92, Rarity.RARE, mage.cards.m.MagusOfTheBridge.class)); cards.add(new SetCardInfo("Marble Gargoyle", 21, Rarity.COMMON, mage.cards.m.MarbleGargoyle.class)); cards.add(new SetCardInfo("Marsh Flats", 248, Rarity.RARE, mage.cards.m.MarshFlats.class)); cards.add(new SetCardInfo("Master of Death", 205, Rarity.RARE, mage.cards.m.MasterOfDeath.class));