add afr tests

This commit is contained in:
Ingmar Goudt 2021-05-12 23:52:23 +02:00
parent d1f51cae2f
commit 3fc28b3c03
4 changed files with 150 additions and 0 deletions

View file

@ -0,0 +1,46 @@
package org.mage.test.cards.single.afr;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class PortableHoleTest extends CardTestPlayerBase {
// When Portable Hole enters the battlefield, exile target nonland permanent an opponent controls with mana value 2 or less until Portable Hole leaves the battlefield.
private final String portable_hole = "Portable Hole";
@Test
public void opponentsPermanentisExiled(){
addCard(Zone.HAND, playerA, portable_hole, 1);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, portable_hole);
addTarget(playerA, "Grizzly Bears");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertExileCount(playerB, "Grizzly Bears", 1);
}
@Test
public void opponentsPermanentisReturned(){
addCard(Zone.HAND, playerA, portable_hole, 1);
addCard(Zone.HAND, playerB, "Shatter");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, portable_hole);
addTarget(playerA, "Grizzly Bears");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Shatter", portable_hole);
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerB, "Grizzly Bears", 1);
}
}

View file

@ -0,0 +1,38 @@
package org.mage.test.cards.single.afr;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class PowerWordKillTest extends CardTestPlayerBase {
// Destroy target non-Angel, non-Demon, non-Devil, non-Dragon creature.
private final String powerWordKill = "Power Word Kill";
@Test
public void killGrizzlyBears(){
addCard(Zone.HAND, playerA, powerWordKill);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, powerWordKill, "Grizzly Bears");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerB, "Grizzly Bears", 1);
}
@Test
public void canNotTargetChangeling(){
addCard(Zone.HAND, playerA, powerWordKill);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.BATTLEFIELD, playerB, "Avian Changeling");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, powerWordKill, "Avian Changeling");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertPermanentCount(playerB, "Avian Changeling", 1);
}
}

View file

@ -0,0 +1,37 @@
package org.mage.test.cards.single.afr;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class ProsperousInnkeeperTest extends CardTestPlayerBase {
// When Prosperous Innkeeper enters the battlefield, create a Treasure token.
// Whenever another creature enters the battlefield under your control, you gain 1 life.
private final String innkeeper = "Prosperous Innkeeper";
@Test
public void createTreasureToken(){
addCard(Zone.HAND, playerA, innkeeper);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, innkeeper);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Treasure", 1);
}
@Test
public void gainLife(){
addCard(Zone.HAND, playerA, innkeeper, 2);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, innkeeper);
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, innkeeper);
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertLife(playerA, 21);
}
}

View file

@ -0,0 +1,29 @@
package org.mage.test.cards.single.afr;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class VorpalSwordTest extends CardTestPlayerBase {
// Equipped creature gets +2/+0 and has deathtouch.
// {5}{B}{B}{B}: Until end of turn, Vorpal Sword gains "Whenever equipped creature deals combat damage to a player, that player loses the game."
// Equip {B}{B}
private final String vorpalSword = "Vorpal Sword";
@Test
public void loseTheGame(){
addCard(Zone.BATTLEFIELD, playerA, vorpalSword);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10);
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", "Grizzly Bears");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{5}{B}{B}{B}");
attack(3, playerA,"Grizzly Bears", playerB);
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
Assert.assertTrue("Player A has won.", playerA.hasWon());
}
}