diff --git a/pkg/nip/rule.go b/pkg/nip/rule.go index dc9b58e..9950ce8 100644 --- a/pkg/nip/rule.go +++ b/pkg/nip/rule.go @@ -156,7 +156,7 @@ func (r Rule) Evaluate(it data.Item) (RuleResult, error) { continue } - if itemTypes, found := blockedStatsForItemType[statName[0]]; found { + if itemTypes, found := blockedStatsForItemType[statName[1]]; found { if slices.Contains(itemTypes, it.TypeAsString()) { return RuleResultNoMatch, fmt.Errorf("property %s is not supported for item type %s", statName[0], it.TypeAsString()) } diff --git a/pkg/nip/rule_test.go b/pkg/nip/rule_test.go index 4184922..a986557 100644 --- a/pkg/nip/rule_test.go +++ b/pkg/nip/rule_test.go @@ -163,6 +163,23 @@ func TestRule_Evaluate(t *testing.T) { }, want: RuleResultFullMatch, }, + { + name: "enhanceddamage should not work for weapons", + fields: fields{ + RawLine: "[type] == axe && [quality] == superior # [enhanceddamage] >= 15 #", + Enabled: true, + }, + args: args{ + item: data.Item{ + Identified: true, + ID: 0, + Name: "handaxe", + Quality: item.QualityUnique, + Stats: []stat.Data{}, + }, + }, + wantErr: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -192,9 +209,9 @@ func TestNew(t *testing.T) { wantErr bool }{ { - name: "Enhanced Damage should throw an error", + name: "itemthrustdamage should throw an error", args: args{ - rawRule: "[type] == armor # [enhanceddamage] >= 15", + rawRule: "[type] == axe # [itemthrustdamage] >= 15", }, wantErr: true, },