Merge pull request #2646 from zeddrak/patch-1

Correction for ns.hack pro-rated security increase
This commit is contained in:
hydroflame 2022-01-15 15:35:51 -05:00 committed by GitHub
commit 4171b98015
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -352,7 +352,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
if (rand < hackChance) {
// Success!
const percentHacked = calculatePercentMoneyHacked(server, Player);
let maxThreadNeeded = Math.ceil((1 / percentHacked) * (server.moneyAvailable / server.moneyMax));
let maxThreadNeeded = Math.ceil(1 / percentHacked);
if (isNaN(maxThreadNeeded)) {
// Server has a 'max money' of 0 (probably). We'll set this to an arbitrarily large value
maxThreadNeeded = 1e6;