* Deathmist Raptor - Fixed that the return ability did wrongly also work if the Raptor had left the graveyard.

This commit is contained in:
LevelX2 2015-05-31 19:17:15 +02:00
parent 1b690e5c8c
commit bc21b8d475
2 changed files with 44 additions and 7 deletions

View file

@ -29,6 +29,7 @@ package mage.sets.dragonsoftarkir;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.TurnedFaceUpAllTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -63,7 +64,7 @@ public class DeathmistRaptor extends CardImpl {
this.addAbility(DeathtouchAbility.getInstance());
// Whenever a permanent you control is turned face up, you may return Deathmist Raptor from your graveyard to the battlefield face up or face down.
this.addAbility(new TurnedFaceUpAllTriggeredAbility(Zone.GRAVEYARD, new DeathmistRaptorEffect(), new FilterControlledPermanent(), false, true));
this.addAbility(new TurnedFaceUpAllTriggeredAbility(Zone.GRAVEYARD, new DeathmistRaptorEffect(), new FilterControlledPermanent("a permanent you control"), false, true));
// Megamorph {4}{G}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{4}{G}"), true));
@ -98,10 +99,10 @@ class DeathmistRaptorEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Card card = game.getCard(source.getSourceId());
if (controller != null && card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId(), false,
controller.chooseUse(Outcome.Detriment, "Return " + card.getName() + " face down to battlefield (otherwise face up)?", game));
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
if (controller != null && (sourceObject instanceof Card)) {
controller.putOntoBattlefieldWithInfo((Card) sourceObject, game, Zone.GRAVEYARD, source.getSourceId(), false,
controller.chooseUse(Outcome.Detriment, "Return " + sourceObject.getLogName() + " face down to battlefield (otherwise face up)?", game));
return true;
}
return false;

View file

@ -37,7 +37,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
* @author LevelX2
*/
public class ReturnToBattlefieldUnderYourControlTargetEffectTest extends CardTestPlayerBase {
public class ReturnToBattlefieldEffectsTest extends CardTestPlayerBase {
@Test
public void testSaffiEriksdotter() {
@ -115,5 +115,41 @@ public class ReturnToBattlefieldUnderYourControlTargetEffectTest extends CardTes
assertExileCount("Arcbound Worker", 1);
}
/**
* With my opponent's Deathmist Raptor return-to-battlefield trigger on the stack,
* I exiled the Deathmist Raptor with Pharika, God of Affliction. However, the Deathmist Raptor
* returned to the battlefield from exile, though it should not have because it had
* changed zones so was a different object.
*/
@Test
public void testDeathmistRaptor() {
// Deathtouch
// Whenever a permanent you control is turned face up, you may return Deathmist Raptor from your graveyard to the battlefield face up or face down.
// Megamorph {4}{G}
addCard(Zone.GRAVEYARD, playerA, "Deathmist Raptor");
addCard(Zone.HAND, playerA, "Pine Walker");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
addCard(Zone.BATTLEFIELD, playerB, "Forest", 1);
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
// {B}{G}: Exile target creature card from a graveyard. It's owner puts a 1/1 black and green Snake enchantment creature token with deathtouch onto the battlefield.
addCard(Zone.BATTLEFIELD, playerB, "Pharika, God of Affliction", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker");
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{4}{G}: Turn this face-down permanent face up.");
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerB, "{B}{G}: Exile target creature card from a graveyard",
"Deathmist Raptor", "Whenever a permanent you control is turned face up");
setStopAt(3, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerB, "Pharika, God of Affliction", 1);
assertPermanentCount(playerA, "Snake", 1);
assertPermanentCount(playerA, "Pine Walker", 1);
assertExileCount("Deathmist Raptor", 1);
}
}