diff --git a/Mage.Sets/src/mage/cards/e/Extortion.java b/Mage.Sets/src/mage/cards/e/Extortion.java new file mode 100644 index 00000000000..8e132f49266 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/Extortion.java @@ -0,0 +1,103 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.e; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.TargetPlayer; + +/** + * + * @author TheElk801 + */ +public class Extortion extends CardImpl { + + public Extortion(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}{B}"); + + // Look at target player's hand and choose up to two cards from it. That player discards those cards. + this.getSpellAbility().addEffect(new ExtortionEffect()); + this.getSpellAbility().addTarget(new TargetPlayer()); + } + + public Extortion(final Extortion card) { + super(card); + } + + @Override + public Extortion copy() { + return new Extortion(this); + } +} + +class ExtortionEffect extends OneShotEffect { + + public ExtortionEffect() { + super(Outcome.Discard); + staticText = "Look at target player's hand and choose up to two cards from it. That player discards that card."; + } + + public ExtortionEffect(final ExtortionEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(source.getFirstTarget()); + Player you = game.getPlayer(source.getControllerId()); + if (targetPlayer != null && you != null) { + you.lookAtCards("Discard", targetPlayer.getHand(), game); + TargetCard target = new TargetCard(0, 2, Zone.HAND, new FilterCard()); + target.setNotTarget(true); + if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) { + Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); + if (card != null) { + return targetPlayer.discard(card, source, game); + } + } + + } + return false; + } + + @Override + public ExtortionEffect copy() { + return new ExtortionEffect(this); + } +} diff --git a/Mage.Sets/src/mage/cards/m/MindWarp.java b/Mage.Sets/src/mage/cards/m/MindWarp.java index bac5087a392..be07dd9f3c0 100644 --- a/Mage.Sets/src/mage/cards/m/MindWarp.java +++ b/Mage.Sets/src/mage/cards/m/MindWarp.java @@ -28,12 +28,20 @@ package mage.cards.m; import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue; -import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.TargetController; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; import mage.target.TargetPlayer; /** @@ -43,11 +51,10 @@ import mage.target.TargetPlayer; public class MindWarp extends CardImpl { public MindWarp(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{3}{B}"); - + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{3}{B}"); // Look at target player's hand and choose X cards from it. That player discards those cards. - this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(new ManacostVariableValue(), TargetController.ANY)); + this.getSpellAbility().addEffect(new MindWarpEffect(new ManacostVariableValue())); this.getSpellAbility().addTarget(new TargetPlayer()); } @@ -60,3 +67,47 @@ public class MindWarp extends CardImpl { return new MindWarp(this); } } + +class MindWarpEffect extends OneShotEffect { + + private final DynamicValue xValue; + + public MindWarpEffect(DynamicValue xValue) { + super(Outcome.Discard); + this.xValue = xValue; + staticText = "Look at target player's hand and choose X cards from it. That player discards those card."; + } + + public MindWarpEffect(final MindWarpEffect effect) { + super(effect); + this.xValue = effect.xValue; + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(source.getFirstTarget()); + Player you = game.getPlayer(source.getControllerId()); + if (targetPlayer != null && you != null) { + int amountToDiscard = Math.min( + xValue.calculate(game, source, this), + targetPlayer.getHand().size() + ); + you.lookAtCards("Discard", targetPlayer.getHand(), game); + TargetCard target = new TargetCard(amountToDiscard, Zone.HAND, new FilterCard()); + target.setNotTarget(true); + if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) { + Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); + if (card != null) { + return targetPlayer.discard(card, source, game); + } + } + + } + return false; + } + + @Override + public MindWarpEffect copy() { + return new MindWarpEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/MercadianMasques.java b/Mage.Sets/src/mage/sets/MercadianMasques.java index e57e539a4a0..2e279116040 100644 --- a/Mage.Sets/src/mage/sets/MercadianMasques.java +++ b/Mage.Sets/src/mage/sets/MercadianMasques.java @@ -138,6 +138,7 @@ public class MercadianMasques extends ExpansionSet { cards.add(new SetCardInfo("Dust Bowl", 316, Rarity.RARE, mage.cards.d.DustBowl.class)); cards.add(new SetCardInfo("Embargo", 77, Rarity.RARE, mage.cards.e.Embargo.class)); cards.add(new SetCardInfo("Energy Flux", 78, Rarity.UNCOMMON, mage.cards.e.EnergyFlux.class)); + cards.add(new SetCardInfo("Extortion", 135, Rarity.RARE, mage.cards.e.Extortion.class)); cards.add(new SetCardInfo("Eye of Ramos", 294, Rarity.RARE, mage.cards.e.EyeOfRamos.class)); cards.add(new SetCardInfo("False Demise", 80, Rarity.UNCOMMON, mage.cards.f.FalseDemise.class)); cards.add(new SetCardInfo("Flailing Manticore", 187, Rarity.RARE, mage.cards.f.FlailingManticore.class));