Test framework cleanup. Removed ai tests and scenarios. Migrated old tests.

This commit is contained in:
magenoxx 2012-08-15 22:06:30 +04:00
parent 82a13a3780
commit 7b268c7fcb
40 changed files with 166 additions and 1511 deletions

View file

@ -1,24 +0,0 @@
# Test playing Lightning Bolts (there was a bug with targeting players)
### ComputerA ###
# Battlefield
battlefield:ComputerA:Mountain:1
# Hand
hand:ComputerA:Mountain:2
hand:ComputerA:Lightning Bolt:5
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Lightning Bolt:10
### ComputerB ###
# Battlefield
battlefield:ComputerB:Plains:1
# Hand
hand:ComputerB:Plains:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Plains:10

View file

@ -1,36 +0,0 @@
# Reproduces game where AI didn't attack though could win
### ComputerA ###
# Battlefield
battlefield:ComputerA:Mountain:3
battlefield:ComputerA:Lavaclaw Reaches:2
battlefield:ComputerA:Dragonskull Summit:1
# Hand
hand:ComputerA:Searing Blaze:1
hand:ComputerA:Lavaclaw Reaches:1
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Mountain:10
# Life
player:ComputerA:life:3
### ComputerB ###
# Battlefield
battlefield:ComputerB:Mountain:4:{tapped}
battlefield:ComputerB:Dragonskull Summit:1:{tapped}
battlefield:ComputerB:Arid Mesa:1:{tapped}
battlefield:ComputerB:Lavaclaw Reaches:1:{tapped}
# Hand
hand:ComputerB:Ball Lightning:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Lightning Bolt:10
library:ComputerB:Mountain:1
# Life
player:ComputerB:life:1

View file

@ -1,26 +0,0 @@
# Test attacking with Hellspark Elemental
### ComputerA ###
# Battlefield
battlefield:ComputerA:Island:2
battlefield:ComputerA:Mountain:2
# Hand
hand:ComputerA:Mountain:0
hand:ComputerA:Hellspark Elemental:5
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Hellspark Elemental:10
### ComputerB ###
# Battlefield
battlefield:ComputerB:Plains:1
# Hand
hand:ComputerB:Plains:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Plains:10
# Life
player:ComputerB:life:2

View file

@ -1,23 +0,0 @@
# Test playing Blightning
### ComputerA ###
# Battlefield
battlefield:ComputerA:Swamp:1
battlefield:ComputerA:Mountain:2
# Hand
hand:ComputerA:Blightning:5
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Blightning:15
### ComputerB ###
# Battlefield
battlefield:ComputerB:Plains:1
# Hand
hand:ComputerB:Plains:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Plains:10

View file

@ -1,30 +0,0 @@
# Test playing Earthquake that kills opponent but not AI
### ComputerA ###
# Battlefield
battlefield:ComputerA:Island:2
battlefield:ComputerA:Mountain:3
battlefield:ComputerA:Dragonskull Summit:1
battlefield:ComputerA:Lavaclaw Reaches:0
# Hand
hand:ComputerA:Mountain:0
hand:ComputerA:Earthquake:1
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Mountain:15
# Life
player:ComputerA:life:5
### ComputerB ###
# Battlefield
battlefield:ComputerB:Plains:1
# Hand
hand:ComputerB:Plains:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Plains:10
# Life
player:ComputerB:life:4

View file

@ -1,29 +0,0 @@
# Test killing with Lavaclaw Reaches with X: +1\+0 ability
### ComputerA ###
# Battlefield
battlefield:ComputerA:Island:2
battlefield:ComputerA:Mountain:3
battlefield:ComputerA:Dragonskull Summit:1
battlefield:ComputerA:Lavaclaw Reaches:1
# Hand
hand:ComputerA:Mountain:1
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Mountain:15
# Life
player:ComputerA:life:5
### ComputerB ###
# Battlefield
battlefield:ComputerB:Plains:1
# Hand
hand:ComputerB:Plains:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Plains:10
# Life
player:ComputerB:life:5

View file

@ -1,33 +0,0 @@
# Test bug with no action from AI
### ComputerA ###
# Battlefield
battlefield:ComputerA:Mountain:2
battlefield:ComputerA:Lavaclaw Reaches:1
# Hand
hand:ComputerA:Burst Lightning:1
hand:ComputerA:Searing Blaze:3
hand:ComputerA:Hellspark Elemental:1
hand:ComputerA:Ball Lightning:1
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Burst Lightning:15
# Life
player:ComputerA:life:8
### ComputerB ###
# Battlefield
battlefield:ComputerB:Plains:1
battlefield:ComputerB:Lavaclaw Reaches:1
battlefield:ComputerB:Scalding Tarn:3
battlefield:ComputerB:Dragonskull Summit:1
# Hand
hand:ComputerB:Plains:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Plains:10
# Life
player:ComputerB:life:2

View file

@ -1,36 +0,0 @@
# This scenario makes AI frozen
### ComputerA ###
# Battlefield
battlefield:ComputerA:Mountain:3
battlefield:ComputerA:Lavaclaw Reaches:2
battlefield:ComputerA:Dragonskull Summit:1
# Hand
hand:ComputerA:Searing Blaze:1
hand:ComputerA:Lavaclaw Reaches:1
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Mountain:10
# Life
player:ComputerA:life:3
### ComputerB ###
# Battlefield
battlefield:ComputerB:Mountain:4
battlefield:ComputerB:Dragonskull Summit:1
battlefield:ComputerB:Arid Mesa:1
battlefield:ComputerB:Lavaclaw Reaches:1
# Hand
hand:ComputerB:Ball Lightning:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Lightning Bolt:10
library:ComputerB:Mountain:1
# Life
player:ComputerB:life:1

View file

@ -1,50 +0,0 @@
package org.mage.test.ai;
import junit.framework.Assert;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* Make sure AI uses equip ability once.
*
* @author ayratn
*/
public class EquipAbilityTest extends CardTestBase {
@Test
@Ignore
public void testLevelUpAbilityUsage() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Steel Wall");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Blade of the Bloodchief");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Blazing Torch");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 2);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Sacred Foundry", 1);
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
Permanent wall = getPermanent("Steel Wall", playerA.getId());
Assert.assertNotNull(wall);
Assert.assertEquals("Not equipped", 2, wall.getAttachments().size());
int count = 0;
int tapped = 0;
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {
if (permanent.getControllerId().equals(playerA.getId())) {
if (permanent.getCardType().contains(Constants.CardType.LAND)) {
count++;
if (permanent.isTapped()) {
tapped++;
}
}
}
}
Assert.assertEquals(6, count);
Assert.assertEquals(2, tapped);
}
}

View file

@ -1,56 +0,0 @@
package org.mage.test.ai;
import junit.framework.Assert;
import mage.Constants;
import mage.counters.CounterType;
import mage.game.permanent.Permanent;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* @author ayratn
*/
public class NimShamblerTest extends CardTestBase {
/**
* Reproduces the bug when AI sacrifices its creatures for no reason.
*/
@Test
@Ignore
public void testNoCreatureWasSacrificed() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Nim Shambler");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Blood Cultist");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Craw Wurm");
execute();
Permanent nimShambler = getPermanent("Nim Shambler", playerA.getId());
Assert.assertNotNull(nimShambler);
Permanent bloodCultist = getPermanent("Blood Cultist", playerA.getId());
Assert.assertNotNull(bloodCultist);
Assert.assertFalse(bloodCultist.isTapped()); // shouldn't be tapped
}
@Test
@Ignore
public void testAttackAndKillBlockerWithAdditionalDamage() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Nim Shambler");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Blood Cultist");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Ob Nixilis, the Fallen");
execute();
// should die in attack
assertPermanentCount(playerA, "Nim Shambler", 0);
// should die because of attack + 1 damage from Blood Cultist
assertPermanentCount(playerA, "Ob Nixilis, the Fallen", 0);
// Blood Cultist should kill Ob Nixilis, the Fallen and get +1\+1
Permanent bloodCultist = getPermanent("Blood Cultist", playerA.getId());
Assert.assertNotNull(bloodCultist);
Assert.assertEquals(1, bloodCultist.getCounters().size());
Assert.assertEquals(1, bloodCultist.getCounters().getCount(CounterType.P1P1));
}
}

View file

