From fe7b9e3e98535b2211f650b5b146b38a78cbc85a Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 29 Aug 2025 22:13:07 -0400 Subject: [PATCH] [SPM] Implement Mysterio, Master of Illusion --- .../cards/m/MysterioMasterOfIllusion.java | 119 ++++++++++++++++++ Mage.Sets/src/mage/sets/MarvelsSpiderMan.java | 2 + .../permanent/token/IllusionVillainToken.java | 30 +++++ 3 files changed, 151 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MysterioMasterOfIllusion.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/IllusionVillainToken.java diff --git a/Mage.Sets/src/mage/cards/m/MysterioMasterOfIllusion.java b/Mage.Sets/src/mage/cards/m/MysterioMasterOfIllusion.java new file mode 100644 index 00000000000..865ae79068b --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MysterioMasterOfIllusion.java @@ -0,0 +1,119 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +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.IllusionVillainToken; +import mage.game.permanent.token.Token; +import mage.target.targetpointer.FixedTargets; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MysterioMasterOfIllusion extends CardImpl { + + public MysterioMasterOfIllusion(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.VILLAIN); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Mysterio enters, create a 3/3 blue Illusion Villain creature token for each nontoken Villain you control. Exile those tokens when Mysterio leaves the battlefield. + this.addAbility(new EntersBattlefieldTriggeredAbility(new MysterioMasterOfIllusionEffect())); + } + + private MysterioMasterOfIllusion(final MysterioMasterOfIllusion card) { + super(card); + } + + @Override + public MysterioMasterOfIllusion copy() { + return new MysterioMasterOfIllusion(this); + } +} + +class MysterioMasterOfIllusionEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.VILLAIN); + + static { + filter.add(TokenPredicate.FALSE); + } + + MysterioMasterOfIllusionEffect() { + super(Outcome.Benefit); + staticText = "create a 3/3 blue Illusion Villain creature token for each nontoken Villain you control. " + + "Exile those tokens when {this} leaves the battlefield"; + } + + private MysterioMasterOfIllusionEffect(final MysterioMasterOfIllusionEffect effect) { + super(effect); + } + + @Override + public MysterioMasterOfIllusionEffect copy() { + return new MysterioMasterOfIllusionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Token token = new IllusionVillainToken(); + token.putOntoBattlefield(game.getBattlefield().count(filter, source.getControllerId(), source, game), game, source); + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + if (permanent != null) { + game.addDelayedTriggeredAbility(new MysterioMasterOfIllusionTriggeredAbility(token, game), source); + } + return true; + } +} + +class MysterioMasterOfIllusionTriggeredAbility extends DelayedTriggeredAbility { + + MysterioMasterOfIllusionTriggeredAbility(Token token, Game game) { + super(new ExileTargetEffect().setTargetPointer(new FixedTargets(token, game)), Duration.Custom, true, false); + this.setLeavesTheBattlefieldTrigger(true); + } + + private MysterioMasterOfIllusionTriggeredAbility(final MysterioMasterOfIllusionTriggeredAbility ability) { + super(ability); + } + + @Override + public MysterioMasterOfIllusionTriggeredAbility copy() { + return new MysterioMasterOfIllusionTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return Zone.BATTLEFIELD.match(((ZoneChangeEvent) event).getFromZone()) + && event.getSourceId().equals(getSourceId()); + } + + @Override + public String getRule() { + return "Exile those tokens when {this} leaves the battlefield."; + } +} diff --git a/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java b/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java index 39db2d19d5a..d9d2c03801e 100644 --- a/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java +++ b/Mage.Sets/src/mage/sets/MarvelsSpiderMan.java @@ -61,6 +61,8 @@ public final class MarvelsSpiderMan extends ExpansionSet { cards.add(new SetCardInfo("Mountain", 197, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Multiversal Passage", 180, Rarity.RARE, mage.cards.m.MultiversalPassage.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Multiversal Passage", 206, Rarity.RARE, mage.cards.m.MultiversalPassage.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Mysterio, Master of Illusion", 37, Rarity.RARE, mage.cards.m.MysterioMasterOfIllusion.class)); + cards.add(new SetCardInfo("Origin of Spider-Man", 218, Rarity.RARE, mage.cards.o.OriginOfSpiderMan.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Origin of Spider-Man", 218, Rarity.RARE, mage.cards.o.OriginOfSpiderMan.class, FULL_ART_USE_VARIOUS)); cards.add(new SetCardInfo("Origin of Spider-Man", 9, Rarity.RARE, mage.cards.o.OriginOfSpiderMan.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Oscorp Research Team", 40, Rarity.COMMON, mage.cards.o.OscorpResearchTeam.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/IllusionVillainToken.java b/Mage/src/main/java/mage/game/permanent/token/IllusionVillainToken.java new file mode 100644 index 00000000000..9862f81e717 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/IllusionVillainToken.java @@ -0,0 +1,30 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class IllusionVillainToken extends TokenImpl { + + public IllusionVillainToken() { + super("Illusion Token", "3/3 blue Illusion Villain creature token"); + cardType.add(CardType.CREATURE); + color.setBlue(true); + + subtype.add(SubType.ILLUSION); + subtype.add(SubType.VILLAIN); + power = new MageInt(3); + toughness = new MageInt(3); + } + + private IllusionVillainToken(final IllusionVillainToken token) { + super(token); + } + + public IllusionVillainToken copy() { + return new IllusionVillainToken(this); + } +}