fix(models): require a positive range_increment_ft (reject 0 and negatives)

This commit is contained in:
2026-09-20 17:36:45 +02:00
parent e9c2a63122
commit 10f811e80e
3 changed files with 22 additions and 2 deletions
+5 -1
View File
@@ -278,7 +278,11 @@ class AttackSpec(_FrozenModel):
crit_mult: int = Field(default=2, ge=2, le=4)
reach_ft: int = 5
reach_weapon: bool = False
range_increment_ft: int | None = None
# Positive or None (None = no range increments: melee, or touch at natural
# reach). A zero increment would crash the engine's range_penalty with a
# ZeroDivisionError (dist_ft // 0); a negative one silently makes the
# weapon unusable -- both are data errors, rejected at the schema.
range_increment_ft: int | None = Field(default=None, ge=1)
count: int = Field(default=1, ge=1)
firearm: bool = False
two_handed: bool = False