diff --git a/Mage.Sets/src/mage/cards/d/Defossilize.java b/Mage.Sets/src/mage/cards/d/Defossilize.java index e659de51347..6893d7ee1c2 100644 --- a/Mage.Sets/src/mage/cards/d/Defossilize.java +++ b/Mage.Sets/src/mage/cards/d/Defossilize.java @@ -65,6 +65,7 @@ class DefossilizeEffect extends OneShotEffect { return false; } player.moveCards(card, Zone.BATTLEFIELD, source, game); + game.getState().processAction(game); Permanent permanent = game.getPermanent(card.getId()); if (permanent == null) { return false; diff --git a/Mage.Sets/src/mage/cards/j/JadelightSpelunker.java b/Mage.Sets/src/mage/cards/j/JadelightSpelunker.java index 82a60894596..a44e7339aae 100644 --- a/Mage.Sets/src/mage/cards/j/JadelightSpelunker.java +++ b/Mage.Sets/src/mage/cards/j/JadelightSpelunker.java @@ -26,8 +26,8 @@ public final class JadelightSpelunker extends CardImpl { // When Jadelight Spelunker enters the battlefield, it explores X times. this.addAbility(new EntersBattlefieldTriggeredAbility( - new ExploreSourceEffect(ManacostVariableValue.ETB, false, "{it}") - .setText("it explores X times. (To have it explore, reveal the top card of your library. " + new ExploreSourceEffect(ManacostVariableValue.ETB, false, "it") + .setText("it explores X times. (To have it explore, reveal the top card of your library. " + "Put that card into your hand if it's a land. Otherwise, put a +1/+1 counter on that creature, " + "then put the card back or put it into your graveyard.)") )); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExploreTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExploreTest.java index cab9a1a24f7..776fd85fef2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExploreTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExploreTest.java @@ -7,7 +7,6 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * * @author xenohedron */ public class ExploreTest extends CardTestPlayerBase { @@ -148,5 +147,62 @@ public class ExploreTest extends CardTestPlayerBase { assertGraveyardCount(playerA, enter,1); assertLibraryCount(playerA, 0); } + + @Test + public void exploreTwice() { + String jr = "Jadelight Ranger"; + addCard(Zone.BATTLEFIELD, playerA, ww); + addCard(Zone.HAND, playerA, jr); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 3); + removeAllCardsFromLibrary(playerA); + skipInitShuffling(); + addCard(Zone.LIBRARY, playerA, quicksand, 2); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, jr); + + setChoice(playerA, "Whenever a creature you control explores"); // order trigger + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + setStrictChooseMode(true); + execute(); + + assertCounterCount(jr, CounterType.P1P1, 0); + assertCounterCount(ww, CounterType.P1P1, 2); + assertLife(playerA, 26); + assertHandCount(playerA, quicksand, 2); + assertGraveyardCount(playerA, 0); + assertLibraryCount(playerA, 0); + } + + @Test + public void exploreXTimes() { + String js = "Jadelight Spelunker"; + addCard(Zone.BATTLEFIELD, playerA, ww); + addCard(Zone.HAND, playerA, js); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 4); + removeAllCardsFromLibrary(playerA); + skipInitShuffling(); + addCard(Zone.LIBRARY, playerA, gg, 3); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, js); + setChoice(playerA, "X=3"); + setChoice(playerA, false); // no to graveyard + setChoice(playerA, true); // yes to graveyard + setChoice(playerA, false); // no to graveyard + + setChoice(playerA, "Whenever a creature you control explores"); // order trigger + setChoice(playerA, "Whenever a creature you control explores"); // order trigger + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + setStrictChooseMode(true); + execute(); + + assertCounterCount(js, CounterType.P1P1, 3); + assertCounterCount(ww, CounterType.P1P1, 3); + assertLife(playerA, 29); + assertHandCount(playerA, gg, 0); + assertGraveyardCount(playerA, gg, 1); + assertLibraryCount(playerA, gg, 2); + } } diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java index e0bf71de8bb..6da0b161d4a 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java @@ -17,7 +17,7 @@ import mage.players.Player; import java.util.UUID; /** - * @author TheElk801, JayDi85 + * @author TheElk801, JayDi85, Susucr, xenohedron */ public class ExploreSourceEffect extends OneShotEffect { @@ -44,7 +44,7 @@ public class ExploreSourceEffect extends OneShotEffect { this.amount = amount; // triggered ability text gen will replace {this} with "it" where applicable - staticText = explorerText + " explores" + (showAbilityHint ? REMINDER_TEXT : ""); + staticText = "{this} explores" + (showAbilityHint ? REMINDER_TEXT : ""); } protected ExploreSourceEffect(final ExploreSourceEffect effect) { @@ -70,6 +70,10 @@ public class ExploreSourceEffect extends OneShotEffect { } for (int i = 0; i < amount; ++i) { + GameEvent event = new GameEvent(GameEvent.EventType.EXPLORE, permanentId, source, permanent.getControllerId()); + if (game.replaceEvent(event)) { + continue; + } // 701.40a Certain abilities instruct a permanent to explore. To do so, that permanent’s controller reveals // the top card of their library. If a land card is revealed this way, that player puts that card into their // hand. Otherwise, that player puts a +1/+1 counter on the exploring permanent and may put the revealed @@ -92,7 +96,7 @@ public class ExploreSourceEffect extends OneShotEffect { // the exploring creature receives a +1/+1 counter. addCounter(game, permanent, source); } - + game.getState().processAction(game); // 701.40b A permanent “explores” after the process described in rule 701.40a is complete, even if some or all of // those actions were impossible. game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EXPLORED, permanentId, source, permanent.getControllerId())); diff --git a/Mage/src/main/java/mage/game/events/GameEvent.java b/Mage/src/main/java/mage/game/events/GameEvent.java index 4fa62d7736b..61a54eddbae 100644 --- a/Mage/src/main/java/mage/game/events/GameEvent.java +++ b/Mage/src/main/java/mage/game/events/GameEvent.java @@ -75,7 +75,7 @@ public class GameEvent implements Serializable { ZONE_CHANGE_GROUP, DRAW_CARDS, // event calls for multi draws only (if player draws 2+ cards at once) DRAW_CARD, DREW_CARD, - EXPLORED, + EXPLORE, EXPLORED, // targetId is exploring permanent ECHO_PAID, MIRACLE_CARD_REVEALED, /* MADNESS_CARD_EXILED,