AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
DamageInfo Class Reference

#include "Unit.h"

Public Member Functions

 DamageInfo (Unit *_attacker, Unit *_victim, uint32 _damage, SpellInfo const *_spellInfo, SpellSchoolMask _schoolMask, DamageEffectType _damageType, uint32 cleanDamage=0)
 
 DamageInfo (CalcDamageInfo const &dmgInfo)
 
 DamageInfo (CalcDamageInfo const &dmgInfo, uint8 damageIndex)
 
 DamageInfo (SpellNonMeleeDamage const &spellNonMeleeDamage, DamageEffectType damageType)
 
void ModifyDamage (int32 amount)
 
void AbsorbDamage (uint32 amount)
 
void ResistDamage (uint32 amount)
 
void BlockDamage (uint32 amount)
 
UnitGetAttacker () const
 
UnitGetVictim () const
 
SpellInfo const * GetSpellInfo () const
 
SpellSchoolMask GetSchoolMask () const
 
DamageEffectType GetDamageType () const
 
WeaponAttackType GetAttackType () const
 
uint32 GetDamage () const
 
uint32 GetAbsorb () const
 
uint32 GetResist () const
 
uint32 GetBlock () const
 
uint32 GetUnmitigatedDamage () const
 

Private Member Functions

 DamageInfo (DamageInfo const &dmg1, DamageInfo const &dmg2)
 

Private Attributes

Unit *const m_attacker
 
Unit *const m_victim
 
uint32 m_damage
 
SpellInfo const *const m_spellInfo
 
SpellSchoolMask const m_schoolMask
 
DamageEffectType const m_damageType
 
WeaponAttackType m_attackType
 
uint32 m_absorb
 
uint32 m_resist
 
uint32 m_block
 
uint32 m_cleanDamage
 

Detailed Description

Constructor & Destructor Documentation

◆ DamageInfo() [1/5]

DamageInfo::DamageInfo ( DamageInfo const &  dmg1,
DamageInfo const &  dmg2 
)
private
125 : m_attacker(dmg1.m_attacker), m_victim(dmg1.m_victim), m_damage(dmg1.m_damage + dmg2.m_damage), m_spellInfo(dmg1.m_spellInfo), m_schoolMask(SpellSchoolMask(dmg1.m_schoolMask | dmg2.m_schoolMask)),
126 m_damageType(dmg1.m_damageType), m_attackType(dmg1.m_attackType), m_absorb(dmg1.m_absorb + dmg2.m_absorb), m_resist(dmg1.m_resist + dmg2.m_resist), m_block(dmg1.m_block),
127 m_cleanDamage(dmg1.m_cleanDamage + dmg1.m_cleanDamage)
128{
129}
SpellSchoolMask
Definition: SharedDefines.h:295
uint32 m_resist
Definition: Unit.h:340
Unit *const m_attacker
Definition: Unit.h:332
WeaponAttackType m_attackType
Definition: Unit.h:338
SpellInfo const *const m_spellInfo
Definition: Unit.h:335
uint32 m_block
Definition: Unit.h:341
uint32 m_absorb
Definition: Unit.h:339
uint32 m_cleanDamage
Definition: Unit.h:342
uint32 m_damage
Definition: Unit.h:334
SpellSchoolMask const m_schoolMask
Definition: Unit.h:336
DamageEffectType const m_damageType
Definition: Unit.h:337
Unit *const m_victim
Definition: Unit.h:333

◆ DamageInfo() [2/5]

DamageInfo::DamageInfo ( Unit _attacker,
Unit _victim,
uint32  _damage,
SpellInfo const *  _spellInfo,
SpellSchoolMask  _schoolMask,
DamageEffectType  _damageType,
uint32  cleanDamage = 0 
)
explicit
112 : m_attacker(_attacker), m_victim(_victim), m_damage(_damage), m_spellInfo(_spellInfo), m_schoolMask(_schoolMask),
113 m_damageType(_damageType), m_attackType(BASE_ATTACK), m_cleanDamage(cleanDamage)
114{
115 m_absorb = 0;
116 m_resist = 0;
117 m_block = 0;
118}
@ BASE_ATTACK
Definition: Unit.h:209

References m_absorb, m_block, and m_resist.

◆ DamageInfo() [3/5]

