add some m21 tests

This commit is contained in:
Ingmar Goudt 2020-08-10 23:03:12 +02:00
parent 072e3e40c7
commit 452ba945e0
14 changed files with 370 additions and 26 deletions

View file

@ -48,29 +48,3 @@ public final class EpitaphGolem extends CardImpl {
return new EpitaphGolem(this);
}
}
class EpitaphGolemGraveyardToLibraryEffect extends OneShotEffect {
public EpitaphGolemGraveyardToLibraryEffect() {
super(Outcome.Benefit);
this.staticText = "Put target card from your graveyard on the bottom of your library";
}
public EpitaphGolemGraveyardToLibraryEffect(final EpitaphGolemGraveyardToLibraryEffect effect) {
super(effect);
}
@Override
public EpitaphGolemGraveyardToLibraryEffect copy() {
return new EpitaphGolemGraveyardToLibraryEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
return controller.putCardsOnBottomOfLibrary(game.getCard(getTargetPointer().getFirst(game, source)), game, source, true);
}
return false;
}
}

View file

@ -0,0 +1,4 @@
package org.mage.test.cards.single.iko;
public class BlitzLeechTest {
}

View file

@ -0,0 +1,32 @@
package org.mage.test.cards.single.m21;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class ContainmentPriestTest extends CardTestPlayerBase {
@Test
public void replacementEffect(){
// If a nontoken creature would enter the battlefield and it wasn't cast, exile it instead.
addCard(Zone.BATTLEFIELD, playerA, "Containment Priest");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears");
addCard(Zone.GRAVEYARD, playerB, "Scryb Sprites");
// Each player puts a creature card from their graveyard onto the battlefield.
addCard(Zone.HAND, playerA, "Exhume");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Exhume");
addTarget(playerA, "Grizzly Bears");
addTarget(playerB, "Scryb Sprites");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertExileCount(playerA, "Grizzly Bears", 1);
assertExileCount(playerB, "Scryb Sprites", 1);
}
}

View file

@ -0,0 +1,30 @@
package org.mage.test.cards.single.m21;
import mage.abilities.keyword.TrampleAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class CrashThroughTest extends CardTestPlayerBase {
@Test
public void crashThrough() {
// Creatures you control gain trample until end of turn.
// Draw a card.
addCard(Zone.HAND, playerA, "Crash Through");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerB, "Scryb Sprites");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Crash Through");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertAbility(playerA, "Grizzly Bears", TrampleAbility.getInstance(), true);
assertAbility(playerB, "Scryb Sprites", TrampleAbility.getInstance(), false);
assertHandCount(playerA, 1);
}
}

View file

@ -0,0 +1,25 @@
package org.mage.test.cards.single.m21;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class DaybreakChargerTest extends CardTestPlayerBase {
@Test
public void etbTrigger(){
// When Daybreak Charger enters the battlefield, target creature gets +2/+0 until end of turn.
addCard(Zone.HAND, playerA, "Daybreak Charger");
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Daybreak Charger");
addTarget(playerA, "Daybreak Charger");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertPowerToughness(playerA, "Daybreak Charger", 5, 1);
}
}

View file

@ -0,0 +1,26 @@
package org.mage.test.cards.single.m21;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class DeathbloomThallidTest extends CardTestPlayerBase {
@Test
public void diesTrigger() {
// When Deathbloom Thallid dies, create a 1/1 green Saproling creature token.
addCard(Zone.BATTLEFIELD, playerA, "Deathbloom Thallid");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.HAND, playerA, "Shock");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", "Deathbloom Thallid");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Saproling", 1);
}
}

View file

@ -0,0 +1,29 @@
package org.mage.test.cards.single.m21;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class DemonicEmbraceTest extends CardTestPlayerBase {
@Test
@Ignore
public void playFromGraveyard() {
// Enchanted creature gets +3/+1, has flying, and is a Demon in addition to its other types.
// You may cast Demonic Embrace from your graveyard by paying 3 life and discarding a card in addition to paying its other costs.
addCard(Zone.GRAVEYARD, playerA, "Demonic Embrace");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.HAND, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Demonic Embrace", "Grizzly Bears");
//addTarget(playerA, );
addTarget(playerA, "Mountain");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
}
}

View file

@ -0,0 +1,27 @@
package org.mage.test.cards.single.m21;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class DireFleetWarmongerTest extends CardTestPlayerBase {
@Test
public void sacCreatureToBoost() {
// At the beginning of combat on your turn, you may sacrifice another creature.
// If you do, Dire Fleet Warmonger gets +2/+2 and gains trample until end of turn.
addCard(Zone.BATTLEFIELD, playerA, "Dire Fleet Warmonger");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
setChoice(playerA, "Yes");
addTarget(playerA, "Grizzly Bears");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertPowerToughness(playerA, "Dire Fleet Warmonger", 5, 5);
}
}

