refactor: additional todos for players lists

This commit is contained in:
Oleg Agafonov 2024-07-01 16:25:55 +04:00
parent 1e2d179410
commit ce15d190e1
5 changed files with 31 additions and 19 deletions

View file

@ -247,6 +247,10 @@ public abstract class GameCommanderImpl extends GameImpl {
@Override
protected boolean checkStateBasedActions() {
for (Player player : getPlayers().values()) {
if (!player.isInGame()) {
continue;
}
for (UUID commanderId : this.getCommandersIds(player, CommanderCardType.COMMANDER_OR_OATHBREAKER, false)) {
CommanderInfoWatcher damageWatcher = getState().getWatcher(CommanderInfoWatcher.class, commanderId);
if (damageWatcher == null) {
@ -255,7 +259,7 @@ public abstract class GameCommanderImpl extends GameImpl {
for (Map.Entry<UUID, Integer> entrySet : damageWatcher.getDamageToPlayer().entrySet()) {
if (entrySet.getValue() > 20) {
Player opponent = getPlayer(entrySet.getKey());
if (opponent != null && !opponent.hasLost() && player.isInGame()) {
if (opponent != null && !opponent.hasLost()) {
opponent.lost(this);
}
}