diff --git a/Mage.Sets/src/mage/sets/magicorigins/HallowedMoonlight.java b/Mage.Sets/src/mage/sets/magicorigins/HallowedMoonlight.java index c4cb42fc138..aaaf39be668 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/HallowedMoonlight.java +++ b/Mage.Sets/src/mage/sets/magicorigins/HallowedMoonlight.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; @@ -89,9 +90,12 @@ class HallowedMoonlightEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - EntersTheBattlefieldEvent entersTheBattlefieldEvent = (EntersTheBattlefieldEvent) event; - controller.moveCards(entersTheBattlefieldEvent.getTarget(), Zone.EXILED, source, game, false, false, false, null); + Card targetCard = game.getCard(event.getTargetId()); + if (targetCard == null) { + targetCard = ((EntersTheBattlefieldEvent) event).getTarget(); + } + if (controller != null && targetCard != null) { + controller.moveCards(targetCard, Zone.EXILED, source, game, false, false, false, null); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/timeshifted/GemstoneMine.java b/Mage.Sets/src/mage/sets/timeshifted/GemstoneMine.java index 60298b92a7e..d5d151a8bcc 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/GemstoneMine.java +++ b/Mage.Sets/src/mage/sets/timeshifted/GemstoneMine.java @@ -54,10 +54,10 @@ public class GemstoneMine extends CardImpl { // Gemstone Mine enters the battlefield with three mining counters on it. this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.MINING.createInstance(3)))); - // {tap}, Remove a mining counter from Gemstone Mine: Add one mana of any color to your mana pool. If there are no mining counters on Gemstone Mine, sacrifice it. + // {T}, Remove a mining counter from Gemstone Mine: Add one mana of any color to your mana pool. If there are no mining counters on Gemstone Mine, sacrifice it. Ability ability = new AnyColorManaAbility(); ability.addCost(new RemoveCountersSourceCost(CounterType.MINING.createInstance(1))); - ability.addEffect(new ConditionalOneShotEffect(new SacrificeSourceEffect(), new SourceHasCounterCondition(CounterType.MINING, 0,0), "If there are no mining counters on Gemstone Mine, sacrifice it")); + ability.addEffect(new ConditionalOneShotEffect(new SacrificeSourceEffect(), new SourceHasCounterCondition(CounterType.MINING, 0, 0), "If there are no mining counters on {this}, sacrifice it")); this.addAbility(ability); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/HallowedMoonlightTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/HallowedMoonlightTest.java index 739018feb35..d1ce158f8f4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/HallowedMoonlightTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/HallowedMoonlightTest.java @@ -76,4 +76,39 @@ public class HallowedMoonlightTest extends CardTestPlayerBase { } + /** + * I cast Rally the Ancestors with many creatures in my graveyard. Opponent + * responds with Hallowed Moonlight. After Rally the Ancestors resolves, the + * creature cards in my graveyard remain in my graveyard, but are also added + * to the exile zone. + */ + @Test + public void testRallyTheAncestors() { + addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); + // Until end of turn, if a creature would enter the battlefield and it wasn't cast, exile it instead. + // Draw a card. + addCard(Zone.HAND, playerA, "Hallowed Moonlight"); + + addCard(Zone.BATTLEFIELD, playerB, "Plains", 6); + // Return each creature card with converted mana cost X or less from your graveyard to the battlefield. + // Exile those creatures at the beginning of your next upkeep. Exile Rally the Ancestors. + addCard(Zone.HAND, playerB, "Rally the Ancestors"); // Instant - {X}{W}{W} + addCard(Zone.GRAVEYARD, playerB, "Pillarfield Ox"); + addCard(Zone.GRAVEYARD, playerB, "Silvercoat Lion"); + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Rally the Ancestors"); + setChoice(playerB, "X=4"); + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Hallowed Moonlight", NO_TARGET, "Rally the Ancestors"); + + setStopAt(2, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerA, "Hallowed Moonlight", 1); + + assertExileCount("Rally the Ancestors", 1); + assertExileCount("Pillarfield Ox", 1); + assertExileCount("Silvercoat Lion", 1); + + } + }