From 31942b96eb3d690189b3ed84be30c37c0d838d91 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 1 Feb 2024 14:37:02 +0000 Subject: [PATCH] Add marksman rifles to elimination dailies Add weapon filtering based on range requirement of elimination quest: > 50 = no pistols/shotguns < 20 = no DMR/MarksmanRifles --- project/assets/configs/quest.json | 4 ++++ .../generators/RepeatableQuestGenerator.ts | 20 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/project/assets/configs/quest.json b/project/assets/configs/quest.json index 5009b758..9571eb81 100644 --- a/project/assets/configs/quest.json +++ b/project/assets/configs/quest.json @@ -400,6 +400,10 @@ "key": "DMR", "relativeProbability": 3, "data": ["5b5f791486f774093f2ed3be"] + }, { + "key": "MarksmanRifle", + "relativeProbability": 1, + "data": ["5447b6194bdc2d67278b4567"] }, { "key": "BoltAction", "relativeProbability": 10, diff --git a/project/src/generators/RepeatableQuestGenerator.ts b/project/src/generators/RepeatableQuestGenerator.ts index 5641c0e8..c5fc176a 100644 --- a/project/src/generators/RepeatableQuestGenerator.ts +++ b/project/src/generators/RepeatableQuestGenerator.ts @@ -131,7 +131,7 @@ export class RepeatableQuestGenerator const locationsConfig = repeatableConfig.locations; let targetsConfig = this.repeatableQuestHelper.probabilityObjectArray(eliminationConfig.targets); const bodypartsConfig = this.repeatableQuestHelper.probabilityObjectArray(eliminationConfig.bodyParts); - const weaponCategoryRequirementConfig = this.repeatableQuestHelper.probabilityObjectArray( + let weaponCategoryRequirementConfig = this.repeatableQuestHelper.probabilityObjectArray( eliminationConfig.weaponCategoryRequirements, ); const weaponRequirementConfig = this.repeatableQuestHelper.probabilityObjectArray( @@ -253,14 +253,14 @@ export class RepeatableQuestGenerator bodyPartDifficulty = 1 / probability; } - // draw a distance condition + // Draw a distance condition let distance = null; let distanceDifficulty = 0; let isDistanceRequirementAllowed = !eliminationConfig.distLocationBlacklist.includes(locationKey); 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) => "base" in x && "Id" in x.base ).map((x) => ({ Id: x.base.Id, BossSpawn: x.base.BossLocationSpawn })); @@ -277,7 +277,7 @@ export class RepeatableQuestGenerator 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( Math.abs(Math.random() - Math.random()) * (1 + eliminationConfig.maxDist - eliminationConfig.minDist) + eliminationConfig.minDist, @@ -289,7 +289,17 @@ export class RepeatableQuestGenerator let allowedWeaponsCategory: string = undefined; 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); // Get the hideout id value stored in the .data array