This commit is contained in:
BetaSteward 2012-02-26 23:05:16 -05:00
parent c64c597467
commit 2a380b6090
7 changed files with 438 additions and 1 deletions

View file

@ -0,0 +1,36 @@
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 TestCounterlash extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Island", 6);
addCard(Constants.Zone.HAND, playerB, "Counterlash");
addCard(Constants.Zone.HAND, playerB, "Beacon of Immortality");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Counterlash", "Lightning Bolt");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 40);
assertGraveyardCount(playerA, 1);
assertGraveyardCount(playerB, 1);
}
}

View file

@ -0,0 +1,44 @@
package org.mage.test.cards;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class TestCurseOfThirst extends CardTestPlayerBase {
@Test
public void testCard1() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Constants.Zone.HAND, playerA, "Curse of Thirst");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Thirst", playerB);
setStopAt(2, Constants.PhaseStep.DRAW);
execute();
assertLife(playerA, 20);
assertLife(playerB, 19);
}
@Test
public void testCard2() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Constants.Zone.HAND, playerA, "Curse of Thirst");
addCard(Constants.Zone.HAND, playerA, "Curse of Bloodletting");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Bloodletting", playerB);
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Thirst", playerB);
setStopAt(2, Constants.PhaseStep.DRAW);
execute();
assertLife(playerA, 20);
assertLife(playerB, 16);
}
}

View file

@ -0,0 +1,76 @@
package org.mage.test.cards;
import mage.Constants;
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 TestFiendOfTheShadows extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "White Knight");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Fiend of the Shadows");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain");
addCard(Constants.Zone.HAND, playerB, "Lightning Bolt");
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice a human: Regenerate {this}. ");
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Fiend of the Shadows");
setStopAt(1, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Fiend of the Shadows", 1);
assertPermanentCount(playerA, "White Knight", 0);
}
@Test
public void testCardExile1() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Fiend of the Shadows");
removeAllCardsFromHand(playerB);
addCard(Constants.Zone.HAND, playerB, "Swamp");
attack(1, playerA, "Fiend of the Shadows");
playLand(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Swamp");
setStopAt(1, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 17);
assertPermanentCount(playerA, "Fiend of the Shadows", 1);
assertPermanentCount(playerA, "Swamp", 1);
assertHandCount(playerB, 0);
}
@Test
public void testCardExile2() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Fiend of the Shadows");
removeAllCardsFromHand(playerB);
addCard(Constants.Zone.HAND, playerB, "Lightning Bolt");
attack(1, playerA, "Fiend of the Shadows");
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
setStopAt(1, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 14);
assertPermanentCount(playerA, "Fiend of the Shadows", 1);
assertGraveyardCount(playerA, "Lightning Bolt", 0);
assertHandCount(playerB, 0);
assertGraveyardCount(playerB, "Lightning Bolt", 1);
}
}

View file

@ -29,6 +29,7 @@
package org.mage.test.player;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import mage.Constants;
@ -40,6 +41,7 @@ import mage.filter.common.FilterAttackingCreature;
import mage.filter.common.FilterCreatureForCombat;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
import mage.player.ai.ComputerPlayer;
import mage.players.Player;
@ -162,6 +164,14 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
break;
}
}
Iterator<StackObject> it = game.getStack().iterator();
while (it.hasNext()) {
StackObject object = it.next();
if (object.getName().equals(target)) {
ability.getTargets().get(0).addTarget(object.getId(), ability, game);
break;
}
}
}
}
}