mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 06:48:42 +02:00
IPVGO: Correctly end game & winstreak if a cheat attempt critically fails (#2130)
This commit is contained in:
committed by
GitHub
parent
eea6733e3b
commit
fe1fc8ba14
@@ -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
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
simpleBoardFromBoard,
|
||||
simpleBoardFromBoardString,
|
||||
} from "../boardAnalysis/boardAnalysis";
|
||||
import { endGoGame, getOpponentStats, getScore, resetWinstreak } from "../boardAnalysis/scoring";
|
||||
import { forceEndGoGame, getOpponentStats, getScore, resetWinstreak } from "../boardAnalysis/scoring";
|
||||
import { WHRNG } from "../../Casino/RNG";
|
||||
import { getRecordKeys } from "../../Types/Record";
|
||||
import { CalculateEffect, getEffectTypeForFaction } from "./effect";
|
||||
@@ -505,7 +505,7 @@ export function determineCheatSuccess(
|
||||
// If there have been prior cheat attempts, and the cheat fails, there is a 10% chance of instantly losing
|
||||
else if (priorCheatCount && (ejectRngOverride ?? rng.random()) < 0.1 && state.ai !== GoOpponent.none) {
|
||||
logger(`Cheat failed! You have been ejected from the subnet.`);
|
||||
endGoGame(state);
|
||||
forceEndGoGame(state);
|
||||
return handleNextTurn(state, true);
|
||||
} else {
|
||||
// If the cheat fails, your turn is skipped
|
||||
|
||||
Reference in New Issue
Block a user