Merge branch 'master' into akh-card-frame

This commit is contained in:
Mark Langen 2017-04-04 18:36:37 -06:00 committed by GitHub
commit a2e8cedd02
272 changed files with 7641 additions and 2593 deletions

View file

@ -27,7 +27,6 @@
*/
package org.mage.test.cards.abilities.keywords;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
@ -109,7 +108,7 @@ public class BestowTest extends CardTestPlayerBase {
// because Boon Satyr is no creature on the battlefield, evolve may not trigger
assertPermanentCount(playerA, "Boon Satyr", 1);
Permanent boonSatyr = getPermanent("Boon Satyr", playerA);
Assert.assertTrue("Boon Satyr may not be a creature", !boonSatyr.getCardType().contains(CardType.CREATURE));
Assert.assertTrue("Boon Satyr may not be a creature", !boonSatyr.isCreature());
assertPermanentCount(playerA, "Silent Artisan", 1);
assertPermanentCount(playerA, "Experiment One", 1);
assertPowerToughness(playerA, "Experiment One", 1, 1);
@ -145,8 +144,8 @@ public class BestowTest extends CardTestPlayerBase {
assertPowerToughness(playerA, "Hopeful Eidolon", 1, 1);
Permanent hopefulEidolon = getPermanent("Hopeful Eidolon", playerA);
Assert.assertTrue("Hopeful Eidolon has to be a creature but is not", hopefulEidolon.getCardType().contains(CardType.CREATURE));
Assert.assertTrue("Hopeful Eidolon has to be an enchantment but is not", hopefulEidolon.getCardType().contains(CardType.ENCHANTMENT));
Assert.assertTrue("Hopeful Eidolon has to be a creature but is not", hopefulEidolon.isCreature());
Assert.assertTrue("Hopeful Eidolon has to be an enchantment but is not", hopefulEidolon.isEnchantment());
}
@ -360,7 +359,7 @@ public class BestowTest extends CardTestPlayerBase {
assertPowerToughness(playerB, "Nighthowler", 2, 2);
Permanent nighthowler = getPermanent("Nighthowler", playerB);
Assert.assertEquals("Nighthowler has to be a creature", true, nighthowler.getCardType().contains(CardType.CREATURE));
Assert.assertEquals("Nighthowler has to be a creature", true, nighthowler.isCreature());
}
@Test

View file

@ -427,14 +427,14 @@ public class FlashbackTest extends CardTestPlayerBase {
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback"); // Flashback blitz
setChoice(playerA, "X=2");
setChoice(playerA, "X=1");
addTarget(playerA, mountain);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertExileCount(playerA, fCatBlitz, 1);
assertGraveyardCount(playerA, mountain, 2);
assertPermanentCount(playerA, "Elemental Cat", 2);
assertPermanentCount(playerA, "Elemental Cat", 1);
assertGraveyardCount(playerA, mountain, 1);
}
}

View file

@ -0,0 +1,179 @@
package org.mage.test.cards.abilities.oneshot.damage;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author Johnny E. Hastings
*/
public class SoulBurnTest extends CardTestPlayerBase {
@Test
public void testDamageOpponentAllBlackMana() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.HAND, playerA, "Soul Burn");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Burn", playerB);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 22);
assertLife(playerB, 18);
}
@Test
public void testDamageOpponentOneBlackFourRedMana() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.HAND, playerA, "Soul Burn");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Burn", playerB);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 18);
}
@Test
public void testDamageOpponentAllKindsOfMana() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Island");
addCard(Zone.BATTLEFIELD, playerA, "Plains");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.HAND, playerA, "Soul Burn");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Burn", playerB);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 21);
assertLife(playerB, 17);
}
@Test
public void testDamageSelfAllSwamps() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.HAND, playerA, "Soul Burn");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Burn", playerA);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
}
@Test
public void testDamageSelfWithSwampsAndMountains() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.HAND, playerA, "Soul Burn");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Burn", playerA);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 18);
assertLife(playerB, 20);
}
@Test
public void testDamageSmallCreatureAllSwamps() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.HAND, playerA, "Soul Burn");
addCard(Zone.BATTLEFIELD, playerB, "Bog Imp");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Burn", "Bog Imp");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerB, "Bog Imp", 0);
assertLife(playerA, 21);
assertLife(playerB, 20);
}
@Test
public void testDamageSmallCreatureSwampsAndMountains() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.HAND, playerA, "Soul Burn");
addCard(Zone.BATTLEFIELD, playerB, "Bog Imp");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Burn", "Bog Imp");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerB, "Bog Imp", 0);
assertLife(playerA, 20);
assertLife(playerB, 20);
}
@Test
public void testDamageBigCreatureAllSwamps() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.HAND, playerA, "Soul Burn");
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Burn", "Craw Wurm");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerB, "Craw Wurm", 1);
assertLife(playerA, 22);
assertLife(playerB, 20);
}
@Test
public void testDamageBigCreatureSwampsAndMountains() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.HAND, playerA, "Soul Burn");
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soul Burn", "Craw Wurm");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerB, "Craw Wurm", 1);
assertLife(playerA, 21);
assertLife(playerB, 20);
}
}

