From 44c5afd424619e53ea168666d2977834d9c09e85 Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Fri, 9 Feb 2024 13:34:44 +0000 Subject: Log misses in battle tab, alongside hits --- src/being/being.cpp | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index b12b00c08..33610e54b 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -753,7 +753,7 @@ void Being::takeDamage(Being *restrict const attacker, { if (this == localPlayer) { - if (attacker->mType == ActorType::Player || (amount != 0)) + if (amount != 0) { ChatWindow::battleChatLog(strprintf("%s : Hit you -%d", attacker->getName().c_str(), amount), @@ -761,16 +761,36 @@ void Being::takeDamage(Being *restrict const attacker, IgnoreRecord_false, TryRemoveColors_true); } + else + { + ChatWindow::battleChatLog(strprintf("%s : Missed you", + attacker->getName().c_str()), + ChatMsgType::BY_OTHER, + IgnoreRecord_false, + TryRemoveColors_true); + } } - else if (attacker == localPlayer && (amount != 0)) + else if (attacker == localPlayer) { - ChatWindow::battleChatLog(strprintf("%s : You hit %s -%d", - attacker->mName.c_str(), - mName.c_str(), - amount), - ChatMsgType::BY_PLAYER, - IgnoreRecord_false, - TryRemoveColors_true); + if (amount != 0) + { + ChatWindow::battleChatLog(strprintf("%s : You hit %s -%d", + attacker->mName.c_str(), + mName.c_str(), + amount), + ChatMsgType::BY_PLAYER, + IgnoreRecord_false, + TryRemoveColors_true); + } + else + { + ChatWindow::battleChatLog(strprintf("%s : You missed %s", + attacker->mName.c_str(), + mName.c_str()), + ChatMsgType::BY_PLAYER, + IgnoreRecord_false, + TryRemoveColors_true); + } } } if (font != nullptr && particleEngine != nullptr) -- cgit v1.2.3-60-g2f50