DamageInfo::DamageInfo ( CalcDamageInfo const &  dmgInfo)
explicit
120 : DamageInfo(DamageInfo(dmgInfo, 0), DamageInfo(dmgInfo, 1))
121{
122}
Definition: Unit.h:330

◆ DamageInfo() [4/5]

DamageInfo::DamageInfo ( CalcDamageInfo const &  dmgInfo,
uint8  damageIndex 
)
132 : m_attacker(dmgInfo.attacker), m_victim(dmgInfo.target), m_damage(dmgInfo.damages[damageIndex].damage), m_spellInfo(nullptr), m_schoolMask(SpellSchoolMask(dmgInfo.damages[damageIndex].damageSchoolMask)),
133 m_damageType(DIRECT_DAMAGE), m_attackType(dmgInfo.attackType), m_absorb(dmgInfo.damages[damageIndex].absorb), m_resist(dmgInfo.damages[damageIndex].resist), m_block(dmgInfo.blocked_amount),
134 m_cleanDamage(dmgInfo.cleanDamage)
135{
136}
@ DIRECT_DAMAGE
Definition: Unit.h:248

◆ DamageInfo() [5/5]

DamageInfo::DamageInfo ( SpellNonMeleeDamage const &  spellNonMeleeDamage,
DamageEffectType  damageType 
)
139 : m_attacker(spellNonMeleeDamage.attacker), m_victim(spellNonMeleeDamage.target), m_damage(spellNonMeleeDamage.damage),
140 m_spellInfo(spellNonMeleeDamage.spellInfo), m_schoolMask(SpellSchoolMask(spellNonMeleeDamage.schoolMask)), m_damageType(damageType),
141 m_absorb(spellNonMeleeDamage.absorb), m_resist(spellNonMeleeDamage.resist), m_block(spellNonMeleeDamage.blocked),
142 m_cleanDamage(spellNonMeleeDamage.cleanDamage)
143{
144}

Member Function Documentation

◆ AbsorbDamage()

void DamageInfo::AbsorbDamage ( uint32  amount)
153{
154 amount = std::min(amount, GetDamage());
155 m_absorb += amount;
156 m_damage -= amount;
157}
uint32 GetDamage() const
Definition: Unit.h:364

References GetDamage(), m_absorb, and m_damage.

Referenced by spell_mage_fire_frost_ward::Absorb(), Unit::CalcAbsorbResist(), and spell_valanar_kinetic_bomb_absorb_aura::OnAbsorb().

◆ BlockDamage()

void DamageInfo::BlockDamage ( uint32  amount)
167{
168 amount = std::min(amount, GetDamage());
169 m_block += amount;
170 m_damage -= amount;
171}

References GetDamage(), m_block, and m_damage.

◆ GetAbsorb()

◆ GetAttacker()

◆ GetAttackType()

WeaponAttackType DamageInfo::GetAttackType ( ) const
inline

◆ GetBlock()

uint32 DamageInfo::GetBlock ( ) const
inline
367{ return m_block; };

References m_block.

Referenced by Unit::AttackerStateUpdate().

◆ GetDamage()

uint32 DamageInfo::GetDamage ( ) const
inline
364{ return m_damage; };

References m_damage.

