diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java index 9055fc5763..f3f299705b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java @@ -27,10 +27,8 @@ */ package org.mage.test.cards.abilities.keywords; -import mage.abilities.keyword.HexproofAbility; import mage.constants.PhaseStep; import mage.constants.Zone; -import mage.game.permanent.Permanent; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -70,5 +68,5 @@ public class ManifestTest extends CardTestPlayerBase { // not tapped assertTapped("face down creature", false); } - + } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java index f6cc00537a..689ba24e9f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java @@ -401,4 +401,33 @@ public class MorphTest extends CardTestPlayerBase { assertPermanentCount(playerA, "face down creature", 1); } + + /** + * I played a Akroma, Angel of Fury face down, and my opponent tried to counter it. + * The counter failed and Akroma face successfully play face down, when it should have + * been countered. (The card text on akroma should not prevent her from being countered). + */ + + @Test + public void testRuleModifyingEffectsFromManifestedCardWontBeAppliedAbilities() { + addCard(Zone.HAND, playerA, "Akroma, Angel of Fury", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + + addCard(Zone.HAND, playerB, "Counterspell", 1); + addCard(Zone.BATTLEFIELD, playerB, "Island", 2); + + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Fury"); + setChoice(playerA, "Yes"); // cast it face down as 2/2 creature + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Counterspell", "Akroma, Angel of Fury"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerB, 20); + + assertGraveyardCount(playerB, "Counterspell", 1); + assertGraveyardCount(playerA, "Akroma, Angel of Fury", 1); + + } } diff --git a/Mage/src/mage/abilities/effects/ContinuousEffects.java b/Mage/src/mage/abilities/effects/ContinuousEffects.java index 220b9570a1..2bbc85cf77 100644 --- a/Mage/src/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/mage/abilities/effects/ContinuousEffects.java @@ -67,6 +67,7 @@ import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentCard; +import mage.game.stack.Spell; import mage.players.Player; import mage.target.common.TargetCardInHand; import org.apache.log4j.Logger; @@ -416,6 +417,11 @@ public class ContinuousEffects implements Serializable { if (permanent.isFaceDown() && !ability.getWorksFaceDown()) { return false; } + } else if (object instanceof Spell) { + Spell spell = (Spell)object; + if (spell.isFaceDown() && !ability.getWorksFaceDown()) { + return false; + } } } return exists; @@ -651,24 +657,26 @@ public class ContinuousEffects implements Serializable { } for (Ability sourceAbility : continuousRuleModifyingEffects.getAbility(effect.getId())) { if (!(sourceAbility instanceof StaticAbility) || sourceAbility.isInUseableZone(game, null, false)) { - if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) { - effect.setValue("targetAbility", targetAbility); - if (effect.applies(event, sourceAbility, game)) { - if (!checkPlayableMode) { - String message = effect.getInfoMessage(sourceAbility, event, game); - if (message != null && !message.isEmpty()) { - if (effect.sendMessageToUser()) { - Player player = game.getPlayer(event.getPlayerId()); - if (player != null) { - game.informPlayer(player, message); + if (checkAbilityStillExists(sourceAbility, effect, event, game)) { + if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) { + effect.setValue("targetAbility", targetAbility); + if (effect.applies(event, sourceAbility, game)) { + if (!checkPlayableMode) { + String message = effect.getInfoMessage(sourceAbility, event, game); + if (message != null && !message.isEmpty()) { + if (effect.sendMessageToUser()) { + Player player = game.getPlayer(event.getPlayerId()); + if (player != null) { + game.informPlayer(player, message); + } + } + if (effect.sendMessageToGameLog()) { + game.informPlayers(message); } } - if (effect.sendMessageToGameLog()) { - game.informPlayers(message); - } } + return true; } - return true; } } }