Add botRelativeLevelDeltaMin
to pmc.json to allow configuration of lowest level of pmc relative to player
This commit is contained in:
parent
d1b17ad1ea
commit
52a5380c33
@ -173,6 +173,7 @@
|
||||
"useDifficultyOverride": false,
|
||||
"difficulty": "AsOnline",
|
||||
"botRelativeLevelDeltaMax": 10,
|
||||
"botRelativeLevelDeltaMin": 70,
|
||||
"_isUsec": "Percentage chance PMC will be USEC",
|
||||
"isUsec": 50,
|
||||
"chanceSameSideIsHostilePercent": 80,
|
||||
|
@ -153,6 +153,7 @@ export class BotController
|
||||
role: condition.Role,
|
||||
playerLevel: pmcProfile.Info.Level,
|
||||
botRelativeLevelDeltaMax: this.pmcConfig.botRelativeLevelDeltaMax,
|
||||
botRelativeLevelDeltaMin: this.pmcConfig.botRelativeLevelDeltaMin,
|
||||
botCountToGenerate: this.botConfig.presetBatch[condition.Role],
|
||||
botDifficulty: condition.Difficulty,
|
||||
isPlayerScav: false,
|
||||
|
@ -83,6 +83,7 @@ export class BotGenerator
|
||||
role: role,
|
||||
playerLevel: 0,
|
||||
botRelativeLevelDeltaMax: 0,
|
||||
botRelativeLevelDeltaMin: 0,
|
||||
botCountToGenerate: 1,
|
||||
botDifficulty: difficulty,
|
||||
isPlayerScav: true,
|
||||
|
@ -39,10 +39,15 @@ export class BotLevelGenerator
|
||||
levelDetails,
|
||||
expTable,
|
||||
);
|
||||
const lowestLevel = this.getLowestRelativeBotLevel(
|
||||
botGenerationDetails.playerLevel,
|
||||
botGenerationDetails.botRelativeLevelDeltaMin,
|
||||
levelDetails,
|
||||
expTable);
|
||||
|
||||
// Get random level based on the exp table.
|
||||
let exp = 0;
|
||||
const level = this.randomUtil.getInt(1, highestLevel);
|
||||
const level = this.randomUtil.getInt(lowestLevel, highestLevel);
|
||||
|
||||
for (let i = 0; i < level; i++)
|
||||
{
|
||||
@ -71,6 +76,7 @@ export class BotLevelGenerator
|
||||
expTable: IExpTable[],
|
||||
): number
|
||||
{
|
||||
// Some bots have a max level of 1
|
||||
const maxPossibleLevel = Math.min(levelDetails.max, expTable.length);
|
||||
|
||||
let level = playerLevel + relativeDeltaMax;
|
||||
@ -81,4 +87,29 @@ export class BotLevelGenerator
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the highest level a bot can be relative to the players level, but no further than the max size from globals.exp_table
|
||||
* @param playerLevel Players current level
|
||||
* @param relativeDeltaMax max delta above player level to go
|
||||
* @returns highest level possible for bot
|
||||
*/
|
||||
protected getLowestRelativeBotLevel(
|
||||
playerLevel: number,
|
||||
relativeDeltaMin: number,
|
||||
levelDetails: MinMax,
|
||||
expTable: IExpTable[],
|
||||
): number
|
||||
{
|
||||
// Some bots have a max level of 1
|
||||
const minPossibleLevel = Math.min(levelDetails.min, expTable.length);
|
||||
|
||||
let level = playerLevel - relativeDeltaMin;
|
||||
if (level < minPossibleLevel)
|
||||
{
|
||||
level = minPossibleLevel;
|
||||
}
|
||||
|
||||
return level;
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,10 @@ export interface BotGenerationDetails
|
||||
side: string;
|
||||
/** Active players current level */
|
||||
playerLevel: number;
|
||||
/** Delta of highest level of bot */
|
||||
/** Delta of highest level of bot e.g. 50 means 50 levels above player */
|
||||
botRelativeLevelDeltaMax: number;
|
||||
/** Delta of lowest level of bot e.g. 50 means 50 levels below player */
|
||||
botRelativeLevelDeltaMin: number;
|
||||
/** How many to create and store */
|
||||
botCountToGenerate: number;
|
||||
/** Desired difficulty of the bot */
|
||||
|
@ -44,6 +44,8 @@ export interface IPmcConfig extends IBaseConfig
|
||||
enemyTypes: string[];
|
||||
/** How many levels above player level can a PMC be */
|
||||
botRelativeLevelDeltaMax: number;
|
||||
/** How many levels below player level can a PMC be */
|
||||
botRelativeLevelDeltaMin: number;
|
||||
/** Force a number of healing items into PMCs secure container to ensure they can heal */
|
||||
forceHealingItemsIntoSecure: boolean;
|
||||
addPrefixToSameNamePMCAsPlayerChance: number;
|
||||
|
Loading…
Reference in New Issue
Block a user