From 8eec7b75ff9c8c368b252373db45fb891732d2ca Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 1 Jul 2026 19:41:34 -0400 Subject: mob combat stats overhauled and standardized --- internal/validate/checks.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'internal/validate/checks.go') 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), }) } -- cgit v1.2.3