TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DamageInfo Class Reference

#include <Unit.h>

Public Member Functions

 DamageInfo (Unit *_attacker, Unit *_victim, uint32 _damage, SpellInfo const *_spellInfo, SpellSchoolMask _schoolMask, DamageEffectType _damageType)
 
 DamageInfo (CalcDamageInfo &dmgInfo)
 
void ModifyDamage (int32 amount)
 
void AbsorbDamage (uint32 amount)
 
void ResistDamage (uint32 amount)
 
void BlockDamage (uint32 amount)
 
UnitGetAttacker () const
 
UnitGetVictim () const
 
SpellInfo constGetSpellInfo () const
 
SpellSchoolMask GetSchoolMask () const
 
DamageEffectType GetDamageType () const
 
WeaponAttackType GetAttackType () const
 
uint32 GetDamage () const
 
uint32 GetAbsorb () const
 
uint32 GetResist () const
 
uint32 GetBlock () const
 

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
 

Constructor & Destructor Documentation

DamageInfo::DamageInfo ( Unit _attacker,
Unit _victim,
uint32  _damage,
SpellInfo const _spellInfo,
SpellSchoolMask  _schoolMask,
DamageEffectType  _damageType 
)
explicit
113 : m_attacker(_attacker), m_victim(_victim), m_damage(_damage), m_spellInfo(_spellInfo), m_schoolMask(_schoolMask),
115 {
116  m_absorb = 0;
117  m_resist = 0;
118  m_block = 0;
119 }
uint32 m_absorb
Definition: Unit.h:931
WeaponAttackType m_attackType
Definition: Unit.h:930
Unit *const m_victim
Definition: Unit.h:925
Unit *const m_attacker
Definition: Unit.h:924
uint32 m_block
Definition: Unit.h:933
SpellSchoolMask const m_schoolMask
Definition: Unit.h:928
DamageEffectType const m_damageType
Definition: Unit.h:929
uint32 m_damage
Definition: Unit.h:926
SpellInfo const *const m_spellInfo
Definition: Unit.h:927
uint32 m_resist
Definition: Unit.h:932
Definition: Unit.h:617
DamageInfo::DamageInfo ( CalcDamageInfo dmgInfo)
explicit
123 {
124  m_absorb = 0;
125  m_resist = 0;
126  m_block = 0;
127 }
Unit * attacker
Definition: Unit.h:1023
SpellSchoolMask
Definition: SharedDefines.h:285
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 m_absorb
Definition: Unit.h:931
WeaponAttackType m_attackType
Definition: Unit.h:930
Unit *const m_victim
Definition: Unit.h:925
WeaponAttackType attackType
Definition: Unit.h:1033
Unit *const m_attacker
Definition: Unit.h:924
uint32 m_block
Definition: Unit.h:933
uint32 damageSchoolMask
Definition: Unit.h:1025
Unit * target
Definition: Unit.h:1024
SpellSchoolMask const m_schoolMask
Definition: Unit.h:928
uint32 damage
Definition: Unit.h:1026
Definition: Unit.h:662
DamageEffectType const m_damageType
Definition: Unit.h:929
uint32 m_damage
Definition: Unit.h:926
SpellInfo const *const m_spellInfo
Definition: Unit.h:927
uint32 m_resist
Definition: Unit.h:932

Member Function Documentation

void DamageInfo::AbsorbDamage ( uint32  amount)
136 {
137  amount = std::min(amount, GetDamage());
138  m_absorb += amount;
139  m_damage -= amount;
140 }
uint32 m_absorb
Definition: Unit.h:931
T min(const T &x, const T &y)
Definition: g3dmath.h:305
uint32 GetDamage() const
Definition: Unit.h:949
uint32 m_damage
Definition: Unit.h:926

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DamageInfo::BlockDamage ( uint32  amount)
150 {
151  amount = std::min(amount, GetDamage());
152  m_block += amount;
153  m_damage -= amount;
154 }
T min(const T &x, const T &y)
Definition: g3dmath.h:305
uint32 m_block
Definition: Unit.h:933
uint32 GetDamage() const
Definition: Unit.h:949
uint32 m_damage
Definition: Unit.h:926

+ Here is the call graph for this function:

uint32 DamageInfo::GetAbsorb ( ) const
inline
950 { return m_absorb; }
uint32 m_absorb
Definition: Unit.h:931

+ Here is the caller graph for this function:

Unit* DamageInfo::GetAttacker ( ) const
inline
943 { return m_attacker; }
Unit *const m_attacker
Definition: Unit.h:924

+ Here is the caller graph for this function:

WeaponAttackType DamageInfo::GetAttackType ( ) const
inline
948 { return m_attackType; }
WeaponAttackType m_attackType
Definition: Unit.h:930

+ Here is the caller graph for this function:

uint32 DamageInfo::GetBlock ( ) const
inline
952 { return m_block; }
uint32 m_block
Definition: Unit.h:933
uint32 DamageInfo::GetDamage ( ) const
inline
949 { return m_damage; }
uint32 m_damage
Definition: Unit.h:926

+ Here is the caller graph for this function:

DamageEffectType DamageInfo::GetDamageType ( ) const
inline
947 { return m_damageType; }
DamageEffectType const m_damageType
Definition: Unit.h:929
uint32 DamageInfo::GetResist ( ) const
inline
951 { return m_resist; }
uint32 m_resist
Definition: Unit.h:932

+ Here is the caller graph for this function:

SpellSchoolMask DamageInfo::GetSchoolMask ( ) const
inline
946 { return m_schoolMask; }
SpellSchoolMask const m_schoolMask
Definition: Unit.h:928

+ Here is the caller graph for this function:

SpellInfo const* DamageInfo::GetSpellInfo ( ) const
inline
945 { return m_spellInfo; }
SpellInfo const *const m_spellInfo
Definition: Unit.h:927

+ Here is the caller graph for this function:

Unit* DamageInfo::GetVictim ( ) const
inline
944 { return m_victim; }
Unit *const m_victim
Definition: Unit.h:925
void DamageInfo::ModifyDamage ( int32  amount)
130 {
131  amount = std::min(amount, int32(GetDamage()));
132  m_damage += amount;
133 }
T min(const T &x, const T &y)
Definition: g3dmath.h:305
uint32 GetDamage() const
Definition: Unit.h:949
int32_t int32
Definition: g3dmath.h:167
uint32 m_damage
Definition: Unit.h:926

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DamageInfo::ResistDamage ( uint32  amount)
143 {
144  amount = std::min(amount, GetDamage());
145  m_resist += amount;
146  m_damage -= amount;
147 }
T min(const T &x, const T &y)
Definition: g3dmath.h:305
uint32 GetDamage() const
Definition: Unit.h:949
uint32 m_damage
Definition: Unit.h:926
uint32 m_resist
Definition: Unit.h:932

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

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

The documentation for this class was generated from the following files: