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

#include "SpellAuras.h"

Inheritance diagram for UnitAura:
Aura

Public Member Functions

void _ApplyForTarget (Unit *target, Unit *caster, AuraApplication *aurApp) override
 
void _UnapplyForTarget (Unit *target, Unit *caster, AuraApplication *aurApp) override
 
void Remove (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT) override
 
void FillTargetMap (std::map< Unit *, uint8 > &targets, Unit *caster) override
 
void SetDiminishGroup (DiminishingGroup group)
 
DiminishingGroup GetDiminishGroup () const
 
- Public Member Functions inherited from Aura
 Aura (SpellInfo const *spellproto, WorldObject *owner, Unit *caster, Item *castItem, ObjectGuid casterGUID, ObjectGuid itemGUID=ObjectGuid::Empty)
 
void _InitEffects (uint8 effMask, Unit *caster, int32 *baseAmount)
 
virtual ~Aura ()
 
SpellInfo const * GetSpellInfo () const
 
uint32 GetId () const
 
ObjectGuid GetCastItemGUID () const
 
uint32 GetCastItemEntry () const
 
ObjectGuid GetCasterGUID () const
 
UnitGetCaster () const
 
WorldObjectGetOwner () const
 
UnitGetUnitOwner () const
 
DynamicObjectGetDynobjOwner () const
 
AuraObjectType GetType () const
 
virtual void _ApplyForTarget (Unit *target, Unit *caster, AuraApplication *auraApp)
 
virtual void _UnapplyForTarget (Unit *target, Unit *caster, AuraApplication *auraApp)
 
void _Remove (AuraRemoveMode removeMode)
 
