improve 2
This commit is contained in:
@@ -572,28 +572,49 @@ func (r Rule) ValidateStats() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func evaluateClassSkillsSum(it data.Item) int {
|
func evaluateClassSkillsSum(it data.Item) int {
|
||||||
// Check all class skills stats
|
return evaluatePositiveStatSum(it, stat.AddClassSkills, maxClassSkillsLayer)
|
||||||
totalClassSkills := 0
|
|
||||||
|
|
||||||
for layer := 0; layer <= maxClassSkillsLayer; layer++ {
|
|
||||||
if itemStat, found := it.FindStat(stat.AddClassSkills, layer); found && itemStat.Value > 0 {
|
|
||||||
totalClassSkills += itemStat.Value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return totalClassSkills
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func evaluateSkillTabSum(it data.Item) int {
|
func evaluateSkillTabSum(it data.Item) int {
|
||||||
// Check all skill tab stats
|
return evaluatePositiveStatSum(it, stat.AddSkillTab, maxSkillTabLayer)
|
||||||
totalSkillTabs := 0
|
}
|
||||||
|
|
||||||
for layer := 0; layer <= maxSkillTabLayer; layer++ {
|
const aggregateLayerFastPathLimit = 64
|
||||||
if itemStat, found := it.FindStat(stat.AddSkillTab, layer); found && itemStat.Value > 0 {
|
|
||||||
totalSkillTabs += itemStat.Value
|
func evaluatePositiveStatSum(it data.Item, statID stat.ID, maxLayer int) int {
|
||||||
|
// Current aggregate aliases fit in a small stack bitmap; retain the general
|
||||||
|
// lookup path if additional layers later exceed that bound.
|
||||||
|
if maxLayer >= aggregateLayerFastPathLimit {
|
||||||
|
total := 0
|
||||||
|
for layer := 0; layer <= maxLayer; layer++ {
|
||||||
|
if itemStat, found := it.FindStat(statID, layer); found && itemStat.Value > 0 {
|
||||||
|
total += itemStat.Value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
return totalSkillTabs
|
var foundLayers [aggregateLayerFastPathLimit]bool
|
||||||
|
total := 0
|
||||||
|
for _, itemStat := range it.Stats {
|
||||||
|
if itemStat.ID != statID || itemStat.Layer < 0 || itemStat.Layer > maxLayer || foundLayers[itemStat.Layer] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
foundLayers[itemStat.Layer] = true
|
||||||
|
if itemStat.Value > 0 {
|
||||||
|
total += itemStat.Value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, itemStat := range it.BaseStats {
|
||||||
|
if itemStat.ID != statID || itemStat.Layer < 0 || itemStat.Layer > maxLayer || foundLayers[itemStat.Layer] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
foundLayers[itemStat.Layer] = true
|
||||||
|
if itemStat.Value > 0 {
|
||||||
|
total += itemStat.Value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
func maxAliasLayer(statID stat.ID) int {
|
func maxAliasLayer(statID stat.ID) int {
|
||||||
|
|||||||
Reference in New Issue
Block a user