Converted scav 2 boss system boss array to weighted system

This commit is contained in:
Dev 2024-06-18 13:12:28 +01:00
parent c6ed811894
commit 0a6ef574d0
3 changed files with 22 additions and 16 deletions

View File

@ -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,

View File

@ -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];
}

View File

@ -51,7 +51,7 @@ export interface IBotConfig extends IBaseConfig
export interface IAssaultToBossConversion
{
bossConvertEnabled: boolean
bossesToConvertTo: string[]
bossesToConvertToWeights: Record<string, MinMax>
bossConvertMinMax: Record<string, MinMax>
}