Phyrexian Purge impl and tests

This commit is contained in:
drmDev 2017-03-05 10:37:05 -05:00
parent 84983a6841
commit c8e41bc002
4 changed files with 189 additions and 3 deletions

View file

@ -0,0 +1,111 @@
package org.mage.test.cards.cost.additional;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class PhyrexianPurgeTest extends CardTestPlayerBase {
/*
Target two creatures, pay 3 life for each.
*/
@Test
public void simpleTest() {
String pPurge = "Phyrexian Purge";
// Sorcery {2}{B}{R}
// Destroy any number of target creatures.
// Phyrexian Purge costs 3 life more to cast for each target.
addCard(Zone.HAND, playerA, pPurge);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerB, "Memnite"); // {0} 1/1 artifact creature
addCard(Zone.BATTLEFIELD, playerB, "Hill Giant"); // {3}{R} 3/3
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, pPurge);
addTarget(playerA, "Memnite^Hill Giant");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, pPurge, 1);
assertGraveyardCount(playerB, "Memnite", 1);
assertGraveyardCount(playerB, "Hill Giant", 1);
assertLife(playerA, 14); // lost 6 life (3 * 2 targets)
}
/*
* Target two creatures, one of them bounced before resolution. Still pay 6 life.
*/
@Test
public void bouncedCreatureStillPaysFullCost() {
String pPurge = "Phyrexian Purge";
// Sorcery {2}{B}{R}
// Destroy any number of target creatures.
// Phyrexian Purge costs 3 life more to cast for each target.
addCard(Zone.HAND, playerA, pPurge);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.HAND, playerB, "Unsummon"); // {U} instant return target creature back to hand
addCard(Zone.BATTLEFIELD, playerB, "Island");
addCard(Zone.BATTLEFIELD, playerB, "Memnite"); // {0} 1/1 artifact creature
addCard(Zone.BATTLEFIELD, playerB, "Hill Giant"); // {3}{R} 3/3
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, pPurge);
addTarget(playerA, "Memnite^Hill Giant");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Unsummon", "Hill Giant");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, pPurge, 1);
assertGraveyardCount(playerB, "Unsummon", 1);
assertGraveyardCount(playerB, "Memnite", 1);
assertHandCount(playerB, "Hill Giant", 1);
assertLife(playerA, 14); // lost 6 life (3 * 2 targets)
}
/*
* Target two creatures, spell is countered. Still pays 6 life.
*/
@Test
public void counteredSpellStillPaysFullCost() {
String pPurge = "Phyrexian Purge";
// Sorcery {2}{B}{R}
// Destroy any number of target creatures.
// Phyrexian Purge costs 3 life more to cast for each target.
addCard(Zone.HAND, playerA, pPurge);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.HAND, playerB, "Counterspell"); // {U}{U} instant - counter target spell
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
addCard(Zone.BATTLEFIELD, playerB, "Memnite"); // {0} 1/1 artifact creature
addCard(Zone.BATTLEFIELD, playerB, "Hill Giant"); // {3}{R} 3/3
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, pPurge);
addTarget(playerA, "Memnite^Hill Giant");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Counterspell", pPurge);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, pPurge, 1);
assertGraveyardCount(playerB, "Counterspell", 1);
assertPermanentCount(playerB, "Memnite", 1);
assertPermanentCount(playerB, "Hill Giant", 1);
assertLife(playerA, 14); // lost 6 life (3 * 2 targets)
}
}

View file

@ -1166,12 +1166,12 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
* Set target permanents
*
* @param player
* @param target you can add multiple targets by seperating them by the "^"
* @param target you can add multiple targets by separating them by the "^"
* character e.g. "creatureName1^creatureName2" you can qualify the target
* additional by setcode e.g. "creatureName-M15" you can add [no copy] to
* the end of the target name to prohibite targets that are copied you can
* the end of the target name to prohibit targets that are copied you can
* add [only copy] to the end of the target name to allow only targets that
* are copies For modal spells use a prefix with the mode number:
* are copies. For modal spells use a prefix with the mode number:
* mode=1Lightning Bolt^mode=2Silvercoat Lion
*/
public void addTarget(TestPlayer player, String target) {