From 9520a2977e7b7ab445c7b221977f4dff6f77ad9b Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 25 Jan 2024 22:38:42 +0000 Subject: [PATCH] Move variable calculation outside of loop --- project/src/controllers/BotController.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/project/src/controllers/BotController.ts b/project/src/controllers/BotController.ts index 933ed422..24a1fcf4 100644 --- a/project/src/controllers/BotController.ts +++ b/project/src/controllers/BotController.ts @@ -166,6 +166,7 @@ export class BotController */ protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[] { + const allPmcsHaveSameNameAsPlayer = this.randomUtil.getChance100(this.pmcConfig.allPMCsHavePlayerNameWithRandomPrefixChance); for (const condition of request.conditions) { const botGenerationDetails: BotGenerationDetails = { @@ -179,7 +180,7 @@ export class BotController botCountToGenerate: this.botConfig.presetBatch[condition.Role], botDifficulty: condition.Difficulty, isPlayerScav: false, - allPmcsHaveSameNameAsPlayer: this.randomUtil.getChance100(this.pmcConfig.allPMCsHavePlayerNameWithRandomPrefixChance) + allPmcsHaveSameNameAsPlayer: allPmcsHaveSameNameAsPlayer }; // Event bots need special actions to occur, set data up for them