refactor: removed useless code on ChoiceCreatureType usage, removed possibly infinite code (game freezes) (related to #13106);

This commit is contained in:
Oleg Agafonov 2024-12-05 01:03:13 +04:00
parent e3a94c8adf
commit 2949444089
12 changed files with 37 additions and 50 deletions

View file

@ -59,10 +59,9 @@ public class BecomesChosenCreatureTypeTargetEffect extends OneShotEffect {
if (nonWall) {
typeChoice.getKeyChoices().remove(SubType.WALL.getDescription());
}
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
if (!player.canRespond()) {
return false;
}
if (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
return false;
}
game.informPlayers(card.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoiceKey());
chosenType = typeChoice.getChoiceKey();

View file

@ -10,7 +10,9 @@ import java.util.*;
import java.util.stream.Collectors;
/**
* Game's choose dialog to ask about creature type. Return getChoice
* Game's choose dialog to ask about creature type.
* <p>
* Warning, must use getChoiceKey as result
*/
public class ChoiceCreatureType extends ChoiceImpl {

View file

@ -135,7 +135,9 @@ class VolosJournalTokenEffect extends OneShotEffect {
return true;
}
player.choose(outcome, choice, game);
if (!player.choose(outcome, choice, game)) {
return false;
}
notedTypes.add(choice.getChoiceKey());
return true;
}