fix: apply skull-red color and "Lv ??" to level-0 mobs in focus frame
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run

Consistent with the target frame fix: focus targets with level 0
(unknown/?? mobs) now show skull-red instead of grey, and display
"Lv ??" instead of "Lv 0".
This commit is contained in:
Kelsi 2026-03-17 14:18:49 -07:00
parent 39f4162ec1
commit 5513c4aad5

View file

@ -4344,17 +4344,21 @@ void GameScreen::renderFocusFrame(game::GameHandler& gameHandler) {
} else if (u->isHostile()) {
uint32_t playerLv = gameHandler.getPlayerLevel();
uint32_t mobLv = u->getLevel();
int32_t diff = static_cast<int32_t>(mobLv) - static_cast<int32_t>(playerLv);
if (game::GameHandler::killXp(playerLv, mobLv) == 0)
focusColor = ImVec4(0.6f, 0.6f, 0.6f, 1.0f);
else if (diff >= 10)
focusColor = ImVec4(1.0f, 0.1f, 0.1f, 1.0f);
else if (diff >= 5)
focusColor = ImVec4(1.0f, 0.5f, 0.1f, 1.0f);
else if (diff >= -2)
focusColor = ImVec4(1.0f, 1.0f, 0.1f, 1.0f);
else
focusColor = ImVec4(0.3f, 1.0f, 0.3f, 1.0f);
if (mobLv == 0) {
focusColor = ImVec4(1.0f, 0.1f, 0.1f, 1.0f); // ?? level = skull red
} else {
int32_t diff = static_cast<int32_t>(mobLv) - static_cast<int32_t>(playerLv);
if (game::GameHandler::killXp(playerLv, mobLv) == 0)
focusColor = ImVec4(0.6f, 0.6f, 0.6f, 1.0f);
else if (diff >= 10)
focusColor = ImVec4(1.0f, 0.1f, 0.1f, 1.0f);
else if (diff >= 5)
focusColor = ImVec4(1.0f, 0.5f, 0.1f, 1.0f);
else if (diff >= -2)
focusColor = ImVec4(1.0f, 1.0f, 0.1f, 1.0f);
else
focusColor = ImVec4(0.3f, 1.0f, 0.3f, 1.0f);
}
} else {
focusColor = ImVec4(0.3f, 1.0f, 0.3f, 1.0f);
}
@ -4487,7 +4491,10 @@ void GameScreen::renderFocusFrame(game::GameHandler& gameHandler) {
// Level + health on same row
ImGui::SameLine();
ImGui::TextDisabled("Lv %u", unit->getLevel());
if (unit->getLevel() == 0)
ImGui::TextDisabled("Lv ??");
else
ImGui::TextDisabled("Lv %u", unit->getLevel());
uint32_t hp = unit->getHealth();
uint32_t maxHp = unit->getMaxHealth();