mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
Refactor: replaced sourceId by source and introduced source param in some methods;
This commit is contained in:
parent
2bb472607b
commit
db239a1055
3205 changed files with 7080 additions and 6795 deletions
|
|
@ -84,13 +84,21 @@ public class ConspireTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Wort, the Raidmother");
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
// prepare goblins
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wort, the Raidmother");// {4}{R/G}{R/G}
|
||||
|
||||
// cast with conspire
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
setChoice(playerA, "Yes");
|
||||
setChoice(playerA, "Yes"); // use conspire
|
||||
setChoice(playerA, "Goblin Warrior");
|
||||
setChoice(playerA, "Goblin Warrior");
|
||||
setChoice(playerA, "No"); // keep targets
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Wort, the Raidmother", 1);
|
||||
assertGraveyardCount(playerA, "Lightning Bolt", 1);
|
||||
assertLife(playerB, 14);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.abilities.keyword.HexproofAbility;
|
||||
|
|
@ -20,10 +18,13 @@ public class HexproofTest extends CardTestPlayerBase {
|
|||
public void testOneTargetOneGainingHexproof() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Elder of Laurels");
|
||||
addCard(Zone.HAND, playerA, "Ranger's Guile");
|
||||
|
||||
//
|
||||
// Target creature you control gets +1/+1 and gains hexproof until end of turn.
|
||||
addCard(Zone.HAND, playerA, "Ranger's Guile"); // {G}
|
||||
//
|
||||
// Return up to two target creatures to their owners’ hands.
|
||||
addCard(Zone.HAND, playerB, "Into the Void"); //{3}{U}
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
|
||||
addCard(Zone.HAND, playerB, "Into the Void");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Into the Void", "Elder of Laurels");
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Ranger's Guile", "Elder of Laurels");
|
||||
|
|
|
|||
|
|
@ -35,9 +35,13 @@ public class MadnessTest extends CardTestPlayerBase {
|
|||
@Test
|
||||
public void testMadness() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
//
|
||||
// Madness {2}{G} (If you discard this card, discard it into exile. When you do, cast it for its madness cost or put it into your graveyard.)
|
||||
addCard(Zone.HAND, playerA, "Arrogant Wurm");
|
||||
addCard(Zone.HAND, playerA, "Raven's Crime");
|
||||
//
|
||||
// Target player discards a card.
|
||||
addCard(Zone.HAND, playerA, "Raven's Crime"); // {B}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Raven's Crime", playerA);
|
||||
setChoice(playerA, "Yes"); // use madness triggered ability
|
||||
|
|
|
|||
|
|
@ -10,125 +10,134 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* 702.87. Rebound
|
||||
* 702.87a Rebound appears on some instants and sorceries. It represents a static ability that functions while
|
||||
* the spell is on the stack and may create a delayed triggered ability. "Rebound" means "If this spell was cast
|
||||
* from your hand, instead of putting it into your graveyard as it resolves, exile it and, at the beginning of
|
||||
* your next upkeep, you may cast this card from exile without paying its mana cost."
|
||||
* 702.87b Casting a card without paying its mana cost as the result of a rebound ability follows the rules for
|
||||
* paying alternative costs in rules 601.2b and 601.2e–g.
|
||||
* 702.87c Multiple instances of rebound on the same spell are redundant.
|
||||
*
|
||||
* 702.87. Rebound
|
||||
* 702.87a Rebound appears on some instants and sorceries. It represents a static ability that functions while
|
||||
* the spell is on the stack and may create a delayed triggered ability. "Rebound" means "If this spell was cast
|
||||
* from your hand, instead of putting it into your graveyard as it resolves, exile it and, at the beginning of
|
||||
* your next upkeep, you may cast this card from exile without paying its mana cost."
|
||||
* 702.87b Casting a card without paying its mana cost as the result of a rebound ability follows the rules for
|
||||
* paying alternative costs in rules 601.2b and 601.2e–g.
|
||||
* 702.87c Multiple instances of rebound on the same spell are redundant.
|
||||
*
|
||||
* @author jeff
|
||||
*/
|
||||
public class ReboundTest extends CardTestPlayerBase{
|
||||
|
||||
public class ReboundTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Test that the spell with rebound is moved to exile if
|
||||
* the spell resolves
|
||||
*/
|
||||
|
||||
|
||||
@Test
|
||||
public void testCastFromHandMovedToExile() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
|
||||
|
||||
// Target creature gets +1/+0 until end of turn and is unblockable this turn.
|
||||
addCard(Zone.HAND, playerA, "Distortion Strike");
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Distortion Strike", "Memnite");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
//check exile and graveyard
|
||||
assertExileCount("Distortion Strike", 1);
|
||||
assertGraveyardCount(playerA, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the spell with rebound can be cast again
|
||||
* on the beginning of the next upkeep without paying mana costs
|
||||
*/
|
||||
|
||||
|
||||
@Test
|
||||
public void testRecastFromExile() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
|
||||
|
||||
// Target creature gets +1/+0 until end of turn and is unblockable this turn.
|
||||
addCard(Zone.HAND, playerA, "Distortion Strike");
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Memnite", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Distortion Strike", "Memnite");
|
||||
|
||||
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
|
||||
//check exile and graveyard
|
||||
assertPowerToughness(playerA, "Memnite", 2, 1);
|
||||
assertExileCount("Distortion Strike", 0);
|
||||
assertGraveyardCount(playerA, "Distortion Strike", 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check that a countered spell with rebound
|
||||
* is not cast again
|
||||
*/
|
||||
|
||||
|
||||
@Test
|
||||
public void testDontRecastAfterCounter() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
|
||||
|
||||
// Target creature gets +1/+0 until end of turn and is unblockable this turn.
|
||||
addCard(Zone.HAND, playerA, "Distortion Strike");
|
||||
addCard(Zone.HAND, playerA, "Distortion Strike");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Memnite", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||
addCard(Zone.HAND, playerB, "Counterspell");
|
||||
addCard(Zone.HAND, playerB, "Counterspell");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Distortion Strike", "Memnite");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Counterspell", "Distortion Strike");
|
||||
|
||||
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
|
||||
//check exile and graveyard
|
||||
assertGraveyardCount(playerB, "Counterspell", 1);
|
||||
assertGraveyardCount(playerA, "Distortion Strike", 1);
|
||||
|
||||
assertPowerToughness(playerA, "Memnite", 1, 1);
|
||||
assertExileCount("Distortion Strike", 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check that a fizzled spell with rebound
|
||||
* is not cast again on the next controllers upkeep
|
||||
* <p>
|
||||
* rules:
|
||||
* If a spell with rebound that you cast from your hand doesn’t resolve for any reason (due being countered by a
|
||||
* spell like Cancel, or because all of its targets are illegal), rebound has no effect. The spell is simply put
|
||||
* into your graveyard. You won’t get to cast it again next turn.
|
||||
* (2010-06-15)
|
||||
*/
|
||||
|
||||
|
||||
@Test
|
||||
public void testDontRecastAfterFizzling() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
|
||||
|
||||
// Target creature gets +1/+0 until end of turn and is unblockable this turn.
|
||||
// Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep,
|
||||
// you may cast this card from exile without paying its mana cost.)
|
||||
addCard(Zone.HAND, playerA, "Distortion Strike");
|
||||
addCard(Zone.HAND, playerA, "Distortion Strike");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Memnite", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Distortion Strike", "Memnite");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Memnite","Distortion Strike");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Memnite", "Distortion Strike");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
//check exile and graveyard
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertGraveyardCount(playerA, "Memnite", 1);
|
||||
assertGraveyardCount(playerA, "Distortion Strike", 1);
|
||||
}
|
||||
assertGraveyardCount(playerA, "Distortion Strike", 1); // rebound is not activated in fizzled spell
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package org.mage.test.cards.abilities.oneshot.counter;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
|
|
@ -7,7 +6,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class AddingCountersToPermanentsTest extends CardTestPlayerBase {
|
||||
|
|
@ -135,28 +133,28 @@ public class AddingCountersToPermanentsTest extends CardTestPlayerBase {
|
|||
*/
|
||||
@Test
|
||||
public void HapatraVizierOfPoisons() {
|
||||
|
||||
// Whenever Hapatra, Vizier of Poisons deals combat damage to a player, you may put a -1/-1 counter on target creature.
|
||||
// Whenever you put one or more -1/-1 counters on a creature, create a 1/1 green Snake creature token with deathtouch.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Hapatra, Vizier of Poisons", 1);
|
||||
|
||||
//
|
||||
// When Kitchen Finks enters the battlefield, you gain 2 life.
|
||||
// Persist (When this creature dies, if it had no -1/-1 counters on it, return it to the battlefield under its owner's control with a -1/-1 counter on it.)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Kitchen Finks", 1); // Creature 3/2
|
||||
|
||||
//
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
|
||||
|
||||
// kill finks and return it to battlefield with hapata's trigger
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Kitchen Finks");
|
||||
setChoice(playerA, "When "); // two triggers (gain life + snake)
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
|
||||
assertPowerToughness(playerA, "Kitchen Finks", 2, 1);
|
||||
|
||||
assertPermanentCount(playerA, "Snake", 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,22 +7,21 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author escplan9
|
||||
*/
|
||||
public class NestOfScarabsTest extends CardTestPlayerBase {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Nest of Scarabs 2B
|
||||
Enchantment
|
||||
Whenever you put one or more -1/-1 counters on a creature, create that many 1/1 black Insect creature tokens.
|
||||
*/
|
||||
private final String nestScarabs = "Nest of Scarabs";
|
||||
|
||||
|
||||
/*
|
||||
* Reported bug: Nest of Scarabs not triggering off -1/-1 counters placed on creatures.
|
||||
*/
|
||||
* Reported bug: Nest of Scarabs not triggering off -1/-1 counters placed on creatures.
|
||||
*/
|
||||
@Test
|
||||
public void scarabs_SoulStinger_TwoCountersTwoTokens() {
|
||||
|
||||
|
|
@ -33,24 +32,26 @@ public class NestOfScarabsTest extends CardTestPlayerBase {
|
|||
When Soulstinger dies, you may put a -1/-1 counter on target creature for each -1/-1 counter on Soulstinger.
|
||||
*/
|
||||
String stinger = "Soulstinger";
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, nestScarabs);
|
||||
addCard(Zone.HAND, playerA, stinger);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, stinger);
|
||||
addTarget(playerA, stinger); // place two -1/-1 counters on himself
|
||||
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, nestScarabs, 1);
|
||||
assertPermanentCount(playerA, stinger, 1);
|
||||
assertCounterCount(playerA, stinger, CounterType.M1M1, 2);
|
||||
assertPowerToughness(playerA, stinger, 2, 3); // 4/5 with two -1/-1 counters
|
||||
assertPermanentCount(playerA, "Insect", 2); // two counters = two insects
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: test is failing due to bug in code. See issue #3402
|
||||
* Bug from testing:
|
||||
|
|
@ -65,27 +66,27 @@ public class NestOfScarabsTest extends CardTestPlayerBase {
|
|||
Put X -1/-1 counters on each creature. Shuffle Black Sun's Zenith into its owner's library.
|
||||
*/
|
||||
String blackZenith = "Black Sun's Zenith";
|
||||
|
||||
|
||||
String hillGiant = "Hill Giant"; // {3}{R} 3/3
|
||||
String grizzly = "Grizzly Bears"; // {1}{G} 2/2
|
||||
String memnite = "Memnite"; // {0} 1/1
|
||||
String fugitive = "Fugitive Wizard"; // {U} 1/1
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, nestScarabs);
|
||||
addCard(Zone.HAND, playerA, blackZenith);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, fugitive);
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, grizzly);
|
||||
addCard(Zone.BATTLEFIELD, playerB, memnite);
|
||||
addCard(Zone.BATTLEFIELD, playerB, hillGiant);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, blackZenith);
|
||||
setChoice(playerA, "X=1");
|
||||
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertPermanentCount(playerA, nestScarabs, 1);
|
||||
assertHandCount(playerA, blackZenith, 0);
|
||||
assertLibraryCount(playerA, blackZenith, 1); // shuffles back into library
|
||||
|
|
@ -93,13 +94,13 @@ public class NestOfScarabsTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, memnite, 1);
|
||||
assertPermanentCount(playerB, grizzly, 1);
|
||||
assertPermanentCount(playerB, hillGiant, 1);
|
||||
assertCounterCount(playerB, grizzly, CounterType.M1M1, 1);
|
||||
assertCounterCount(playerB, grizzly, CounterType.M1M1, 1);
|
||||
assertCounterCount(playerB, hillGiant, CounterType.M1M1, 1);
|
||||
assertPowerToughness(playerB, grizzly, 1, 1); // 2/2 with -1/-1 counter
|
||||
assertPowerToughness(playerB, hillGiant, 2, 2); // 3/3 with -1/-1 counter
|
||||
assertPermanentCount(playerA, "Insect", 4); // 4 counters = 4 insects
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: test is failing due to bug in code. See issue #3402
|
||||
* Bug from testing:
|
||||
|
|
@ -115,28 +116,28 @@ public class NestOfScarabsTest extends CardTestPlayerBase {
|
|||
Put X -1/-1 counters on each creature. Shuffle Black Sun's Zenith into its owner's library.
|
||||
*/
|
||||
String blackZenith = "Black Sun's Zenith";
|
||||
|
||||
|
||||
String hillGiant = "Hill Giant"; // {3}{R} 3/3
|
||||
String grizzly = "Grizzly Bears"; // {1}{G} 2/2
|
||||
String memnite = "Memnite"; // {0} 1/1
|
||||
String fugitive = "Fugitive Wizard"; // {U} 1/1
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, nestScarabs);
|
||||
addCard(Zone.HAND, playerA, blackZenith);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, fugitive);
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, nestScarabs);
|
||||
addCard(Zone.BATTLEFIELD, playerB, grizzly);
|
||||
addCard(Zone.BATTLEFIELD, playerB, memnite);
|
||||
addCard(Zone.BATTLEFIELD, playerB, hillGiant);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, blackZenith);
|
||||
setChoice(playerA, "X=1");
|
||||
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertPermanentCount(playerA, nestScarabs, 1);
|
||||
assertPermanentCount(playerB, nestScarabs, 1);
|
||||
assertHandCount(playerA, blackZenith, 0);
|
||||
|
|
@ -145,14 +146,14 @@ public class NestOfScarabsTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, memnite, 1);
|
||||
assertPermanentCount(playerB, grizzly, 1);
|
||||
assertPermanentCount(playerB, hillGiant, 1);
|
||||
assertCounterCount(playerB, grizzly, CounterType.M1M1, 1);
|
||||
assertCounterCount(playerB, grizzly, CounterType.M1M1, 1);
|
||||
assertCounterCount(playerB, hillGiant, CounterType.M1M1, 1);
|
||||
assertPowerToughness(playerB, grizzly, 1, 1); // 2/2 with -1/-1 counter
|
||||
assertPowerToughness(playerB, hillGiant, 2, 2); // 3/3 with -1/-1 counter
|
||||
assertPermanentCount(playerB, "Insect", 0); // playerB did not place the -1/-1 counters, should not trigger
|
||||
assertPermanentCount(playerA, "Insect", 4); // 4 counters = 4 insects
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Reported bug: Nest of Scarabs not triggering off infect damage dealt by creatures such as Blight Mamba
|
||||
*/
|
||||
|
|
@ -178,14 +179,14 @@ public class NestOfScarabsTest extends CardTestPlayerBase {
|
|||
assertCounterCount(playerB, wOmens, CounterType.M1M1, 1);
|
||||
assertPermanentCount(playerA, "Insect", 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Reported bug: Nest of Scarabs not triggering off wither damage dealt by creatures such as Sickle Ripper
|
||||
*/
|
||||
@Test
|
||||
public void scarab_witherDamageTriggers() {
|
||||
|
||||
|
||||
String sickleRipper = "Sickle Ripper"; // {1}{B} 2/1 Creature - Elemental Warrior, Wither
|
||||
String wOmens = "Wall of Omens"; // {1}{W} 0/4 defender ETB: draw a card
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,11 @@ public class UnpredictableCycloneTest extends CardTestPlayerBase {
|
|||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
|
||||
setChoice(playerA, "Yes");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Goblin Piker", 1);
|
||||
}
|
||||
|
||||
|
|
@ -42,9 +44,11 @@ public class UnpredictableCycloneTest extends CardTestPlayerBase {
|
|||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertHandCount(playerA, "Swamp", 1);
|
||||
}
|
||||
|
||||
|
|
@ -60,12 +64,16 @@ public class UnpredictableCycloneTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerA, "Thought Reflection");
|
||||
addCard(Zone.HAND, playerA, "Desert Cerodon");
|
||||
|
||||
showAvailableAbilities("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
|
||||
setChoice(playerA, "Thought Reflection"); // apply doubling first
|
||||
setChoice(playerA, "Yes", 2); // cast founded library cards
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Goblin Piker", 2);
|
||||
}
|
||||
|
||||
|
|
@ -82,11 +90,18 @@ public class UnpredictableCycloneTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Desert Cerodon");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
|
||||
setChoice(playerA, "Thought Reflection", 3); // apply doubling first
|
||||
// from first cycle call
|
||||
setChoice(playerA, "Thought Reflection", 2); // 3 triggers: 2x doubling + 1x cycle
|
||||
setChoice(playerA, "Yes", 2); // cast founded library cards for 2x doubling triggers
|
||||
// from triggered cycle
|
||||
setChoice(playerA, "Thought Reflection", 1); // 2 triggers: 1x doubling + 1x cycle
|
||||
setChoice(playerA, "Yes", 2); // cast founded library cards for 2x doubling triggers
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Goblin Piker", 4);
|
||||
}
|
||||
|
||||
|
|
@ -105,10 +120,13 @@ public class UnpredictableCycloneTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plagiarize", playerB);
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Cycling");
|
||||
setChoice(playerA, "Yes"); // cast founded library card
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Goblin Piker", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import mage.game.permanent.Permanent;
|
|||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static mage.constants.PhaseStep.*;
|
||||
import static mage.constants.Zone.BATTLEFIELD;
|
||||
import static mage.constants.Zone.HAND;
|
||||
|
|
@ -34,7 +32,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void should_reduce_life_of_playerA_by_1_at_the_beginning_of_the_next_end_step() {
|
||||
playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID());
|
||||
setLife(playerA, ANY_LIFE_TOTAL);
|
||||
|
||||
playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase();
|
||||
|
||||
|
|
@ -48,7 +46,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void should_not_reduce_life_of_playerA_by_1_at_post_combat_main_step() {
|
||||
playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID());
|
||||
setLife(playerA, ANY_LIFE_TOTAL);
|
||||
|
||||
playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase();
|
||||
|
||||
|
|
@ -62,7 +60,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void should_return_Brood_of_Cockroaches_to_playerA_hand_end_of_turn() {
|
||||
playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID());
|
||||
setLife(playerA, ANY_LIFE_TOTAL);
|
||||
|
||||
playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase();
|
||||
|
||||
|
|
@ -76,7 +74,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void should_not_return_Brood_of_Cockroaches_to_playerA_at_post_combat_step() {
|
||||
playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID());
|
||||
setLife(playerA, ANY_LIFE_TOTAL);
|
||||
|
||||
playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,32 +9,51 @@ public class AbilityOwnershipTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void testOwned() {
|
||||
// When Soul Snuffers enters the battlefield, put a -1/-1 counter on each creature.
|
||||
addCard(Zone.GRAVEYARD, playerB, "Soul Snuffers");
|
||||
//
|
||||
// Exploit (When this creature enters the battlefield, you may sacrifice a creature.)
|
||||
// When Minister of Pain exploits a creature, creatures your opponents control get -1/-1 until end of turn.
|
||||
addCard(Zone.GRAVEYARD, playerB, "Minister of Pain");
|
||||
|
||||
// Put all creature cards from all graveyards onto the battlefield under your control.
|
||||
addCard(Zone.HAND, playerA, "Rise of the Dark Realms");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 9);
|
||||
//
|
||||
// Whenever you put one or more -1/-1 counters on a creature, each opponent loses 1 life and you gain 1 life.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Obelisk Spider");
|
||||
|
||||
setLife(playerA, 20);
|
||||
setLife(playerB, 20);
|
||||
|
||||
// return two creatures from graveyard:
|
||||
// - Soul Snuffers must gives 1 counter to each creature (total: 3x from my creatures)
|
||||
// - Minister of Pain must gives 0 counter to opponent's creature (total: 0x, cause opponents don't have creatures and we don't use exploit)
|
||||
// - SO Obelisk Spider must triggers 3x times
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rise of the Dark Realms");
|
||||
setChoice(playerA, "Yes");
|
||||
addTarget(playerA, "Soul Snuffers"); // sacrifice to Exploit
|
||||
setChoice(playerA, "When "); // two triggers
|
||||
// * Ability: Soul Snuffers - EntersBattlefieldTriggeredAbility: When {this} enters the battlefield, put a -1/-1 counter on each creature.
|
||||
// * Ability: Minister of Pain - ExploitAbility: Exploit <i>(When this creature enters the battlefield, you may sacrifice a creature.)</i>
|
||||
setChoice(playerA, "No"); // no exploit
|
||||
// 3x life triggers
|
||||
setChoice(playerA, "Whenever you put one or more");
|
||||
setChoice(playerA, "Whenever you put one or more");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// Obelisk Spider Triggers twice once for the counter on Obelisk Spider. Once for the counter on Minister of Pain.
|
||||
assertLife(playerA, 22);
|
||||
assertLife(playerB, 18);
|
||||
// Obelisk Spider Triggers 3x (Soul Snuffers puts 3 counters on 3 creatures)
|
||||
assertLife(playerA, 20 + 3);
|
||||
assertLife(playerB, 20 - 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToGraveyard() {
|
||||
addCard(Zone.GRAVEYARD, playerB, "Soul Snuffers");
|
||||
addCard(Zone.GRAVEYARD, playerB, "Minister of Pain");
|
||||
// Whenever you put one or more -1/-1 counters on a creature, each opponent loses 1 life and you gain 1 life.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Obelisk Spider");
|
||||
|
||||
addCard(Zone.HAND, playerA, "Rise of the Dark Realms");
|
||||
|
|
@ -43,12 +62,18 @@ public class AbilityOwnershipTest extends CardTestPlayerBase {
|
|||
setLife(playerA, 20);
|
||||
setLife(playerB, 20);
|
||||
|
||||
// return two creatures from graveyard:
|
||||
// - Soul Snuffers must gives 1 counter to each creature (total: 2x from my creatures)
|
||||
// - Minister of Pain must gives 0 counter to opponent's creature (total: 0x, cause opponents don't have creatures and we don't use exploit)
|
||||
// - SO Obelisk Spider must triggers 2x times, BUT it's controlled by opponent, so no triggers at all
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rise of the Dark Realms");
|
||||
setChoice(playerA, "Yes");
|
||||
addTarget(playerA, "Soul Snuffers"); // sacrifice to Exploit
|
||||
setChoice(playerA, "When "); // two triggers
|
||||
setChoice(playerA, "No"); // no exploit
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.mage.test.cards.triggers;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
|
|
@ -11,7 +6,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class StormCauldronTest extends CardTestPlayerBase {
|
||||
|
|
@ -20,37 +14,37 @@ public class StormCauldronTest extends CardTestPlayerBase {
|
|||
* With Storm Cauldron in play (owned by opponent), I sacced Crystal Vein
|
||||
* for 2 mana... except it got returned to my hand, which shouldn't happen.
|
||||
* Haven't tested it with other sac lands yet.
|
||||
*
|
||||
* <p>
|
||||
* Relevant ruing for Storm Cauldron:
|
||||
*
|
||||
* <p>
|
||||
* 10/4/2004: If a land is tapped for mana and sacrificed all in one action,
|
||||
* it goes to the graveyard before the Cauldron can return it to the
|
||||
* player's hand.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testLandNotReturnedToHand() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Zone.HAND, playerA, "Mountain", 1);
|
||||
// {T}: Add {C}.
|
||||
// {T}, Sacrifice Crystal Vein: Add {C}{C}.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Crystal Vein", 1);
|
||||
|
||||
addCard(Zone.HAND, playerA, "Crystal Vein", 1);
|
||||
//
|
||||
// Each player may play an additional land during each of their turns.
|
||||
// Whenever a land is tapped for mana, return it to its owner's hand.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Storm Cauldron", 1);
|
||||
|
||||
// can play two lands
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Crystal Vein");
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mountain");
|
||||
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}, Sacrifice");
|
||||
activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}, Sacrifice");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, "Crystal Vein", 1);
|
||||
assertPermanentCount(playerA, "Mountain", 1);
|
||||
assertHandCount(playerA, "Crystal Vein", 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public class LoadTest {
|
|||
private static final int TEST_PORT = 17171;
|
||||
private static final String TEST_PROXY_TYPE = "None";
|
||||
private static final String TEST_USER_NAME = "user";
|
||||
private static final String TEST_AI_SETS_USAGE = "CMR"; // set in generated decks for AI games (empty for all sets usage)
|
||||
|
||||
@BeforeClass
|
||||
public static void initDatabase() {
|
||||
|
|
@ -267,7 +268,7 @@ public class LoadTest {
|
|||
@Test
|
||||
@Ignore
|
||||
public void test_TwoAIPlayGame_One() {
|
||||
playTwoAIGame("Single AI game", "GR", "GRN");
|
||||
playTwoAIGame("Single AI game", "WGUBR", TEST_AI_SETS_USAGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -293,7 +294,7 @@ public class LoadTest {
|
|||
long randomSeed = seedsList.get(i);
|
||||
logger.info("Game " + (i + 1) + " of " + seedsList.size() + ", RANDOM seed: " + randomSeed);
|
||||
RandomUtil.setSeed(randomSeed);
|
||||
playTwoAIGame("AI game #" + (i + 1), "WGUBR", "ELD");
|
||||
playTwoAIGame("AI game #" + (i + 1), "WGUBR", TEST_AI_SETS_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import java.util.*;
|
|||
*/
|
||||
public class RandomPlayer extends ComputerPlayer {
|
||||
|
||||
private boolean isSimulatedPlayer;
|
||||
private final boolean isSimulatedPlayer;
|
||||
private int actionCount = 0;
|
||||
|
||||
protected PassAbility pass = new PassAbility();
|
||||
|
|
@ -138,7 +138,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
if (ability.isUsesStack()) {
|
||||
game.getStack().push(new StackAbility(ability, playerId));
|
||||
if (ability.activate(game, false)) {
|
||||
game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId()));
|
||||
game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability, ability.getControllerId()));
|
||||
actionCount++;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void selectBlockers(Game game, UUID defendingPlayerId) {
|
||||
public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) {
|
||||
int numGroups = game.getCombat().getGroups().size();
|
||||
if (numGroups == 0) {
|
||||
return;
|
||||
|
|
@ -373,7 +373,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void assignDamage(int damage, List<UUID> targets, String singleTargetName, UUID sourceId, Game game) {
|
||||
public void assignDamage(int damage, List<UUID> targets, String singleTargetName, UUID attackerId, Ability source, Game game) {
|
||||
int remainingDamage = damage;
|
||||
UUID targetId;
|
||||
int amount;
|
||||
|
|
@ -387,12 +387,12 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
}
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.damage(amount, sourceId, game, false, true);
|
||||
permanent.damage(amount, attackerId, source, game, false, true);
|
||||
remainingDamage -= amount;
|
||||
} else {
|
||||
Player player = game.getPlayer(targetId);
|
||||
if (player != null) {
|
||||
player.damage(amount, sourceId, game);
|
||||
player.damage(amount, attackerId, source, game);
|
||||
remainingDamage -= amount;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package org.mage.test.player;
|
|||
|
||||
import mage.*;
|
||||
import mage.abilities.*;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.AlternativeSourceCosts;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -35,6 +37,7 @@ import mage.game.Graveyard;
|
|||
import mage.game.Table;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.draft.Draft;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.match.Match;
|
||||
import mage.game.match.MatchPlayer;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -564,6 +567,10 @@ public class TestPlayer implements Player {
|
|||
removed.forEach(actionsToRemoveLater::remove);
|
||||
}
|
||||
|
||||
// fake test ability for triggers and events
|
||||
Ability source = new SimpleStaticAbility(Zone.OUTSIDE, new InfoEffect("adding testing cards"));
|
||||
source.setControllerId(this.getId());
|
||||
|
||||
int numberOfActions = actions.size();
|
||||
List<PlayerAction> tempActions = new ArrayList<>();
|
||||
tempActions.addAll(actions);
|
||||
|
|
@ -663,7 +670,7 @@ public class TestPlayer implements Player {
|
|||
CounterType counterType = CounterType.findByName(groups[1]);
|
||||
Assert.assertNotNull("Invalid counter type " + groups[1], counterType);
|
||||
Counter counter = counterType.createInstance(Integer.parseInt(groups[2]));
|
||||
permanent.addCounters(counter, null, game);
|
||||
permanent.addCounters(counter, source, game);
|
||||
actions.remove(action);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1034,7 +1041,7 @@ public class TestPlayer implements Player {
|
|||
* rollback.
|
||||
*
|
||||
* @param game
|
||||
* @param rollbackBlock rollback block to add the actions for
|
||||
* @param rollbackBlockNumber rollback block to add the actions for
|
||||
*/
|
||||
private void addActionsAfterRollback(Game game, int rollbackBlockNumber) {
|
||||
Map<UUID, ArrayList<PlayerAction>> rollbackBlock = rollbackActions.get(rollbackBlockNumber);
|
||||
|
|
@ -1680,7 +1687,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void selectBlockers(Game game, UUID defendingPlayerId) {
|
||||
public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) {
|
||||
List<PlayerAction> tempActions = new ArrayList<>(actions);
|
||||
|
||||
UUID opponentId = game.getOpponents(computerPlayer.getId()).iterator().next();
|
||||
|
|
@ -1692,7 +1699,7 @@ public class TestPlayer implements Player {
|
|||
// aiXXX commands
|
||||
if (action.getTurnNum() == game.getTurnNum() && action.getAction().equals(AI_PREFIX + AI_COMMAND_PLAY_STEP)) {
|
||||
mustBlockByAction = true;
|
||||
this.computerPlayer.selectBlockers(game, defendingPlayerId);
|
||||
this.computerPlayer.selectBlockers(source, game, defendingPlayerId);
|
||||
actions.remove(action);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1726,7 +1733,7 @@ public class TestPlayer implements Player {
|
|||
|
||||
// AI FULL play if no actions available
|
||||
if (!mustBlockByAction && this.AIPlayer) {
|
||||
this.computerPlayer.selectBlockers(game, defendingPlayerId);
|
||||
this.computerPlayer.selectBlockers(source, game, defendingPlayerId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2154,15 +2161,15 @@ public class TestPlayer implements Player {
|
|||
// ^ - multiple targets
|
||||
// [] - special option like [no copy]
|
||||
// = - target type like targetPlayer=PlayerA
|
||||
Boolean foundMulti = targetDefinition.contains("^");
|
||||
Boolean foundSpecialStart = targetDefinition.contains("[");
|
||||
Boolean foundSpecialClose = targetDefinition.contains("]");
|
||||
Boolean foundEquals = targetDefinition.contains("=");
|
||||
boolean foundMulti = targetDefinition.contains("^");
|
||||
boolean foundSpecialStart = targetDefinition.contains("[");
|
||||
boolean foundSpecialClose = targetDefinition.contains("]");
|
||||
boolean foundEquals = targetDefinition.contains("=");
|
||||
|
||||
Boolean canMulti = canSupportChars.contains("^");
|
||||
Boolean canSpecialStart = canSupportChars.contains("[");
|
||||
Boolean canSpecialClose = canSupportChars.contains("]");
|
||||
Boolean canEquals = canSupportChars.contains("=");
|
||||
boolean canMulti = canSupportChars.contains("^");
|
||||
boolean canSpecialStart = canSupportChars.contains("[");
|
||||
boolean canSpecialClose = canSupportChars.contains("]");
|
||||
boolean canEquals = canSupportChars.contains("=");
|
||||
|
||||
// how to fix: change target definition for addTarget in test's code or update choose from targets implementation in TestPlayer
|
||||
if ((foundMulti && !canMulti) || (foundSpecialStart && !canSpecialStart) || (foundSpecialClose && !canSpecialClose) || (foundEquals && !canEquals)) {
|
||||
|
|
@ -2715,13 +2722,13 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int drawCards(int num, UUID sourceId, Game game) {
|
||||
return computerPlayer.drawCards(num, sourceId, game);
|
||||
public int drawCards(int num, Ability source, Game game) {
|
||||
return computerPlayer.drawCards(num, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int drawCards(int num, UUID sourceId, Game game, List<UUID> appliedEffects) {
|
||||
return computerPlayer.drawCards(num, sourceId, game, appliedEffects);
|
||||
public int drawCards(int num, Ability source, Game game, GameEvent event) {
|
||||
return computerPlayer.drawCards(num, source, game, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -2745,23 +2752,23 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Card discardOne(boolean random, Ability source, Game game) {
|
||||
return computerPlayer.discardOne(random, source, game);
|
||||
public Card discardOne(boolean random, boolean payForCost, Ability source, Game game) {
|
||||
return computerPlayer.discardOne(random, payForCost, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cards discard(int amount, boolean random, Ability source, Game game) {
|
||||
return computerPlayer.discard(amount, random, source, game);
|
||||
public Cards discard(int amount, boolean random, boolean payForCost, Ability source, Game game) {
|
||||
return computerPlayer.discard(amount, random, payForCost, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cards discard(Cards cards, Ability source, Game game) {
|
||||
return computerPlayer.discard(cards, source, game);
|
||||
public Cards discard(Cards cards, boolean payForCost, Ability source, Game game) {
|
||||
return computerPlayer.discard(cards, payForCost, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean discard(Card card, Ability source, Game game) {
|
||||
return computerPlayer.discard(card, source, game);
|
||||
public boolean discard(Card card, boolean payForCost, Ability source, Game game) {
|
||||
return computerPlayer.discard(card, payForCost, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -2770,18 +2777,18 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean addAttachment(UUID permanentId, Game game) {
|
||||
return computerPlayer.addAttachment(permanentId, game);
|
||||
public boolean addAttachment(UUID permanentId, Ability source, Game game) {
|
||||
return computerPlayer.addAttachment(permanentId, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAttachment(Permanent attachment, Game game) {
|
||||
return computerPlayer.removeAttachment(attachment, game);
|
||||
public boolean removeAttachment(Permanent attachment, Ability source, Game game) {
|
||||
return computerPlayer.removeAttachment(attachment, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFromBattlefield(Permanent permanent, Game game) {
|
||||
return computerPlayer.removeFromBattlefield(permanent, game);
|
||||
public boolean removeFromBattlefield(Permanent permanent, Ability source, Game game) {
|
||||
return computerPlayer.removeFromBattlefield(permanent, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -3006,11 +3013,6 @@ public class TestPlayer implements Player {
|
|||
computerPlayer.initLife(life);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLife(int life, Game game, UUID sourceId) {
|
||||
computerPlayer.setLife(life, game, sourceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLife(int life, Game game, Ability source) {
|
||||
computerPlayer.setLife(life, game, source);
|
||||
|
|
@ -3042,8 +3044,8 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int loseLife(int amount, Game game, boolean atCombat) {
|
||||
return computerPlayer.loseLife(amount, game, atCombat);
|
||||
public int loseLife(int amount, Game game, Ability source, boolean atCombat) {
|
||||
return computerPlayer.loseLife(amount, game, source, atCombat);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -3062,28 +3064,23 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int gainLife(int amount, Game game, UUID sourceId) {
|
||||
return computerPlayer.gainLife(amount, game, sourceId);
|
||||
public int damage(int damage, UUID attackerId, Ability source, Game game) {
|
||||
return computerPlayer.damage(damage, attackerId, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damage(int damage, UUID sourceId, Game game) {
|
||||
return computerPlayer.damage(damage, sourceId, game);
|
||||
public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable) {
|
||||
return computerPlayer.damage(damage, attackerId, source, game, combatDamage, preventable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable) {
|
||||
return computerPlayer.damage(damage, sourceId, game, combatDamage, preventable);
|
||||
public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable, List<UUID> appliedEffects) {
|
||||
return computerPlayer.damage(damage, attackerId, source, game, combatDamage, preventable, appliedEffects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, List<UUID> appliedEffects) {
|
||||
return computerPlayer.damage(damage, sourceId, game, combatDamage, preventable, appliedEffects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addCounters(Counter counter, Game game) {
|
||||
return computerPlayer.addCounters(counter, game);
|
||||
public boolean addCounters(Counter counter, Ability source, Game game) {
|
||||
return computerPlayer.addCounters(counter, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -3413,8 +3410,8 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canPaySacrificeCost(Permanent permanent, UUID sourceId, UUID controllerId, Game game) {
|
||||
return computerPlayer.canPaySacrificeCost(permanent, sourceId, controllerId, game);
|
||||
public boolean canPaySacrificeCost(Permanent permanent, Ability source, UUID controllerId, Game game) {
|
||||
return computerPlayer.canPaySacrificeCost(permanent, source, controllerId, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -3538,13 +3535,8 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game) {
|
||||
return computerPlayer.moveCardToHandWithInfo(card, sourceId, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName) {
|
||||
return computerPlayer.moveCardToHandWithInfo(card, sourceId, game, withName);
|
||||
public boolean moveCardToHandWithInfo(Card card, Ability source, Game game, boolean withName) {
|
||||
return computerPlayer.moveCardToHandWithInfo(card, source, game, withName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -3563,23 +3555,23 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
|
||||
return computerPlayer.moveCardToGraveyardWithInfo(card, sourceId, game, fromZone);
|
||||
public boolean moveCardToGraveyardWithInfo(Card card, Ability source, Game game, Zone fromZone) {
|
||||
return computerPlayer.moveCardToGraveyardWithInfo(card, source, game, fromZone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName) {
|
||||
return computerPlayer.moveCardToLibraryWithInfo(card, sourceId, game, fromZone, toTop, withName);
|
||||
public boolean moveCardToLibraryWithInfo(Card card, Ability source, Game game, Zone fromZone, boolean toTop, boolean withName) {
|
||||
return computerPlayer.moveCardToLibraryWithInfo(card, source, game, fromZone, toTop, withName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone, boolean withName) {
|
||||
return computerPlayer.moveCardToExileWithInfo(card, exileId, exileName, sourceId, game, fromZone, withName);
|
||||
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, Ability source, Game game, Zone fromZone, boolean withName) {
|
||||
return computerPlayer.moveCardToExileWithInfo(card, exileId, exileName, source, game, fromZone, withName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToCommandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
|
||||
return computerPlayer.moveCardToCommandWithInfo(card, sourceId, game, fromZone);
|
||||
public boolean moveCardToCommandWithInfo(Card card, Ability source, Game game, Zone fromZone) {
|
||||
return computerPlayer.moveCardToCommandWithInfo(card, source, game, fromZone);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -3905,10 +3897,10 @@ public class TestPlayer implements Player {
|
|||
|
||||
@Override
|
||||
public void assignDamage(int damage, List<UUID> targets,
|
||||
String singleTargetName, UUID sourceId,
|
||||
String singleTargetName, UUID attackerId, Ability source,
|
||||
Game game
|
||||
) {
|
||||
computerPlayer.assignDamage(damage, targets, singleTargetName, sourceId, game);
|
||||
computerPlayer.assignDamage(damage, targets, singleTargetName, attackerId, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -295,8 +295,8 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
if (!currentGame.isPaused()) {
|
||||
for (Player player : currentGame.getPlayers().values()) {
|
||||
TestPlayer testPlayer = (TestPlayer) player;
|
||||
currentGame.cheat(player.getId(), getCommands(testPlayer));
|
||||
currentGame.cheat(player.getId(), activePlayer.getId(), getLibraryCards(testPlayer), getHandCards(testPlayer),
|
||||
currentGame.cheat(testPlayer.getId(), getCommands(testPlayer));
|
||||
currentGame.cheat(testPlayer.getId(), getLibraryCards(testPlayer), getHandCards(testPlayer),
|
||||
getBattlefieldCards(testPlayer), getGraveCards(testPlayer), getCommandCards(testPlayer));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,16 @@ public class ProtectionFromTypeTest extends CardTestPlayerBase {
|
|||
@Test
|
||||
public void testNoProtection() {
|
||||
useRedDefault();
|
||||
// Trigon of Corruption enters the battlefield with three charge counters on it.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Trigon of Corruption");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Coral Merfolk");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}, Remove a charge counter from {this}, {T}: Put a -1/-1 counter on target creature.", "Coral Merfolk");
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// Coral Merfolk should be destroyed
|
||||
assertPermanentCount(playerB, "Coral Merfolk", 0);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class SerializationTest extends CardTestPlayerBase {
|
|||
|
||||
// mark damage from infected ability
|
||||
permanent.addAbility(InfectAbility.getInstance(), null, currentGame);
|
||||
permanent.markDamage(1, permanent.getId(), currentGame, false, false);
|
||||
permanent.markDamage(1, permanent.getId(), null, currentGame, false, false);
|
||||
|
||||
// test compress (it uses default java serialization)
|
||||
Object compressed = CompressUtil.compress(permanent);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import mage.game.Graveyard;
|
|||
import mage.game.Table;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.draft.Draft;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.match.Match;
|
||||
import mage.game.match.MatchPlayer;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -121,12 +122,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setLife(int life, Game game, UUID sourceId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int loseLife(int amount, Game game, boolean at) {
|
||||
public int loseLife(int amount, Game game, Ability source, boolean atCombat) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -136,22 +132,17 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int gainLife(int amount, Game game, UUID sourceId) {
|
||||
public int damage(int damage, UUID attackerId, Ability source, Game game) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damage(int damage, UUID sourceId, Game game) {
|
||||
public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable, List<UUID> appliedEffects) {
|
||||
public int damage(int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable, List<UUID> appliedEffects) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -200,7 +191,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canPaySacrificeCost(Permanent permanent, UUID sourceId, UUID controllerId, Game game) {
|
||||
public boolean canPaySacrificeCost(Permanent permanent, Ability source, UUID controllerId, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -530,12 +521,12 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int drawCards(int num, UUID sourceId, Game game) {
|
||||
public int drawCards(int num, Ability source, Game game) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int drawCards(int num, UUID sourceId, Game game, List<UUID> appliedEffects) {
|
||||
public int drawCards(int num, Ability source, Game game, GameEvent event) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -555,7 +546,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFromBattlefield(Permanent permanent, Game game) {
|
||||
public boolean removeFromBattlefield(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -644,17 +635,17 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Cards discard(Cards cards, Ability source, Game game) {
|
||||
public Cards discard(Cards cards, boolean payForCost, Ability source, Game game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card discardOne(boolean random, Ability source, Game game) {
|
||||
public Card discardOne(boolean random, boolean payForCost, Ability source, Game game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cards discard(int amount, boolean random, Ability source, Game game) {
|
||||
public Cards discard(int amount, boolean random, boolean payForCost, Ability source, Game game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -664,7 +655,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean discard(Card card, Ability source, Game game) {
|
||||
public boolean discard(Card card, boolean payForCost, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -939,7 +930,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void selectBlockers(Game game, UUID defendingPlayerId) {
|
||||
public void selectBlockers(Ability source, Game game, UUID defendingPlayerId) {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -954,7 +945,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void assignDamage(int damage, List<UUID> targets, String singleTargetName, UUID sourceId, Game game) {
|
||||
public void assignDamage(int damage, List<UUID> targets, String singleTargetName, UUID attackerId, Ability source, Game game) {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1069,7 +1060,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean addCounters(Counter counter, Game game) {
|
||||
public boolean addCounters(Counter counter, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1084,12 +1075,12 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean addAttachment(UUID permanentId, Game game) {
|
||||
public boolean addAttachment(UUID permanentId, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAttachment(Permanent permanent, Game game) {
|
||||
public boolean removeAttachment(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1179,22 +1170,17 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game) {
|
||||
public boolean moveCardToHandWithInfo(Card card, Ability source, Game game, boolean withName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName) {
|
||||
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, Ability source, Game game, Zone fromZone, boolean withName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone, boolean withName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
|
||||
public boolean moveCardToGraveyardWithInfo(Card card, Ability source, Game game, Zone fromZone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1204,12 +1190,12 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName) {
|
||||
public boolean moveCardToLibraryWithInfo(Card card, Ability source, Game game, Zone fromZone, boolean toTop, boolean withName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToCommandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
|
||||
public boolean moveCardToCommandWithInfo(Card card, Ability source, Game game, Zone fromZone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue