fixed while on stack effects of copied spells not discarding when copy has left stack

This commit is contained in:
Evan Kranzler 2021-06-10 18:42:47 -04:00
parent bd92ced539
commit 7d07c220b0
3 changed files with 57 additions and 4 deletions

View file

@ -0,0 +1,51 @@
package org.mage.test.cards.continuous;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author TheElk801
*/
public class SplitSecondTest extends CardTestPlayerBase {
@Test
public void testCounterSpell() {
addCard(Zone.BATTLEFIELD, playerA, "Volcanic Island", 4);
addCard(Zone.HAND, playerA, "Sudden Shock");
addCard(Zone.HAND, playerA, "Counterspell");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sudden Shock", playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Counterspell", "Sudden Shock");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertHandCount(playerA, "Counterspell", 1);
assertGraveyardCount(playerA, "Sudden Shock", 1);
assertLife(playerB, 20 - 2);
}
@Test
public void testCopiedSpell() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.HAND, playerA, "Doublecast");
addCard(Zone.HAND, playerA, "Sudden Shock");
addCard(Zone.HAND, playerA, "Raging Goblin");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Doublecast");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sudden Shock", playerB);
// No split second spells are on the stack, effect should not apply anymore
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Raging Goblin");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertLife(playerB, 20 - 2 - 2);
assertPermanentCount(playerA, "Raging Goblin", 1);
}
}