diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2018-02-10 16:43:01 -0300 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-08-28 15:59:11 +0200 |
| commit | 962f6d7988b9003e550f6745be7cff812e9d8efa (patch) | |
| tree | ee6ab5872b947afb00f4ca99e87c7dddea35bdb3 /src/server/game/Server | |
| parent | 65dca120d34febdaa84a63e17f638ab0fa59b3df (diff) | |
Core/Spells: rework part 5: GameObject casting
Closes #21330
Closes #18885
Ref #18752
(cherry picked from commit 45c5e1b9d63796d168339a44f63418f220cf2403)
Diffstat (limited to 'src/server/game/Server')
| -rw-r--r-- | src/server/game/Server/Packets/CombatLogPacketsCommon.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp b/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp index c03f304a215..a065e619e98 100644 --- a/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp +++ b/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp @@ -38,21 +38,24 @@ void SpellCastLogData::Initialize(Unit const* unit) void SpellCastLogData::Initialize(Spell const* spell) { - Health = spell->GetCaster()->GetHealth(); - AttackPower = spell->GetCaster()->GetTotalAttackPowerValue(spell->GetCaster()->getClass() == CLASS_HUNTER ? RANGED_ATTACK : BASE_ATTACK); - SpellPower = spell->GetCaster()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SPELL); - Armor = spell->GetCaster()->GetArmor(); - Powers primaryPowerType = spell->GetCaster()->GetPowerType(); - bool primaryPowerAdded = false; - for (SpellPowerCost const& cost : spell->GetPowerCost()) + if (Unit const* unitCaster = spell->GetCaster()->ToUnit()) { - PowerData.emplace_back(int32(cost.Power), spell->GetCaster()->GetPower(Powers(cost.Power)), int32(cost.Amount)); - if (cost.Power == primaryPowerType) - primaryPowerAdded = true; - } + Health = unitCaster->GetHealth(); + AttackPower = unitCaster->GetTotalAttackPowerValue(unitCaster->getClass() == CLASS_HUNTER ? RANGED_ATTACK : BASE_ATTACK); + SpellPower = unitCaster->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SPELL); + Armor = unitCaster->GetArmor(); + Powers primaryPowerType = unitCaster->GetPowerType(); + bool primaryPowerAdded = false; + for (SpellPowerCost const& cost : spell->GetPowerCost()) + { + PowerData.emplace_back(int32(cost.Power), unitCaster->GetPower(Powers(cost.Power)), int32(cost.Amount)); + if (cost.Power == primaryPowerType) + primaryPowerAdded = true; + } - if (!primaryPowerAdded) - PowerData.insert(PowerData.begin(), SpellLogPowerData(int32(primaryPowerType), spell->GetCaster()->GetPower(primaryPowerType), 0)); + if (!primaryPowerAdded) + PowerData.insert(PowerData.begin(), SpellLogPowerData(int32(primaryPowerType), unitCaster->GetPower(primaryPowerType), 0)); + } } template<class T, class U> |
