From b72febb316d5953ea6f69fdf18c5fdb4d5b245e3 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 27 Jul 2021 21:13:09 -0400 Subject: [PATCH] [AFC] Implemented Minn, Wily Illusionist --- .../src/mage/cards/m/MinnWilyIllusionist.java | 99 +++++++++++++++++++ .../mage/sets/ForgottenRealmsCommander.java | 1 + .../token/MinnWilyIllusionistToken.java | 48 +++++++++ 3 files changed, 148 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MinnWilyIllusionist.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/MinnWilyIllusionistToken.java diff --git a/Mage.Sets/src/mage/cards/m/MinnWilyIllusionist.java b/Mage.Sets/src/mage/cards/m/MinnWilyIllusionist.java new file mode 100644 index 0000000000..454c45fe48 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MinnWilyIllusionist.java @@ -0,0 +1,99 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.common.DrawSecondCardTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterPermanentCard; +import mage.filter.predicate.mageobject.ManaValuePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.MinnWilyIllusionistToken; +import mage.players.Player; +import mage.target.common.TargetCardInHand; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MinnWilyIllusionist extends CardImpl { + + private static final FilterPermanent filter + = new FilterControlledCreaturePermanent(SubType.ILLUSION, "an Illusion you control"); + + public MinnWilyIllusionist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.GNOME); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // Whenever you draw your second card each turn, create a 1/1 blue Illusion creature token with "This creature gets +1/+0 for each other Illusion you control." + this.addAbility(new DrawSecondCardTriggeredAbility( + new CreateTokenEffect(new MinnWilyIllusionistToken()), false + )); + + // Whenever an Illusion you control dies, you may put a permanent card with mana value less than or equal to that creature's power from your hand onto the battlefield. + this.addAbility(new DiesCreatureTriggeredAbility(new MinnWilyIllusionistEffect(), false, filter)); + } + + private MinnWilyIllusionist(final MinnWilyIllusionist card) { + super(card); + } + + @Override + public MinnWilyIllusionist copy() { + return new MinnWilyIllusionist(this); + } +} + +class MinnWilyIllusionistEffect extends OneShotEffect { + + MinnWilyIllusionistEffect() { + super(Outcome.Benefit); + staticText = "you may put a permanent card with mana value less than or equal " + + "to that creature's power from your hand onto the battlefield"; + } + + private MinnWilyIllusionistEffect(final MinnWilyIllusionistEffect effect) { + super(effect); + } + + @Override + public MinnWilyIllusionistEffect copy() { + return new MinnWilyIllusionistEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = (Permanent) getValue("creatureDied"); + if (player == null || permanent == null) { + return false; + } + FilterCard filterCard = new FilterPermanentCard( + "permanent card with mana value " + + permanent.getPower().getValue() + " or less" + ); + filterCard.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, permanent.getPower().getValue() + 1)); + TargetCardInHand target = new TargetCardInHand(0, 1, filterCard); + player.choose(Outcome.PutCardInPlay, player.getHand(), target, game); + Card card = game.getCard(target.getFirstTarget()); + if (card == null) { + return false; + } + return player.moveCards(card, Zone.BATTLEFIELD, source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java b/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java index 9dcfaf7f5b..106135b64f 100644 --- a/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java +++ b/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java @@ -144,6 +144,7 @@ public final class ForgottenRealmsCommander extends ExpansionSet { cards.add(new SetCardInfo("Meteor Golem", 210, Rarity.UNCOMMON, mage.cards.m.MeteorGolem.class)); cards.add(new SetCardInfo("Midnight Pathlighter", 52, Rarity.RARE, mage.cards.m.MidnightPathlighter.class)); cards.add(new SetCardInfo("Mind Stone", 211, Rarity.UNCOMMON, mage.cards.m.MindStone.class)); + cards.add(new SetCardInfo("Minn, Wily Illusionist", 16, Rarity.RARE, mage.cards.m.MinnWilyIllusionist.class)); cards.add(new SetCardInfo("Mishra's Factory", 248, Rarity.UNCOMMON, mage.cards.m.MishrasFactory.class)); cards.add(new SetCardInfo("Moonsilver Spear", 212, Rarity.RARE, mage.cards.m.MoonsilverSpear.class)); cards.add(new SetCardInfo("Mortuary Mire", 249, Rarity.COMMON, mage.cards.m.MortuaryMire.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/MinnWilyIllusionistToken.java b/Mage/src/main/java/mage/game/permanent/token/MinnWilyIllusionistToken.java new file mode 100644 index 0000000000..9f19f8ddd1 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/MinnWilyIllusionistToken.java @@ -0,0 +1,48 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; + +/** + * @author TheElk801 + */ +public final class MinnWilyIllusionistToken extends TokenImpl { + + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.ILLUSION); + + static { + filter.add(AnotherPredicate.instance); + } + + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter); + + public MinnWilyIllusionistToken() { + super("Illusion", "1/1 blue Illusion creature token with \"This creature gets +1/+0 for each other Illusion you control.\""); + cardType.add(CardType.CREATURE); + color.setBlue(true); + subtype.add(SubType.ILLUSION); + power = new MageInt(1); + toughness = new MageInt(1); + addAbility(new SimpleStaticAbility(new BoostSourceEffect( + xValue, StaticValue.get(0), Duration.WhileOnBattlefield + ).setText("this creature gets +1/+0 for each other Illusion you control"))); + } + + public MinnWilyIllusionistToken(final MinnWilyIllusionistToken token) { + super(token); + } + + public MinnWilyIllusionistToken copy() { + return new MinnWilyIllusionistToken(this); + } +}