Clarify enemy lure distance feedback

This commit is contained in:
2026-06-20 12:16:14 +09:00
parent 47b9840e4b
commit 1b27275eda
2 changed files with 54 additions and 6 deletions

View File

@@ -9631,15 +9631,16 @@ func _unit_ai_behavior_text(unit: Dictionary) -> String:
var behavior := str(unit.get("ai_behavior", "")).strip_edges().to_lower()
if behavior == "guard":
var guard_radius := int(unit.get("ai_guard_radius", 0))
return "수비: 거점 경계 반경 %d 안에서 길목을 지킵니다." % guard_radius
return "수비: 거점 경계 반경 %d 안에서 길목을 지킵니다. %s" % [guard_radius, _unit_ai_anchor_pressure_text(unit, "ai_guard_anchor", guard_radius, "거점")]
if behavior == "sentry":
var sentry_radius := int(unit.get("ai_sentry_radius", 0))
var activation_turn := int(unit.get("ai_sentry_activation_turn", 0))
if bool(unit.get("ai_awake", false)):
return "초병: 경계가 풀려 추격 중입니다. 유인 반경 %d" % sentry_radius
var pressure_text := _unit_ai_anchor_pressure_text(unit, "ai_sentry_anchor", sentry_radius, "유인")
if activation_turn > 0:
return "초병: 유인 반경 %d 또는 제%d군령에 움직입니다." % [sentry_radius, activation_turn]
return "초병: 유인 반경 %d 안에 들어오면 움직입니다." % sentry_radius
return "초병: 유인 반경 %d 또는 제%d군령에 움직입니다. %s" % [sentry_radius, activation_turn, pressure_text]
return "초병: 유인 반경 %d 안에 들어오면 움직입니다. %s" % [sentry_radius, pressure_text]
return ""
@@ -9648,18 +9649,55 @@ func _unit_ai_behavior_hover_line(unit: Dictionary) -> String:
return ""
var behavior := str(unit.get("ai_behavior", "")).strip_edges().to_lower()
if behavior == "guard":
return "수비 · 거점 반경 %d" % int(unit.get("ai_guard_radius", 0))
var guard_radius := int(unit.get("ai_guard_radius", 0))
return "수비 · 거점 %d · %s" % [guard_radius, _unit_ai_anchor_pressure_badge_text(unit, "ai_guard_anchor", guard_radius, "거점")]
if behavior == "sentry":
var sentry_radius := int(unit.get("ai_sentry_radius", 0))
if bool(unit.get("ai_awake", false)):
return "초병 경계 · 유인 반경 %d" % sentry_radius
var pressure_badge := _unit_ai_anchor_pressure_badge_text(unit, "ai_sentry_anchor", sentry_radius, "유인")
var activation_turn := int(unit.get("ai_sentry_activation_turn", 0))
if activation_turn > 0:
return "초병 대기 · 유인 %d · 제%d군령" % [sentry_radius, activation_turn]
return "초병 대기 · 유인 반경 %d" % sentry_radius
return "초병 대기 · 유인 %d · %s ·%d군령" % [sentry_radius, pressure_badge, activation_turn]
return "초병 대기 · 유인 %d · %s" % [sentry_radius, pressure_badge]
return ""
func _unit_ai_anchor_pressure_text(unit: Dictionary, anchor_key: String, radius: int, label: String) -> String:
var distance := _nearest_player_distance_to_ai_anchor(unit, anchor_key)
if distance < 0:
return "%s 거리를 읽을 수 없습니다." % label
if distance <= radius:
return "아군이 %s 범위 안에 있습니다." % label
return "가장 가까운 아군은 %s%d칸입니다." % [label, distance - radius]
func _unit_ai_anchor_pressure_badge_text(unit: Dictionary, anchor_key: String, radius: int, label: String) -> String:
var distance := _nearest_player_distance_to_ai_anchor(unit, anchor_key)
if distance < 0:
return "%s 미확인" % label
if distance <= radius:
return "%s 범위 안" % label
return "%s%d" % [label, distance - radius]
func _nearest_player_distance_to_ai_anchor(unit: Dictionary, anchor_key: String) -> int:
var anchor: Vector2i = unit.get(anchor_key, unit.get("pos", Vector2i(-1, -1)))
if not state.is_inside(anchor):
anchor = unit.get("pos", Vector2i(-1, -1))
if not state.is_inside(anchor):
return -1
var best_distance := 9999
for player in state.get_living_units(BattleState.TEAM_PLAYER):
if not bool(player.get("deployed", true)):
continue
var player_cell: Vector2i = player.get("pos", Vector2i(-1, -1))
if not state.is_inside(player_cell):
continue
best_distance = mini(best_distance, abs(player_cell.x - anchor.x) + abs(player_cell.y - anchor.y))
return -1 if best_distance == 9999 else best_distance
func _unit_ai_behavior_badge_text(unit: Dictionary) -> String:
if str(unit.get("team", "")) != BattleState.TEAM_ENEMY:
return ""