When playing non-team matches, display Player name as winner in Game Recap screen

This commit is contained in:
Chris H
2018-04-28 23:22:23 -04:00
parent dc71046018
commit 758dbb689a
2 changed files with 8 additions and 3 deletions

View File

@@ -47,7 +47,12 @@ public class GameStateEvaluator {
}
private Score getScoreForGameOver(Game game, Player aiPlayer) {
return game.getOutcome().getWinningTeam() == aiPlayer.getTeam() ? new Score(Integer.MAX_VALUE) : new Score(Integer.MIN_VALUE);
if (game.getOutcome().getWinningTeam() == aiPlayer.getTeam() ||
game.getOutcome().isWinner(aiPlayer.getRegisteredPlayer())) {
return new Score(Integer.MAX_VALUE);
}
return new Score(Integer.MIN_VALUE);
}
public Score getScoreForGameState(Game game, Player aiPlayer) {

View File

@@ -92,8 +92,8 @@ public final class GameOutcome implements Iterable<Entry<RegisteredPlayer, Playe
this.playerRating.put(p.getRegisteredPlayer(), p.getStats());
this.playerNames.put(p.getRegisteredPlayer(), p.getName());
if (p.getOutcome().hasWon() &&
(winCondition == GameEndReason.AllOpponentsLost || winCondition == GameEndReason.AllOpposingTeamsLost)) {
if (p.getOutcome().hasWon() && winCondition == GameEndReason.AllOpposingTeamsLost) {
// Only mark the WinningTeam when "Team mode" is on.
winningTeam = p.getTeam();
}
}