From c14c2e403c75a913e1a6d962fb6fe64f013adae5 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 1 Jul 2026 22:30:31 -0400 Subject: fix: combat formulas and mob attack types (mobs switch attack styles if safespotting) --- internal/combat/types.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 internal/combat/types.go (limited to 'internal/combat/types.go') diff --git a/internal/combat/types.go b/internal/combat/types.go new file mode 100644 index 0000000..bb2a897 --- /dev/null +++ b/internal/combat/types.go @@ -0,0 +1,36 @@ +package combat + +// Attack type identifiers shared across combat, mobs, weapons, hazards and +// validation. These are the canonical string values stored in YAML. +const ( + AttackStab = "stab" + AttackSlash = "slash" + AttackCrush = "crush" + AttackRanged = "ranged" + AttackScience = "science" + + // DefaultAttackType is the fallback when no attack type is specified. + DefaultAttackType = AttackCrush +) + +// MeleeAttackTypes lists the melee attack types (exactly one of which a mob +// must have). +var MeleeAttackTypes = []string{AttackStab, AttackSlash, AttackCrush} + +// AllAttackTypes lists every valid attack type. +var AllAttackTypes = []string{AttackStab, AttackSlash, AttackCrush, AttackRanged, AttackScience} + +// IsMeleeType reports whether t is a melee attack type. +func IsMeleeType(t string) bool { + return t == AttackStab || t == AttackSlash || t == AttackCrush +} + +// IsValidAttackType reports whether t is any recognized attack type. +func IsValidAttackType(t string) bool { + switch t { + case AttackStab, AttackSlash, AttackCrush, AttackRanged, AttackScience: + return true + default: + return false + } +} -- cgit v1.2.3