2 DKA + tests

This commit is contained in:
BetaSteward 2012-02-17 22:53:27 -05:00
parent 86906c633a
commit 6828f1d651
5 changed files with 331 additions and 1 deletions

View file

@ -0,0 +1,53 @@
package org.mage.test.cards;
import junit.framework.Assert;
import mage.Constants;
import mage.filter.Filter;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class TestAlphaBrawl extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 8);
addCard(Constants.Zone.HAND, playerA, "Alpha Brawl");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Air Elemental", 1);
addCard(Constants.Zone.BATTLEFIELD, playerB, "Horned Turtle", 4);
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Alpha Brawl", "Air Elemental");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerB, "Air Elemental", 0);
assertPermanentCount(playerB, "Horned Turtle", 0);
}
@Test
public void testCardWithInfect() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 8);
addCard(Constants.Zone.HAND, playerA, "Alpha Brawl");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Blackcleave Goblin", 1);
addCard(Constants.Zone.BATTLEFIELD, playerB, "Air Elemental", 2);
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Alpha Brawl", "Blackcleave Goblin");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerB, "Blackcleave Goblin", 0);
assertPermanentCount(playerB, "Air Elemental", 2);
assertPowerToughness(playerB, "Air Elemental", 2, 2, Filter.ComparisonScope.All);
}
}

View file

@ -0,0 +1,33 @@
package org.mage.test.cards;
import junit.framework.Assert;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class TestArchangelsLight extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 8);
addCard(Constants.Zone.GRAVEYARD, playerA, "Forest", 6);
addCard(Constants.Zone.HAND, playerA, "Archangel's Light");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Archangel's Light");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 32);
assertLife(playerB, 20);
assertGraveyardCount(playerA, 1);
assertGraveyardCount(playerA, "Archangel's Light", 1);
Assert.assertEquals(currentGame.getPlayer(playerA.getId()).getLibrary().size(), 66);
}
}

View file

@ -352,7 +352,36 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
Assert.assertEquals("(Battlefield) Card counts are not equal (" + cardName + ")", count, actualCount);
}
public Permanent getPermanent(String cardName, UUID controller) {
/**
* Assert card count in player's graveyard.
*
* @param player {@link Player} who's graveyard should be counted.
* @param count Expected count.
*/
public void assertGraveyardCount(Player player, int count) throws AssertionError {
int actual = currentGame.getPlayer(player.getId()).getGraveyard().size();
Assert.assertEquals("(Graveyard) Card counts are not equal ", count, actual);
}
/**
* Assert card count in player's graveyard.
*
* @param player {@link Player} who's graveyard should be counted.
* @param cardName Name of the cards that should be counted.
* @param count Expected count.
*/
public void assertGraveyardCount(Player player, String cardName, int count) throws AssertionError {
int actualCount = 0;
for (Card card : player.getGraveyard().getCards(currentGame)) {
if (card.getName().equals(cardName)) {
actualCount++;
}
}
Assert.assertEquals("(Graveyard) Card counts are not equal (" + cardName + ")", count, actualCount);
}
public Permanent getPermanent(String cardName, UUID controller) {
Permanent permanent0 = null;
int count = 0;
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {