Test framework: added command to show available mana;

This commit is contained in:
Oleg Agafonov 2020-01-04 20:15:43 +04:00
parent 90478932a3
commit b3ec79f467
2 changed files with 22 additions and 2 deletions

View file

@ -816,6 +816,15 @@ public class TestPlayer implements Player {
wasProccessed = true;
}
// show available mana
if (params[0].equals(SHOW_COMMAND_AVAILABLE_MANA) && params.length == 1) {
printStart(action.getActionName());
printMana(game, computerPlayer.getManaAvailable(game));
printEnd();
actions.remove(action);
wasProccessed = true;
}
// show aliases
if (params[0].equals(SHOW_COMMAND_ALIASES) && params.length == 1) {
printStart(action.getActionName());
@ -906,9 +915,14 @@ public class TestPlayer implements Player {
}
}
private void printMana(Game game, ManaOptions manaOptions) {
System.out.println("Total mana options: " + manaOptions.size());
manaOptions.forEach(mana -> {
System.out.println(mana.toString());
});
}
private void printAbilities(Game game, List<Ability> abilities) {
System.out.println("Total abilities: " + (abilities != null ? abilities.size() : 0));
if (abilities == null) {
return;

View file

@ -77,6 +77,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
public static final String SHOW_COMMAND_GRAVEYEARD = "GRAVEYARD";
public static final String SHOW_COMMAND_EXILE = "EXILE";
public static final String SHOW_COMMAND_AVAILABLE_ABILITIES = "AVAILABLE_ABILITIES";
public static final String SHOW_COMMAND_AVAILABLE_MANA = "AVAILABLE_MANA";
public static final String SHOW_COMMAND_ALIASES = "ALIASES";
// TODO: add target player param to commands
@ -421,6 +422,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
show(showName, turnNum, step, player, SHOW_COMMAND_AVAILABLE_ABILITIES);
}
public void showAvaileableMana(String showName, int turnNum, PhaseStep step, TestPlayer player) {
show(showName, turnNum, step, player, SHOW_COMMAND_AVAILABLE_MANA);
}
public void showAliases(String showName, int turnNum, PhaseStep step, TestPlayer player) {
show(showName, turnNum, step, player, SHOW_COMMAND_ALIASES);
}
@ -1347,6 +1352,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, Player target) {
//Assert.assertNotEquals("", cardName);
// warning, target in spell cast command setups without choose target call
player.addAction(turnNum, step, "activate:Cast " + cardName + "$targetPlayer=" + target.getName());
}