Bugfix for evaluating resists as part of complex rules.

This commit is contained in:
Polivox
2025-11-27 14:26:41 +02:00
parent 8d3a2e39e4
commit c4edf8452e

View File

@@ -388,18 +388,17 @@ func (r Rule) Evaluate(it data.Item) (RuleResult, error) {
} }
// Special handling for stats not found // Special handling for stats not found
if !statFound { if !statFound {
// Check if this is a resist stat
isResistStat := strings.Contains(statName, "resist") isResistStat := strings.Contains(statName, "resist")
// When the rule contains a resist-sum but the item has no resists,
// For resist stats in a sum expression when no resists are present, don't match // dont return NoMatch—set the stat to 0 so the sum evaluates to false,
// and let other OR conditions decide the result.
if isResistStat && isResistSum && !hasAnyResist { if isResistStat && isResistSum && !hasAnyResist {
return RuleResultNoMatch, nil stage2Props[statName] = 0
continue
} }
// For all other missing stats, default to 0
// For all other stats, default to 0 to allow proper evaluation of OR conditions
stage2Props[statName] = 0 stage2Props[statName] = 0
} else { } else {
// Stat was found, use its value
stage2Props[statName] = statValue stage2Props[statName] = statValue
} }
} }