Merge branch 'master' into Battlebond_Boos

This commit is contained in:
Chatziargyriou Eleftheria 2018-07-31 17:02:11 +03:00 committed by GitHub
commit 197020b162
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1466 changed files with 18523 additions and 4276 deletions

View file

@ -23,7 +23,7 @@ public class MetalcraftTest extends CardTestPlayerBase {
public void testMetalcraftFromBlinkmoth() {
addCard(Zone.BATTLEFIELD, playerA, "Darksteel Citadel",1);
// Metalcraft - {this} is a 5/5 Golem artifact creature as long as you control three or more artifacts
// <i>Metalcraft</i> &mdash; {this} is a 5/5 Golem artifact creature as long as you control three or more artifacts
addCard(Zone.BATTLEFIELD, playerA, "Rusted Relic", 1);
// {T}: Add {C}to your mana pool.

View file

@ -36,9 +36,41 @@ public class PutToLibraryTest extends CardTestPlayerBase {
ArrayList<Card> cardArray = new ArrayList<>(playerB.getLibrary().getCards(currentGame));
Assert.assertTrue("Library has no cards but should have", cardArray.size() > 1);
Card secondCard = cardArray.get(1);
Assert.assertTrue("Second card from top should be Dread Wanderer, bnut it isn't",
Assert.assertTrue("Second card from top should be Dread Wanderer, but it isn't",
secondCard != null && secondCard.getName().equals("Dread Wanderer"));
}
// Unexpectedly Absent doesn't work properly, no matter how much you pay for X the card is always returned on top of the library.
@Test
public void testUnexpectedlyAbsent() {
// Flying
// At the beginning of combat on your turn, you may pay {G}{U}. When you do, put a +1/+1 counter on another target creature you control, and that creature gains flying until end of turn.
addCard(Zone.BATTLEFIELD, playerA, "Skyrider Patrol", 1);
// Put target nonland permanent into its owner's library just beneath the top X cards of that library.
addCard(Zone.HAND, playerB, "Unexpectedly Absent"); // Instant {X}{W}{W}
addCard(Zone.BATTLEFIELD, playerB, "Plains", 5);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Unexpectedly Absent", "Skyrider Patrol");
setChoice(playerB, "X=3");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerB, "Unexpectedly Absent", 1);
assertPermanentCount(playerA, "Skyrider Patrol", 0);
assertLibraryCount(playerA, "Skyrider Patrol", 1);
ArrayList<Card> cardArray = new ArrayList<>(playerA.getLibrary().getCards(currentGame));
Assert.assertTrue("Library has no cards but should have", cardArray.size() > 3);
Card fourthCard = cardArray.get(3);// get the 4th element
Assert.assertTrue("Fourth card from top should be Skyrider Patrol, but it isn't",
fourthCard != null && fourthCard.getName().equals("Skyrider Patrol"));
assertLife(playerA, 20);
assertLife(playerB, 20);
}
}

View file

@ -0,0 +1,67 @@
package org.mage.test.cards.abilities.other;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
import mage.constants.Zone;
import mage.game.FreeForAll;
import mage.game.Game;
import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import java.io.FileNotFoundException;
public class NaturesWillTest extends CardTestPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 20);
playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB");
playerC = createPlayer(game, playerC, "PlayerC");
return game;
}
@Test
public void testAttackMultiplePlayers() {
addCard(Zone.HAND, playerA, "Nature's Will");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerA, "Suntail Hawk");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 4);
addCard(Zone.BATTLEFIELD, playerC, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nature's Will");
attack(1, playerA, "Grizzly Bears", playerB);
attack(1, playerA, "Suntail Hawk", playerC);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertTappedCount("Forest", false, 4);
assertTappedCount("Mountain", true, 4);
assertTappedCount("Island", true, 4);
}
@Test
public void testAttackOnePlayer() {
addCard(Zone.HAND, playerA, "Nature's Will");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 4);
addCard(Zone.BATTLEFIELD, playerC, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nature's Will");
attack(1, playerA, "Grizzly Bears", playerB);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertTappedCount("Forest", false, 4);
assertTappedCount("Mountain", true, 4);
assertTappedCount("Island", false, 4);
}
}

