From 5c2cc28415198ee877c8de506dcccd751d1649c3 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Mon, 16 Feb 2026 14:49:09 -0500 Subject: [PATCH] Validate timing fields per move type in load_move --- src/mudlib/combat/moves.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mudlib/combat/moves.py b/src/mudlib/combat/moves.py index 8c2f518..a7d1d91 100644 --- a/src/mudlib/combat/moves.py +++ b/src/mudlib/combat/moves.py @@ -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")