From c656a8088d3ef36732f90d5a3ddfd6dcc3f2a532 Mon Sep 17 00:00:00 2001 From: Wickedness Date: Sun, 21 Jun 2026 00:12:45 +0900 Subject: [PATCH] Prioritize core battle log entries --- scripts/scenes/battle_scene.gd | 44 +++++++++++++++++++++++++++++++--- tools/smoke_visual_assets.gd | 12 ++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/scripts/scenes/battle_scene.gd b/scripts/scenes/battle_scene.gd index f4bb256..d6180cd 100644 --- a/scripts/scenes/battle_scene.gd +++ b/scripts/scenes/battle_scene.gd @@ -11914,13 +11914,51 @@ func _refresh_battle_log_box() -> void: log_box.tooltip_text = "전투 기록\n군령과 전장 변화가 여기에 짧게 남습니다." return var visible_lines: Array[String] = [] - var start_index := maxi(0, battle_log_recent_lines.size() - BATTLE_LOG_VISIBLE_LINES) - for index in range(start_index, battle_log_recent_lines.size()): - visible_lines.append("· %s" % _short_preview_text(battle_log_recent_lines[index], BATTLE_LOG_VISIBLE_CHARS)) + for entry in _compact_battle_log_visible_entries(): + visible_lines.append("· %s" % _short_preview_text(str(entry), BATTLE_LOG_VISIBLE_CHARS)) log_box.append_text(_join_strings(visible_lines, "\n")) log_box.tooltip_text = "전투 기록\n%s" % _join_strings(battle_log_recent_lines, "\n") +func _compact_battle_log_visible_entries() -> Array[String]: + var target_count := mini(BATTLE_LOG_VISIBLE_LINES, battle_log_recent_lines.size()) + var visible_indices: Array[int] = [] + for offset in range(battle_log_recent_lines.size()): + var index := battle_log_recent_lines.size() - 1 - offset + var entry := str(battle_log_recent_lines[index]) + if _is_compact_battle_log_detail_entry(entry): + continue + visible_indices.push_front(index) + if visible_indices.size() >= target_count: + break + if visible_indices.size() < target_count: + for offset in range(battle_log_recent_lines.size()): + var index := battle_log_recent_lines.size() - 1 - offset + if visible_indices.has(index): + continue + visible_indices.push_front(index) + if visible_indices.size() >= target_count: + break + var entries: Array[String] = [] + for index in visible_indices: + entries.append(str(battle_log_recent_lines[index])) + return entries + + +func _is_compact_battle_log_detail_entry(entry_text: String) -> bool: + var normalized := entry_text.strip_edges() + if normalized.is_empty(): + return true + if normalized.contains("공적 +"): + return true + if normalized.ends_with(" 소모.") and normalized.contains("기력 "): + return true + for directional_token in ["후방 공격 +", "측면 공격 +", "정면 공격 +"]: + if normalized.contains(directional_token): + return true + return false + + func _format_log_entry_text(message: String) -> String: if message.begins_with("Objective updated:"): return "군령 갱신:%s" % message.substr("Objective updated:".length()) diff --git a/tools/smoke_visual_assets.gd b/tools/smoke_visual_assets.gd index 27c7277..e1df37f 100644 --- a/tools/smoke_visual_assets.gd +++ b/tools/smoke_visual_assets.gd @@ -3983,6 +3983,18 @@ func _check_ancient_ui_theme(failures: Array[String]) -> void: failures.append("battle log tooltip should preserve earlier history: %s" % scene.log_box.tooltip_text) if scene.log_box.scroll_active: failures.append("battle log should avoid a visible scrollbar in the compact side panel") + scene._clear_battle_log() + scene._append_battle_log_entry("조조 공격 황건병, 12 피해. 명중 88%.") + scene._append_battle_log_entry("황건병 후방 공격 +2.") + scene._append_battle_log_entry("황건병 퇴각.") + scene._append_battle_log_entry("조조 공적 +12.") + visible_log_text = scene.log_box.get_parsed_text() + if visible_log_text.contains("공적 +") or visible_log_text.contains("후방 공격 +"): + failures.append("battle log visible text should keep bookkeeping detail out of the compact panel: %s" % visible_log_text) + if not visible_log_text.contains("조조 공격") or not visible_log_text.contains("황건병 퇴각"): + failures.append("battle log visible text should prefer core action outcomes over detail lines: %s" % visible_log_text) + if not scene.log_box.tooltip_text.contains("공적 +12") or not scene.log_box.tooltip_text.contains("후방 공격 +2"): + failures.append("battle log tooltip should preserve filtered combat detail: %s" % scene.log_box.tooltip_text) var localized_lines := scene._normalized_dialogue_lines([{"speaker": "Cao Cao", "display_speaker": "조조", "text": "군령을 전하라."}]) if localized_lines.is_empty() or str((localized_lines[0] as Dictionary).get("speaker", "")) != "조조": failures.append("dialogue normalization should preserve display_speaker for localized names")