* Animate Dead - Fixed that the target card in graveyard was not handled correct, if the Animate Dead reentered the Battlefield(e.g. with Worldgorger Dragon combo).

This commit is contained in:
LevelX2 2015-06-25 14:31:23 +02:00
parent 81934e32e3
commit 7bc8649585
3 changed files with 39 additions and 28 deletions

View file

@ -5,9 +5,10 @@
*/
package org.mage.test.cards.triggers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -133,7 +134,6 @@ public class WorldgorgerDragonTest extends CardTestPlayerBase {
*
*/
@Test
@Ignore
public void testWithAnimateDeadDifferentTargets() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
@ -153,35 +153,40 @@ public class WorldgorgerDragonTest extends CardTestPlayerBase {
// When Staunch Defenders enters the battlefield, you gain 4 life.
addCard(Zone.BATTLEFIELD, playerA, "Staunch Defenders", 1);
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {B}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {B}");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Animate Dead", "Worldgorger Dragon");
addTarget(playerA, "Worldgorger Dragon");
addTarget(playerA, "Worldgorger Dragon");
addTarget(playerA, "Silvercoat Lion");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
setChoice(playerA, "Worldgorger Dragon");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Volcanic Geyser", playerB, 9);
setChoice(playerA, "X=7");
setChoice(playerA, "Silvercoat Lion");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Volcanic Geyser", playerB, 9);
setChoice(playerA, "X=9");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Volcanic Geyser", 1);
assertGraveyardCount(playerA, "Worldgorger Dragon", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertLife(playerA, 24);
assertLife(playerA, 28);
assertLife(playerB, 11);
assertGraveyardCount(playerA, "Volcanic Geyser", 1);
Assert.assertEquals("Mana pool", "[]", playerA.getManaAvailable(currentGame).toString());
}

View file

@ -628,8 +628,10 @@ public class TestPlayer implements Player {
if (targetCardInGraveyard.canTarget(targetObject.getId(), game)) {
if (alreadyTargetted != null && !alreadyTargetted.contains(targetObject.getId())) {
targetCardInGraveyard.add(targetObject.getId(), game);
choices.remove(choose2);
targetFound = true;
if (target.getTargets().size() >= target.getMaxNumberOfTargets()) {
break;
}
}
}
}
@ -810,10 +812,12 @@ public class TestPlayer implements Player {
@Override
public int announceXMana(int min, int max, String message, Game game, Ability ability) {
if (!choices.isEmpty()) {
if (choices.get(0).startsWith("X=")) {
int xValue = Integer.parseInt(choices.get(0).substring(2));
choices.remove(0);
return xValue;
for(String choice: choices) {
if (choice.startsWith("X=")) {
int xValue = Integer.parseInt(choice.substring(2));
choices.remove(choice);
return xValue;
}
}
}
return computerPlayer.announceXMana(min, max, message, game, ability);