mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
* Fixed available mana calculation for Cryptic Trilobite and Titans' Nest. Added some improvements for available mana calculation of conditional mana.
This commit is contained in:
parent
3d989b24ac
commit
768f1bec4f
100 changed files with 507 additions and 144 deletions
|
|
@ -15,19 +15,20 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
*/
|
||||
public class GatherSpecimensTest extends CardTestPlayerBase {
|
||||
|
||||
/* Gather Specimens {3}{U}{U}{U}
|
||||
/* Gather Specimens - Instant {3}{U}{U}{U}
|
||||
*
|
||||
* If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead.
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testFromHandEffect() {
|
||||
setStrictChooseMode(true);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
|
||||
addCard(Zone.HAND, playerA, "Gather Specimens", 1);
|
||||
|
||||
addCard(Zone.LIBRARY, playerB, "Mountain", 1);
|
||||
addCard(Zone.HAND, playerB, "Memnite", 1);
|
||||
addCard(Zone.HAND, playerB, "Memnite", 1); // Artifact Creature (1/1) {0}
|
||||
|
||||
castSpell(2, PhaseStep.UPKEEP, playerA, "Gather Specimens");
|
||||
|
||||
|
|
@ -37,6 +38,10 @@ public class GatherSpecimensTest extends CardTestPlayerBase {
|
|||
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, "Gather Specimens", 1);
|
||||
|
||||
assertPermanentCount(playerA, "Memnite", 1);
|
||||
assertPermanentCount(playerB, "Memnite", 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package org.mage.test.cards.mana;
|
||||
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
|
|
@ -8,12 +7,14 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
|
||||
public class GaeasGradleTest extends CardTestPlayerBase {
|
||||
|
||||
// {T}: Add {G} for each creature you control.
|
||||
private final String cradle = "Gaea's Cradle";
|
||||
private final String bears = "Grizzly Bears";
|
||||
private final String thopter = "Ornithopter";
|
||||
|
||||
@Test
|
||||
public void testGradle(){
|
||||
setStrictChooseMode(true);
|
||||
addCard(Zone.BATTLEFIELD, playerA, cradle);
|
||||
addCard(Zone.BATTLEFIELD, playerA, bears, 2);
|
||||
addCard(Zone.BATTLEFIELD, playerB, thopter);
|
||||
|
|
@ -23,6 +24,8 @@ public class GaeasGradleTest extends CardTestPlayerBase {
|
|||
checkManaPool("gaeas cradle ",1, PhaseStep.PRECOMBAT_MAIN, playerA, "G", 2);
|
||||
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class RosheenMeandererManaXTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void test_KickerWithXMana() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 6 + 2 - 4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 6);
|
||||
addCard(Zone.HAND, playerA, "Verdeloth the Ancient");
|
||||
//
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Rosheen Meanderer");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package org.mage.test.cards.mana;
|
||||
package org.mage.test.cards.mana.conditional;
|
||||
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
|
|
@ -6,7 +6,6 @@ import mage.constants.PhaseStep;
|
|||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -20,13 +19,17 @@ public class ConditionalManaTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void testNormalUse() {
|
||||
setStrictChooseMode(true);
|
||||
|
||||
// {T}: Add one mana of any color. Spend this mana only to cast a multicolored spell.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Pillar of the Paruns", 2);
|
||||
// Instant {G}{W}
|
||||
|
||||
// Target player gains 7 life.
|
||||
addCard(Zone.HAND, playerA, "Heroes' Reunion", 1);
|
||||
addCard(Zone.HAND, playerA, "Heroes' Reunion", 1); // Instant {G}{W}
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Heroes' Reunion", playerA);
|
||||
setChoice(playerA, "Green"); // Choose color
|
||||
setChoice(playerA, "White"); // Choose color
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
|
@ -358,4 +361,37 @@ public class ConditionalManaTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerB, 20 - 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTwoConditionalMana(){
|
||||
setStrictChooseMode(true);
|
||||
|
||||
// At the beginning of your upkeep, look at the top card of your library. You may put that card into your graveyard.
|
||||
// Exile a card from your graveyard: Add {C}. Spend this mana only to cast a colored spell without {X} in its mana cost.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Titans' Nest"); // Enchantment {1}{B}{G}{U}
|
||||
|
||||
// {T}: Add {C}{C}{C}{C}. Spend this mana only on costs that contain {X}.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Rosheen Meanderer", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
|
||||
addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears", 2);
|
||||
|
||||
|
||||
setChoice(playerA, "No"); // Put [Top Card of Library] into your graveyard?
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Titans' Nest", 1);
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("mana variations don't fit", 4, manaOptions.size());
|
||||
assertManaOptions("{R}", manaOptions);
|
||||
assertManaOptions("{C}{C}{R}[{TitansNestManaCondition}]", manaOptions);
|
||||
assertManaOptions("{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}]", manaOptions);
|
||||
assertManaOptions("{C}{C}{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}{TitansNestManaCondition}]", manaOptions);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package org.mage.test.cards.mana.conditional;
|
||||
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
import static org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class CrypticTrilobiteTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testAvailableManaCalculation(){
|
||||
setStrictChooseMode(true);
|
||||
|
||||
// Cryptic Trilobite enters the battlefield with X +1/+1 counters on it.
|
||||
// Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities.
|
||||
// {1}, {T}: Put a +1/+1 counter on Cryptic Trilobite.
|
||||
addCard(Zone.HAND, playerA, "Cryptic Trilobite"); // Creature {X}{X}
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cryptic Trilobite");
|
||||
setChoice(playerA, "X=5");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Cryptic Trilobite", 1);
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||
assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{C}{C}[{CrypticTrilobiteManaCondition}]", manaOptions);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUse(){
|
||||
setStrictChooseMode(true);
|
||||
|
||||
// Cryptic Trilobite enters the battlefield with X +1/+1 counters on it.
|
||||
// Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities.
|
||||
// {1}, {T}: Put a +1/+1 counter on Cryptic Trilobite.
|
||||
addCard(Zone.HAND, playerA, "Cryptic Trilobite"); // Creature {X}{X}
|
||||
// Flying
|
||||
// {2}: Deathknell Kami gets +1/+1 until end of turn. Sacrifice it at the beginning of the next end step.
|
||||
// Soulshift 1 (When this creature dies, you may return target Spirit card with converted mana cost 1 or less from your graveyard to your hand.)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Deathknell Kami"); // Creature (0/1)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cryptic Trilobite");
|
||||
setChoice(playerA, "X=5");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}:");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}:");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Cryptic Trilobite", 1);
|
||||
assertCounterCount(playerA, "Cryptic Trilobite", CounterType.P1P1, 3);
|
||||
|
||||
assertPowerToughness(playerA, "Deathknell Kami", 2, 3);
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||
assertManaOptions("{C}{C}{C}{C}{C}{C}[{CrypticTrilobiteManaCondition}]", manaOptions);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCantUse(){
|
||||
setStrictChooseMode(true);
|
||||
|
||||
// Cryptic Trilobite enters the battlefield with X +1/+1 counters on it.
|
||||
// Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities.
|
||||
// {1}, {T}: Put a +1/+1 counter on Cryptic Trilobite.
|
||||
addCard(Zone.HAND, playerA, "Cryptic Trilobite"); // Creature {X}{X}
|
||||
|
||||
// {4}{W}: Return another target creature you control to its owner's hand.
|
||||
addCard(Zone.HAND, playerA, "Aegis Automaton"); // Creature {2} (0/2)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cryptic Trilobite");
|
||||
setChoice(playerA, "X=5");
|
||||
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
|
||||
checkPlayableAbility("can't play", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Aegis Automaton", false);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Cryptic Trilobite", 1);
|
||||
assertCounterCount(playerA, "Cryptic Trilobite", CounterType.P1P1, 5);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
|
||||
package org.mage.test.cards.mana.conditional;
|
||||
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
import static org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class TitansNestTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testTitansNest(){
|
||||
setStrictChooseMode(true);
|
||||
|
||||
// At the beginning of your upkeep, look at the top card of your library. You may put that card into your graveyard.
|
||||
// Exile a card from your graveyard: Add {C}. Spend this mana only to cast a colored spell without {X} in its mana cost.
|
||||
addCard(Zone.HAND, playerA, "Titans' Nest"); // Enchantment {1}{B}{G}{U}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
|
||||
addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears", 2);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Titans' Nest");
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Titans' Nest", 1);
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||
assertManaOptions("{C}{C}[{TitansNestManaCondition}]", manaOptions);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import org.junit.Assert;
|
|||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import mage.ConditionalMana;
|
||||
|
||||
public class ManaOptionsTestUtils {
|
||||
|
||||
|
|
@ -18,29 +19,34 @@ public class ManaOptionsTestUtils {
|
|||
//mana info
|
||||
//logger.info(playerA.getManaPool().getMana().toString());
|
||||
//logger.info(playerA.getManaAvailable(currentGame).toString());
|
||||
|
||||
public static boolean manaOptionsContain(ManaOptions list, String searchMana){
|
||||
for(Mana mana: list){
|
||||
if (mana.toString().equals(searchMana)){
|
||||
return true;
|
||||
public static boolean manaOptionsContain(ManaOptions list, String searchMana) {
|
||||
for (Mana mana : list) {
|
||||
if (mana instanceof ConditionalMana) {
|
||||
if ((mana.toString() + ((ConditionalMana)mana).getConditionString()).equals(searchMana)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (mana.toString().equals(searchMana)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void assertManaOptions(String searchMana, ManaOptions manaList){
|
||||
if(!manaOptionsContain(manaList, searchMana)){
|
||||
public static void assertManaOptions(String searchMana, ManaOptions manaList) {
|
||||
if (!manaOptionsContain(manaList, searchMana)) {
|
||||
Assert.fail("Can't find " + searchMana + " in " + manaList.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertDuplicatedManaOptions(ManaOptions manaList){
|
||||
public static void assertDuplicatedManaOptions(ManaOptions manaList) {
|
||||
Set<String> list = new HashSet<>();
|
||||
for(Mana mana: manaList){
|
||||
for (Mana mana : manaList) {
|
||||
String s = mana.toString();
|
||||
if(list.contains(s)){
|
||||
if (list.contains(s)) {
|
||||
Assert.fail("Found duplicated mana option " + s + " in " + manaList.toString());
|
||||
}else{
|
||||
} else {
|
||||
list.add(s);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue