mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-02 05:47:14 +02:00
MISC: move server constants into their own constant (#1075)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { currentNodeMults } from "../../BitNode/BitNodeMultipliers";
|
||||
import { Person as IPerson, Server as IServer } from "@nsdefs";
|
||||
import { ServerConstants } from "../data/Constants";
|
||||
|
||||
// Returns the log of the growth rate. When passing 1 for threads, this gives a useful constant.
|
||||
export function calculateServerGrowthLog(server: IServer, threads: number, p: IPerson, cores = 1): number {
|
||||
@@ -10,9 +10,9 @@ export function calculateServerGrowthLog(server: IServer, threads: number, p: IP
|
||||
|
||||
//Get adjusted growth log, which accounts for server security
|
||||
//log1p computes log(1+p), it is far more accurate for small values.
|
||||
let adjGrowthLog = Math.log1p(CONSTANTS.ServerBaseGrowthIncr / hackDifficulty);
|
||||
if (adjGrowthLog >= CONSTANTS.ServerMaxGrowthLog) {
|
||||
adjGrowthLog = CONSTANTS.ServerMaxGrowthLog;
|
||||
let adjGrowthLog = Math.log1p(ServerConstants.ServerBaseGrowthIncr / hackDifficulty);
|
||||
if (adjGrowthLog >= ServerConstants.ServerMaxGrowthLog) {
|
||||
adjGrowthLog = ServerConstants.ServerMaxGrowthLog;
|
||||
}
|
||||
|
||||
//Calculate adjusted server growth rate based on parameters
|
||||
|
||||
Reference in New Issue
Block a user