Merge pull request #2883 from chrisrabe/fix/hackanalyzethreads-infinity

fix: fixed hackAnalyzeThreads returning infinity
This commit is contained in:
hydroflame 2022-03-20 22:23:15 -04:00 committed by GitHub
commit e56f7356cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -539,6 +539,10 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
const percentHacked = calculatePercentMoneyHacked(server, Player);
if (percentHacked === 0 || server.moneyAvailable === 0) {
return 0; // To prevent returning infinity below
}
return hackAmount / Math.floor(server.moneyAvailable * percentHacked);
},
hackAnalyze: function (hostname: any): any {