View file

@ -55,6 +55,9 @@ public class EndTurnEffectTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Sphinx's Tutelage");
// Each player shuffles his or her hand and graveyard into his or her library, then draws seven cards. If it's your turn, end the turn.
// (Exile all spells and abilities on the stack, including this card.
// Discard down to your maximum hand size. Damage wears off, and
// "this turn" and "until end of turn" effects end.)
addCard(Zone.HAND, playerA, "Day's Undoing"); //Sorcery {2}{U}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Day's Undoing");
@ -67,8 +70,42 @@ public class EndTurnEffectTest extends CardTestPlayerBase {
assertHandCount(playerA, 7);
assertHandCount(playerB, 7);
assertGraveyardCount(playerB, 0); // because the trigegrs of Sphinx's Tutelage cease to exist
assertGraveyardCount(playerB, 0); // because the triggers of Sphinx's Tutelage cease to exist
}
@Test
public void testSpellSplitCard() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
// End the turn.
// (Exile all spells and abilities on the stack, including this card.
// Discard down to your maximum hand size. Damage wears off, and
// "this turn" and "until end of turn" effects end.)
addCard(Zone.HAND, playerA, "Time Stop"); //Instant {4}{U}{U}
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
// Fire
// Fire deals 2 damage divided as you choose among one or two target creatures and/or players.
// Ice
// Tap target permanent. Draw a card.
addCard(Zone.HAND, playerB, "Fire // Ice"); // Instant {1}{R} // {1}{U}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Ice", "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Time Stop", NO_TARGET, "Ice");
setStopAt(2, PhaseStep.UPKEEP);
execute();
assertHandCount(playerB, "Fire // Ice", 0);
assertExileCount(playerA, "Time Stop", 1);
assertExileCount(playerB, "Fire // Ice", 1);
assertTapped("Silvercoat Lion", false);
assertHandCount(playerA, 0);
assertHandCount(playerB, 0);
}
}

View file

