mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
GUI, game: added source info in "choose number/amount" dialogs, added auto-choose for single possible value (part of #13638);
This commit is contained in:
parent
06242496d7
commit
e320bf241c
83 changed files with 142 additions and 106 deletions
|
|
@ -35,7 +35,7 @@ public class WillbreakerTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{B}, Remove", "Silvercoat Lion");
|
||||
setChoice(playerA, "X=0");
|
||||
//setChoice(playerA, "X=0"); // auto-choose X=0
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class HELIOSOneTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Memnite");
|
||||
|
||||
setChoice(playerA, "X=0");
|
||||
//setChoice(playerA, "X=0"); // auto-choose X=0
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}");
|
||||
addTarget(playerA, "Memnite");
|
||||
|
||||
|
|
@ -52,7 +52,10 @@ public class HELIOSOneTest extends CardTestPlayerBase {
|
|||
|
||||
// TODO: So the test suite let's you activate the ability (as it does not go to adjust targets to check them.)
|
||||
// But X=0 is not a valid choice once targets are checked (no nonland card with that MV in play).
|
||||
setChoice(playerA, "X=0");
|
||||
checkPlayableAbility("Pay X {E} ability is playable, but can't be activated",
|
||||
1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}", true);
|
||||
showAvailableAbilities("hmm", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
//setChoice(playerA, "X=0"); // auto-choose X=0
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}");
|
||||
addTarget(playerA, "Elite Vanguard"); // not a valid target for X=0 energy payment
|
||||
|
|
@ -65,7 +68,7 @@ public class HELIOSOneTest extends CardTestPlayerBase {
|
|||
} catch (AssertionError e) {
|
||||
Assert.assertTrue(
|
||||
"X=0 is not a valid choice. Error message:\n" + e.getMessage(),
|
||||
e.getMessage().contains("Message: Announce the value for {X}")
|
||||
e.getMessage().contains("Can't find ability to activate command: {3}")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2917,6 +2917,12 @@ public class TestPlayer implements Player {
|
|||
@Override
|
||||
public int announceX(int min, int max, String message, Game game, Ability source, boolean isManaPay) {
|
||||
assertAliasSupportInChoices(false);
|
||||
|
||||
// fast calc on nothing to choose
|
||||
if (min >= max) {
|
||||
return min;
|
||||
}
|
||||
|
||||
if (!choices.isEmpty()) {
|
||||
if (choices.get(0).startsWith("X=")) {
|
||||
int xValue = Integer.parseInt(choices.get(0).substring(2));
|
||||
|
|
@ -2949,8 +2955,14 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getAmount(int min, int max, String message, Game game) {
|
||||
public int getAmount(int min, int max, String message, Ability source, Game game) {
|
||||
assertAliasSupportInChoices(false);
|
||||
|
||||
// fast calc on nothing to choose
|
||||
if (min >= max) {
|
||||
return min;
|
||||
}
|
||||
|
||||
if (!choices.isEmpty()) {
|
||||
if (choices.get(0).startsWith("X=")) {
|
||||
int xValue = Integer.parseInt(choices.get(0).substring(2));
|
||||
|
|
@ -2960,7 +2972,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
this.chooseStrictModeFailed("choice", game, message);
|
||||
return computerPlayer.getAmount(min, max, message, game);
|
||||
return computerPlayer.getAmount(min, max, message, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue