mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 12:22:10 -08:00
refactor one-use prevention effect for a chosen source
fixes a few bugs along the way: [[Pilgrim and Justice]] & [[Pilgrim of Virue]] were incorrectly adding a "to you" to their damage clause. [[Ajani's Aid]] was improperly a one-use prevention effect. [[Story Circle]] and [[Prismatic Circle]] have not been refactor as it is not currently possible to have a proper filter for them. Would require a FilterSource with a 4-argument match most likely.
This commit is contained in:
parent
7537e5ea38
commit
b13efab236
49 changed files with 1481 additions and 821 deletions
|
|
@ -0,0 +1,77 @@
|
|||
package org.mage.test.cards.single.aer;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class AjanisAidTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.a.AjanisAid Ajani's Aid} {2}{G}{W}
|
||||
* Enchantment
|
||||
* When this enchantment enters, you may search your library and/or graveyard for a card named Ajani, Valiant Protector, reveal it, and put it into your hand. If you search your library this way, shuffle.
|
||||
* Sacrifice this enchantment: Prevent all combat damage a creature of your choice would deal this turn.
|
||||
*/
|
||||
private static final String aid = "Ajani's Aid";
|
||||
|
||||
@Test
|
||||
public void test_DamageOnCreature_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, aid, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Caelorna, Coral Tyrant"); // 0/8
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice");
|
||||
setChoice(playerA, "Goblin Piker"); // creature to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
block(2, playerA, "Caelorna, Coral Tyrant", "Goblin Piker");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertDamageReceived(playerA, "Caelorna, Coral Tyrant", 0);
|
||||
assertTapped("Goblin Piker", true);
|
||||
assertGraveyardCount(playerA, aid, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DamageOnYou_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, aid, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice");
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertTapped("Goblin Piker", true);
|
||||
assertGraveyardCount(playerA, aid, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DamageNonCombat_NoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, aid, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Prodigal Pyromancer", 1); // {T}: This creature deals 1 damage to any target.
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice");
|
||||
setChoice(playerA, "Prodigal Pyromancer"); // source to prevent from
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "{T}: ", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20 - 1);
|
||||
assertGraveyardCount(playerA, aid, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package org.mage.test.cards.single.exo;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class PenanceTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.p.Penance Penance} {2}{W}
|
||||
* Enchantment
|
||||
* Put a card from your hand on top of your library: The next time a black or red source of your choice would deal damage this turn, prevent that damage.
|
||||
*/
|
||||
private static final String penance = "Penance";
|
||||
|
||||
@Test
|
||||
public void test_DamageOnCreature_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, penance, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Caelorna, Coral Tyrant"); // 0/8
|
||||
addCard(Zone.HAND, playerA, "Plains", 1);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Put a card");
|
||||
setChoice(playerA, "Plains"); // card to put on top
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
block(2, playerA, "Caelorna, Coral Tyrant", "Goblin Piker");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertDamageReceived(playerA, "Caelorna, Coral Tyrant", 0);
|
||||
assertTapped("Goblin Piker", true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DamageOnYou_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, penance, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.HAND, playerA, "Plains", 1);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Put a card");
|
||||
setChoice(playerA, "Plains"); // card to put on top
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertTapped("Goblin Piker", true);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package org.mage.test.cards.single.ktk;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class DeflectingPalmTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.d.DeflectingPalm Deflecting Palm} {R}{W}
|
||||
* Instant
|
||||
* The next time a source of your choice would deal damage to you this turn, prevent that damage. If damage is prevented this way, Deflecting Palm deals that much damage to that source’s controller.
|
||||
*/
|
||||
private static final String palm = "Deflecting Palm";
|
||||
|
||||
@Test
|
||||
public void test_DamageOnCreature_NoPrevent() {
|
||||
addCard(Zone.HAND, playerA, palm, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Caelorna, Coral Tyrant"); // 0/8
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plateau", 2);
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, palm);
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
block(2, playerA, "Caelorna, Coral Tyrant", "Goblin Piker");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertDamageReceived(playerA, "Caelorna, Coral Tyrant", 2); // no prevent
|
||||
assertLife(playerB, 20);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DamageOnYou_Prevent() {
|
||||
addCard(Zone.HAND, playerA, palm, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plateau", 2);
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, palm);
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20 - 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DoubleStrike_Prevent_ThenConsumedAndNoPrevent() {
|
||||
addCard(Zone.HAND, playerA, palm, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Blade Historian", 1); // 2/3 "Attacking creatures you control have double strike."
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plateau", 2);
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, palm);
|
||||
setChoice(playerA, "Blade Historian"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Blade Historian", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20 - 2);
|
||||
assertLife(playerB, 20 - 2);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,227 @@
|
|||
package org.mage.test.cards.single.lea;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class CircleOfProtectionTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.c.CircleOfProtectionRed Circle of Protection: Red} {1}{W}
|
||||
* Enchantment
|
||||
* {1}: The next time a red source of your choice would deal damage to you this turn, prevent that damage.
|
||||
*/
|
||||
private static final String circleRed = "Circle of Protection: Red";
|
||||
|
||||
/**
|
||||
* {@link mage.cards.c.CircleOfProtectionGreen Circle of Protection: Green} {1}{W}
|
||||
* Enchantment
|
||||
* {1}: The next time a green source of your choice would deal damage to you this turn, prevent that damage.
|
||||
*/
|
||||
private static final String circleGreen = "Circle of Protection: Green";
|
||||
|
||||
@Test
|
||||
public void test_DamageOnCreature_NoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, circleRed, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Caelorna, Coral Tyrant"); // 0/8
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 14);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}");
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
block(2, playerA, "Caelorna, Coral Tyrant", "Goblin Piker");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertDamageReceived(playerA, "Caelorna, Coral Tyrant", 2); // no prevent
|
||||
assertLife(playerB, 20);
|
||||
assertTappedCount("Plains", true, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DamageOnYou_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, circleRed, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}");
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertTappedCount("Plains", true, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DoubleStrike_Prevent_ThenConsumedAndNoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, circleRed, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Blade Historian", 1); // 2/3 "Attacking creatures you control have double strike."
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}");
|
||||
setChoice(playerA, "Blade Historian"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Blade Historian", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20 - 2);
|
||||
assertTappedCount("Plains", true, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_NoSourceOfCircleColor_NoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, circleGreen, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}");
|
||||
// No possible choice for a green source
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20 - 2); // no prevention
|
||||
assertTappedCount("Plains", true, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_SpellDamageOnYou_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, circleRed, 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}", null, "Lightning Bolt");
|
||||
setChoice(playerA, "Lightning Bolt"); // source to prevent from
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertTappedCount("Plains", true, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_SpellNotChosenColorDamageOnYou_NoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, circleGreen, 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}", null, "Lightning Bolt");
|
||||
// no possible choice for "a green source"
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20 - 3);
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertTappedCount("Plains", true, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_TriggerDamageOnYou_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, circleRed, 1);
|
||||
addCard(Zone.HAND, playerB, "Blisterstick Shaman", 1); // etb deals 1 to any target
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Blisterstick Shaman");
|
||||
addTarget(playerB, playerA); // target for Shaman trigger
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}", null, "stack ability (When");
|
||||
setChoice(playerA, "Blisterstick Shaman"); // source to prevent from
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertPermanentCount(playerB, "Blisterstick Shaman", 1);
|
||||
assertTappedCount("Plains", true, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_TriggerNotChosenColorDamageOnYou_NoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, circleGreen, 1);
|
||||
addCard(Zone.HAND, playerB, "Blisterstick Shaman", 1); // etb deals 1 to any target
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Blisterstick Shaman");
|
||||
addTarget(playerB, playerA); // target for Shaman trigger
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}", null, "stack ability (When");
|
||||
// no possible choice for "a green source"
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20 - 1);
|
||||
assertPermanentCount(playerB, "Blisterstick Shaman", 1);
|
||||
assertTappedCount("Plains", true, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_ActivationDamageOnYou_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, circleRed, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Anaba Shaman", 1); // {R}, {T}: This creature deals 1 damage to any target.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{R},", playerA);
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}", null, "stack ability ({R}");
|
||||
setChoice(playerA, "Anaba Shaman"); // source to prevent from
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertTappedCount("Anaba Shaman", true, 1);
|
||||
assertTappedCount("Plains", true, 1);
|
||||
assertLife(playerA, 20);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_ActivationNotChosenColorDamageOnYou_NoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, circleGreen, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Anaba Shaman", 1); // {R}, {T}: This creature deals 1 damage to any target.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{R},", playerA);
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}", null, "stack ability ({R}");
|
||||
// no possible choice for "a green source"
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertTappedCount("Anaba Shaman", true, 1);
|
||||
assertTappedCount("Plains", true, 1);
|
||||
assertLife(playerA, 20 - 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package org.mage.test.cards.single.mir;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class BoneMaskTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.b.BoneMask Bone Mask} {4}
|
||||
* Artifact
|
||||
* {2}, {T}: The next time a source of your choice would deal damage to you this turn, prevent that damage. Exile cards from the top of your library equal to the damage prevented this way.
|
||||
*/
|
||||
private static final String mask = "Bone Mask";
|
||||
|
||||
@Test
|
||||
public void test_DamageOnCreature_NoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, mask, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Caelorna, Coral Tyrant"); // 0/8
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}");
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
block(2, playerA, "Caelorna, Coral Tyrant", "Goblin Piker");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertDamageReceived(playerA, "Caelorna, Coral Tyrant", 2); // no prevent
|
||||
assertExileCount(playerA, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DamageOnYou_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, mask, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}");
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertExileCount(playerA, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DoubleStrike_Prevent_ThenConsumedAndNoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, mask, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Blade Historian", 1); // 2/3 "Attacking creatures you control have double strike."
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}");
|
||||
setChoice(playerA, "Blade Historian"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Blade Historian", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20 - 2);
|
||||
assertExileCount(playerA, 2);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package org.mage.test.cards.single.mmq;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class ChoArrimAlchemistTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.c.ChoArrimAlchemist Cho-Arrim Alchemist} {W}
|
||||
* Creature — Human Spellshaper
|
||||
* {1}{W}{W}, {T}, Discard a card: The next time a source of your choice would deal damage to you this turn, prevent that damage. You gain life equal to the damage prevented this way.
|
||||
* 1/1
|
||||
*/
|
||||
private static final String alchemist = "Cho-Arrim Alchemist";
|
||||
|
||||
@Test
|
||||
public void test_DamageOnCreature_NoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, alchemist, 1);
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt", 1); // to discard
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Caelorna, Coral Tyrant"); // 0/8
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{W}{W}");
|
||||
setChoice(playerA, "Lightning Bolt"); // discard to activate
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
block(2, playerA, "Caelorna, Coral Tyrant", "Goblin Piker");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertDamageReceived(playerA, "Caelorna, Coral Tyrant", 2); // no prevent
|
||||
assertGraveyardCount(playerA, "Lightning Bolt", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DamageOnYou_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, alchemist, 1);
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt", 1); // to discard
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{W}{W}");
|
||||
setChoice(playerA, "Lightning Bolt"); // discard to activate
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20 + 2);
|
||||
assertGraveyardCount(playerA, "Lightning Bolt", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DoubleStrike_Prevent_ThenConsumedAndNoPrevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, alchemist, 1);
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt", 1); // to discard
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Blade Historian", 1); // 2/3 "Attacking creatures you control have double strike."
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{W}{W}");
|
||||
setChoice(playerA, "Lightning Bolt"); // discard to activate
|
||||
setChoice(playerA, "Blade Historian"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Blade Historian", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertTapped("Blade Historian", true);
|
||||
assertGraveyardCount(playerA, "Lightning Bolt", 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,251 @@
|
|||
package org.mage.test.cards.single.mmq;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class StoryCircleTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.s.StoryCircle Story Circle} {1}{W}{W}
|
||||
* Enchantment
|
||||
* As this enchantment enters, choose a color.
|
||||
* {W}: The next time a source of your choice of the chosen color would deal damage to you this turn, prevent that damage.
|
||||
*/
|
||||
private static final String circle = "Story Circle";
|
||||
|
||||
@Test
|
||||
public void test_DamageOnCreature_NoPrevent() {
|
||||
addCard(Zone.HAND, playerA, circle, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Caelorna, Coral Tyrant"); // 0/8
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, circle);
|
||||
setChoice(playerA, "Red"); // color chosen
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}");
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
block(2, playerA, "Caelorna, Coral Tyrant", "Goblin Piker");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertDamageReceived(playerA, "Caelorna, Coral Tyrant", 2); // no prevent
|
||||
assertLife(playerB, 20);
|
||||
assertTappedCount("Plains", true, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DamageOnYou_Prevent() {
|
||||
addCard(Zone.HAND, playerA, circle, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, circle);
|
||||
setChoice(playerA, "Red"); // color chosen
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}");
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertTappedCount("Plains", true, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DoubleStrike_Prevent_ThenConsumedAndNoPrevent() {
|
||||
addCard(Zone.HAND, playerA, circle, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Blade Historian", 1); // 2/3 "Attacking creatures you control have double strike."
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, circle);
|
||||
setChoice(playerA, "Red"); // color chosen
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}");
|
||||
setChoice(playerA, "Blade Historian"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Blade Historian", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20 - 2);
|
||||
assertTappedCount("Plains", true, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_NoSourceOfChosenColor_NoPrevent() {
|
||||
addCard(Zone.HAND, playerA, circle, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, circle);
|
||||
setChoice(playerA, "Green"); // color chosen
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}");
|
||||
setChoice(playerA, "Goblin Piker"); // TODO: this should not be a valid choice for TargetSource(chosencolor)
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20); // TODO: Should not prevent.
|
||||
assertTappedCount("Plains", true, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_SpellDamageOnYou_Prevent() {
|
||||
addCard(Zone.HAND, playerA, circle, 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, circle);
|
||||
setChoice(playerA, "Red"); // color chosen
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}", null, "Lightning Bolt");
|
||||
setChoice(playerA, "Lightning Bolt"); // source to prevent from
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertTappedCount("Plains", true, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_SpellNotChosenColorDamageOnYou_NoPrevent() {
|
||||
addCard(Zone.HAND, playerA, circle, 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, circle);
|
||||
setChoice(playerA, "Green"); // color chosen
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}", null, "Lightning Bolt");
|
||||
setChoice(playerA, "Lightning Bolt"); // TODO: this should not be a valid choice for TargetSource(chosencolor)
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20); // TODO: Should not prevent.
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertTappedCount("Plains", true, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_TriggerDamageOnYou_Prevent() {
|
||||
addCard(Zone.HAND, playerA, circle, 1);
|
||||
addCard(Zone.HAND, playerB, "Blisterstick Shaman", 1); // etb deals 1 to any target
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, circle);
|
||||
setChoice(playerA, "Red"); // color chosen
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Blisterstick Shaman");
|
||||
addTarget(playerB, playerA); // target for Shaman trigger
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}", null, "stack ability (When");
|
||||
setChoice(playerA, "Blisterstick Shaman");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertPermanentCount(playerB, "Blisterstick Shaman", 1);
|
||||
assertTappedCount("Plains", true, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_TriggerNotChosenColorDamageOnYou_NoPrevent() {
|
||||
addCard(Zone.HAND, playerA, circle, 1);
|
||||
addCard(Zone.HAND, playerB, "Blisterstick Shaman", 1); // etb deals 1 to any target
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, circle);
|
||||
setChoice(playerA, "Green"); // color chosen
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Blisterstick Shaman");
|
||||
addTarget(playerB, playerA); // target for Shaman trigger
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}", null, "stack ability (When");
|
||||
setChoice(playerA, "Blisterstick Shaman"); // TODO: this should not be a valid choice for TargetSource(chosencolor)
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20); // TODO: Should not prevent.
|
||||
assertPermanentCount(playerB, "Blisterstick Shaman", 1);
|
||||
assertTappedCount("Plains", true, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_ActivationDamageOnYou_Prevent() {
|
||||
addCard(Zone.HAND, playerA, circle, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Anaba Shaman", 1); // {R}, {T}: This creature deals 1 damage to any target.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, circle);
|
||||
setChoice(playerA, "Red"); // color chosen
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{R},", playerA);
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}", null, "stack ability ({R}");
|
||||
setChoice(playerA, "Anaba Shaman"); // source to prevent from
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertTappedCount("Anaba Shaman", true, 1);
|
||||
assertLife(playerA, 20);
|
||||
assertTappedCount("Plains", true, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_ActivationNotChosenColorDamageOnYou_NoPrevent() {
|
||||
addCard(Zone.HAND, playerA, circle, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Anaba Shaman", 1); // {R}, {T}: This creature deals 1 damage to any target.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, circle);
|
||||
setChoice(playerA, "Green"); // color chosen
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{R},", playerA);
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}", null, "stack ability ({R}");
|
||||
setChoice(playerA, "Anaba Shaman"); // TODO: this should not be a valid choice for TargetSource(chosencolor)
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertTappedCount("Anaba Shaman", true, 1);
|
||||
assertLife(playerA, 20); // TODO: Should not prevent.
|
||||
assertTappedCount("Plains", true, 4);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package org.mage.test.cards.single.ody;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class PilgrimOfJusticeTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.p.PilgrimOfJustice Pilgrim of Justice} {2}{W}
|
||||
* Creature — Human Cleric
|
||||
* Protection from red
|
||||
* {W}, Sacrifice this creature: The next time a red source of your choice would deal damage this turn, prevent that damage.
|
||||
* 1/3
|
||||
*/
|
||||
private static final String pilgrim = "Pilgrim of Justice";
|
||||
|
||||
@Test
|
||||
public void test_DamageOnCreature_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, pilgrim, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Caelorna, Coral Tyrant"); // 0/8
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}");
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
block(2, playerA, "Caelorna, Coral Tyrant", "Goblin Piker");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertDamageReceived(playerA, "Caelorna, Coral Tyrant", 0);
|
||||
assertTapped("Goblin Piker", true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DamageOnYou_Prevent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, pilgrim, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{W}");
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertTapped("Goblin Piker", true);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package org.mage.test.cards.single.tdm;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class NewWayForwardTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.n.NewWayForward New Way Forward} {2}{U}{R}{W}
|
||||
* Instant
|
||||
* The next time a source of your choice would deal damage to you this turn, prevent that damage. When damage is prevented this way, New Way Forward deals that much damage to that source’s controller and you draw that many cards.
|
||||
*/
|
||||
private static final String way = "New Way Forward";
|
||||
|
||||
@Test
|
||||
public void test_DamageOnCreature_NoPrevent() {
|
||||
addCard(Zone.HAND, playerA, way, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Caelorna, Coral Tyrant"); // 0/8
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plateau", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, way);
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
block(2, playerA, "Caelorna, Coral Tyrant", "Goblin Piker");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertDamageReceived(playerA, "Caelorna, Coral Tyrant", 2); // no prevent
|
||||
assertLife(playerB, 20);
|
||||
assertHandCount(playerA, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DamageOnYou_Prevent() {
|
||||
addCard(Zone.HAND, playerA, way, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plateau", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, way);
|
||||
setChoice(playerA, "Goblin Piker"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Goblin Piker", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20 - 2);
|
||||
assertHandCount(playerA, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DoubleStrike_Prevent_ThenConsumedAndNoPrevent() {
|
||||
addCard(Zone.HAND, playerA, way, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Blade Historian", 1); // 2/3 "Attacking creatures you control have double strike."
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plateau", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, way);
|
||||
setChoice(playerA, "Blade Historian"); // source to prevent from
|
||||
|
||||
attack(2, playerB, "Blade Historian", playerA);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20 - 2);
|
||||
assertLife(playerB, 20 - 2);
|
||||
assertHandCount(playerA, 2);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue