From bce4d070410d36492c9917815bd8b6da357acdd2 Mon Sep 17 00:00:00 2001 From: vietdungdev Date: Sat, 30 May 2026 20:39:47 +0700 Subject: [PATCH] update allres --- pkg/nip/rule.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pkg/nip/rule.go b/pkg/nip/rule.go index c0ca8c0..5055807 100644 --- a/pkg/nip/rule.go +++ b/pkg/nip/rule.go @@ -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 {