@ -1,6 +1,5 @@
package org.mage.test.cards.control;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
@ -47,7 +46,7 @@ public class BattlefieldTriggeredAbilitiesTest extends CardTestPlayerBase {
int playerACount = 0;
int playerBCount = 0;
for (Permanent p : currentGame.getBattlefield().getAllActivePermanents()) {
if (p.getCardType().contains(CardType.LAND)) {
if (p.isLand()) {
if (p.getControllerId().equals(playerB.getId())) {
playerBCount++;
}

View file

@ -1,6 +1,5 @@
package org.mage.test.cards.copy;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.filter.Filter;
@ -42,7 +41,7 @@ public class ProgenitorMimicTest extends CardTestPlayerBase {
int nonTokens = 0;
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {
if (permanent.getControllerId().equals(playerB.getId())) {
if (permanent.getCardType().contains(CardType.CREATURE)) {
if (permanent.isCreature()) {
if (permanent instanceof PermanentToken) {
tokens++;
} else {
@ -122,7 +121,7 @@ public class ProgenitorMimicTest extends CardTestPlayerBase {
int nonTokens = 0;
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {
if (permanent.getControllerId().equals(playerB.getId())) {
if (permanent.getCardType().contains(CardType.CREATURE)) {
if (permanent.isCreature()) {
if (permanent instanceof PermanentToken) {
tokens++;
} else {

View file

@ -51,13 +51,13 @@ public class NykthosShrineToNyxTest extends CardTestPlayerBase {
// Green mana doesn't empty from your mana pool as steps and phases end.
// Omnath, Locus of Mana gets +1/+1 for each green mana in your mana pool.
addCard(Zone.BATTLEFIELD, playerA, "Omnath, Locus of Mana", 1);
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color.");
setChoice(playerA, "Green");
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
Assert.assertEquals("message", 6, playerA.getManaPool().getGreen()); // 6 green mana
assertPowerToughness(playerA, "Omnath, Locus of Mana", 7, 7);
}
@ -78,7 +78,7 @@ public class NykthosShrineToNyxTest extends CardTestPlayerBase {
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color.");
setChoice(playerA, "Green");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Untap another target permanent.","Nykthos, Shrine to Nyx");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Untap another target permanent.", "Nykthos, Shrine to Nyx");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color.");
setChoice(playerA, "Green");
@ -87,12 +87,12 @@ public class NykthosShrineToNyxTest extends CardTestPlayerBase {
execute();
Assert.assertEquals("amount of green mana", 10, playerA.getManaPool().getGreen()); // 6G - 2G = 4G + 6G = 10G
assertPowerToughness(playerA, "Omnath, Locus of Mana", 11,11);
assertPowerToughness(playerA, "Omnath, Locus of Mana", 11, 11);
}
/*
Use Nykthos together with Kruphix, God of Horizons to save mana as colorless mana
*/
*/
@Test
public void testDoubleUseWithKruphix() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 2); // to use Nykthos
@ -109,7 +109,7 @@ public class NykthosShrineToNyxTest extends CardTestPlayerBase {
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color.");
setChoice(playerA, "Green");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Untap another target permanent.","Nykthos, Shrine to Nyx");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Untap another target permanent.", "Nykthos, Shrine to Nyx");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color.");
setChoice(playerA, "Green");
@ -117,8 +117,8 @@ public class NykthosShrineToNyxTest extends CardTestPlayerBase {
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
Assert.assertEquals("amount of colorless mana", 10, playerA.getManaPool().getColorless()); // 6 - 2 (2.Activation) = 4 + 6 = 10 colorless mana
assertPowerToughness(playerA, "Kruphix, God of Horizons", 4,7);
Assert.assertEquals("amount of colorless mana", 10, playerA.getManaPool().getColorless()); // 6 - 2 (2.Activation) = 4 + 6 = 10 colorless mana
assertPowerToughness(playerA, "Kruphix, God of Horizons", 4, 7);
}
@Test
@ -145,7 +145,7 @@ public class NykthosShrineToNyxTest extends CardTestPlayerBase {
activateManaAbility(1, PhaseStep.BEGIN_COMBAT, playerA, "{2},{T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color.");
setChoice(playerA, "Green");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
@ -153,4 +153,70 @@ public class NykthosShrineToNyxTest extends CardTestPlayerBase {
Assert.assertEquals("amount of green mana", 5, playerA.getManaPool().getGreen()); // 6 green mana
assertPowerToughness(playerA, "Omnath, Locus of Mana", 6, 6);
}
@Test
public void testNykthosDevotionAccurate() {
/*
Nykthos, Shrine to Nyx
Legendary Land
{T}: Add {1} to your mana pool.
{2}, {T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color.
*/
String nykthos = "Nykthos, Shrine to Nyx";
/*
Stronghold Assassin {1}{B}{B}
Creature Zombie Assassin 2/1
{T}, Sacrifice a creature: Destroy target nonblack creature.
*/
String sAssassin = "Stronghold Assassin";
/*
Graf Harvest {B}
Enchantment
Zombies you control have menace. (They can't be blocked except by two or more creatures.)
{3}{B}, Exile a creature card from your graveyard: Create a 2/2 black Zombie creature token.
*/
String gHarvest = "Graf Harvest";
/*
Erebos, God of the Dead {3}{B}
Legendary Enchantment Creature God 5/7
Indestructible
As long as your devotion to black is less than five, Erebos isn't a creature.
Your opponents can't gain life.
{1}{B}, Pay 2 life: Draw a card.
*/
String erebos = "Erebos, God of the Dead";
/*
Phyrexian Obliterator {B}{B}{B}{B}
Creature Horror
Trample
Whenever a source deals damage to Phyrexian Obliterator, that source's controller sacrifices that many permanents.
*/
String pObliterator = "Phyrexian Obliterator";
addCard(Zone.BATTLEFIELD, playerA, nykthos);
addCard(Zone.BATTLEFIELD, playerA, sAssassin);
addCard(Zone.BATTLEFIELD, playerA, gHarvest);
addCard(Zone.BATTLEFIELD, playerA, erebos);
addCard(Zone.BATTLEFIELD, playerA, "Wastes", 2); // two colorless to pay for nykthos
addCard(Zone.HAND, playerA, pObliterator); // just for something to cast for 4 black mana
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color.");
setChoice(playerA, "Black"); // should produce 4 black mana
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, pObliterator); // costs exactly 4 black mana should be castable
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertTappedCount("Wastes", true, 2);
assertTapped(nykthos, true);
// Assert.assertEquals("amount of black mana", 4, playerA.getManaPool().getBlack()); // should be 4 black mana
assertHandCount(playerA, pObliterator, 0);
assertPermanentCount(playerA, pObliterator, 1);
}
}

View file

@ -29,6 +29,7 @@ package org.mage.test.cards.mana;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -69,4 +70,63 @@ public class SpendManaAsThoughItWereManaOfAnyColorTest extends CardTestPlayerBas
}
/**
* Celestial Dawn does not allow spending of off-color mana for any purpose.
* Had a Black Market down, was trying to cast Darksteel Forge, could not
* spend the black mana on the forge.
*/
@Test
public void testCelestialDawn() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
// Lands you control are Plains.
// Nonland cards you own that aren't on the battlefield, spells you control, and nonland permanents you control are white.
// You may spend white mana as though it were mana of any color.
// You may spend other mana only as though it were colorless mana.
addCard(Zone.BATTLEFIELD, playerA, "Celestial Dawn", 1);
// Whenever a creature dies, put a charge counter on Black Market.
// At the beginning of your precombat main phase, add {B} to your mana pool for each charge counter on Black Market.
addCard(Zone.BATTLEFIELD, playerA, "Black Market", 1);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
// Artifacts you control are indestructible.
addCard(Zone.HAND, playerA, "Darksteel Forge", 1); // Artifact {9}
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
castSpell(1, PhaseStep.UPKEEP, playerB, "Lightning Bolt", "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Darksteel Forge");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
assertGraveyardCount(playerB, "Lightning Bolt", 1);
assertCounterCount("Black Market", CounterType.CHARGE, 1);
assertPermanentCount(playerA, "Darksteel Forge", 1);
}
@Test
public void testCelestialDawnAny() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
// Lands you control are Plains.
// Nonland cards you own that aren't on the battlefield, spells you control, and nonland permanents you control are white.
// You may spend white mana as though it were mana of any color.
// You may spend other mana only as though it were colorless mana.
addCard(Zone.BATTLEFIELD, playerA, "Celestial Dawn", 1);
addCard(Zone.HAND, playerA, "Vedalken Mastermind", 1); // Creature {U}{U}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vedalken Mastermind");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Vedalken Mastermind", 1);
}
}

View file

@ -95,4 +95,48 @@ public class DamageEffectsTest extends CardTestPlayerBase {
assertLife(playerA, 32);
}
@Test
public void vexingDevilFurnaceRathRedirectToPlaneswalker() {
/*
Vexing Devil {R}
Creature Devil
When Vexing Devil enters the battlefield, any opponent may have it deal 4 damage to him or her. If a player does, sacrifice Vexing Devil.
*/
String vDevil = "Vexing Devil";
/*
Nissa, Worldwaker {3}{G}{G}
Planeswalker Nissa
+1: Target land you control becomes a 4/4 Elemental creature with trample. It's still a land.
+1: Untap up to four target Forests.
7: Search your library for any number of basic land cards, put them onto the battlefield, then shuffle your library. Those lands become 4/4 Elemental creatures with trample. They're still lands.
*/
String nissa = "Nissa, Worldwaker";
/*
Furnace of Rath {1}{R}{R}{R}
Enchantment
If a source would deal damage to a creature or player, it deals double that damage to that creature or player instead.
*/
addCard(Zone.BATTLEFIELD, playerB, "Furnace of Rath");
addCard(Zone.HAND, playerB, vDevil);
addCard(Zone.HAND, playerA, nissa);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, nissa);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, vDevil);
setChoice(playerA, "Yes"); // deal 8 damage to playerA and sac vexing devil (8 due to furnace)
setChoice(playerB, "Yes"); // redirect to planeswalker
addTarget(playerB, nissa);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerB, vDevil, 1);
assertLife(playerA, 20);
assertGraveyardCount(playerA, nissa, 1);
}
}

View file

@ -52,7 +52,7 @@ public class DrawEffectsTest extends CardTestPlayerBase {
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute();
Assert.assertEquals("Player B has to have 4 cards in hand", 8, playerB.getHand().size());
Assert.assertEquals("Player B has to have 8 cards in hand", 8, playerB.getHand().size());
}

View file

@ -0,0 +1,142 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.replacement.entersBattlefield;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class HardenedScaleTest extends CardTestPlayerBase {
/*
Reported bug: Hangarback interaciton with Hardened Scales and Metallic Mimic on board is incorrect.
*/
@Test
public void hangarBackHardenedScalesMetallicMimicTest() {
/*
Hangarback Walker {X}{X}
Artifact Creature Construct 0/0
Hangarback Walker enters the battlefield with X +1/+1 counters on it.
When Hangarback Walker dies, create a 1/1 colorless Thopter artifact creature token with flying for each +1/+1 counter on Hangarback Walker.
{1}, {T}: Put a +1/+1 counter on Hangarback Walker.
*/
String hWalker = "Hangarback Walker";
/*
Hardened Scales {G}
Enchantment
If one or more +1/+1 counters would be placed on a creature you control, that many plus one +1/+1 counters are placed on it instead.
*/
String hScales = "Hardened Scales";
/*
Metallic Mimic {2}
Artifact Creature Shapeshifter 2/1
As Metallic Mimic enters the battlefield, choose a creature type.
Metallic Mimic is the chosen type in addition to its other types.
Each other creature you control of the chosen type enters the battlefield with an additional +1/+1 counter on it.
*/
String mMimic = "Metallic Mimic";
addCard(Zone.BATTLEFIELD, playerA, hScales);
addCard(Zone.HAND, playerA, mMimic);
addCard(Zone.HAND, playerA, hWalker);
addCard(Zone.BATTLEFIELD, playerA, "Wastes", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, mMimic);
setChoice(playerA, "Construct");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, hWalker);
setChoice(playerA, "X=1");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, mMimic, 1);
assertPermanentCount(playerA, hWalker, 1);
assertCounterCount(playerA, hWalker, CounterType.P1P1, 3);
assertPowerToughness(playerA, hWalker, 3, 3);
}
@Test
public void testWithVigorMortis() {
/*
Vigor Mortis {2}{B}{B}
Sorcery
Return target creature card from your graveyard to the battlefield. If {G} was spent to cast Vigor Mortis,
that creature enters the battlefield with an additional +1/+1 counter on it.
*/
String vMortis = "Vigor Mortis";
/*
Hardened Scales {G}
Enchantment
If one or more +1/+1 counters would be placed on a creature you control, that many plus one +1/+1 counters are placed on it instead.
*/
String hScales = "Hardened Scales";
/*
Metallic Mimic {2}
Artifact Creature Shapeshifter 2/1
As Metallic Mimic enters the battlefield, choose a creature type.
Metallic Mimic is the chosen type in addition to its other types.
Each other creature you control of the chosen type enters the battlefield with an additional +1/+1 counter on it.
*/
String mMimic = "Metallic Mimic";
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerA, hScales);
addCard(Zone.HAND, playerA, mMimic);
addCard(Zone.HAND, playerA, vMortis);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, mMimic);
setChoice(playerA, "Cat");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, vMortis, "Silvercoat Lion");
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, mMimic, 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertCounterCount(playerA, "Silvercoat Lion", CounterType.P1P1, 3);
assertPowerToughness(playerA, "Silvercoat Lion", 5, 5); // Hardened Scales is only once applied to EntersTheBattlefield event
assertGraveyardCount(playerA, vMortis, 1);
}
}

View file

@ -40,17 +40,18 @@ public class ChaliceOfTheVoidTest extends CardTestPlayerBase {
/**
* Theres a Chalice of the Void with 1 counter in play under my control.
* Then I cast second chalice with x=1. For spells on the stack the cmc is the base CMC + X value * {X} in casting costs on top right of card.
* So cmc should be 2 in this case, it shouldnt be countered.
* Then I cast second chalice with x=1. For spells on the stack the cmc is
* the base CMC + X value * {X} in casting costs on top right of card. So
* cmc should be 2 in this case, it shouldnt be countered.
* http://boardgames.stackexchange.com/questions/7327/what-is-the-converted-mana-cost-of-a-spell-with-x-when-cast-with-the-miracle-m
*/
@Test
public void testX1CountsFor2CMC() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
// Chalice of the Void enters the battlefield with X charge counters on it.
// Whenever a player casts a spell with converted mana cost equal to the number of charge counters on Chalice of the Void, counter that spell.
addCard(Zone.HAND, playerA, "Chalice of the Void", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chalice of the Void");
setChoice(playerA, "X=1");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chalice of the Void");
@ -62,10 +63,10 @@ public class ChaliceOfTheVoidTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Chalice of the Void", 2);
}
/*
If X=1 the cmc of Chalice on the stack is 2. So it can't be countered by Mental Misstep
*/
*/
@Test
public void testCantBeCounteredByMentalMisstep() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
@ -94,6 +95,8 @@ public class ChaliceOfTheVoidTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.HAND, playerA, "Chalice of the Void", 1);
// Conflagrate deals X damage divided as you choose among any number of target creatures and/or players.
// Flashback-{R}{R}, Discard X cards.
addCard(Zone.GRAVEYARD, playerB, "Conflagrate", 1);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
addCard(Zone.HAND, playerB, "Mountain", 1);
@ -101,7 +104,6 @@ public class ChaliceOfTheVoidTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chalice of the Void");
setChoice(playerA, "X=1");
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Flashback {R}{R}");
setChoice(playerB, "X=1");
addTarget(playerB, playerA);
@ -109,13 +111,12 @@ public class ChaliceOfTheVoidTest extends CardTestPlayerBase {
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 19);
assertLife(playerB, 20);
assertExileCount(playerB, "Conflagrate", 1);
//TODO: Apparently there are two mountains in the graveyard at the end of the test now.
//assertGraveyardCount(playerB, "Mountain", 1);
assertGraveyardCount(playerB, "Mountain", 1);
assertLife(playerA, 19);
assertLife(playerB, 20);
}
}

