Merge remote-tracking branch 'magefree/master'

This commit is contained in:
Samuel Sandeen 2016-07-24 18:02:53 -04:00
commit d97d9ea130
5 changed files with 165 additions and 4 deletions

View file

@ -32,7 +32,7 @@ import mage.abilities.effects.common.DamageMultiEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanentAmount;
/** /**
* *
@ -46,7 +46,7 @@ public class SpreadingFlames extends CardImpl {
// Spreading Flames deals 6 damage divided as you choose among any number of target creatures. // Spreading Flames deals 6 damage divided as you choose among any number of target creatures.
this.getSpellAbility().addEffect(new DamageMultiEffect(6)); this.getSpellAbility().addEffect(new DamageMultiEffect(6));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0,Integer.MAX_VALUE)); this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(6));
} }
public SpreadingFlames(final SpreadingFlames card) { public SpreadingFlames(final SpreadingFlames card) {

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

@ -0,0 +1,97 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.replacement;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class PulmonicSliverTest extends CardTestPlayerBase {
@Test
public void testKillSpellOnOtherSliver() {
/*
Pulmonic Sliver - {3}{W}{W} - Sliver
All Sliver creatures have flying.
All Slivers have "If this permanent would be put into a graveyard, you may put it on top of its owner's library instead."
*/
addCard(Zone.BATTLEFIELD, playerA, "Pulmonic Sliver");
addCard(Zone.BATTLEFIELD, playerA, "Venom Sliver"); // 2/2 slivers get deathtouch
addCard(Zone.HAND, playerB, "Doom Blade");
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Doom Blade");
addTarget(playerB, "Venom Sliver");
setChoice(playerA, "Yes");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerB, "Doom Blade", 1);
assertGraveyardCount(playerA, "Venom Sliver", 0);
assertPermanentCount(playerA, "Venom Sliver", 0);
assertLibraryCount(playerA, "Venom Sliver", 1);
}
@Test
public void testDamnationOnSlivers() {
/*
Pulmonic Sliver - {3}{W}{W} - Sliver
All Sliver creatures have flying.
All Slivers have "If this permanent would be put into a graveyard, you may put it on top of its owner's library instead."
*/
addCard(Zone.BATTLEFIELD, playerA, "Pulmonic Sliver");
addCard(Zone.BATTLEFIELD, playerA, "Venom Sliver"); // 2/2 slivers get deathtouch
addCard(Zone.HAND, playerB, "Damnation");
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 4);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Damnation");
setChoice(playerA, "Yes");
setChoice(playerA, "Yes");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerB, "Damnation", 1);
assertGraveyardCount(playerA, "Venom Sliver", 0);
assertPermanentCount(playerA, "Venom Sliver", 0);
assertLibraryCount(playerA, "Venom Sliver", 1);
assertGraveyardCount(playerA, "Pulmonic Sliver", 0);
assertPermanentCount(playerA, "Pulmonic Sliver", 0);
assertLibraryCount(playerA, "Pulmonic Sliver", 1);
}
@Test
public void testExileOnSliver() {
/*
Pulmonic Sliver - {3}{W}{W} - Sliver
All Sliver creatures have flying.
All Slivers have "If this permanent would be put into a graveyard, you may put it on top of its owner's library instead."
*/
addCard(Zone.BATTLEFIELD, playerA, "Pulmonic Sliver");
addCard(Zone.BATTLEFIELD, playerA, "Venom Sliver"); // 2/2 slivers get deathtouch
addCard(Zone.HAND, playerB, "Path to Exile");
addCard(Zone.BATTLEFIELD, playerB, "Plains", 1);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Path to Exile");
addTarget(playerB, "Venom Sliver");
setChoice(playerA, "Yes"); // should not even have this as a choice
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerB, "Path to Exile", 1);
assertGraveyardCount(playerA, "Venom Sliver", 0);
assertPermanentCount(playerA, "Venom Sliver", 0);
assertLibraryCount(playerA, "Venom Sliver", 0);
assertExileCount("Venom Sliver", 1);
}
}

View file

@ -0,0 +1,63 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.single;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class MindShatterTest extends CardTestPlayerBase {
/*
Reported bug: Mind Shatter forces discard when X=0
*/
@Test
public void testMindShatterXZeroOneCardInOpponentHand() {
// {X}{B}{B} - Sorcery
// Target player discards X cards at random.
addCard(Zone.HAND, playerA, "Mind Shatter");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.HAND, playerB, "Wooded Foothills", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mind Shatter");
addTarget(playerA, playerB);
setChoice(playerA, "X=0");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Mind Shatter", 1);
assertGraveyardCount(playerB, "Wooded Foothills", 0);
assertHandCount(playerB, "Wooded Foothills", 1);
}
@Test
public void testMindShatterXZeroTwoCardsInOpponentHand() {
// {X}{B}{B} - Sorcery
// Target player discards X cards at random.
addCard(Zone.HAND, playerA, "Mind Shatter");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.HAND, playerB, "Wooded Foothills", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mind Shatter");
addTarget(playerA, playerB);
setChoice(playerA, "X=0");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Mind Shatter", 1);
assertGraveyardCount(playerB, "Wooded Foothills", 0);
assertHandCount(playerB, "Wooded Foothills", 2);
}
}

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) {