Validate timing fields per move type in load_move
This commit is contained in:
parent
0a9a7f74bc
commit
5c2cc28415
1 changed files with 10 additions and 0 deletions
|
|
@ -77,6 +77,16 @@ def load_move(path: Path) -> list[CombatMove]:
|
||||||
msg = f"missing required field: {field_name}"
|
msg = f"missing required field: {field_name}"
|
||||||
raise ValueError(msg)
|
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"]
|
base_name = data["name"]
|
||||||
variants = data.get("variants")
|
variants = data.get("variants")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue