From 5e10f7df1f7a2b05cd0f7cff5793ba592a7d07af Mon Sep 17 00:00:00 2001 From: hydroflame <79246165+hydroflame@users.noreply.github.com> Date: Wed, 26 Jan 2022 00:35:42 -0500 Subject: [PATCH] Revert "Use min `server.moneyAvailable` of 1$ when growing server money" --- src/NetscriptFunctions.ts | 6 +++--- src/Server/ServerHelpers.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 2cc6f3825..5d43cd1e9 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -612,12 +612,12 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { )} (t=${numeralWrapper.formatThreads(threads)}).`, ); return netscriptDelay(growTime * 1000, workerScript).then(function () { - const moneyBefore = server.moneyAvailable; - const growth = processSingleServerGrowth(server, threads, Player, host.cpuCores); + const moneyBefore = server.moneyAvailable <= 0 ? 1 : server.moneyAvailable; + processSingleServerGrowth(server, threads, Player, host.cpuCores); const moneyAfter = server.moneyAvailable; workerScript.scriptRef.recordGrow(server.hostname, threads); const expGain = calculateHackingExpGain(server, Player) * threads; - const logGrowPercent = growth; + const logGrowPercent = moneyAfter / moneyBefore - 1; workerScript.log( "grow", () => diff --git a/src/Server/ServerHelpers.ts b/src/Server/ServerHelpers.ts index db3639c74..7e8459e9d 100644 --- a/src/Server/ServerHelpers.ts +++ b/src/Server/ServerHelpers.ts @@ -74,8 +74,8 @@ export function processSingleServerGrowth(server: Server, threads: number, p: IP serverGrowth = 1; } - server.moneyAvailable = Math.max(server.moneyAvailable, 1); // It can be grown even if it has no money. 1$ min const oldMoneyAvailable = server.moneyAvailable; + server.moneyAvailable += 1 * threads; // It can be grown even if it has no money server.moneyAvailable *= serverGrowth; // in case of data corruption