View file

@ -4,7 +4,6 @@
*/
package org.mage.test.cards.single.ths;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
@ -47,7 +46,7 @@ public class HeliodGodOfTheSun extends CardTestPlayerBase {
assertPermanentCount(playerA, "Hold the Gates", 1);
Permanent heliodGodOfTheSun = getPermanent("Heliod, God of the Sun", playerA);
Assert.assertTrue(heliodGodOfTheSun.getCardType().contains(CardType.CREATURE));
Assert.assertTrue(heliodGodOfTheSun.isCreature());
}

View file

@ -312,14 +312,14 @@ public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
/*
* playerA's Carnivorous Plant will get -1/-1 from Noxious Ghoul -> 3/4
* playerB's Carnivorous Plant will get -1/-1 from Noxious Ghoul -> 3/4
*/
*/
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Clone");
setChoice(playerA, "Noxious Ghoul");
/*
* playerA's Carnivorous Plant will get -1/-1 from Clone -> 2/3
* playerB's Carnivorous Plant will get -1/-1 from Clone -> 2/3
*/
*/
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ego Erasure", "targetPlayer=PlayerA", "Whenever");
/*
* playerA' Noxious Ghoul will get -2/0 -> 1/3
@ -328,7 +328,7 @@ public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
* playerA' Noxious Ghoul will get -1/-1 from itself -> -1/1
* playerA's Carnivorous Plant will get -1/-1 from Noxious Ghoul -> -1/2
* playerB's Carnivorous Plant will get -1/-1 from Noxious Ghoul -> 1/2
*/
*/
setStopAt(1, PhaseStep.END_TURN);
execute();
@ -341,21 +341,22 @@ public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
assertPowerToughness(playerB, "Carnivorous Plant", 1, 2);
assertPowerToughness(playerA, "Carnivorous Plant", -1, 2);
}
@Test
public void testHearthcageGiant() {
// {6}{R}{R} Creature Giant Warrior
//When Hearthcage Giant enters the battlefield, put two 3/1 red Elemental Shaman creature tokens onto the battlefield.
//Sacrifice an Elemental: Target Giant creature gets +3/+1 until end of turn.
addCard(Zone.HAND,playerA,"Hearthcage Giant");
addCard(Zone.HAND, playerA, "Hearthcage Giant");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Hearthcage Giant");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Hearthcage Giant", 1);
assertPermanentCount(playerA, "Elemental Shaman", 2);
assertPowerToughness(playerA, "Elemental Shaman", 3, 1);
}
}

