Label first battle capture objective
This commit is contained in:
@@ -1613,6 +1613,12 @@ func get_objective_cells() -> Array[Vector2i]:
|
||||
return result
|
||||
|
||||
|
||||
func get_objective_cell_label(cell: Vector2i) -> String:
|
||||
if not is_inside(cell):
|
||||
return ""
|
||||
return _objective_cell_label_for_condition(battle_conditions.get("victory", {}), cell)
|
||||
|
||||
|
||||
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")
|
||||
@@ -3630,7 +3636,8 @@ func _append_destination_progress_line(result: Array[String], condition: Diction
|
||||
if targets.is_empty():
|
||||
return
|
||||
var status := "도달" if _unit_reaches_tile(condition) else "미도달"
|
||||
_append_progress_line(result, "전장 표식 %s · %s" % [_format_cells(targets), status], pending)
|
||||
var label := _condition_destination_label(condition)
|
||||
_append_progress_line(result, "%s %s · %s" % [label, _format_cells(targets), status], pending)
|
||||
|
||||
|
||||
func _append_turn_limit_progress_line(result: Array[String]) -> void:
|
||||
@@ -3662,7 +3669,17 @@ func _append_event_destination_progress_line(result: Array[String], when: Dictio
|
||||
if targets.is_empty():
|
||||
return
|
||||
var status := "도달" if _unit_reaches_tile(when) else "미도달"
|
||||
_append_progress_line(result, "전장 표식 %s · %s" % [_format_cells(targets), status])
|
||||
var label := _condition_destination_label(when)
|
||||
_append_progress_line(result, "%s %s · %s" % [label, _format_cells(targets), status])
|
||||
|
||||
|
||||
func _condition_destination_label(condition: Dictionary) -> String:
|
||||
var label := str(condition.get("label", "")).strip_edges()
|
||||
if label.is_empty():
|
||||
label = str(condition.get("objective_label", "")).strip_edges()
|
||||
if label.is_empty():
|
||||
return "전장 표식"
|
||||
return label
|
||||
|
||||
|
||||
func _append_turn_condition_progress_line(result: Array[String], condition: Dictionary, mode: String, pending := false) -> void:
|
||||
@@ -3936,6 +3953,44 @@ func _collect_after_event_objective_cells(event_id: String, result: Array[Vector
|
||||
result.append(cell)
|
||||
|
||||
|
||||
func _objective_cell_label_for_condition(condition_group, cell: Vector2i) -> String:
|
||||
if typeof(condition_group) == TYPE_ARRAY:
|
||||
for condition in condition_group:
|
||||
var label := _objective_cell_label_for_condition(condition, cell)
|
||||
if not label.is_empty():
|
||||
return label
|
||||
return ""
|
||||
if typeof(condition_group) != TYPE_DICTIONARY:
|
||||
return ""
|
||||
if not _condition_gate_open(condition_group):
|
||||
return _objective_cell_label_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_label_for_condition(condition_group.get("conditions", []), cell)
|
||||
if condition_type != "unit_reaches_tile":
|
||||
return ""
|
||||
if _condition_cells(condition_group).has(cell):
|
||||
return _condition_destination_label(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 ""
|
||||
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):
|
||||
return _condition_destination_label(when)
|
||||
return ""
|
||||
|
||||
|
||||
func _find_turn_limit(condition_group) -> int:
|
||||
if typeof(condition_group) == TYPE_ARRAY:
|
||||
var best_limit := 0
|
||||
|
||||
Reference in New Issue
Block a user