diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/BestowTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/BestowTest.java index 017aa0d9c96..c684ea65402 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/BestowTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/BestowTest.java @@ -231,5 +231,45 @@ public class BestowTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Nyxborn Rollicker", 0); assertGraveyardCount(playerA, "Nyxborn Rollicker", 1); - } + } + + /** + * Test that CMC of a spell cast with bestowed is correct + * Disdainful Stroke doesn't check converted mana cost correctly. Opponent was + * able to use it to counter a Hypnotic Siren cast with Bestow. + */ + @Test + public void bestowCheckForCorrectCMC() { + addCard(Zone.BATTLEFIELD, playerA, "Island", 7); + // Enchantment Creature — Siren + // 1/1 + // Bestow {5}{U}{U} (If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature.) + // Flying + // You control enchanted creature. + // Enchanted creature gets +1/+1 and has flying. + addCard(Zone.HAND, playerA, "Hypnotic Siren"); + // Instant {1}{U} + // Counter target spell with converted mana cost 4 or greater. + addCard(Zone.HAND, playerB, "Disdainful Stroke"); + addCard(Zone.BATTLEFIELD, playerB, "Island", 2); + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Hypnotic Siren using bestow", "Silvercoat Lion"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Disdainful Stroke", "Hypnotic Siren"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + // + assertHandCount(playerA, "Hypnotic Siren", 0); + assertGraveyardCount(playerA, "Hypnotic Siren", 0); + assertHandCount(playerB, "Disdainful Stroke", 1); + assertPermanentCount(playerA, "Hypnotic Siren", 1); + + // because cast with bestow, Boon Satyr may not be tapped + assertPermanentCount(playerA, "Silvercoat Lion", 1); + assertPowerToughness(playerA, "Silvercoat Lion", 3,3); + + } } diff --git a/Mage/src/mage/abilities/keyword/BestowAbility.java b/Mage/src/mage/abilities/keyword/BestowAbility.java index 6f933711cc3..5c3c1823904 100644 --- a/Mage/src/mage/abilities/keyword/BestowAbility.java +++ b/Mage/src/mage/abilities/keyword/BestowAbility.java @@ -41,6 +41,7 @@ import mage.constants.Duration; import mage.constants.Layer; import static mage.constants.Layer.TypeChangingEffects_4; import mage.constants.Outcome; +import mage.constants.SpellAbilityType; import mage.constants.SubLayer; import mage.constants.TimingRule; import mage.constants.Zone; @@ -108,6 +109,7 @@ public class BestowAbility extends SpellAbility { public BestowAbility(Card card, String manaString) { super(new ManaCostsImpl(manaString), card.getName() + " using bestow"); + this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE; this.timing = TimingRule.SORCERY; TargetPermanent auraTarget = new TargetCreaturePermanent(); this.addTarget(auraTarget); diff --git a/Mage/src/mage/game/stack/Spell.java b/Mage/src/mage/game/stack/Spell.java index 2ea2c858ebd..bed5d9ac863 100644 --- a/Mage/src/mage/game/stack/Spell.java +++ b/Mage/src/mage/game/stack/Spell.java @@ -28,6 +28,9 @@ package mage.game.stack; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.Mana; @@ -47,7 +50,11 @@ import mage.abilities.keyword.BestowAbility; import mage.abilities.keyword.MorphAbility; import mage.cards.Card; import mage.cards.SplitCard; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SpellAbilityType; +import mage.constants.Zone; import mage.counters.Counter; import mage.counters.Counters; import mage.game.Game; @@ -59,10 +66,6 @@ import mage.target.Target; import mage.target.TargetAmount; import mage.watchers.Watcher; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - /** * * @author BetaSteward_at_googlemail.com @@ -181,7 +184,7 @@ public class Spell implements StackObject, Card { // if muliple modes are selected, and there are modes with targets, then at least one mode has to have a legal target or // When resolving a fused split spell with multiple targets, treat it as you would any spell with multiple targets. // If all targets are illegal when the spell tries to resolve, the spell is countered and none of its effects happen. - // If at least one target is still legal at that time, the spell resolves, but an illegal target can’t perform any actions + // If at least one target is still legal at that time, the spell resolves, but an illegal target can't perform any actions // or have any actions performed on it. legalParts |= spellAbilityHasLegalParts(spellAbility, game); } @@ -635,7 +638,14 @@ public class Spell implements StackObject, Card { index = symbolString.indexOf("{X}"); } } - cmc += spellAbility.getManaCosts().convertedManaCost() + spellAbility.getManaCostsToPay().getX() * xMultiplier; + if (this.getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) { + cmc += spellAbility.getManaCostsToPay().getX() * xMultiplier; + } else { + cmc += spellAbility.getManaCosts().convertedManaCost() + spellAbility.getManaCostsToPay().getX() * xMultiplier; + } + } + if (this.getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) { + cmc += getCard().getManaCost().convertedManaCost(); } return cmc; }