View file

@ -70,4 +70,44 @@ public class EndStepTriggerTest extends CardTestPlayerBase {
assertCounterCount("Bloodchief Ascension", CounterType.QUEST, 2);
}
/**
* Hey, I don't know how to submit bugs but in a game I played today I
* sacrificed Child of Alara by casting Bound at the end step of my previous
* opponent's turn, then chose Child as one of the cards to return to my
* hand. My graveyard was empty so that was the only card I chose. Child
* returned to my hand but it did NOT trigger for some reason. Nothing was
* destroyed
*/
@Test
public void testSacrificeChildOfAlara() {
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); //Creature
// Trample
// When Child of Alara dies, destroy all nonland permanents. They can't be regenerated.
addCard(Zone.BATTLEFIELD, playerB, "Icy Manipulator", 1); //Creature
addCard(Zone.BATTLEFIELD, playerB, "Child of Alara", 1); //Creature
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
addCard(Zone.BATTLEFIELD, playerB, "Forest", 4);
// Bound
// Sacrifice a creature. Return up to X cards from your graveyard to your hand, where X is the number of colors that creature was. Exile this card.
// Determined
// Other spells you control can't be countered by spells or abilities this turn.
// Draw a card.
addCard(Zone.HAND, playerB, "Bound // Determined"); // Instant {3}{B}{G} // {G}{U}
castSpell(1, PhaseStep.END_TURN, playerB, "Bound");
addTarget(playerB, "Child of Alara");
setChoice(playerB, "Child of Alara");
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute();
assertExileCount(playerB, "Bound // Determined", 1);
assertHandCount(playerB, "Child of Alara", 1);
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
assertGraveyardCount(playerB, "Icy Manipulator", 1);
}
}

