* Safe Passage - Fixed a problem that damage to player was not prevented (fixes #6995).

This commit is contained in:
LevelX2 2020-08-25 16:30:48 +02:00
parent ced6965b59
commit f1d2d2fb22
3 changed files with 108 additions and 3 deletions

View file

@ -0,0 +1,98 @@
package org.mage.test.cards.prevention;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class PreventAllDamageTest extends CardTestPlayerBase {
@Test
public void test_SafePassage() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
// Prevent all damage that would be dealt to you and creatures you control this turn.
addCard(Zone.HAND, playerA, "Safe Passage"); // Instant {2}{W}
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); // (2/2)
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox", 2); // (2/4)
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
addCard(Zone.HAND, playerB, "Lightning Bolt",2); // Instnat {R}
castSpell(2, PhaseStep.UPKEEP, playerA, "Safe Passage");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Silvercoat Lion");
attack(2, playerB, "Pillarfield Ox");
attack(2, playerB, "Pillarfield Ox");
block(2, playerA, "Silvercoat Lion", "Pillarfield Ox");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerA, "Safe Passage", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertGraveyardCount(playerB, "Lightning Bolt", 2);
assertLife(playerA, 20);
assertLife(playerB, 20);
}
@Test
public void test_EtherealHaze() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
// Prevent all damage that would be dealt by creatures this turn.
addCard(Zone.HAND, playerA, "Ethereal Haze"); // Instant {W}
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); // (2/2)
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 2); // (2/4)
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
addCard(Zone.HAND, playerB, "Lightning Bolt",1); // Instant {R}
castSpell(2, PhaseStep.UPKEEP, playerA, "Ethereal Haze");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
attack(2, playerB, "Silvercoat Lion");
attack(2, playerB, "Silvercoat Lion");
block(2, playerA, "Silvercoat Lion", "Silvercoat Lion");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerA, "Ethereal Haze", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertPermanentCount(playerB, "Silvercoat Lion", 2);
assertGraveyardCount(playerB, "Lightning Bolt", 1);
assertLife(playerA, 17);
assertLife(playerB, 20);
}
}