Merge pull request #4134 from Shiiyu/dev

MISC: FIX #3649 Preventing server starting security level from going above 100
This commit is contained in:
hydroflame 2022-09-23 03:42:09 -03:00 committed by GitHub
commit b8f8246294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -75,10 +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 * BitNodeMultipliers.ServerStartingSecurity : 1; params.hackDifficulty != null ? params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity : 1;
this.hackDifficulty = Math.min(realDifficulty, 100);
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