aboutsummaryrefslogtreecommitdiff
path: root/internal/validate
diff options
context:
space:
mode:
Diffstat (limited to 'internal/validate')
-rw-r--r--internal/validate/checks.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/internal/validate/checks.go b/internal/validate/checks.go
index bbcb820..7ac6fa1 100644
--- a/internal/validate/checks.go
+++ b/internal/validate/checks.go
@@ -508,12 +508,16 @@ func validateHazards(s Source) []Issue {
})
continue
}
- if def.AttackType != "" && !combat.IsValidAttackType(def.AttackType) {
- issues = append(issues, Issue{
- Level: "ERROR",
- Type: "reference",
- Message: fmt.Sprintf("Hazard %q: invalid attack_type %q (must be stab/slash/crush/ranged/science)", id, def.AttackType),
- })
+ if def.Combat != nil {
+ for _, t := range def.Combat.AttackTypes {
+ if t != "" && !combat.IsValidAttackType(t) {
+ issues = append(issues, Issue{
+ Level: "ERROR",
+ Type: "reference",
+ Message: fmt.Sprintf("Hazard %q: invalid attack_type %q (must be stab/slash/crush/ranged/science)", id, t),
+ })
+ }
+ }
}
if def.RequiredItem != "" && !itemIDs[def.RequiredItem] {
issues = append(issues, Issue{