IPVGO: Correctly end game & winstreak if a cheat attempt critically fails (#2130)

This commit is contained in:
Michael Ficocelli
2025-05-11 15:02:56 -04:00
committed by GitHub
parent eea6733e3b
commit fe1fc8ba14
2 changed files with 16 additions and 2 deletions
+14
View File
@@ -90,6 +90,20 @@ export function endGoGame(boardState: BoardState) {
Player.applyEntropy(Player.entropy);
}
/**
* Forcefully ends the game, resetting the winstreak (if any) and ending the game without applying node power bonuses.
* Used for critically failing a cheat attempt.
* @param boardState - the boardstate to reset
*/
export function forceEndGoGame(boardState: BoardState) {
resetWinstreak(boardState.ai, false);
boardState.previousPlayer = null;
Go.currentGame = boardState;
Go.previousGame = boardState;
resetAI(true);
GoEvents.emit();
}
/**
* Sets the winstreak to zero for the given opponent, and adds a loss
*/