Referenced by spell_shield_generator_aura::Absorb(), spell_yogg_saron_protective_gaze_aura::Absorb(), spell_charge_shield_bomber_aura::Absorb(), spell_black_temple_spell_absorption_aura::Absorb(), spell_dk_anti_magic_shell_raid::Absorb(), spell_dk_anti_magic_shell_self::Absorb(), spell_dk_anti_magic_zone::Absorb(), spell_dk_spell_deflection::Absorb(), spell_dk_will_of_the_necropolis::Absorb(), spell_dru_moonkin_form_passive::Absorb(), spell_dru_primal_tenacity::Absorb(), spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_rog_nerves_of_steel::Absorb(), spell_sha_astral_shift::Absorb(), spell_mage_fire_frost_ward::Absorb(), spell_pal_ardent_defender::Absorb(), AbsorbDamage(), Unit::AttackerStateUpdate(), BlockDamage(), Unit::CalcAbsorbResist(), Unit::CalculateSpellDamageTaken(), spell_deathbringer_blood_link_aura::CheckProc(), spell_deathbringer_blood_link_blood_beast_aura::CheckProc(), spell_dk_improved_blood_presence_proc::CheckProc(), spell_dk_scent_of_blood_trigger::CheckProc(), spell_item_shadowmourne::CheckProc(), spell_pal_sacred_shield_base::CheckProc(), spell_pal_seal_of_righteousness::CheckProc(), spell_warl_siphon_life::CheckProc(), spell_warl_fel_synergy::CheckProc(), Unit::DealDamage(), Unit::DealMeleeDamage(), Spell::EffectEnvironmentalDMG(), Player::EnvironmentalDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_reliquary_of_souls_aura_of_desire_aura::HandleProc(), spell_black_temple_consuming_strikes_aura::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), spell_mage_ignite::HandleProc(), spell_the_lich_king_dark_hunger_aura::HandleProc(), spell_oculus_temporal_rift_aura::HandleProc(), spell_yogg_saron_grim_reprisal_aura::HandleProc(), spell_dk_wandering_plague_aura::HandleProc(), spell_dk_blood_gorged::HandleProc(), spell_dru_t10_balance_4p_bonus::HandleProc(), spell_item_necrotic_touch::HandleProc(), spell_sha_t8_electrified::HandleProc(), spell_warl_seed_of_corruption_aura::HandleProc(), spell_warl_seed_of_corruption_generic_aura::HandleProc(), spell_dk_hungering_cold::HandleProc(), ModifyDamage(), spell_valanar_kinetic_bomb_absorb_aura::OnAbsorb(), spell_blood_queen_essence_of_the_blood_queen_aura::OnProc(), spell_pal_eye_for_an_eye::OnProc(), spell_warl_siphon_life::OnProc(), spell_warl_fel_synergy::OnProc(), and ResistDamage().

◆ GetDamageType()

DamageEffectType DamageInfo::GetDamageType ( ) const
inline

◆ GetResist()

◆ GetSchoolMask()

SpellSchoolMask DamageInfo::GetSchoolMask ( ) const
inline
361{ return m_schoolMask; };

References m_schoolMask.

Referenced by Unit::CalcAbsorbResist().

◆ GetSpellInfo()

◆ GetUnmitigatedDamage()

uint32 DamageInfo::GetUnmitigatedDamage ( ) const

◆ GetVictim()

Unit * DamageInfo::GetVictim ( ) const
inline
359{ return m_victim; };

References m_victim.

Referenced by Unit::CalcAbsorbResist().

◆ ModifyDamage()

void DamageInfo::ModifyDamage ( int32  amount)
147{
148 amount = std::min(amount, int32(GetDamage()));
149 m_damage += amount;
150}
std::int32_t int32
Definition: Define.h:103

References GetDamage(), and m_damage.

Referenced by AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ ResistDamage()

void DamageInfo::ResistDamage ( uint32  amount)
160{
161 amount = std::min(amount, GetDamage());
162 m_resist += amount;
163 m_damage -= amount;
164}

References GetDamage(), m_damage, and m_resist.

Referenced by Unit::CalcAbsorbResist().

Member Data Documentation

◆ m_absorb

uint32 DamageInfo::m_absorb
private

◆ m_attacker

Unit* const DamageInfo::m_attacker
private

Referenced by GetAttacker().

◆ m_attackType

WeaponAttackType DamageInfo::m_attackType
private

Referenced by GetAttackType().

◆ m_block

uint32 DamageInfo::m_block
private

Referenced by BlockDamage(), DamageInfo(), and GetBlock().

◆ m_cleanDamage

uint32 DamageInfo::m_cleanDamage
private

Referenced by GetUnmitigatedDamage().

◆ m_damage

◆ m_damageType

DamageEffectType const DamageInfo::m_damageType
private

Referenced by GetDamageType().

◆ m_resist

uint32 DamageInfo::m_resist
private

◆ m_schoolMask

SpellSchoolMask const DamageInfo::m_schoolMask
private

Referenced by GetSchoolMask().

◆ m_spellInfo

SpellInfo const* const DamageInfo::m_spellInfo
private

Referenced by GetSpellInfo().

◆ m_victim

Unit* const DamageInfo::m_victim
private

Referenced by GetVictim().