From a796fe5adb910a0eeb0abf5639c8dabae410bead Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 3 Feb 2016 00:22:29 +0100 Subject: [PATCH] * Flashback - Fixed that spells without mana costs (e.g. Ancestral Vision) wrongly could be cast by flashback (fixes #1510). --- .../abilities/keywords/FlashbackTest.java | 36 +++++++++++++++++++ .../abilities/keyword/FlashbackAbility.java | 4 +++ 2 files changed, 40 insertions(+) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java index 7f0273567c6..bd953f1161e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java @@ -178,4 +178,40 @@ public class FlashbackTest extends CardTestPlayerBase { assertExileCount("Conflagrate", 1); } + + /** + * Ancestral Vision has no casting cost (this is different to a casting cost + * of {0}). Snapcaster Mage, for example, is able to give it flashback + * whilst it is in the graveyard. + * + * However the controller should not be able to cast Ancestral Visions from + * the graveyard for {0} mana. + */ + @Test + public void testFlashbackAncestralVision() { + // Suspend 4-{U} + // Target player draws three cards. + addCard(Zone.GRAVEYARD, playerA, "Ancestral Vision", 1); + + // Flash + // When Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost. + addCard(Zone.HAND, playerA, "Snapcaster Mage", 1); + + addCard(Zone.BATTLEFIELD, playerA, "Island", 2); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage"); + addTarget(playerA, "Ancestral Vision"); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback"); + addTarget(playerA, playerA); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertHandCount(playerA, "Snapcaster Mage", 0); + assertPermanentCount(playerA, "Snapcaster Mage", 1); + assertGraveyardCount(playerA, "Ancestral Vision", 1); + assertHandCount(playerA, 0); + + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java index 9b514380393..9c661c6ec1d 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java @@ -86,6 +86,10 @@ public class FlashbackAbility extends SpellAbility { if (super.canActivate(playerId, game)) { Card card = game.getCard(getSourceId()); if (card != null) { + // Cards with no Mana Costs cant't be flashbacked (e.g. Ancestral Vision) + if (card.getManaCost().isEmpty()) { + return false; + } // Flashback can never cast a split card by Fuse, because Fuse only works from hand if (card.isSplitCard()) { if (((SplitCard) card).getLeftHalfCard().getName().equals(abilityName)) {