update allres

This commit is contained in:
vietdungdev
2026-05-30 20:39:47 +07:00
parent 439bf27cb2
commit bce4d07041

View File

@@ -450,6 +450,11 @@ func (r Rule) Evaluate(it data.Item) (RuleResult, error) {
// Special handling for stats not found
if !statFound {
if statName == "allres" {
stage2Props[statName] = evaluateAllRes(it)
continue
}
isResistStat := strings.Contains(statName, "resist")
// Special case: Pure resist-sum rules (like sunders) should fail early if no resists exist
// But mixed rules (resists OR other stats) should continue to check other conditions
@@ -579,6 +584,28 @@ func evaluateSkillTabSum(it data.Item) int {
return evaluatePositiveStatSum(it, stat.AddSkillTab, maxSkillTabLayer)
}
func evaluateAllRes(it data.Item) int {
resistStats := []stat.ID{
stat.FireResist,
stat.LightningResist,
stat.ColdResist,
stat.PoisonResist,
}
lowest := 0
for idx, statID := range resistStats {
itemStat, found := it.FindStat(statID, 0)
if !found {
return 0
}
if idx == 0 || itemStat.Value < lowest {
lowest = itemStat.Value
}
}
return lowest
}
const aggregateLayerFastPathLimit = 64
func evaluatePositiveStatSum(it data.Item, statID stat.ID, maxLayer int) int {