Show physical threat damage hints

This commit is contained in:
2026-06-18 11:36:14 +09:00
parent a4330481a6
commit cecdb05a4a
6 changed files with 68 additions and 6 deletions

View File

@@ -1492,10 +1492,38 @@ func _update_cell_info() -> void:
var status_effects := state.get_status_effect_summary(unit["id"])
if not status_effects.is_empty():
text += "\nEffects: %s" % status_effects
if show_threat_overlay:
var physical_threats := state.get_physical_threat_previews(cell, BattleState.TEAM_ENEMY)
if not physical_threats.is_empty():
text += "\nPhysical threat: %s" % _format_physical_threat_preview_text(physical_threats, 3)
cell_info_label.text = text
func _format_physical_threat_preview_text(previews: Array[Dictionary], limit: int) -> String:
var parts := []
var safe_limit: int = maxi(1, limit)
for index in range(mini(previews.size(), safe_limit)):
var preview: Dictionary = previews[index]
var defeat_text := " KO" if bool(preview.get("would_defeat", false)) else ""
var effective_text := ""
var effective_bonus := int(preview.get("effective_bonus", 0))
if effective_bonus > 0:
var effective_type := _format_move_type(str(preview.get("effective_target_type", "")))
var effective_target_text := "" if effective_type.is_empty() else " vs %s" % effective_type
effective_text = " Eff +%d%s" % [effective_bonus, effective_target_text]
parts.append("%s %d/%d%%%s%s" % [
str(preview.get("source_name", "Unit")),
int(preview.get("damage", 0)),
int(preview.get("hit_chance", 0)),
effective_text,
defeat_text
])
if previews.size() > safe_limit:
parts.append("+%d" % (previews.size() - safe_limit))
return _join_strings(parts, "; ")
func _compact_name_list(names: Array[String], limit: int) -> String:
var visible_names: Array[String] = []
var safe_limit: int = maxi(1, limit)