This commit is contained in:
BetaSteward 2012-03-05 22:44:49 -05:00
parent e4b6c66b16
commit dddca6ae32
6 changed files with 323 additions and 1 deletions

View file

@ -0,0 +1,49 @@
package org.mage.test.cards;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.PhaseStep;
import mage.filter.Filter;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* also tests cost reduction effects
*
* @author BetaSteward
*/
public class TestThaliaGuardianOfThraben extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertGraveyardCount(playerA, 0);
}
@Test
public void testCard1() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 17);
assertGraveyardCount(playerA, 1);
}
}

View file

@ -0,0 +1,42 @@
package org.mage.test.cards;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.PhaseStep;
import mage.filter.Filter;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class TestWardenOfTheWall extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Warden of the Wall");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPowerToughness(playerA, "Warden of the Wall", 0, 0, Filter.ComparisonScope.All);
}
@Test
public void testCard1() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Warden of the Wall");
setStopAt(2, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPowerToughness(playerA, "Warden of the Wall", 2, 3, Filter.ComparisonScope.All);
assertType("Warden of the Wall", CardType.CREATURE, "Gargoyle");
}
}

View file

@ -14,6 +14,7 @@ import org.mage.test.serverside.base.MageTestPlayerBase;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.PhaseStep;
import mage.counters.Counter;
import mage.counters.CounterType;
@ -319,6 +320,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(player.getId())) {
if (permanent.getName().equals(cardName)) {
found = permanent;
break;
}
}
@ -381,6 +383,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
if (permanent.getName().equals(cardName)) {
found = permanent;
break;
}
}
@ -390,6 +393,29 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
}
/**
* Assert whether a permanent is a specified type or not
*
* @param cardName Name of the permanent that should be checked.
* @param type A type to test for
* @param subType a subtype to test for
*/
public void assertType(String cardName, CardType type, String subType) throws AssertionError {
Permanent found = null;
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
if (permanent.getName().equals(cardName)) {
found = permanent;
break;
}
}
Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found);
Assert.assertTrue("(Battlefield) card type not found (" + cardName + ":" + type + ")", found.getCardType().contains(type));
Assert.assertTrue("(Battlefield) card sub-type not equal (" + cardName + ":" + subType + ")", found.getSubtype().contains(subType));
}
/**
* Assert whether a permanent is tapped or not
*
* @param cardName Name of the permanent that should be checked.