mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 14:32:06 -08:00
[refactor/bugfix] use rule 802.2a where appropriate. (#13179)
* [refactor/bugfix] use rule 802.2a where appropriate. Many effects which relied on getDefendingPlayerId would fail if the attacking creature had been removed from combat before they resolved, in which case the defending player ID would be null. This fixes these issues. * Add test for removing attacking creature with Defending Player triggered ability. Change allowFormer to be true by default, reduce falses to only necessary cases.
This commit is contained in:
parent
8de9fb03a4
commit
6b9532febd
8 changed files with 73 additions and 7 deletions
|
|
@ -106,4 +106,30 @@ public class RemoveFromCombatTest extends CardTestPlayerBase {
|
|||
assertLife(playerB, 20 - 2);
|
||||
assertGraveyardCount(playerB, "Jace, Memory Adept", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate rule 806.2a: Abilities which refer to Defending Player still mean that defending player, even if the
|
||||
* attacking creature is removed from combat.
|
||||
*/
|
||||
@Test
|
||||
public void test_RemoveAttackerWithDefendingPlayerTriggeredAbilityOnStack() {
|
||||
|
||||
addCard(Zone.HAND, playerA, "Swords to Plowshares", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Agate-Blade Assassin", 1); // 2/2
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
|
||||
// attack player
|
||||
attack(1, playerA, "Agate-Blade Assassin", playerB);
|
||||
// remove Agate-Blade Assassin from combat
|
||||
castSpell(1, PhaseStep.DECLARE_ATTACKERS, playerA, "Swords to Plowshares");
|
||||
addTarget(playerA, "Agate-Blade Assassin");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 20 - 1);
|
||||
assertLife(playerA, 20 + 1 /* StP */ + 1 /* Agate-Blade Assassin trigger */);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue