mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
Refactor addCounters to fix bugs in edge cases. (#5154)
Add code to check the controller of abilities on the stack instead of the controller of their source card or object. This fixes https://github.com/magefree/mage/issues/5152
This commit is contained in:
parent
3278139da3
commit
3875f42bac
2 changed files with 65 additions and 1 deletions
|
|
@ -0,0 +1,56 @@
|
|||
package org.mage.test.cards.triggers;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
public class AbilityOwnershipTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testOwned() {
|
||||
addCard(Zone.GRAVEYARD, playerB, "Soul Snuffers");
|
||||
addCard(Zone.GRAVEYARD, playerB, "Minister of Pain");
|
||||
|
||||
addCard(Zone.HAND, playerA, "Rise of the Dark Realms");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 9);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Obelisk Spider");
|
||||
|
||||
setLife(playerA, 20);
|
||||
setLife(playerB, 20);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rise of the Dark Realms");
|
||||
setChoice(playerA, "Yes");
|
||||
addTarget(playerA, "Soul Snuffers"); // sacrifice to Exploit
|
||||
|
||||
setStopAt(1, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
// Obelisk Spider Triggers twice once for the counter on Obelisk Spider. Once for the counter on Minister of Pain.
|
||||
assertLife(playerA, 22);
|
||||
assertLife(playerB, 18);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToGraveyard() {
|
||||
addCard(Zone.GRAVEYARD, playerB, "Soul Snuffers");
|
||||
addCard(Zone.GRAVEYARD, playerB, "Minister of Pain");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Obelisk Spider");
|
||||
|
||||
addCard(Zone.HAND, playerA, "Rise of the Dark Realms");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 9);
|
||||
|
||||
setLife(playerA, 20);
|
||||
setLife(playerB, 20);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rise of the Dark Realms");
|
||||
setChoice(playerA, "Yes");
|
||||
addTarget(playerA, "Soul Snuffers"); // sacrifice to Exploit
|
||||
|
||||
setStopAt(1, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue