Show status effect durations

This commit is contained in:
2026-06-18 15:23:13 +09:00
parent e005b82bbb
commit 5a3e5e1b64
6 changed files with 223 additions and 11 deletions

View File

@@ -1114,24 +1114,36 @@ func _format_active_status_effects(unit: Dictionary) -> String:
for effect in _active_status_effects(unit):
var effect_type := str(effect.get("type", "stat_bonus"))
var amount := int(effect.get("amount", 0))
var duration_text := _format_status_remaining_phases(effect)
if effect_type == "damage_over_time":
if amount > 0:
parts.append("%s -%d HP" % [_status_display_name(str(effect.get("status", "poison"))), amount])
parts.append("%s -%d HP %s" % [
_status_display_name(str(effect.get("status", "poison"))),
amount,
duration_text
])
continue
if effect_type == "action_lock":
parts.append("%s %s" % [
parts.append("%s %s %s" % [
_status_display_name(str(effect.get("status", "status"))),
_action_lock_display_name(str(effect.get("action", "")))
_action_lock_display_name(str(effect.get("action", ""))),
duration_text
])
continue
var stat := str(effect.get("stat", ""))
if not _is_supported_status_stat(stat) or amount == 0:
continue
var sign := "+" if amount > 0 else ""
parts.append("%s %s%d" % [stat.to_upper(), sign, amount])
parts.append("%s %s%d %s" % [stat.to_upper(), sign, amount, duration_text])
return _join_strings(parts, ", ")
func _format_status_remaining_phases(effect: Dictionary) -> String:
var remaining: int = maxi(1, int(effect.get("remaining_phases", 1)))
var label := "phase" if remaining == 1 else "phases"
return "(%d %s)" % [remaining, label]
func _status_display_name(status: String) -> String:
var normalized := status.strip_edges()
if normalized.is_empty():
@@ -1155,12 +1167,12 @@ func _unit_has_action_lock(unit: Dictionary, action: String) -> bool:
func _action_lock_display_name(action: String) -> String:
if action == "skill":
return "tactics"
return "no tactics"
if action == "move":
return "movement"
return "no movement"
if action == "attack":
return "attacks"
return "action"
return "no attacks"
return "no action"
func try_wait_selected() -> bool: