mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 16:30:15 +00:00
fix(combattext): render deflect and reflect miss events
This commit is contained in:
parent
dceaf8f1ac
commit
77d53baa09
3 changed files with 32 additions and 6 deletions
|
|
@ -52,7 +52,7 @@ struct CombatTextEntry {
|
|||
enum Type : uint8_t {
|
||||
MELEE_DAMAGE, SPELL_DAMAGE, HEAL, MISS, DODGE, PARRY, BLOCK,
|
||||
CRIT_DAMAGE, CRIT_HEAL, PERIODIC_DAMAGE, PERIODIC_HEAL, ENVIRONMENTAL,
|
||||
ENERGIZE, XP_GAIN, IMMUNE, ABSORB, RESIST, PROC_TRIGGER,
|
||||
ENERGIZE, XP_GAIN, IMMUNE, ABSORB, RESIST, DEFLECT, REFLECT, PROC_TRIGGER,
|
||||
DISPEL, STEAL, INTERRUPT, INSTAKILL
|
||||
};
|
||||
Type type;
|
||||
|
|
|
|||
|
|
@ -2723,11 +2723,12 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
CombatTextEntry::BLOCK, // 3=BLOCK
|
||||
CombatTextEntry::MISS, // 4=EVADE
|
||||
CombatTextEntry::IMMUNE, // 5=IMMUNE
|
||||
CombatTextEntry::MISS, // 6=DEFLECT
|
||||
CombatTextEntry::DEFLECT, // 6=DEFLECT
|
||||
CombatTextEntry::ABSORB, // 7=ABSORB
|
||||
CombatTextEntry::RESIST, // 8=RESIST
|
||||
};
|
||||
CombatTextEntry::Type ct = (missInfo < 9) ? missTypes[missInfo] : CombatTextEntry::MISS;
|
||||
CombatTextEntry::Type ct = (missInfo < 9) ? missTypes[missInfo]
|
||||
: (missInfo == 11 ? CombatTextEntry::REFLECT : CombatTextEntry::MISS);
|
||||
if (casterGuid == playerGuid) {
|
||||
// We cast a spell and it missed the target
|
||||
addCombatText(ct, 0, spellId, true, 0, casterGuid, victimGuid);
|
||||
|
|
@ -16386,7 +16387,7 @@ void GameHandler::handleAttackerStateUpdate(network::Packet& packet) {
|
|||
addCombatText(CombatTextEntry::IMMUNE, 0, 0, isPlayerAttacker, 0, data.attackerGuid, data.targetGuid);
|
||||
} else if (data.victimState == 7) {
|
||||
// VICTIMSTATE_DEFLECT: Attack was deflected (e.g. shield slam reflect).
|
||||
addCombatText(CombatTextEntry::MISS, 0, 0, isPlayerAttacker, 0, data.attackerGuid, data.targetGuid);
|
||||
addCombatText(CombatTextEntry::DEFLECT, 0, 0, isPlayerAttacker, 0, data.attackerGuid, data.targetGuid);
|
||||
} else {
|
||||
auto type = data.isCrit() ? CombatTextEntry::CRIT_DAMAGE : CombatTextEntry::MELEE_DAMAGE;
|
||||
addCombatText(type, data.totalDamage, 0, isPlayerAttacker, 0, data.attackerGuid, data.targetGuid);
|
||||
|
|
@ -16998,7 +16999,7 @@ void GameHandler::handleSpellGo(network::Packet& packet) {
|
|||
CombatTextEntry::BLOCK, // 3=BLOCK
|
||||
CombatTextEntry::MISS, // 4=EVADE
|
||||
CombatTextEntry::IMMUNE, // 5=IMMUNE
|
||||
CombatTextEntry::MISS, // 6=DEFLECT
|
||||
CombatTextEntry::DEFLECT, // 6=DEFLECT
|
||||
CombatTextEntry::ABSORB, // 7=ABSORB
|
||||
CombatTextEntry::RESIST, // 8=RESIST
|
||||
};
|
||||
|
|
@ -17009,7 +17010,8 @@ void GameHandler::handleSpellGo(network::Packet& packet) {
|
|||
if (!playerIsCaster && m.targetGuid != playerGuid) {
|
||||
continue;
|
||||
}
|
||||
CombatTextEntry::Type ct = (m.missType < 9) ? missTypes[m.missType] : CombatTextEntry::MISS;
|
||||
CombatTextEntry::Type ct = (m.missType < 9) ? missTypes[m.missType]
|
||||
: (m.missType == 11 ? CombatTextEntry::REFLECT : CombatTextEntry::MISS);
|
||||
addCombatText(ct, 0, data.spellId, playerIsCaster, 0, spellCasterGuid, m.targetGuid);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8388,6 +8388,16 @@ void GameScreen::renderCombatText(game::GameHandler& gameHandler) {
|
|||
snprintf(text, sizeof(text), "Resisted");
|
||||
color = ImVec4(0.7f, 0.7f, 0.7f, alpha); // Grey for resist
|
||||
break;
|
||||
case game::CombatTextEntry::DEFLECT:
|
||||
snprintf(text, sizeof(text), outgoing ? "Deflect" : "You Deflect");
|
||||
color = outgoing ? ImVec4(0.7f, 0.7f, 0.7f, alpha)
|
||||
: ImVec4(0.5f, 0.9f, 1.0f, alpha);
|
||||
break;
|
||||
case game::CombatTextEntry::REFLECT:
|
||||
snprintf(text, sizeof(text), outgoing ? "Reflect" : "Reflected");
|
||||
color = outgoing ? ImVec4(0.85f, 0.75f, 1.0f, alpha)
|
||||
: ImVec4(0.75f, 0.85f, 1.0f, alpha);
|
||||
break;
|
||||
case game::CombatTextEntry::PROC_TRIGGER: {
|
||||
const std::string& procName = entry.spellId ? gameHandler.getSpellName(entry.spellId) : "";
|
||||
if (!procName.empty())
|
||||
|
|
@ -20281,6 +20291,20 @@ void GameScreen::renderCombatLog(game::GameHandler& gameHandler) {
|
|||
snprintf(desc, sizeof(desc), "Resisted");
|
||||
color = ImVec4(0.6f, 0.6f, 0.9f, 1.0f);
|
||||
break;
|
||||
case T::DEFLECT:
|
||||
if (spell)
|
||||
snprintf(desc, sizeof(desc), "%s deflects %s's %s", tgt, src, spell);
|
||||
else
|
||||
snprintf(desc, sizeof(desc), "%s deflects %s's attack", tgt, src);
|
||||
color = ImVec4(0.65f, 0.8f, 0.95f, 1.0f);
|
||||
break;
|
||||
case T::REFLECT:
|
||||
if (spell)
|
||||
snprintf(desc, sizeof(desc), "%s reflects %s's %s", tgt, src, spell);
|
||||
else
|
||||
snprintf(desc, sizeof(desc), "%s reflects %s's attack", tgt, src);
|
||||
color = ImVec4(0.8f, 0.7f, 1.0f, 1.0f);
|
||||
break;
|
||||
case T::ENVIRONMENTAL:
|
||||
snprintf(desc, sizeof(desc), "Environmental damage: %d", e.amount);
|
||||
color = ImVec4(1.0f, 0.5f, 0.2f, 1.0f);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue