From 72cbaaf3ab7dcf4c5d4aec4556f64968dcf80e14 Mon Sep 17 00:00:00 2001 From: drmDev Date: Mon, 14 Mar 2016 02:27:32 -0400 Subject: [PATCH] Tests for Thought-Knot Seer reported bug --- .../single/ogw/ThoughtKnotSeerTests.java | 130 ++++++++++++++++++ .../EnterLeaveBattlefieldExileTargetTest.java | 1 - 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/ThoughtKnotSeerTests.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/ThoughtKnotSeerTests.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/ThoughtKnotSeerTests.java new file mode 100644 index 00000000000..accc6f15a30 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/ThoughtKnotSeerTests.java @@ -0,0 +1,130 @@ +/* + * 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.ogw; + +import java.util.Set; +import mage.cards.Card; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +public class ThoughtKnotSeerTests extends CardTestPlayerBase { + + /** + * Reported bug + * I bounced a Thought-Knot Seer my opponent controlled with enter the battlefield ability of a Reflector Mage. + * I should have drawn a card since the Thought-Knot Seer left the battlefield but I didn't. + */ + @Test + public void testThoughtKnotSeerBouncedReflectorMage() { + + // {1}{W}{U} When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand. + // That creature's owner can't cast spells with the same name as that creature until your next turn. + addCard(Zone.HAND, playerA, "Reflector Mage"); // 2/3 + addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); + addCard(Zone.BATTLEFIELD, playerA, "Island", 2); + + // {3}{<>} 4/4 + // When Thought-Knot Seer enters the battlefield, target opponent reveals his or her hand. You choose a nonland card from it and exile that card. + // When Thought-Knot Seer leaves the battlefield, target opponent draws a card. + addCard(Zone.BATTLEFIELD, playerB, "Thought-Knot Seer"); + addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage"); + addTarget(playerA, "Thought-Knot Seer"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertHandCount(playerB, "Thought-Knot Seer", 1); + Set hand = playerA.getHand().getCards(currentGame); + assertHandCount(playerA, 1); // should have drawn a card from Thought-Knot Seer leaving + } + + /** + * Simple bounce test on Thought-Knot Seer to differentiate between this and Reflector Mage issue + */ + @Test + public void testThoughtKnotSeerBouncedUnsummon() { + + // {U} Return target creature to its owner's hand. + addCard(Zone.HAND, playerA, "Unsummon"); + addCard(Zone.BATTLEFIELD, playerA, "Island", 2); + + // {3}{<>} 4/4 + // When Thought-Knot Seer enters the battlefield, target opponent reveals his or her hand. You choose a nonland card from it and exile that card. + // When Thought-Knot Seer leaves the battlefield, target opponent draws a card. + addCard(Zone.BATTLEFIELD, playerB, "Thought-Knot Seer"); + addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unsummon"); + addTarget(playerA, "Thought-Knot Seer"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Unsummon", 1); + assertHandCount(playerB, "Thought-Knot Seer", 1); + Set hand = playerA.getHand().getCards(currentGame); + assertHandCount(playerA, 1); // should have drawn a card from Thought-Knot Seer leaving + } + + /** + * + */ + @Test + public void testThoughtKnotSeerDestroyed() { + + // {1}{B} Destroy target nonblack creature. + addCard(Zone.HAND, playerA, "Doom Blade"); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); + + // {3}{<>} 4/4 + // When Thought-Knot Seer enters the battlefield, target opponent reveals his or her hand. You choose a nonland card from it and exile that card. + // When Thought-Knot Seer leaves the battlefield, target opponent draws a card. + addCard(Zone.BATTLEFIELD, playerB, "Thought-Knot Seer"); + addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Doom Blade"); + addTarget(playerA, "Thought-Knot Seer"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerB, "Thought-Knot Seer", 1); + Set hand = playerA.getHand().getCards(currentGame); + assertHandCount(playerA, 1); // should have drawn a card from Thought-Knot Seer leaving + } + + /** + * + */ + @Test + public void testThoughtKnotSeerExiled() { + + // {W} Exile target creature. Its controller may search his or her library for a basic land card, put that card onto the battlefield tapped, then shuffle his or her library. + addCard(Zone.HAND, playerA, "Path to Exile"); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); + + // {3}{<>} 4/4 + // When Thought-Knot Seer enters the battlefield, target opponent reveals his or her hand. You choose a nonland card from it and exile that card. + // When Thought-Knot Seer leaves the battlefield, target opponent draws a card. + addCard(Zone.BATTLEFIELD, playerB, "Thought-Knot Seer"); + addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Path to Exile"); + addTarget(playerA, "Thought-Knot Seer"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertExileCount(playerB, 1); + assertExileCount("Thought-Knot Seer", 1); + Set hand = playerA.getHand().getCards(currentGame); + assertHandCount(playerA, 1); // should have drawn a card from Thought-Knot Seer leaving + } +} \ No newline at end of file diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/EnterLeaveBattlefieldExileTargetTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/EnterLeaveBattlefieldExileTargetTest.java index a8088969696..abd2067e6b6 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/EnterLeaveBattlefieldExileTargetTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/EnterLeaveBattlefieldExileTargetTest.java @@ -94,6 +94,5 @@ public class EnterLeaveBattlefieldExileTargetTest extends CardTestPlayerBase { assertHandCount(playerB, "Silvercoat Lion", 1); assertHandCount(playerB, "Pillarfield Ox", 1); assertExileCount(playerB, 0); - } }