From 47b943021f5afe4b33708a4f41e87d7fb2ddd4ca Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 2 Jan 2019 18:56:15 -0500 Subject: [PATCH] Implemented Mass Manipulation --- .../src/mage/cards/m/MassManipulation.java | 50 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + .../common/TargetCreatureOrPlaneswalker.java | 12 ++++- 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/m/MassManipulation.java diff --git a/Mage.Sets/src/mage/cards/m/MassManipulation.java b/Mage.Sets/src/mage/cards/m/MassManipulation.java new file mode 100644 index 0000000000..c60e54e428 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MassManipulation.java @@ -0,0 +1,50 @@ +package mage.cards.m; + +import mage.abilities.Ability; +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.game.Game; +import mage.target.common.TargetCreatureOrPlaneswalker; +import mage.target.targetadjustment.TargetAdjuster; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MassManipulation extends CardImpl { + + public MassManipulation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{X}{U}{U}{U}{U}"); + + // Gain control of X target creatures and/or planeswalkers. + this.getSpellAbility().addEffect( + new GainControlTargetEffect(Duration.Custom, true) + .setText("Gain control of X target creatures and/or planeswalkers.") + ); + this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker()); + this.getSpellAbility().setTargetAdjuster(MassManipulationAdjuster.instance); + } + + private MassManipulation(final MassManipulation card) { + super(card); + } + + @Override + public MassManipulation copy() { + return new MassManipulation(this); + } +} + +enum MassManipulationAdjuster implements TargetAdjuster { + instance; + + @Override + public void adjustTargets(Ability ability, Game game) { + ability.getTargets().clear(); + ability.addTarget(new TargetCreatureOrPlaneswalker(ability.getManaCosts().getX())); + } +} diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index 8b68dca119..ee7c41ee8a 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -58,6 +58,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Judith, the Scourge Diva", 185, Rarity.RARE, mage.cards.j.JudithTheScourgeDiva.class)); cards.add(new SetCardInfo("Kaya, Orzhov Usurper", 186, Rarity.MYTHIC, mage.cards.k.KayaOrzhovUsurper.class)); cards.add(new SetCardInfo("Light Up the Stage", 107, Rarity.UNCOMMON, mage.cards.l.LightUpTheStage.class)); + cards.add(new SetCardInfo("Mass Manipulation", 42, Rarity.RARE, mage.cards.m.MassManipulation.class)); cards.add(new SetCardInfo("Mortify", 192, Rarity.UNCOMMON, mage.cards.m.Mortify.class)); cards.add(new SetCardInfo("Orzhov Guildgate", 252, Rarity.COMMON, mage.cards.o.OrzhovGuildgate.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Orzhov Guildgate", 253, Rarity.COMMON, mage.cards.o.OrzhovGuildgate.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalker.java b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalker.java index d5d490816d..041cc8081d 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalker.java +++ b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalker.java @@ -1,20 +1,28 @@ package mage.target.common; -import java.util.UUID; import mage.abilities.Ability; import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent; import mage.game.Game; import mage.players.Player; import mage.target.TargetPermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public class TargetCreatureOrPlaneswalker extends TargetPermanent { public TargetCreatureOrPlaneswalker() { + this(1); + } + + public TargetCreatureOrPlaneswalker(int numTargets) { + this(numTargets, numTargets); + } + + public TargetCreatureOrPlaneswalker(int minNumTargets, int maxNumTargets) { this(1, 1, new FilterCreatureOrPlaneswalkerPermanent(), false); }