From ecaa9066824424051ee70937a235665ae6b1da9b Mon Sep 17 00:00:00 2001 From: Shiiyu Date: Fri, 23 Sep 2022 00:42:47 -0400 Subject: [PATCH 1/3] fix: :bug: fix server starting security going above 100 --- src/Server/Server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Server/Server.ts b/src/Server/Server.ts index 442b6d461..4881acfb4 100644 --- a/src/Server/Server.ts +++ b/src/Server/Server.ts @@ -76,7 +76,7 @@ export class Server extends BaseServer { //Hack Difficulty is synonymous with server security. Base Difficulty = Starting difficulty this.hackDifficulty = - params.hackDifficulty != null ? params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity : 1; + params.hackDifficulty != null ? Math.min(params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity, 100) : 1; this.baseDifficulty = this.hackDifficulty; this.minDifficulty = Math.max(1, Math.round(this.hackDifficulty / 3)); this.serverGrowth = params.serverGrowth != null ? params.serverGrowth : 1; //Integer from 0 to 100. Affects money increase from grow() From cf11612abc1a063063c20b8f39f7cd34d62bbf5e Mon Sep 17 00:00:00 2001 From: Shiiyu Date: Fri, 23 Sep 2022 02:07:32 -0400 Subject: [PATCH 2/3] style: :art: fix - forgot to run format first --- src/Server/Server.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Server/Server.ts b/src/Server/Server.ts index 4881acfb4..0ed5dc66d 100644 --- a/src/Server/Server.ts +++ b/src/Server/Server.ts @@ -76,7 +76,9 @@ export class Server extends BaseServer { //Hack Difficulty is synonymous with server security. Base Difficulty = Starting difficulty this.hackDifficulty = - params.hackDifficulty != null ? Math.min(params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity, 100) : 1; + params.hackDifficulty != null + ? Math.min(params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity, 100) + : 1; this.baseDifficulty = this.hackDifficulty; this.minDifficulty = Math.max(1, Math.round(this.hackDifficulty / 3)); this.serverGrowth = params.serverGrowth != null ? params.serverGrowth : 1; //Integer from 0 to 100. Affects money increase from grow() From e1bff8bcb1adf5712f4df8ad6fbd2ce03de0359f Mon Sep 17 00:00:00 2001 From: Shiiyu Date: Fri, 23 Sep 2022 02:39:58 -0400 Subject: [PATCH 3/3] fix: :bug: fix server minimum difficulty changing when server starting difficulty is capped --- src/Server/Server.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Server/Server.ts b/src/Server/Server.ts index 0ed5dc66d..427b879e3 100644 --- a/src/Server/Server.ts +++ b/src/Server/Server.ts @@ -75,12 +75,11 @@ export class Server extends BaseServer { this.moneyMax = 25 * this.moneyAvailable * BitNodeMultipliers.ServerMaxMoney; //Hack Difficulty is synonymous with server security. Base Difficulty = Starting difficulty - this.hackDifficulty = - params.hackDifficulty != null - ? Math.min(params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity, 100) - : 1; + const realDifficulty = + params.hackDifficulty != null ? params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity : 1; + this.hackDifficulty = Math.min(realDifficulty, 100); this.baseDifficulty = this.hackDifficulty; - this.minDifficulty = Math.max(1, Math.round(this.hackDifficulty / 3)); + this.minDifficulty = Math.min(Math.max(1, Math.round(realDifficulty / 3)), 100); this.serverGrowth = params.serverGrowth != null ? params.serverGrowth : 1; //Integer from 0 to 100. Affects money increase from grow() //Port information, required for porthacking servers to get admin rights