* Optimized handling and call of player.choose choice to prevent problems if a player disconnects or left a game (#4263).

This commit is contained in:
LevelX2 2018-02-04 17:51:12 +01:00
parent b9ec919f06
commit b752eacfaa
152 changed files with 1224 additions and 1681 deletions

View file

@ -108,7 +108,9 @@ public class RemoveCounterCost extends CostImpl {
}
choice.setChoices(choices);
choice.setMessage("Choose a counter to remove from " + permanent.getLogName());
controller.choose(Outcome.UnboostCreature, choice, game);
if (!controller.choose(Outcome.UnboostCreature, choice, game)) {
return false;
}
counterName = choice.getChoice();
} else {
for (Counter counter : permanent.getCounters(game).values()) {
@ -117,7 +119,7 @@ public class RemoveCounterCost extends CostImpl {
}
}
}
if (counterName != null) {
if (counterName != null && !counterName.isEmpty()) {
int countersLeft = countersToRemove - countersRemoved;
int countersOnPermanent = permanent.getCounters(game).getCount(counterName);
int numberOfCountersSelected = 1;