Add marksman rifles to elimination dailies

Add weapon filtering based on range requirement of elimination quest:
> 50 = no pistols/shotguns
< 20 = no DMR/MarksmanRifles
This commit is contained in:
Dev 2024-02-01 14:37:02 +00:00
parent a38cf7fa69
commit 31942b96eb
2 changed files with 19 additions and 5 deletions

View File

@ -400,6 +400,10 @@
"key": "DMR", "key": "DMR",
"relativeProbability": 3, "relativeProbability": 3,
"data": ["5b5f791486f774093f2ed3be"] "data": ["5b5f791486f774093f2ed3be"]
}, {
"key": "MarksmanRifle",
"relativeProbability": 1,
"data": ["5447b6194bdc2d67278b4567"]
}, { }, {
"key": "BoltAction", "key": "BoltAction",
"relativeProbability": 10, "relativeProbability": 10,

View File

@ -131,7 +131,7 @@ export class RepeatableQuestGenerator
const locationsConfig = repeatableConfig.locations; const locationsConfig = repeatableConfig.locations;
let targetsConfig = this.repeatableQuestHelper.probabilityObjectArray(eliminationConfig.targets); let targetsConfig = this.repeatableQuestHelper.probabilityObjectArray(eliminationConfig.targets);
const bodypartsConfig = this.repeatableQuestHelper.probabilityObjectArray(eliminationConfig.bodyParts); const bodypartsConfig = this.repeatableQuestHelper.probabilityObjectArray(eliminationConfig.bodyParts);
const weaponCategoryRequirementConfig = this.repeatableQuestHelper.probabilityObjectArray( let weaponCategoryRequirementConfig = this.repeatableQuestHelper.probabilityObjectArray(
eliminationConfig.weaponCategoryRequirements, eliminationConfig.weaponCategoryRequirements,
); );
const weaponRequirementConfig = this.repeatableQuestHelper.probabilityObjectArray( const weaponRequirementConfig = this.repeatableQuestHelper.probabilityObjectArray(
@ -253,14 +253,14 @@ export class RepeatableQuestGenerator
bodyPartDifficulty = 1 / probability; bodyPartDifficulty = 1 / probability;
} }
// draw a distance condition // Draw a distance condition
let distance = null; let distance = null;
let distanceDifficulty = 0; let distanceDifficulty = 0;
let isDistanceRequirementAllowed = !eliminationConfig.distLocationBlacklist.includes(locationKey); let isDistanceRequirementAllowed = !eliminationConfig.distLocationBlacklist.includes(locationKey);
if (targetsConfig.data(targetKey).isBoss) if (targetsConfig.data(targetKey).isBoss)
{ {
// get all boss spawn information // Get all boss spawn information
const bossSpawns = Object.values(this.databaseServer.getTables().locations).filter((x) => const bossSpawns = Object.values(this.databaseServer.getTables().locations).filter((x) =>
"base" in x && "Id" in x.base "base" in x && "Id" in x.base
).map((x) => ({ Id: x.base.Id, BossSpawn: x.base.BossLocationSpawn })); ).map((x) => ({ Id: x.base.Id, BossSpawn: x.base.BossLocationSpawn }));
@ -277,7 +277,7 @@ export class RepeatableQuestGenerator
if (eliminationConfig.distProb > Math.random() && isDistanceRequirementAllowed) if (eliminationConfig.distProb > Math.random() && isDistanceRequirementAllowed)
{ {
// random distance with lower values more likely; simple distribution for starters... // Random distance with lower values more likely; simple distribution for starters...
distance = Math.floor( distance = Math.floor(
Math.abs(Math.random() - Math.random()) * (1 + eliminationConfig.maxDist - eliminationConfig.minDist) Math.abs(Math.random() - Math.random()) * (1 + eliminationConfig.maxDist - eliminationConfig.minDist)
+ eliminationConfig.minDist, + eliminationConfig.minDist,
@ -289,7 +289,17 @@ export class RepeatableQuestGenerator
let allowedWeaponsCategory: string = undefined; let allowedWeaponsCategory: string = undefined;
if (eliminationConfig.weaponCategoryRequirementProb > Math.random()) if (eliminationConfig.weaponCategoryRequirementProb > Math.random())
{ {
// Pick a weighted weapon categroy // Filter out close range weapons from far distance requirement
if (distance > 50)
{
weaponCategoryRequirementConfig = weaponCategoryRequirementConfig.filter(category => ["Shotgun", "Pistol"].includes(category.key));
}
else if (distance < 20) // Filter out far range weapons from close distance requirement
{
weaponCategoryRequirementConfig = weaponCategoryRequirementConfig.filter(category => ["MarksmanRifle", "DMR"].includes(category.key));
}
// Pick a weighted weapon category
const weaponRequirement = weaponCategoryRequirementConfig.draw(1, false); const weaponRequirement = weaponCategoryRequirementConfig.draw(1, false);
// Get the hideout id value stored in the .data array // Get the hideout id value stored in the .data array