View file

@ -0,0 +1,59 @@
package org.mage.test.cards.abilities.other;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
import mage.constants.Zone;
import mage.game.FreeForAll;
import mage.game.Game;
import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import java.io.FileNotFoundException;
public class StormTheVaultTest extends CardTestPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 20);
playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB");
playerC = createPlayer(game, playerC, "PlayerC");
return game;
}
@Test
public void testAttackMultiplePlayers() {
addCard(Zone.BATTLEFIELD, playerA, "Storm the Vault");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerA, "Nessian Courser");
addCard(Zone.BATTLEFIELD, playerA, "Suntail Hawk");
addCard(Zone.BATTLEFIELD, playerA, "Lantern Kami");
attack(1, playerA, "Grizzly Bears", playerB);
attack(1, playerA, "Nessian Courser", playerB);
attack(1, playerA, "Suntail Hawk", playerC);
attack(1, playerA, "Lantern Kami", playerC);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Treasure", 2);
}
@Test
public void testAttackOnePlayer() {
addCard(Zone.BATTLEFIELD, playerA, "Storm the Vault");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerA, "Suntail Hawk");
attack(1, playerA, "Grizzly Bears", playerB);
attack(1, playerA, "Suntail Hawk", playerB);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Treasure", 1);
}
}

View file

@ -191,4 +191,34 @@ public class CleverImpersonatorTest extends CardTestPlayerBase {
assertType(dReflection, CardType.ENCHANTMENT, true);
}
@Test
public void testKindredDiscovery() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.HAND, playerA, "Kindred Discovery");
addCard(Zone.BATTLEFIELD, playerB, "Island", 5);
// Skip your draw step.
addCard(Zone.BATTLEFIELD, playerB, "Dragon Appeasement");
addCard(Zone.HAND, playerB, "Clever Impersonator");
addCard(Zone.HAND, playerB, "Ornithopter", 2);
addCard(Zone.HAND, playerB, "Memnite");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Kindred Discovery");
setChoice(playerA, "Construct");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Clever Impersonator");
setChoice(playerB, "Kindred Discovery");
setChoice(playerB, "Thopter");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Ornithopter");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Ornithopter");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Memnite");
setStopAt(2, PhaseStep.END_COMBAT);
execute();
assertHandCount(playerB, 2);
}
}

View file

@ -4,6 +4,7 @@ import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectsList;
import mage.cards.Card;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
@ -89,7 +90,7 @@ public class CloneTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Llanowar Elves");
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Public Executio", "Llanowar Elves");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Public Execution", "Llanowar Elves");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Clone");
setStopAt(1, PhaseStep.END_TURN);
@ -199,4 +200,32 @@ public class CloneTest extends CardTestPlayerBase {
Assert.assertTrue("There should be a white and a blue Silvercoat Lion be on the battlefield", blueLion && whiteLion);
}
@Test
public void testAdaptiveAutomaton() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.HAND, playerA, "Adaptive Automaton");
addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
addCard(Zone.HAND, playerB, "Clone");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Adaptive Automaton");
setChoice(playerA, "Elf");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Clone");
setChoice(playerB, "Adaptive Automaton");
setChoice(playerB, "Goblin");
setStopAt(2, PhaseStep.END_COMBAT);
execute();
assertPermanentCount(playerA, "Adaptive Automaton", 1);
Permanent original = getPermanent("Adaptive Automaton", playerA);
Assert.assertTrue("The original Adaptive Automaton should be an Elf", original.hasSubtype(SubType.ELF, currentGame));
assertPermanentCount(playerB, "Adaptive Automaton", 1);
Permanent clone = getPermanent("Adaptive Automaton", playerB);
Assert.assertFalse("The cloned Adaptive Automaton should not be as Elf", clone.hasSubtype(SubType.ELF, currentGame));
Assert.assertTrue("The cloned Adaptive Automaton should be a Goblin", clone.hasSubtype(SubType.GOBLIN, currentGame));
}
}

