mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-08 00:27:47 +02:00
MISC: Add achievements for BN14 (#2140)
This commit is contained in:
@@ -16,6 +16,8 @@ export class GoObject {
|
||||
currentGame: BoardState = getNewBoardState(7);
|
||||
stats: PartialRecord<GoOpponent, OpponentStats> = {};
|
||||
storedCycles: number = 0;
|
||||
// This flag is used when checking the achievement CHALLENGE_BN14.
|
||||
moveOrCheatViaApi = false;
|
||||
|
||||
prestigeAugmentation() {
|
||||
for (const opponent of getRecordKeys(Go.stats)) {
|
||||
@@ -36,6 +38,7 @@ export class GoObject {
|
||||
this.previousGame = null;
|
||||
this.currentGame = getNewBoardState(7);
|
||||
this.stats = {};
|
||||
this.moveOrCheatViaApi = false;
|
||||
resetGoPromises();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ type SaveFormat = {
|
||||
currentGame: CurrentGameSaveData;
|
||||
stats: PartialRecord<GoOpponent, OpponentStats>;
|
||||
storedCycles: number;
|
||||
moveOrCheatViaApi: boolean;
|
||||
};
|
||||
|
||||
export function getGoSave(): SaveFormat {
|
||||
@@ -46,6 +47,7 @@ export function getGoSave(): SaveFormat {
|
||||
},
|
||||
stats: Go.stats,
|
||||
storedCycles: Go.storedCycles,
|
||||
moveOrCheatViaApi: Go.moveOrCheatViaApi,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -85,6 +87,9 @@ export function loadGo(data: unknown): boolean {
|
||||
Go.previousGame = previousGame;
|
||||
Go.stats = stats;
|
||||
Go.storeCycles(loadStoredCycles(parsedData.storedCycles));
|
||||
if (typeof parsedData.moveOrCheatViaApi === "boolean") {
|
||||
Go.moveOrCheatViaApi = parsedData.moveOrCheatViaApi;
|
||||
}
|
||||
|
||||
resetAI();
|
||||
handleNextTurn(currentGame).catch((error) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Board, BoardState, PointState } from "../Types";
|
||||
|
||||
import { Player } from "@player";
|
||||
import { GoOpponent, GoColor } from "@enums";
|
||||
import { GoOpponent, GoColor, FactionName } from "@enums";
|
||||
import { newOpponentStats } from "../Constants";
|
||||
import { getAllChains, getPlayerNeighbors } from "./boardAnalysis";
|
||||
import { getKomi, resetAI } from "./goAI";
|
||||
@@ -77,6 +77,10 @@ export function endGoGame(boardState: BoardState) {
|
||||
Factions[factionName].setFavor(newFavor);
|
||||
statusToUpdate.rep += repToAdd;
|
||||
}
|
||||
|
||||
if (factionName === FactionName.Illuminati && statusToUpdate.winStreak >= 10) {
|
||||
Player.giveAchievement("IPVGO_WINNING_STREAK");
|
||||
}
|
||||
}
|
||||
|
||||
statusToUpdate.nodePower +=
|
||||
|
||||
@@ -29,6 +29,7 @@ import { newOpponentStats } from "../Constants";
|
||||
* Check the move based on the current settings
|
||||
*/
|
||||
export function validateMove(error: (s: string) => never, x: number, y: number, methodName = "", settings = {}): void {
|
||||
Go.moveOrCheatViaApi = true;
|
||||
const check = {
|
||||
emptyNode: true,
|
||||
requireNonEmptyNode: false,
|
||||
@@ -502,10 +503,11 @@ export function determineCheatSuccess(
|
||||
if ((successRngOverride ?? rng.random()) <= cheatSuccessChance(state.cheatCount, playAsWhite)) {
|
||||
callback();
|
||||
}
|
||||
// If there have been prior cheat attempts, and the cheat fails, there is a 10% chance of instantly losing
|
||||
// If there have been prior cheat attempts, and the cheat fails, there is a 10% chance of instantly ending the game
|
||||
else if (priorCheatCount && (ejectRngOverride ?? rng.random()) < 0.1 && state.ai !== GoOpponent.none) {
|
||||
logger(`Cheat failed! You have been ejected from the subnet.`);
|
||||
forceEndGoGame(state);
|
||||
Player.giveAchievement("IPVGO_ANTICHEAT");
|
||||
return handleNextTurn(state, true);
|
||||
} else {
|
||||
// If the cheat fails, your turn is skipped
|
||||
|
||||
Reference in New Issue
Block a user