diff --git a/Mage.Sets/src/mage/sets/eventide/BatwingBrume.java b/Mage.Sets/src/mage/sets/eventide/BatwingBrume.java index c7226b9495..1d2cf21e63 100644 --- a/Mage.Sets/src/mage/sets/eventide/BatwingBrume.java +++ b/Mage.Sets/src/mage/sets/eventide/BatwingBrume.java @@ -45,6 +45,7 @@ import mage.constants.Rarity; import mage.filter.common.FilterAttackingCreature; import mage.game.Game; import mage.players.Player; +import mage.watchers.common.ManaSpentToCastWatcher; /** * @@ -69,6 +70,7 @@ public class BatwingBrume extends CardImpl { new BatwingBrumeEffect(), new ManaWasSpentCondition(ColoredManaSymbol.B), "Each player loses 1 life for each attacking creature he or she controls if {B} was spent to cast {this}")); this.addInfo("Info1", "<i>(Do both if {W}{B} was spent.)<i>"); + this.addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/eventide/CankerousThirst.java b/Mage.Sets/src/mage/sets/eventide/CankerousThirst.java index b184e11b2e..26e06b9f84 100644 --- a/Mage.Sets/src/mage/sets/eventide/CankerousThirst.java +++ b/Mage.Sets/src/mage/sets/eventide/CankerousThirst.java @@ -39,6 +39,7 @@ import mage.constants.Duration; import mage.constants.ManaType; import mage.constants.Rarity; import mage.target.common.TargetCreaturePermanent; +import mage.watchers.common.ManaSpentToCastWatcher; /** * @@ -65,6 +66,7 @@ public class CankerousThirst extends CardImpl { "If {G} was spent to cast {this}, you may have target creature get +3/+3 until end of turn")); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.addInfo("Info1", "<i>(Do both if {B}{G} was spent.)<i>"); + this.addWatcher(new ManaSpentToCastWatcher()); } public CankerousThirst(final CankerousThirst card) { diff --git a/Mage.Sets/src/mage/sets/eventide/InvertTheSkies.java b/Mage.Sets/src/mage/sets/eventide/InvertTheSkies.java index b4c562fa77..c3e4db7546 100644 --- a/Mage.Sets/src/mage/sets/eventide/InvertTheSkies.java +++ b/Mage.Sets/src/mage/sets/eventide/InvertTheSkies.java @@ -47,6 +47,7 @@ import mage.constants.SubLayer; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.watchers.common.ManaSpentToCastWatcher; /** * @@ -72,6 +73,7 @@ public class InvertTheSkies extends CardImpl { new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.U)), "and creatures you control gain flying until end of turn if {U} was spent to cast it")); this.addInfo("Info1", "<i>(Do both if {G}{U} was spent.)<i>"); + this.addWatcher(new ManaSpentToCastWatcher()); } public InvertTheSkies(final InvertTheSkies card) { diff --git a/Mage.Sets/src/mage/sets/eventide/Moonhold.java b/Mage.Sets/src/mage/sets/eventide/Moonhold.java index 9bff533544..f2fff80e21 100644 --- a/Mage.Sets/src/mage/sets/eventide/Moonhold.java +++ b/Mage.Sets/src/mage/sets/eventide/Moonhold.java @@ -45,6 +45,7 @@ import mage.constants.Rarity; import mage.game.Game; import mage.game.events.GameEvent; import mage.target.TargetPlayer; +import mage.watchers.common.ManaSpentToCastWatcher; /** * @@ -72,6 +73,7 @@ public class Moonhold extends CardImpl { new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.W)))); this.getSpellAbility().addTarget(new TargetPlayer()); this.addInfo("Info1", "<i>(Do both if {R}{W} was spent.)</i>"); + this.addWatcher(new ManaSpentToCastWatcher()); } public Moonhold(final Moonhold card) { diff --git a/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java b/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java index ec48471c4b..7b13336ef5 100644 --- a/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java +++ b/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.TargetController; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; +import mage.watchers.common.ManaSpentToCastWatcher; /** * @@ -71,6 +72,7 @@ public class UnnervingAssault extends CardImpl { new BoostAllEffect(1, 0, Duration.EndOfTurn, filter2, false), new ManaWasSpentCondition(ColoredManaSymbol.R), " and creatures you control get +1/0 until end of turn if {R} was spent to cast it")); this.addInfo("Info1", "<i>(Do both if {U}{R} was spent.)</i>"); + this.addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/guildpact/TinStreetHooligan.java b/Mage.Sets/src/mage/sets/guildpact/TinStreetHooligan.java index 90434468cb..1ac034abfd 100644 --- a/Mage.Sets/src/mage/sets/guildpact/TinStreetHooligan.java +++ b/Mage.Sets/src/mage/sets/guildpact/TinStreetHooligan.java @@ -39,6 +39,7 @@ import mage.constants.CardType; import mage.constants.ColoredManaSymbol; import mage.constants.Rarity; import mage.target.common.TargetArtifactPermanent; +import mage.watchers.common.ManaSpentToCastWatcher; /** * @@ -59,8 +60,9 @@ public class TinStreetHooligan extends CardImpl { // When Tin Street Hooligan enters the battlefield, if {G} was spent to cast Tin Street Hooligan, destroy target artifact. Ability ability = new EntersBattlefieldTriggeredAbility(new ConditionalOneShotEffect(new DestroyTargetEffect(), new ManaWasSpentCondition(ColoredManaSymbol.G), "if {G} was spent to cast {this}, destroy target artifact"), false); - ability.addTarget(new TargetArtifactPermanent()); + ability.addTarget(new TargetArtifactPermanent()); this.addAbility(ability); + this.addWatcher(new ManaSpentToCastWatcher()); } public TinStreetHooligan(final TinStreetHooligan card) { diff --git a/Mage.Sets/src/mage/sets/shadowmoor/DawnglowInfusion.java b/Mage.Sets/src/mage/sets/shadowmoor/DawnglowInfusion.java index 4aa3e3816a..eab04ec0ff 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/DawnglowInfusion.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/DawnglowInfusion.java @@ -39,6 +39,7 @@ import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; import mage.constants.ColoredManaSymbol; import mage.constants.ManaType; +import mage.watchers.common.ManaSpentToCastWatcher; /** * @@ -62,6 +63,7 @@ public class DawnglowInfusion extends CardImpl { new GainLifeEffect(xValue), new ManaWasSpentCondition(ColoredManaSymbol.W), " And X life if {W} was spent to cast it")); this.addInfo("Info1", "<i>(Do both if {G}{W} was spent.)</i>"); + this.addWatcher(new ManaSpentToCastWatcher()); } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java b/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java index 2eda8ae39c..2fca287e7d 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java @@ -39,6 +39,7 @@ import mage.constants.Rarity; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.watchers.common.ManaSpentToCastWatcher; /** * @@ -68,6 +69,7 @@ public class Firespout extends CardImpl { new DamageAllEffect(3, filter2), new ManaWasSpentCondition(ColoredManaSymbol.G), " And 3 damage to each creature with flying if {G} was spent to cast it")); this.addInfo("Info1", "<i>(Do both if {R}{G} was spent.)</i>"); + this.addWatcher(new ManaSpentToCastWatcher()); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java new file mode 100644 index 0000000000..795a478da6 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java @@ -0,0 +1,79 @@ +/* + * 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.conditional; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ + +public class ManaWasSpentToCastTest extends CardTestPlayerBase { + + @Test + public void testArtifactWillBeDestroyed() { + // Tin Street Hooligan - Creature 2/1 {1}{R} + // When Tin Street Hooligan enters the battlefield, if {G} was spent to cast Tin Street Hooligan, destroy target artifact. + addCard(Zone.HAND, playerA, "Tin Street Hooligan"); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + + addCard(Zone.BATTLEFIELD, playerB, "Abzan Banner"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tin Street Hooligan"); + addTarget(playerA, "Abzan Banner"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Tin Street Hooligan", 1); + assertPermanentCount(playerB, "Abzan Banner", 0); + } + + @Test + public void testArtifactWontBeDestroyed() { + // Tin Street Hooligan - Creature 2/1 {1}{R} + // When Tin Street Hooligan enters the battlefield, if {G} was spent to cast Tin Street Hooligan, destroy target artifact. + addCard(Zone.HAND, playerA, "Tin Street Hooligan"); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + + addCard(Zone.BATTLEFIELD, playerB, "Abzan Banner"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tin Street Hooligan"); + addTarget(playerA, "Abzan Banner"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Tin Street Hooligan", 1); + assertPermanentCount(playerB, "Abzan Banner", 1); + } + +} \ No newline at end of file