From 45818f3a510aa2775f96572e6f2805b7362d6519 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 4 Apr 2017 15:32:39 +0200 Subject: [PATCH] * Celestial Dawn - Fixed that it was not possible to pay colorless costs with non white mana. --- Mage.Sets/src/mage/cards/c/CelestialDawn.java | 7 +-- Mage.Sets/src/mage/cards/l/LordOfLineage.java | 9 ++- ...dManaAsThoughItWereManaOfAnyColorTest.java | 60 +++++++++++++++++++ .../abilities/effects/AsThoughManaEffect.java | 9 +++ Mage/src/main/java/mage/players/ManaPool.java | 2 +- 5 files changed, 77 insertions(+), 10 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/CelestialDawn.java b/Mage.Sets/src/mage/cards/c/CelestialDawn.java index 3ea52e72b1c..0f3367eae8d 100644 --- a/Mage.Sets/src/mage/cards/c/CelestialDawn.java +++ b/Mage.Sets/src/mage/cards/c/CelestialDawn.java @@ -27,6 +27,7 @@ */ package mage.cards.c; +import java.util.UUID; import mage.MageObject; import mage.ObjectColor; import mage.abilities.Ability; @@ -49,8 +50,6 @@ import mage.players.ManaPoolItem; import mage.players.Player; import mage.sets.Commander; -import java.util.UUID; - /** * * @author LevelX2 @@ -267,8 +266,8 @@ class CelestialDawnSpendColorlessManaEffect extends AsThoughEffectImpl implement @Override public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) { - if (mana.getWhite() == 0 && ManaType.COLORLESS != manaType) { - return null; + if (mana.getWhite() == 0) { + return ManaType.COLORLESS; } return manaType; } diff --git a/Mage.Sets/src/mage/cards/l/LordOfLineage.java b/Mage.Sets/src/mage/cards/l/LordOfLineage.java index 2f557c675cd..c7c25e6a969 100644 --- a/Mage.Sets/src/mage/cards/l/LordOfLineage.java +++ b/Mage.Sets/src/mage/cards/l/LordOfLineage.java @@ -28,10 +28,6 @@ package mage.cards.l; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; @@ -41,6 +37,9 @@ import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.permanent.token.Token; @@ -64,7 +63,7 @@ public class LordOfLineage extends CardImpl { this.power = new MageInt(5); this.toughness = new MageInt(5); - // this card is the second face of double-faced card + // this card is the second face of double-faced card Bloodline Keeper this.nightCard = true; this.transformable = true; diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/SpendManaAsThoughItWereManaOfAnyColorTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/SpendManaAsThoughItWereManaOfAnyColorTest.java index 0743a0962e6..6673dc09721 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/SpendManaAsThoughItWereManaOfAnyColorTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/SpendManaAsThoughItWereManaOfAnyColorTest.java @@ -29,6 +29,7 @@ package org.mage.test.cards.mana; import mage.constants.PhaseStep; import mage.constants.Zone; +import mage.counters.CounterType; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -69,4 +70,63 @@ public class SpendManaAsThoughItWereManaOfAnyColorTest extends CardTestPlayerBas } + /** + * Celestial Dawn does not allow spending of off-color mana for any purpose. + * Had a Black Market down, was trying to cast Darksteel Forge, could not + * spend the black mana on the forge. + */ + @Test + public void testCelestialDawn() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8); + // Lands you control are Plains. + // Nonland cards you own that aren't on the battlefield, spells you control, and nonland permanents you control are white. + // You may spend white mana as though it were mana of any color. + // You may spend other mana only as though it were colorless mana. + addCard(Zone.BATTLEFIELD, playerA, "Celestial Dawn", 1); + + // Whenever a creature dies, put a charge counter on Black Market. + // At the beginning of your precombat main phase, add {B} to your mana pool for each charge counter on Black Market. + addCard(Zone.BATTLEFIELD, playerA, "Black Market", 1); + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); + + // Artifacts you control are indestructible. + addCard(Zone.HAND, playerA, "Darksteel Forge", 1); // Artifact {9} + + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); + addCard(Zone.HAND, playerB, "Lightning Bolt", 1); + + castSpell(1, PhaseStep.UPKEEP, playerB, "Lightning Bolt", "Silvercoat Lion"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Darksteel Forge"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Silvercoat Lion", 1); + assertGraveyardCount(playerB, "Lightning Bolt", 1); + assertCounterCount("Black Market", CounterType.CHARGE, 1); + + assertPermanentCount(playerA, "Darksteel Forge", 1); + + } + + @Test + public void testCelestialDawnAny() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + // Lands you control are Plains. + // Nonland cards you own that aren't on the battlefield, spells you control, and nonland permanents you control are white. + // You may spend white mana as though it were mana of any color. + // You may spend other mana only as though it were colorless mana. + addCard(Zone.BATTLEFIELD, playerA, "Celestial Dawn", 1); + + addCard(Zone.HAND, playerA, "Vedalken Mastermind", 1); // Creature {U}{U} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vedalken Mastermind"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Vedalken Mastermind", 1); + + } } diff --git a/Mage/src/main/java/mage/abilities/effects/AsThoughManaEffect.java b/Mage/src/main/java/mage/abilities/effects/AsThoughManaEffect.java index ef062750352..60d067116e8 100644 --- a/Mage/src/main/java/mage/abilities/effects/AsThoughManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/AsThoughManaEffect.java @@ -40,6 +40,15 @@ import mage.players.ManaPoolItem; public interface AsThoughManaEffect extends AsThoughEffect { // return a mana type that can be used to pay a mana cost instead of the normally needed mana type + /** + * + * @param manaType type of mana with which the player wants to pay the cost + * @param mana mana pool item to pay from the cost + * @param affectedControllerId + * @param source + * @param game + * @return + */ ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game); } diff --git a/Mage/src/main/java/mage/players/ManaPool.java b/Mage/src/main/java/mage/players/ManaPool.java index 71e131b29be..dbfac4fb149 100644 --- a/Mage/src/main/java/mage/players/ManaPool.java +++ b/Mage/src/main/java/mage/players/ManaPool.java @@ -118,7 +118,7 @@ public class ManaPool implements Serializable { return false; } if (autoPayment && autoPaymentRestricted && !wasManaAddedBeyondStock() && manaType != unlockedManaType) { - // if automatic restricted payment and there is laready mana in the pool + // if automatic restricted payment and there is already mana in the pool // and the needed mana type was not unlocked, nothing will be paid return false; }