diff --git a/project/assets/configs/bot.json b/project/assets/configs/bot.json index e8d21b34..454e868c 100644 --- a/project/assets/configs/bot.json +++ b/project/assets/configs/bot.json @@ -2708,14 +2708,14 @@ "disableLootOnBotTypes": [], "assaultToBossConversion": { "bossConvertEnabled": false, - "bossesToConvertTo": [ - "bossKilla", - "bossSanitar", - "bossKolontay", - "bossKnight", - "followerBigPipe", - "followerBirdEye" - ], + "bossesToConvertToWeights": { + "bossKilla": 1, + "bossSanitar": 1, + "bossKolontay": 1, + "bossKnight": 1, + "followerBigPipe": 1, + "followerBirdEye": 1 + }, "bossConvertMinMax": { "assault": { "min": 100, diff --git a/project/src/controllers/BotController.ts b/project/src/controllers/BotController.ts index 0ef38f89..f3546bd7 100644 --- a/project/src/controllers/BotController.ts +++ b/project/src/controllers/BotController.ts @@ -5,6 +5,7 @@ import { BotGenerator } from "@spt/generators/BotGenerator"; import { BotDifficultyHelper } from "@spt/helpers/BotDifficultyHelper"; import { BotHelper } from "@spt/helpers/BotHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper"; +import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper"; import { MinMax } from "@spt/models/common/MinMax"; import { Condition, IGenerateBotsRequestData } from "@spt/models/eft/bot/IGenerateBotsRequestData"; import { IPmcData } from "@spt/models/eft/common/IPmcData"; @@ -39,6 +40,7 @@ export class BotController @inject("BotGenerator") protected botGenerator: BotGenerator, @inject("BotHelper") protected botHelper: BotHelper, @inject("BotDifficultyHelper") protected botDifficultyHelper: BotDifficultyHelper, + @inject("WeightedRandomHelper") protected weightedRandomHelper: WeightedRandomHelper, @inject("BotGenerationCacheService") protected botGenerationCacheService: BotGenerationCacheService, @inject("MatchBotDetailsCacheService") protected matchBotDetailsCacheService: MatchBotDetailsCacheService, @inject("LocalisationService") protected localisationService: LocalisationService, @@ -434,16 +436,20 @@ export class BotController botGenerationDetails.botCountToGenerate = this.botConfig.presetBatch[botGenerationDetails.role]; } } - // Only runs if bot didnt get picked to be PMC & Boss Convert is enabled - if (this.botConfig.assaultToBossConversion.bossConvertEnabled && !botGenerationDetails.isPmc) { - const bossConvertPercent = this.botConfig.assaultToBossConversion.bossConvertMinMax[requestedBot.Role.toLowerCase()]; + // Only convert to boss when not already converted to PMC & Boss Convert is enabled + const toBossSettings = this.botConfig.assaultToBossConversion; + if (toBossSettings.bossConvertEnabled && !botGenerationDetails.isPmc) + { + const bossConvertPercent = toBossSettings.bossConvertMinMax[requestedBot.Role.toLowerCase()]; // Only Pass if role exists - if (bossConvertPercent) { + if (bossConvertPercent) + { const convertToBoss = this.botHelper.rollChanceToBePmc(requestedBot.Role, bossConvertPercent); - // Should become Boss - if (convertToBoss) { + if (convertToBoss) + { // Seems Actual bosses have the same Brain issues like PMC gaining Boss Brains We cant use all bosses - botGenerationDetails.role = this.randomUtil.drawRandomFromList(this.botConfig.assaultToBossConversion.bossesToConvertTo)[0]; + botGenerationDetails.role + = this.weightedRandomHelper.getWeightedValue(toBossSettings.bossesToConvertToWeights); botGenerationDetails.botDifficulty = this.getPMCDifficulty(requestedBot.Difficulty); botGenerationDetails.botCountToGenerate = this.botConfig.presetBatch[botGenerationDetails.role]; } diff --git a/project/src/models/spt/config/IBotConfig.ts b/project/src/models/spt/config/IBotConfig.ts index 12312751..d9dc6835 100644 --- a/project/src/models/spt/config/IBotConfig.ts +++ b/project/src/models/spt/config/IBotConfig.ts @@ -51,7 +51,7 @@ export interface IBotConfig extends IBaseConfig export interface IAssaultToBossConversion { bossConvertEnabled: boolean - bossesToConvertTo: string[] + bossesToConvertToWeights: Record bossConvertMinMax: Record }