Added labs to pmc conversion system

This commit is contained in:
Dev 2024-09-23 22:56:22 +01:00
parent 12c602b578
commit a477b0b584
3 changed files with 20 additions and 25 deletions

View File

@ -778,30 +778,12 @@
"assault": { "assault": {
"min": 10, "min": 10,
"max": 15 "max": 15
}, }
"cursedassault": { },
"min": 15, "laboratory":{
"max": 30
},
"pmcbot": { "pmcbot": {
"min": 5, "min": 1,
"max": 10
},
"exusec": {
"min": 5,
"max": 5 "max": 5
},
"arenafighter": {
"min": 0,
"max": 0
},
"arenafighterevent": {
"min": 0,
"max": 0
},
"crazyassaultevent": {
"min": 0,
"max": 0
} }
} }
}, },

View File

@ -397,7 +397,11 @@ export class BotController {
const botConvertRateMinMax = this.getPmcConversionMinMaxForLocation(requestedBot.Role, raidSettings?.location); const botConvertRateMinMax = this.getPmcConversionMinMaxForLocation(requestedBot.Role, raidSettings?.location);
if (botConvertRateMinMax) { if (botConvertRateMinMax) {
// Should bot become PMC // Should bot become PMC
const convertToPmc = this.botHelper.rollChanceToBePmc(requestedBot.Role, botConvertRateMinMax); const convertToPmc = this.botHelper.rollChanceToBePmc(
requestedBot.Role,
botConvertRateMinMax,
raidSettings?.location,
);
if (convertToPmc) { if (convertToPmc) {
botGenerationDetails.isPmc = true; botGenerationDetails.isPmc = true;
botGenerationDetails.role = this.botHelper.getRandomizedPmcRole(); botGenerationDetails.role = this.botHelper.getRandomizedPmcRole();

View File

@ -92,13 +92,22 @@ export class BotHelper {
} }
} }
public rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean { public rollChanceToBePmc(role: string, botConvertMinMax: MinMax, location: string): boolean {
return ( return (
role.toLowerCase() in this.pmcConfig.convertIntoPmcChance && role.toLowerCase() in this.getPmcConversionValuesForLocation(location) &&
this.randomUtil.getChance100(this.randomUtil.getInt(botConvertMinMax.min, botConvertMinMax.max)) this.randomUtil.getChance100(this.randomUtil.getInt(botConvertMinMax.min, botConvertMinMax.max))
); );
} }
protected getPmcConversionValuesForLocation(location: string) {
const result = this.pmcConfig.convertIntoPmcChance[location.toLowerCase()];
if (!result) {
this.pmcConfig.convertIntoPmcChance.default;
}
return result;
}
/** /**
* is the provided role a PMC, case-agnostic * is the provided role a PMC, case-agnostic
* @param botRole Role to check * @param botRole Role to check