mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
Fixed bug where hacking special servers w/ no money would result in NaN because of a '0 / 0' in fortify() calculation
This commit is contained in:
parent
a27ecca7bf
commit
47134a9640
2
dist/engine.bundle.js
vendored
2
dist/engine.bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -498,6 +498,7 @@ let CONSTANTS = {
|
||||
"* Added getCurrentAction() to Bladeburner API<br>" +
|
||||
"* Added a variety of functions to Bladeburner API that deal with action levels (change by hydroflame)<br>" +
|
||||
"* Added getPurchasedServerLimit() and getPurchasedServerMaxRam() functions to Netscript (change by hydroflame & kopelli)<br>" +
|
||||
"* Added getOwnedSourceFiles() Singularity function (by hydroflame)<br>" +
|
||||
"* Completely re-designed the Hacknet Node API<br>" +
|
||||
"* getSkillLevel() in Bladeburner API now returns an error if no argument is passed in (as opposed to an object with all skill levels). This may break scripts<br>" +
|
||||
"* Minimum Netscript execution time reduced from 15ms to 10ms (configurable in Options)<br>" +
|
||||
@ -505,6 +506,8 @@ let CONSTANTS = {
|
||||
"* Source-File 6 now increases both the level and experience gain of all combat stats (it was only experience gain previously)<br>" +
|
||||
"* Reverted a previous change for Source-File 12. It's benefits are now multiplicative rather than additive<br>" +
|
||||
"* Starting Infiltration security level for almost every location decreased by ~10%<br>" +
|
||||
"* Changed 'fl1ght.exe' message when its listed conditions are fulfilled (by hydroflame)<br>" +
|
||||
"* The 'Save Game' button in the top-right overview panel now flashes red if autosave is disabled<br>" +
|
||||
"* Bug Fix: Infiltration buttons can no longer be clicked through NetscriptJS<br>" +
|
||||
"* Bug Fix: Bladeburner 'Overclock' skill can no longer be leveled above max level through the API (by hydroflame)"
|
||||
}
|
||||
|
@ -298,7 +298,11 @@ function NetscriptFunctions(workerScript) {
|
||||
var expGainedOnFailure = (expGainedOnSuccess / 4);
|
||||
if (rand < hackChance) { //Success!
|
||||
const percentHacked = scriptCalculatePercentMoneyHacked(server);
|
||||
const maxThreadNeeded = Math.ceil(1/percentHacked*(server.moneyAvailable/server.moneyMax))
|
||||
let maxThreadNeeded = Math.ceil(1/percentHacked*(server.moneyAvailable/server.moneyMax));
|
||||
if (isNaN(maxThreadNeeded)) {
|
||||
maxThreadNeeded = 1e6; //Server has a 'max money' of 0 (probably)
|
||||
}
|
||||
|
||||
let moneyGained = Math.floor(server.moneyAvailable * percentHacked) * threads;
|
||||
|
||||
//Over-the-top safety checks
|
||||
|
Loading…
Reference in New Issue
Block a user