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 b79f3ea19ae..12b941e7fac 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 @@ -367,6 +367,31 @@ public class FlashbackTest extends CardTestPlayerBase { } + @Test + public void testSnapcasterMageWithBuyback() { + addCard(Zone.BATTLEFIELD, playerA, "Island", 8); + addCard(Zone.HAND, playerA, "Snapcaster Mage", 1); + + // Buyback {5}(You may pay an additional {5} as you cast this spell. If you do, put this card into your hand as it resolves.) + // Draw a card. + addCard(Zone.GRAVEYARD, playerA, "Whispers of the Muse", 1); // {U} + + // 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. + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage"); + setChoice(playerA, "Whispers of the Muse"); + + activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Flashback"); // Flashback Whispers of the Muse + setChoice(playerA, "Yes"); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Snapcaster Mage", 1); + assertGraveyardCount(playerA, "Whispers of the Muse", 0); + assertHandCount(playerA, 1); + assertExileCount("Whispers of the Muse", 1); + + } + /** * Deep Analysis doesn't cost mana when flashbacked. */ diff --git a/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java b/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java index 8251c9fcdc7..98eb6e7752c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java @@ -186,7 +186,7 @@ class BuybackEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (event.getTargetId().equals(source.getSourceId())) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone() == Zone.STACK + if (zEvent.getFromZone() == Zone.STACK && zEvent.getToZone() == Zone.GRAVEYARD && source.getSourceId().equals(event.getSourceId())) { // if spell fizzled, the sourceId is null return true; }