@ -1,35 +0,0 @@
package org.mage.test.ai;
import junit.framework.Assert;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* @author ayratn
*/
public class ObNixilistheFallenTest extends CardTestBase {
/**
* Reproduces bug when AI doesn't use good "may" ability.
*/
@Test
@Ignore
public void testMayAbilityUsed() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Ob Nixilis, the Fallen");
addCard(Constants.Zone.HAND, playerA, "Swamp", 1);
playLand(playerA, "Swamp");
execute();
Permanent master = getPermanent("Ob Nixilis, the Fallen", playerA.getId());
Assert.assertNotNull(master);
Assert.assertEquals(6, master.getPower().getValue());
Assert.assertEquals(6, master.getToughness().getValue());
assertLife(playerA, 20);
assertLife(playerB, 11); // lose 3 life + attack with 6\6
}
}

View file

@ -1,52 +0,0 @@
package org.mage.test.ai;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* Make sure AI uses regenerate ability once.
*
* @author ayratn
*/
public class RegenerateAbilityTest extends CardTestBase {
@Test
@Ignore
public void testRegenerateUsage() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Quicksilver Gargantuan", 1);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Thousand-legged Kami", 1);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 6);
addCard(Constants.Zone.BATTLEFIELD, playerB, "Slith Bloodletter");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Swamp", 4);
addCard(Constants.Zone.BATTLEFIELD, playerB, "Drowned Catacomb", 1);
addCard(Constants.Zone.BATTLEFIELD, playerB, "Crumbling Necropolis", 1);
addCard(Constants.Zone.BATTLEFIELD, playerB, "Llanowar Wastes", 1);
execute();
Permanent slith = getPermanent("Slith Bloodletter", playerB.getId());
Assert.assertNotNull("Should be alive because of Regenerate ability", slith);
int count = 0;
int tapped = 0;
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {
if (permanent.getControllerId().equals(playerB.getId())) {
if (permanent.getCardType().contains(Constants.CardType.LAND)) {
count++;
if (permanent.isTapped()) {
tapped++;
}
}
}
}
Assert.assertEquals(7, count);
Assert.assertEquals(2, tapped);
// should block 7/7 (Quicksilver Gargantuan) and allow 6/6 (Thousand-legged Kami) to attack
assertLife(playerB, 14);
}
}

View file

@ -1,26 +0,0 @@
package org.mage.test.ai;
import junit.framework.Assert;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* @author ayratn
*/
public class SphinxOfJwarIsleTest extends CardTestBase {
/**
* Issue 381: AI Sphinx of Jwar Isle Loop
*
* AI will continuously loop using Sphinx's 'look at top card' ability.
* version: 0.8.1
*
* Doesn't reproduce.
*/
@Test
public void testInfiniteLoopBug() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Sphinx of Jwar Isle");
execute();
}
}

View file

@ -1,23 +0,0 @@
package org.mage.test.ai.bugs;
import junit.framework.Assert;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
public class BugCantFindCardInLibrary extends CardTestBase {
@Test
@Ignore
public void testWithSquadronHawk() {
addCard(Constants.Zone.HAND, playerA, "Squadron Hawk");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains");
execute();
Permanent merfolk = getPermanent("Squadron Hawk", playerA.getId());
Assert.assertNotNull(merfolk);
}
}

View file

@ -1,42 +0,0 @@
package org.mage.test.ai.bugs;
import mage.Constants;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* Reproduces bug when AI didn't attack with one of the creatures.
*
* @author ayratn
*/
public class BugDoesntAttackTest extends CardTestBase {
@Test
@Ignore
public void testAttackWithZephyrSprite() throws Exception {
addCard(Constants.Zone.HAND, playerA, "Zephyr Sprite");
addCard(Constants.Zone.HAND, playerA, "Island");
addCard(Constants.Zone.HAND, playerA, "Rupture Spire");
setLife(playerB, 1);
setStopOnTurn(4);
execute();
assertLife(playerB, 0);
}
@Test
@Ignore
public void testAttackWithGoblinGuide() throws Exception {
addCard(Constants.Zone.HAND, playerA, "Goblin Guide");
addCard(Constants.Zone.HAND, playerA, "Mountain");
playLand(playerA, "Mountain");
castSpell(playerA, "Goblin Guide");
execute();
assertLife(playerB, 18);
}
}

View file

@ -1,33 +0,0 @@
package org.mage.test.ai.bugs;
import junit.framework.Assert;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* Should reproduce the bug with AI tapping itself with Blinding Mage.
* But it doesn't ^(
*
* @ayratn
*/
public class BugTapsItselfTest extends CardTestBase {
@Test
@Ignore
public void testVersusInfectCreature() throws Exception {
useWhiteDefault();
addCard(Constants.Zone.BATTLEFIELD, playerA, "Blinding Mage");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Myr Sire");
setStopOnTurn(4);
execute();
assertResult(playerA, GameResult.DRAW);
Permanent permanent = getPermanent("Blinding Mage", playerA.getId());
Assert.assertFalse("Should have been untapped", permanent.isTapped());
}
}

View file

@ -1,47 +0,0 @@
package org.mage.test.ai.bugs;
import org.mage.test.cards.*;
import mage.Constants;
import mage.Constants.PhaseStep;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class TestHavengulLich extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.GRAVEYARD, playerA, "Gravecrawler");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Black Cat");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Gravecrawler");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Gravecrawler", 1);
assertGraveyardCount(playerA, 0);
}
@Test
public void testCard1() {
addCard(Constants.Zone.GRAVEYARD, playerA, "Gravecrawler");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Gravecrawler");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Gravecrawler", 0);
assertGraveyardCount(playerA, 1);
}
}

View file

