From fb01361837997e8349836b94861c6517c6efaa0b Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 11 Mar 2026 03:36:45 -0700 Subject: [PATCH] feat: show blocked amount and reduced damage on VICTIMSTATE_BLOCKS When an attack is partially blocked, the server sends the remaining damage in totalDamage and the blocked amount in data.blocked. Show both: the damage taken and a 'Block N' entry. When block amount is zero (full block with no damage), just show 'Block'. --- src/game/game_handler.cpp | 5 ++++- src/ui/game_screen.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index f730d6aa..9db4a4f3 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -13543,7 +13543,10 @@ void GameHandler::handleAttackerStateUpdate(network::Packet& packet) { } else if (data.victimState == 2) { addCombatText(CombatTextEntry::PARRY, 0, 0, isPlayerAttacker); } else if (data.victimState == 4) { - addCombatText(CombatTextEntry::BLOCK, 0, 0, isPlayerAttacker); + // VICTIMSTATE_BLOCKS: show reduced damage and the blocked amount + if (data.totalDamage > 0) + addCombatText(CombatTextEntry::MELEE_DAMAGE, data.totalDamage, 0, isPlayerAttacker); + addCombatText(CombatTextEntry::BLOCK, static_cast(data.blocked), 0, isPlayerAttacker); } else if (data.victimState == 5) { // VICTIMSTATE_EVADE: NPC evaded (out of combat zone). Show as miss. addCombatText(CombatTextEntry::MISS, 0, 0, isPlayerAttacker); diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 5f213707..52e056fb 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -5173,7 +5173,10 @@ void GameScreen::renderCombatText(game::GameHandler& gameHandler) { : ImVec4(0.4f, 0.9f, 1.0f, alpha); break; case game::CombatTextEntry::BLOCK: - snprintf(text, sizeof(text), outgoing ? "Block" : "You Block"); + if (entry.amount > 0) + snprintf(text, sizeof(text), outgoing ? "Block %d" : "You Block %d", entry.amount); + else + snprintf(text, sizeof(text), outgoing ? "Block" : "You Block"); color = outgoing ? ImVec4(0.6f, 0.6f, 0.6f, alpha) : ImVec4(0.4f, 0.9f, 1.0f, alpha); break;