mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
IPVGO: Tweak cheat success scaling so it is applicable even to endgame stats (#1194)
This commit is contained in:
committed by
GitHub
parent
6beb6e9f95
commit
6c9555ba32
@@ -1,11 +1,12 @@
|
||||
import { setPlayer } from "@player";
|
||||
import { GoColor, GoOpponent, GoPlayType } from "@enums";
|
||||
import { Player, setPlayer } from "@player";
|
||||
import { AugmentationName, GoColor, GoOpponent, GoPlayType } from "@enums";
|
||||
import { Go } from "../../../src/Go/Go";
|
||||
import { boardStateFromSimpleBoard, simpleBoardFromBoard } from "../../../src/Go/boardAnalysis/boardAnalysis";
|
||||
import {
|
||||
cheatPlayTwoMoves,
|
||||
cheatRemoveRouter,
|
||||
cheatRepairOfflineNode,
|
||||
cheatSuccessChance,
|
||||
getChains,
|
||||
getControlledEmptyNodes,
|
||||
getGameState,
|
||||
@@ -19,12 +20,24 @@ import {
|
||||
import { PlayerObject } from "../../../src/PersonObjects/Player/PlayerObject";
|
||||
import "../../../src/Faction/Factions";
|
||||
import { getNewBoardState } from "../../../src/Go/boardState/boardState";
|
||||
import { installAugmentations } from "../../../src/Augmentation/AugmentationHelpers";
|
||||
import { AddToAllServers } from "../../../src/Server/AllServers";
|
||||
import { Server } from "../../../src/Server/Server";
|
||||
import { initSourceFiles } from "../../../src/SourceFile/SourceFiles";
|
||||
|
||||
jest.mock("../../../src/Faction/Factions", () => ({
|
||||
Factions: {},
|
||||
}));
|
||||
|
||||
jest.mock("../../../src/ui/GameRoot", () => ({
|
||||
Router: {
|
||||
page: () => ({}),
|
||||
toPage: () => ({}),
|
||||
},
|
||||
}));
|
||||
|
||||
setPlayer(new PlayerObject());
|
||||
AddToAllServers(new Server({ hostname: "home" }));
|
||||
|
||||
describe("Netscript Go API unit tests", () => {
|
||||
describe("makeMove() tests", () => {
|
||||
@@ -304,4 +317,27 @@ describe("Netscript Go API unit tests", () => {
|
||||
expect(Go.currentGame.board[4]?.[4]?.color).toEqual(GoColor.empty);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Cheat success chance unit tests", () => {
|
||||
it("should have a base chance", () => {
|
||||
expect(cheatSuccessChance(0)).toEqual(0.6);
|
||||
});
|
||||
|
||||
it("should have a scaled chance based on cheat count", () => {
|
||||
expect(cheatSuccessChance(4)).toEqual(0.6 * (0.7 - 0.08) ** 4);
|
||||
});
|
||||
|
||||
it("should have a scaled chance based on layer cheat success level", () => {
|
||||
Player.setBitNodeNumber(13);
|
||||
initSourceFiles();
|
||||
Player.queueAugmentation(AugmentationName.BrachiBlades);
|
||||
Player.queueAugmentation(AugmentationName.GrapheneBrachiBlades);
|
||||
Player.queueAugmentation(AugmentationName.INFRARet);
|
||||
Player.queueAugmentation(AugmentationName.PCMatrix);
|
||||
Player.queueAugmentation(AugmentationName.NeuroFluxGovernor);
|
||||
installAugmentations();
|
||||
|
||||
expect(cheatSuccessChance(4)).toEqual(0.6 * (0.7 - 0.08) ** 4 * Player.mults.crime_success);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user