game: added runtime check for empty choice dialogs

This commit is contained in:
Oleg Agafonov 2023-08-25 19:07:32 +04:00
parent f6e625de72
commit da89ab6ad7

View file

@ -467,6 +467,13 @@ public class HumanPlayer extends PlayerImpl {
return true;
}
if (choice.isKeyChoice() && choice.getKeyChoices().isEmpty()) {
throw new IllegalArgumentException("Wrong code usage. Key choices must contains some values");
}
if (!choice.isKeyChoice() && choice.getChoices().isEmpty()) {
throw new IllegalArgumentException("Wrong code usage. Choices must contains some values");
}
// Try to autopay for mana
if (Outcome.PutManaInPool == outcome && currentlyUnpaidMana != null) {
// Check check if the spell being paid for cares about the color of mana being paid