View file

@ -0,0 +1,37 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* Created by IGOUDT on 30-3-2017.
*/
public class KiraGreatGlassSpinnerTest extends CardTestPlayerBase {
private final String kira = "Kira, Great Glass-Spinner";
private final String shock = "Shock";
@Test
public void counterFirst(){
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
addCard(Zone.BATTLEFIELD, playerA, "Ugin, the Spirit Dragon"); // starts with 7 Loyality counters
addCard(Zone.BATTLEFIELD, playerA, kira);
addCard(Zone.HAND, playerA, shock);
addCard(Zone.HAND, playerA, shock);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+2: {source} deals 3 damage to target creature or player.", kira);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
Permanent _kira = getPermanent(kira, playerA.getId());
Assert.assertNotNull(_kira);
}
}

View file

@ -35,58 +35,55 @@ public class LoadCallbackClient implements CallbackClient {
log.info(callback.getMethod());
callback.setData(CompressUtil.decompress(callback.getData()));
switch (callback.getMethod()) {
case "startGame":
{
TableClientMessage message = (TableClientMessage) callback.getData();
gameId = message.getGameId();
playerId = message.getPlayerId();
session.joinGame(message.getGameId());
startControlThread();
break;
}
case "gameInform":
{
GameClientMessage message = (GameClientMessage) callback.getData();
log.info("Inform: " + message.getMessage());
gameView = message.getGameView();
break;
}
case "gameInit":
case START_GAME: {
TableClientMessage message = (TableClientMessage) callback.getData();
gameId = message.getGameId();
playerId = message.getPlayerId();
session.joinGame(message.getGameId());
startControlThread();
break;
case "gameTarget":
{
GameClientMessage message = (GameClientMessage) callback.getData();
log.info("Target: " + message.getMessage());
switch (message.getMessage()) {
case "Select a starting player":
session.sendPlayerUUID(gameId, playerId);
break;
case "Select a card to discard":
log.info("hand size: " + gameView.getHand().size());
SimpleCardView card = gameView.getHand().values().iterator().next();
session.sendPlayerUUID(gameId, card.getId());
break;
}
break;
}
case GAME_INFORM: {
GameClientMessage message = (GameClientMessage) callback.getData();
log.info("Inform: " + message.getMessage());
gameView = message.getGameView();
break;
}
case GAME_INIT:
break;
case GAME_TARGET: {
GameClientMessage message = (GameClientMessage) callback.getData();
log.info("Target: " + message.getMessage());
switch (message.getMessage()) {
case "Select a starting player":
session.sendPlayerUUID(gameId, playerId);
break;
case "Select a card to discard":
log.info("hand size: " + gameView.getHand().size());
SimpleCardView card = gameView.getHand().values().iterator().next();
session.sendPlayerUUID(gameId, card.getId());
break;
}
case "gameAsk":
{
GameClientMessage message = (GameClientMessage) callback.getData();
log.info("Ask: " + message.getMessage());
if (message.getMessage().equals("Do you want to take a mulligan?")) {
session.sendPlayerBoolean(gameId, false);
} break;
break;
}
case GAME_ASK: {
GameClientMessage message = (GameClientMessage) callback.getData();
log.info("Ask: " + message.getMessage());
if (message.getMessage().equals("Do you want to take a mulligan?")) {
session.sendPlayerBoolean(gameId, false);
}
case "gameSelect":
{
GameClientMessage message = (GameClientMessage) callback.getData();
log.info("Select: " + message.getMessage());
if (LoadPhaseManager.getInstance().isSkip(message.getGameView(), message.getMessage(), playerId)) {
log.info("Skipped: " + message.getMessage());
session.sendPlayerBoolean(gameId, false);
} break;
break;
}
case GAME_SELECT: {
GameClientMessage message = (GameClientMessage) callback.getData();
log.info("Select: " + message.getMessage());
if (LoadPhaseManager.getInstance().isSkip(message.getGameView(), message.getMessage(), playerId)) {
log.info("Skipped: " + message.getMessage());
session.sendPlayerBoolean(gameId, false);
}
case "gameOver":
break;
}
case GAME_OVER:
log.info("Game over");
gameOver = true;
break;

View file

@ -12,6 +12,7 @@ import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
import mage.game.match.MatchOptions;
import mage.player.ai.ComputerPlayer;
import mage.players.PlayerType;
import mage.remote.Connection;
import mage.remote.Session;
import mage.remote.SessionImpl;
@ -105,7 +106,7 @@ public class LoadTest {
TableView table = session.createTable(roomId, options);
if (!session.joinTable(roomId, table.getTableId(), TEST_USER_NAME + i, "Human", 1, deckList,"")) {
if (!session.joinTable(roomId, table.getTableId(), TEST_USER_NAME + i, PlayerType.HUMAN, 1, deckList,"")) {
log.error("Error while joining table");
Assert.fail("Error while joining table");
return;
@ -119,7 +120,7 @@ public class LoadTest {
UUID roomId2 = session2.getMainRoomId();
// connect to the table with the same deck
if (!session2.joinTable(roomId2, table.getTableId(), TEST_USER_NAME_2 + i, "Human", 1, deckList,"")) {
if (!session2.joinTable(roomId2, table.getTableId(), TEST_USER_NAME_2 + i, PlayerType.HUMAN, 1, deckList,"")) {
log.error("Error while joining table");
Assert.fail("Error while joining table");
return;
@ -177,7 +178,7 @@ public class LoadTest {
TableView table = session.createTable(roomId, options);
if (!session.joinTable(roomId, table.getTableId(), TEST_USER_NAME + i, "Human", 1, deckList,"")) {
if (!session.joinTable(roomId, table.getTableId(), TEST_USER_NAME + i, PlayerType.HUMAN, 1, deckList,"")) {
log.error("Error while joining table");
Assert.fail("Error while joining table");
return true;
@ -193,7 +194,7 @@ public class LoadTest {
UUID roomId2 = session2.getMainRoomId();
// connect to the table with the same deck
if (!session2.joinTable(roomId2, table.getTableId(), TEST_USER_NAME_2 + i, "Human", 1, deckList,"")) {
if (!session2.joinTable(roomId2, table.getTableId(), TEST_USER_NAME_2 + i, PlayerType.HUMAN, 1, deckList,"")) {
log.error("Error while joining table");
Assert.fail("Error while joining table");
return true;
@ -266,8 +267,8 @@ public class LoadTest {
private MatchOptions createGameOptions(GameTypeView gameTypeView, Session session) {
MatchOptions options = new MatchOptions("Test game", gameTypeView.getName(), false, 2);
options.getPlayerTypes().add("Human");
options.getPlayerTypes().add("Human");
options.getPlayerTypes().add(PlayerType.HUMAN);
options.getPlayerTypes().add(PlayerType.HUMAN);
options.setDeckType(session.getDeckTypes()[0]);
options.setLimited(false);

View file

@ -12,6 +12,7 @@ import mage.game.GameOptions;
import mage.game.TwoPlayerDuel;
import mage.player.ai.ComputerPlayer;
import mage.players.Player;
import mage.players.PlayerType;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.MageTestBase;
@ -34,7 +35,7 @@ public class PlayGameTest extends MageTestBase {
public void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException {
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, 0, 20);
Player computerA = createPlayer("ComputerA", "Computer - minimax hybrid");
Player computerA = createPlayer("ComputerA", PlayerType.COMPUTER_MINIMAX_HYBRID);
// Player playerA = createPlayer("ComputerA", "Computer - mad");
// Deck deck = Deck.load(Sets.loadDeck("RB Aggro.dck"));
Deck deck = generateRandomDeck();
@ -45,7 +46,7 @@ public class PlayGameTest extends MageTestBase {
game.addPlayer(computerA, deck);
game.loadCards(deck.getCards(), computerA.getId());
Player computerB = createPlayer("ComputerB", "Computer - minimax hybrid");
Player computerB = createPlayer("ComputerB", PlayerType.COMPUTER_MINIMAX_HYBRID);
// Player playerB = createPlayer("ComputerB", "Computer - mad");
// Deck deck2 = Deck.load(Sets.loadDeck("RB Aggro.dck"));
Deck deck2 = generateRandomDeck();

View file

@ -11,6 +11,7 @@ import mage.game.match.MatchType;
import mage.game.permanent.PermanentCard;
import mage.game.tournament.TournamentType;
import mage.players.Player;
import mage.players.PlayerType;
import mage.server.game.GameFactory;
import mage.server.game.PlayerFactory;
import mage.server.tournament.TournamentFactory;
@ -103,13 +104,13 @@ public abstract class MageTestBase {
deleteSavedGames();
ConfigSettings config = ConfigSettings.instance;
for (GamePlugin plugin : config.getGameTypes()) {
GameFactory.getInstance().addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin));
GameFactory.instance.addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin));
}
for (GamePlugin plugin : config.getTournamentTypes()) {
TournamentFactory.getInstance().addTournamentType(plugin.getName(), loadTournamentType(plugin), loadPlugin(plugin));
TournamentFactory.instance.addTournamentType(plugin.getName(), loadTournamentType(plugin), loadPlugin(plugin));
}
for (Plugin plugin : config.getPlayerTypes()) {
PlayerFactory.getInstance().addPlayerType(plugin.getName(), loadPlugin(plugin));
PlayerFactory.instance.addPlayerType(plugin.getName(), loadPlugin(plugin));
}
// for (Plugin plugin : config.getDeckTypes()) {
// DeckValidatorFactory.getInstance().addDeckType(plugin.getName(), loadPlugin(plugin));
@ -289,8 +290,8 @@ public abstract class MageTestBase {
}
}
protected Player createPlayer(String name, String playerType) {
Optional<Player> playerOptional = PlayerFactory.getInstance().createPlayer(playerType, name, RangeOfInfluence.ALL, 5);
protected Player createPlayer(String name, PlayerType playerType) {
Optional<Player> playerOptional = PlayerFactory.instance.createPlayer(playerType, name, RangeOfInfluence.ALL, 5);
return playerOptional.orElseThrow(() -> new NullPointerException("PlayerFactory error - player is not created"));
}

View file

@ -98,7 +98,7 @@ public abstract class MageTestPlayerBase {
deleteSavedGames();
ConfigSettings config = ConfigSettings.instance;
for (GamePlugin plugin : config.getGameTypes()) {
GameFactory.getInstance().addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin));
GameFactory.instance.addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin));
}
Copier.setLoader(classLoader);
}

View file

@ -27,10 +27,6 @@
*/
package org.mage.test.stub;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import mage.cards.ExpansionSet;
import mage.cards.decks.Deck;
import mage.game.draft.Draft;
@ -38,12 +34,14 @@ import mage.game.events.Listener;
import mage.game.events.PlayerQueryEvent;
import mage.game.events.TableEvent;
import mage.game.result.ResultProtos;
import mage.game.tournament.Round;
import mage.game.tournament.Tournament;
import mage.game.tournament.TournamentOptions;
import mage.game.tournament.TournamentPlayer;
import mage.game.tournament.TournamentType;
import mage.game.tournament.*;
import mage.players.Player;
import mage.players.PlayerType;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
*
@ -59,7 +57,7 @@ public class TournamentStub implements Tournament {
}
@Override
public void addPlayer(Player player, String playerType) {
public void addPlayer(Player player, PlayerType playerType) {
}