Add guard behavior for opening defenders

This commit is contained in:
2026-06-19 19:06:50 +09:00
parent f13f20939f
commit 8f1b6fb398
6 changed files with 232 additions and 3 deletions

View File

@@ -54,6 +54,15 @@ func hydrate_deployment(deployment: Dictionary) -> Dictionary:
unit["controllable"] = bool(deployment.get("controllable", true))
unit["persist_progression"] = bool(deployment.get("persist_progression", true))
unit["ai_target_priority"] = int(deployment.get("ai_target_priority", 0))
unit["ai_behavior"] = str(deployment.get("ai_behavior", "")).strip_edges().to_lower()
if deployment.has("ai_guard_anchor"):
unit["ai_guard_anchor"] = deployment["ai_guard_anchor"]
elif unit["ai_behavior"] == "guard":
unit["ai_guard_anchor"] = deployment.get("pos", [0, 0])
if deployment.has("ai_guard_radius"):
unit["ai_guard_radius"] = int(deployment.get("ai_guard_radius", 0))
elif unit["ai_behavior"] == "guard":
unit["ai_guard_radius"] = 2
unit["level"] = int(deployment.get("level", officer.get("level", 1)))
unit["exp"] = int(deployment.get("exp", officer.get("exp", 0)))
unit["max_hp"] = int(stats.get("hp", stats.get("max_hp", 1)))