@ -2,12 +2,12 @@ package org.mage.test.cards.abilities.oneshot.damage;
import mage.Constants; import mage.Constants;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* @author Loki * @author Loki
*/ */
public class PsionicBlastTest extends CardTestBase { public class PsionicBlastTest extends CardTestPlayerBase {
@Test @Test
public void testDamageInPlayer() { public void testDamageInPlayer() {
@ -16,7 +16,7 @@ public class PsionicBlastTest extends CardTestBase {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island"); addCard(Constants.Zone.BATTLEFIELD, playerA, "Island");
addCard(Constants.Zone.HAND, playerA, "Psionic Blast"); addCard(Constants.Zone.HAND, playerA, "Psionic Blast");
castSpell(playerA, "Psionic Blast"); castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA ,"Psionic Blast");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT); setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute(); execute();

View file

@ -3,9 +3,9 @@ package org.mage.test.cards.abilities.oneshot.destroy;
import mage.Constants; import mage.Constants;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase; import org.mage.test.serverside.base.CardTestPlayerBase;
public class HideousEndTest extends CardTestBase { public class HideousEndTest extends CardTestPlayerBase {
@Test @Test
public void testWithValidTarget() { public void testWithValidTarget() {
@ -15,11 +15,11 @@ public class HideousEndTest extends CardTestBase {
addCard(Constants.Zone.HAND, playerA, "Hideous End"); addCard(Constants.Zone.HAND, playerA, "Hideous End");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Copper Myr"); addCard(Constants.Zone.BATTLEFIELD, playerB, "Copper Myr");
castSpell(playerA, "Hideous End"); castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Hideous End", "Copper Myr");
addFixedTarget(playerA, "Hideous End", "Copper Myr");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT); setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertPermanentCount(playerB, "Copper Myr", 0); assertPermanentCount(playerB, "Copper Myr", 0);
assertLife(playerB, 18); assertLife(playerB, 18);
} }
@ -32,11 +32,11 @@ public class HideousEndTest extends CardTestBase {
addCard(Constants.Zone.HAND, playerA, "Hideous End"); addCard(Constants.Zone.HAND, playerA, "Hideous End");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Zombie Goliath"); addCard(Constants.Zone.BATTLEFIELD, playerB, "Zombie Goliath");
castSpell(playerA, "Hideous End"); castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Hideous End", "Zombie Goliath");
addFixedTarget(playerA, "Hideous End", "Zombie Goliath");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT); setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertPermanentCount(playerB, "Zombie Goliath", 1); assertPermanentCount(playerB, "Zombie Goliath", 1);
assertLife(playerB, 20); assertLife(playerB, 20);
} }
@ -53,11 +53,11 @@ public class HideousEndTest extends CardTestBase {
addCard(Constants.Zone.BATTLEFIELD, playerB, "Copper Myr"); addCard(Constants.Zone.BATTLEFIELD, playerB, "Copper Myr");
addCard(Constants.Zone.HAND, playerB, "Apostle's Blessing"); addCard(Constants.Zone.HAND, playerB, "Apostle's Blessing");
castSpell(playerA, "Hideous End"); castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Hideous End", "Copper Myr");
addFixedTarget(playerA, "Hideous End", "Copper Myr");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT); setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertPermanentCount(playerB, "Copper Myr", 1); assertPermanentCount(playerB, "Copper Myr", 1);
assertLife(playerB, 20); assertLife(playerB, 20);
} }

View file

@ -2,12 +2,12 @@ package org.mage.test.cards.abilities.oneshot.destroy;
import mage.Constants; import mage.Constants;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* @author Loki * @author Loki
*/ */
public class LeaveNoTraceTest extends CardTestBase { public class LeaveNoTraceTest extends CardTestPlayerBase {
@Test @Test
public void testDestroy() { public void testDestroy() {
@ -19,8 +19,7 @@ public class LeaveNoTraceTest extends CardTestBase {
addCard(Constants.Zone.BATTLEFIELD, playerB, "Awakening Zone"); // Green addCard(Constants.Zone.BATTLEFIELD, playerB, "Awakening Zone"); // Green
addCard(Constants.Zone.BATTLEFIELD, playerB, "Back from the Brink"); // Blue addCard(Constants.Zone.BATTLEFIELD, playerB, "Back from the Brink"); // Blue
castSpell(playerA, "Leave No Trace"); castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Leave No Trace", "Asceticism");
addFixedTarget(playerA, "Leave No Trace", "Asceticism");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT); setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute(); execute();

View file

@ -2,16 +2,14 @@ package org.mage.test.cards.filters;
import junit.framework.Assert; import junit.framework.Assert;
import mage.Constants; import mage.Constants;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* @author ayrat * @author ayrat
*/ */
public class OneEyedScarecrowTest extends CardTestBase { public class OneEyedScarecrowTest extends CardTestPlayerBase {
@Test @Test
public void testBoost() { public void testBoost() {

View file

@ -1,76 +0,0 @@
package org.mage.test.cards.single;
import mage.Constants;
import mage.filter.Filter;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestAPI;
import org.mage.test.serverside.base.CardTestBase;
/**
* First JUnit tests for Mage card.
*
* @ayratn
*/
@Ignore
public class BurntheImpureTest extends CardTestBase {
/**
* Reproduces the test written in MBS/Burn the Impure.test
*
* Actually it can be tested with one java line that loads all test metadata from text file:
* load("MBS/Burn the Impure.test");
*
* But it was decided to use java code only.
*
* @throws Exception
*/
@Test
public void testVersusInfectCreature() throws Exception {
// $include red.default
useRedDefault();
// hand:ComputerA:Burn the Impure:1
addCard(Constants.Zone.HAND, playerA, "Burn the Impure");
// battlefield:ComputerB:Tine Shrike:1
addCard(Constants.Zone.BATTLEFIELD, playerB, "Tine Shrike");
// player:ComputerB:life:3
setLife(playerB, 3);
setStopOnTurn(2);
execute();
// turn:1
assertTurn(1);
// result:won
assertResult(playerA, CardTestAPI.GameResult.WON);
// life:ComputerA:20
assertLife(playerA, 20);
// life:ComputerB:0
assertLife(playerB, 0);
// assert Tine Shrike has been killed
assertPermanentCount(playerB, "Tine Shrike", 0);
}
/**
* load("MBS/Burn the Impure - no infect.test");
* @throws Exception
*/
@Test
public void testVersusNonInfectCreature() throws Exception {
useRedDefault();
addCard(Constants.Zone.HAND, playerA, "Burn the Impure");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Runeclaw Bear", 3);
setLife(playerB, 3);
setStopOnTurn(2);
execute();
assertTurn(2);
assertResult(playerA, CardTestAPI.GameResult.DRAW);
assertLife(playerA, 20);
assertLife(playerB, 3);
assertPermanentCount(playerB, "Runeclaw Bear", 2);
assertPowerToughness(playerB, "Runeclaw Bear", 2, 2, Filter.ComparisonScope.Any);
assertPowerToughness(playerB, "Runeclaw Bear", 2, 2, Filter.ComparisonScope.All);
}
}

View file

@ -1,45 +0,0 @@
package org.mage.test.cards.triggers;
import mage.Constants;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* @author ayratn
*
* Card: Whenever a player taps a land for mana, Manabarbs deals 1 damage to that player.
*/
public class ManabarbsTest extends CardTestBase {
/**
* Issue 374: manabarb enchantment
* Games goes into a freeze loop.
*
* version: 0.8.1
*
* Couldn't reproduce.
*/
@Test
@Ignore
public void testMultiTriggers() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Manabarbs");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 7);
addCard(Constants.Zone.HAND, playerA, "Lightning Elemental");
addCard(Constants.Zone.HAND, playerA, "Ball Lightning");
castSpell(playerA, "Ball Lightning");
castSpell(playerA, "Lightning Elemental");
attack(playerA, "Ball Lightning");
attack(playerA, "Lightning Elemental");
playerA.setAllowBadMoves(true);
setStopAt(2, Constants.PhaseStep.UNTAP);
execute();
assertLife(playerA, 13); // burns from Manabarbs
assertLife(playerB, 10); // ai should attack with 4/1 + 6/1
assertPermanentCount(playerA, "Lightning Elemental", 1);
assertPermanentCount(playerA, "Ball Lightning", 0); // sacrificed at EOT
}
}

View file

@ -1,36 +0,0 @@
package org.mage.test.cards.triggers;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* @author ayratn
*
* Card: When Mausoleum Guard dies, put two 1/1 white Spirit creature tokens with flying onto the battlefield.
*/
public class MausoleumGuardTest extends CardTestBase {
/**
* Issue 350: Mausoleum Guard
* Destroyed a mausoleum guard, was supposed to get two 1/1 fliers when it dies. None of them were created.
*
* version: 0.8.1
*/
@Test
public void testTokensAppeared() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mausoleum Guard");
castSpell(playerA, "Lightning Bolt");
addFixedTarget(playerA, "Lightning Bolt", "Mausoleum Guard");
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerB, "Mausoleum Guard", 0);
assertPermanentCount(playerA, "Spirit", 0);
assertPermanentCount(playerB, "Spirit", 2);
}
}

View file

@ -1,12 +1,13 @@
package org.mage.test.serverside.base; package org.mage.test.serverside.base;
import mage.Constants; import mage.Constants;
import mage.Constants.PhaseStep;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.filter.Filter; import mage.filter.Filter;
import mage.players.Player; import mage.players.Player;
import org.mage.test.player.TestPlayer;
import java.util.List; import java.util.List;
import mage.Constants.PhaseStep;
/** /**
* Interface for all test initialization and assertion operations. * Interface for all test initialization and assertion operations.
@ -35,7 +36,7 @@ public interface CardTestAPI {
* *
* @param player {@link Player} to remove all library cards from. * @param player {@link Player} to remove all library cards from.
*/ */
void removeAllCardsFromLibrary(Player player); void removeAllCardsFromLibrary(TestPlayer player);
/** /**
* Add a card to specified zone of specified player. * Add a card to specified zone of specified player.
@ -44,7 +45,7 @@ public interface CardTestAPI {
* @param player {@link Player} to add cards for. Use either playerA or playerB. * @param player {@link Player} to add cards for. Use either playerA or playerB.
* @param cardName Card name in string format. * @param cardName Card name in string format.
*/ */
void addCard(Constants.Zone gameZone, Player player, String cardName); void addCard(Constants.Zone gameZone, TestPlayer player, String cardName);
/** /**
* Add any amount of cards to specified zone of specified player. * Add any amount of cards to specified zone of specified player.
@ -54,7 +55,7 @@ public interface CardTestAPI {
* @param cardName Card name in string format. * @param cardName Card name in string format.
* @param count Amount of cards to be added. * @param count Amount of cards to be added.
*/ */
void addCard(Constants.Zone gameZone, Player player, String cardName, int count); void addCard(Constants.Zone gameZone, TestPlayer player, String cardName, int count);
/** /**
* Add any amount of cards to specified zone of specified player. * Add any amount of cards to specified zone of specified player.
@ -66,7 +67,7 @@ public interface CardTestAPI {
* @param tapped In case gameZone is Battlefield, determines whether permanent should be tapped. * @param tapped In case gameZone is Battlefield, determines whether permanent should be tapped.
* In case gameZone is other than Battlefield, {@link IllegalArgumentException} is thrown * In case gameZone is other than Battlefield, {@link IllegalArgumentException} is thrown
*/ */
void addCard(Constants.Zone gameZone, Player player, String cardName, int count, boolean tapped); void addCard(Constants.Zone gameZone, TestPlayer player, String cardName, int count, boolean tapped);
/** /**
* Set player's initial life count. * Set player's initial life count.
@ -74,7 +75,7 @@ public interface CardTestAPI {
* @param player {@link Player} to set life count for. * @param player {@link Player} to set life count for.
* @param life Life count to set. * @param life Life count to set.
*/ */
void setLife(Player player, int life); void setLife(TestPlayer player, int life);
//******* GAME OPTIONS *******/ //******* GAME OPTIONS *******/

View file

@ -1,347 +0,0 @@
package org.mage.test.serverside.base;
import java.io.File;
import java.io.FileNotFoundException;
import mage.Constants;
import mage.Constants.PhaseStep;
import mage.cards.Card;
import mage.cards.decks.Deck;
import mage.cards.decks.importer.DeckImporterUtil;
import mage.filter.Filter;
import mage.game.Game;
import mage.game.GameException;
import mage.game.GameOptions;
import mage.game.TwoPlayerDuel;
import mage.game.permanent.Permanent;
import mage.players.Player;
import org.junit.Assert;
import org.junit.Before;
import org.mage.test.serverside.base.impl.CardTestAPIImpl;
/**
* Base class for testing single cards and effects.
*
* @author ayratn
*/
public abstract class CardTestBase extends CardTestAPIImpl {
protected enum AIType {
MinimaxHybrid,
MAD,
MonteCarlo
}
protected enum ExpectedType {
TURN_NUMBER,
RESULT,
LIFE,
BATTLEFIELD,
GRAVEYARD,
UNKNOWN
}
/**
* Computer types used to test cards.
* By default: MAD.
*/
private AIType aiTypeA, aiTypeB;
public CardTestBase() {
aiTypeA = AIType.MAD;
aiTypeB = AIType.MAD;
}
public CardTestBase(AIType aiTypeA, AIType aiTypeB) {
this.aiTypeA = aiTypeA;
this.aiTypeB = aiTypeB;
}
protected Player createNewPlayer(String playerName, AIType aiType) {
Player player = null;
switch (aiType) {
case MinimaxHybrid:
player = createPlayer(playerName, "Computer - minimax hybrid");
break;
case MAD:
player = createPlayer(playerName, "Computer - mad");
break;
case MonteCarlo:
player = createPlayer(playerName, "Computer - monte carlo");
break;
}
return player;
}
@Before
public void reset() throws GameException, FileNotFoundException {
if (currentGame != null) {
logger.info("Resetting previous game and creating new one!");
currentGame = null;
System.gc();
}
Game game = new TwoPlayerDuel(Constants.MultiplayerAttackOption.LEFT, Constants.RangeOfInfluence.ALL);
playerA = createNewPlayer("PlayerA", aiTypeA);
playerA.setTestMode(true);
logger.info("Loading deck...");
Deck deck = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck"));
logger.info("Done!");
if (deck.getCards().size() < 40) {
throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck.getCards().size());
}
game.addPlayer(playerA, deck);
game.loadCards(deck.getCards(), playerA.getId());
playerB = createNewPlayer("PlayerB", aiTypeB);
playerB.setTestMode(true);
Deck deck2 = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck"));
if (deck2.getCards().size() < 40) {
throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck2.getCards().size());
}
game.addPlayer(playerB, deck2);
game.loadCards(deck2.getCards(), playerB.getId());
activePlayer = playerA;
currentGame = game;
stopOnTurn = 2;
stopAtStep = PhaseStep.UNTAP;
handCardsA.clear();
handCardsB.clear();
battlefieldCardsA.clear();
battlefieldCardsB.clear();
graveyardCardsA.clear();
graveyardCardsB.clear();
libraryCardsA.clear();
libraryCardsB.clear();
commandsA.clear();
commandsB.clear();
}
public void load(String path) throws FileNotFoundException, GameException {
load(path, AIType.MAD, AIType.MAD);
}
public void load(String path, AIType aiTypeA, AIType aiTypeB) throws FileNotFoundException, GameException {
String cardPath = TESTS_PATH + path;
File checkFile = new File(cardPath);
if (!checkFile.exists()) {
throw new FileNotFoundException("Couldn't find test file: " + cardPath);
}
if (checkFile.isDirectory()) {
throw new FileNotFoundException("Couldn't find test file: " + cardPath + ". It is directory.");
}
if (currentGame != null) {
logger.info("Resetting previous game and creating new one!");
currentGame = null;
System.gc();
}
Game game = new TwoPlayerDuel(Constants.MultiplayerAttackOption.LEFT, Constants.RangeOfInfluence.ALL);
playerA = createNewPlayer("ComputerA", aiTypeA);
playerA.setTestMode(true);
Deck deck = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck"));
if (deck.getCards().size() < 40) {
throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck.getCards().size());
}
game.addPlayer(playerA, deck);
game.loadCards(deck.getCards(), playerA.getId());
playerB = createNewPlayer("ComputerB", aiTypeB);
playerB.setTestMode(true);
Deck deck2 = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck"));
if (deck2.getCards().size() < 40) {
throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck2.getCards().size());
}
game.addPlayer(playerB, deck2);
game.loadCards(deck2.getCards(), playerB.getId());
parseScenario(cardPath);
activePlayer = playerA;
currentGame = game;
}
/**
* Starts testing card by starting current game.
*
* @throws IllegalStateException In case game wasn't created previously. Use {@link #load} method to initialize the game.
*/
public void execute() throws IllegalStateException {
if (currentGame == null || activePlayer == null) {
throw new IllegalStateException("Game is not initialized. Use load method to load a test case and initialize a game.");
}
currentGame.cheat(playerA.getId(), commandsA);
currentGame.cheat(playerA.getId(), libraryCardsA, handCardsA, battlefieldCardsA, graveyardCardsA);
currentGame.cheat(playerB.getId(), commandsB);
currentGame.cheat(playerB.getId(), libraryCardsB, handCardsB, battlefieldCardsB, graveyardCardsB);
boolean testMode = true;
long t1 = System.nanoTime();
GameOptions gameOptions = new GameOptions();
gameOptions.testMode = true;
gameOptions.stopOnTurn = stopOnTurn;
gameOptions.stopAtStep = stopAtStep;
currentGame.start(activePlayer.getId(), gameOptions);
long t2 = System.nanoTime();
logger.info("Winner: " + currentGame.getWinner());
logger.info("Time: " + (t2 - t1) / 1000000 + " ms");
assertTheResults();
}
/**
* Assert expected and actual results.
*/
private void assertTheResults() {
logger.info("Matching expected results:");
for (String line : expectedResults) {
boolean ok = false;
try {
ExpectedType type = getExpectedType(line);
if (type.equals(CardTestBase.ExpectedType.UNKNOWN)) {
throw new AssertionError("Unknown expected type, check the line in $expected section=" + line);
}
parseType(type, line);
ok = true;
} finally {
logger.info(" " + line + " - " + (ok ? "OK" : "ERROR"));
}
}
}
private ExpectedType getExpectedType(String line) {
if (line.startsWith("turn:")) {
return CardTestBase.ExpectedType.TURN_NUMBER;
}
if (line.startsWith("result:")) {
return CardTestBase.ExpectedType.RESULT;
}
if (line.startsWith("life:")) {
return CardTestBase.ExpectedType.LIFE;
}
if (line.startsWith("battlefield:")) {
return CardTestBase.ExpectedType.BATTLEFIELD;
}
if (line.startsWith("graveyard:")) {
return CardTestBase.ExpectedType.GRAVEYARD;
}
return CardTestBase.ExpectedType.UNKNOWN;
}
private void parseType(ExpectedType type, String line) {
if (type.equals(CardTestBase.ExpectedType.TURN_NUMBER)) {
int turn = getIntParam(line, 1);
Assert.assertEquals("Turn numbers are not equal", turn, currentGame.getTurnNum());
return;
}
if (type.equals(CardTestBase.ExpectedType.RESULT)) {
String expected = getStringParam(line, 1);
String actual = "draw";
if (currentGame.getWinner().equals("Player ComputerA is the winner")) {
actual = "won";
} else if (currentGame.getWinner().equals("Player ComputerB is the winner")) {
actual = "lost";
}
Assert.assertEquals("Game results are not equal", expected, actual);
return;
}
if (type.equals(CardTestBase.ExpectedType.LIFE)) {
String player = getStringParam(line, 1);
int expected = getIntParam(line, 2);
if (player.equals("ComputerA")) {
int actual = currentGame.getPlayer(playerA.getId()).getLife();
Assert.assertEquals("Life amounts are not equal", expected, actual);
} else if (player.equals("ComputerB")) {
int actual = currentGame.getPlayer(playerB.getId()).getLife();
Assert.assertEquals("Life amounts are not equal", expected, actual);
} else {
throw new IllegalArgumentException("Wrong player in 'life' line, player=" + player + ", line=" + line);
}
return;
}
if (type.equals(CardTestBase.ExpectedType.BATTLEFIELD)) {
String playerName = getStringParam(line, 1);
String cardName = getStringParam(line, 2);
int expectedCount = getIntParam(line, 3);
Player player = null;
if (playerName.equals("ComputerA")) {
player = currentGame.getPlayer(playerA.getId());
} else if (playerName.equals("ComputerB")) {
player = currentGame.getPlayer(playerB.getId());
} else {
throw new IllegalArgumentException("Wrong player in 'battlefield' line, player=" + player + ", line=" + line);
}
int actualCount = 0;
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {
if (permanent.getControllerId().equals(player.getId())) {
if (permanent.getName().equals(cardName)) {
actualCount++;
}
}
}
Assert.assertEquals("(Battlefield) Card counts are not equal (" + cardName + ")", expectedCount, actualCount);
return;
}
if (type.equals(CardTestBase.ExpectedType.GRAVEYARD)) {
String playerName = getStringParam(line, 1);
String cardName = getStringParam(line, 2);
int expectedCount = getIntParam(line, 3);
Player player = null;
if (playerName.equals("ComputerA")) {
player = currentGame.getPlayer(playerA.getId());
} else if (playerName.equals("ComputerB")) {
player = currentGame.getPlayer(playerB.getId());
} else {
throw new IllegalArgumentException("Wrong player in 'graveyard' line, player=" + player + ", line=" + line);
}
int actualCount = 0;
for (Card card : player.getGraveyard().getCards(currentGame)) {
if (card.getName().equals(cardName)) {
actualCount++;
}
}
Assert.assertEquals("(Graveyard) Card counts are not equal (" + cardName + ")", expectedCount, actualCount);
}
}
private int getIntParam(String line, int index) {
String[] params = line.split(":");
if (index > params.length - 1) {
throw new IllegalArgumentException("Not correct line: " + line);
}
return Integer.parseInt(params[index]);
}
private String getStringParam(String line, int index) {
String[] params = line.split(":");
if (index > params.length - 1) {
throw new IllegalArgumentException("Not correct line: " + line);
}
return params[index];
}
protected void checkPermanentPT(Player player, String cardName, int power, int toughness, Filter.ComparisonScope scope) {
if (currentGame == null) {
throw new IllegalStateException("Current game is null");
}
if (scope.equals(Filter.ComparisonScope.All)) {
throw new UnsupportedOperationException("ComparisonScope.All is not implemented.");
}
int count = 0;
int fit = 0;
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(player.getId())) {
if (permanent.getName().equals(cardName)) {
Assert.assertEquals("Power is not the same", power, permanent.getPower().getValue());
Assert.assertEquals("Toughness is not the same", toughness, permanent.getToughness().getValue());
break;
}
}
}
}

View file

@ -79,16 +79,15 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
stopOnTurn = 2; stopOnTurn = 2;
stopAtStep = PhaseStep.UNTAP; stopAtStep = PhaseStep.UNTAP;
handCardsA.clear();
handCardsB.clear(); for (Player player : currentGame.getPlayers().values()) {
battlefieldCardsA.clear(); TestPlayer testPlayer = (TestPlayer)player;
battlefieldCardsB.clear(); getCommands(testPlayer).clear();
graveyardCardsA.clear(); getLibraryCards(testPlayer).clear();
graveyardCardsB.clear(); getHandCards(testPlayer).clear();
libraryCardsA.clear(); getBattlefieldCards(testPlayer).clear();
libraryCardsB.clear(); getGraveCards(testPlayer).clear();
commandsA.clear(); }
commandsB.clear();
gameOptions = new GameOptions(); gameOptions = new GameOptions();
} }
@ -147,10 +146,12 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
throw new IllegalStateException("Game is not initialized. Use load method to load a test case and initialize a game."); throw new IllegalStateException("Game is not initialized. Use load method to load a test case and initialize a game.");
} }
currentGame.cheat(playerA.getId(), commandsA); for (Player player : currentGame.getPlayers().values()) {
currentGame.cheat(playerA.getId(), libraryCardsA, handCardsA, battlefieldCardsA, graveyardCardsA); TestPlayer testPlayer = (TestPlayer)player;
currentGame.cheat(playerB.getId(), commandsB); currentGame.cheat(player.getId(), getCommands(testPlayer));
currentGame.cheat(playerB.getId(), libraryCardsB, handCardsB, battlefieldCardsB, graveyardCardsB); currentGame.cheat(player.getId(), getLibraryCards(testPlayer), getHandCards(testPlayer),
getBattlefieldCards(testPlayer), getGraveCards(testPlayer));
}
boolean testMode = true; boolean testMode = true;
long t1 = System.nanoTime(); long t1 = System.nanoTime();

