Package megamek.server.victory
Class VictoryResult
java.lang.Object
megamek.server.victory.VictoryResult
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic VictoryResultintintbooleanisDraw()booleanstatic VictoryResultnoResult()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.voidsetPlayerScore(int id, double score) voidsetTeamScore(int id, double score) voidsetVictory(boolean b) toString()
-
Constructor Details
-
VictoryResult
public VictoryResult(boolean win) -
VictoryResult
public VictoryResult(boolean win, int player, int team)
-
-
Method Details
-
noResult
-
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
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 currentGamefor 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
-