mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -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
|
|
@ -26,7 +26,11 @@ public final class GameStateEvaluator2 {
|
|||
|
||||
public static PlayerEvaluateScore evaluate(UUID playerId, Game game) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Player opponent = game.getPlayer(game.getOpponents(playerId).iterator().next()); // TODO: add multi opponent support?
|
||||
Player opponent = game.getPlayer(game.getOpponents(playerId).stream().findFirst().orElse(null)); // TODO: add multi opponent support?
|
||||
if (opponent == null) {
|
||||
return new PlayerEvaluateScore(WIN_GAME_SCORE);
|
||||
}
|
||||
|
||||
if (game.checkIfGameIsOver()) {
|
||||
if (player.hasLost()
|
||||
|| opponent.hasWon()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue