forked from External/mage
* Fixed that deathtouch and lifelink did not work if the source permanent left the battlefield before the damage was dealt (e.g. Marath removing its last +1/+1 counter).
This commit is contained in:
parent
3d9357c2c9
commit
e0c7083145
2 changed files with 37 additions and 15 deletions
|
|
@ -40,10 +40,31 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
*/
|
||||
public class DeathtouchTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void simpleDeathtouchDuringCombat() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Archangel of Thune");
|
||||
// Creature - Rat 1/1
|
||||
// Deathtouch
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Typhoid Rats");
|
||||
|
||||
|
||||
attack(2, playerB, "Typhoid Rats");
|
||||
block(2, playerA, "Archangel of Thune", "Typhoid Rats");
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 23);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertGraveyardCount(playerA, "Archangel of Thune", 1);
|
||||
assertGraveyardCount(playerB, "Typhoid Rats", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if cards put into play with Lord of the Void triggered ability
|
||||
* are correctly controlled by the controller of Lord of the Void
|
||||
* e.g. the top card of the library of the current controller of Oracle of Mul Daya is revealed
|
||||
* Checks if a creature getting damage from Marath abilitity dies
|
||||
* from Deathtouch, if Marath is equiped with Deathtouch giving Equipment
|
||||
* and Marath dies from removing the +1/+1 counters.
|
||||
*/
|
||||
@Test
|
||||
public void testMarathWillOfTheWild() {
|
||||
|
|
@ -51,15 +72,17 @@ public class DeathtouchTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10);
|
||||
// Equipped creature has deathtouch and lifelink.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Basilisk Collar");
|
||||
/*
|
||||
{R}{G}{W} Legendary Creature - Elemental Beast
|
||||
Marath, Will of the Wild enters the battlefield with a number of +1/+1 counters on
|
||||
it equal to the amount of mana spent to cast it.
|
||||
{X}, Remove X +1/+1 counters from Marath: Choose one -
|
||||
* Put X +1/+1 counters on target creature; or Marath deals X damage to target creature or player; or put an X/X green Elemental creature token onto the battlefield. X can't be 0
|
||||
|
||||
*/
|
||||
* Put X +1/+1 counters on target creature
|
||||
* Marath deals X damage to target creature or player
|
||||
* Put an X/X green Elemental creature token onto the battlefield. X can't be 0
|
||||
*/
|
||||
addCard(Zone.HAND, playerA, "Marath, Will of the Wild", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Archangel of Thune");
|
||||
|
|
@ -68,20 +91,19 @@ public class DeathtouchTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN , playerA, "Marath, Will of the Wild");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {2}", "Marath, Will of the Wild");
|
||||
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{X},Remove X +1/+1 counters from Marath: Choose one - Put X +1/+1 counters on target creature; or {source} deals X damage to target creature or player; or put an X/X green Elemental creature token onto the battlefield.");
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{X},Remove X +1/+1 counters from Marath: Choose one - Put X +1/+1 counters on target creature; or {source} deals X damage to target creature or player; or put an X/X green Elemental creature token onto the battlefield.", "Archangel of Thune");
|
||||
setChoice(playerA, "X=3");
|
||||
setModeChoice(playerA, "1"); // Marath deals X damage to target creature or player
|
||||
setModeChoice(playerA, "2"); // Marath deals X damage to target creature or player
|
||||
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
// under control
|
||||
assertLife(playerA, 20);
|
||||
Permanent equipment = getPermanent("Basilisk Collar", playerA);
|
||||
Assert.assertTrue("Equipment is attached to Marath", equipment.getAttachedTo() != null);
|
||||
// assertPermanentCount(playerA, "Marath, Will of the Wild", 0);
|
||||
// assertPermanentCount(playerB, "Archangel of Thune", 0);
|
||||
assertLife(playerA, 23);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Marath, Will of the Wild", 0);
|
||||
assertPermanentCount(playerB, "Archangel of Thune", 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -621,7 +621,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
damageDone = damageCreature(damageAmount, sourceId, game, preventable, combat, markDamage, appliedEffects);
|
||||
}
|
||||
if (damageDone > 0) {
|
||||
Permanent source = game.getPermanent(sourceId);
|
||||
Permanent source = game.getPermanentOrLKIBattlefield(sourceId);
|
||||
if (source != null && source.getAbilities().containsKey(LifelinkAbility.getInstance().getId())) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
player.gainLife(damageAmount, game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue