From c1e4fce448fa96c400d9c639b8a28dc541794814 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sat, 1 Dec 2018 08:21:54 +0400 Subject: [PATCH] Tests: fixed SpellskiteTest and enabled missing tests; --- .../test/cards/triggers/SpellskiteTest.java | 92 +++++++++++-------- 1 file changed, 56 insertions(+), 36 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SpellskiteTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SpellskiteTest.java index 9c45cc42e7b..af57b93243b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SpellskiteTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SpellskiteTest.java @@ -1,4 +1,3 @@ - package org.mage.test.cards.triggers; import mage.constants.PhaseStep; @@ -7,7 +6,6 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * * @author LevelX2 */ public class SpellskiteTest extends CardTestPlayerBase { @@ -30,6 +28,7 @@ public class SpellskiteTest extends CardTestPlayerBase { setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); assertGraveyardCount(playerA, "Lightning Bolt", 1); assertPermanentCount(playerA, "Spellskite", 1); @@ -80,6 +79,7 @@ public class SpellskiteTest extends CardTestPlayerBase { setStopAt(2, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); assertPermanentCount(playerA, "Spellskite", 1); assertPermanentCount(playerB, "Frost Titan", 1); @@ -119,6 +119,7 @@ public class SpellskiteTest extends CardTestPlayerBase { setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); assertGraveyardCount(playerB, "Lightning Bolt", 1); @@ -160,6 +161,7 @@ public class SpellskiteTest extends CardTestPlayerBase { setStopAt(2, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); assertGraveyardCount(playerA, "Cryptic Command", 1); @@ -188,16 +190,16 @@ public class SpellskiteTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{U/P}: Change a target of target spell or ability to {this}.", "Lightning Bolt"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{U/P}: Change a target", "Lightning Bolt"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); assertGraveyardCount(playerA, "Lightning Bolt", 1); assertLife(playerA, 20); assertLife(playerB, 18); - } /** @@ -219,6 +221,7 @@ public class SpellskiteTest extends CardTestPlayerBase { setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); assertGraveyardCount(playerA, "Flame Slash", 1); assertPowerToughness(playerB, "Spellskite", 3, 7); @@ -238,24 +241,36 @@ public class SpellskiteTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Spellskite"); addCard(Zone.BATTLEFIELD, playerB, "Scute Mob"); addCard(Zone.BATTLEFIELD, playerB, "Island"); + // + addCard(Zone.BATTLEFIELD, playerB, "Memnite"); // 1/1 + addCard(Zone.BATTLEFIELD, playerB, "Royal Assassin"); // 1/1 + addCard(Zone.BATTLEFIELD, playerB, "Blinking Spirit"); // 2/2 + addCard(Zone.BATTLEFIELD, playerB, "Pearled Unicorn"); // 2/2 addCard(Zone.HAND, playerA, "Fiery Justice"); + // A cast Fiery Justice castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Fiery Justice"); - addTarget(playerA, "Scute Mob"); - setChoice(playerA, "X=1"); - addTarget(playerA, "Spellskite"); - setChoice(playerA, "X=4"); - - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{UP}: Change a target of target spell or ability to {this}.", "Fiery Justice", "Fiery Justice"); - setChoice(playerA, "Yes"); + addTarget(playerA, playerB); // 5 life to B + addTarget(playerA, "Scute Mob^X=1"); // target 1 + addTarget(playerA, "Spellskite^X=4"); // target 2 + // B activate Spellskite, but can't change any targets cause it's already targeted + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{U/P}: Change a target", "Fiery Justice", "Fiery Justice"); + setChoice(playerB, "Yes"); // pay 2 life + showBattlefield("B battle", 1, PhaseStep.BEGIN_COMBAT, playerB); + showGraveyard("B grave", 1, PhaseStep.BEGIN_COMBAT, playerB); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); + assertLife(playerB, 20 + 5 - 2); assertGraveyardCount(playerB, 2); + assertGraveyardCount(playerB, "Scute Mob", 1); + assertGraveyardCount(playerB, "Spellskite", 1); } + @Test public void testThatSplitDamageCanGetRedirected() { /* Standard redirect test The Spellskite should die from the 5 damage that was redirected to it @@ -267,59 +282,64 @@ public class SpellskiteTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Spellskite");// 0/4 creature addCard(Zone.BATTLEFIELD, playerB, "Scute Mob"); // 1/1 creauture addCard(Zone.BATTLEFIELD, playerB, "Island"); + addCard(Zone.BATTLEFIELD, playerB, "Memnite"); // 1/1 + addCard(Zone.BATTLEFIELD, playerB, "Royal Assassin"); // 1/1 + addCard(Zone.BATTLEFIELD, playerB, "Blinking Spirit"); // 2/2 + addCard(Zone.BATTLEFIELD, playerB, "Pearled Unicorn"); // 2/2 addCard(Zone.HAND, playerA, "Fiery Justice"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Fiery Justice"); // 5 damage distributed to any number of targets - addTarget(playerA, "Scute Mob"); - setChoice(playerA, "X=5"); + addTarget(playerA, "Scute Mob^X=5"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{UP}: Change a target of target spell or ability to {this}.", "Fiery Justice", "Fiery Justice"); - setChoice(playerA, "Yes"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{U/P}: Change a target", "Fiery Justice", "Fiery Justice"); + setChoice(playerB, "Yes"); // pay 2 life + setChoice(playerB, "Yes"); // retarget setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); + assertLife(playerB, 20 + 5 - 2); assertGraveyardCount(playerB, 1); assertPermanentCount(playerB, "Scute Mob", 1); } + @Test public void testThatSplitDamageGetsRedirectedFromTheCorrectChoice() { addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); addCard(Zone.BATTLEFIELD, playerB, "Spellskite");// 0/4 creature - addCard(Zone.BATTLEFIELD, playerB, "Memnite"); // 1/1 creauture - addCard(Zone.BATTLEFIELD, playerB, "Royal Assassin"); - addCard(Zone.BATTLEFIELD, playerB, "Blinking Spirit"); - addCard(Zone.BATTLEFIELD, playerB, "Pearled Unicorn"); + addCard(Zone.BATTLEFIELD, playerB, "Memnite"); // 1/1 + addCard(Zone.BATTLEFIELD, playerB, "Royal Assassin"); // 1/1 + addCard(Zone.BATTLEFIELD, playerB, "Blinking Spirit"); // 2/2 + addCard(Zone.BATTLEFIELD, playerB, "Pearled Unicorn"); // 2/2 addCard(Zone.BATTLEFIELD, playerB, "Island"); addCard(Zone.HAND, playerA, "Fiery Justice"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Fiery Justice"); // 5 damage distributed to any number of targets - addTarget(playerA, "Memnite"); - setChoice(playerA, "X=1"); - addTarget(playerA, "Royal Assassin"); - setChoice(playerA, "X=1"); - addTarget(playerA, "Blinking Spirit"); - setChoice(playerA, "X=1"); - addTarget(playerA, "Pearled Unicorn"); - setChoice(playerA, "X=2");//the unicorn deserves it + addTarget(playerA, "Royal Assassin^X=1"); + addTarget(playerA, "Blinking Spirit^X=2"); + addTarget(playerA, "Pearled Unicorn^X=2"); - - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{UP}: Change a target of target spell or ability to {this}.", "Fiery Justice", "Fiery Justice"); - setChoice(playerA, "No"); - setChoice(playerA, "No"); - setChoice(playerA, "No"); - setChoice(playerA, "Yes"); //of course + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{U/P}: Change a target", "Fiery Justice", "Fiery Justice"); + setChoice(playerB, "Yes"); // pay 2 life + setChoice(playerB, "No"); // skip royal + setChoice(playerB, "No"); // skip blink + setChoice(playerB, "Yes"); // change pearl setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); + assertAllCommandsUsed(); - assertGraveyardCount(playerB, 3); - assertPermanentCount(playerB, "Pearled Unicorn", 1);//it lives on - assertPowerToughness(playerB, "Spellskite", 0, 2); + assertLife(playerB, 20 + 5 - 2); + assertGraveyardCount(playerB, "Memnite", 0); + assertGraveyardCount(playerB, "Royal Assassin", 1); + assertGraveyardCount(playerB, "Blinking Spirit", 1); + assertGraveyardCount(playerB, "Pearled Unicorn", 0); + assertGraveyardCount(playerB, "Spellskite", 0); } }