Merge pull request #2816 from danielyxie/revert-2785-improve-server-grow-low-money

Revert "Use min `server.moneyAvailable` of 1$ when growing server money"
This commit is contained in:
hydroflame 2022-01-26 00:35:48 -05:00 committed by GitHub
commit c2c31eede6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

@ -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",
() =>

@ -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