using System; using System.Linq; using Cthangover.Core.Cards.StatusEffect; using Cthangover.Core.Characters; using Cthangover.Core.Mods.Resolvers; using Cthangover.Core.UI; using Cthangover.Core.UI.Theming; using Godot; namespace Cthangover.FFBattle.UI { /// /// Battle card of a single combatant, shared by the party and enemy panels. /// The node tree lives in scenes/ff_character_widget.tscn; this class /// only fetches the nodes, dresses them with styles and /// refreshes their content. Visually the card follows the unified style guide: /// a team accent line on top, a sprite well, status badges in the upper right /// and an info block holding name, HP numbers, HP bar, action point pips /// (party) or attack caption (enemies) and the defence shield chip. /// /// The public surface is animation-facing, not layout-facing: /// paints the selection frame, and /// give impact feedback, /// dissolves the card. Battle code never touches labels directly — it mutates /// the and calls , which /// re-reads health, defence, points and stun in one place. Panels must assign /// before , because the team colour is /// applied during initialisation. /// public partial class FFCharacterWidget : ModWidget { /// Diameter of one action point pip. private const int PipSize = 9; private TextureRect _art; private ColorRect _teamLine; private Panel _selection; private Panel _teamDot; private Label _nameLabel; private Label _hpNumLabel; private ProgressBar _hpBar; private HBoxContainer _pipsBox; private Label _atkLabel; private PanelContainer _shieldChip; private Label _shieldValue; private VBoxContainer _statusBox; private PanelContainer _stunBadge; private TextureRect _stunIcon; private Label _stunLabel; private Tween _animTween; private static Shader _dissolveShader; /// Whether this widget belongs to the player party (affects highlight/targeting logic). public bool IsPlayer { get; set; } /// Whether the character is dead; set by . public bool IsDead { get; set; } /// The character data model backing this widget: stats, actions, status effects. public Character Card { get; set; } /// Original scale captured at initialisation; used to restore after death animation. public Vector2 BaseScale { get; private set; } /// Exposes this widget as a for layout calculations. public Control ControlNode => this; protected override void Construct() { CthangoverTheme.Apply(this); _teamLine = GetNode("TeamLine"); _art = GetNode("Art"); _nameLabel = GetNode