This commit is contained in:
jeffwadsworth 2012-07-17 23:23:37 -05:00
commit 9e33fdeba2
2 changed files with 50 additions and 4 deletions

View file

@ -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);
}
}

View file

@ -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<TestPlayer> {
@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 choose1: choice.getChoices()) {
if (choose1.equals(choose2)) {
choice.setChoice(choose2);
choices.remove(choose2);