virtual void Remove (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
 
virtual void FillTargetMap (std::map< Unit *, uint8 > &targets, Unit *caster)=0
 
void UpdateTargetMap (Unit *caster, bool apply=true)
 
void _RegisterForTargets ()
 
void ApplyForTargets ()
 
void _ApplyEffectForTargets (uint8 effIndex)
 
void UpdateOwner (uint32 diff, WorldObject *owner)
 
void Update (uint32 diff, Unit *caster)
 
time_t GetApplyTime () const
 
int32 GetMaxDuration () const
 
void SetMaxDuration (int32 duration)
 
int32 CalcMaxDuration () const
 
int32 CalcMaxDuration (Unit *caster) const
 
int32 GetDuration () const
 
void SetDuration (int32 duration, bool withMods=false)
 
void RefreshDuration (bool withMods=false)
 
void RefreshTimers (bool periodicReset=false)
 
void RefreshTimersWithMods ()
 
bool IsExpired () const
 
bool IsPermanent () const
 
uint8 GetCharges () const
 
void SetCharges (uint8 charges)
 
uint8 CalcMaxCharges (Unit *caster) const
 
uint8 CalcMaxCharges () const
 
bool ModCharges (int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool DropCharge (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
uint8 GetStackAmount () const
 
void SetStackAmount (uint8 num)
 
bool ModStackAmount (int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool periodicReset=false)
 
void RefreshSpellMods ()
 
uint8 GetCasterLevel () const
 
bool IsArea () const
 
bool IsPassive () const
 
bool IsDeathPersistent () const
 
bool IsRemovedOnShapeLost (Unit *target) const
 
bool CanBeSaved () const
 
bool IsRemoved () const
 
bool CanBeSentToClient () const
 
bool IsSingleTarget () const
 
bool IsSingleTargetWith (Aura const *aura) const
 
void SetIsSingleTarget (bool val)
 
void UnregisterSingleTarget ()
 
int32 CalcDispelChance (Unit *auraTarget, bool offensive) const
 
void SetLoadedState (int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint8 recalculateMask, int32 *amount)
 
bool HasEffect (uint8 effIndex) const
 
bool HasEffectType (AuraType type) const
 
AuraEffectGetEffect (uint8 effIndex) const
 
uint8 GetEffectMask () const
 
void RecalculateAmountOfEffects ()
 
void HandleAllEffects (AuraApplication *aurApp, uint8 mode, bool apply)
 
ApplicationMap const & GetApplicationMap ()
 
void GetApplicationList (std::list< AuraApplication * > &applicationList) const
 
const AuraApplicationGetApplicationOfTarget (ObjectGuid guid) const
 
AuraApplicationGetApplicationOfTarget (ObjectGuid guid)
 
bool IsAppliedOnTarget (ObjectGuid guid) const
 
void SetNeedClientUpdateForTargets () const
 
void HandleAuraSpecificMods (AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
 
bool CanBeAppliedOn (Unit *target)
 
bool CheckAreaTarget (Unit *target)
 
bool CanStackWith (Aura const *checkAura, bool remove) const
 
bool IsAuraStronger (Aura const *newAura) const
 
bool IsProcOnCooldown () const
 
void AddProcCooldown (Milliseconds msec)
 
bool IsUsingCharges () const
 
void SetUsingCharges (bool val)
 
void PrepareProcToTrigger (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
bool IsProcTriggeredOnEvent (AuraApplication *aurApp, ProcEventInfo &eventInfo) const
 
float CalcProcChance (SpellProcEntry const &procEntry, ProcEventInfo &eventInfo) const
 
void TriggerProcOnEvent (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void LoadScripts ()
 
bool CallScriptCheckAreaTargetHandlers (Unit *target)
 
void CallScriptDispel (DispelInfo *dispelInfo)
 
void CallScriptAfterDispel (DispelInfo *dispelInfo)
 
bool CallScriptEffectApplyHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
 
bool CallScriptEffectRemoveHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
 
void CallScriptAfterEffectApplyHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
 
void CallScriptAfterEffectRemoveHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
 
bool CallScriptEffectPeriodicHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp)
 
void CallScriptEffectUpdatePeriodicHandlers (AuraEffect *aurEff)
 
void CallScriptEffectCalcAmountHandlers (AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
 
void CallScriptEffectCalcPeriodicHandlers (AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
 
void CallScriptEffectCalcSpellModHandlers (AuraEffect const *aurEff, SpellModifier *&spellMod)
 
void CallScriptEffectAbsorbHandlers (AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
 
void CallScriptEffectAfterAbsorbHandlers (AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
 
void CallScriptEffectManaShieldHandlers (AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
 
void CallScriptEffectAfterManaShieldHandlers (AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
 
void CallScriptEffectSplitHandlers (AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &splitAmount)
 
bool CallScriptCheckProcHandlers (AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
bool CallScriptAfterCheckProcHandlers (AuraApplication const *aurApp, ProcEventInfo &eventInfo, bool isTriggeredAtSpellProcEvent)
 
bool CallScriptPrepareProcHandlers (AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
bool CallScriptProcHandlers (AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
void CallScriptAfterProcHandlers (AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
bool CallScriptEffectProcHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
void CallScriptAfterEffectProcHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
AuraScriptGetScriptByName (std::string const &scriptName) const
 
virtual std::string GetDebugInfo () const
 
void SetTriggeredByAuraSpellInfo (SpellInfo const *triggeredByAuraSpellInfo)
 
SpellInfo const * GetTriggeredByAuraSpellInfo () const
 

Protected Member Functions

 UnitAura (SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, ObjectGuid itemGUID=ObjectGuid::Empty)
 

Private Attributes

DiminishingGroup m_AuraDRGroup: 8
 

Friends

AuraAura::Create (SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, ObjectGuid itemGUID)
 

Additional Inherited Members

- Public Types inherited from Aura
typedef std::map< ObjectGuid, AuraApplication * > ApplicationMap
 
- Static Public Member Functions inherited from Aura
static uint8 BuildEffectMaskForOwner (SpellInfo const *spellProto, uint8 avalibleEffectMask, WorldObject *owner)
 
static AuraTryRefreshStackOrCreate (SpellInfo const *spellproto, uint8 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool *refresh=nullptr, bool periodicReset=false)
 
static AuraTryCreate (SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemGUID=ObjectGuid::Empty)
 
static AuraCreate (SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, ObjectGuid itemGUID=ObjectGuid::Empty)
 
- Public Attributes inherited from Aura
std::list< AuraScript * > m_loadedScripts
 
- Protected Attributes inherited from Aura
SpellInfo const *const m_spellInfo
 
ObjectGuid const m_casterGuid
 
ObjectGuid const m_castItemGuid
 
uint32 const m_castItemEntry
 
time_t const m_applyTime
 
WorldObject *const m_owner
 
int32 m_maxDuration
 
int32 m_duration
 
int32 m_timeCla
 
int32 m_updateTargetMapInterval
 
uint8 const m_casterLevel
 
uint8 m_procCharges
 
uint8 m_stackAmount
 
AuraEffectm_effects [3]
 
ApplicationMap m_applications
 
bool m_isRemoved: 1
 
bool m_isSingleTarget: 1
 
bool m_isUsingCharges: 1
 

Detailed Description

Constructor & Destructor Documentation

◆ UnitAura()

UnitAura::UnitAura ( SpellInfo const *  spellproto,
uint8  effMask,
WorldObject owner,
Unit caster,
int32 baseAmount,
Item castItem,
ObjectGuid  casterGUID,
ObjectGuid  itemGUID = ObjectGuid::Empty 
)
explicitprotected
2767 : Aura(spellproto, owner, caster, castItem, casterGUID, itemGUID)
2768{
2770 LoadScripts();
2771 _InitEffects(effMask, caster, baseAmount);
2772 GetUnitOwner()->_AddAura(this, caster);
2773}
@ DIMINISHING_NONE
Definition: SharedDefines.h:3258
void _AddAura(UnitAura *aura, Unit *caster)
Definition: Unit.cpp:4396
Definition: SpellAuras.h:87
Unit * GetUnitOwner() const
Definition: SpellAuras.h:108
void LoadScripts()
Definition: SpellAuras.cpp:2356
void _InitEffects(uint8 effMask, Unit *caster, int32 *baseAmount)
Definition: SpellAuras.cpp:435
DiminishingGroup m_AuraDRGroup
Definition: SpellAuras.h:298

References Unit::_AddAura(), Aura::_InitEffects(), DIMINISHING_NONE, Aura::GetUnitOwner(), Aura::LoadScripts(), and m_AuraDRGroup.

Member Function Documentation

◆ _ApplyForTarget()

void UnitAura::_ApplyForTarget ( Unit target,
Unit caster,
AuraApplication aurApp 
)
overridevirtual

Reimplemented from Aura.

2776{
2777 Aura::_ApplyForTarget(target, caster, aurApp);
2778
2779 // register aura diminishing on apply
2780 if (DiminishingGroup group = GetDiminishGroup())
2781 target->ApplyDiminishingAura(group, true);
2782}
DiminishingGroup
Definition: SharedDefines.h:3257
void ApplyDiminishingAura(DiminishingGroup group, bool apply)
Definition: Unit.cpp:15081
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:492
DiminishingGroup GetDiminishGroup() const
Definition: SpellAuras.h:295

References Aura::_ApplyForTarget(), Unit::ApplyDiminishingAura(), and GetDiminishGroup().

◆ _UnapplyForTarget()

void UnitAura::_UnapplyForTarget ( Unit target,
Unit caster,
AuraApplication aurApp 
)
overridevirtual

Reimplemented from Aura.

2785{
2786 Aura::_UnapplyForTarget(target, caster, aurApp);
2787
2788 // unregister aura diminishing (and store last time)
2789 if (DiminishingGroup group = GetDiminishGroup())
2790 target->ApplyDiminishingAura(group, false);
2791}
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:515

References Aura::_UnapplyForTarget(), Unit::ApplyDiminishingAura(), and GetDiminishGroup().

◆ FillTargetMap()

void UnitAura::FillTargetMap ( std::map< Unit *, uint8 > &  targets,
Unit caster 
)
overridevirtual
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.

Implements Aura.

2801{
2802 for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
2803 {
2804 if (!HasEffect(effIndex))
2805 continue;
2806 UnitList targetList;
2807 // non-area aura
2808 if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_APPLY_AURA)
2809 {
2810 targetList.push_back(GetUnitOwner());
2811 }
2812 else
2813 {
2814 float radius = GetSpellInfo()->Effects[effIndex].CalcRadius(caster);
2815
2816 if (!GetUnitOwner()->HasUnitState(UNIT_STATE_ISOLATED))
2817 {
2818 switch (GetSpellInfo()->Effects[effIndex].Effect)
2819 {
2822 {
2823 targetList.push_back(GetUnitOwner());
2826 Cell::VisitAllObjects(GetUnitOwner(), searcher, radius);
2827 break;
2828 }
2830 {
2831 targetList.push_back(GetUnitOwner());
2834 Cell::VisitAllObjects(GetUnitOwner(), searcher, radius);
2835 break;
2836 }
2838 {
2839 Acore::AnyAoETargetUnitInObjectRangeCheck u_check(GetUnitOwner(), GetUnitOwner(), radius); // No GetCharmer in searcher
2841 Cell::VisitAllObjects(GetUnitOwner(), searcher, radius);
2842 break;
2843 }
2845 targetList.push_back(GetUnitOwner());
2846 [[fallthrough]];
2848 {
2849 if (Unit* owner = GetUnitOwner()->GetCharmerOrOwner())
2850 if (GetUnitOwner()->IsWithinDistInMap(owner, radius))
2851 targetList.push_back(owner);
2852 break;
2853 }
2854 }
2855 }
2856 }
2857
2858 for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
2859 {
2860 std::map<Unit*, uint8>::iterator existing = targets.find(*itr);
2861 if (existing != targets.end())
2862 existing->second |= 1 << effIndex;
2863 else
2864 targets[*itr] = 1 << effIndex;
2865 }
2866 }
2867}
std::uint8_t uint8
Definition: Define.h:109
std::list< Unit * > UnitList
Definition: Unit.h:76
@ UNIT_STATE_ISOLATED
Definition: UnitDefines.h:162
@ SPELL_EFFECT_APPLY_AREA_AURA_PARTY
Definition: SharedDefines.h:813
@ SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
Definition: SharedDefines.h:906
@ SPELL_EFFECT_APPLY_AREA_AURA_PET
Definition: SharedDefines.h:897
@ SPELL_EFFECT_APPLY_AREA_AURA_RAID
Definition: SharedDefines.h:843
@ SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
Definition: SharedDefines.h:907
@ SPELL_EFFECT_APPLY_AURA
Definition: SharedDefines.h:784
@ SPELL_EFFECT_APPLY_AREA_AURA_OWNER
Definition: SharedDefines.h:921
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1637
Definition: Unit.h:630
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:423
Definition: GridNotifiers.h:976
Definition: GridNotifiers.h:1012
Definition: GridNotifiers.h:1077
bool HasEffect(uint8 effIndex) const
Definition: SpellAuras.h:173
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:100
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:393

References SpellInfo::Effects, Aura::GetSpellInfo(), Aura::GetUnitOwner(), Aura::HasEffect(), MAX_SPELL_EFFECTS, SPELL_EFFECT_APPLY_AREA_AURA_ENEMY, SPELL_EFFECT_APPLY_AREA_AURA_FRIEND, SPELL_EFFECT_APPLY_AREA_AURA_OWNER, SPELL_EFFECT_APPLY_AREA_AURA_PARTY, SPELL_EFFECT_APPLY_AREA_AURA_PET, SPELL_EFFECT_APPLY_AREA_AURA_RAID, SPELL_EFFECT_APPLY_AURA, UNIT_STATE_ISOLATED, and Cell::VisitAllObjects().

◆ GetDiminishGroup()

DiminishingGroup UnitAura::GetDiminishGroup ( ) const
inline
295{ return m_AuraDRGroup; }

References m_AuraDRGroup.

Referenced by _ApplyForTarget(), and _UnapplyForTarget().

◆ Remove()

void UnitAura::Remove ( AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT)
overridevirtual

Implements Aura.

2794{
2795 if (IsRemoved())
2796 return;
2797 GetUnitOwner()->RemoveOwnedAura(this, removeMode);
2798}
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4687
bool IsRemoved() const
Definition: SpellAuras.h:161

References Aura::GetUnitOwner(), Aura::IsRemoved(), and Unit::RemoveOwnedAura().

◆ SetDiminishGroup()

void UnitAura::SetDiminishGroup ( DiminishingGroup  group)
inline
294{ m_AuraDRGroup = group; }

References m_AuraDRGroup.

Friends And Related Function Documentation

◆ Aura::Create

Aura * Aura::Create ( SpellInfo const *  spellproto,
uint8  effMask,
WorldObject owner,
Unit caster,
int32 baseAmount,
Item castItem,
ObjectGuid  casterGUID,
ObjectGuid  itemGUID 
)
friend

Member Data Documentation

◆ m_AuraDRGroup

DiminishingGroup UnitAura::m_AuraDRGroup
private