diff --git a/Mage.Sets/src/mage/sets/alarareborn/MeddlingMage.java b/Mage.Sets/src/mage/sets/alarareborn/MeddlingMage.java index c05a1cf39b9..21ef080034f 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/MeddlingMage.java +++ b/Mage.Sets/src/mage/sets/alarareborn/MeddlingMage.java @@ -109,15 +109,15 @@ class MeddlingMageReplacementEffect extends ContinuousRuleModifiyingEffectImpl { return null; } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == EventType.CAST_SPELL; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == EventType.CAST_SPELL) { - MageObject object = game.getObject(event.getSourceId()); - if (object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY))) { - return true; - } - } - return false; + MageObject object = game.getObject(event.getSourceId()); + return object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY)); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java b/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java index de199431991..6a58f6f827c 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java @@ -75,10 +75,10 @@ public class CavernOfSouls extends CardImpl { // As Cavern of Souls enters the battlefield, choose a creature type. this.addAbility(new AsEntersBattlefieldAbility(new CavernOfSoulsEffect(), ruleText)); - // {tap}: Add {1} to your mana pool. + // {T}: Add {1} to your mana pool. this.addAbility(new ColorlessManaAbility()); - // {tap}: Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered. + // {T}: Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered. this.addAbility(new ConditionalAnyColorManaAbility(1, new CavernOfSoulsManaBuilder())); this.addWatcher(new CavernOfSoulsWatcher()); this.addAbility(new SimpleStaticAbility(Zone.ALL, new CavernOfSoulsCantCounterEffect())); @@ -133,21 +133,28 @@ class CavernOfSoulsEffect extends OneShotEffect { class CavernOfSoulsManaBuilder extends ConditionalManaBuilder { - String creatuerType; + String creatureType; @Override public ConditionalManaBuilder setMana(Mana mana, Ability source, Game game) { Object value = game.getState().getValue(source.getSourceId() + "_type"); if (value != null && value instanceof String) { - creatuerType = (String) value; + creatureType = (String) value; } + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = game.getObject(source.getSourceId()); + if (controller != null && sourceObject != null) { + game.informPlayers(controller.getName() + " produces " + mana.toString() + " with " + sourceObject.getLogName() + + " (can only be spend to cast for creatures of type " + creatureType + " and that spell can't be countered)"); + } + return super.setMana(mana, source, game); } @Override public ConditionalMana build(Object... options) { this.mana.setFlag(true); // indicates that the mana is from second ability - return new CavernOfSoulsConditionalMana(this.mana, creatuerType); + return new CavernOfSoulsConditionalMana(this.mana, creatureType); } @Override diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/control/ExileAndReturnUnderYourControl.java b/Mage.Tests/src/test/java/org/mage/test/cards/control/ExileAndReturnUnderYourControl.java index 1ea6711938d..eb98e6c6122 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/control/ExileAndReturnUnderYourControl.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/control/ExileAndReturnUnderYourControl.java @@ -68,5 +68,42 @@ public class ExileAndReturnUnderYourControl extends CardTestPlayerBase { Assert.assertFalse("player B should play NOT with top card revealed", playerB.isTopCardRevealed()); } + @Test + public void testVillainousWealthExilesBoost() { + // Villainous Wealth {X}{B}{G}{U} + // Target opponent exiles the top X cards of his or her library. You may cast any number + // of nonland cards with converted mana cost X or less from among them without paying + // their mana costs. + addCard(Zone.HAND, playerA, "Villainous Wealth"); + addCard(Zone.HAND, playerA, "Master of Pearls"); + + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 4); + addCard(Zone.BATTLEFIELD, playerA, "Island", 4); + + // Secret Plans {G}{U} + // Face-down creatures you control get +0/+1. + // Whenever a permanent you control is turned face up, draw a card. + addCard(Zone.LIBRARY, playerB, "Secret Plans"); + skipInitShuffling(); // to keep this card on top of library + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Master of Pearls"); + setChoice(playerA, "Yes"); // cast it face down as 2/2 creature + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Villainous Wealth", playerB); + setChoice(playerA, "X=3"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Secret Plans"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Villainous Wealth", 1); + assertExileCount(playerB, 2); + assertExileCount("Secret Plans", 0); + assertPermanentCount(playerA, "Secret Plans", 1); + + assertPermanentCount(playerA, "face down creature", 1); + assertPowerToughness(playerA, "face down creature", 2, 3); + } } diff --git a/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java index ddfc2a1c260..d4a80ad55d1 100644 --- a/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java @@ -39,7 +39,6 @@ import mage.constants.Layer; import mage.constants.Outcome; import mage.constants.PhaseStep; import mage.constants.SubLayer; -import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.Target;