From 99dc17ef93f624d88c4038a4219aa1200bf30b1c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 7 Jul 2021 19:01:35 -0400 Subject: [PATCH] [AFR] Implemented Mind Flayer --- Mage.Sets/src/mage/cards/m/MindFlayer.java | 74 +++++++++++++++++++ .../sets/AdventuresInTheForgottenRealms.java | 1 + 2 files changed, 75 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MindFlayer.java diff --git a/Mage.Sets/src/mage/cards/m/MindFlayer.java b/Mage.Sets/src/mage/cards/m/MindFlayer.java new file mode 100644 index 00000000000..287fbd6097b --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MindFlayer.java @@ -0,0 +1,74 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MindFlayer extends CardImpl { + + public MindFlayer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); + + this.subtype.add(SubType.HORROR); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Dominate Monster — When Mind Flayer enters the battlefield, gain control of target creature for as long as you control Mind Flayer. + Ability ability = new EntersBattlefieldTriggeredAbility(new MindFlayerEffect()); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability.withFlavorWord("Dominate Monster")); + } + + private MindFlayer(final MindFlayer card) { + super(card); + } + + @Override + public MindFlayer copy() { + return new MindFlayer(this); + } +} + +class MindFlayerEffect extends GainControlTargetEffect { + + MindFlayerEffect() { + super(Duration.Custom, true); + staticText = "gain control of target creature for as long as you control {this}"; + } + + private MindFlayerEffect(final MindFlayerEffect effect) { + super(effect); + } + + @Override + public MindFlayerEffect copy() { + return new MindFlayerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game); + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (sourcePermanent == null + || permanent == null + || !sourcePermanent.isControlledBy(source.getControllerId())) { + discard(); + return false; + } + return super.apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index c0793521105..f913f1e1d7b 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -145,6 +145,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Manticore", 113, Rarity.COMMON, mage.cards.m.Manticore.class)); cards.add(new SetCardInfo("Meteor Swarm", 155, Rarity.RARE, mage.cards.m.MeteorSwarm.class)); cards.add(new SetCardInfo("Mimic", 249, Rarity.COMMON, mage.cards.m.Mimic.class)); + cards.add(new SetCardInfo("Mind Flayer", 63, Rarity.RARE, mage.cards.m.MindFlayer.class)); cards.add(new SetCardInfo("Minion of the Mighty", 156, Rarity.RARE, mage.cards.m.MinionOfTheMighty.class)); cards.add(new SetCardInfo("Minsc, Beloved Ranger", 227, Rarity.MYTHIC, mage.cards.m.MinscBelovedRanger.class)); cards.add(new SetCardInfo("Monk of the Open Hand", 25, Rarity.UNCOMMON, mage.cards.m.MonkOfTheOpenHand.class));