AzeorthCore 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)
 Construct a new DamageInfo::DamageInfo object. More...
 
 DamageInfo (CalcDamageInfo const &dmgInfo)
 Construct a new DamageInfo::DamageInfo object. More...
 
 DamageInfo (CalcDamageInfo const &dmgInfo, uint8 damageIndex)
 Construct a new DamageInfo::DamageInfo object. More...
 
 DamageInfo (SpellNonMeleeDamage const &spellNonMeleeDamage, DamageEffectType damageType)
 Construct a new DamageInfo::DamageInfo object. More...
 
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)
 Construct a new DamageInfo::DamageInfo object. More...
 

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

Construct a new DamageInfo::DamageInfo object.

Parameters
dmg1
dmg2
165 : 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)),
166 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),
167 m_cleanDamage(dmg1.m_cleanDamage + dmg1.m_cleanDamage)
168{
169}
SpellSchoolMask
Definition: SharedDefines.h:267
uint32 m_resist
Definition: Unit.h:771
Unit *const m_attacker
Definition: Unit.h:763
WeaponAttackType m_attackType
Definition: Unit.h:769
SpellInfo const *const m_spellInfo
Definition: Unit.h:766
uint32 m_block
Definition: Unit.h:772
uint32 m_absorb
Definition: Unit.h:770
uint32 m_cleanDamage
Definition: Unit.h:773
uint32 m_damage
Definition: Unit.h:765
SpellSchoolMask const m_schoolMask
Definition: Unit.h:767
DamageEffectType const m_damageType
Definition: Unit.h:768
Unit *const m_victim
Definition: Unit.h:764

◆ DamageInfo() [2/5]

DamageInfo::DamageInfo ( Unit _attacker,
Unit _victim,
uint32  _damage,
SpellInfo const *  _spellInfo,
SpellSchoolMask  _schoolMask,
DamageEffectType  _damageType,
uint32  cleanDamage = 0 
)
explicit

Construct a new DamageInfo::DamageInfo object.

Parameters
_attacker
_victim
_damage
_spellInfo
_schoolMask
_damageType
cleanDamage
141 : m_attacker(_attacker), m_victim(_victim), m_damage(_damage), m_spellInfo(_spellInfo), m_schoolMask(_schoolMask),
142 m_damageType(_damageType), m_attackType(BASE_ATTACK), m_cleanDamage(cleanDamage)
143{
144 m_absorb = 0;
145 m_resist = 0;
146 m_block = 0;
147}
@ BASE_ATTACK
Definition: Unit.h:396

References m_absorb, m_block, and m_resist.

◆ DamageInfo() [3/5]

DamageInfo::DamageInfo ( CalcDamageInfo const &  dmgInfo)
explicit

Construct a new DamageInfo::DamageInfo object.

Parameters
dmgInfo
154 : DamageInfo(DamageInfo(dmgInfo, 0), DamageInfo(dmgInfo, 1))
155{
156}
Definition: Unit.h:761

◆ DamageInfo() [4/5]

DamageInfo::DamageInfo ( CalcDamageInfo const &  dmgInfo,
uint8  damageIndex 
)

Construct a new DamageInfo::DamageInfo object.

Parameters
dmgInfo
damageIndex
178 : m_attacker(dmgInfo.attacker), m_victim(dmgInfo.target), m_damage(dmgInfo.damages[damageIndex].damage), m_spellInfo(nullptr), m_schoolMask(SpellSchoolMask(dmgInfo.damages[damageIndex].damageSchoolMask)),
179 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),
180 m_cleanDamage(dmgInfo.cleanDamage)
181{
182}
@ DIRECT_DAMAGE
Definition: Unit.h:435

◆ DamageInfo() [5/5]

DamageInfo::DamageInfo ( SpellNonMeleeDamage const &  spellNonMeleeDamage,
DamageEffectType  damageType 
)

Construct a new DamageInfo::DamageInfo object.

