Class VictoryResult

java.lang.Object
megamek.server.victory.VictoryResult

public final class VictoryResult extends Object
A Victory Result stores information about the results of checking one or more victory conditions. It includes player scores and a flag if a game-ending victory is achieved or not. A draw as well as a victory are indicated by the isVictory flag being true. The game will typically end when a VictoryResult with isVictory == true is found.
  • Constructor Details

    • VictoryResult

      public VictoryResult(boolean win)
    • VictoryResult

      public VictoryResult(boolean win, int player, int team)
  • Method Details

    • noResult

      public static VictoryResult noResult()
    • drawResult

      public static VictoryResult drawResult()
    • isVictory

      public boolean isVictory()
      Returns:
      True if this result indicates a game-ending state - this can be a victory but also a draw!
      See Also:
    • setVictory

      public void setVictory(boolean b)
    • isDraw

      public boolean isDraw()
    • getWinningPlayer

      public int getWinningPlayer()
      Returns:
      the ID of the winning player, or Player.PLAYER_NONE if it's a draw
    • getWinningTeam

      public int getWinningTeam()
      Returns:
      the ID of the winning team, or Player.TEAM_NONE if it's a draw
    • setPlayerScore

      public void setPlayerScore(int id, double score)
    • setTeamScore

      public void setTeamScore(int id, double score)
    • processVictory

      public List<Report> processVictory(Game game)
      Creates and returns victory/draw reports if this is a victory and updates the game's settings to reflect the victory result.
      Parameters:
      game - The current Game for which the victory needs to be processed
      Returns:
      a list of reports generated by victory checking and by the actual processing of the victory
    • toString

      public String toString()
      Overrides:
      toString in class Object