* Obstinate Baloth - Fixed a bug that EntersBattlefieldTriggeredAbilities did not work if the triggering creature entered and left the battlefield during the resolution of an effect (#606).

This commit is contained in:
LevelX2 2014-10-23 19:55:44 +02:00
parent cc6f1f0010
commit e244f5d87f
2 changed files with 31 additions and 2 deletions

View file

@ -64,5 +64,34 @@ public class ObstinateBalothTest extends CardTestPlayerBase {
assertLife(playerA, 20);
assertLife(playerB, 24); // + 4 from Obstinate Baloth entering the battlefield
}
}
/*
Obstinate Baloth enters the battlefield and will also be sacrificed during the
resolution of Smallpox. So it's triggered ability goes to the stack as the
Obstinate Baloth has already left the battlefield again.
So EntersBattlefieldTriggeredAbility has to work in all zones as a consequence.
*/
@Test
public void TestWithSmallpox() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
// Each player loses 1 life, discards a card, sacrifices a creature, then sacrifices a land.
addCard(Zone.HAND, playerA, "Smallpox");
addCard(Zone.HAND, playerB, "Obstinate Baloth");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Smallpox");
setChoice(playerB, "Obstinate Baloth"); // comes into play after directly after discard
setChoice(playerB, "Obstinate Baloth"); // and can and has to be sacrificed here
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Smallpox", 1);
assertPermanentCount(playerB, "Obstinate Baloth", 0);
assertGraveyardCount(playerB, "Obstinate Baloth", 1);
assertLife(playerA, 19);
assertLife(playerB, 23); // -1 from Smallpox + 4 from Obstinate Baloth entering the battlefield
}
}

View file

@ -56,7 +56,7 @@ public class EntersBattlefieldTriggeredAbility extends TriggeredAbilityImpl {
}
public EntersBattlefieldTriggeredAbility(Effect effect, boolean optional, String rulePrefix) {
super(Zone.BATTLEFIELD, effect, optional);
super(Zone.ALL, effect, optional); // Zone.All because a creature with trigger can be put into play and be sacrificed during the resolution of an effect (discard Obstinate Baloth with Smallpox)
this.rulePrefix = rulePrefix;
}