* Afflict - Fixed that life loss of triggered afflict ability was not applied if creature with afflict was removed from battlefield before life loss effect resolved (fixes #3694).

This commit is contained in:
LevelX2 2017-07-27 11:33:45 +02:00
parent 52cc8b46b1
commit d0e610e83b
3 changed files with 58 additions and 10 deletions

View file

@ -7,14 +7,14 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
public class AfflictTest extends CardTestPlayerBase {
private String khenra = "Khenra Eternal";
private String elves = "Llanowar Elves";
private final String khenra = "Khenra Eternal";
private final String elves = "Llanowar Elves";
@Test
public void testBecomesBlocked(){
public void testBecomesBlocked() {
addCard(Zone.BATTLEFIELD, playerA, khenra);
addCard(Zone.BATTLEFIELD, playerB, elves );
addCard(Zone.BATTLEFIELD, playerB, elves);
attack(1, playerA, khenra);
block(1, playerB, elves, khenra);
@ -27,10 +27,10 @@ public class AfflictTest extends CardTestPlayerBase {
}
@Test
public void testNotBlocked(){
public void testNotBlocked() {
addCard(Zone.BATTLEFIELD, playerA, khenra);
addCard(Zone.BATTLEFIELD, playerB, elves );
addCard(Zone.BATTLEFIELD, playerB, elves);
attack(1, playerA, khenra);
@ -40,4 +40,36 @@ public class AfflictTest extends CardTestPlayerBase {
assertLife(playerB, 18);
}
// My afflict didn't come through after using Endless Sands on my own creature. The afflict ability was on the stack already.
@Test
public void testRemoveAfflictCreatureAfterAfflictIsOnTheStack() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
// Afflict 2 (Whenever this creature becomes blocked, defending player loses 2 life.)
// {1}{R}: Frontline Devastator gets +1/+0 until end of turn.
addCard(Zone.BATTLEFIELD, playerA, "Frontline Devastator");
// {T}: Add {C} to your mana pool.
// {2}, {T}: Exile target creature you control.
// {4}, {T}, Sacrifice Endless Sands: Return each creature card exiled with Endless Sands to the battlefield under its owners control.
addCard(Zone.BATTLEFIELD, playerA, "Endless Sands");
// Deathtouch
// When Ruin Rat dies, exile target card from an opponent's graveyard.
addCard(Zone.BATTLEFIELD, playerB, "Ruin Rat"); // Creature 1/1
attack(1, playerA, "Frontline Devastator");
block(1, playerB, "Ruin Rat", "Frontline Devastator");
activateAbility(1, PhaseStep.DECLARE_BLOCKERS, playerA, "{2},", "Frontline Devastator");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertExileCount(playerA, "Frontline Devastator", 1);
assertPermanentCount(playerB, "Ruin Rat", 1);
assertLife(playerB, 18);
}
}