From a151531a2a4ca2d56a5f3bfadb4e005b9befce16 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 18 Mar 2026 03:28:06 -0700 Subject: [PATCH] feat: show health bar on target-of-target in target frame The ToT health bar gives healers immediate % health readout of whoever the target is attacking, without needing to click-through to that unit. --- src/ui/game_screen.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 086f29af..af8b5f62 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -4388,6 +4388,27 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) { if (ImGui::IsItemClicked()) { gameHandler.setTarget(totGuid); } + + // Compact health bar for the ToT — essential for healers tracking boss target + if (totEnt) { + auto totUnit = std::dynamic_pointer_cast(totEnt); + if (totUnit && totUnit->getMaxHealth() > 0) { + uint32_t totHp = totUnit->getHealth(); + uint32_t totMaxHp = totUnit->getMaxHealth(); + float totPct = static_cast(totHp) / static_cast(totMaxHp); + ImVec4 totBarColor = + totPct > 0.5f ? ImVec4(0.2f, 0.75f, 0.2f, 1.0f) : + totPct > 0.2f ? ImVec4(0.75f, 0.75f, 0.2f, 1.0f) : + ImVec4(0.75f, 0.2f, 0.2f, 1.0f); + ImGui::PushStyleColor(ImGuiCol_PlotHistogram, totBarColor); + ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.15f, 0.15f, 0.15f, 0.8f)); + char totOverlay[32]; + snprintf(totOverlay, sizeof(totOverlay), "%u%%", + static_cast(totPct * 100.0f + 0.5f)); + ImGui::ProgressBar(totPct, ImVec2(-1, 10), totOverlay); + ImGui::PopStyleColor(2); + } + } } } }