mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 23:08:36 +02:00
Fix infinite time to hack on 0-difficulty servers
This commit is contained in:
@@ -56,9 +56,8 @@ export function calculatePercentMoneyHacked(server: IServer, person: IPerson): n
|
|||||||
|
|
||||||
/** Returns time it takes to complete a hack on a server, in seconds */
|
/** Returns time it takes to complete a hack on a server, in seconds */
|
||||||
export function calculateHackingTime(server: IServer, person: IPerson): number {
|
export function calculateHackingTime(server: IServer, person: IPerson): number {
|
||||||
const hackDifficulty = server.hackDifficulty;
|
const { hackDifficulty, requiredHackingSkill } = server;
|
||||||
const requiredHackingSkill = server.requiredHackingSkill;
|
if (typeof hackDifficulty !== "number" || typeof requiredHackingSkill !== "number") return Infinity;
|
||||||
if (!hackDifficulty || !requiredHackingSkill) return Infinity;
|
|
||||||
const difficultyMult = requiredHackingSkill * hackDifficulty;
|
const difficultyMult = requiredHackingSkill * hackDifficulty;
|
||||||
|
|
||||||
const baseDiff = 500;
|
const baseDiff = 500;
|
||||||
|
|||||||
Reference in New Issue
Block a user