Validate timing fields per move type in load_move

This commit is contained in:
Jared Miller 2026-02-16 14:49:09 -05:00
parent 0a9a7f74bc
commit 5c2cc28415
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -77,6 +77,16 @@ def load_move(path: Path) -> list[CombatMove]:
msg = f"missing required field: {field_name}"
raise ValueError(msg)
# Move-type-specific timing validation
move_type = data["move_type"]
name = data["name"]
if move_type == "attack" and data.get("hit_time_ms", 0) <= 0:
msg = f"attack move '{name}' requires hit_time_ms > 0"
raise ValueError(msg)
if move_type == "defense" and data.get("active_ms", 0) <= 0:
msg = f"defense move '{name}' requires active_ms > 0"
raise ValueError(msg)
base_name = data["name"]
variants = data.get("variants")