fix: 🐛 fix server minimum difficulty changing when server starting difficulty is capped

This commit is contained in:
Shiiyu 2022-09-23 02:39:58 -04:00
parent cf11612abc
commit e1bff8bcb1

@ -75,12 +75,11 @@ export class Server extends BaseServer {
this.moneyMax = 25 * this.moneyAvailable * BitNodeMultipliers.ServerMaxMoney; this.moneyMax = 25 * this.moneyAvailable * BitNodeMultipliers.ServerMaxMoney;
//Hack Difficulty is synonymous with server security. Base Difficulty = Starting difficulty //Hack Difficulty is synonymous with server security. Base Difficulty = Starting difficulty
this.hackDifficulty = const realDifficulty =
params.hackDifficulty != null params.hackDifficulty != null ? params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity : 1;
? Math.min(params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity, 100) this.hackDifficulty = Math.min(realDifficulty, 100);
: 1;
this.baseDifficulty = this.hackDifficulty; 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() 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 //Port information, required for porthacking servers to get admin rights