* Reworked Perisist and Undying to not use replacement effects to add the needed counters.

This commit is contained in:
LevelX2 2015-08-18 12:30:52 +02:00
parent e2625fd60e
commit b40c8535e9
9 changed files with 218 additions and 195 deletions

View file

@ -3,7 +3,6 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep;
@ -15,33 +14,32 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* 702.78. Persist
* 702.78a Persist is a triggered ability. "Persist" means "When this permanent is put into a graveyard
* from the battlefield, if it had no -1/-1 counters on it, return it to the battlefield under its
* owner's control with a -1/-1 counter on it."
* 702.78. Persist 702.78a Persist is a triggered ability. "Persist" means "When
* this permanent is put into a graveyard from the battlefield, if it had no
* -1/-1 counters on it, return it to the battlefield under its owner's control
* with a -1/-1 counter on it."
*
* @author LevelX2
*/
public class PersistTest extends CardTestPlayerBase {
/**
* Tests Safehold Elite don't returns from Persist if already a -1/-1 counter
* was put on it from another source
* Tests Safehold Elite don't returns from Persist if already a -1/-1
* counter was put on it from another source
*
*/
@Test
public void testUndyingdoesntTriggerWithMinusCounter() {
// Safehold Elite 2/2 {1}{G/W}
// Creature - Elf Scout
//
//
// Persist
addCard(Zone.BATTLEFIELD, playerA, "Safehold Elite");
// Put a -1/-1 counter on target creature. When that creature dies this turn, its controller gets a poison counter.
addCard(Zone.HAND, playerB, "Virulent Wound",1);
addCard(Zone.HAND, playerB, "Lightning Bolt",1);
addCard(Zone.HAND, playerB, "Virulent Wound", 1);
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
@ -58,9 +56,9 @@ public class PersistTest extends CardTestPlayerBase {
Assert.assertEquals(1, playerA.getCounters().getCount(CounterType.POISON));
}
/**
* If a card with persist is removed from a graveyard before the persist ability resolves, persist will do nothing.
* If a card with persist is removed from a graveyard before the persist
* ability resolves, persist will do nothing.
*/
@Test
public void testWontTriggerIfPersistCardIsRemovedFromGraveyard() {
@ -72,14 +70,14 @@ public class PersistTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Safehold Elite");
// Exile target card from a graveyard. You gain 3 life.
addCard(Zone.HAND, playerB, "Lightning Bolt",1);
addCard(Zone.HAND, playerB, "Shadowfeed",1);
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
addCard(Zone.HAND, playerB, "Shadowfeed", 1);
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Safehold Elite");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Shadowfeed", "Safehold Elite","Persist <i>(When this creature dies, if it had no -1/-1 counters on it, return it to the battlefield under its owner's control with a -1/-1 counter on it.)</i>");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Shadowfeed", "Safehold Elite", "Persist <i>(When this creature dies, if it had no -1/-1 counters on it, return it to the battlefield under its owner's control with a -1/-1 counter on it.)</i>");
setStopAt(1, PhaseStep.END_TURN);
execute();
@ -103,11 +101,11 @@ public class PersistTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Kitchen Finks", 1);
/**
* Deathtouch, lifelink
* When Wurmcoil Engine dies, put a 3/3 colorless Wurm artifact creature token with
* deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink onto the battlefield.
* Deathtouch, lifelink When Wurmcoil Engine dies, put a 3/3 colorless
* Wurm artifact creature token with deathtouch and a 3/3 colorless Wurm
* artifact creature token with lifelink onto the battlefield.
*/
addCard(Zone.BATTLEFIELD, playerB, "Wurmcoil Engine",1);
addCard(Zone.BATTLEFIELD, playerB, "Wurmcoil Engine", 1);
attack(2, playerB, "Wurmcoil Engine");
block(2, playerA, "Kitchen Finks", "Wurmcoil Engine");
@ -117,14 +115,13 @@ public class PersistTest extends CardTestPlayerBase {
assertPermanentCount(playerB, "Wurmcoil Engine", 1);
assertPermanentCount(playerA, "Kitchen Finks", 1);
assertPowerToughness(playerA, "Kitchen Finks", 2,1);
assertPowerToughness(playerA, "Kitchen Finks", 2, 1);
assertLife(playerA, 22); // Kitchen Finks +2 life
assertLife(playerB, 26); // Wurmcoil Engine +6 ife
}
@Test
public void testInteractionWithToporOrb() {
@ -137,12 +134,12 @@ public class PersistTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Kitchen Finks", 2);
/**
* Deathtouch, lifelink
* When Wurmcoil Engine dies, put a 3/3 colorless Wurm artifact creature token with
* deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink onto the battlefield.
* Deathtouch, lifelink When Wurmcoil Engine dies, put a 3/3 colorless
* Wurm artifact creature token with deathtouch and a 3/3 colorless Wurm
* artifact creature token with lifelink onto the battlefield.
*/
addCard(Zone.BATTLEFIELD, playerB, "Wurmcoil Engine",1);
addCard(Zone.BATTLEFIELD, playerB, "Torpor Orb",1);
addCard(Zone.BATTLEFIELD, playerB, "Wurmcoil Engine", 1);
addCard(Zone.BATTLEFIELD, playerB, "Torpor Orb", 1);
attack(2, playerB, "Wurmcoil Engine");
block(2, playerA, "Kitchen Finks", "Wurmcoil Engine");
@ -161,9 +158,44 @@ public class PersistTest extends CardTestPlayerBase {
assertPermanentCount(playerB, "Wurm", 2);
assertPermanentCount(playerA, "Kitchen Finks", 2);
assertPowerToughness(playerA, "Kitchen Finks", 2, 1, Filter.ComparisonScope.All);
}
/**
* Situation: Clever Impersonator is copying ". Opponent casts Supreme
* Verdict. Persist on the clone of Glen Elendra Archmage triggers and goes
* on the stack, and I am asked to put triggers on the stack. Problem: No
* options pop up. I tried pressing many buttons, but the game was
* deadlocked.
*/
@Test
public void testCopiedCreatureWithPersists() {
// some tests were moved to LastKnownInformationTest
// Flying
// {U}, Sacrifice Glen Elendra Archmage: Counter target noncreature spell.
// Persist
addCard(Zone.BATTLEFIELD, playerB, "Glen Elendra Archmage", 1); // 2/2
addCard(Zone.BATTLEFIELD, playerB, "Plains", 2);
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
// Supreme Verdict can't be countered.
// Destroy all creatures.
addCard(Zone.HAND, playerB, "Supreme Verdict", 1); // {1}{W}{W}{U}
// You may have Clever Impersonator enter the battlefield as a copy of any nonland permanent on the battlefield.
addCard(Zone.HAND, playerA, "Clever Impersonator", 1);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Clever Impersonator");
setChoice(playerA, "Glen Elendra Archmage");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Supreme Verdict");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerB, "Glen Elendra Archmage", 1);
assertPowerToughness(playerB, "Glen Elendra Archmage", 1, 1);
assertPermanentCount(playerA, "Glen Elendra Archmage", 1);
assertPowerToughness(playerA, "Glen Elendra Archmage", 1, 1);
}
}

View file

@ -0,0 +1,67 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.triggers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
@Test
public void testDrawCardsAddedCounters() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
addCard(Zone.HAND, playerA, "Soul Warden");
// You may have Clever Impersonator enter the battlefield as a copy of any nonland permanent on the battlefield.
addCard(Zone.HAND, playerB, "Clever Impersonator", 1);
addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Warden");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Clever Impersonator");
setChoice(playerB, "Silvercoat Lion");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Soul Warden", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertPermanentCount(playerB, "Silvercoat Lion", 1);
assertLife(playerA, 21);
assertLife(playerB, 20);
}
}