diff options
Diffstat (limited to 'internal/combat/types.go')
| -rw-r--r-- | internal/combat/types.go | 36 |
1 files changed, 36 insertions, 0 deletions
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 + } +} |
