diff --git a/Mage.Sets/src/mage/sets/dissension/PillarOfTheParuns.java b/Mage.Sets/src/mage/sets/dissension/PillarOfTheParuns.java index 9b44a9a48a7..c1be32d897e 100644 --- a/Mage.Sets/src/mage/sets/dissension/PillarOfTheParuns.java +++ b/Mage.Sets/src/mage/sets/dissension/PillarOfTheParuns.java @@ -54,7 +54,7 @@ public class PillarOfTheParuns extends CardImpl { super(ownerId, 176, "Pillar of the Paruns", Rarity.RARE, new CardType[]{CardType.LAND}, ""); this.expansionSetCode = "DIS"; - // {tap}: Add one mana of any color to your mana pool. Spend this mana only to cast a multicolored spell. + // {T}: Add one mana of any color to your mana pool. Spend this mana only to cast a multicolored spell. this.addAbility(new ConditionalAnyColorManaAbility(1, new PillarOfTheParunsManaBuilder())); } @@ -92,17 +92,11 @@ class PillarOfTheParunsConditionalMana extends ConditionalMana { class MultiColoredSpellCastManaCondition extends ManaCondition implements Condition { - private static final MulticoloredPredicate multicolored = new MulticoloredPredicate(); - - private static class LazyHolder { - private static final MulticoloredPredicate multicolored = new MulticoloredPredicate(); - } - @Override public boolean apply(Game game, Ability source) { if (source instanceof SpellAbility) { MageObject object = game.getObject(source.getSourceId()); - if (object != null && LazyHolder.multicolored.apply(object, game)) { + if (object != null && object.getColor().getColorCount() > 1) { return true; } } @@ -113,4 +107,4 @@ class MultiColoredSpellCastManaCondition extends ManaCondition implements Condit public boolean apply(Game game, Ability source, UUID originalId) { return apply(game, source); } -} \ No newline at end of file +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java new file mode 100644 index 00000000000..197b794d575 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java @@ -0,0 +1,77 @@ +/* + * 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.mana; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ + +public class ConditionalManaTest extends CardTestPlayerBase { + + @Test + public void testNormalUse() { + // {T}: Add one mana of any color to your mana pool. 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); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Heroes' Reunion", playerA); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Heroes' Reunion", 1); + assertHandCount(playerA, "Heroes' Reunion", 0); // player A could not cast it + assertLife(playerA, 27); + } + + @Test + public void testNotAllowedUse() { + // {T}: Add one mana of any color to your mana pool. Spend this mana only to cast a multicolored spell. + addCard(Zone.BATTLEFIELD, playerA, "Pillar of the Paruns", 2); + addCard(Zone.HAND, playerA, "Silvercoat Lion", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion"); + playerA.addChoice("White"); + playerA.addChoice("White"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertHandCount(playerA, "Silvercoat Lion", 1); // player A could not cast Silvercoat Lion because the conditional mana is not available + } + +}