[MH2] Implemented Magus of the Bridge (#7886)

This commit is contained in:
Daniel Bomar 2021-06-04 19:01:23 -05:00 committed by GitHub
parent 0d84a4a133
commit 4bf1ce9c0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 100 additions and 0 deletions

View file

@ -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();
}
}

View file

@ -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));