View file

@ -23,7 +23,7 @@ public class KikiJikiMirrorBreakerTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Kiki-Jiki, Mirror Breaker", 1);
addCard(Zone.BATTLEFIELD, playerA, "Voice of Resurgence", 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Create a token that's a copy of target nonlegendary creature you control. That token has haste. Sacrifice it at the beginning of the next end step.");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Create a token that's a copy of target nonlegendary creature you control, except it has haste. Sacrifice it at the beginning of the next end step.");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
@ -39,7 +39,7 @@ public class KikiJikiMirrorBreakerTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Kiki-Jiki, Mirror Breaker", 1);
addCard(Zone.BATTLEFIELD, playerA, "Voice of Resurgence", 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Create a token that's a copy of target nonlegendary creature you control. That token has haste. Sacrifice it at the beginning of the next end step.");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Create a token that's a copy of target nonlegendary creature you control, except it has haste. Sacrifice it at the beginning of the next end step.");
setStopAt(1, PhaseStep.END_TURN);
execute();
@ -60,7 +60,7 @@ public class KikiJikiMirrorBreakerTest extends CardTestPlayerBase {
// Flamebreak deals 3 damage to each creature without flying and each player. Creatures dealt damage this way can't be regenerated this turn.
addCard(Zone.HAND, playerB, "Flamebreak");
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Create a token that's a copy of target nonlegendary creature you control. That token has haste. Sacrifice it at the beginning of the next end step.");
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Create a token that's a copy of target nonlegendary creature you control, except it has haste. Sacrifice it at the beginning of the next end step.");
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Flamebreak");
setStopAt(2, PhaseStep.END_TURN);
@ -95,7 +95,7 @@ public class KikiJikiMirrorBreakerTest extends CardTestPlayerBase {
castSpell(2, PhaseStep.UPKEEP, playerA, "Blustersquall", "Humble Defector"); // Tap nontoken Defector so only the Token can be used later
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{T}: Create a token that's a copy of target nonlegendary creature you control. That token has haste. Sacrifice it at the beginning of the next end step.");
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{T}: Create a token that's a copy of target nonlegendary creature you control, except it has haste. Sacrifice it at the beginning of the next end step.");
activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "{T}: Draw two cards. Target opponent gains control");
@ -137,7 +137,7 @@ public class KikiJikiMirrorBreakerTest extends CardTestPlayerBase {
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Body Double");
setChoice(playerB, "Silvercoat Lion");
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{T}: Create a token that's a copy of target nonlegendary creature you control. That token has haste. Sacrifice it at the beginning of the next end step.");
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{T}: Create a token that's a copy of target nonlegendary creature you control, except it has haste. Sacrifice it at the beginning of the next end step.");
attack(2, playerB, "Silvercoat Lion");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);

View file

@ -1,9 +1,9 @@
package org.mage.test.cards.mana;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -48,6 +48,7 @@ public class ConditionalManaTest extends CardTestPlayerBase {
}
@Test
@Ignore
public void testWorkingWithReflectingPool() {
addCard(Zone.BATTLEFIELD, playerA, "Cavern of Souls", 1); // can give {C] or {any} mana ({any} with restrictions)
addCard(Zone.BATTLEFIELD, playerA, "Reflecting Pool", 1); // must give {C} or {any} mana from the Cavern, but without restrictions

View file

@ -1,10 +1,10 @@
package org.mage.test.cards.mana;
import mage.abilities.mana.ManaOptions;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import static org.mage.test.utils.ManaOptionsTestUtils.*;
@ -16,6 +16,7 @@ import static org.mage.test.utils.ManaOptionsTestUtils.*;
public class HarvesterDruidTest extends CardTestPlayerBase {
@Test
@Ignore
public void testOneInstance() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
@ -34,6 +35,7 @@ public class HarvesterDruidTest extends CardTestPlayerBase {
}
@Test
@Ignore
public void testTwoInstances() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);

View file

@ -1,4 +1,3 @@
package org.mage.test.cards.mana;
import mage.abilities.mana.ManaOptions;
@ -6,6 +5,7 @@ import mage.constants.ManaType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -133,6 +133,7 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
* producing mana
*/
@Test
@Ignore
public void testWithDifferentLands() {
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
@ -161,7 +162,6 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
assertManaOptions("{W}{W}", options);
}
@Test
public void testReflectingPoolGiveNonMana() {
addCard(Zone.HAND, playerA, bear1, 1);
@ -215,6 +215,7 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
}
@Test
@Ignore
public void testReflectingPoolAnyManaNeedWithoutCondition() {
// any mana source without conditions (use any mana at any time)
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
@ -232,6 +233,7 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
}
@Test
@Ignore
public void testReflectingPoolAnyManaNeedWithCondition() {
// any mana source have condition to use (Reflecting Pool must ignore that condition)
addCard(Zone.BATTLEFIELD, playerA, "Cavern of Souls", 1); // {C} or {any}
@ -256,7 +258,7 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add one mana of any");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {W}");
setChoice(playerA,"Black");
setChoice(playerA, "Black");
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();

View file

@ -1,10 +1,10 @@
package org.mage.test.cards.mana;
import mage.abilities.mana.ManaOptions;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -32,6 +32,7 @@ public class SylvokExplorerTest extends CardTestPlayerBase {
* mage.abilities.mana.AnyColorLandsProduceManaEffect.getNetMana(AnyColorLandsProduceManaAbility.java:181)
*/
@Test
@Ignore
public void testOneInstance() {
addCard(Zone.BATTLEFIELD, playerB, "Island", 1);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);

View file

@ -4,6 +4,7 @@ import mage.constants.ManaType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -90,6 +91,7 @@ public class VorinclexVoiceOfHungerTest extends CardTestPlayerBase {
}
@Test
@Ignore
public void testCastWithGemstoneCavern() {
// Trample
// Whenever you tap a land for mana, add one mana of any type that land produced.

View file

@ -127,7 +127,7 @@ public class CantCastTest extends CardTestPlayerBase {
// Your opponents can't block with creatures with even converted mana costs.
addCard(Zone.BATTLEFIELD, playerB, "Void Winnower");
// Metalcraft - {T}: Add one mana of any color. Activate this ability only if you control three or more artifacts.
// <i>Metalcraft</i> &mdash; {T}: Add one mana of any color. Activate this ability only if you control three or more artifacts.
addCard(Zone.HAND, playerA, "Mox Opal", 1); // {0}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mox Opal");

View file

@ -0,0 +1,56 @@
package org.mage.test.cards.triggers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class AbilityOwnershipTest extends CardTestPlayerBase {
@Test
public void testOwned() {
addCard(Zone.GRAVEYARD, playerB, "Soul Snuffers");
addCard(Zone.GRAVEYARD, playerB, "Minister of Pain");
addCard(Zone.HAND, playerA, "Rise of the Dark Realms");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 9);
addCard(Zone.BATTLEFIELD, playerA, "Obelisk Spider");
setLife(playerA, 20);
setLife(playerB, 20);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rise of the Dark Realms");
setChoice(playerA, "Yes");
addTarget(playerA, "Soul Snuffers"); // sacrifice to Exploit
setStopAt(1, PhaseStep.END_COMBAT);
execute();
// Obelisk Spider Triggers twice once for the counter on Obelisk Spider. Once for the counter on Minister of Pain.
assertLife(playerA, 22);
assertLife(playerB, 18);
}
@Test
public void testToGraveyard() {
addCard(Zone.GRAVEYARD, playerB, "Soul Snuffers");
addCard(Zone.GRAVEYARD, playerB, "Minister of Pain");
addCard(Zone.BATTLEFIELD, playerB, "Obelisk Spider");
addCard(Zone.HAND, playerA, "Rise of the Dark Realms");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 9);
setLife(playerA, 20);
setLife(playerB, 20);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rise of the Dark Realms");
setChoice(playerA, "Yes");
addTarget(playerA, "Soul Snuffers"); // sacrifice to Exploit
setStopAt(1, PhaseStep.END_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
}
}

View file

@ -0,0 +1,40 @@
package org.mage.test.combat;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class FirstStrikeTest extends CardTestPlayerBase {
@Test
public void firstStrikeAttacker(){
addCard(Zone.BATTLEFIELD, playerA, "Silver Knight", 1);
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 1);
attack(1, playerA, "Silver Knight");
block(1, playerB, "Grizzly Bears", "Silver Knight");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertGraveyardCount(playerB, "Grizzly Bears", 1);
assertGraveyardCount(playerA, "Silver Knight", 0);
}
@Test
public void firstStrikeBlocker(){
addCard(Zone.BATTLEFIELD, playerB, "Silver Knight", 1);
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1);
attack(1, playerA, "Grizzly Bears");
block(1, playerB, "Silver Knight", "Grizzly Bears");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertGraveyardCount(playerA, "Grizzly Bears", 1);
assertGraveyardCount(playerB, "Silver Knight", 0);
}
}

View file

@ -44,7 +44,7 @@ public class PhageTheUntouchableTest extends CardTestPlayerBase {
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
Assert.assertTrue("Player A has won.", playerA.hasWon());
Assert.assertTrue("Game ist At end phase", currentGame.getPhase().getType().equals(TurnPhase.END));
Assert.assertTrue("Game ist At end phase", currentGame.getPhase().getType() == TurnPhase.END);
}

View file

@ -4,7 +4,6 @@ import java.io.Serializable;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mage.MageObject;
import mage.MageObjectReference;
import mage.ObjectColor;
@ -127,7 +126,7 @@ public class TestPlayer implements Player {
/**
* @param maxCallsWithoutAction max number of priority passes a player may
* have for this test (default = 100)
* have for this test (default = 100)
*/
public void setMaxCallsWithoutAction(int maxCallsWithoutAction) {
this.maxCallsWithoutAction = maxCallsWithoutAction;
@ -686,7 +685,6 @@ public class TestPlayer implements Player {
}
}
private void assertManaPoolInner(PlayerAction action, Player player, ManaType manaType, Integer amount) {
Integer current = player.getManaPool().get(manaType);
Assert.assertEquals(action.getActionName() + " - mana pool must contain [" + amount.toString() + " " + manaType.toString() + "], but found [" + current.toString() + "]", amount, current);
@ -696,7 +694,6 @@ public class TestPlayer implements Player {
Assert.assertNotEquals(action.getActionName() + " - must setup color", "", colors);
// Can't use ObjectColor -- it's doesn't contain colorless -- need to use custom parse
for (int i = 0; i < colors.length(); i++) {
switch (colors.charAt(i)) {
case 'W':
@ -774,7 +771,7 @@ public class TestPlayer implements Player {
// Loop through players and validate can attack/block this turn
UUID defenderId = null;
//List<PlayerAction>
for (Iterator<org.mage.test.player.PlayerAction> it = actions.iterator(); it.hasNext(); ) {
for (Iterator<org.mage.test.player.PlayerAction> it = actions.iterator(); it.hasNext();) {
PlayerAction action = it.next();
if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("attack:")) {
String command = action.getAction();
@ -826,6 +823,11 @@ public class TestPlayer implements Player {
}
}
@Override
public List<UUID> getTurnControllers() {
return computerPlayer.getTurnControllers();
}
@Override
public void selectBlockers(Game game, UUID defendingPlayerId) {
@ -1488,6 +1490,11 @@ public class TestPlayer implements Player {
computerPlayer.setGameUnderYourControl(value);
}
@Override
public void setGameUnderYourControl(boolean value, boolean fullRestore) {
computerPlayer.setGameUnderYourControl(value, fullRestore);
}
@Override
public void endOfTurn(Game game) {
computerPlayer.endOfTurn(game);
@ -2197,6 +2204,11 @@ public class TestPlayer implements Player {
return computerPlayer.canPlayCardsFromGraveyard();
}
@Override
public void setPayManaMode(boolean payManaMode) {
computerPlayer.setPayManaMode(payManaMode);
}
@Override
public void setPlayCardsFromGraveyard(boolean playCardsFromGraveyard) {
computerPlayer.setPlayCardsFromGraveyard(playCardsFromGraveyard);
@ -2442,7 +2454,7 @@ public class TestPlayer implements Player {
@Override
public boolean choose(Outcome outcome, Target target,
UUID sourceId, Game game
UUID sourceId, Game game
) {
// needed to call here the TestPlayer because it's overwitten
return choose(outcome, target, sourceId, game, null);
@ -2450,7 +2462,7 @@ public class TestPlayer implements Player {
@Override
public boolean choose(Outcome outcome, Cards cards,
TargetCard target, Game game
TargetCard target, Game game
) {
if (!choices.isEmpty()) {
for (String choose2 : choices) {
@ -2482,7 +2494,7 @@ public class TestPlayer implements Player {
@Override
public boolean chooseTargetAmount(Outcome outcome, TargetAmount target,
Ability source, Game game
Ability source, Game game
) {
return computerPlayer.chooseTargetAmount(outcome, target, source, game);
}
@ -2495,15 +2507,15 @@ public class TestPlayer implements Player {
@Override
public boolean choosePile(Outcome outcome, String message,
List<? extends Card> pile1, List<? extends Card> pile2,
Game game
List<? extends Card> pile1, List<? extends Card> pile2,
Game game
) {
return computerPlayer.choosePile(outcome, message, pile1, pile2, game);
}
@Override
public boolean playMana(Ability ability, ManaCost unpaid,
String promptText, Game game
String promptText, Game game
) {
groupsForTargetHandling = null;
return computerPlayer.playMana(ability, unpaid, promptText, game);
@ -2517,15 +2529,15 @@ public class TestPlayer implements Player {
@Override
public UUID chooseBlockerOrder(List<Permanent> blockers, CombatGroup combatGroup,
List<UUID> blockerOrder, Game game
List<UUID> blockerOrder, Game game
) {
return computerPlayer.chooseBlockerOrder(blockers, combatGroup, blockerOrder, game);
}
@Override
public void assignDamage(int damage, List<UUID> targets,
String singleTargetName, UUID sourceId,
Game game
String singleTargetName, UUID sourceId,
Game game
) {
computerPlayer.assignDamage(damage, targets, singleTargetName, sourceId, game);
}
@ -2544,14 +2556,14 @@ public class TestPlayer implements Player {
@Override
public void pickCard(List<Card> cards, Deck deck,
Draft draft
Draft draft
) {
computerPlayer.pickCard(cards, deck, draft);
}
@Override
public boolean scry(int value, Ability source,
Game game
Game game
) {
// Don't scry at the start of the game.
if (game.getTurnNum() == 1 && game.getStep() == null) {
@ -2562,37 +2574,37 @@ public class TestPlayer implements Player {
@Override
public boolean moveCards(Card card, Zone toZone,
Ability source, Game game
Ability source, Game game
) {
return computerPlayer.moveCards(card, toZone, source, game);
}
@Override
public boolean moveCards(Card card, Zone toZone,
Ability source, Game game,
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
Ability source, Game game,
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
) {
return computerPlayer.moveCards(card, toZone, source, game, tapped, faceDown, byOwner, appliedEffects);
}
@Override
public boolean moveCards(Cards cards, Zone toZone,
Ability source, Game game
Ability source, Game game
) {
return computerPlayer.moveCards(cards, toZone, source, game);
}
@Override
public boolean moveCards(Set<Card> cards, Zone toZone,
Ability source, Game game
Ability source, Game game
) {
return computerPlayer.moveCards(cards, toZone, source, game);
}
@Override
public boolean moveCards(Set<Card> cards, Zone toZone,
Ability source, Game game,
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
Ability source, Game game,
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
) {
return computerPlayer.moveCards(cards, toZone, source, game, tapped, faceDown, byOwner, appliedEffects);
}

View file

@ -985,7 +985,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
int actualCount = 0;
for (ExileZone exile : currentGame.getExile().getExileZones()) {
for (Card card : exile.getCards(currentGame)) {
if (card.getOwnerId().equals(owner.getId())) {
if (card.isOwnedBy(owner.getId())) {
actualCount++;
}
}
@ -1005,7 +1005,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
int actualCount = 0;
for (ExileZone exile : currentGame.getExile().getExileZones()) {
for (Card card : exile.getCards(currentGame)) {
if (card.getOwnerId().equals(owner.getId()) && card.getName().equals(cardName)) {
if (card.isOwnedBy(owner.getId()) && card.getName().equals(cardName)) {
actualCount++;
}
}

View file

@ -5,14 +5,15 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import mage.abilities.Ability;
import mage.abilities.keyword.PartnerWithAbility;
import mage.cards.Card;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardScanner;
import mage.sets.FateReforged;
import mage.sets.Battlebond;
import mage.abilities.keyword.PartnerWithAbility;
import mage.sets.MastersEditionII;
import mage.sets.MastersEditionIV;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.sets.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@ -123,6 +124,28 @@ public class BoosterGenerationTest extends MageTestBase {
}
}
@Test
public void testCoreSet2019_DualLandsAreGenerated() {
List<Card> allCards = new ArrayList<>();
for (int i = 0; i < 50; i++) {
List<Card> booster = CoreSet2019.getInstance().createBooster();
// check that booster contains a land card
assertTrue(booster.stream().anyMatch(card -> card.getCardType().contains(CardType.LAND)));
allCards.addAll(booster);
}
// check that some dual lands were generated
assertTrue(allCards.stream().anyMatch(card -> card.getCardType().contains(CardType.LAND) && card.getRarity().equals(Rarity.COMMON)));
}
@Test
public void testDominaria_EveryBoosterContainsLegendaryCreature() {
for (int i = 0; i < 10; i++) {
List<Card> booster = Dominaria.getInstance().createBooster();
// check that booster contains legendary creature
assertTrue(booster.stream().anyMatch(card -> card.isCreature() && card.isLegendary()));
}
}
private static String str(List<Card> cards) {
StringBuilder sb = new StringBuilder("[");
Iterator<Card> iterator = cards.iterator();

View file

@ -1307,6 +1307,21 @@ public class PlayerStub implements Player {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List<UUID> getTurnControllers() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setGameUnderYourControl(boolean value, boolean fullRestore) {
}
@Override
public void setPayManaMode(boolean payManaMode) {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@ -1325,4 +1340,11 @@ public class PlayerStub implements Player {
return this.getId().equals(obj.getId());
}
@Override
public int hashCode() {
int hash = 5;
hash = 41 * hash + Objects.hashCode(this.id);
return hash;
}
}

View file

@ -454,4 +454,103 @@ public class ManaOptionsTest extends CardTestPlayerBase {
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
assertManaOptions("{C}{C}", manaOptions);
}
@Test
public void testManaSourcesWithCosts() {
// {T}: Add {C} to your mana pool.
// {5}, {T}: Add {W}{U}{B}{R}{G} to your mana pool.
addCard(Zone.BATTLEFIELD, playerA, "Crystal Quarry", 1);
// {T}: Add {C} to your mana pool.
// {W/B}, {T}: Add {W}{W}, {W}{B}, or {B}{B} to your mana pool.
addCard(Zone.BATTLEFIELD, playerA, "Fetid Heath", 3);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
setStopAt(1, PhaseStep.UPKEEP);
execute();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
assertDuplicatedManaOptions(manaOptions);
Assert.assertEquals("mana variations don't fit", 16, manaOptions.size());
assertManaOptions("{C}{C}{C}{C}{W}{W}{W}", manaOptions);
assertManaOptions("{C}{C}{C}{W}{W}{W}{W}", manaOptions);
assertManaOptions("{C}{C}{C}{W}{W}{W}{B}", manaOptions);
assertManaOptions("{C}{C}{C}{W}{W}{B}{B}", manaOptions);
assertManaOptions("{C}{C}{W}{W}{W}{W}{W}", manaOptions);
assertManaOptions("{C}{C}{W}{W}{W}{W}{B}", manaOptions);
assertManaOptions("{C}{C}{W}{W}{W}{B}{B}", manaOptions);
assertManaOptions("{C}{C}{W}{W}{B}{B}{B}", manaOptions);
assertManaOptions("{C}{C}{W}{B}{B}{B}{B}", manaOptions);
assertManaOptions("{C}{W}{W}{W}{W}{W}{W}", manaOptions);
assertManaOptions("{C}{W}{W}{W}{W}{W}{B}", manaOptions);
assertManaOptions("{C}{W}{W}{W}{W}{B}{B}", manaOptions);
assertManaOptions("{C}{W}{W}{W}{B}{B}{B}", manaOptions);
assertManaOptions("{C}{W}{W}{B}{B}{B}{B}", manaOptions);
assertManaOptions("{C}{W}{B}{B}{B}{B}{B}", manaOptions);
assertManaOptions("{C}{B}{B}{B}{B}{B}{B}", manaOptions);
}
@Test
public void testSungrassPrairie() {
// {1}, {T}: Add {G}{W}.
addCard(Zone.BATTLEFIELD, playerA, "Sungrass Prairie", 1);
// {T}: Add one mana of any color to your mana pool.
addCard(Zone.BATTLEFIELD, playerA, "Alloy Myr", 2);
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
assertDuplicatedManaOptions(manaOptions);
Assert.assertEquals("mana variations don't fit", 2, manaOptions.size());
assertManaOptions("{W}{G}{Any}", manaOptions);
assertManaOptions("{Any}{Any}", manaOptions);
}
@Test
public void testSungrassPrairie2() {
// {1}, {T}: Add {G}{W}.
addCard(Zone.BATTLEFIELD, playerA, "Sungrass Prairie", 5);
// ({T}: Add {U} or {W} to your mana pool.)
addCard(Zone.BATTLEFIELD, playerA, "Tundra", 9);
// ({T}: Add {G} or {U} to your mana pool.)
addCard(Zone.BATTLEFIELD, playerA, "Tropical Island", 3);
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
assertDuplicatedManaOptions(manaOptions);
Assert.assertEquals("mana variations don't fit", 88, manaOptions.size());
assertManaOptions("{W}{W}{W}{W}{W}{W}{W}{W}{W}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{W}{W}{W}{W}{W}{W}{W}{W}{U}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
}
@Test
public void testSungrassPrairie3() {
// {1}, {T}: Add {G}{W}.
addCard(Zone.BATTLEFIELD, playerA, "Sungrass Prairie", 1);
// ({T}: Add {U} or {W} to your mana pool.)
addCard(Zone.BATTLEFIELD, playerA, "Tundra", 1);
// ({T}: Add {G} or {U} to your mana pool.)
addCard(Zone.BATTLEFIELD, playerA, "Tropical Island", 1);
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
assertDuplicatedManaOptions(manaOptions);
Assert.assertEquals("mana variations don't fit", 4, manaOptions.size());
assertManaOptions("{U}{U}", manaOptions);
assertManaOptions("{W}{G}{G}", manaOptions);
assertManaOptions("{W}{U}{G}", manaOptions);
assertManaOptions("{W}{W}{G}", manaOptions);
}
}