2 DKA + Spiteful Shadows fix

This commit is contained in:
BetaSteward 2012-03-12 22:08:57 -04:00
parent 8ea3cc741c
commit 5d652e9128
6 changed files with 366 additions and 1 deletions

View file

@ -0,0 +1,72 @@
package org.mage.test.cards;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* also tests regenerate and
* tests that permanents with protection can be sacrificed
*
* @author BetaSteward
*/
public class TestClingingMists extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "White Knight");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Constants.Zone.HAND, playerA, "Clinging Mists");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Clinging Mists");
attack(1, playerA, "White Knight");
setStopAt(1, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
}
@Test
public void testCardExile1() {
setLife(playerA, 5);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Abbey Griffin");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Constants.Zone.HAND, playerA, "Clinging Mists");
attack(1, playerA, "Abbey Griffin");
castSpell(1, Constants.PhaseStep.DECLARE_BLOCKERS, playerA, "Clinging Mists");
setStopAt(3, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 5);
assertLife(playerB, 20);
assertTapped("Abbey Griffin", true);
}
@Test
public void testCardExile2() {
setLife(playerA, 5);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Constants.Zone.HAND, playerA, "Clinging Mists");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Abbey Griffin");
addCard(Constants.Zone.HAND, playerB, "Lightning Bolt");
attack(2, playerB, "Abbey Griffin");
castSpell(2, Constants.PhaseStep.DECLARE_BLOCKERS, playerA, "Clinging Mists");
castSpell(2, Constants.PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
setStopAt(6, Constants.PhaseStep.DRAW);
execute();
assertLife(playerA, 2);
assertLife(playerB, 20);
assertTapped("Abbey Griffin", false);
assertGraveyardCount(playerB, "Lightning Bolt", 1);
}
}

View file

@ -0,0 +1,56 @@
package org.mage.test.cards.damage;
import mage.Constants;
import mage.counters.CounterType;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* also tests regenerate and
* tests that permanents with protection can be sacrificed
*
* @author BetaSteward
*/
public class TestSpitefulShadows extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Glistener Elf");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Constants.Zone.HAND, playerA, "Spiteful Shadows");
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Spiteful Shadows", "Glistener Elf");
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Glistener Elf");
setStopAt(1, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertCounterCount(playerA, CounterType.POISON, 3);
}
@Test
public void testCard1() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Craw Wurm");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Constants.Zone.HAND, playerA, "Spiteful Shadows");
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Spiteful Shadows", "Craw Wurm");
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Craw Wurm");
setStopAt(1, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 17);
assertLife(playerB, 20);
assertCounterCount(playerA, CounterType.POISON, 0);
}
}

View file

@ -391,6 +391,17 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters().getCount(type));
}
/**
* Assert counter count on a player
*
* @param player The player whos counters should be counted.
* @param type Type of the counter that should be counted.
* @param count Expected count.
*/
public void assertCounterCount(Player player, CounterType type, int count) throws AssertionError {
Assert.assertEquals("(Battlefield) Counter counts are not equal (" + player.getName() + ":" + type + ")", count, player.getCounters().getCount(type));
}
/**
* Assert whether a permanent is a specified type or not