* Curse of Exhaustion - Fixed that it did not work correctly with Copy Enchantment spell.

This commit is contained in:
LevelX2 2014-08-06 12:22:17 +02:00
parent 6776b03bae
commit fc382740ce
3 changed files with 92 additions and 37 deletions

View file

@ -84,6 +84,80 @@ public class CursesTest extends CardTestPlayerBase {
assertLife(playerB, 14);
}
/**
* Checks if Copy Enchantment works for palyer auras
*/
@Test
public void testCurseOfExhaustion3() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
addCard(Zone.HAND, playerA, "Curse of Exhaustion");
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
addCard(Zone.HAND, playerB, "Copy Enchantment", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Exhaustion", playerB);
castSpell(4, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
castSpell(4, PhaseStep.PRECOMBAT_MAIN, playerB, "Copy Enchantment");
setChoice(playerB, "Yes");
setChoice(playerB, "Curse of Exhaustion");
setChoice(playerB, "targetPlayer=PlayerA");
castSpell(4, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
setStopAt(4, PhaseStep.END_TURN);
execute();
assertHandCount(playerB, "Copy Enchantment", 0);
assertGraveyardCount(playerB, "Copy Enchantment", 0);
assertPermanentCount(playerA, "Curse of Exhaustion", 1);
assertPermanentCount(playerB, "Curse of Exhaustion", 1);
assertLife(playerA, 20);
assertLife(playerB, 17);
}
// returng curse enchantment from graveyard to battlefield
@Test
public void testCurseOfExhaustion4() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerB, "Plains", 3);
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
addCard(Zone.GRAVEYARD, playerB, "Curse of Exhaustion", 1);
addCard(Zone.HAND, playerB, "Obzedat's Aid", 1);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Obzedat's Aid", "Curse of Exhaustion");
setChoice(playerB, "PlayerA");
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
setStopAt(2, PhaseStep.END_TURN);
execute();
assertHandCount(playerB, "Obzedat's Aid", 0);
assertGraveyardCount(playerB, "Obzedat's Aid", 1);
assertGraveyardCount(playerB, "Curse of Exhaustion", 0);
assertPermanentCount(playerB, "Curse of Exhaustion", 1);
assertLife(playerA, 20);
assertLife(playerB, 17);
}
@Test
public void testCurseOfThirst1() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);

View file

@ -63,6 +63,7 @@ import mage.constants.SpellAbilityType;
import mage.filter.common.FilterCreatureForCombatBlock;
import mage.filter.common.FilterPlaneswalkerPermanent;
import mage.game.stack.StackObject;
import mage.target.TargetPlayer;
/**
*
@ -262,6 +263,20 @@ public class TestPlayer extends ComputerPlayer {
}
}
}
if (target instanceof TargetPlayer) {
for (Player player :game.getPlayers().values()) {
for (String choose2: choices) {
if (player.getName().equals(choose2)) {
if (((TargetPlayer)target).canTarget(playerId, player.getId(), null, game) && !target.getTargets().contains(player.getId())) {
target.add(player.getId(), game);
choices.remove(choose2);
return true;
}
}
}
}
}
}
return super.choose(outcome, target, sourceId, game, options);
}