|
| 1 | +package org.mage.test.cards.enchantments; |
| 2 | + |
| 3 | +import mage.constants.PhaseStep; |
| 4 | +import mage.constants.Zone; |
| 5 | +import org.junit.Assert; |
| 6 | +import org.junit.Test; |
| 7 | +import org.mage.test.serverside.base.CardTestPlayerBase; |
| 8 | + |
| 9 | +/** |
| 10 | + * @author markort147 |
| 11 | + */ |
| 12 | +public class NowhereToRunTest extends CardTestPlayerBase { |
| 13 | + |
| 14 | + // Prevent ward from triggering on opponent's creatures |
| 15 | + @Test |
| 16 | + public void testWardPreventingOnOpponentsCreatures() { |
| 17 | + |
| 18 | + addCard(Zone.BATTLEFIELD, playerB, "Waterfall Aerialist", 1); |
| 19 | + addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); |
| 20 | + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); |
| 21 | + addCard(Zone.HAND, playerA, "Nowhere to Run", 1); |
| 22 | + |
| 23 | + setStrictChooseMode(true); |
| 24 | + |
| 25 | + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nowhere to Run"); |
| 26 | + addTarget(playerA, "Waterfall Aerialist"); |
| 27 | + |
| 28 | + setStopAt(1, PhaseStep.BEGIN_COMBAT); |
| 29 | + execute(); |
| 30 | + |
| 31 | + assertPermanentCount(playerA, "Waterfall Aerialist", 0); |
| 32 | + } |
| 33 | + |
| 34 | + // Does not prevent ward from triggering on own creatures |
| 35 | + @Test |
| 36 | + public void testWardOnOwnCreatures() { |
| 37 | + |
| 38 | + addCard(Zone.BATTLEFIELD, playerA, "Waterfall Aerialist", 1); |
| 39 | + addCard(Zone.BATTLEFIELD, playerA, "Nowhere to Run", 1); |
| 40 | + addCard(Zone.HAND, playerB, "Swords to Plowshares", 1); |
| 41 | + addCard(Zone.BATTLEFIELD, playerB, "Plains", 1); |
| 42 | + |
| 43 | + setStrictChooseMode(true); |
| 44 | + |
| 45 | + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Swords to Plowshares"); |
| 46 | + addTarget(playerB, "Waterfall Aerialist"); |
| 47 | + setChoice(playerB, false); |
| 48 | + |
| 49 | + setStopAt(1, PhaseStep.BEGIN_COMBAT); |
| 50 | + execute(); |
| 51 | + |
| 52 | + assertPermanentCount(playerA, "Waterfall Aerialist", 1); |
| 53 | + assertGraveyardCount(playerB, "Swords to Plowshares", 1); |
| 54 | + } |
| 55 | + |
| 56 | + // Prevent hexproof on opponent's creatures |
| 57 | + @Test |
| 58 | + public void testHexproofOnCreatures() { |
| 59 | + |
| 60 | + addCard(Zone.BATTLEFIELD, playerB, "Gladecover Scout", 1); |
| 61 | + addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); |
| 62 | + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); |
| 63 | + addCard(Zone.BATTLEFIELD, playerA, "Nowhere to Run", 1); |
| 64 | + addCard(Zone.HAND, playerA, "Go for the Throat", 1); |
| 65 | + |
| 66 | + setStrictChooseMode(true); |
| 67 | + |
| 68 | + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Go for the Throat"); |
| 69 | + addTarget(playerA, "Gladecover Scout"); |
| 70 | + |
| 71 | + setStopAt(1, PhaseStep.BEGIN_COMBAT); |
| 72 | + execute(); |
| 73 | + |
| 74 | + assertPermanentCount(playerB, "Gladecover Scout", 0); |
| 75 | + } |
| 76 | + |
| 77 | + // Does not prevent hexproof on non-creature permanents |
| 78 | + @Test |
| 79 | + public void testHexproofOnOtherPermanents() { |
| 80 | + |
| 81 | + addCard(Zone.BATTLEFIELD, playerB, "Valgavoth's Lair", 1); |
| 82 | + setChoice(playerB, "Red"); |
| 83 | + |
| 84 | + addCard(Zone.BATTLEFIELD, playerA, "Nowhere to Run", 1); |
| 85 | + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); |
| 86 | + addCard(Zone.HAND, playerA, "Stone Rain", 1); |
| 87 | + |
| 88 | + setStrictChooseMode(true); |
| 89 | + |
| 90 | + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Stone Rain"); |
| 91 | + addTarget(playerA, "Valgavoth's Lair"); |
| 92 | + |
| 93 | + setStopAt(1, PhaseStep.BEGIN_COMBAT); |
| 94 | + |
| 95 | + try { |
| 96 | + execute(); |
| 97 | + } catch (Throwable e) { |
| 98 | + if (!e.getMessage().contains("Targets list was setup by addTarget with [Valgavoth's Lair], but not used")) { |
| 99 | + Assert.fail("must throw error about bad targets, but got:\n" + e.getMessage()); |
| 100 | + } |
| 101 | + return; |
| 102 | + } |
| 103 | + Assert.fail("must throw exception on execute"); |
| 104 | + } |
| 105 | + |
| 106 | +} |
0 commit comments