* Fixed a bug of colorless mana (e.g. caused Heartbeat of Spring not working with Urza's lands).

This commit is contained in:
LevelX2 2016-02-16 17:15:47 +01:00
parent bf934137e8
commit f54c675c4b
15 changed files with 203 additions and 97 deletions

View file

@ -90,4 +90,47 @@ public class DrawTriggeredTest extends CardTestPlayerBase {
assertHandCount(playerA, 4); // 2 * 2 from Sphinx = 4
}
/**
* two consecrated sphinxes do not work properly, only gives one player
* additional draw
*
*/
@Test
public void TwoConsecratedSphinxDifferentPlayers() {
// Flying
// Whenever an opponent draws a card, you may draw two cards.
addCard(Zone.BATTLEFIELD, playerA, "Consecrated Sphinx", 1);
// Flying
// Whenever an opponent draws a card, you may draw two cards.
addCard(Zone.BATTLEFIELD, playerB, "Consecrated Sphinx", 1);
setChoice(playerA, "Yes");
setChoice(playerA, "No");
setChoice(playerA, "No");
setChoice(playerB, "Yes");
setChoice(playerB, "No");
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute();
assertHandCount(playerB, 3); // 1 from start of turn 1 and 4 from Opponents draw of 2 cards
assertHandCount(playerA, 2); // 2 from Sphinx triggered by the normal draw
}
@Test
public void TwoConsecratedSphinxSamePlayer() {
// Flying
// Whenever an opponent draws a card, you may draw two cards.
addCard(Zone.BATTLEFIELD, playerA, "Consecrated Sphinx", 2);
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute();
assertHandCount(playerB, 1); // 1 from start of turn 1 and 4 from Opponents draw of 2 cards
assertHandCount(playerA, 4); // 2 from Sphinx triggered by the normal draw
}
}

View file

@ -0,0 +1,66 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.triggers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class HeartbeatOfSpringTest extends CardTestPlayerBase {
/**
* Heartbeat of Spring does not function on urza's
*/
@Test
public void testWorksForUrzasLand() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
// {T}: Add {C} to your mana pool. If you control an Urza's Power-Plant and an Urza's Tower, add {C}{C} to your mana pool instead.
addCard(Zone.HAND, playerA, "Urza's Mine", 1);
// Whenever a player taps a land for mana, that player adds one mana to his or her mana pool of any type that land produced.
addCard(Zone.HAND, playerA, "Heartbeat of Spring"); // {2}{G}
// Whenever a player casts a white spell, you may gain 1 life.
addCard(Zone.HAND, playerA, "Angel's Feather"); // {2}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Heartbeat of Spring");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Urza's Mine");
activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}:");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Angel's Feather");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Heartbeat of Spring", 1);
assertPermanentCount(playerA, "Angel's Feather", 1);
}
}

View file

@ -393,6 +393,7 @@ public class TestPlayer implements Player {
command = command.substring(command.indexOf("manaActivate:") + 13);
String[] groups = command.split("\\$");
List<MageObject> manaObjects = computerPlayer.getAvailableManaProducers(game);
for (MageObject mageObject : manaObjects) {
if (mageObject instanceof Permanent) {
for (Ability manaAbility : ((Permanent) mageObject).getAbilities(game).getAvailableManaAbilities(Zone.BATTLEFIELD, game)) {

View file

@ -321,7 +321,7 @@ public class ManaOptionsTest extends CardTestPlayerBase {
public void testMageRingNetwork2() {
// {T}: Add {C} to your mana pool.
// {T}, {1} : Put a storage counter on Mage-Ring Network.
// {T}, Remove X storage counters from Mage-Ring Network: Add {X} to your mana pool.
// {T}, Remove any number of storage counters from Mage-Ring Network: Add {C} to your mana pool for each storage counter removed this way.
addCard(Zone.BATTLEFIELD, playerA, "Mage-Ring Network", 1);
addCounters(1, PhaseStep.UPKEEP, playerA, "Mage-Ring Network", CounterType.STORAGE, 4);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
@ -332,9 +332,8 @@ public class ManaOptionsTest extends CardTestPlayerBase {
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 2, manaOptions.size());
Assert.assertEquals("{C}{W}{B}", getManaOption(0, manaOptions));
Assert.assertEquals("{4}{W}{B}", getManaOption(1, manaOptions));
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
Assert.assertEquals("{C}{C}{C}{C}{W}{B}", getManaOption(0, manaOptions));
}
@Test