Mind Shatter bug fix for #2110. Before a discard effect can happen, checks the amount of cards to be discarded > 0

This commit is contained in:
drmDev 2016-07-24 15:00:07 -04:00
parent 232ad196eb
commit 642de722f6
2 changed files with 3 additions and 2 deletions

View file

@ -28,7 +28,6 @@
package mage.sets.magic2010; package mage.sets.magic2010;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -46,7 +45,6 @@ public class MindShatter extends CardImpl {
super(ownerId, 106, "Mind Shatter", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{B}{B}"); super(ownerId, 106, "Mind Shatter", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{B}{B}");
this.expansionSetCode = "M10"; this.expansionSetCode = "M10";
// Target player discards X cards at random. // Target player discards X cards at random.
this.getSpellAbility().addEffect(new DiscardTargetEffect(new ManacostVariableValue(), true)); this.getSpellAbility().addEffect(new DiscardTargetEffect(new ManacostVariableValue(), true));
this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addTarget(new TargetPlayer());

View file

@ -723,6 +723,9 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override @Override
public Cards discard(int amount, boolean random, Ability source, Game game) { public Cards discard(int amount, boolean random, Ability source, Game game) {
Cards discardedCards = new CardsImpl(); Cards discardedCards = new CardsImpl();
if (amount <= 0) {
return discardedCards;
}
if (this.getHand().size() == 1 || this.getHand().size() == amount) { if (this.getHand().size() == 1 || this.getHand().size() == amount) {
discardedCards.addAll(this.getHand()); discardedCards.addAll(this.getHand());
while (this.getHand().size() > 0) { while (this.getHand().size() > 0) {