View file

@ -0,0 +1,24 @@
package org.mage.test.cards.single.m21;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class DiscontinuityTest extends CardTestPlayerBase {
@Test
public void testCostReduction(){
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
// As long as it's your turn, this spell costs {2}{U}{U} less to cast.
addCard(Zone.HAND, playerA, "Discontinuity");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Discontinuity");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertTappedCount("Island", true, 2);
}
}

View file

@ -0,0 +1,28 @@
package org.mage.test.cards.single.m21;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class DoubleVisionTest extends CardTestPlayerBase {
@Test
public void testFirstInstant(){
// Whenever you cast your first instant or sorcery spell each turn, copy that spell.
// You may choose new targets for the copy.
addCard(Zone.BATTLEFIELD, playerA, "Double Vision");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.HAND, playerA, "Shock");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", playerB);
setChoice(playerA, "Yes");
addTarget(playerA, playerB);
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertLife(playerB, 16);
}
}

View file

@ -0,0 +1,33 @@
package org.mage.test.cards.single.m21;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class DubTest extends CardTestPlayerBase {
@Test
public void testBoostAndAbilities(){
// Enchanted creature gets +2/+2, has first strike, and is a Knight in addition to its other types.
addCard(Zone.HAND, playerA, "Dub");
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
addCard(Zone.BATTLEFIELD, playerA, "Scryb Sprites");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dub", "Scryb Sprites");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertAbility(playerA, "Scryb Sprites", FirstStrikeAbility.getInstance(), true);
assertAbility(playerA, "Scryb Sprites", FlyingAbility.getInstance(), true);
assertPowerToughness(playerA, "Scryb Sprites", 3, 3);
assertSubtype("Scryb Sprites", SubType.KNIGHT);
assertSubtype("Scryb Sprites", SubType.FAERIE);
}
}

View file

@ -0,0 +1,61 @@
package org.mage.test.cards.single.m21;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class ElderGargarothTest extends CardTestPlayerBase {
private static final String gargaroth = "Elder Gargaroth";
@Test
public void createToken(){
// Whenever Elder Gargaroth attacks or blocks, choose one
addCard(Zone.BATTLEFIELD, playerA, gargaroth);
attack(3, playerA, gargaroth, playerB);
// Create a 3/3 green Beast creature token.
setModeChoice(playerA, "1");
setStrictChooseMode(true);
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Beast", 1);
}
@Test
public void gainLife(){
// Whenever Elder Gargaroth attacks or blocks, choose one
addCard(Zone.BATTLEFIELD, playerA, gargaroth);
attack(3, playerA, gargaroth, playerB);
// You gain 3 life.
setModeChoice(playerA, "2");
setStrictChooseMode(true);
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertLife(playerA, 23);
}
@Test
public void drawCard(){
// Whenever Elder Gargaroth attacks or blocks, choose one
addCard(Zone.BATTLEFIELD, playerA, gargaroth);
attack(3, playerA, gargaroth, playerB);
// Draw a card.
setModeChoice(playerA, "3");
setStrictChooseMode(true);
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertHandCount(playerA, 2);
}
}

View file

@ -0,0 +1,37 @@
package org.mage.test.cards.single.m21;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class EliminateTest extends CardTestPlayerBase {
@Test
public void destroyCreature(){
addCard(Zone.BATTLEFIELD, playerB, "Ancient Crab");
addCard(Zone.HAND, playerA, "Eliminate");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Eliminate", "Ancient Crab");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerB, "Ancient Crab", 1);
}
@Test
public void destroyPlaneswalker(){
addCard(Zone.BATTLEFIELD, playerB, "Basri Ket");
addCard(Zone.HAND, playerA, "Eliminate");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Eliminate", "Basri Ket");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerB, "Basri Ket", 1);
}
}

View file

@ -1115,6 +1115,20 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
}
}
/**
* Assert whether a permanent is a specified subtype
*
* @param cardName Name of the permanent that should be checked.
* @param subType a subtype to test for
*/
public void assertSubtype(String cardName, SubType subType) throws AssertionError {
//Assert.assertNotEquals("", cardName);
Permanent found = getPermanent(cardName);
if (subType != null) {
Assert.assertTrue("(Battlefield) card sub-type equal (" + cardName + ':' + subType.getDescription() + ')', found.getSubtype(currentGame).contains(subType));
}
}
/**
* Assert permanent color
*