Parameters
spellNonMeleeDamage
damageType
191 : m_attacker(spellNonMeleeDamage.attacker), m_victim(spellNonMeleeDamage.target), m_damage(spellNonMeleeDamage.damage),
192 m_spellInfo(spellNonMeleeDamage.spellInfo), m_schoolMask(SpellSchoolMask(spellNonMeleeDamage.schoolMask)), m_damageType(damageType),
193 m_absorb(spellNonMeleeDamage.absorb), m_resist(spellNonMeleeDamage.resist), m_block(spellNonMeleeDamage.blocked),
194 m_cleanDamage(spellNonMeleeDamage.cleanDamage)
195{
196}

Member Function Documentation

◆ AbsorbDamage()

void DamageInfo::AbsorbDamage ( uint32  amount)
Parameters
amount
215{
216 amount = std::min(amount, GetDamage());
217 m_absorb += amount;
218 m_damage -= amount;
219}
uint32 GetDamage() const
Definition: Unit.h:795

References GetDamage(), m_absorb, and m_damage.

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

◆ BlockDamage()

void DamageInfo::BlockDamage ( uint32  amount)
Parameters
amount
239{
240 amount = std::min(amount, GetDamage());
241 m_block += amount;
242 m_damage -= amount;
243}

References GetDamage(), m_block, and m_damage.

◆ GetAbsorb()

◆ GetAttacker()

◆ GetAttackType()

WeaponAttackType DamageInfo::GetAttackType ( ) const
inline

◆ GetBlock()

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

References m_block.

Referenced by Unit::AttackerStateUpdate().

◆ GetDamage()

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

References m_damage.

Referenced by spell_shield_generator::spell_shield_generator_AuraScript::Absorb(), spell_yogg_saron_protective_gaze::spell_yogg_saron_protective_gaze_AuraScript::Absorb(), spell_charge_shield_bomber::spell_charge_shield_bomber_AuraScript::Absorb(), spell_black_temple_spell_absorption::spell_black_temple_spell_absorption_AuraScript::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::spell_deathbringer_blood_link_AuraScript::CheckProc(), spell_deathbringer_blood_link_blood_beast_aura::spell_deathbringer_blood_link_blood_beast_aura_AuraScript::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::spell_reliquary_of_souls_aura_of_desire_AuraScript::HandleProc(), spell_black_temple_consuming_strikes::spell_black_temple_consuming_strikes_AuraScript::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), spell_mage_ignite::HandleProc(), spell_the_lich_king_dark_hunger::spell_the_lich_king_dark_hunger_AuraScript::HandleProc(), spell_oculus_temporal_rift::spell_oculus_temporal_rift_AuraScript::HandleProc(), spell_yogg_saron_grim_reprisal::spell_yogg_saron_grim_reprisal_AuraScript::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_dk_hungering_cold::HandleProc(), ModifyDamage(), spell_valanar_kinetic_bomb_absorb::spell_valanar_kinetic_bomb_absorb_AuraScript::OnAbsorb(), spell_blood_queen_essence_of_the_blood_queen::spell_blood_queen_essence_of_the_blood_queen_AuraScript::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
792{ return m_schoolMask; };

References m_schoolMask.

Referenced by Unit::CalcAbsorbResist().

◆ GetSpellInfo()

◆ GetUnmitigatedDamage()

uint32 DamageInfo::GetUnmitigatedDamage ( ) const
Returns
uint32
251{
253}

References m_absorb, m_cleanDamage, m_damage, and m_resist.

Referenced by spell_rog_blade_flurry::HandleProc().

◆ GetVictim()

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

References m_victim.

Referenced by Unit::CalcAbsorbResist().

◆ ModifyDamage()

void DamageInfo::ModifyDamage ( int32  amount)
Parameters
amount
204{
205 amount = std::min(amount, int32(GetDamage()));
206 m_damage += amount;
207}
std::int32_t int32
Definition: Define.h:104

References GetDamage(), and m_damage.

Referenced by AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ ResistDamage()

void DamageInfo::ResistDamage ( uint32  amount)
Parameters
amount
227{
228 amount = std::min(amount, GetDamage());
229 m_resist += amount;
230 m_damage -= amount;
231}

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().