From 8315e55594ec3017d51ac30300d00d82149cc6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Gim=C3=A9nez?= Date: Mon, 6 May 2024 08:10:57 +0900 Subject: [PATCH] stop further evaluation if first rule stage is not matching --- pkg/nip/rule.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/nip/rule.go b/pkg/nip/rule.go index 9950ce8..0943365 100644 --- a/pkg/nip/rule.go +++ b/pkg/nip/rule.go @@ -138,6 +138,11 @@ func (r Rule) Evaluate(it data.Item) (RuleResult, error) { return RuleResultNoMatch, fmt.Errorf("error evaluating rule: %w", err) } + // If stage1 does not match, we can stop here, nothing else to match + if !stage1Result.(bool) { + return RuleResultNoMatch, nil + } + // Let's go with other stats now // TODO: properties are missing (enhanceddefense, enhanceddamage, etc) stage2 := r.Stages[1]