From 2ef225f935f676748c67ee5bb432cfb9fc572edc Mon Sep 17 00:00:00 2001 From: AlvISsReimu Date: Tue, 31 Oct 2023 14:26:18 -0700 Subject: [PATCH] chore: add some comments to the algorithm of dropinfo adjustment by times --- internal/util/reportverifs/verify_drops.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/internal/util/reportverifs/verify_drops.go b/internal/util/reportverifs/verify_drops.go index 91cb51ac..5e3e40fc 100644 --- a/internal/util/reportverifs/verify_drops.go +++ b/internal/util/reportverifs/verify_drops.go @@ -125,20 +125,26 @@ func (d *DropVerifier) adjustDropInfosByTimes(itemDropInfos []*model.DropInfo, t for _, dropInfo := range itemDropInfos { dropTypeItemTypeCountMap[dropInfo.DropType] += 1 + // for item drop info, we need to adjust multiple the original bounds by times dropInfo.Bounds.Lower *= times dropInfo.Bounds.Upper *= times if dropInfo.Bounds.Exceptions != nil { + // Adjusting exceptions by times will make the range very complicated, so we just remove it dropInfo.Bounds.Exceptions = nil } } for _, dropInfo := range typeDropInfos { - min := times - if dropTypeItemTypeCountMap[dropInfo.DropType] < min { - min = dropTypeItemTypeCountMap[dropInfo.DropType] + // The lower bound remains the same, because no matter how many times you play, you can always get at least as many types as the lower bound + // For upper bound, if times < item_type_count_for_this_drop_type, it means it's impossible to get each type at least once, so we adjust upper bound to be max(oldUpper, times) + // if times > item_type_count_for_this_drop_type, it means you are able to get each type at lease once, so we adjust upper bound to be max(oldUpper, item_type_count_for_this_drop_type) + // newUpper = max(oldUpper, min(times, item_type_count_for_this_drop_type)) + minBetweenTimesAndItemTypeCount := times + if dropTypeItemTypeCountMap[dropInfo.DropType] < minBetweenTimesAndItemTypeCount { + minBetweenTimesAndItemTypeCount = dropTypeItemTypeCountMap[dropInfo.DropType] } - if min > dropInfo.Bounds.Upper { - dropInfo.Bounds.Upper = min + if minBetweenTimesAndItemTypeCount > dropInfo.Bounds.Upper { + dropInfo.Bounds.Upper = minBetweenTimesAndItemTypeCount } if dropInfo.Bounds.Exceptions != nil { dropInfo.Bounds.Exceptions = nil