Skip to content

Commit

Permalink
chore: add some comments to the algorithm of dropinfo adjustment by t…
Browse files Browse the repository at this point in the history
…imes
  • Loading branch information
AlvISsReimu authored and GalvinGao committed Oct 31, 2023
1 parent f71bf0b commit 2ef225f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions internal/util/reportverifs/verify_drops.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2ef225f

Please sign in to comment.