View file

@ -1,13 +1,13 @@
package org.mage.test.serverside.base; package org.mage.test.serverside.base;
import mage.Constants; import mage.Constants;
import mage.Constants.PhaseStep;
import mage.cards.Card; import mage.cards.Card;
import mage.game.Game; import mage.game.Game;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.permanent.PermanentCard; import mage.game.permanent.PermanentCard;
import mage.game.tournament.TournamentType; import mage.game.tournament.TournamentType;
import mage.players.Player; import mage.players.Player;
import mage.server.game.DeckValidatorFactory;
import mage.server.game.GameFactory; import mage.server.game.GameFactory;
import mage.server.game.PlayerFactory; import mage.server.game.PlayerFactory;
import mage.server.tournament.TournamentFactory; import mage.server.tournament.TournamentFactory;
@ -20,6 +20,8 @@ import mage.util.Copier;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.mage.test.player.RandomPlayer;
import org.mage.test.player.TestPlayer;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -27,8 +29,6 @@ import java.io.FilenameFilter;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import mage.Constants.PhaseStep;
import org.mage.test.player.RandomPlayer;
/** /**
* Base class for all tests. * Base class for all tests.
@ -56,8 +56,8 @@ public abstract class MageTestBase {
protected Map<Constants.Zone, String> commandsA = new HashMap<Constants.Zone, String>(); protected Map<Constants.Zone, String> commandsA = new HashMap<Constants.Zone, String>();
protected Map<Constants.Zone, String> commandsB = new HashMap<Constants.Zone, String>(); protected Map<Constants.Zone, String> commandsB = new HashMap<Constants.Zone, String>();
protected Player playerA; protected TestPlayer playerA;
protected Player playerB; protected TestPlayer playerB;
/** /**
* Game instance initialized in load method. * Game instance initialized in load method.

View file

@ -41,20 +41,17 @@ public abstract class MageTestPlayerBase {
protected Pattern pattern = Pattern.compile("([a-zA-Z]*):([\\w]*):([a-zA-Z ,\\-.!'\\d]*):([\\d]*)(:\\{tapped\\})?"); protected Pattern pattern = Pattern.compile("([a-zA-Z]*):([\\w]*):([a-zA-Z ,\\-.!'\\d]*):([\\d]*)(:\\{tapped\\})?");
protected List<Card> handCardsA = new ArrayList<Card>(); protected Map<TestPlayer, List<Card>> handCards = new HashMap<TestPlayer, List<Card>>();
protected List<Card> handCardsB = new ArrayList<Card>(); protected Map<TestPlayer, List<PermanentCard>> battlefieldCards = new HashMap<TestPlayer, List<PermanentCard>>();
protected List<PermanentCard> battlefieldCardsA = new ArrayList<PermanentCard>(); protected Map<TestPlayer, List<Card>> graveyardCards = new HashMap<TestPlayer, List<Card>>();
protected List<PermanentCard> battlefieldCardsB = new ArrayList<PermanentCard>(); protected Map<TestPlayer, List<Card>> libraryCards = new HashMap<TestPlayer, List<Card>>();
protected List<Card> graveyardCardsA = new ArrayList<Card>();
protected List<Card> graveyardCardsB = new ArrayList<Card>();
protected List<Card> libraryCardsA = new ArrayList<Card>();
protected List<Card> libraryCardsB = new ArrayList<Card>();
protected Map<Constants.Zone, String> commandsA = new HashMap<Constants.Zone, String>(); protected Map<TestPlayer, Map<Constants.Zone, String>> commands = new HashMap<TestPlayer, Map<Constants.Zone, String>>();
protected Map<Constants.Zone, String> commandsB = new HashMap<Constants.Zone, String>();
protected TestPlayer playerA; protected TestPlayer playerA;
protected TestPlayer playerB; protected TestPlayer playerB;
protected TestPlayer playerC;
protected TestPlayer playerD;
/** /**
* Game instance initialized in load method. * Game instance initialized in load method.
@ -105,15 +102,6 @@ public abstract class MageTestPlayerBase {
for (GamePlugin plugin : config.getGameTypes()) { for (GamePlugin plugin : config.getGameTypes()) {
GameFactory.getInstance().addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin)); GameFactory.getInstance().addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin));
} }
// for (GamePlugin plugin : config.getTournamentTypes()) {
// TournamentFactory.getInstance().addTournamentType(plugin.getName(), loadTournamentType(plugin), loadPlugin(plugin));
// }
// for (Plugin plugin : config.getPlayerTypes()) {
// PlayerFactory.getInstance().addPlayerType(plugin.getName(), loadPlugin(plugin));
// }
// for (Plugin plugin : config.getDeckTypes()) {
// DeckValidatorFactory.getInstance().addDeckType(plugin.getName(), loadPlugin(plugin));
// }
Copier.setLoader(classLoader); Copier.setLoader(classLoader);
} }
@ -208,30 +196,26 @@ public abstract class MageTestPlayerBase {
String zone = m.group(1); String zone = m.group(1);
String nickname = m.group(2); String nickname = m.group(2);
if (nickname.equals("ComputerA") || nickname.equals("ComputerB")) { if (nickname.startsWith("Computer")) {
List<Card> cards = null; List<Card> cards = null;
List<PermanentCard> perms = null; List<PermanentCard> perms = null;
Constants.Zone gameZone; Constants.Zone gameZone;
if ("hand".equalsIgnoreCase(zone)) { if ("hand".equalsIgnoreCase(zone)) {
gameZone = Constants.Zone.HAND; gameZone = Constants.Zone.HAND;
cards = nickname.equals("ComputerA") ? handCardsA : handCardsB; cards = getHandCards(getPlayer(nickname));
} else if ("battlefield".equalsIgnoreCase(zone)) { } else if ("battlefield".equalsIgnoreCase(zone)) {
gameZone = Constants.Zone.BATTLEFIELD; gameZone = Constants.Zone.BATTLEFIELD;
perms = nickname.equals("ComputerA") ? battlefieldCardsA : battlefieldCardsB; perms = getBattlefieldCards(getPlayer(nickname));
} else if ("graveyard".equalsIgnoreCase(zone)) { } else if ("graveyard".equalsIgnoreCase(zone)) {
gameZone = Constants.Zone.GRAVEYARD; gameZone = Constants.Zone.GRAVEYARD;
cards = nickname.equals("ComputerA") ? graveyardCardsA : graveyardCardsB; cards = getGraveCards(getPlayer(nickname));
} else if ("library".equalsIgnoreCase(zone)) { } else if ("library".equalsIgnoreCase(zone)) {
gameZone = Constants.Zone.LIBRARY; gameZone = Constants.Zone.LIBRARY;
cards = nickname.equals("ComputerA") ? libraryCardsA : libraryCardsB; cards = getLibraryCards(getPlayer(nickname));
} else if ("player".equalsIgnoreCase(zone)) { } else if ("player".equalsIgnoreCase(zone)) {
String command = m.group(3); String command = m.group(3);
if ("life".equals(command)) { if ("life".equals(command)) {
if (nickname.equals("ComputerA")) { getCommands(getPlayer(nickname)).put(Constants.Zone.OUTSIDE, "life:" + m.group(4));
commandsA.put(Constants.Zone.OUTSIDE, "life:" + m.group(4));
} else {
commandsB.put(Constants.Zone.OUTSIDE, "life:" + m.group(4));
}
} }
return; return;
} else { } else {
@ -243,11 +227,7 @@ public abstract class MageTestPlayerBase {
boolean tapped = m.group(5) != null && m.group(5).equals(":{tapped}"); boolean tapped = m.group(5) != null && m.group(5).equals(":{tapped}");
if (cardName.equals("clear")) { if (cardName.equals("clear")) {
if (nickname.equals("ComputerA")) { getCommands(getPlayer(nickname)).put(gameZone, "clear");
commandsA.put(gameZone, "clear");
} else {
commandsB.put(gameZone, "clear");
}
} else { } else {
for (int i = 0; i < amount; i++) { for (int i = 0; i < amount; i++) {
Card card = Sets.findCard(cardName, true); Card card = Sets.findCard(cardName, true);
@ -272,6 +252,65 @@ public abstract class MageTestPlayerBase {
logger.warn("Init string wasn't parsed: " + line); logger.warn("Init string wasn't parsed: " + line);
} }
} }
private TestPlayer getPlayer(String name) {
if (name.equals("ComputerA")) {
return playerA;
} else if (name.equals("ComputerB")) {
return playerB;
} else if (name.equals("ComputerC")) {
return playerC;
} else if (name.equals("ComputerD")) {
return playerD;
}
throw new IllegalArgumentException("Couldn't find player for name=" + name);
}
protected List<Card> getHandCards(TestPlayer player) {
if (handCards.containsKey(player)) {
return handCards.get(player);
}
List<Card> hand = new ArrayList<Card>();
handCards.put(player, hand);
return hand;
}
protected List<Card> getGraveCards(TestPlayer player) {
if (graveyardCards.containsKey(player)) {
return graveyardCards.get(player);
}
List<Card> grave = new ArrayList<Card>();
graveyardCards.put(player, grave);
return grave;
}
protected List<Card> getLibraryCards(TestPlayer player) {
if (libraryCards.containsKey(player)) {
return libraryCards.get(player);
}
List<Card> library = new ArrayList<Card>();
libraryCards.put(player, library);
return library;
}
protected List<PermanentCard> getBattlefieldCards(TestPlayer player) {
if (battlefieldCards.containsKey(player)) {
return battlefieldCards.get(player);
}
List<PermanentCard> battlefield = new ArrayList<PermanentCard>();
battlefieldCards.put(player, battlefield);
return battlefield;
}
protected Map<Constants.Zone, String> getCommands(TestPlayer player) {
if (commands.containsKey(player)) {
return commands.get(player);
}
Map<Constants.Zone, String> command = new HashMap<Constants.Zone, String>();
commands.put(player, command);
return command;
}
private void includeFrom(String line) throws FileNotFoundException { private void includeFrom(String line) throws FileNotFoundException {
String[] params = line.split(" "); String[] params = line.split(" ");
@ -294,6 +333,6 @@ public abstract class MageTestPlayerBase {
} }
protected TestPlayer createPlayer(String name) { protected TestPlayer createPlayer(String name) {
return new TestPlayer(name, Constants.RangeOfInfluence.ALL); return new TestPlayer(name, Constants.RangeOfInfluence.ONE);
} }
} }

View file

@ -1,6 +1,7 @@
package org.mage.test.serverside.base.impl; package org.mage.test.serverside.base.impl;
import mage.Constants; import mage.Constants;
import mage.Constants.PhaseStep;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.cards.Card; import mage.cards.Card;
import mage.filter.Filter; import mage.filter.Filter;
@ -9,12 +10,12 @@ import mage.game.permanent.PermanentCard;
import mage.players.Player; import mage.players.Player;
import mage.sets.Sets; import mage.sets.Sets;
import org.junit.Assert; import org.junit.Assert;
import org.mage.test.player.TestPlayer;
import org.mage.test.serverside.base.CardTestAPI; import org.mage.test.serverside.base.CardTestAPI;
import org.mage.test.serverside.base.MageTestBase; import org.mage.test.serverside.base.MageTestBase;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.Constants.PhaseStep;
/** /**
* API for test initialization and asserting the test results. * API for test initialization and asserting the test results.
@ -86,7 +87,7 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP
* @param player {@link Player} to add cards for. Use either playerA or playerB. * @param player {@link Player} to add cards for. Use either playerA or playerB.
* @param cardName Card name in string format. * @param cardName Card name in string format.
*/ */
public void addCard(Constants.Zone gameZone, Player player, String cardName) { public void addCard(Constants.Zone gameZone, TestPlayer player, String cardName) {
addCard(gameZone, player, cardName, 1, false); addCard(gameZone, player, cardName, 1, false);
} }
@ -98,7 +99,7 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP
* @param cardName Card name in string format. * @param cardName Card name in string format.
* @param count Amount of cards to be added. * @param count Amount of cards to be added.
*/ */
public void addCard(Constants.Zone gameZone, Player player, String cardName, int count) { public void addCard(Constants.Zone gameZone, TestPlayer player, String cardName, int count) {
addCard(gameZone, player, cardName, count, false); addCard(gameZone, player, cardName, count, false);
} }
@ -112,7 +113,7 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP
* @param tapped In case gameZone is Battlefield, determines whether permanent should be tapped. * @param tapped In case gameZone is Battlefield, determines whether permanent should be tapped.
* In case gameZone is other than Battlefield, {@link IllegalArgumentException} is thrown * In case gameZone is other than Battlefield, {@link IllegalArgumentException} is thrown
*/ */
public void addCard(Constants.Zone gameZone, Player player, String cardName, int count, boolean tapped) { public void addCard(Constants.Zone gameZone, TestPlayer player, String cardName, int count, boolean tapped) {
if (gameZone.equals(Constants.Zone.BATTLEFIELD)) { if (gameZone.equals(Constants.Zone.BATTLEFIELD)) {
@ -175,7 +176,7 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP
* @param player {@link Player} to set life count for. * @param player {@link Player} to set life count for.
* @param life Life count to set. * @param life Life count to set.
*/ */
public void setLife(Player player, int life) { public void setLife(TestPlayer player, int life) {
if (player.equals(playerA)) { if (player.equals(playerA)) {
commandsA.put(Constants.Zone.OUTSIDE, "life:" + String.valueOf(life)); commandsA.put(Constants.Zone.OUTSIDE, "life:" + String.valueOf(life));
} else if (player.equals(playerB)) { } else if (player.equals(playerB)) {

View file

@ -5,9 +5,13 @@ import mage.Constants.CardType;
import mage.Constants.PhaseStep; import mage.Constants.PhaseStep;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.decks.Deck;
import mage.cards.decks.importer.DeckImporterUtil;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.Filter; import mage.filter.Filter;
import mage.game.ExileZone; import mage.game.ExileZone;
import mage.game.Game;
import mage.game.GameException;
import mage.game.command.CommandObject; import mage.game.command.CommandObject;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard; import mage.game.permanent.PermanentCard;
@ -70,18 +74,33 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
addCard(Constants.Zone.LIBRARY, playerB, "Plains", 10); addCard(Constants.Zone.LIBRARY, playerB, "Plains", 10);
} }
protected TestPlayer createPlayer(Game game, TestPlayer player, String name) throws GameException {
player = createNewPlayer(name);
player.setTestMode(true);
logger.debug("Loading deck...");
Deck deck = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck"));
logger.debug("Done!");
if (deck.getCards().size() < 40) {
throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck.getCards().size());
}
game.addPlayer(player, deck);
game.loadCards(deck.getCards(), player.getId());
return player;
}
protected TestPlayer createNewPlayer(String playerName) {
return createPlayer(playerName);
}
/** /**
* Removes all cards from player's library from the game. * Removes all cards from player's library from the game.
* Usually this should be used once before initialization to form the library in certain order. * Usually this should be used once before initialization to form the library in certain order.
* *
* @param player {@link Player} to remove all library cards from. * @param player {@link Player} to remove all library cards from.
*/ */
public void removeAllCardsFromLibrary(Player player) { public void removeAllCardsFromLibrary(TestPlayer player) {
if (player.equals(playerA)) { getCommands(player).put(Constants.Zone.LIBRARY, "clear");
commandsA.put(Constants.Zone.LIBRARY, "clear");
} else if (player.equals(playerB)) {
commandsB.put(Constants.Zone.LIBRARY, "clear");
}
} }
/** /**
@ -90,12 +109,8 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
* *
* @param player {@link Player} to remove all cards from hand. * @param player {@link Player} to remove all cards from hand.
*/ */
public void removeAllCardsFromHand(Player player) { public void removeAllCardsFromHand(TestPlayer player) {
if (player.equals(playerA)) { getCommands(player).put(Constants.Zone.HAND, "clear");
commandsA.put(Constants.Zone.HAND, "clear");
} else if (player.equals(playerB)) {
commandsB.put(Constants.Zone.HAND, "clear");
}
} }
/** /**
@ -105,7 +120,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
* @param player {@link Player} to add cards for. Use either playerA or playerB. * @param player {@link Player} to add cards for. Use either playerA or playerB.
* @param cardName Card name in string format. * @param cardName Card name in string format.
*/ */
public void addCard(Constants.Zone gameZone, Player player, String cardName) { public void addCard(Constants.Zone gameZone, TestPlayer player, String cardName) {
addCard(gameZone, player, cardName, 1, false); addCard(gameZone, player, cardName, 1, false);
} }
@ -117,7 +132,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
* @param cardName Card name in string format. * @param cardName Card name in string format.
* @param count Amount of cards to be added. * @param count Amount of cards to be added.
*/ */
public void addCard(Constants.Zone gameZone, Player player, String cardName, int count) { public void addCard(Constants.Zone gameZone, TestPlayer player, String cardName, int count) {
addCard(gameZone, player, cardName, count, false); addCard(gameZone, player, cardName, count, false);
} }
@ -131,8 +146,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
* @param tapped In case gameZone is Battlefield, determines whether permanent should be tapped. * @param tapped In case gameZone is Battlefield, determines whether permanent should be tapped.
* In case gameZone is other than Battlefield, {@link IllegalArgumentException} is thrown * In case gameZone is other than Battlefield, {@link IllegalArgumentException} is thrown
*/ */
public void addCard(Constants.Zone gameZone, Player player, String cardName, int count, boolean tapped) { public void addCard(Constants.Zone gameZone, TestPlayer player, String cardName, int count, boolean tapped) {
if (gameZone.equals(Constants.Zone.BATTLEFIELD)) { if (gameZone.equals(Constants.Zone.BATTLEFIELD)) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
@ -142,11 +156,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
} }
PermanentCard p = new PermanentCard(card, null); PermanentCard p = new PermanentCard(card, null);
p.setTapped(tapped); p.setTapped(tapped);
if (player.equals(playerA)) { getBattlefieldCards(player).add(p);
battlefieldCardsA.add(p);
} else if (player.equals(playerB)) {
battlefieldCardsB.add(p);
}
} }
} else { } else {
if (tapped) { if (tapped) {
@ -170,24 +180,15 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
* @param player * @param player
* @return * @return
*/ */
private List<Card> getCardList(Constants.Zone gameZone, Player player) { private List<Card> getCardList(Constants.Zone gameZone, TestPlayer player) {
if (player.equals(playerA)) { if (gameZone.equals(Constants.Zone.HAND)) {
if (gameZone.equals(Constants.Zone.HAND)) { return getHandCards(player);
return handCardsA; } else if (gameZone.equals(Constants.Zone.GRAVEYARD)) {
} else if (gameZone.equals(Constants.Zone.GRAVEYARD)) { return getGraveCards(player);
return graveyardCardsA; } else if (gameZone.equals(Constants.Zone.LIBRARY)) {
} else if (gameZone.equals(Constants.Zone.LIBRARY)) { return getLibraryCards(player);
return libraryCardsA;
}
} else if (player.equals(playerB)) {
if (gameZone.equals(Constants.Zone.HAND)) {
return handCardsB;
} else if (gameZone.equals(Constants.Zone.GRAVEYARD)) {
return graveyardCardsB;
} else if (gameZone.equals(Constants.Zone.LIBRARY)) {
return libraryCardsB;
}
} }
throw new AssertionError("Zone is not supported by test framework: " + gameZone); throw new AssertionError("Zone is not supported by test framework: " + gameZone);
} }
@ -197,12 +198,8 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
* @param player {@link Player} to set life count for. * @param player {@link Player} to set life count for.
* @param life Life count to set. * @param life Life count to set.
*/ */
public void setLife(Player player, int life) { public void setLife(TestPlayer player, int life) {
if (player.equals(playerA)) { getCommands(player).put(Constants.Zone.OUTSIDE, "life:" + String.valueOf(life));
commandsA.put(Constants.Zone.OUTSIDE, "life:" + String.valueOf(life));
} else if (player.equals(playerB)) {
commandsB.put(Constants.Zone.OUTSIDE, "life:" + String.valueOf(life));
}
} }
/** /**

View file

@ -1,67 +0,0 @@
package org.mage.test.serverside.cards.effects;
import mage.Constants;
import mage.Constants.PhaseStep;
import mage.filter.Filter;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* Tests continuous boost effect like "White creatures you control get +1/+1".
*
* @author ayratn
*/
public class BoostContinuousEffectTest extends CardTestBase {
@Test
@Ignore
public void testHonorOfThePoor() throws Exception {
load("M11/Honor of the Pure.test");
execute();
checkPermanentPT(playerA, "Tine Shrike", 3, 2, Filter.ComparisonScope.Any);
checkPermanentPT(playerA, "Runeclaw Bear", 2, 2, Filter.ComparisonScope.Any);
}
@Test
public void testHonorOfThePoor2() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Honor of the Pure", 2);
addCard(Constants.Zone.BATTLEFIELD, playerA, "White Knight");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Black Knight");
setStopAt(1, PhaseStep.CLEANUP);
execute();
assertPowerToughness(playerA, "White Knight", 4, 4, Filter.ComparisonScope.Any);
assertPowerToughness(playerA, "Black Knight", 2, 2, Filter.ComparisonScope.Any);
}
@Test
public void testHonorOfThePoor3() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Honor of the Pure");
addCard(Constants.Zone.BATTLEFIELD, playerA, "White Knight");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Black Knight");
setStopAt(2, PhaseStep.CLEANUP);
execute();
assertPowerToughness(playerA, "White Knight", 3, 3, Filter.ComparisonScope.Any);
assertPowerToughness(playerA, "Black Knight", 2, 2, Filter.ComparisonScope.Any);
}
@Test
public void testGiantGrowth() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest");
addCard(Constants.Zone.BATTLEFIELD, playerA, "White Knight");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Black Knight");
addCard(Constants.Zone.HAND, playerA, "Giant Growth");
castSpell(playerA, "Giant Growth");
addFixedTarget(playerA, "Giant Growth", "White Knight");
setStopAt(1, PhaseStep.CLEANUP);
execute();
assertPowerToughness(playerA, "White Knight", 5, 5, Filter.ComparisonScope.Any);
assertPowerToughness(playerA, "Black Knight", 2, 2, Filter.ComparisonScope.Any);
}
}

View file

@ -2,7 +2,7 @@ package org.mage.test.serverside.performance;
import mage.game.Game; import mage.game.Game;
import org.junit.Ignore; import org.junit.Ignore;
import org.mage.test.serverside.base.CardTestBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* Test for copying game state. * Test for copying game state.
@ -10,7 +10,7 @@ import org.mage.test.serverside.base.CardTestBase;
* @ayratn * @ayratn
*/ */
@Ignore @Ignore
public class CopyGameStatePerformanceTest extends CardTestBase { public class CopyGameStatePerformanceTest extends CardTestPlayerBase {
public void run() throws Exception { public void run() throws Exception {
init(); init();

View file

@ -1,34 +0,0 @@
# Test playing Burn the Impure
### ComputerA ###
# Battlefield
battlefield:ComputerA:Mountain:2
# Hand
hand:ComputerA:Mountain:4
hand:ComputerA:Burn the Impure:1
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Mountain:10
### ComputerB ###
# Battlefield
battlefield:ComputerB:Plains:1
battlefield:ComputerB:Tine Shrike:1
#battlefield:ComputerB:Runeclaw Bear:1
# Hand
hand:ComputerB:Plains:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Plains:10
# Life
player:ComputerB:life:3

View file

@ -1,29 +0,0 @@
### Test playing Honor of the Pure ###
#######################################
$include green.white.default
### ComputerA ###
# Hand
hand:ComputerA:Honor of the Pure:1
# Battlefield
battlefield:ComputerB:Tine Shrike:1
battlefield:ComputerB:Runeclaw Bear:1
### ComputerB ###
# nothing
$options
exit_on_turn:2
$expected
turn:1
result:draw
life:ComputerA:20
life:ComputerB:20
battlefield:ComputerA:Tine Shrike:1
battlefield:ComputerA:Runeclaw Bear:1
# note: abilities are tested in code

View file

@ -1,30 +0,0 @@
### Test playing Burn the Impure ###
### Target: creature with no Infect ###
#######################################
$include red.default
### ComputerA ###
# Hand
hand:ComputerA:Burn the Impure:1
### ComputerB ###
# Battlefield
battlefield:ComputerB:Runeclaw Bear:1
# Life
player:ComputerB:life:3
$options
exit_on_turn:2
$expected
turn:1
result:draw
life:ComputerA:20
life:ComputerB:3
#battlefield:ComputerB:Runeclaw Bear:0
#graveyard:ComputerB:Runeclaw Bear:1

View file

@ -1,29 +0,0 @@
### Test playing Burn the Impure ###
### Target: creature with Infect ###
#######################################
$include red.default
### ComputerA ###
# Hand
hand:ComputerA:Burn the Impure:1
### ComputerB ###
# Battlefield
battlefield:ComputerB:Tine Shrike:1
# Life
player:ComputerB:life:3
$options
exit_on_turn:2
$expected
turn:1
result:won
life:ComputerA:20
life:ComputerB:0
#battlefield:ComputerB:Tine Shrike:0
#graveyard:ComputerB:Tine Shrike:1

View file

@ -1,31 +0,0 @@
# Default init game state for white player (that plays with Plains)
### ComputerA ###
# Battlefield
battlefield:ComputerA:Plains:5
battlefield:ComputerA:Forest:5
# Hand
hand:ComputerA:Plains:2
hand:ComputerA:Forest:2
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Plains:5
library:ComputerA:Forest:5
### ComputerB ###
# Battlefield
battlefield:ComputerB:Mountain:2
# Hand
hand:ComputerB:Mountain:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Mountain:10

View file

@ -1,28 +0,0 @@
# Default init game state for red player (that plays with Mountains)
### ComputerA ###
# Battlefield
battlefield:ComputerA:Mountain:5
# Hand
hand:ComputerA:Mountain:4
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Mountain:10
### ComputerB ###
# Battlefield
battlefield:ComputerB:Plains:2
# Hand
hand:ComputerB:Plains:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Plains:10

View file

@ -1,28 +0,0 @@
# Default init game state for white player (that plays with Plains)
### ComputerA ###
# Battlefield
battlefield:ComputerA:Plains:5
# Hand
hand:ComputerA:Plains:4
# Library
# from down to top
library:ComputerA:clear:0
library:ComputerA:Plains:10
### ComputerB ###
# Battlefield
battlefield:ComputerB:Mountain:2
# Hand
hand:ComputerB:Mountain:2
# Library
# from down to top
library:ComputerB:clear:0
library:ComputerB:Mountain:10