Show recovery terrain and guard hints

This commit is contained in:
2026-06-19 19:13:27 +09:00
parent 8f1b6fb398
commit 9a9c677863
3 changed files with 64 additions and 1 deletions

View File

@@ -502,6 +502,7 @@ func _unhandled_input(event: InputEvent) -> void:
func _draw() -> void:
_draw_map()
_draw_overlays()
_draw_recovery_terrain_markers(_visible_cell_bounds())
_draw_units()
_draw_objective_foreground_markers()
_draw_target_selection_markers()
@@ -2755,6 +2756,37 @@ func _draw_silk_map_patina(board_rect: Rect2, has_background: bool) -> void:
draw_circle(board_rect.end - Vector2(24, 22), 30.0, corner_stain)
func _draw_recovery_terrain_markers(bounds: Rect2i) -> void:
var font := _draw_ui_font(true)
for y in range(bounds.position.y, bounds.position.y + bounds.size.y):
for x in range(bounds.position.x, bounds.position.x + bounds.size.x):
var cell := Vector2i(x, y)
var marker_text := _recovery_marker_text(cell)
if marker_text.is_empty():
continue
var marker_rect := _recovery_marker_rect(cell)
draw_rect(marker_rect, Color(0.035, 0.022, 0.012, 0.74))
draw_rect(marker_rect, Color(UI_OLD_BRONZE.r, UI_OLD_BRONZE.g, UI_OLD_BRONZE.b, 0.88), false, 1.4)
var plus_center := marker_rect.position + Vector2(8.0, marker_rect.size.y * 0.5)
var plus_color := Color(0.54, 0.86, 0.48, 0.92)
draw_line(plus_center + Vector2(-3.0, 0.0), plus_center + Vector2(3.0, 0.0), plus_color, 1.6)
draw_line(plus_center + Vector2(0.0, -3.0), plus_center + Vector2(0.0, 3.0), plus_color, 1.6)
_draw_ink_text(font, marker_rect.position + Vector2(9.0, 13.0), marker_text, HORIZONTAL_ALIGNMENT_CENTER, marker_rect.size.x - 9.0, 11, Color(0.78, 0.98, 0.62, 0.96))
func _recovery_marker_text(cell: Vector2i) -> String:
var heal := state.get_terrain_heal(cell)
if heal <= 0:
return ""
return "+%d" % heal
func _recovery_marker_rect(cell: Vector2i) -> Rect2:
var cell_rect := _rect_for_cell(cell)
var size := Vector2(34.0, 16.0)
return Rect2(cell_rect.position + Vector2(TILE_SIZE - size.x - 4.0, 4.0), size)
func _draw_silk_map_frame(board_rect: Rect2) -> void:
var padding := MAP_SCROLL_FRAME_PADDING
var top_rod := Rect2(board_rect.position + Vector2(-padding, -padding), Vector2(board_rect.size.x + padding * 2.0, 7.0))
@@ -5175,6 +5207,9 @@ func _format_unit_focus_text(unit: Dictionary, prefix: String) -> String:
int(unit.get("range", 1))
])
lines.append(_unit_action_status_text(unit))
var ai_text := _unit_ai_behavior_text(unit)
if not ai_text.is_empty():
lines.append(ai_text)
var terrain_text := _unit_current_terrain_text(unit)
if not terrain_text.is_empty():
lines.append(terrain_text)
@@ -5305,6 +5340,18 @@ func _unit_class_display_name(unit: Dictionary) -> String:
return str(unit.get("class", "부대"))
func _unit_ai_behavior_text(unit: Dictionary) -> String:
if str(unit.get("team", "")) != BattleState.TEAM_ENEMY:
return ""
if str(unit.get("ai_behavior", "")).strip_edges().to_lower() != "guard":
return ""
var anchor: Vector2i = unit.get("ai_guard_anchor", unit.get("pos", Vector2i(-1, -1)))
var radius := int(unit.get("ai_guard_radius", 0))
if not state.is_inside(anchor):
return "수비: 거점 경계"
return "수비: 거점 %d,%d 반경 %d" % [anchor.x + 1, anchor.y + 1, radius]
func _unit_current_terrain_text(unit: Dictionary) -> String:
var cell: Vector2i = unit.get("pos", Vector2i(-1, -1))
if not state.is_inside(cell):
@@ -5422,6 +5469,9 @@ func _update_cell_info() -> void:
_format_hover_unit_equipment(unit)
]
var status_effects := state.get_status_effect_summary(unit["id"])
var ai_text := _unit_ai_behavior_text(unit)
if not ai_text.is_empty():
text += "\n%s" % ai_text
if not status_effects.is_empty():
text += "\n상태: %s" % status_effects
if show_threat_overlay: