Move conversion to boss code into its own function - force difficulty to be normal

Fixed bad type for bot type weights

Small formatting changes
This commit is contained in:
Dev 2024-06-18 13:18:05 +01:00
parent 0a6ef574d0
commit adb18884b8
2 changed files with 20 additions and 7 deletions

View File

@ -444,14 +444,14 @@ export class BotController
// Only Pass if role exists
if (bossConvertPercent)
{
const convertToBoss = this.botHelper.rollChanceToBePmc(requestedBot.Role, bossConvertPercent);
const convertToBoss = this.botHelper.rollChanceToBePmc(
requestedBot.Role,
bossConvertPercent);
if (convertToBoss)
{
// Seems Actual bosses have the same Brain issues like PMC gaining Boss Brains We cant use all bosses
botGenerationDetails.role
= this.weightedRandomHelper.getWeightedValue(toBossSettings.bossesToConvertToWeights);
botGenerationDetails.botDifficulty = this.getPMCDifficulty(requestedBot.Difficulty);
botGenerationDetails.botCountToGenerate = this.botConfig.presetBatch[botGenerationDetails.role];
this.convertBotGenerationDetailsToRandomBoss(
botGenerationDetails,
toBossSettings.bossesToConvertToWeights);
}
}
}
@ -487,6 +487,19 @@ export class BotController
return [desiredBot];
}
protected convertBotGenerationDetailsToRandomBoss(
botGenerationDetails: BotGenerationDetails,
possibleBossTypeWeights: Record<string, number>): void
{
// Seems Actual bosses have the same Brain issues like PMC gaining Boss Brains We cant use all bosses
botGenerationDetails.role
= this.weightedRandomHelper.getWeightedValue(possibleBossTypeWeights);
// Bosses are only ever 'normal'
botGenerationDetails.botDifficulty = "normal";
botGenerationDetails.botCountToGenerate = this.botConfig.presetBatch[botGenerationDetails.role];
}
/**
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
* @param requestedDifficulty

View File

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