From 96187ad3c00f41a89353a2d751f4f800abff38f3 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Mon, 3 Dec 2018 06:16:34 +0400 Subject: [PATCH] Tests: fixed TidehollowScullerTest; --- .../triggers/dies/TidehollowScullerTest.java | 113 +++++++++++++----- 1 file changed, 86 insertions(+), 27 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/TidehollowScullerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/TidehollowScullerTest.java index 3551024a717..7661906c858 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/TidehollowScullerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/TidehollowScullerTest.java @@ -1,4 +1,3 @@ - package org.mage.test.cards.triggers.dies; import mage.constants.PhaseStep; @@ -7,8 +6,7 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * - * @author LevelX2 + * @author LevelX2, JayDi85 */ public class TidehollowScullerTest extends CardTestPlayerBase { @@ -17,43 +15,104 @@ public class TidehollowScullerTest extends CardTestPlayerBase { * Test if the same Tidehollow Sculler is cast multiple times, the correct * corresponding exiled cards are returned */ + @Test - public void testCardFromHandWillBeExiled() { + public void test_CastOneCardFromHandWillBeExiled() { addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); addCard(Zone.BATTLEFIELD, playerA, "Island", 2); addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); // Tidehollow Sculler {W}{B} // When Tidehollow Sculler enters the battlefield, target opponent reveals their hand and you choose a nonland card from it. Exile that card. // When Tidehollow Sculler leaves the battlefield, return the exiled card to its owner's hand. - addCard(Zone.HAND, playerA, "Tidehollow Sculler", 1); - // Boomerang {U}{U} - // Return target creature card from your graveyard to your hand. - addCard(Zone.HAND, playerA, "Boomerang", 1); - // Scout's Warning {W} - // The next creature card you play this turn can be played as though it had flash. - // Draw a card. - addCard(Zone.HAND, playerA, "Scout's Warning", 1); + addCard(Zone.HAND, playerA, "Tidehollow Sculler", 1); // 2/2 + addCard(Zone.HAND, playerA, "Lightning Bolt", 1); // {R} + // + addCard(Zone.HAND, playerB, "Bloodflow Connoisseur", 1); + + // cast and exile from hand + checkHandCardCount("B hand must have blood", 1, PhaseStep.UPKEEP, playerB, "Bloodflow Connoisseur", 1); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tidehollow Sculler"); + addTarget(playerA, playerB); // choose opponent + setChoice(playerA, "Bloodflow Connoisseur"); // card to exile + checkHandCardCount("B hand must lost blood", 1, PhaseStep.BEGIN_COMBAT, playerB, "Bloodflow Connoisseur", 0); + + // destroy and return card to hand + checkPermanentCount("A must have tide", 1, PhaseStep.END_COMBAT, playerA, "Tidehollow Sculler", 1); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Tidehollow Sculler"); + checkPermanentCount("A must lost tide", 1, PhaseStep.END_TURN, playerA, "Tidehollow Sculler", 0); + checkHandCardCount("B must return blood", 1, PhaseStep.END_TURN, playerB, "Bloodflow Connoisseur", 1); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertHandCount(playerB, "Bloodflow Connoisseur", 1); + assertPermanentCount(playerA, "Tidehollow Sculler", 0); + } + + @Test + public void test_CastTwoCardFromHandWillBeExiled() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); + addCard(Zone.BATTLEFIELD, playerA, "Island", 2); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + // Tidehollow Sculler {W}{B} + // When Tidehollow Sculler enters the battlefield, target opponent reveals their hand and you choose a nonland card from it. Exile that card. + // When Tidehollow Sculler leaves the battlefield, return the exiled card to its owner's hand. + addCard(Zone.HAND, playerA, "Tidehollow Sculler@tide", 2); // 2/2 + addCard(Zone.HAND, playerA, "Lightning Bolt", 2); // {R} + // addCard(Zone.HAND, playerB, "Bloodflow Connoisseur", 1); addCard(Zone.HAND, playerB, "Silvercoat Lion", 1); + // turn 1 - A + // cast 1 and exile from hand + checkHandCardCount("B hand must have blood", 1, PhaseStep.UPKEEP, playerB, "Bloodflow Connoisseur", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tidehollow Sculler"); - addTarget(playerA, "Bloodflow Connoisseur"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Boomerang", "Tidehollow Sculler"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Scout's Warning", null, "Boomerang"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tidehollow Sculler", null, "", "When {this} leaves the battlefield, return the exiled card to its owner's hand."); - addTarget(playerA, "Silvercoat Lion"); + addTarget(playerA, playerB); // choose opponent + setChoice(playerA, "Bloodflow Connoisseur"); // card to exile + checkHandCardCount("B hand must lost blood", 1, PhaseStep.BEGIN_COMBAT, playerB, "Bloodflow Connoisseur", 0); + // cast 2 and exile from hand + checkHandCardCount("B hand must have lion", 1, PhaseStep.END_COMBAT, playerB, "Silvercoat Lion", 1); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Tidehollow Sculler"); + addTarget(playerA, playerB); // choose opponent + setChoice(playerA, "Silvercoat Lion"); // card to exile + checkHandCardCount("B hand must lost lion", 1, PhaseStep.END_TURN, playerB, "Silvercoat Lion", 0); - setStopAt(1, PhaseStep.BEGIN_COMBAT); + // turn 2 - B + // destroy 1 and return card to hand + checkPermanentCount("A must have 2 tide", 2, PhaseStep.UPKEEP, playerA, "Tidehollow Sculler", 2); + checkHandCardCount("B hand must have 0 blood", 2, PhaseStep.UPKEEP, playerB, "Bloodflow Connoisseur", 0); + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "@tide.1"); + showHand("B hand", 2, PhaseStep.BEGIN_COMBAT, playerB); + checkPermanentCount("A must have 1 tide", 2, PhaseStep.BEGIN_COMBAT, playerA, "Tidehollow Sculler", 1); + checkHandCardCount("B hand must have 1 blood", 2, PhaseStep.BEGIN_COMBAT, playerB, "Bloodflow Connoisseur", 1); + // destroy 2 and return card to hand + checkPermanentCount("A must have 1 tide", 2, PhaseStep.END_COMBAT, playerA, "Tidehollow Sculler", 1); + checkHandCardCount("B hand must have 0 lion", 2, PhaseStep.END_COMBAT, playerB, "Silvercoat Lion", 0); + castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "@tide.2"); + checkPermanentCount("A must have 0 tide", 2, PhaseStep.END_TURN, playerA, "Tidehollow Sculler", 0); + checkHandCardCount("B hand must have 1 lion", 2, PhaseStep.END_TURN, playerB, "Silvercoat Lion", 1); + + setStopAt(2, PhaseStep.END_TURN); execute(); - - assertGraveyardCount(playerA,"Boomerang", 1); - assertGraveyardCount(playerA,"Scout's Warning", 1); - assertHandCount(playerB, "Bloodflow Connoisseur", 0); // never comes back because first Tidehollow Sculler left battlefield before target was exiled - assertHandCount(playerB, "Silvercoat Lion", 0); - assertExileCount("Silvercoat Lion", 1); - - assertPermanentCount(playerA, "Tidehollow Sculler", 1); - + assertAllCommandsUsed(); } + + @Test + public void test_MultipleRuns() { + // test random selection by AI (must use direct select by alias, not AI) + for (int i = 1; i <= 10; i++) { + try { + this.reset(); + System.out.println("run " + i); + test_CastTwoCardFromHandWillBeExiled(); + } catch (Exception e) { + // + } + } + } + } \ No newline at end of file