From 05dcfeaaa141c7c6b6c653d36bb6c5ec4f5cd4ed Mon Sep 17 00:00:00 2001 From: LevelX2 <ludwig.hirth@online.de> Date: Wed, 26 Sep 2018 17:29:43 +0200 Subject: [PATCH] * Experimental Frenzy - Fixed a problem that casting cards from hand was not prevented (#5338). --- .../src/mage/cards/e/ExperimentalFrenzy.java | 2 +- .../abilities/keywords/JumpStartTest.java | 41 ++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/cards/e/ExperimentalFrenzy.java b/Mage.Sets/src/mage/cards/e/ExperimentalFrenzy.java index 2cee3f83b7..50dcb6b5a4 100644 --- a/Mage.Sets/src/mage/cards/e/ExperimentalFrenzy.java +++ b/Mage.Sets/src/mage/cards/e/ExperimentalFrenzy.java @@ -128,6 +128,6 @@ class ExperimentalFrenzyRestrictionEffect extends ContinuousRuleModifyingEffectI @Override public boolean applies(GameEvent event, Ability source, Game game) { return event.getPlayerId().equals(source.getControllerId()) - && event.getZone() == Zone.HAND; + && game.getState().getZone(event.getSourceId()) == Zone.HAND; } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/JumpStartTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/JumpStartTest.java index 5e250462d8..ca0be11736 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/JumpStartTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/JumpStartTest.java @@ -60,7 +60,7 @@ public class JumpStartTest extends CardTestPlayerBase { assertGraveyardCount(playerB, "Silvercoat Lion", 1); assertGraveyardCount(playerB, "Counterspell", 1); - assertHandCount(playerA, 0); // 1 from sacrificed Clue and 1 from draw of turn 3 + assertHandCount(playerA, 0); assertGraveyardCount(playerA, "Direct Current", 0); assertExileCount(playerA, "Direct Current", 1); @@ -68,4 +68,43 @@ public class JumpStartTest extends CardTestPlayerBase { assertLife(playerB, 20); } + + @Test + public void testWithExperimentalFrenzy() { + // Direct Current deals 2 damage to any target. + // Jump-start + addCard(Zone.HAND, playerA, "Direct Current", 1); // Sorcery {1}{R}{R} + // You may look at the top card of your library any time. + // You may play the top card of your library. + // You can't play cards from your hand. + // {3}{R}: Destroy Experimental Frenzy. + addCard(Zone.HAND, playerA, "Experimental Frenzy", 1); // Enchantment {3}{R} + + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 12); + addCard(Zone.HAND, playerA, "Lightning Bolt", 2); + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); // 2/2 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Direct Current", "Silvercoat Lion"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Experimental Frenzy"); + + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Direct Current with jump-start", playerB); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Experimental Frenzy", 1); + assertGraveyardCount(playerB, "Silvercoat Lion", 1); + assertGraveyardCount(playerA, "Direct Current", 0); + assertExileCount(playerA, "Direct Current", 1); + + assertHandCount(playerA, "Lightning Bolt", 1); // prevented to cast from hand by Experimental Frenzy + assertGraveyardCount(playerA, "Lightning Bolt", 1); // Discarded by using jump-start + + assertLife(playerA, 20); + assertLife(playerB, 18); + + } + }