mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 15:32:08 -08:00
Additional fixes for #6771 (modal spells resolve order)
This commit is contained in:
parent
6dccaee9a4
commit
da4a44445b
8 changed files with 120 additions and 64 deletions
|
|
@ -14,7 +14,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class OneOrMoreTest extends CardTestPlayerBase {
|
||||
|
|
@ -26,7 +25,7 @@ public class OneOrMoreTest extends CardTestPlayerBase {
|
|||
* the games can use last known info of the legal target.
|
||||
*/
|
||||
@Test
|
||||
public void testSubtleStrikeFirstMode() {
|
||||
public void test_ChooseModes_AsCardOrder() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
|
||||
// Choose one or more —
|
||||
// 1 • Counter target spell
|
||||
|
|
@ -38,24 +37,64 @@ public class OneOrMoreTest extends CardTestPlayerBase {
|
|||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sublime Epiphany", "Silvercoat Lion");
|
||||
setModeChoice(playerA, "3");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sublime Epiphany");
|
||||
setModeChoice(playerA, "3");
|
||||
setModeChoice(playerA, "4");
|
||||
addTarget(playerA, "Silvercoat Lion");
|
||||
setModeChoice(playerA, "5");
|
||||
addTarget(playerA, playerB);
|
||||
addTarget(playerA, "Silvercoat Lion"); // for 3
|
||||
addTarget(playerA, "Silvercoat Lion"); // for 4
|
||||
addTarget(playerA, playerB); // for 5
|
||||
setModeChoice(playerA, null);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertHandCount(playerB, 1);
|
||||
assertHandCount(playerA, "Silvercoat Lion", 1);
|
||||
|
||||
|
||||
assertPowerToughness(playerA, "Silvercoat Lion", 2, 2);
|
||||
|
||||
|
||||
Permanent perm = getPermanent("Silvercoat Lion");
|
||||
Assert.assertTrue("Silvercoat Lion has to be a Token", perm instanceof PermanentToken);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_ChooseModes_AsCustomOrder() {
|
||||
// user can select modes in any order, but resolves/targets must be standard (in same order as card's text)
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
|
||||
// Choose one or more —
|
||||
// 1 • Counter target spell
|
||||
// 2 • Counter target activated or triggered ability.
|
||||
// 3 • Return target nonland permanent to its owner's hand.
|
||||
// 4 • Create a token that's a copy of target creature you control.
|
||||
// 5 • Target player draws a card.
|
||||
addCard(Zone.HAND, playerA, "Sublime Epiphany"); // Instant {4}{U}{U}
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sublime Epiphany");
|
||||
setModeChoice(playerA, "4");
|
||||
setModeChoice(playerA, "5");
|
||||
setModeChoice(playerA, "3");
|
||||
addTarget(playerA, "Silvercoat Lion"); // for 3
|
||||
addTarget(playerA, "Silvercoat Lion"); // for 4
|
||||
addTarget(playerA, playerB); // for 5
|
||||
setModeChoice(playerA, null);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertHandCount(playerB, 1);
|
||||
assertHandCount(playerA, "Silvercoat Lion", 1);
|
||||
|
||||
assertPowerToughness(playerA, "Silvercoat Lion", 2, 2);
|
||||
|
||||
Permanent perm = getPermanent("Silvercoat Lion");
|
||||
Assert.assertTrue("Silvercoat Lion has to be a Token", perm instanceof PermanentToken);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1780,10 +1780,10 @@ public class TestPlayer implements Player {
|
|||
modesSet.remove(0);
|
||||
return null;
|
||||
}
|
||||
int selectedMode = Integer.parseInt(modesSet.get(0));
|
||||
int needMode = Integer.parseInt(modesSet.get(0));
|
||||
int i = 1;
|
||||
for (Mode mode : modes.getAvailableModes(source, game)) {
|
||||
if (i == selectedMode) {
|
||||
if (i == needMode) {
|
||||
modesSet.remove(0);
|
||||
return mode;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue