From 0b27499ce053b393fffd8b56a901f9f385231c4b Mon Sep 17 00:00:00 2001 From: magenoxx Date: Wed, 18 Jul 2012 08:11:36 +0400 Subject: [PATCH 1/2] Changed the order of choice compare in test framework --- .../src/test/java/org/mage/test/player/TestPlayer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index d9d2eaf01e..19c3a4b967 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -38,6 +38,7 @@ import mage.counters.Counter; import mage.filter.FilterPermanent; import mage.filter.common.FilterAttackingCreature; import mage.filter.common.FilterCreatureForCombat; +import mage.filter.predicate.mageobject.NamePredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.player.ai.ComputerPlayer; @@ -51,7 +52,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; -import mage.filter.predicate.mageobject.NamePredicate; /** * @@ -170,8 +170,8 @@ public class TestPlayer extends ComputerPlayer { @Override public boolean choose(Constants.Outcome outcome, Choice choice, Game game) { if (!choices.isEmpty()) { - for (String choose1: choice.getChoices()) { - for (String choose2: choices) { + for (String choose2: choices) { + for (String choose1: choice.getChoices()) { if (choose1.equals(choose2)) { choice.setChoice(choose2); choices.remove(choose2); From 6eb199006da76fb68ca5686af5b9d3a16292519e Mon Sep 17 00:00:00 2001 From: magenoxx Date: Wed, 18 Jul 2012 08:12:27 +0400 Subject: [PATCH 2/2] Two tests for AsEntersBattlefieldAbility and Copy effect interaction. Passed. --- .../test/cards/copy/PhantasmalImageTest.java | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java index 781df7d512..dd243c2b00 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/PhantasmalImageTest.java @@ -36,7 +36,7 @@ public class PhantasmalImageTest extends CardTestPlayerBase { * Tests that copy effect will copy EntersBattlefieldTriggeredAbility and it will be applied. */ @Test - public void testCopiedEntersBattlefieldTriggeredAbility() { + public void testCopyEntersBattlefieldTriggeredAbility() { addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 2); addCard(Constants.Zone.HAND, playerA, "Phantasmal Image"); addCard(Constants.Zone.BATTLEFIELD, playerB, "Howling Banshee"); @@ -166,4 +166,50 @@ public class PhantasmalImageTest extends CardTestPlayerBase { assertLife(playerB, 18); } + + /** + * Tests that copy effect will copy AsEntersBattlefieldAbility and will choose another color. + * As there is no permanent of the second color, copy of Lurebound Scarecrow will be sacrificed. + */ + @Test + public void testCopyAsEntersBattlefieldAbility() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 5); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Llanowar Elves"); + addCard(Constants.Zone.HAND, playerA, "Phantasmal Image"); + addCard(Constants.Zone.HAND, playerA, "Lurebound Scarecrow"); + + setChoice(playerA, "Green"); + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lurebound Scarecrow"); + setChoice(playerA, "Red"); + castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Phantasmal Image"); + + setStopAt(1, Constants.PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Lurebound Scarecrow", 1); + } + + /** + * Tests that copy effect will copy AsEntersBattlefieldAbility and will choose another color. + * Both Lurebound Scarecrow cards should stay on battlefield. + */ + @Test + public void testCopyAsEntersBattlefieldAbility2() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 5); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Llanowar Elves"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Raging Goblin"); + addCard(Constants.Zone.HAND, playerA, "Phantasmal Image"); + addCard(Constants.Zone.HAND, playerA, "Lurebound Scarecrow"); + + setChoice(playerA, "Green"); + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lurebound Scarecrow"); + setChoice(playerA, "Red"); + castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Phantasmal Image"); + + setStopAt(1, Constants.PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Lurebound Scarecrow", 2); + } + }