refactor: add new simpler technique for intervening if conditions on triggered abilities (#13037)

too many usages to fix all at once, plus condition text needs updating, but this will give a cleaner option for new implementations
This commit is contained in:
xenohedron 2024-10-27 00:19:57 -04:00 committed by GitHub
parent fb71ce8c85
commit 8a8773971d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 153 additions and 122 deletions

View file

@ -0,0 +1,51 @@
package org.mage.test.cards.single.xln;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author xenohedron
*/
public class DeadeyeTormentorTest extends CardTestPlayerBase {
private static final String tormentor = "Deadeye Tormentor"; // 2B 2/2
// Raid When Deadeye Tormentor enters, if you attacked this turn, target opponent discards a card.
@Test
public void testConditionFalse() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.HAND, playerA, tormentor);
addCard(Zone.HAND, playerB, "Ornithopter");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, tormentor);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertHandCount(playerB, "Ornithopter", 1);
}
@Test
public void testConditionTrue() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.HAND, playerA, tormentor);
addCard(Zone.HAND, playerB, "Ornithopter");
addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin");
attack(1, playerA, "Raging Goblin", playerB);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, tormentor);
addTarget(playerA, playerB);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertHandCount(playerB, "Ornithopter", 0);
assertGraveyardCount(playerB, "Ornithopter", 1);
}
}