Fix issue where scav raids would generate MORE loot the shorter the raid was

This commit is contained in:
Dev 2023-12-11 14:42:04 +00:00
parent b15c8e196e
commit 14e94dbb8e

View File

@ -129,6 +129,7 @@ export class RaidTimeAdjustmentService
const chosenRaidReductionPercent = Number.parseInt(this.weightedRandomHelper.getWeightedValue<string>( const chosenRaidReductionPercent = Number.parseInt(this.weightedRandomHelper.getWeightedValue<string>(
mapSettings.reductionPercentWeights, mapSettings.reductionPercentWeights,
)); ));
const raidTimeRemainingPercent = 100 - chosenRaidReductionPercent;
// How many minutes raid will last // How many minutes raid will last
const newRaidTimeMinutes = Math.floor(this.randomUtil.reduceValueByPercent(baseEscapeTimeMinutes, chosenRaidReductionPercent)); const newRaidTimeMinutes = Math.floor(this.randomUtil.reduceValueByPercent(baseEscapeTimeMinutes, chosenRaidReductionPercent));
@ -141,8 +142,8 @@ export class RaidTimeAdjustmentService
// Store time reduction percent in app context so loot gen can pick it up later // Store time reduction percent in app context so loot gen can pick it up later
this.applicationContext.addValue(ContextVariableType.RAID_ADJUSTMENTS, this.applicationContext.addValue(ContextVariableType.RAID_ADJUSTMENTS,
{ {
dynamicLootPercent: Math.max(chosenRaidReductionPercent, mapSettings.minDynamicLootPercent), dynamicLootPercent: Math.max(raidTimeRemainingPercent, mapSettings.minDynamicLootPercent),
staticLootPercent: Math.max(chosenRaidReductionPercent, mapSettings.minStaticLootPercent), staticLootPercent: Math.max(raidTimeRemainingPercent, mapSettings.minStaticLootPercent),
simulatedRaidStartSeconds: simulatedRaidStartTimeMinutes * 60 simulatedRaidStartSeconds: simulatedRaidStartTimeMinutes * 60
}); });
} }