#5935 Fix and standardise firing of TAPPED_FOR_MANA event

This commit is contained in:
Iain Monro 2019-08-15 20:41:06 +01:00
parent 0cf758ea5e
commit 48fbd30f2d
62 changed files with 556 additions and 1115 deletions

View file

@ -0,0 +1,57 @@
package org.mage.test.cards.replacement;
import mage.constants.ManaType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class ManaReflectionTest extends CardTestPlayerBase {
@Test
public void generatesCorrectManaFromMarwyn() {
addCard(Zone.BATTLEFIELD, playerA, "Mana Reflection");
addCard(Zone.BATTLEFIELD, playerA, "Marwyn, the Nurturer");
addCard(Zone.BATTLEFIELD, playerA, "Upwelling"); // Prevent mana from emptying before we can check it
addCounters(1, PhaseStep.UPKEEP, playerA, "Marwyn, the Nurturer", CounterType.P1P1, 2);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add");
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPowerToughness(playerA, "Marwyn, the Nurturer", 3, 3);
assertManaPool(playerA, ManaType.GREEN, 6);
}
@Test
public void generatesCorrectManaFromGemstoneCaverns() {
addCard(Zone.BATTLEFIELD, playerA, "Mana Reflection");
addCard(Zone.BATTLEFIELD, playerA, "Gemstone Caverns");
addCard(Zone.BATTLEFIELD, playerA, "Upwelling"); // Prevent mana from emptying before we can check it
addCounters(1, PhaseStep.UPKEEP, playerA, "Gemstone Caverns", CounterType.LUCK, 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add");
setChoice(playerA, "Green");
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
assertManaPool(playerA, ManaType.GREEN, 2);
}
@Test
public void generatesCorrectManaFromLlanowarElves() {
addCard(Zone.BATTLEFIELD, playerA, "Mana Reflection");
addCard(Zone.BATTLEFIELD, playerA, "Llanowar Elves");
addCard(Zone.BATTLEFIELD, playerA, "Upwelling"); // Prevent mana from emptying before we can check it
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add");
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
assertManaPool(playerA, ManaType.GREEN, 2);
}
}

View file

@ -574,7 +574,9 @@ public class TestPlayer implements Player {
String[] groups = command.split("\\$");
for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) {
if (permanent.getName().equals(groups[0])) {
Counter counter = new Counter(groups[1], Integer.parseInt(groups[2]));
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);
actions.remove(action);
return true;