mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
* Hallowed Moonlight - Fixed a bug in the way cards were moved to exile.
This commit is contained in:
parent
0157bf0494
commit
855ac6e4e1
3 changed files with 44 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue