forked from External/mage
increase test coverage
This commit is contained in:
parent
895c99d282
commit
ca8b02d5ab
7 changed files with 439 additions and 0 deletions
|
|
@ -0,0 +1,77 @@
|
||||||
|
package org.mage.test.cards.single.dis;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.common.UntapAllControllerEffect;
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class ExperimentKrajTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Experiment Kraj
|
||||||
|
{2}{G}{G}{U}{U}
|
||||||
|
Legendary Creature — Ooze Mutant
|
||||||
|
|
||||||
|
Experiment Kraj has all activated abilities of each other creature with a +1/+1 counter on it.
|
||||||
|
|
||||||
|
{T}: Put a +1/+1 counter on target creature.
|
||||||
|
*/
|
||||||
|
private static final String experimentKraj = "Experiment Kraj";
|
||||||
|
/*
|
||||||
|
Stoneforge Mystic
|
||||||
|
{1}{W}
|
||||||
|
Creature — Kor Artificer
|
||||||
|
|
||||||
|
When this creature enters, you may search your library for an Equipment card, reveal it, put it into your hand, then shuffle.
|
||||||
|
|
||||||
|
{1}{W}, {T}: You may put an Equipment card from your hand onto the battlefield.
|
||||||
|
*/
|
||||||
|
private static final String stoneforgeMystic = "Stoneforge Mystic";
|
||||||
|
/*
|
||||||
|
Noble Hierarch
|
||||||
|
{G}
|
||||||
|
Creature — Human Druid
|
||||||
|
|
||||||
|
Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)
|
||||||
|
|
||||||
|
{T}: Add {G}, {W}, or {U}.
|
||||||
|
*/
|
||||||
|
private static final String nobleHierarch = "Noble Hierarch";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testExperimentKraj() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
Ability ability = new SimpleActivatedAbility(
|
||||||
|
Zone.ALL,
|
||||||
|
new UntapAllControllerEffect(StaticFilters.FILTER_CONTROLLED_A_CREATURE),
|
||||||
|
new ManaCostsImpl<>("")
|
||||||
|
);
|
||||||
|
addCustomCardWithAbility("Untap creatures", playerA, ability);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, experimentKraj);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, stoneforgeMystic);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, nobleHierarch);
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Put a +1/+1", stoneforgeMystic);
|
||||||
|
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "untap all");
|
||||||
|
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Put a +1/+1", nobleHierarch);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertEquals("Kraj should have 5 activated abilities", 5, getPermanent(experimentKraj).getAbilities(currentGame)
|
||||||
|
.stream()
|
||||||
|
.filter(Ability::isActivatedAbility)
|
||||||
|
.count());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package org.mage.test.cards.single.lci;
|
||||||
|
|
||||||
|
import mage.ObjectColor;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
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 EatenByPiranhasTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Eaten by Piranhas
|
||||||
|
{1}{U}
|
||||||
|
Enchantment — Aura
|
||||||
|
|
||||||
|
Flash (You may cast this spell any time you could cast an instant.)
|
||||||
|
|
||||||
|
Enchant creature
|
||||||
|
|
||||||
|
Enchanted creature loses all abilities and is a black Skeleton creature with base power and toughness 1/1. (It loses all other colors, card types, and creature types.)
|
||||||
|
*/
|
||||||
|
private static final String eatenByPiranhas = "Eaten by Piranhas";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEatenByPiranhas() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
addCard(Zone.HAND, playerB, eatenByPiranhas);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, eatenByPiranhas);
|
||||||
|
addTarget(playerB, "Balduvian Bears");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertType("Balduvian Bears", CardType.CREATURE, SubType.SKELETON);
|
||||||
|
assertPowerToughness(playerA, "Balduvian Bears", 1, 1);
|
||||||
|
assertColor(playerA, "Balduvian Bears", ObjectColor.BLACK, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package org.mage.test.cards.single.neo;
|
||||||
|
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.abilities.keyword.HasteAbility;
|
||||||
|
import mage.abilities.keyword.LifelinkAbility;
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
|
||||||
|
public class EaterOfVirtueTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Eater of Virtue
|
||||||
|
{1}
|
||||||
|
Legendary Artifact — Equipment
|
||||||
|
|
||||||
|
Whenever equipped creature dies, exile it.
|
||||||
|
|
||||||
|
Equipped creature gets +2/+0.
|
||||||
|
|
||||||
|
As long as a card exiled with Eater of Virtue has flying, equipped creature has flying.
|
||||||
|
The same is true for first strike, double strike, deathtouch, haste, hexproof, indestructible, lifelink, menace, protection, reach, trample, and vigilance.
|
||||||
|
|
||||||
|
Equip {1}
|
||||||
|
*/
|
||||||
|
public static final String eaterOfVirtue = "Eater of Virtue";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEaterOfVirtue() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, eaterOfVirtue);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Adult Gold Dragon"); // Flying, Lifelink, Haste
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears");
|
||||||
|
addCard(Zone.HAND, playerB, "Doom Blade");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", "Adult Gold Dragon");
|
||||||
|
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, 1);
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Doom Blade", "Adult Gold Dragon");
|
||||||
|
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, 1);
|
||||||
|
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Equip", "Balduvian Bears");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertAbilities(playerA, "Balduvian Bears", Arrays.asList(FlyingAbility.getInstance(), LifelinkAbility.getInstance(), HasteAbility.getInstance()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package org.mage.test.cards.single.one;
|
||||||
|
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestCommanderDuelBase;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
|
||||||
|
public class EncroachingMycosynthTest extends CardTestCommanderDuelBase {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Encroaching Mycosynth
|
||||||
|
{3}{U}
|
||||||
|
Artifact
|
||||||
|
|
||||||
|
Nonland permanents you control are artifacts in addition to their other types.
|
||||||
|
The same is true for permanent spells you control and nonland permanent cards you own that aren’t on the battlefield.
|
||||||
|
*/
|
||||||
|
private static final String encroachingMycosynth = "Encroaching Mycosynth";
|
||||||
|
private static final String balduvianBears = "Balduvian Bears";
|
||||||
|
@Test
|
||||||
|
public void testEncroachingMycosynth() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCard(Zone.GRAVEYARD, playerA, balduvianBears);
|
||||||
|
addCard(Zone.HAND, playerA, balduvianBears, 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, balduvianBears);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, encroachingMycosynth);
|
||||||
|
addCard(Zone.EXILED, playerA, balduvianBears);
|
||||||
|
addCard(Zone.LIBRARY, playerA, balduvianBears);
|
||||||
|
addCard(Zone.COMMAND, playerA, balduvianBears);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, balduvianBears);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertType(balduvianBears, CardType.ARTIFACT, true);
|
||||||
|
List<Card> cards = getHandCards(playerA);
|
||||||
|
cards.addAll(getLibraryCards(playerA));
|
||||||
|
cards.addAll(getCommandCards(playerA));
|
||||||
|
cards.addAll(getExiledCards(playerA));
|
||||||
|
cards.addAll(getLibraryCards(playerA));
|
||||||
|
for (Card card : cards) {
|
||||||
|
if (!card.isLand(currentGame)) {
|
||||||
|
assertTrue(card.getCardType(currentGame).contains(CardType.ARTIFACT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
package org.mage.test.cards.single.shm;
|
||||||
|
|
||||||
|
import mage.constants.CardType;
|
||||||
|
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 ElsewhereFlaskTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Elsewhere Flask
|
||||||
|
{2}
|
||||||
|
Artifact
|
||||||
|
|
||||||
|
When this artifact enters, draw a card.
|
||||||
|
|
||||||
|
Sacrifice this artifact: Choose a basic land type. Each land you control becomes that type until end of turn.
|
||||||
|
*/
|
||||||
|
private static final String elsewhereFlask = "Elsewhere Flask";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testElsewhereFlask() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, elsewhereFlask);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice");
|
||||||
|
setChoice(playerA, "Swamp");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertType("Island", CardType.LAND, SubType.SWAMP);
|
||||||
|
assertType("Forest", CardType.LAND, SubType.SWAMP);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testElsewhereFlask2() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, elsewhereFlask);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice");
|
||||||
|
setChoice(playerA, "Swamp");
|
||||||
|
|
||||||
|
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertType("Island", CardType.LAND, SubType.ISLAND);
|
||||||
|
assertType("Forest", CardType.LAND, SubType.FOREST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package org.mage.test.cards.single.tmp;
|
||||||
|
|
||||||
|
import mage.abilities.keyword.LandwalkAbility;
|
||||||
|
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 ExcavatorTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Excavator
|
||||||
|
{2}
|
||||||
|
Artifact
|
||||||
|
|
||||||
|
{T}, Sacrifice a basic land: Target creature gains landwalk of each of the land types of the sacrificed land until end of turn.
|
||||||
|
(It can’t be blocked as long as defending player controls a land of any of those types.)
|
||||||
|
*/
|
||||||
|
public static final String excavator = "Excavator";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Leyline of the Guildpact
|
||||||
|
{G/W}{G/U}{B/G}{R/G}
|
||||||
|
Enchantment
|
||||||
|
|
||||||
|
If this card is in your opening hand, you may begin the game with it on the battlefield.
|
||||||
|
|
||||||
|
Each nonland permanent you control is all colors.
|
||||||
|
|
||||||
|
Lands you control are every basic land type in addition to their other types.
|
||||||
|
*/
|
||||||
|
public static final String leylineOfTheGuildpact = "Leyline of the Guildpact";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore("Failing because permanent LKI does not save MageObjectAttribute values")
|
||||||
|
public void testExcavator() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, excavator);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, leylineOfTheGuildpact);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears");
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}");
|
||||||
|
setChoice(playerA, "Island");
|
||||||
|
addTarget(playerA, "Balduvian Bears");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertAbilityCount(playerA, "Balduvian Bears", LandwalkAbility.class, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
package org.mage.test.cards.single.who;
|
||||||
|
|
||||||
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.common.LoseGameSourceControllerEffect;
|
||||||
|
import mage.abilities.effects.common.LoseLifeAllPlayersEffect;
|
||||||
|
import mage.abilities.effects.common.WinGameSourceControllerEffect;
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestCommander4Players;
|
||||||
|
|
||||||
|
public class EverybodyLivesTest extends CardTestCommander4Players {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Everybody Lives!
|
||||||
|
{1}{W}
|
||||||
|
Instant
|
||||||
|
|
||||||
|
All creatures gain hexproof and indestructible until end of turn. Players gain hexproof until end of turn.
|
||||||
|
Players can’t lose life this turn and players can’t lose the game or win the game this turn.
|
||||||
|
*/
|
||||||
|
private static final String everybodyLives = "Everybody Lives!";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEverybodyLivesCantLoseLifeAndHexproof() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCustomCardWithAbility("lose life effect", playerA, new SimpleActivatedAbility(
|
||||||
|
new LoseLifeAllPlayersEffect(20),
|
||||||
|
new ManaCostsImpl<>(""))
|
||||||
|
);
|
||||||
|
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||||
|
addCard(Zone.HAND, playerA, everybodyLives);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, everybodyLives, true);
|
||||||
|
checkPlayableAbility("Can't cast lightning bolt", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", false);
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "each player");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 20);
|
||||||
|
assertLife(playerB, 20);
|
||||||
|
assertLife(playerC, 20);
|
||||||
|
assertLife(playerD, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEverybodyLivesCantLoseGame() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCustomCardWithAbility("lose game effect", playerA, new SimpleActivatedAbility(
|
||||||
|
new LoseGameSourceControllerEffect(),
|
||||||
|
new ManaCostsImpl<>(""))
|
||||||
|
);
|
||||||
|
addCard(Zone.HAND, playerA, everybodyLives);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, everybodyLives, true);
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "you lose");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertHasNotLostTheGame(playerA);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEverybodyLivesCantWinGame() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCustomCardWithAbility("win game effect", playerA, new SimpleActivatedAbility(
|
||||||
|
new WinGameSourceControllerEffect(),
|
||||||
|
new ManaCostsImpl<>(""))
|
||||||
|
);
|
||||||
|
addCard(Zone.HAND, playerA, everybodyLives);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, everybodyLives, true);
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "you win");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertHasNotWonTheGame(playerA);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue