mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 15:32:08 -08:00
* Added handling of triggered mana to available mana calculation (fixes #585).
This commit is contained in:
parent
5be6e9398a
commit
89249888b5
26 changed files with 544 additions and 96 deletions
|
|
@ -29,13 +29,16 @@ public class SasayaOrochiAscendantTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Upwelling", 1); // Enchantment {3}{G}
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reveal your hand: If you have seven or more land cards in your hand, flip");
|
||||
|
||||
activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
|
||||
activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Upwelling");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Sasaya's Essence", 1);
|
||||
assertPermanentCount(playerA, "Upwelling", 1);
|
||||
|
||||
|
|
@ -45,7 +48,89 @@ public class SasayaOrochiAscendantTest extends CardTestPlayerBase {
|
|||
assertDuplicatedManaOptions(manaOptions);
|
||||
|
||||
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||
assertManaOptions("{G}", manaOptions);
|
||||
assertManaOptions("{G}{G}{G}", manaOptions);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSasayasEssence2() {
|
||||
addCard(Zone.HAND, playerA, "Plains", 7);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Brushland", 3);
|
||||
|
||||
// Reveal your hand: If you have seven or more land cards in your hand, flip Sasaya, Orochi Ascendant.
|
||||
// Sasaya's Essence: Legendary Enchantment
|
||||
// Whenever a land you control is tapped for mana, for each other land you control with the same name, add one mana of any type that land produced.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Sasaya, Orochi Ascendant", 1);
|
||||
// Mana pools don't empty as steps and phases end.
|
||||
addCard(Zone.HAND, playerA, "Upwelling", 1); // Enchantment {3}{G}
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reveal your hand: If you have seven or more land cards in your hand, flip");
|
||||
activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
|
||||
activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Upwelling");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Sasaya's Essence", 1);
|
||||
assertPermanentCount(playerA, "Upwelling", 1);
|
||||
|
||||
assertManaPool(playerA, ManaType.GREEN, 2);
|
||||
|
||||
assertLife(playerA, 18);
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
assertDuplicatedManaOptions(manaOptions);
|
||||
|
||||
Assert.assertEquals("mana variations don't fit", 3, manaOptions.size());
|
||||
assertManaOptions("{C}{C}{C}", manaOptions);
|
||||
assertManaOptions("{G}{G}{G}", manaOptions);
|
||||
assertManaOptions("{W}{W}{W}", manaOptions);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSasayasEssence3() {
|
||||
addCard(Zone.HAND, playerA, "Plains", 7);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||
// {1}, {T}: Add {R}{G}.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mossfire Valley", 2);
|
||||
|
||||
// Reveal your hand: If you have seven or more land cards in your hand, flip Sasaya, Orochi Ascendant.
|
||||
// Sasaya's Essence: Legendary Enchantment
|
||||
// Whenever a land you control is tapped for mana, for each other land you control with the same name, add one mana of any type that land produced.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Sasaya, Orochi Ascendant", 1);
|
||||
// Mana pools don't empty as steps and phases end.
|
||||
addCard(Zone.HAND, playerA, "Upwelling", 1); // Enchantment {3}{G}
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reveal your hand: If you have seven or more land cards in your hand, flip");
|
||||
activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
|
||||
activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Upwelling");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Sasaya's Essence", 1);
|
||||
assertPermanentCount(playerA, "Upwelling", 1);
|
||||
|
||||
assertManaPool(playerA, ManaType.GREEN, 2);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
assertDuplicatedManaOptions(manaOptions);
|
||||
|
||||
Assert.assertEquals("mana variations don't fit", 4, manaOptions.size());
|
||||
assertManaOptions("{R}{R}{R}{R}{G}{G}{G}", manaOptions);
|
||||
assertManaOptions("{R}{R}{R}{G}{G}{G}{G}", manaOptions);
|
||||
assertManaOptions("{R}{R}{G}{G}{G}{G}{G}", manaOptions);
|
||||
assertManaOptions("{R}{G}{G}{G}{G}{G}{G}", manaOptions);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ public class ConditionalManaTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testWorkingWithReflectingPool() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Cavern of Souls", 1); // can give {C] or {any} mana ({any} with restrictions)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Reflecting Pool", 1); // must give {C} or {any} mana from the Cavern, but without restrictions
|
||||
|
|
@ -321,7 +320,6 @@ public class ConditionalManaTest extends CardTestPlayerBase {
|
|||
// and process all available net mana by special call like TriggeredManaAbility->getNetManaForEvent(ManaEvent xxx)
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void TriggeredManaAbilityMustGivesExtraManaOptions() {
|
||||
// TriggeredManaAbility must give extra mana options (2 red instead 1)
|
||||
// Whenever you tap a land for mana, add one mana of any type that land produced.
|
||||
|
|
@ -340,7 +338,6 @@ public class ConditionalManaTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void DictateOfKarametra_AutoPay() {
|
||||
// Whenever you tap a land for mana, add one mana of any type that land produced.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Dictate of Karametra");
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import mage.constants.ManaType;
|
|||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -133,7 +132,6 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
|
|||
* producing mana
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
public void testWithDifferentLands() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
|
||||
|
||||
|
|
@ -215,7 +213,6 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testReflectingPoolAnyManaNeedWithoutCondition() {
|
||||
// any mana source without conditions (use any mana at any time)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
|
|
@ -233,7 +230,6 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testReflectingPoolAnyManaNeedWithCondition() {
|
||||
// any mana source have condition to use (Reflecting Pool must ignore that condition)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Cavern of Souls", 1); // {C} or {any}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
package org.mage.test.cards.mana;
|
||||
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
import static org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class TappedForManaRelatedTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* This is a new rule that slightly changes how we resolve abilities that
|
||||
* trigger whenever a permanent is tapped for mana or for mana of a
|
||||
* specified type. Now, you look at what was actually produced after the
|
||||
* activated mana ability resolves. So, tapping a Gaea's Cradle while you no
|
||||
* control no creatures won't cause a Wild Growth attached to it to trigger.
|
||||
*/
|
||||
@Test
|
||||
public void TestCradleWithWildGrowthNoCreatures() {
|
||||
// {T}: Add {G} for each creature you control.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Gaea's Cradle", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
// Enchant land
|
||||
// Whenever enchanted land is tapped for mana, its controller adds {G}.
|
||||
addCard(Zone.HAND, playerA, "Wild Growth", 1); // Enchantment {G}
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wild Growth", "Gaea's Cradle");
|
||||
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Wild Growth", 1);
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||
assertManaOptions("{G}{G}", manaOptions);
|
||||
|
||||
}
|
||||
|
||||
// Mana producedc by triggered mana abilities is not calculated in manaOptions calculations yet.
|
||||
@Test
|
||||
// @Ignore
|
||||
public void TestCradleWithWildGrowthTwoCreatures() {
|
||||
// {T}: Add {G} for each creature you control.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Gaea's Cradle", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 2);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
// Enchant land
|
||||
// Whenever enchanted land is tapped for mana, its controller adds {G}.
|
||||
addCard(Zone.HAND, playerA, "Wild Growth", 1); // Enchantment {G}
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wild Growth", "Gaea's Cradle");
|
||||
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Wild Growth", 1);
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||
assertManaOptions("{G}{G}{G}{G}", manaOptions);
|
||||
|
||||
}
|
||||
|
||||
// Mana producedc by triggered mana abilities is not calculated in manaOptions calculations yet.
|
||||
@Test
|
||||
// @Ignore
|
||||
public void TestWildGrowth() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 2);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
// Enchant land
|
||||
// Whenever enchanted land is tapped for mana, its controller adds {G}.
|
||||
addCard(Zone.HAND, playerA, "Wild Growth", 1); // Enchantment {G}
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wild Growth", "Forest");
|
||||
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Wild Growth", 1);
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||
assertManaOptions("{G}{G}", manaOptions);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -63,6 +63,7 @@ import java.util.*;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import mage.Mana;
|
||||
|
||||
import static org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl.*;
|
||||
|
||||
|
|
@ -3274,7 +3275,17 @@ public class TestPlayer implements Player {
|
|||
public ManaOptions getManaAvailable(Game game) {
|
||||
return computerPlayer.getManaAvailable(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAvailableTriggeredMana(List<Mana> availableTriggeredMana) {
|
||||
computerPlayer.addAvailableTriggeredMana(availableTriggeredMana);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<List<Mana>> getAvailableTriggeredMana() {
|
||||
return computerPlayer.getAvailableTriggeredMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActivatedAbility> getPlayable(Game game, boolean hidden) {
|
||||
return computerPlayer.getPlayable(game, hidden);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import mage.target.common.TargetCardInLibrary;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import mage.Mana;
|
||||
|
||||
/**
|
||||
* @author Quercitron
|
||||
|
|
@ -1037,6 +1038,21 @@ public class PlayerStub implements Player {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAvailableTriggeredMana(List<Mana> availableTriggeredMan) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<List<Mana>> getAvailableTriggeredMana() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int announceXMana(int min, int max, String message, Game game, Ability ability) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActivatedAbility> getPlayable(Game game, boolean hidden) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -209,11 +209,32 @@ public class ManaOptionsTest extends CardTestPlayerBase {
|
|||
assertManaOptions("{C}{G}{Any}", manaOptions);
|
||||
}
|
||||
|
||||
// Nykthos, Shrine to Nyx
|
||||
@Test
|
||||
public void testNykthos4a() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Sedge Scorpion", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||
// {T}: Add {C}.
|
||||
// {2}, {T}: Choose a color. Add an amount of mana of that color equal to your devotion to that color. (Your devotion to a color is the number of mana symbols of that color in the mana costs of permanents you control.)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Nykthos, Shrine to Nyx", 1);
|
||||
|
||||
setStopAt(1, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
assertDuplicatedManaOptions(manaOptions);
|
||||
|
||||
Assert.assertEquals("mana variations don't fit", 2, manaOptions.size());
|
||||
assertManaOptions("{C}{G}{G}{G}", manaOptions);
|
||||
assertManaOptions("{G}{G}{G}{G}{G}", manaOptions);
|
||||
|
||||
}
|
||||
|
||||
// Nykthos, Shrine to Nyx
|
||||
// {T}: Add {C}.
|
||||
// {2}, {T}: Choose a color. Add an amount of mana of that color equal to your devotion to that color. (Your devotion to a color is the number of mana symbols of that color in the mana costs of permanents you control.)
|
||||
@Test
|
||||
public void testNykthos4() {
|
||||
public void testNykthos4b() {
|
||||
// If a land is tapped for two or more mana, it produces {C} instead of any other type and amount.
|
||||
// Each spell a player casts costs {1} more to cast for each other spell that player has cast this turn.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Damping Sphere", 1);
|
||||
|
|
@ -399,7 +420,6 @@ public class ManaOptionsTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore // TriggeredManaAbilities not supported yet for getAvailableMana
|
||||
public void testCryptGhast() {
|
||||
//Extort (Whenever you cast a spell, you may pay {WB}. If you do, each opponent loses 1 life and you gain that much life.)
|
||||
// Whenever you tap a Swamp for mana, add {B} (in addition to the mana the land produces).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue