mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 12:22:10 -08:00
AI: fixed computer's errors if all players quit the game;
This commit is contained in:
parent
d41ccd11bc
commit
c1db466d05
4 changed files with 16 additions and 4 deletions
|
|
@ -42,7 +42,11 @@ public final class GameStateEvaluator {
|
|||
|
||||
public static int evaluate(UUID playerId, Game game, boolean ignoreTapped) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Player opponent = game.getPlayer(game.getOpponents(playerId).iterator().next());
|
||||
Player opponent = game.getPlayer(game.getOpponents(playerId).stream().findFirst().orElse(null));
|
||||
if (opponent == null) {
|
||||
return WIN_SCORE;
|
||||
}
|
||||
|
||||
if (game.checkIfGameIsOver()) {
|
||||
if (player.hasLost() || opponent.hasWon()) {
|
||||
return LOSE_SCORE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue