aboutsummaryrefslogtreecommitdiff
path: root/internal/validate/checks.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-01 19:41:34 -0400
committerhistoria <[not public]>2026-07-01 19:41:34 -0400
commit8eec7b75ff9c8c368b252373db45fb891732d2ca (patch)
tree528ab3f235e3082a51b8bd6c8e5ae269c41b4f2b /internal/validate/checks.go
parent78b522d57a9ebc691e075523910d7cdaa06b6493 (diff)
downloadthehouseoficarus-8eec7b75ff9c8c368b252373db45fb891732d2ca.tar.gz
mob combat stats overhauled and standardized
Diffstat (limited to 'internal/validate/checks.go')
-rw-r--r--internal/validate/checks.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/internal/validate/checks.go b/internal/validate/checks.go
index cdeee44..a8f973f 100644
--- a/internal/validate/checks.go
+++ b/internal/validate/checks.go
@@ -316,19 +316,23 @@ func validateMobs(s Source) []Issue {
})
}
- if !def.Protected && def.HP <= 0 {
+ if !def.Protected && (def.Combat == nil || def.Combat.Stats.HP <= 0) {
+ hp := 0
+ if def.Combat != nil {
+ hp = def.Combat.Stats.HP
+ }
issues = append(issues, Issue{
Level: "ERROR",
Type: "reference",
- Message: fmt.Sprintf("Mob %q: is not protected but has HP=%d — mobs must have hp > 0 (or set protected: true)", id, def.HP),
+ Message: fmt.Sprintf("Mob %q: is not protected but has HP=%d — mobs must have hp > 0 (or set protected: true)", id, hp),
})
}
- if def.Kind != "" && def.Kind != "combat" && def.Kind != "task" {
+ if def.Combat != nil && def.Combat.Kind != "" && def.Combat.Kind != "combat" && def.Combat.Kind != "task" {
issues = append(issues, Issue{
Level: "ERROR",
Type: "reference",
- Message: fmt.Sprintf("Mob %q: invalid kind %q (must be \"combat\" or \"task\")", id, def.Kind),
+ Message: fmt.Sprintf("Mob %q: invalid kind %q (must be \"combat\" or \"task\")", id, def.Combat.Kind),
})
}
@@ -360,21 +364,21 @@ func validateMobs(s Source) []Issue {
}
}
- if def.StealTable != "" && !dropIDs[def.StealTable] {
+ if def.Steal != nil && def.Steal.Table != "" && !dropIDs[def.Steal.Table] {
issues = append(issues, Issue{
Level: "ERROR",
Type: "reference",
- Message: fmt.Sprintf("Mob %q: steal_table %q does not exist",
- id, def.StealTable),
+ Message: fmt.Sprintf("Mob %q: steal table %q does not exist",
+ id, def.Steal.Table),
})
}
- if def.FinishingBlow != "" && !itemIDs[def.FinishingBlow] {
+ if def.Combat != nil && def.Combat.FinishingBlow != "" && !itemIDs[def.Combat.FinishingBlow] {
issues = append(issues, Issue{
Level: "ERROR",
Type: "reference",
Message: fmt.Sprintf("Mob %q: finishing_blow item %q does not exist",
- id, def.FinishingBlow),
+ id, def.Combat.FinishingBlow),
})
}