Expose tactical marker hints

This commit is contained in:
2026-06-20 15:34:28 +09:00
parent f320124270
commit 7ff1e84d53
5 changed files with 169 additions and 1 deletions

View File

@@ -1803,6 +1803,12 @@ func get_objective_cell_label(cell: Vector2i) -> String:
return _objective_cell_label_for_condition(battle_conditions.get("victory", {}), cell)
func get_objective_cell_hint(cell: Vector2i) -> String:
if not is_inside(cell):
return ""
return _objective_cell_hint_for_condition(battle_conditions.get("victory", {}), cell)
func get_event_markers() -> Array[Dictionary]:
var result: Array[Dictionary] = []
var objective_cells := get_objective_cells()
@@ -1827,6 +1833,7 @@ func get_event_markers() -> Array[Dictionary]:
"id": event_id,
"label": _event_marker_label(event),
"kind": _event_marker_kind(event),
"hint": _event_marker_hint(event),
"cells": cells
})
return result
@@ -1864,6 +1871,16 @@ func get_event_marker_kind(cell: Vector2i) -> String:
return ""
func get_event_marker_hint(cell: Vector2i) -> String:
if not is_inside(cell):
return ""
for marker in get_event_markers():
var cells = marker.get("cells", [])
if typeof(cells) == TYPE_ARRAY and cells.has(cell):
return str(marker.get("hint", ""))
return ""
func get_objective_progress_lines(include_defeat_risks := false, include_turn_limit := true) -> Array[String]:
var result: Array[String] = []
_append_condition_progress_lines(battle_conditions.get("victory", {}), result, "victory")
@@ -4418,6 +4435,28 @@ func _objective_cell_label_for_condition(condition_group, cell: Vector2i) -> Str
return ""
func _objective_cell_hint_for_condition(condition_group, cell: Vector2i) -> String:
if typeof(condition_group) == TYPE_ARRAY:
for condition in condition_group:
var hint := _objective_cell_hint_for_condition(condition, cell)
if not hint.is_empty():
return hint
return ""
if typeof(condition_group) != TYPE_DICTIONARY:
return ""
if not _condition_gate_open(condition_group):
return _objective_cell_hint_for_after_event(str(condition_group.get("after_event", "")), cell)
var condition_type := str(condition_group.get("type", ""))
if condition_type == "all" or condition_type == "any":
return _objective_cell_hint_for_condition(condition_group.get("conditions", []), cell)
if condition_type != "unit_reaches_tile":
return ""
if _condition_cells(condition_group).has(cell):
return _condition_marker_hint(condition_group)
return ""
func _objective_cell_label_for_after_event(event_id: String, cell: Vector2i) -> String:
if event_id.is_empty() or fired_event_ids.has(event_id):
return ""
@@ -4434,6 +4473,25 @@ func _objective_cell_label_for_after_event(event_id: String, cell: Vector2i) ->
return ""
func _objective_cell_hint_for_after_event(event_id: String, cell: Vector2i) -> String:
if event_id.is_empty() or fired_event_ids.has(event_id):
return ""
var event := _event_by_id(event_id)
if event.is_empty():
return ""
var when: Dictionary = event.get("when", {})
if str(when.get("type", "")) != "unit_reaches_tile":
return ""
if not _event_gate_open(when) or not _campaign_flags_match(when.get("campaign_flags", {})):
return ""
if _condition_cells(when).has(cell):
var hint := _condition_marker_hint(when)
if hint.is_empty():
hint = _event_marker_hint(event)
return hint
return ""
func _event_has_reward_action(event: Dictionary) -> bool:
for action in event.get("actions", []):
if typeof(action) != TYPE_DICTIONARY:
@@ -4476,6 +4534,33 @@ func _event_marker_label(event: Dictionary) -> String:
return "전장 표식"
func _condition_marker_hint(condition: Dictionary) -> String:
for key in ["objective_hint", "marker_hint", "hint"]:
var value := str(condition.get(key, "")).strip_edges()
if not value.is_empty():
return value
return ""
func _event_marker_hint(event: Dictionary) -> String:
for key in ["marker_hint", "hint"]:
var value := str(event.get(key, "")).strip_edges()
if not value.is_empty():
return value
var when: Dictionary = event.get("when", {})
var condition_hint := _condition_marker_hint(when)
if not condition_hint.is_empty():
return condition_hint
var kind := _event_marker_kind(event)
if kind == "tactic":
return "적 앞줄만 끌어내기 좋은 전술 표식입니다."
if kind == "gold":
return "전장 군자금을 거둘 수 있는 표식입니다."
if kind == "supply":
return "소모품이나 회복 거점을 얻을 수 있는 보급 표식입니다."
return ""
func _event_marker_kind(event: Dictionary) -> String:
var explicit_kind := str(event.get("marker_kind", "")).strip_edges().to_lower()
if explicit_kind.is_empty():