AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Aura Class Referenceabstract

#include "SpellAuras.h"

Inheritance diagram for Aura:
DynObjAura UnitAura

Public Types

typedef std::map< ObjectGuid, AuraApplication * > ApplicationMap
 

Public Member Functions

 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 HasMoreThanOneEffectForType (AuraType auraType) 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
 
AuraApplication const * GetApplicationOfTarget (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 *existingAura) const
 
bool IsAuraStronger (Aura const *newAura) const
 
bool IsProcOnCooldown (TimePoint now) const
 
void AddProcCooldown (TimePoint cooldownEnd)
 
void AddProcCooldown (SpellProcEntry const *procEntry, TimePoint now)
 
void ResetProcCooldown ()
 
bool IsUsingCharges () const
 
void SetUsingCharges (bool val)
 
void PrepareProcToTrigger (AuraApplication *aurApp, ProcEventInfo &eventInfo, TimePoint now)
 
uint8 GetProcEffectMask (AuraApplication *aurApp, ProcEventInfo &eventInfo, TimePoint now) const
 
float CalcProcChance (SpellProcEntry const &procEntry, ProcEventInfo &eventInfo) const
 
void TriggerProcOnEvent (uint8 procEffectMask, AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void ConsumeProcCharges (SpellProcEntry const *procEntry)
 
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 CallScriptCheckEffectProcHandlers (AuraEffect const *aurEff, 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
 
template<class Script >
Script * GetScript (std::string const &scriptName) const
 
virtual std::string GetDebugInfo () const
 
void SetTriggeredByAuraSpellInfo (SpellInfo const *triggeredByAuraSpellInfo)
 
SpellInfo const * GetTriggeredByAuraSpellInfo () const
 

Static Public Member Functions

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

std::list< AuraScript * > m_loadedScripts
 

Protected Attributes

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
 
TimePoint m_procCooldown
 

Private Member Functions

void _DeleteRemovedApplications ()
 

Private Attributes

Unit::AuraApplicationList m_removedApplications
 
SpellInfo const * m_triggeredByAuraSpellInfo
 

Friends

AuraUnit::_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, bool noPeriodicReset)
 

Detailed Description

Member Typedef Documentation

◆ ApplicationMap

Constructor & Destructor Documentation

◆ Aura()

Aura::Aura ( SpellInfo const *  spellproto,
WorldObject owner,
Unit caster,
Item castItem,
ObjectGuid  casterGUID,
ObjectGuid  itemGUID = ObjectGuid::Empty 
)
explicit
353 :
354 m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
355 m_castItemGuid(itemGUID ? itemGUID : castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(GameTime::GetGameTime().count()),
357 m_casterLevel(caster ? caster->GetLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
359{
362
367 memset(m_effects, 0, sizeof(m_effects));
368 // m_casterLevel = cast item level/caster level, caster level should be saved to db, confirmed with sniffs
369}
constexpr auto IN_MILLISECONDS
Definition Common.h:53
@ SPELL_ATTR2_NO_TARGET_PER_SECOND_COST
Definition SharedDefines.h:455
int32 m_maxDuration
Definition SpellAuras.h:264
time_t const m_applyTime
Definition SpellAuras.h:261
AuraEffect * m_effects[3]
Definition SpellAuras.h:273
uint8 m_stackAmount
Definition SpellAuras.h:271
int32 m_duration
Definition SpellAuras.h:265
uint32 const m_castItemEntry
Definition SpellAuras.h:260
ObjectGuid const m_castItemGuid
Definition SpellAuras.h:259
int32 m_timeCla
Definition SpellAuras.h:266
int32 CalcMaxDuration() const
Definition SpellAuras.h:131
SpellInfo const * m_triggeredByAuraSpellInfo
Definition SpellAuras.h:285
SpellInfo const *const m_spellInfo
Definition SpellAuras.h:257
WorldObject *const m_owner
Definition SpellAuras.h:262
ObjectGuid const m_casterGuid
Definition SpellAuras.h:258
uint8 const m_casterLevel
Definition SpellAuras.h:269
uint8 CalcMaxCharges() const
Definition SpellAuras.h:144
bool m_isUsingCharges
Definition SpellAuras.h:278
bool m_isRemoved
Definition SpellAuras.h:276
int32 m_updateTargetMapInterval
Definition SpellAuras.h:267
bool m_isSingleTarget
Definition SpellAuras.h:277
uint8 m_procCharges
Definition SpellAuras.h:270
Definition ObjectGuid.h:121
uint32 ManaPerSecondPerLevel
Definition SpellInfo.h:390
uint32 ManaPerSecond
Definition SpellInfo.h:389
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:441
Definition GameTime.cpp:22
Seconds GetGameTime()
Definition GameTime.cpp:38

References CalcMaxCharges(), CalcMaxDuration(), SpellInfo::HasAttribute(), IN_MILLISECONDS, m_duration, m_effects, m_isUsingCharges, m_maxDuration, m_procCharges, m_spellInfo, m_timeCla, SpellInfo::ManaPerSecond, SpellInfo::ManaPerSecondPerLevel, and SPELL_ATTR2_NO_TARGET_PER_SECOND_COST.

◆ ~Aura()

Aura::~Aura ( )
virtual
392{
393 // unload scripts
394 while (!m_loadedScripts.empty())
395 {
396 std::list<AuraScript*>::iterator itr = m_loadedScripts.begin();
397 (*itr)->_Unload();
398 delete (*itr);
399 m_loadedScripts.erase(itr);
400 }
401
402 // free effects memory
403 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
404 delete m_effects[i];
405
406 ASSERT(m_applications.empty());
408}
#define MAX_SPELL_EFFECTS
Definition DBCStructure.h:1637
std::uint8_t uint8
Definition Define.h:109
#define ASSERT
Definition Errors.h:68
std::list< AuraScript * > m_loadedScripts
Definition SpellAuras.h:246
ApplicationMap m_applications
Definition SpellAuras.h:274
void _DeleteRemovedApplications()
Definition SpellAuras.cpp:2344

References _DeleteRemovedApplications(), ASSERT, m_applications, m_effects, m_loadedScripts, and MAX_SPELL_EFFECTS.

Member Function Documentation

◆ _ApplyEffectForTargets()

void Aura::_ApplyEffectForTargets ( uint8  effIndex)
683{
684 // prepare list of aura targets
685 UnitList targetList;
686 for (ApplicationMap::iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
687 {
688 if ((appIter->second->GetEffectsToApply() & (1 << effIndex)) && !appIter->second->HasEffect(effIndex))
689 targetList.push_back(appIter->second->GetTarget());
690 }
691
692 // apply effect to targets
693 for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
694 {
695 if (GetApplicationOfTarget((*itr)->GetGUID()))
696 {
697 // owner has to be in world, or effect has to be applied to self
698 ASSERT((!GetOwner()->IsInWorld() && GetOwner() == *itr) || GetOwner()->IsInMap(*itr));
699 (*itr)->_ApplyAuraEffect(this, effIndex);
700 }
701 }
702}
std::list< Unit * > UnitList
Definition Unit.h:78
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
Definition SpellAuras.h:184
WorldObject * GetOwner() const
Definition SpellAuras.h:107

References ASSERT, GetApplicationOfTarget(), GetOwner(), and m_applications.

Referenced by Spell::EffectApplyAreaAura(), Spell::EffectApplyAura(), and Spell::EffectPersistentAA().

◆ _ApplyForTarget()

void Aura::_ApplyForTarget ( Unit target,
Unit caster,
AuraApplication auraApp 
)
virtual

Reimplemented in UnitAura.

437{
438 ASSERT(target);
439 ASSERT(auraApp);
440 // aura mustn't be already applied on target
441 ASSERT (!IsAppliedOnTarget(target->GetGUID()) && "Aura::_ApplyForTarget: aura musn't be already applied on target");
442
443 m_applications[target->GetGUID()] = auraApp;
444
445 // set infinity cooldown state for spells
447 {
448 if (caster->IsPlayer())
449 {
450 caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, 0, nullptr, true);
451 }
452 else
453 {
455 }
456 }
457}
static constexpr uint32 infinityCooldownDelay
Definition Unit.h:47
bool IsAppliedOnTarget(ObjectGuid guid) const
Definition SpellAuras.h:186
void AddSpellCooldown(uint32 spell_id, uint32, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Creature.cpp:2989
bool IsPlayer() const
Definition Object.h:201
Player * ToPlayer()
Definition Object.h:202
Creature * ToCreature()
Definition Object.h:206
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:114
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
Definition Player.cpp:11080
bool IsCooldownStartedOnEvent() const
Definition SpellInfo.cpp:1244
uint32 Id
Definition SpellInfo.h:344

References Player::AddSpellAndCategoryCooldowns(), Creature::AddSpellCooldown(), ASSERT, Object::GetGUID(), SpellInfo::Id, infinityCooldownDelay, IsAppliedOnTarget(), SpellInfo::IsCooldownStartedOnEvent(), Object::IsPlayer(), m_applications, m_castItemGuid, m_spellInfo, Object::ToCreature(), and Object::ToPlayer().

Referenced by UnitAura::_ApplyForTarget(), and Unit::_CreateAuraApplication().

◆ _DeleteRemovedApplications()

void Aura::_DeleteRemovedApplications ( )
private
2345{
2346 while (!m_removedApplications.empty())
2347 {
2348 delete m_removedApplications.front();
2349 m_removedApplications.pop_front();
2350 }
2351}
Unit::AuraApplicationList m_removedApplications
Definition SpellAuras.h:283

References m_removedApplications.

Referenced by UpdateOwner(), and ~Aura().

◆ _InitEffects()

void Aura::_InitEffects ( uint8  effMask,
Unit caster,
int32 baseAmount 
)
380{
381 // shouldn't be in constructor - functions in AuraEffect::AuraEffect use polymorphism
382 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
383 {
384 if (effMask & (uint8(1) << i))
385 m_effects[i] = new AuraEffect(this, i, baseAmount ? baseAmount + i : nullptr, caster);
386 else
387 m_effects[i] = nullptr;
388 }
389}
Definition SpellAuraEffects.h:39

References m_effects, and MAX_SPELL_EFFECTS.

Referenced by DynObjAura::DynObjAura(), and UnitAura::UnitAura().

◆ _RegisterForTargets()

void Aura::_RegisterForTargets ( )
inline
121{Unit* caster = GetCaster(); UpdateTargetMap(caster, false);}
Unit * GetCaster() const
Definition SpellAuras.cpp:415
void UpdateTargetMap(Unit *caster, bool apply=true)
Definition SpellAuras.cpp:532
Definition Unit.h:665

References GetCaster(), and UpdateTargetMap().

Referenced by Spell::DoSpellHitOnUnit(), and Spell::EffectPersistentAA().

◆ _Remove()

void Aura::_Remove ( AuraRemoveMode  removeMode)
519{
521 m_isRemoved = true;
522 ApplicationMap::iterator appItr = m_applications.begin();
523 for (appItr = m_applications.begin(); appItr != m_applications.end();)
524 {
525 AuraApplication* aurApp = appItr->second;
526 Unit* target = aurApp->GetTarget();
527 target->_UnapplyAura(aurApp, removeMode);
528 appItr = m_applications.begin();
529 }
530}
Definition SpellAuras.h:37
Unit * GetTarget() const
Definition SpellAuras.h:61
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
Definition Unit.cpp:4835

References Unit::_UnapplyAura(), ASSERT, AuraApplication::GetTarget(), m_applications, and m_isRemoved.

Referenced by DynObjAura::Remove(), DynamicObject::RemoveAura(), and Unit::RemoveOwnedAura().

◆ _UnapplyForTarget()

void Aura::_UnapplyForTarget ( Unit target,
Unit caster,
AuraApplication auraApp 
)
virtual
Todo:
: Figure out why this happens

Reimplemented in UnitAura.

460{
461 ASSERT(target);
462 ASSERT(auraApp->GetRemoveMode());
463 ASSERT(auraApp);
464
465 ApplicationMap::iterator itr = m_applications.find(target->GetGUID());
466
468 if (itr == m_applications.end())
469 {
470 LOG_ERROR("spells.aura", "Aura::_UnapplyForTarget, target:{}, caster:{}, spell:{} was not found in owners application map!",
471 target->GetGUID().ToString(), caster ? caster->GetGUID().ToString() : "", auraApp->GetBase()->GetSpellInfo()->Id);
472 ABORT();
473 }
474
475 // aura has to be already applied
476 ASSERT(itr->second == auraApp);
477 m_applications.erase(itr);
478
479 m_removedApplications.push_back(auraApp);
480
481 // reset cooldown state for spells
483 {
484 if (caster->IsPlayer())
485 {
486 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
488 }
489 else
490 {
491 caster->ToCreature()->AddSpellCooldown(m_spellInfo->Id, 0, 0);
492
493 if (Unit* owner = caster->GetCharmerOrOwner())
494 {
495 if (Player* playerOwner = owner->ToPlayer())
496 {
497 WorldPacket data(SMSG_COOLDOWN_EVENT, 4 + 8);
498 data << uint32(m_spellInfo->Id);
499 data << caster->GetGUID();
500 playerOwner->SendDirectMessage(&data);
501 }
502 }
503 }
504 }
505
506 if (caster && caster->IsPlayer())
507 {
508 if (GetSpellInfo()->IsCooldownStartedOnEvent() && !m_castItemGuid)
509 {
510 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
512 }
513 }
514}
std::uint32_t uint32
Definition Define.h:107
#define ABORT
Definition Errors.h:76
#define LOG_ERROR(filterType__,...)
Definition Log.h:145
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:73
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:100
std::string ToString() const
Definition ObjectGuid.cpp:48
Definition Player.h:1086
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition Player.cpp:11278
Unit * GetCharmerOrOwner() const
Definition Unit.h:1287
Definition WorldPacket.h:26
@ SMSG_COOLDOWN_EVENT
Definition Opcodes.h:339

References ABORT, Creature::AddSpellCooldown(), ASSERT, AuraApplication::GetBase(), Unit::GetCharmerOrOwner(), Object::GetGUID(), AuraApplication::GetRemoveMode(), GetSpellInfo(), SpellInfo::Id, SpellInfo::IsCooldownStartedOnEvent(), Object::IsPlayer(), LOG_ERROR, m_applications, m_castItemGuid, m_removedApplications, m_spellInfo, Player::SendCooldownEvent(), SMSG_COOLDOWN_EVENT, Object::ToCreature(), Object::ToPlayer(), and ObjectGuid::ToString().

Referenced by Unit::_UnapplyAura(), and UnitAura::_UnapplyForTarget().

◆ AddProcCooldown() [1/2]

void Aura::AddProcCooldown ( SpellProcEntry const *  procEntry,
TimePoint  now 
)
2104{
2105 AddProcCooldown(now + procEntry->Cooldown);
2106}
void AddProcCooldown(TimePoint cooldownEnd)
Definition SpellAuras.cpp:2098

References AddProcCooldown(), and SpellProcEntry::Cooldown.

◆ AddProcCooldown() [2/2]

void Aura::AddProcCooldown ( TimePoint  cooldownEnd)
2099{
2100 m_procCooldown = cooldownEnd;
2101}
TimePoint m_procCooldown
Definition SpellAuras.h:280

References m_procCooldown.

Referenced by AddProcCooldown(), and PrepareProcToTrigger().

◆ ApplyForTargets()

void Aura::ApplyForTargets ( )
inline
122{Unit* caster = GetCaster(); UpdateTargetMap(caster, true);}

References GetCaster(), and UpdateTargetMap().

Referenced by Unit::AddAura().

◆ BuildEffectMaskForOwner()

uint8 Aura::BuildEffectMaskForOwner ( SpellInfo const *  spellProto,
uint8  avalibleEffectMask,
WorldObject owner 
)
static
243{
244 ASSERT_NODEBUGINFO(spellProto);
245 ASSERT_NODEBUGINFO(owner);
246 uint8 effMask = 0;
247 switch (owner->GetTypeId())
248 {
249 case TYPEID_UNIT:
250 case TYPEID_PLAYER:
251 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
252 {
253 if (spellProto->Effects[i].IsUnitOwnedAuraEffect())
254 effMask |= 1 << i;
255 }
256 break;
258 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
259 {
260 if (spellProto->Effects[i].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
261 effMask |= 1 << i;
262 }
263 break;
264 default:
265 break;
266 }
267 return effMask & avalibleEffectMask;
268}
#define ASSERT_NODEBUGINFO
Definition Errors.h:69
@ TYPEID_DYNAMICOBJECT
Definition ObjectGuid.h:41
@ TYPEID_UNIT
Definition ObjectGuid.h:38
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
Definition SharedDefines.h:793
TypeID GetTypeId() const
Definition Object.h:129

References ASSERT_NODEBUGINFO, SpellInfo::Effects, Object::GetTypeId(), MAX_SPELL_EFFECTS, SPELL_EFFECT_PERSISTENT_AREA_AURA, TYPEID_DYNAMICOBJECT, TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by TryCreate(), and TryRefreshStackOrCreate().

◆ CalcDispelChance()

int32 Aura::CalcDispelChance ( Unit auraTarget,
bool  offensive 
) const
1134{
1135 // we assume that aura dispel chance is 100% on start
1136 // need formula for level difference based chance
1137 int32 resistChance = 0;
1138
1139 // Apply dispel mod from aura caster
1140 if (Unit* caster = GetCaster())
1141 if (Player* modOwner = caster->GetSpellModOwner())
1142 modOwner->ApplySpellMod(GetId(), SPELLMOD_RESIST_DISPEL_CHANCE, resistChance);
1143
1144 // Dispel resistance from target SPELL_AURA_MOD_DISPEL_RESIST
1145 // Only affects offensive dispels
1146 if (offensive && auraTarget)
1147 resistChance += auraTarget->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
1148
1149 resistChance = resistChance < 0 ? 0 : resistChance;
1150 resistChance = resistChance > 100 ? 100 : resistChance;
1151 return 100 - resistChance;
1152}
std::int32_t int32
Definition Define.h:103
@ SPELL_AURA_MOD_DISPEL_RESIST
Definition SpellAuraDefines.h:298
@ SPELLMOD_RESIST_DISPEL_CHANCE
Definition SpellDefines.h:104
uint32 GetId() const
Definition SpellAuras.cpp:410
Player * GetSpellModOwner() const
Definition Unit.cpp:12962
int32 GetTotalAuraModifier(AuraType auratype) const
Definition Unit.cpp:6303

References GetCaster(), GetId(), Unit::GetSpellModOwner(), Unit::GetTotalAuraModifier(), SPELL_AURA_MOD_DISPEL_RESIST, and SPELLMOD_RESIST_DISPEL_CHANCE.

Referenced by Spell::EffectDispelMechanic().

◆ CalcMaxCharges() [1/2]

uint8 Aura::CalcMaxCharges ( ) const
inline

◆ CalcMaxCharges() [2/2]

uint8 Aura::CalcMaxCharges ( Unit caster) const
909{
910 uint32 maxProcCharges = m_spellInfo->ProcCharges;
911 if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()))
912 maxProcCharges = procEntry->Charges;
913
914 if (caster)
915 if (Player* modOwner = caster->GetSpellModOwner())
916 modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, maxProcCharges);
917 return maxProcCharges;
918}
@ SPELLMOD_CHARGES
Definition SpellDefines.h:80
#define sSpellMgr
Definition SpellMgr.h:847
uint32 ProcCharges
Definition SpellInfo.h:381
Definition SpellMgr.h:286

References GetId(), Unit::GetSpellModOwner(), m_spellInfo, SpellInfo::ProcCharges, SPELLMOD_CHARGES, and sSpellMgr.

Referenced by AuraScript::CalcMaxCharges().

◆ CalcMaxDuration() [1/2]

int32 Aura::CalcMaxDuration ( ) const
inline

◆ CalcMaxDuration() [2/2]

int32 Aura::CalcMaxDuration ( Unit caster) const
792{
793 Player* modOwner = nullptr;
794 int32 maxDuration;
795
796 if (caster)
797 {
798 modOwner = caster->GetSpellModOwner();
799 maxDuration = caster->CalcSpellDuration(m_spellInfo);
800 }
801 else
802 maxDuration = m_spellInfo->GetDuration();
803
805 maxDuration = -1;
806
807 sScriptMgr->OnCalcMaxDuration(this, maxDuration);
808
809 // IsPermanent() checks max duration (which we are supposed to calculate here)
810 if (maxDuration != -1 && modOwner)
811 modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, maxDuration);
812 return maxDuration;
813}
#define sScriptMgr
Definition ScriptMgr.h:743
@ SPELLMOD_DURATION
Definition SpellDefines.h:77
bool IsPassive() const
Definition SpellAuras.cpp:1033
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
Definition Player.cpp:9996
SpellDurationEntry const * DurationEntry
Definition SpellInfo.h:385
int32 GetDuration() const
Definition SpellInfo.cpp:2738
int32 CalcSpellDuration(SpellInfo const *spellProto)
Definition Unit.cpp:11600

References Player::ApplySpellMod(), Unit::CalcSpellDuration(), SpellInfo::DurationEntry, SpellInfo::GetDuration(), GetId(), Unit::GetSpellModOwner(), IsPassive(), m_spellInfo, SPELLMOD_DURATION, and sScriptMgr.

◆ CalcProcChance()

float Aura::CalcProcChance ( SpellProcEntry const &  procEntry,
ProcEventInfo eventInfo 
) const
2271{
2272 float chance = procEntry.Chance;
2273 // calculate chances depending on unit with caster's data
2274 // so talents modifying chances and judgements will have properly calculated proc chance
2275 if (Unit* caster = GetCaster())
2276 {
2277 // If PPM exists calculate chance from PPM
2278 if ((eventInfo.GetDamageInfo() || eventInfo.GetHealInfo()) && procEntry.ProcsPerMinute != 0)
2279 {
2280 SpellInfo const* procSpell = eventInfo.GetSpellInfo();
2281 uint32 attackSpeed = 0;
2282 if (!procSpell || procSpell->DmgClass == SPELL_DAMAGE_CLASS_MELEE || procSpell->IsRangedWeaponSpell())
2283 {
2284 attackSpeed = caster->GetAttackTime(eventInfo.GetDamageInfo()->GetAttackType());
2285 }
2286 else // spells use their cast time for PPM calculations
2287 {
2288 if (procSpell->CastTimeEntry)
2289 attackSpeed = procSpell->CastTimeEntry->CastTime;
2290
2291 // instants and fast spells use 1.5s cast speed
2292 if (attackSpeed < 1500)
2293 attackSpeed = 1500;
2294 }
2295 chance = caster->GetPPMProcChance(attackSpeed, procEntry.ProcsPerMinute, GetSpellInfo());
2296 }
2297 // apply chance modifer aura, applies also to ppm chance (see improved judgement of light spell)
2298 if (Player* modOwner = caster->GetSpellModOwner())
2299 modOwner->ApplySpellMod(GetId(), SPELLMOD_CHANCE_OF_SUCCESS, chance);
2300 }
2301
2302 // proc chance is reduced by an additional 3.333% per level past 60
2303 if ((procEntry.AttributesMask & PROC_ATTR_REDUCE_PROC_60) && eventInfo.GetActor()->GetLevel() > 60)
2304 chance = std::max(0.f, (1.f - ((eventInfo.GetActor()->GetLevel() - 60) * 1.f / 30.f)) * chance);
2305
2306 return chance;
2307}
@ SPELL_DAMAGE_CLASS_MELEE
Definition SharedDefines.h:1551
@ SPELLMOD_CHANCE_OF_SUCCESS
Definition SpellDefines.h:94
@ PROC_ATTR_REDUCE_PROC_60
Definition SpellMgr.h:281
WeaponAttackType GetAttackType() const
Definition Unit.h:372
HealInfo * GetHealInfo() const
Definition Unit.h:471
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:301
Unit * GetActor()
Definition Unit.h:460
DamageInfo * GetDamageInfo() const
Definition Unit.h:470
Definition SpellInfo.h:340
SpellCastTimesEntry const * CastTimeEntry
Definition SpellInfo.h:371
uint32 DmgClass
Definition SpellInfo.h:413
bool IsRangedWeaponSpell() const
Definition SpellInfo.cpp:1308
uint8 GetLevel() const
Definition Unit.h:1104
int32 CastTime
Definition DBCStructure.h:1760

References SpellProcEntry::AttributesMask, SpellCastTimesEntry::CastTime, SpellInfo::CastTimeEntry, SpellProcEntry::Chance, SpellInfo::DmgClass, ProcEventInfo::GetActor(), DamageInfo::GetAttackType(), GetCaster(), ProcEventInfo::GetDamageInfo(), ProcEventInfo::GetHealInfo(), GetId(), Unit::GetLevel(), ProcEventInfo::GetSpellInfo(), GetSpellInfo(), Unit::GetSpellModOwner(), SpellInfo::IsRangedWeaponSpell(), PROC_ATTR_REDUCE_PROC_60, SpellProcEntry::ProcsPerMinute, SPELL_DAMAGE_CLASS_MELEE, and SPELLMOD_CHANCE_OF_SUCCESS.

Referenced by GetProcEffectMask().

◆ CallScriptAfterCheckProcHandlers()

bool Aura::CallScriptAfterCheckProcHandlers ( AuraApplication const *  aurApp,
ProcEventInfo eventInfo,
bool  isTriggeredAtSpellProcEvent 
)
2664{
2665 bool result = isTriggeredAtSpellProcEvent;
2666 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2667 {
2668 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_CHECK_PROC, aurApp);
2669 std::list<AuraScript::AfterCheckProcHandler>::iterator hookItrEnd = (*scritr)->DoAfterCheckProc.end(), hookItr = (*scritr)->DoAfterCheckProc.begin();
2670 for (; hookItr != hookItrEnd; ++hookItr)
2671 result &= hookItr->Call(*scritr, eventInfo, isTriggeredAtSpellProcEvent);
2672
2673 (*scritr)->_FinishScriptCall();
2674 }
2675
2676 return result;
2677}
@ AURA_SCRIPT_HOOK_AFTER_CHECK_PROC
Definition SpellScript.h:503

References AURA_SCRIPT_HOOK_AFTER_CHECK_PROC, and m_loadedScripts.

◆ CallScriptAfterDispel()

void Aura::CallScriptAfterDispel ( DispelInfo dispelInfo)
2401{
2402 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2403 {
2404 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_DISPEL);
2405 std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin();
2406 for (; hookItr != hookItrEnd; ++hookItr)
2407 hookItr->Call(*scritr, dispelInfo);
2408
2409 (*scritr)->_FinishScriptCall();
2410 }
2411}
@ AURA_SCRIPT_HOOK_AFTER_DISPEL
Definition SpellScript.h:499

References AURA_SCRIPT_HOOK_AFTER_DISPEL, and m_loadedScripts.

Referenced by Unit::RemoveAurasDueToSpellByDispel().

◆ CallScriptAfterEffectApplyHandlers()

void Aura::CallScriptAfterEffectApplyHandlers ( AuraEffect const *  aurEff,
AuraApplication const *  aurApp,
AuraEffectHandleModes  mode 
)
2453{
2454 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2455 {
2456 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp);
2457 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
2458 for (; effItr != effEndItr; ++effItr)
2459 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2460 effItr->Call(*scritr, aurEff, mode);
2461
2462 (*scritr)->_FinishScriptCall();
2463 }
2464}
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY
Definition SpellScript.h:484

References AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::HandleEffect().

◆ CallScriptAfterEffectProcHandlers()

void Aura::CallScriptAfterEffectProcHandlers ( AuraEffect const *  aurEff,
AuraApplication const *  aurApp,
ProcEventInfo eventInfo 
)
2748{
2749 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2750 {
2751 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC, aurApp);
2752 std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->AfterEffectProc.end(), effItr = (*scritr)->AfterEffectProc.begin();
2753 for (; effItr != effEndItr; ++effItr)
2754 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2755 effItr->Call(*scritr, aurEff, eventInfo);
2756
2757 (*scritr)->_FinishScriptCall();
2758 }
2759}
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC
Definition SpellScript.h:507

References AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::HandleProc().

◆ CallScriptAfterEffectRemoveHandlers()

void Aura::CallScriptAfterEffectRemoveHandlers ( AuraEffect const *  aurEff,
AuraApplication const *  aurApp,
AuraEffectHandleModes  mode 
)
2467{
2468 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2469 {
2470 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp);
2471 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
2472 for (; effItr != effEndItr; ++effItr)
2473 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2474 effItr->Call(*scritr, aurEff, mode);
2475
2476 (*scritr)->_FinishScriptCall();
2477 }
2478}
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE
Definition SpellScript.h:486

References AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::HandleEffect().

◆ CallScriptAfterProcHandlers()

void Aura::CallScriptAfterProcHandlers ( AuraApplication const *  aurApp,
ProcEventInfo eventInfo 
)
2716{
2717 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2718 {
2719 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_PROC, aurApp);
2720 std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->AfterProc.end(), hookItr = (*scritr)->AfterProc.begin();
2721 for (; hookItr != hookItrEnd; ++hookItr)
2722 hookItr->Call(*scritr, eventInfo);
2723
2724 (*scritr)->_FinishScriptCall();
2725 }
2726}
@ AURA_SCRIPT_HOOK_AFTER_PROC
Definition SpellScript.h:508

References AURA_SCRIPT_HOOK_AFTER_PROC, and m_loadedScripts.

Referenced by TriggerProcOnEvent().

◆ CallScriptCheckAreaTargetHandlers()

bool Aura::CallScriptCheckAreaTargetHandlers ( Unit target)
2373{
2374 bool result = true;
2375 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2376 {
2377 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_AREA_TARGET);
2378 std::list<AuraScript::CheckAreaTargetHandler>::iterator hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin();
2379 for (; hookItr != hookItrEnd; ++hookItr)
2380 result &= hookItr->Call(*scritr, target);
2381
2382 (*scritr)->_FinishScriptCall();
2383 }
2384 return result;
2385}
@ AURA_SCRIPT_HOOK_CHECK_AREA_TARGET
Definition SpellScript.h:497

References AURA_SCRIPT_HOOK_CHECK_AREA_TARGET, and m_loadedScripts.

Referenced by CheckAreaTarget().

◆ CallScriptCheckEffectProcHandlers()

bool Aura::CallScriptCheckEffectProcHandlers ( AuraEffect const *  aurEff,
AuraApplication const *  aurApp,
ProcEventInfo eventInfo 
)
2647{
2648 bool result = true;
2649 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2650 {
2651 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_EFFECT_PROC, aurApp);
2652 std::list<AuraScript::CheckEffectProcHandler>::iterator effEndItr = (*scritr)->DoCheckEffectProc.end(), effItr = (*scritr)->DoCheckEffectProc.begin();
2653 for (; effItr != effEndItr; ++effItr)
2654 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2655 result &= effItr->Call(*scritr, aurEff, eventInfo);
2656
2657 (*scritr)->_FinishScriptCall();
2658 }
2659
2660 return result;
2661}
@ AURA_SCRIPT_HOOK_CHECK_EFFECT_PROC
Definition SpellScript.h:502

References AURA_SCRIPT_HOOK_CHECK_EFFECT_PROC, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::CheckEffectProc().

◆ CallScriptCheckProcHandlers()

bool Aura::CallScriptCheckProcHandlers ( AuraApplication const *  aurApp,
ProcEventInfo eventInfo 
)
2631{
2632 bool result = true;
2633 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2634 {
2635 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_PROC, aurApp);
2636 std::list<AuraScript::CheckProcHandler>::iterator hookItrEnd = (*scritr)->DoCheckProc.end(), hookItr = (*scritr)->DoCheckProc.begin();
2637 for (; hookItr != hookItrEnd; ++hookItr)
2638 result &= hookItr->Call(*scritr, eventInfo);
2639
2640 (*scritr)->_FinishScriptCall();
2641 }
2642
2643 return result;
2644}
@ AURA_SCRIPT_HOOK_CHECK_PROC
Definition SpellScript.h:501

References AURA_SCRIPT_HOOK_CHECK_PROC, and m_loadedScripts.

Referenced by GetProcEffectMask().

◆ CallScriptDispel()

void Aura::CallScriptDispel ( DispelInfo dispelInfo)
2388{
2389 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2390 {
2391 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_DISPEL);
2392 std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin();
2393 for (; hookItr != hookItrEnd; ++hookItr)
2394 hookItr->Call(*scritr, dispelInfo);
2395
2396 (*scritr)->_FinishScriptCall();
2397 }
2398}
@ AURA_SCRIPT_HOOK_DISPEL
Definition SpellScript.h:498

References AURA_SCRIPT_HOOK_DISPEL, and m_loadedScripts.

Referenced by Unit::RemoveAurasDueToSpellByDispel().

◆ CallScriptEffectAbsorbHandlers()

void Aura::CallScriptEffectAbsorbHandlers ( AuraEffect aurEff,
AuraApplication const *  aurApp,
DamageInfo dmgInfo,
uint32 absorbAmount,
bool &  defaultPrevented 
)
2557{
2558 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2559 {
2560 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp);
2561 std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
2562 for (; effItr != effEndItr; ++effItr)
2563
2564 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2565 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2566
2567 if (!defaultPrevented)
2568 defaultPrevented = (*scritr)->_IsDefaultActionPrevented();
2569
2570 (*scritr)->_FinishScriptCall();
2571 }
2572}
@ AURA_SCRIPT_HOOK_EFFECT_ABSORB
Definition SpellScript.h:492
uint32 GetEffIndex() const
Definition SpellAuraEffects.h:56

References AURA_SCRIPT_HOOK_EFFECT_ABSORB, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by Unit::CalcAbsorbResist().

◆ CallScriptEffectAfterAbsorbHandlers()

void Aura::CallScriptEffectAfterAbsorbHandlers ( AuraEffect aurEff,
AuraApplication const *  aurApp,
DamageInfo dmgInfo,
uint32 absorbAmount 
)
2575{
2576 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2577 {
2578 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp);
2579 std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
2580 for (; effItr != effEndItr; ++effItr)
2581 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2582 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2583
2584 (*scritr)->_FinishScriptCall();
2585 }
2586}
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB
Definition SpellScript.h:493

References AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by Unit::CalcAbsorbResist().

◆ CallScriptEffectAfterManaShieldHandlers()

void Aura::CallScriptEffectAfterManaShieldHandlers ( AuraEffect aurEff,
AuraApplication const *  aurApp,
DamageInfo dmgInfo,
uint32 absorbAmount 
)
2603{
2604 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2605 {
2606 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp);
2607 std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
2608 for (; effItr != effEndItr; ++effItr)
2609 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2610 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2611
2612 (*scritr)->_FinishScriptCall();
2613 }
2614}
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD
Definition SpellScript.h:495

References AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by Unit::CalcAbsorbResist().

◆ CallScriptEffectApplyHandlers()

bool Aura::CallScriptEffectApplyHandlers ( AuraEffect const *  aurEff,
AuraApplication const *  aurApp,
AuraEffectHandleModes  mode 
)
2414{
2415 bool preventDefault = false;
2416 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2417 {
2418 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp);
2419 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
2420 for (; effItr != effEndItr; ++effItr)
2421 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2422 effItr->Call(*scritr, aurEff, mode);
2423
2424 if (!preventDefault)
2425 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2426
2427 (*scritr)->_FinishScriptCall();
2428 }
2429
2430 return preventDefault;
2431}
@ AURA_SCRIPT_HOOK_EFFECT_APPLY
Definition SpellScript.h:483

References AURA_SCRIPT_HOOK_EFFECT_APPLY, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::HandleEffect().

◆ CallScriptEffectCalcAmountHandlers()

void Aura::CallScriptEffectCalcAmountHandlers ( AuraEffect const *  aurEff,
int32 amount,
bool &  canBeRecalculated 
)
2515{
2516 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2517 {
2518 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT);
2519 std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
2520 for (; effItr != effEndItr; ++effItr)
2521 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2522 effItr->Call(*scritr, aurEff, amount, canBeRecalculated);
2523
2524 (*scritr)->_FinishScriptCall();
2525 }
2526}
@ AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT
Definition SpellScript.h:489

References AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::CalculateAmount().

◆ CallScriptEffectCalcPeriodicHandlers()

void Aura::CallScriptEffectCalcPeriodicHandlers ( AuraEffect const *  aurEff,
bool &  isPeriodic,
int32 amplitude 
)
2529{
2530 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2531 {
2532 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC);
2533 std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
2534 for (; effItr != effEndItr; ++effItr)
2535 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2536 effItr->Call(*scritr, aurEff, isPeriodic, amplitude);
2537
2538 (*scritr)->_FinishScriptCall();
2539 }
2540}
@ AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC
Definition SpellScript.h:490

References AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::CalculatePeriodic().

◆ CallScriptEffectCalcSpellModHandlers()

void Aura::CallScriptEffectCalcSpellModHandlers ( AuraEffect const *  aurEff,
SpellModifier *&  spellMod 
)
2543{
2544 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2545 {
2546 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD);
2547 std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
2548 for (; effItr != effEndItr; ++effItr)
2549 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2550 effItr->Call(*scritr, aurEff, spellMod);
2551
2552 (*scritr)->_FinishScriptCall();
2553 }
2554}
@ AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD
Definition SpellScript.h:491

References AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::CalculateSpellMod().

◆ CallScriptEffectManaShieldHandlers()

void Aura::CallScriptEffectManaShieldHandlers ( AuraEffect aurEff,
AuraApplication const *  aurApp,
DamageInfo dmgInfo,
uint32 absorbAmount,
bool &  defaultPrevented 
)
2589{
2590 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2591 {
2592 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp);
2593 std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
2594 for (; effItr != effEndItr; ++effItr)
2595 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2596 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2597
2598 (*scritr)->_FinishScriptCall();
2599 }
2600}
@ AURA_SCRIPT_HOOK_EFFECT_MANASHIELD
Definition SpellScript.h:494

References AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by Unit::CalcAbsorbResist().

◆ CallScriptEffectPeriodicHandlers()

bool Aura::CallScriptEffectPeriodicHandlers ( AuraEffect const *  aurEff,
AuraApplication const *  aurApp 
)
2481{
2482 bool preventDefault = false;
2483 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2484 {
2485 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp);
2486 std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
2487 for (; effItr != effEndItr; ++effItr)
2488 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2489 effItr->Call(*scritr, aurEff);
2490
2491 if (!preventDefault)
2492 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2493
2494 (*scritr)->_FinishScriptCall();
2495 }
2496
2497 return preventDefault;
2498}
@ AURA_SCRIPT_HOOK_EFFECT_PERIODIC
Definition SpellScript.h:487

References AURA_SCRIPT_HOOK_EFFECT_PERIODIC, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::PeriodicTick().

◆ CallScriptEffectProcHandlers()

bool Aura::CallScriptEffectProcHandlers ( AuraEffect const *  aurEff,
AuraApplication const *  aurApp,
ProcEventInfo eventInfo 
)
2729{
2730 bool preventDefault = false;
2731 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2732 {
2733 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PROC, aurApp);
2734 std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->OnEffectProc.end(), effItr = (*scritr)->OnEffectProc.begin();
2735 for (; effItr != effEndItr; ++effItr)
2736 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2737 effItr->Call(*scritr, aurEff, eventInfo);
2738
2739 if (!preventDefault)
2740 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2741
2742 (*scritr)->_FinishScriptCall();
2743 }
2744 return preventDefault;
2745}
@ AURA_SCRIPT_HOOK_EFFECT_PROC
Definition SpellScript.h:506

References AURA_SCRIPT_HOOK_EFFECT_PROC, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::HandleProc().

◆ CallScriptEffectRemoveHandlers()

bool Aura::CallScriptEffectRemoveHandlers ( AuraEffect const *  aurEff,
AuraApplication const *  aurApp,
AuraEffectHandleModes  mode 
)
2434{
2435 bool preventDefault = false;
2436 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2437 {
2438 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp);
2439 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
2440 for (; effItr != effEndItr; ++effItr)
2441 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2442 effItr->Call(*scritr, aurEff, mode);
2443
2444 if (!preventDefault)
2445 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2446
2447 (*scritr)->_FinishScriptCall();
2448 }
2449 return preventDefault;
2450}
@ AURA_SCRIPT_HOOK_EFFECT_REMOVE
Definition SpellScript.h:485

References AURA_SCRIPT_HOOK_EFFECT_REMOVE, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::HandleEffect().

◆ CallScriptEffectSplitHandlers()

void Aura::CallScriptEffectSplitHandlers ( AuraEffect aurEff,
AuraApplication const *  aurApp,
DamageInfo dmgInfo,
uint32 splitAmount 
)
2617{
2618 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2619 {
2620 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_SPLIT, aurApp);
2621 std::list<AuraScript::EffectSplitHandler>::iterator effEndItr = (*scritr)->OnEffectSplit.end(), effItr = (*scritr)->OnEffectSplit.begin();
2622 for (; effItr != effEndItr; ++effItr)
2623 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2624 effItr->Call(*scritr, aurEff, dmgInfo, splitAmount);
2625
2626 (*scritr)->_FinishScriptCall();
2627 }
2628}
@ AURA_SCRIPT_HOOK_EFFECT_SPLIT
Definition SpellScript.h:496

References AURA_SCRIPT_HOOK_EFFECT_SPLIT, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

◆ CallScriptEffectUpdatePeriodicHandlers()

void Aura::CallScriptEffectUpdatePeriodicHandlers ( AuraEffect aurEff)
2501{
2502 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2503 {
2504 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC);
2505 std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
2506 for (; effItr != effEndItr; ++effItr)
2507 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2508 effItr->Call(*scritr, aurEff);
2509
2510 (*scritr)->_FinishScriptCall();
2511 }
2512}
@ AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC
Definition SpellScript.h:488

References AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC, AuraEffect::GetEffIndex(), m_loadedScripts, and m_spellInfo.

Referenced by AuraEffect::UpdatePeriodic().

◆ CallScriptPrepareProcHandlers()

bool Aura::CallScriptPrepareProcHandlers ( AuraApplication const *  aurApp,
ProcEventInfo eventInfo 
)
2680{
2681 bool prepare = true;
2682 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2683 {
2684 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PREPARE_PROC, aurApp);
2685 std::list<AuraScript::AuraProcHandler>::iterator effEndItr = (*scritr)->DoPrepareProc.end(), effItr = (*scritr)->DoPrepareProc.begin();
2686 for (; effItr != effEndItr; ++effItr)
2687 effItr->Call(*scritr, eventInfo);
2688
2689 if (prepare)
2690 prepare = !(*scritr)->_IsDefaultActionPrevented();
2691
2692 (*scritr)->_FinishScriptCall();
2693 }
2694
2695 return prepare;
2696}
@ AURA_SCRIPT_HOOK_PREPARE_PROC
Definition SpellScript.h:504

References AURA_SCRIPT_HOOK_PREPARE_PROC, and m_loadedScripts.

Referenced by PrepareProcToTrigger().

◆ CallScriptProcHandlers()

bool Aura::CallScriptProcHandlers ( AuraApplication const *  aurApp,
ProcEventInfo eventInfo 
)
2699{
2700 bool handled = false;
2701 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2702 {
2703 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PROC, aurApp);
2704 std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->OnProc.end(), hookItr = (*scritr)->OnProc.begin();
2705 for (; hookItr != hookItrEnd; ++hookItr)
2706 hookItr->Call(*scritr, eventInfo);
2707
2708 handled |= (*scritr)->_IsDefaultActionPrevented();
2709 (*scritr)->_FinishScriptCall();
2710 }
2711
2712 return handled;
2713}
@ AURA_SCRIPT_HOOK_PROC
Definition SpellScript.h:505

References AURA_SCRIPT_HOOK_PROC, and m_loadedScripts.

Referenced by TriggerProcOnEvent().

◆ CanBeAppliedOn()

bool Aura::CanBeAppliedOn ( Unit target)
1889{
1890 // unit not in world or during remove from world
1891 if (!target->IsInWorld() || target->IsDuringRemoveFromWorld())
1892 {
1893 // area auras mustn't be applied
1894 if (GetOwner() != target)
1895 return false;
1896 // not selfcasted single target auras mustn't be applied
1897 if (GetCasterGUID() != GetOwner()->GetGUID() && GetSpellInfo()->IsSingleTarget())
1898 return false;
1899 return true;
1900 }
1901 else
1902 return CheckAreaTarget(target);
1903}
bool CheckAreaTarget(Unit *target)
Definition SpellAuras.cpp:1905
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:105
bool IsSingleTarget() const
Definition SpellAuras.h:165
bool IsInWorld() const
Definition Object.h:109
bool IsDuringRemoveFromWorld() const
Definition Unit.h:704

References CheckAreaTarget(), GetCasterGUID(), GetOwner(), GetSpellInfo(), Unit::IsDuringRemoveFromWorld(), Object::IsInWorld(), and IsSingleTarget().

Referenced by UpdateTargetMap().

◆ CanBeSaved()

bool Aura::CanBeSaved ( ) const
1049{
1050 SpellInfo const* spellInfo = GetSpellInfo();
1051
1053 {
1054 return true;
1055 }
1056
1058 {
1059 return false;
1060 }
1061
1062 if (IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_DO_NOT_DISPLAY) && spellInfo->Stances))
1063 {
1064 return false;
1065 }
1066
1067 // Xinef: do not save channel auras
1068 if (GetSpellInfo()->IsChanneled())
1069 {
1070 return false;
1071 }
1072
1073 // Xinef: Check if aura is single target, not only spell info
1074 if (GetCasterGUID() != GetOwner()->GetGUID() && (GetSpellInfo()->IsSingleTarget() || IsSingleTarget()))
1075 {
1076 return false;
1077 }
1078
1079 // don't save auras removed by proc system
1080 if (IsUsingCharges() && !GetCharges())
1081 {
1082 return false;
1083 }
1084
1085 return true;
1086}
@ SPELL_ATTR0_DO_NOT_DISPLAY
Definition SharedDefines.h:377
@ SPELL_ATTR0_CU_FORCE_AURA_SAVING
Definition SpellInfo.h:206
@ SPELL_ATTR0_CU_AURA_CANNOT_BE_SAVED
Definition SpellInfo.h:201
bool IsUsingCharges() const
Definition SpellAuras.h:200
uint8 GetCharges() const
Definition SpellAuras.h:141
uint32 Stances
Definition SpellInfo.h:357

References GetCasterGUID(), GetCharges(), GetOwner(), GetSpellInfo(), SpellInfo::HasAttribute(), IsPassive(), IsSingleTarget(), IsUsingCharges(), SPELL_ATTR0_CU_AURA_CANNOT_BE_SAVED, SPELL_ATTR0_CU_FORCE_AURA_SAVING, SPELL_ATTR0_DO_NOT_DISPLAY, and SpellInfo::Stances.

◆ CanBeSentToClient()

bool Aura::CanBeSentToClient ( ) const
1089{
1091}
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
Definition SpellAuraDefines.h:325
bool HasEffectType(AuraType type) const
Definition SpellAuras.cpp:1173
bool HasAreaAuraEffect() const
Definition SpellInfo.cpp:918

References GetSpellInfo(), SpellInfo::HasAreaAuraEffect(), HasEffectType(), IsPassive(), and SPELL_AURA_ABILITY_IGNORE_AURASTATE.

Referenced by Spell::EffectSummonPet().

◆ CanStackWith()

bool Aura::CanStackWith ( Aura const *  existingAura) const
1940{
1941 // Can stack with self
1942 if (this == existingAura)
1943 return true;
1944
1945 SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo();
1946 bool sameCaster = GetCasterGUID() == existingAura->GetCasterGUID();
1947
1948 // Dynobj auras always stack
1949 // xinef: dont allow different ranks (or the same rank) of same spell to stack (many flamestrikes for example)
1950 if (existingAura->GetType() == DYNOBJ_AURA_TYPE)
1951 {
1952 // xinef: desecration lag fix - bound this condition to periodics
1953 if (sameCaster && GetSpellInfo()->Id == existingSpellInfo->Id && GetSpellInfo()->HasAura(SPELL_AURA_PERIODIC_DAMAGE))
1954 return false;
1955 return true;
1956 }
1957
1958 // passive auras don't stack with another rank of the spell cast by same caster
1959 // Exception: item-sourced auras from different items can stack (e.g., weapon imbues on MH/OH)
1960 if (IsPassive() && sameCaster && (m_spellInfo->IsDifferentRankOf(existingSpellInfo) || (m_spellInfo->Id == existingSpellInfo->Id && m_castItemGuid.IsEmpty())))
1961 {
1962 // Allow stacking if both auras are from different items
1963 if (!(GetCastItemGUID() && existingAura->GetCastItemGUID() && GetCastItemGUID() != existingAura->GetCastItemGUID()))
1964 return false;
1965 }
1966
1967 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1968 {
1969 // prevent remove triggering aura by triggered aura
1970 if (existingSpellInfo->Effects[i].TriggerSpell == GetId()
1971 // prevent remove triggered aura by triggering aura refresh
1972 || m_spellInfo->Effects[i].TriggerSpell == existingAura->GetId())
1973 return true;
1974 }
1975
1976 // check spell specific stack rules
1977 if (m_spellInfo->IsAuraExclusiveBySpecificWith(existingSpellInfo)
1978 || (sameCaster && m_spellInfo->IsAuraExclusiveBySpecificPerCasterWith(existingSpellInfo)))
1979 return false;
1980
1981 // check spell group stack rules
1982 switch (sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo))
1983 {
1985 case SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST: // if it reaches this point, existing aura is lower/equal
1986 return false;
1988 if (sameCaster)
1989 return false;
1990 break;
1993 default:
1994 break;
1995 }
1996
1997 if (m_spellInfo->SpellFamilyName != existingSpellInfo->SpellFamilyName)
1998 return true;
1999
2000 if (!sameCaster)
2001 {
2002 // Channeled auras can stack if not forbidden by db or aura type
2003 if (existingAura->GetSpellInfo()->IsChanneled())
2004 return true;
2005
2007 return true;
2008
2009 // check same periodic auras
2010 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2011 {
2012 switch (m_spellInfo->Effects[i].ApplyAuraName)
2013 {
2014 // DOT or HOT from different casters will stack
2026 // periodic auras which target areas are not allowed to stack this way (replenishment for example)
2027 if (m_spellInfo->Effects[i].IsTargetingArea() || existingSpellInfo->Effects[i].IsTargetingArea())
2028 break;
2029 return true;
2030 default:
2031 break;
2032 }
2033 }
2034 }
2035
2036 uint8 VehicleAura1 = 0;
2037 uint8 VehicleAura2 = 0;
2038 uint8 i = 0;
2039 while (i < MAX_SPELL_EFFECTS && !(VehicleAura1 && VehicleAura2))
2040 {
2041 if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
2042 VehicleAura1 = i + 1;
2043 if (existingSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
2044 VehicleAura2 = i + 1;
2045
2046 ++i;
2047 }
2048
2049 if (VehicleAura1 && VehicleAura2)
2050 {
2051 Vehicle* veh = nullptr;
2052 if (GetOwner()->ToUnit())
2053 veh = GetOwner()->ToUnit()->GetVehicleKit();
2054
2055 if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
2056 return true;
2057
2058 // xinef: allow direct auras to stack if there is no passenger in this slot
2059 if (AuraEffect* aurEff = GetEffect(VehicleAura1 - 1))
2060 if (aurEff->GetAmount() > 0)
2061 if (!veh->GetPassenger(aurEff->GetAmount() - 1))
2062 return true;
2063
2064 if (!veh->GetAvailableSeatCount())
2065 return false; // No empty seat available
2066
2067 return true; // Empty seat available (skip rest)
2068 }
2069
2070 // spell of same spell rank chain
2071 if (m_spellInfo->IsRankOf(existingSpellInfo) && !(m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellInfo->SpellFamilyFlags[1] & 0x80000000))
2072 {
2073 // don't allow passive area auras to stack
2074 if (m_spellInfo->IsMultiSlotAura() && !IsArea())
2075 return true;
2076
2077 // Allow item-sourced auras from different items to stack (e.g., weapon imbues on MH/OH, enchant procs)
2078 if ((IsPassive() || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC)) && GetCastItemGUID() && existingAura->GetCastItemGUID() && GetCastItemGUID() != existingAura->GetCastItemGUID())
2079 return true;
2080
2081 // same spell with same caster should not stack
2082 return false;
2083 }
2084
2085 return true;
2086}
@ SPELL_ATTR3_DOT_STACKING_RULE
Definition SharedDefines.h:488
@ SPELLFAMILY_HUNTER
Definition SharedDefines.h:3793
@ SPELL_AURA_PERIODIC_DAMAGE
Definition SpellAuraDefines.h:66
@ SPELL_AURA_OBS_MOD_HEALTH
Definition SpellAuraDefines.h:83
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition SpellAuraDefines.h:127
@ SPELL_AURA_OBS_MOD_POWER
Definition SpellAuraDefines.h:84
@ SPELL_AURA_CONTROL_VEHICLE
Definition SpellAuraDefines.h:299
@ SPELL_AURA_PERIODIC_HEAL
Definition SpellAuraDefines.h:71
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
Definition SpellAuraDefines.h:290
@ SPELL_AURA_PERIODIC_ENERGIZE
Definition SpellAuraDefines.h:87
@ SPELL_AURA_PERIODIC_LEECH
Definition SpellAuraDefines.h:116
@ SPELL_AURA_POWER_BURN
Definition SpellAuraDefines.h:225
@ SPELL_AURA_PERIODIC_DUMMY
Definition SpellAuraDefines.h:289
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
Definition SpellAuraDefines.h:86
@ DYNOBJ_AURA_TYPE
Definition SpellAuraDefines.h:386
@ SPELL_ATTR0_CU_ENCHANT_PROC
Definition SpellInfo.h:177
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER
Definition SpellMgr.h:364
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE
Definition SpellMgr.h:363
@ SPELL_GROUP_STACK_RULE_DEFAULT
Definition SpellMgr.h:362
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT
Definition SpellMgr.h:365
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST
Definition SpellMgr.h:366
bool IsArea() const
Definition SpellAuras.cpp:1023
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:176
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:103
bool IsEmpty() const
Definition ObjectGuid.h:165
Unit * ToUnit()
Definition Object.h:210
bool IsRankOf(SpellInfo const *spellInfo) const
Definition SpellInfo.cpp:2975
flag96 SpellFamilyFlags
Definition SpellInfo.h:412
bool IsAuraExclusiveBySpecificPerCasterWith(SpellInfo const *spellInfo) const
Definition SpellInfo.cpp:1425
bool IsAuraExclusiveBySpecificWith(SpellInfo const *spellInfo) const
Definition SpellInfo.cpp:1393
bool IsMultiSlotAura() const
Definition SpellInfo.cpp:1239
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
bool IsDifferentRankOf(SpellInfo const *spellInfo) const
Definition SpellInfo.cpp:2980
uint32 SpellFamilyName
Definition SpellInfo.h:411
Vehicle * GetVehicleKit() const
Definition Unit.h:1925
Definition Vehicle.h:28
uint8 GetAvailableSeatCount() const
Definition Vehicle.cpp:641
Unit * GetPassenger(int8 seatId) const
Definition Vehicle.cpp:239

References DYNOBJ_AURA_TYPE, SpellInfo::Effects, Vehicle::GetAvailableSeatCount(), GetCasterGUID(), GetCastItemGUID(), GetEffect(), GetId(), GetOwner(), Vehicle::GetPassenger(), GetSpellInfo(), GetType(), Unit::GetVehicleKit(), SpellInfo::HasAttribute(), SpellInfo::Id, IsArea(), SpellInfo::IsAuraExclusiveBySpecificPerCasterWith(), SpellInfo::IsAuraExclusiveBySpecificWith(), SpellInfo::IsChanneled(), SpellInfo::IsDifferentRankOf(), ObjectGuid::IsEmpty(), SpellInfo::IsMultiSlotAura(), IsPassive(), SpellInfo::IsRankOf(), m_castItemGuid, m_spellInfo, MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_ENCHANT_PROC, SPELL_ATTR3_DOT_STACKING_RULE, SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DUMMY, SPELL_AURA_PERIODIC_ENERGIZE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_PERIODIC_MANA_LEECH, SPELL_AURA_PERIODIC_TRIGGER_SPELL, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_POWER_BURN, SPELL_GROUP_STACK_RULE_DEFAULT, SPELL_GROUP_STACK_RULE_EXCLUSIVE, SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER, SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST, SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT, SPELLFAMILY_HUNTER, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, sSpellMgr, and Object::ToUnit().

Referenced by Unit::_RemoveNoStackAurasDueToAura(), and UpdateTargetMap().

◆ CheckAreaTarget()

bool Aura::CheckAreaTarget ( Unit target)
1906{
1907 return CallScriptCheckAreaTargetHandlers(target);
1908}
bool CallScriptCheckAreaTargetHandlers(Unit *target)
Definition SpellAuras.cpp:2372

References CallScriptCheckAreaTargetHandlers().

Referenced by CanBeAppliedOn().

◆ ConsumeProcCharges()

void Aura::ConsumeProcCharges ( SpellProcEntry const *  procEntry)
2331{
2332 // Remove aura if we've used last charge to proc
2333 if (procEntry->AttributesMask & PROC_ATTR_USE_STACKS_FOR_CHARGES)
2334 {
2335 ModStackAmount(-1);
2336 }
2337 else if (IsUsingCharges())
2338 {
2339 if (!GetCharges())
2340 Remove();
2341 }
2342}
@ PROC_ATTR_USE_STACKS_FOR_CHARGES
Definition SpellMgr.h:280
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool periodicReset=false)
Definition SpellAuras.cpp:968
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0

References SpellProcEntry::AttributesMask, GetCharges(), IsUsingCharges(), ModStackAmount(), PROC_ATTR_USE_STACKS_FOR_CHARGES, and Remove().

Referenced by TriggerProcOnEvent().

◆ Create()

Aura * Aura::Create ( SpellInfo const *  spellproto,
uint8  effMask,
WorldObject owner,
Unit caster,
int32 baseAmount,
Item castItem,
ObjectGuid  casterGUID,
ObjectGuid  itemGUID = ObjectGuid::Empty 
)
static
309{
310 ASSERT_NODEBUGINFO(effMask);
311 ASSERT_NODEBUGINFO(spellproto);
312 ASSERT_NODEBUGINFO(owner);
313 ASSERT_NODEBUGINFO(caster || casterGUID);
315 // try to get caster of aura
316 if (casterGUID)
317 {
318 if (owner->GetGUID() == casterGUID)
319 caster = owner->ToUnit();
320 else
321 caster = ObjectAccessor::GetUnit(*owner, casterGUID);
322 }
323 else
324 casterGUID = caster->GetGUID();
325
326 // check if aura can be owned by owner
327 if (owner->IsUnit())
328 if (!owner->IsInWorld() || ((Unit*)owner)->IsDuringRemoveFromWorld())
329 // owner not in world so don't allow to own not self casted single target auras
330 if (casterGUID != owner->GetGUID() && spellproto->IsSingleTarget())
331 return nullptr;
332
333 Aura* aura = nullptr;
334 switch (owner->GetTypeId())
335 {
336 case TYPEID_UNIT:
337 case TYPEID_PLAYER:
338 aura = new UnitAura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID, itemGUID);
339 break;
341 aura = new DynObjAura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID, itemGUID);
342 break;
343 default:
344 ABORT();
345 return nullptr;
346 }
347 // aura can be removed in Unit::_AddAura call
348 if (aura->IsRemoved())
349 return nullptr;
350 return aura;
351}
#define MAX_EFFECT_MASK
Definition DBCStructure.h:1638
Definition SpellAuras.h:87
bool IsRemoved() const
Definition SpellAuras.h:162
Definition SpellAuras.h:312
bool IsUnit() const
Definition Object.h:209
Definition SpellAuras.h:289
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:223

References ABORT, ASSERT_NODEBUGINFO, Object::GetGUID(), Object::GetTypeId(), ObjectAccessor::GetUnit(), Object::IsInWorld(), IsRemoved(), SpellInfo::IsSingleTarget(), Object::IsUnit(), MAX_EFFECT_MASK, Object::ToUnit(), TYPEID_DYNAMICOBJECT, TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by TryCreate(), and TryRefreshStackOrCreate().

◆ DropCharge()

bool Aura::DropCharge ( AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT)
inline
146{ return ModCharges(-1, removeMode); }
bool ModCharges(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition SpellAuras.cpp:920

References ModCharges().

Referenced by AuraScript::DropCharge(), spell_sha_static_shock::HandleProc(), and Player::RemoveSpellMods().

◆ FillTargetMap()

virtual void Aura::FillTargetMap ( std::map< Unit *, uint8 > &  targets,
Unit caster 
)
pure virtual

Implemented in UnitAura, and DynObjAura.

Referenced by UpdateTargetMap().

◆ GetApplicationList()

void Aura::GetApplicationList ( std::list< AuraApplication * > &  applicationList) const
1201{
1202 for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1203 {
1204 if (appIter->second->GetEffectMask())
1205 applicationList.push_back(appIter->second);
1206 }
1207}

References m_applications.

Referenced by SetStackAmount().

◆ GetApplicationMap()

ApplicationMap const & Aura::GetApplicationMap ( )
inline

◆ GetApplicationOfTarget() [1/2]

AuraApplication * Aura::GetApplicationOfTarget ( ObjectGuid  guid)
inline
185{ ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return nullptr; }

References m_applications.

◆ GetApplicationOfTarget() [2/2]

◆ GetApplyTime()

time_t Aura::GetApplyTime ( ) const
inline

◆ GetCaster()

◆ GetCasterGUID()

◆ GetCasterLevel()

uint8 Aura::GetCasterLevel ( ) const
inline

◆ GetCastItemEntry()

uint32 Aura::GetCastItemEntry ( ) const
inline
104{ return m_castItemEntry; }

References m_castItemEntry.

◆ GetCastItemGUID()

◆ GetCharges()

◆ GetDebugInfo()

std::string Aura::GetDebugInfo ( ) const
virtual
2767{
2768 std::stringstream sstr;
2769 sstr << std::boolalpha
2770 << "Id: " << GetId() << " Caster: " << GetCasterGUID().ToString()
2771 << "\nOwner: " << (GetOwner() ? GetOwner()->GetDebugInfo() : "NULL");
2772 return sstr.str();
2773}
std::string GetDebugInfo() const override
Definition Object.cpp:2591

References GetCasterGUID(), WorldObject::GetDebugInfo(), GetId(), GetOwner(), and ObjectGuid::ToString().

◆ GetDuration()

◆ GetDynobjOwner()

DynamicObject * Aura::GetDynobjOwner ( ) const
inline
AuraObjectType GetType() const
Definition SpellAuras.cpp:425
Definition DynamicObject.h:35

References ASSERT, DYNOBJ_AURA_TYPE, GetType(), and m_owner.

Referenced by DynObjAura::DynObjAura(), Spell::EffectPersistentAA(), DynObjAura::FillTargetMap(), and AuraScript::GetDynobjOwner().

◆ GetEffect()

◆ GetEffectMask()

◆ GetId()

◆ GetMaxDuration()

◆ GetOwner()

◆ GetProcEffectMask()

uint8 Aura::GetProcEffectMask ( AuraApplication aurApp,
ProcEventInfo eventInfo,
TimePoint  now 
) const
2135{
2136 SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId());
2137
2138 // only auras with spell proc entry can trigger proc
2139 if (!procEntry)
2140 return 0;
2141
2142 // check spell triggering us
2143 if (Spell const* spell = eventInfo.GetProcSpell())
2144 {
2145 // Do not allow auras to proc from effect triggered from itself
2146 if (spell->GetTriggeredByAuraSpellInfo() == m_spellInfo)
2147 return 0;
2148
2149 // check if aura can proc when spell is triggered (exception for hunter auto shot & wands)
2150 // Kill/killed/death events should not be blocked by the triggered-spell check -
2151 // the kill itself is the proc trigger, not the spell that dealt the killing blow
2152 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_CAN_PROC_FROM_PROCS) &&
2154 !(eventInfo.GetTypeMask() & AUTO_ATTACK_PROC_FLAG_MASK) &&
2156 {
2157 if (spell->IsTriggered() && !spell->GetSpellInfo()->HasAttribute(SPELL_ATTR3_NOT_A_PROC))
2158 return 0;
2159 }
2160
2161 // do not allow aura proc if proc is caused by a spell cast by item
2162 if (spell->m_CastItem && (procEntry->AttributesMask & PROC_ATTR_CANT_PROC_FROM_ITEM_CAST))
2163 return 0;
2164 }
2165
2166 // Don't consume stealth charges from friendly spells
2168 {
2169 if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
2170 if (spellInfo->IsPositive() || !eventInfo.GetActor()->IsHostileTo(aurApp->GetTarget()) || spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH))
2171 return 0;
2172 }
2173
2174 // check if we have charges to proc with
2175 if (IsUsingCharges() && !GetCharges())
2176 return 0;
2177
2178 // check proc cooldown
2179 if (IsProcOnCooldown(now))
2180 return 0;
2181
2182 // do checks against db data
2183 if (!sSpellMgr->CanSpellTriggerProcOnEvent(*procEntry, eventInfo))
2184 return 0;
2185
2186 // check if spell was affected by this aura's spellmod (used by Arcane Potency and similar effects)
2187 // only applies when consuming charges or stacks
2189 {
2190 Spell const* procSpell = eventInfo.GetProcSpell();
2191 if (!procSpell || procSpell->m_appliedMods.find(const_cast<Aura*>(this)) == procSpell->m_appliedMods.end())
2192 return 0;
2193 }
2194
2195 // do checks using conditions table
2196 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, GetId());
2197 ConditionSourceInfo condInfo = ConditionSourceInfo(eventInfo.GetActor(), eventInfo.GetActionTarget());
2198 if (!sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
2199 return 0;
2200
2201 // AuraScript Hook
2202 if (!const_cast<Aura*>(this)->CallScriptCheckProcHandlers(aurApp, eventInfo))
2203 return 0;
2204
2205 // At least one effect has to pass checks to proc aura
2206 uint8 procEffectMask = aurApp->GetEffectMask();
2207 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2208 {
2209 if (AuraEffect* aurEff = GetEffect(i))
2210 {
2211 if (procEffectMask & (1 << i))
2212 {
2213 if ((procEntry->DisableEffectsMask & (1u << i)) || !aurEff->CheckEffectProc(aurApp, eventInfo))
2214 procEffectMask &= ~(1 << i);
2215 }
2216 }
2217 }
2218
2219 if (!procEffectMask)
2220 return 0;
2221
2222 // Check if current equipment meets aura requirements
2223 // do that only for passive spells
2224 Unit* target = aurApp->GetTarget();
2225 if (IsPassive() && target->IsPlayer() && GetSpellInfo()->EquippedItemClass != -1)
2226 {
2228 {
2229 Item* item = nullptr;
2231 {
2232 if (target->ToPlayer()->IsInFeralForm())
2233 return 0;
2234
2235 if (DamageInfo const* damageInfo = eventInfo.GetDamageInfo())
2236 {
2237 switch (damageInfo->GetAttackType())
2238 {
2239 case BASE_ATTACK:
2241 break;
2242 case OFF_ATTACK:
2244 break;
2245 default:
2247 break;
2248 }
2249 }
2250 }
2252 {
2253 // Check if player is wearing shield
2255 }
2256
2257 if (!item || item->IsBroken() || !item->IsFitToSpellRequirements(GetSpellInfo()))
2258 return 0;
2259 }
2260 }
2261
2262 float procChance = CalcProcChance(*procEntry, eventInfo);
2263
2264 if (roll_chance_f(procChance))
2265 return procEffectMask;
2266
2267 return 0;
2268}
#define sConditionMgr
Definition ConditionMgr.h:296
@ CONDITION_SOURCE_TYPE_SPELL_PROC
Definition ConditionMgr.h:150
std::list< Condition * > ConditionList
Definition ConditionMgr.h:240
@ ITEM_CLASS_ARMOR
Definition ItemTemplate.h:295
@ ITEM_CLASS_WEAPON
Definition ItemTemplate.h:293
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:677
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:678
@ EQUIPMENT_SLOT_RANGED
Definition Player.h:679
#define INVENTORY_SLOT_BAG_0
Definition Player.h:657
bool roll_chance_f(float chance)
Definition Random.h:57
@ SPELL_ATTR3_NOT_A_PROC
Definition SharedDefines.h:490
@ SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT
Definition SharedDefines.h:482
@ SPELL_ATTR3_CAN_PROC_FROM_PROCS
Definition SharedDefines.h:507
@ SPELL_AURA_MOD_STEALTH
Definition SpellAuraDefines.h:79
@ SPELL_ATTR0_CU_DONT_BREAK_STEALTH
Definition SpellInfo.h:183
@ PROC_ATTR_CANT_PROC_FROM_ITEM_CAST
Definition SpellMgr.h:282
@ PROC_ATTR_TRIGGERED_CAN_PROC
Definition SpellMgr.h:277
@ PROC_ATTR_REQ_SPELLMOD
Definition SpellMgr.h:279
@ AUTO_ATTACK_PROC_FLAG_MASK
Definition SpellMgr.h:149
@ PROC_FLAG_KILLED
Definition SpellMgr.h:110
@ PROC_FLAG_DEATH
Definition SpellMgr.h:146
@ PROC_FLAG_KILL
Definition SpellMgr.h:111
@ OFF_ATTACK
Definition Unit.h:217
@ BASE_ATTACK
Definition Unit.h:216
uint8 GetEffectMask() const
Definition SpellAuras.h:66
bool CallScriptCheckProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2630
float CalcProcChance(SpellProcEntry const &procEntry, ProcEventInfo &eventInfo) const
Definition SpellAuras.cpp:2270
bool IsProcOnCooldown(TimePoint now) const
Definition SpellAuras.cpp:2088
Definition Unit.h:337
Definition Item.h:220
bool IsBroken() const
Definition Item.h:257
bool IsFitToSpellRequirements(SpellInfo const *spellInfo) const
Definition Item.cpp:885
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
Definition Player.h:1270
Unit * GetActionTarget() const
Definition Unit.h:461
Spell const * GetProcSpell() const
Definition Unit.h:469
uint32 GetTypeMask() const
Definition Unit.h:463
int32 EquippedItemClass
Definition SpellInfo.h:399
bool HasAura(AuraType aura) const
Definition SpellInfo.cpp:902
Definition Spell.h:298
UsedSpellMods m_appliedMods
Definition Spell.h:560
bool IsInFeralForm() const
Definition Unit.h:1960
bool IsHostileTo(Unit const *unit) const
Definition Unit.cpp:7297
Definition ConditionMgr.h:185
uint32 AttributesMask
Definition SpellMgr.h:294
uint32 DisableEffectsMask
Definition SpellMgr.h:295

References SpellProcEntry::AttributesMask, AUTO_ATTACK_PROC_FLAG_MASK, BASE_ATTACK, CalcProcChance(), CallScriptCheckProcHandlers(), CONDITION_SOURCE_TYPE_SPELL_PROC, SpellProcEntry::DisableEffectsMask, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, SpellInfo::EquippedItemClass, ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), GetCharges(), ProcEventInfo::GetDamageInfo(), GetEffect(), AuraApplication::GetEffectMask(), GetId(), ProcEventInfo::GetProcSpell(), ProcEventInfo::GetSpellInfo(), GetSpellInfo(), AuraApplication::GetTarget(), ProcEventInfo::GetTypeMask(), Player::GetUseableItemByPos(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), Item::IsFitToSpellRequirements(), Unit::IsHostileTo(), Unit::IsInFeralForm(), IsPassive(), Object::IsPlayer(), IsProcOnCooldown(), IsUsingCharges(), ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, Spell::m_appliedMods, m_spellInfo, MAX_SPELL_EFFECTS, OFF_ATTACK, PROC_ATTR_CANT_PROC_FROM_ITEM_CAST, PROC_ATTR_REQ_SPELLMOD, PROC_ATTR_TRIGGERED_CAN_PROC, PROC_ATTR_USE_STACKS_FOR_CHARGES, PROC_FLAG_DEATH, PROC_FLAG_KILL, PROC_FLAG_KILLED, roll_chance_f(), sConditionMgr, SPELL_ATTR0_CU_DONT_BREAK_STEALTH, SPELL_ATTR3_CAN_PROC_FROM_PROCS, SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT, SPELL_ATTR3_NOT_A_PROC, SPELL_AURA_MOD_STEALTH, sSpellMgr, and Object::ToPlayer().

◆ GetScript()

template<class Script >
Script * Aura::GetScript ( std::string const &  scriptName) const
inline
242 {
243 return dynamic_cast<Script*>(GetScriptByName(scriptName));
244 }
AuraScript * GetScriptByName(std::string const &scriptName) const
Definition SpellAuras.cpp:371

References GetScriptByName().

◆ GetScriptByName()

AuraScript * Aura::GetScriptByName ( std::string const &  scriptName) const
372{
373 for (std::list<AuraScript*>::const_iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)
374 if ((*itr)->_GetScriptName()->compare(scriptName) == 0)
375 return *itr;
376 return nullptr;
377}

References m_loadedScripts.

Referenced by GetScript(), and spell_rog_mutilate::HandleAfterCast().

◆ GetSpellInfo()

SpellInfo const * Aura::GetSpellInfo ( ) const
inline
100{ return m_spellInfo; }

References m_spellInfo.

Referenced by Unit::_AddAura(), Unit::_ApplyAura(), Unit::_CreateAuraApplication(), Pet::_SaveAuras(), Unit::_UnapplyAura(), _UnapplyForTarget(), SpellInfo::ApplyAllSpellImmunitiesTo(), AuraEffect::ApplySpellMod(), AuraApplication::BuildUpdatePacket(), CalcProcChance(), CanBeAppliedOn(), CanBeSaved(), CanBeSentToClient(), CanStackWith(), Player::CheckAreaExploreAndOutdoor(), spell_item_luffa::CheckCast(), Spell::CheckCasterAuras(), Spell::DoSpellHitOnUnit(), Spell::EffectDispelMechanic(), Spell::EffectStealBeneficialBuff(), UnitAura::FillTargetMap(), DynObjAura::FillTargetMap(), Unit::GetDiseasesByCaster(), Unit::GetDispellableAuraList(), GetId(), GetProcEffectMask(), AuraScript::GetSpellInfo(), AuraEffect::HandleAuraDummy(), HandleAuraSpecificMods(), spell_item_powerful_anti_venom::HandleDummy(), spell_item_strong_anti_venom::HandleDummy(), spell_item_anti_venom::HandleDummy(), spell_item_luffa::HandleEffect(), ArenaSpectator::HandleResetCommand(), spell_gen_clear_debuffs::HandleScript(), spell_dru_glyph_of_starfire::HandleScriptEffect(), spell_hun_chimera_shot::HandleScriptEffect(), HasMoreThanOneEffectForType(), Unit::HasNegativeAuraWithAttribute(), IsArea(), IsDeathPersistent(), Unit::IsHighestExclusiveAura(), IsPassive(), IsSingleTargetWith(), list_commandscript::ListAurasCommand(), Player::LoadFromDB(), spell_hor_shared_suffering_aura::OnRemove(), Unit::RemoveAllAurasExceptType(), Unit::RemoveAllAurasOnDeath(), Unit::RemoveAllAurasRequiringDeadTarget(), Unit::RemoveArenaAuras(), Unit::RemoveAurasByShapeShift(), Unit::RemoveAurasDueToSpellByDispel(), Unit::RemoveAurasDueToSpellBySteal(), Unit::RemoveAurasWithFamily(), Unit::RemoveAurasWithInterruptFlags(), Unit::RemoveAurasWithMechanic(), Unit::RemoveEvadeAuras(), Player::RemoveItemDependentAurasAndCasts(), Unit::RemoveMovementImpairingAuras(), Player::RemoveSpellMods(), Player::RestoreSpellMods(), ArenaSpectator::ShouldSendAura(), Unit::SpellPctDamageModsDone(), and UpdateTargetMap().

◆ GetStackAmount()

◆ GetTriggeredByAuraSpellInfo()

SpellInfo const * Aura::GetTriggeredByAuraSpellInfo ( ) const

◆ GetType()

AuraObjectType Aura::GetType ( ) const
426{
427 if (!m_owner)
428 {
429 LOG_ERROR("spells", "Aura::GetType m_owner is null!");
430 return UNIT_AURA_TYPE;
431 }
432
434}
@ UNIT_AURA_TYPE
Definition SpellAuraDefines.h:385
bool IsDynamicObject() const
Definition Object.h:221

References DYNOBJ_AURA_TYPE, Object::IsDynamicObject(), LOG_ERROR, m_owner, and UNIT_AURA_TYPE.

Referenced by CanStackWith(), GetDynobjOwner(), AuraScript::GetType(), GetUnitOwner(), Spell::handle_immediate(), IsProcOnCooldown(), Unit::RemoveAuraFromStack(), and UpdateTargetMap().

◆ GetUnitOwner()

◆ HandleAllEffects()

void Aura::HandleAllEffects ( AuraApplication aurApp,
uint8  mode,
bool  apply 
)
1193{
1194 ASSERT (!IsRemoved());
1195 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1196 if (m_effects[i] && !IsRemoved())
1197 m_effects[i]->HandleEffect(aurApp, mode, apply);
1198}
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
Definition SpellAuraEffects.cpp:755

References ASSERT, AuraEffect::HandleEffect(), IsRemoved(), m_effects, and MAX_SPELL_EFFECTS.

Referenced by Player::CheckAreaExploreAndOutdoor(), and Player::LoadFromDB().

◆ HandleAuraSpecificMods()

void Aura::HandleAuraSpecificMods ( AuraApplication const *  aurApp,
Unit caster,
bool  apply,
bool  onReapply 
)
Todo:
: This should be moved to similar function in spell::hit
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
1217{
1218 Unit* target = aurApp->GetTarget();
1219 AuraRemoveMode removeMode = aurApp->GetRemoveMode();
1220 // handle spell_area table
1221 SpellAreaForAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForAuraMapBounds(GetId());
1222 if (saBounds.first != saBounds.second)
1223 {
1224 uint32 zone, area;
1225 target->GetZoneAndAreaId(zone, area);
1226
1227 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1228 {
1229 // some auras remove at aura remove
1230 if (!itr->second->IsFitToRequirements(target->ToPlayer(), zone, area) && !apply)
1231 target->RemoveAurasDueToSpell(itr->second->spellId);
1232 // some auras applied at aura apply
1233 else if (itr->second->autocast)
1234 {
1235 if (!target->HasAura(itr->second->spellId))
1236 target->CastSpell(target, itr->second->spellId, true);
1237 }
1238 }
1239 }
1240
1241 // handle spell_linked_spell table
1242 if (!onReapply)
1243 {
1244 // apply linked auras
1245 if (apply)
1246 {
1247 if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
1248 {
1249 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1250 {
1251 if (*itr < 0)
1252 target->ApplySpellImmune(GetId(), IMMUNITY_ID, -(*itr), true);
1253 else if (caster)
1254 caster->AddAura(*itr, target);
1255 }
1256 }
1257 }
1258 else
1259 {
1260 // remove linked auras
1261 if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(-(int32)GetId()))
1262 {
1263 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1264 {
1265 if (*itr < 0)
1266 target->RemoveAurasDueToSpell(-(*itr));
1267 else if (removeMode != AURA_REMOVE_BY_DEATH)
1268 target->CastSpell(target, *itr, true, nullptr, nullptr, GetCasterGUID());
1269 }
1270 }
1271 if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
1272 {
1273 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1274 {
1275 if (*itr < 0)
1276 target->ApplySpellImmune(GetId(), IMMUNITY_ID, -(*itr), false);
1277 else
1278 target->RemoveAura(*itr, GetCasterGUID(), 0, removeMode);
1279 }
1280 }
1281 }
1282 }
1283 else if (apply)
1284 {
1285 // modify stack amount of linked auras
1286 if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
1287 {
1288 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1289 if (*itr > 0)
1290 if (Aura* triggeredAura = target->GetAura(*itr, GetCasterGUID()))
1291 triggeredAura->ModStackAmount(GetStackAmount() - triggeredAura->GetStackAmount());
1292 }
1293 }
1294
1295 // mods at aura apply
1296 if (apply)
1297 {
1298 switch (GetSpellInfo()->SpellFamilyName)
1299 {
1301 switch (GetId())
1302 {
1303 case 32474: // Buffeting Winds of Susurrus
1304 if (target->IsPlayer())
1305 target->ToPlayer()->ActivateTaxiPathTo(506, GetId());
1306 break;
1307 case 33572: // Gronn Lord's Grasp, becomes stoned
1308 if (GetStackAmount() >= 5 && !target->HasAura(33652))
1309 target->CastSpell(target, 33652, true);
1310 break;
1311 case 50836: //Petrifying Grip, becomes stoned
1312 if (GetStackAmount() >= 5 && !target->HasAura(50812))
1313 target->CastSpell(target, 50812, true);
1314 break;
1315 case 60970: // Heroic Fury (remove Intercept cooldown)
1316 if (target->IsPlayer())
1317 target->ToPlayer()->RemoveSpellCooldown(20252, true);
1318 break;
1319 }
1320 break;
1321 case SPELLFAMILY_MAGE:
1322 if (!caster)
1323 break;
1324 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000001 && GetSpellInfo()->SpellFamilyFlags[2] & 0x00000008)
1325 {
1326 // Glyph of Fireball
1327 if (caster->HasAura(56368))
1328 SetDuration(0);
1329 }
1330 else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000020 && GetSpellInfo()->SpellVisual[0] == 13)
1331 {
1332 // Glyph of Frostbolt
1333 if (caster->HasAura(56370))
1334 SetDuration(0);
1335 }
1337 else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x01000000)
1338 {
1339 // Polymorph Sound - Sheep && Penguin
1340 if (GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978)
1341 {
1342 // Glyph of the Penguin
1343 if (caster->HasAura(52648))
1344 caster->CastSpell(target, 61635, true);
1345 else
1346 caster->CastSpell(target, 61634, true);
1347 }
1348
1349 if (Creature* creatureTarget = target->ToCreature())
1350 {
1351 creatureTarget->CallAssistance(caster);
1352 }
1353 }
1354 switch (GetId())
1355 {
1356 case 44544: // Fingers of Frost
1357 {
1358 // See if we already have the indicator aura. If not, create one.
1359 if (Aura* aur = target->GetAura(74396))
1360 {
1361 // Aura already there. Refresh duration and set original charges
1362 aur->SetCharges(2);
1363 aur->RefreshDuration();
1364 }
1365 else
1366 target->AddAura(74396, target);
1367 }
1368 break;
1369 case 12494: // Frostbite, synchronise with Fingers of Frost
1370 {
1371 // Find Fingers of Frost
1373 {
1374 if (SpellInfo const* triggeringSpellInfo = GetTriggeredByAuraSpellInfo())
1375 {
1376 uint8 fbRank = sSpellMgr->GetSpellRank(triggeringSpellInfo->Id);
1377 uint8 fofRank = sSpellMgr->GetSpellRank(aurEff->GetId());
1378 uint8 chance = uint8(std::ceil(fofRank * fbRank * 16.6f));
1379
1380 if (roll_chance_i(chance))
1381 {
1382 caster->CastSpell(caster, aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true);
1383 }
1384 }
1385 }
1386 break;
1387 }
1388 default:
1389 break;
1390 }
1391 break;
1392 case SPELLFAMILY_DRUID:
1393 if (!caster)
1394 break;
1395 // Rejuvenation
1396 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x10 && GetEffect(0))
1397 {
1398 // Druid T8 Restoration 4P Bonus
1399 if (caster->GetAuraEffectDummy(64760))
1400 {
1401 uint32 damage = GetEffect(0)->GetAmount();
1402 damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT);
1403
1404 int32 basepoints0 = damage;
1405 caster->CastCustomSpell(target, 64801, &basepoints0, nullptr, nullptr, true, nullptr, GetEffect(0));
1406 }
1407 }
1408 break;
1409 case SPELLFAMILY_PRIEST:
1410 if (!caster)
1411 break;
1412 // Devouring Plague
1413 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x02000000 && GetEffect(0))
1414 {
1415 // Improved Devouring Plague
1416 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 1))
1417 {
1418 uint32 damage = GetEffect(0)->GetAmount();
1419 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
1420 int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100;
1421 int32 heal = int32(CalculatePct(basepoints0, 15));
1422
1423 caster->CastCustomSpell(target, 63675, &basepoints0, nullptr, nullptr, true, nullptr, GetEffect(0));
1424 caster->CastCustomSpell(caster, 75999, &heal, nullptr, nullptr, true, nullptr, GetEffect(0));
1425 }
1426 }
1427 // Power Word: Shield
1428 else if (m_spellInfo->SpellFamilyFlags[0] & 0x1 && m_spellInfo->SpellFamilyFlags[2] & 0x400 && GetEffect(0))
1429 {
1430 // Glyph of Power Word: Shield
1431 if (AuraEffect* glyph = caster->GetAuraEffect(55672, 0))
1432 {
1433 // instantly heal m_amount% of the absorb-value
1434 int32 heal = glyph->GetAmount() * GetEffect(0)->GetAmount() / 100;
1435 caster->CastCustomSpell(GetUnitOwner(), 56160, &heal, nullptr, nullptr, true, 0, GetEffect(0));
1436 }
1437 }
1438 break;
1439 case SPELLFAMILY_ROGUE:
1440 // Sprint (skip non player casted spells by category)
1441 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x40 && GetSpellInfo()->GetCategory() == 44)
1442 // in official maybe there is only one icon?
1443 if (target->HasAura(58039)) // Glyph of Blurred Speed
1444 target->CastSpell(target, 61922, true); // Sprint (waterwalk)
1445 break;
1446 case SPELLFAMILY_SHAMAN:
1447 {
1448 // Ghost Wolf Speed (PvP 58 lvl set)
1449 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000800 && target->HasAura(22801) && target->GetLevel() <= 60)
1450 {
1451 int32 bp0 = 15;
1452 target->CastCustomSpell(target, 47017, &bp0, 0, 0, true);
1453 }
1454 break;
1455 }
1457 if (!caster)
1458 break;
1459 // Frost Fever and Blood Plague
1460 if (GetSpellInfo()->SpellFamilyFlags[2] & 0x2)
1461 {
1462 // Can't proc on self
1463 if (GetCasterGUID() == target->GetGUID())
1464 break;
1465
1466 AuraEffect* aurEff = nullptr;
1467 // Ebon Plaguebringer / Crypt Fever
1469 for (Unit::AuraEffectList::const_iterator itr = TalentAuras.begin(); itr != TalentAuras.end(); ++itr)
1470 {
1471 if ((*itr)->GetMiscValue() == 7282)
1472 {
1473 aurEff = *itr;
1474 // Ebon Plaguebringer - end search if found
1475 if ((*itr)->GetSpellInfo()->SpellIconID == 1766)
1476 break;
1477 }
1478 }
1479 if (aurEff)
1480 {
1481 uint32 spellId = 0;
1482 switch (aurEff->GetId())
1483 {
1484 // Ebon Plague
1485 case 51161:
1486 spellId = 51735;
1487 break;
1488 case 51160:
1489 spellId = 51734;
1490 break;
1491 case 51099:
1492 spellId = 51726;
1493 break;
1494 // Crypt Fever
1495 case 49632:
1496 spellId = 50510;
1497 break;
1498 case 49631:
1499 spellId = 50509;
1500 break;
1501 case 49032:
1502 spellId = 50508;
1503 break;
1504 default:
1505 LOG_ERROR("spells.aura", "Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague ({}) found", aurEff->GetId());
1506 }
1507 caster->CastSpell(target, spellId, true, 0, GetEffect(0));
1508 }
1509 }
1510 // Unholy blight
1511 if (GetId() == 50536)
1512 {
1513 if (caster->IsFriendlyTo(target))
1514 SetDuration(0);
1515 }
1516 break;
1517 case SPELLFAMILY_POTION:
1518 // Alchemy: Mixology
1519 if (caster && caster->HasAura(53042) && caster->IsPlayer() && !caster->ToPlayer()->GetSession()->PlayerLoading())
1520 {
1521 if (sSpellMgr->IsSpellMemberOfSpellGroup(GetId(), SPELL_GROUP_ELIXIR_BATTLE) || sSpellMgr->IsSpellMemberOfSpellGroup(GetId(), SPELL_GROUP_ELIXIR_GUARDIAN))
1522 {
1523 if (caster->HasSpell(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell))
1524 {
1525 for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
1526 if (GetEffect(i))
1527 GetEffect(i)->SetAmount(CalculatePct(GetEffect(i)->GetAmount(), 100 + sSpellMgr->GetSpellMixologyBonus(GetId())));
1528
1531 }
1532 }
1533 }
1534 break;
1535 }
1536 }
1537 // mods at aura remove
1538 else
1539 {
1540 switch (GetSpellInfo()->SpellFamilyName)
1541 {
1543 if (!caster)
1544 break;
1545 switch (GetId())
1546 {
1547 case 61987: // Avenging Wrath
1548 // Remove the immunity shield marker on Avenging Wrath removal if Forbearance is not present
1549 if (target->HasAura(61988) && !target->HasAura(25771))
1550 target->RemoveAura(61988);
1551 break;
1552 case 72368: // Shared Suffering
1553 case 72369:
1554 if (AuraEffect* aurEff = GetEffect(0))
1555 {
1556 int32 remainingDamage = aurEff->GetAmount() * (aurEff->GetTotalTicks() - aurEff->GetTickNumber());
1557 if (remainingDamage > 0)
1558 caster->CastCustomSpell(caster, 72373, nullptr, &remainingDamage, nullptr, true);
1559 }
1560 break;
1561 }
1562 break;
1563 case SPELLFAMILY_MAGE:
1564 {
1565 // Polymorph
1566 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x01000000)
1567 {
1568 if (Creature* creatureTarget = target->ToCreature())
1569 {
1570 creatureTarget->SetNoCallAssistance(false);
1571 }
1572 }
1573 switch (GetId())
1574 {
1575 case 66: // Invisibility
1576 if (removeMode != AURA_REMOVE_BY_EXPIRE)
1577 break;
1578 target->CastSpell(target, 32612, true, nullptr, GetEffect(1));
1579 target->CombatStop();
1580 break;
1581 case 74396: // Fingers of Frost
1582 // Remove the IGNORE_AURASTATE aura
1583 target->RemoveAurasDueToSpell(44544);
1584 break;
1585 case 44401: // Missile Barrage
1586 case 48108: // Hot Streak
1587 case 57761: // Fireball!
1588 if (removeMode != AURA_REMOVE_BY_EXPIRE || aurApp->GetBase()->IsExpired())
1589 break;
1590 if (target->HasAura(70752)) // Item - Mage T10 2P Bonus
1591 target->CastSpell(target, 70753, true); // Pushing the Limit
1592 break;
1593 default:
1594 break;
1595 }
1596 if (!caster)
1597 break;
1598 // Ice barrier - dispel/absorb remove
1599 if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[1] & 0x1)
1600 {
1601 // Shattered Barrier
1602 if (AuraEffect* absorb = GetEffect(EFFECT_0))
1603 if (absorb->GetAmount() <= 0) // removed by damage, not dispel
1604 if (AuraEffect* dummy = caster->GetDummyAuraEffect(SPELLFAMILY_MAGE, 2945, 0))
1605 if (roll_chance_i(dummy->GetSpellInfo()->ProcChance))
1606 caster->CastSpell(target, 55080, true, nullptr, GetEffect(0));
1607 }
1608 break;
1609 }
1611 if (!caster)
1612 break;
1613 [[fallthrough]];
1615 if (!caster)
1616 break;
1617 if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400)
1618 {
1619 if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_WARLOCK, 98, 0))
1620 {
1621 uint32 spellId = 0;
1622 switch (aurEff->GetId())
1623 {
1624 case 53759:
1625 spellId = 60947;
1626 break;
1627 case 53754:
1628 spellId = 60946;
1629 break;
1630 default:
1631 LOG_ERROR("spells.aura", "Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear ({}) found", aurEff->GetId());
1632 }
1633 if (spellId)
1634 caster->CastSpell(target, spellId, true);
1635 }
1636 }
1637 break;
1638 case SPELLFAMILY_PRIEST:
1639 if (!caster)
1640 break;
1641 // Shadow word: Pain // Vampiric Touch
1642 if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00008000 || GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400))
1643 {
1644 // Shadow Affinity
1645 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 178, 1))
1646 {
1647 int32 basepoints0 = aurEff->GetAmount() * caster->GetCreateMana() / 100;
1648 caster->CastCustomSpell(caster, 64103, &basepoints0, nullptr, nullptr, true, nullptr, GetEffect(0));
1649 }
1650 }
1651 // Power word: shield
1652 else if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[0] & 0x00000001)
1653 {
1654 // Rapture
1655 if (Aura const* aura = caster->GetAuraOfRankedSpell(47535))
1656 {
1657 // check cooldown
1658 if (caster->IsPlayer())
1659 {
1660 if (caster->ToPlayer()->HasSpellCooldown(aura->GetId()))
1661 {
1662 // This additional check is needed to add a minimal delay before cooldown in in effect
1663 // to allow all bubbles broken by a single damage source proc mana return
1664 if (caster->ToPlayer()->GetSpellCooldownDelay(aura->GetId()) <= 11500)
1665 break;
1666 }
1667 else // and add if needed
1668 caster->ToPlayer()->AddSpellCooldown(aura->GetId(), 0, 12 * IN_MILLISECONDS);
1669 }
1670
1671 // effect on caster
1672 if (AuraEffect const* aurEff = aura->GetEffect(0))
1673 {
1674 float multiplier = (float)aurEff->GetAmount();
1675 if (aurEff->GetId() == 47535)
1676 multiplier -= 0.5f;
1677 else if (aurEff->GetId() == 47537)
1678 multiplier += 0.5f;
1679
1680 int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier));
1681 caster->CastCustomSpell(caster, 47755, &basepoints0, nullptr, nullptr, true);
1682 }
1683 // effect on aura target
1684 if (AuraEffect const* aurEff = aura->GetEffect(1))
1685 {
1686 if (!roll_chance_i(aurEff->GetAmount()))
1687 break;
1688
1689 int32 triggeredSpellId = 0;
1690 switch (target->getPowerType())
1691 {
1692 case POWER_MANA:
1693 {
1694 int32 basepoints0 = int32(CalculatePct(target->GetMaxPower(POWER_MANA), 2));
1695 caster->CastCustomSpell(target, 63654, &basepoints0, nullptr, nullptr, true);
1696 break;
1697 }
1698 case POWER_RAGE:
1699 triggeredSpellId = 63653;
1700 break;
1701 case POWER_ENERGY:
1702 triggeredSpellId = (!target->HasAura(70405) ? 63655 : 0);
1703 break;
1704 case POWER_RUNIC_POWER:
1705 triggeredSpellId = 63652;
1706 break;
1707 default:
1708 break;
1709 }
1710 if (triggeredSpellId)
1711 caster->CastSpell(target, triggeredSpellId, true);
1712 }
1713 }
1714 }
1715 switch (GetId())
1716 {
1717 case 47788: // Guardian Spirit
1718 {
1719 if (removeMode != AURA_REMOVE_BY_EXPIRE)
1720 break;
1721 if (!caster->IsPlayer())
1722 break;
1723
1724 Player* player = caster->ToPlayer();
1725 // Glyph of Guardian Spirit
1726 if (AuraEffect* aurEff = player->GetAuraEffect(63231, 0))
1727 {
1728 if (!player->HasSpellCooldown(47788))
1729 break;
1730
1731 player->AddSpellCooldown(GetSpellInfo()->Id, 0, aurEff->GetAmount()*IN_MILLISECONDS);
1732
1733 WorldPacket data(SMSG_MODIFY_COOLDOWN, 4 + 8 + 4);
1734 data << uint32(GetId()); // Spell ID
1735 data << player->GetGUID(); // Player GUID
1736 data << int32(-110000); // Cooldown mod in milliseconds
1737 player->SendDirectMessage(&data);
1738 }
1739 break;
1740 }
1741 case 47585: // Dispersion (fixed bug invisible as a Shadow Priest)
1742 {
1743 if (target->IsMounted())
1744 {
1745 target->CastSpell(target, 53444, true);
1746 }
1747 break;
1748 }
1749 }
1750 break;
1751 case SPELLFAMILY_ROGUE:
1752 // Remove Vanish on stealth remove
1753 if (GetId() == 1784)
1754 {
1756 target->RemoveAurasDueToSpell(18461);
1757 }
1758 break;
1759 case SPELLFAMILY_SHAMAN:
1760 {
1761 // Ghost Wolf Speed (PvP 58 lvl set)
1762 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000800)
1763 {
1764 target->RemoveAurasDueToSpell(47017);
1765 }
1766 // Lightning Shield vs The Earthshatterer 8/9 set bonus
1767 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000400)
1768 {
1769 target->RemoveAurasDueToSpell(28820);
1770 }
1771 break;
1772 }
1774 // Blood of the North
1775 // Reaping
1776 // Death Rune Mastery
1777 if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
1778 {
1779 if (!GetEffect(0) || GetEffect(0)->GetAuraType() != SPELL_AURA_PERIODIC_DUMMY)
1780 break;
1781 if (!target->IsPlayer())
1782 break;
1784 break;
1785
1786 // aura removed - remove death runes
1788 }
1789 break;
1791 // Remove the immunity shield marker on Forbearance removal if AW marker is not present
1792 if (GetId() == 25771 && target->HasAura(61988) && !target->HasAura(61987))
1793 target->RemoveAura(61988);
1794 break;
1795 case SPELLFAMILY_HUNTER:
1796 // Glyph of Freezing Trap
1797 if ((GetSpellInfo()->SpellFamilyFlags[0] & 0x00000008) && caster && caster->HasAura(56845))
1798 {
1799 target->CastSpell(target, 61394, true);
1800 }
1801 break;
1802 }
1803 }
1804
1805 // mods at aura apply or remove
1806 switch (GetSpellInfo()->SpellFamilyName)
1807 {
1808 case SPELLFAMILY_ROGUE:
1809 // Stealth
1810 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00400000)
1811 {
1812 // Master of Subtlety
1813 if (AuraEffect const* aurEff = target->GetAuraEffectOfRankedSpell(31221, 0))
1814 {
1815 if (!apply)
1816 target->CastSpell(target, 31666, true);
1817 else
1818 {
1819 // Remove counter aura
1820 target->RemoveAurasDueToSpell(31666);
1821
1822 int32 amount = aurEff->GetAmount();
1823 target->CastCustomSpell(target, 31665, &amount, nullptr, nullptr, true);
1824 }
1825 }
1826 // Overkill
1827 if (target->HasAura(58426))
1828 {
1829 if (!apply)
1830 target->CastSpell(target, 58428, true);
1831 else
1832 {
1833 // Remove counter aura
1834 target->RemoveAurasDueToSpell(58428);
1835
1836 target->CastSpell(target, 58427, true);
1837 }
1838 }
1839 }
1840 break;
1841 case SPELLFAMILY_HUNTER:
1842 switch (GetId())
1843 {
1844 case 19574: // Bestial Wrath
1845 // The Beast Within cast on owner if talent present
1846 if (Unit* owner = target->GetOwner())
1847 {
1848 // Search talent
1849 if (owner->HasAura(34692))
1850 {
1851 if (apply)
1852 owner->CastSpell(owner, 34471, true, 0, GetEffect(0));
1853 else
1854 owner->RemoveAurasDueToSpell(34471);
1855 }
1856 }
1857 break;
1858 case 34026: // Kill Command
1859 // Dungeon Set 3
1860 if (caster->HasAura(37483))
1861 {
1862 if (apply)
1863 {
1864 caster->CastSpell(caster, 37482, true);
1865 }
1866 }
1867 break;
1868 }
1869 break;
1871 switch (GetId())
1872 {
1873 case 31842: // Divine Illumination
1874 // Item - Paladin T10 Holy 2P Bonus
1875 if (caster && caster->HasAura(70755))
1876 {
1877 if (apply)
1878 target->CastSpell(target, 71166, true);
1879 else
1880 target->RemoveAurasDueToSpell(71166);
1881 }
1882 break;
1883 }
1884 break;
1885 }
1886}
bool roll_chance_i(int chance)
Definition Random.h:63
@ EFFECT_0
Definition SharedDefines.h:31
@ POWER_RAGE
Definition SharedDefines.h:258
@ POWER_RUNIC_POWER
Definition SharedDefines.h:263
@ POWER_ENERGY
Definition SharedDefines.h:260
@ POWER_MANA
Definition SharedDefines.h:257
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:131
@ IMMUNITY_ID
Definition SharedDefines.h:1404
@ SPELLFAMILY_PRIEST
Definition SharedDefines.h:3790
@ SPELLFAMILY_WARLOCK
Definition SharedDefines.h:3789
@ SPELLFAMILY_MAGE
Definition SharedDefines.h:3787
@ SPELLFAMILY_GENERIC
Definition SharedDefines.h:3784
@ SPELLFAMILY_WARRIOR
Definition SharedDefines.h:3788
@ SPELLFAMILY_PALADIN
Definition SharedDefines.h:3794
@ SPELLFAMILY_POTION
Definition SharedDefines.h:3797
@ SPELLFAMILY_ROGUE
Definition SharedDefines.h:3792
@ SPELLFAMILY_SHAMAN
Definition SharedDefines.h:3795
@ SPELLFAMILY_DRUID
Definition SharedDefines.h:3791
@ SPELLFAMILY_DEATHKNIGHT
Definition SharedDefines.h:3799
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition SpellAuraDefines.h:105
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
Definition SpellAuraDefines.h:175
AuraRemoveMode
Definition SpellAuraDefines.h:390
@ AURA_REMOVE_BY_DEATH
Definition SpellAuraDefines.h:396
@ AURA_REMOVE_BY_EXPIRE
Definition SpellAuraDefines.h:395
@ AURA_REMOVE_BY_ENEMY_SPELL
Definition SpellAuraDefines.h:394
@ SPELL_GROUP_ELIXIR_BATTLE
Definition SpellMgr.h:333
@ SPELL_GROUP_ELIXIR_GUARDIAN
Definition SpellMgr.h:334
std::pair< SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator > SpellAreaForAreaMapBounds
Definition SpellMgr.h:547
@ SPELL_LINK_AURA
Definition SpellMgr.h:101
@ CLASS_CONTEXT_ABILITY
Definition UnitDefines.h:241
@ DOT
Definition Unit.h:257
T CalculatePct(T base, U pct)
Definition Util.h:52
uint32 GetTickNumber() const
Definition SpellAuraEffects.h:87
uint32 GetId() const
Definition SpellAuraEffects.cpp:432
int32 GetTotalTicks() const
Definition SpellAuraEffects.cpp:7064
void SetAmount(int32 amount)
Definition SpellAuraEffects.h:66
int32 GetAmount() const
Definition SpellAuraEffects.h:64
int32 GetMaxDuration() const
Definition SpellAuras.h:129
void SetDuration(int32 duration, bool withMods=false)
Definition SpellAuras.cpp:815
uint8 GetStackAmount() const
Definition SpellAuras.h:148
void SetMaxDuration(int32 duration)
Definition SpellAuras.h:130
SpellInfo const * GetTriggeredByAuraSpellInfo() const
Definition SpellAuras.cpp:2775
Definition Creature.h:47
static ObjectGuid const Empty
Definition ObjectGuid.h:123
void RemoveRunesByAuraEffect(AuraEffect const *aura)
Definition Player.cpp:13694
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5852
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, Creature *npc=nullptr, uint32 spellid=1)
Definition Player.cpp:10400
WorldSession * GetSession() const
Definition Player.h:2030
bool HasSpellCooldown(uint32 spell_id) const override
Definition Player.cpp:16697
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11258
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition Player.cpp:1348
uint32 GetSpellCooldownDelay(uint32 spell_id) const
Definition Player.cpp:16709
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:3683
std::array< uint32, 2 > SpellVisual
Definition SpellInfo.h:403
uint32 SpellIconID
Definition SpellInfo.h:404
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1429
std::vector< AuraEffect * > AuraEffectList
Definition Unit.h:681
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5877
void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
Definition Unit.cpp:5503
Unit * GetOwner() const
Definition Unit.cpp:7746
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:10469
Aura * GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5895
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:5050
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:15137
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1418
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5790
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:6017
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition Unit.cpp:5846
virtual bool HasSpell(uint32) const
Definition Unit.h:1583
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:8941
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1137
AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5804
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1361
bool IsMounted() const
Definition Unit.h:1886
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:5189
bool IsFriendlyTo(Unit const *unit) const
Definition Unit.cpp:7302
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition Unit.h:1438
Powers getPowerType() const
Definition Unit.h:1132
void CombatStop(bool includingCast=false, bool mutualPvP=true)
Definition Unit.cpp:7532
uint32 GetCreateMana() const
Definition Unit.h:1149
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:9705
ObjectGuid GetTarget() const
Definition Unit.h:862
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition Object.cpp:3182
bool PlayerLoading() const
Definition WorldSession.h:427
@ SMSG_MODIFY_COOLDOWN
Definition Opcodes.h:1199
void apply(T *val)
Definition ByteConverter.h:40

References Player::ActivateTaxiPathTo(), Unit::AddAura(), Player::AddSpellCooldown(), Unit::ApplySpellImmune(), AURA_REMOVE_BY_DEATH, AURA_REMOVE_BY_ENEMY_SPELL, AURA_REMOVE_BY_EXPIRE, Unit::CalcSpellDuration(), CalculatePct(), Unit::CastCustomSpell(), Unit::CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, Unit::CombatStop(), DOT, EFFECT_0, ObjectGuid::Empty, AuraEffect::GetAmount(), Unit::GetAura(), Unit::GetAuraEffect(), Unit::GetAuraEffectDummy(), Unit::GetAuraEffectOfRankedSpell(), Unit::GetAuraEffectsByType(), Unit::GetAuraOfRankedSpell(), AuraApplication::GetBase(), GetCasterGUID(), Unit::GetCreateMana(), Unit::GetDummyAuraEffect(), GetEffect(), Object::GetGUID(), AuraEffect::GetId(), GetId(), Unit::GetLevel(), GetMaxDuration(), Unit::GetMaxPower(), Unit::GetOwner(), Unit::getPowerType(), AuraApplication::GetRemoveMode(), Player::GetSession(), Player::GetSpellCooldownDelay(), GetSpellInfo(), GetStackAmount(), AuraApplication::GetTarget(), AuraEffect::GetTotalTicks(), GetTriggeredByAuraSpellInfo(), GetUnitOwner(), WorldObject::GetZoneAndAreaId(), Unit::HasAura(), Unit::HasSpell(), Player::HasSpellCooldown(), SpellInfo::Id, IMMUNITY_ID, IN_MILLISECONDS, Player::IsClass(), IsExpired(), Unit::IsFriendlyTo(), Unit::IsMounted(), Object::IsPlayer(), LOG_ERROR, m_spellInfo, MAX_SPELL_EFFECTS, WorldSession::PlayerLoading(), POWER_ENERGY, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, Unit::RemoveAura(), Unit::RemoveAurasDueToSpell(), Unit::RemoveAurasWithFamily(), Player::RemoveRunesByAuraEffect(), Player::RemoveSpellCooldown(), roll_chance_i(), Player::SendDirectMessage(), AuraEffect::SetAmount(), SetDuration(), SetMaxDuration(), SMSG_MODIFY_COOLDOWN, SPELL_AURA_DUMMY, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DUMMY, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_GROUP_ELIXIR_BATTLE, SPELL_GROUP_ELIXIR_GUARDIAN, SPELL_LINK_AURA, Unit::SpellDamageBonusTaken(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_POTION, SPELLFAMILY_PRIEST, SPELLFAMILY_ROGUE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARLOCK, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, Unit::SpellHealingBonusTaken(), SpellInfo::SpellIconID, SpellInfo::SpellVisual, sSpellMgr, Object::ToCreature(), and Object::ToPlayer().

Referenced by Unit::_ApplyAura(), Unit::_UnapplyAura(), and SetStackAmount().

◆ HasEffect()

◆ HasEffectType()

bool Aura::HasEffectType ( AuraType  type) const
1174{
1175 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1176 {
1177 if (HasEffect(i) && m_effects[i]->GetAuraType() == type)
1178 return true;
1179 }
1180 return false;
1181}
bool HasEffect(uint8 effIndex) const
Definition SpellAuras.h:174

References HasEffect(), m_effects, and MAX_SPELL_EFFECTS.

Referenced by Unit::_AddAura(), Battleground::_ProcessJoin(), CanBeSentToClient(), AuraScript::HasEffectType(), IsSingleTargetWith(), and Unit::RemoveAura().

◆ HasMoreThanOneEffectForType()

bool Aura::HasMoreThanOneEffectForType ( AuraType  auraType) const
1014{
1015 uint32 count = 0;
1016 for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects())
1017 if (HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.ApplyAuraName == auraType)
1018 ++count;
1019
1020 return count > 1;
1021}
Definition SpellInfo.h:270

References SpellInfo::GetEffects(), GetSpellInfo(), and HasEffect().

Referenced by Unit::IsHighestExclusiveAuraEffect().

◆ IsAppliedOnTarget()

bool Aura::IsAppliedOnTarget ( ObjectGuid  guid) const
inline
186{ return m_applications.find(guid) != m_applications.end(); }

References m_applications.

Referenced by _ApplyForTarget(), and Unit::_CreateAuraApplication().

◆ IsArea()

bool Aura::IsArea ( ) const
1024{
1025 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1026 {
1027 if (HasEffect(i) && GetSpellInfo()->Effects[i].IsAreaAuraEffect())
1028 return true;
1029 }
1030 return false;
1031}

References GetSpellInfo(), HasEffect(), and MAX_SPELL_EFFECTS.

Referenced by CanStackWith(), Unit::IsHighestExclusiveAuraEffect(), and UpdateTargetMap().

◆ IsAuraStronger()

bool Aura::IsAuraStronger ( Aura const *  newAura) const
1911{
1912 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
1913 {
1914 AuraEffect* thisEffect = GetEffect(i);
1915 if (!thisEffect)
1916 continue;
1917
1918 AuraEffect* newEffect = nullptr;
1919 for (uint8 j = EFFECT_0; j < MAX_SPELL_EFFECTS; ++j)
1920 {
1921 newEffect = newAura->GetEffect(j);
1922 if (!newEffect || thisEffect->GetAuraType() != newEffect->GetAuraType() || thisEffect->GetMiscValue() != newEffect->GetMiscValue())
1923 continue;
1924
1925 // xinef: assume that all spells are either positive or negative, otherwise they should not be in one group
1926 int32 curValue = std::abs(thisEffect->GetAmount());
1927 if (curValue < std::abs(newEffect->GetAmount()))
1928 return true;
1929
1930 if (curValue == std::abs(newEffect->GetAmount()))
1931 if (!IsPassive() && !IsPermanent() && GetDuration() < newAura->GetDuration())
1932 return true;
1933 }
1934 }
1935
1936 return false;
1937}
AuraType GetAuraType() const
Definition SpellAuraEffects.cpp:447
int32 GetMiscValue() const
Definition SpellAuraEffects.cpp:442
int32 GetDuration() const
Definition SpellAuras.h:133
bool IsPermanent() const
Definition SpellAuras.h:139

References EFFECT_0, AuraEffect::GetAmount(), AuraEffect::GetAuraType(), GetDuration(), GetEffect(), AuraEffect::GetMiscValue(), IsPassive(), IsPermanent(), and MAX_SPELL_EFFECTS.

◆ IsDeathPersistent()

bool Aura::IsDeathPersistent ( ) const
1039{
1040 return GetSpellInfo()->IsDeathPersistent();
1041}
bool IsDeathPersistent() const
Definition SpellInfo.cpp:1249

References GetSpellInfo(), and SpellInfo::IsDeathPersistent().

Referenced by AuraScript::IsDeathPersistent(), and Unit::RemoveAllAurasOnDeath().

◆ IsExpired()

bool Aura::IsExpired ( ) const
inline

◆ IsPassive()

◆ IsPermanent()

◆ IsProcOnCooldown()

bool Aura::IsProcOnCooldown ( TimePoint  now) const
2089{
2090 if (GetType() == UNIT_AURA_TYPE)
2091 if (Player* player = GetUnitOwner()->ToPlayer())
2092 if (player->GetCommandStatus(CHEAT_COOLDOWN))
2093 return false;
2094
2095 return m_procCooldown > now;
2096}
@ CHEAT_COOLDOWN
Definition Player.h:999

References CHEAT_COOLDOWN, GetType(), GetUnitOwner(), m_procCooldown, and UNIT_AURA_TYPE.

Referenced by GetProcEffectMask().

◆ IsRemoved()

◆ IsRemovedOnShapeLost()

bool Aura::IsRemovedOnShapeLost ( Unit target) const

◆ IsSingleTarget()

◆ IsSingleTargetWith()

bool Aura::IsSingleTargetWith ( Aura const *  aura) const
1094{
1095 // Same spell?
1096 if (GetSpellInfo()->IsRankOf(aura->GetSpellInfo()))
1097 return true;
1098
1100 // spell with single target specific types
1101 switch (spec)
1102 {
1105 if (aura->GetSpellInfo()->GetSpellSpecific() == spec)
1106 return true;
1107 break;
1108 default:
1109 break;
1110 }
1111
1113 return true;
1114
1115 return false;
1116}
SpellSpecificType
Definition SpellInfo.h:150
@ SPELL_SPECIFIC_JUDGEMENT
Definition SpellInfo.h:162
@ SPELL_SPECIFIC_MAGE_POLYMORPH
Definition SpellInfo.h:161
SpellSpecificType GetSpellSpecific() const
Definition SpellInfo.cpp:2049

References GetSpellInfo(), SpellInfo::GetSpellSpecific(), HasEffectType(), SPELL_AURA_CONTROL_VEHICLE, SPELL_SPECIFIC_JUDGEMENT, and SPELL_SPECIFIC_MAGE_POLYMORPH.

Referenced by Unit::_AddAura().

◆ IsUsingCharges()

◆ LoadScripts()

void Aura::LoadScripts ( )
2354{
2355 sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts);
2356 for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();)
2357 {
2358 if (!(*itr)->_Load(this))
2359 {
2360 std::list<AuraScript*>::iterator bitr = itr;
2361 ++itr;
2362 delete (*bitr);
2363 m_loadedScripts.erase(bitr);
2364 continue;
2365 }
2366 LOG_DEBUG("spells.aura", "Aura::LoadScripts: Script `{}` for aura `{}` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id);
2367 (*itr)->Register();
2368 ++itr;
2369 }
2370}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:157

References SpellInfo::Id, LOG_DEBUG, m_loadedScripts, m_spellInfo, and sScriptMgr.

Referenced by DynObjAura::DynObjAura(), and UnitAura::UnitAura().

◆ ModCharges()

bool Aura::ModCharges ( int32  num,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
921{
922 if (IsUsingCharges())
923 {
924 int32 charges = m_procCharges + num;
925 int32 maxCharges = CalcMaxCharges();
926
927 // limit charges (only on charges increase, charges may be changed manually)
928 if ((num > 0) && (charges > int32(maxCharges)))
929 charges = maxCharges;
930 // we're out of charges, remove
931 else if (charges <= 0)
932 {
933 Remove(removeMode);
934 return true;
935 }
936
937 SetCharges(charges);
938 }
939 return false;
940}
void SetCharges(uint8 charges)
Definition SpellAuras.cpp:899

References CalcMaxCharges(), IsUsingCharges(), m_procCharges, Remove(), and SetCharges().

Referenced by DropCharge(), AuraScript::ModCharges(), Unit::RemoveAurasDueToSpellByDispel(), and Unit::RemoveAurasDueToSpellBySteal().

◆ ModStackAmount()

bool Aura::ModStackAmount ( int32  num,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT,
bool  periodicReset = false 
)
969{
970 int32 stackAmount = m_stackAmount + num;
971
972 // limit the stack amount (only on stack increase, stack amount may be changed manually)
973 if ((num > 0) && (stackAmount > int32(m_spellInfo->StackAmount)))
974 {
975 // not stackable aura - set stack amount to 1
977 stackAmount = 1;
978 else
979 stackAmount = m_spellInfo->StackAmount;
980 }
981 // we're out of stacks, remove
982 else if (stackAmount <= 0)
983 {
984 Remove(removeMode);
985 return true;
986 }
987
988 bool refresh = stackAmount >= GetStackAmount() && (m_spellInfo->StackAmount || !m_spellInfo->HasAttribute(SPELL_ATTR1_AURA_UNIQUE));
989
990 // Update stack amount
991 if (refresh)
992 {
994 RefreshTimers(periodicReset);
995
996 // reset charges
998 }
999
1000 SetStackAmount(stackAmount);
1001
1003 return false;
1004}
@ SPELL_ATTR1_AURA_UNIQUE
Definition SharedDefines.h:418
void SetStackAmount(uint8 num)
Definition SpellAuras.cpp:942
void RefreshTimers(bool periodicReset=false)
Definition SpellAuras.cpp:856
void SetNeedClientUpdateForTargets() const
Definition SpellAuras.cpp:1209
void RefreshSpellMods()
Definition SpellAuras.cpp:1006
uint32 StackAmount
Definition SpellInfo.h:395

References CalcMaxCharges(), GetStackAmount(), SpellInfo::HasAttribute(), m_spellInfo, m_stackAmount, RefreshSpellMods(), RefreshTimers(), Remove(), SetCharges(), SetNeedClientUpdateForTargets(), SetStackAmount(), SPELL_ATTR1_AURA_UNIQUE, and SpellInfo::StackAmount.

Referenced by spell_the_lich_king_necrotic_plague_jump::AddMissingStack(), ConsumeProcCharges(), Spell::DoSpellHitOnUnit(), misc_commandscript::HandleAuraStacksCommand(), spell_charge_shield_bomber::HandleDummy(), spell_freya_attuned_to_nature_dose_reduction::HandleScript(), AuraScript::ModStackAmount(), Unit::RemoveAuraFromStack(), Unit::RemoveAurasDueToSpellByDispel(), and Unit::RemoveAurasDueToSpellBySteal().

◆ PrepareProcToTrigger()

void Aura::PrepareProcToTrigger ( AuraApplication aurApp,
ProcEventInfo eventInfo,
TimePoint  now 
)
2114{
2115 bool prepare = CallScriptPrepareProcHandlers(aurApp, eventInfo);
2116 if (!prepare)
2117 return;
2118
2119 // take one charge, aura expiration will be handled in Aura::TriggerProcOnEvent (if needed)
2121 {
2122 --m_procCharges;
2124 }
2125
2126 SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId());
2127
2128 ASSERT(procEntry);
2129
2130 // cooldowns should be added to the whole aura (see 51698 area aura)
2131 AddProcCooldown(now + procEntry->Cooldown);
2132}
@ SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES
Definition SharedDefines.h:597
bool CallScriptPrepareProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2679
Milliseconds Cooldown
Definition SpellMgr.h:298

References AddProcCooldown(), ASSERT, CallScriptPrepareProcHandlers(), SpellProcEntry::Cooldown, GetId(), ProcEventInfo::GetSpellInfo(), SpellInfo::HasAttribute(), IsUsingCharges(), m_procCharges, SetNeedClientUpdateForTargets(), SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES, and sSpellMgr.

◆ RecalculateAmountOfEffects()

void Aura::RecalculateAmountOfEffects ( )
1184{
1185 ASSERT (!IsRemoved());
1186 Unit* caster = GetCaster();
1187 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1188 if (HasEffect(i))
1189 m_effects[i]->RecalculateAmount(caster);
1190}
void RecalculateAmount()
Definition SpellAuraEffects.h:76

References ASSERT, GetCaster(), HasEffect(), IsRemoved(), m_effects, MAX_SPELL_EFFECTS, and AuraEffect::RecalculateAmount().

◆ RefreshDuration()

void Aura::RefreshDuration ( bool  withMods = false)
Todo:
  • Look to convert to std::chrono
828{
829 Unit* caster = GetCaster();
830
831 if (!caster)
832 return;
833
834 if (withMods && caster)
835 {
836 int32 duration = m_spellInfo->GetMaxDuration();
837 // Calculate duration of periodics affected by haste.
839 duration = int32(duration * caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
840 SetMaxDuration(duration);
841
842 SetDuration(duration);
843 }
844 else
846
849
850 // also reset periodic counters
851 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
852 if (AuraEffect* aurEff = m_effects[i])
853 aurEff->ResetTicks();
854}
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition SharedDefines.h:568
@ SPELL_AURA_PERIODIC_HASTE
Definition SpellAuraDefines.h:379
@ UNIT_MOD_CAST_SPEED
Definition UpdateFields.h:137
float GetFloatValue(uint16 index) const
Definition Object.cpp:310
int32 GetMaxDuration() const
Definition SpellInfo.cpp:2745
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition Unit.cpp:6057

References GetCaster(), Object::GetFloatValue(), GetMaxDuration(), SpellInfo::GetMaxDuration(), SpellInfo::HasAttribute(), Unit::HasAuraTypeWithAffectMask(), IN_MILLISECONDS, m_effects, m_spellInfo, m_timeCla, SpellInfo::ManaPerSecond, SpellInfo::ManaPerSecondPerLevel, MAX_SPELL_EFFECTS, SetDuration(), SetMaxDuration(), SPELL_ATTR2_NO_TARGET_PER_SECOND_COST, SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC, SPELL_AURA_PERIODIC_HASTE, and UNIT_MOD_CAST_SPEED.

Referenced by spell_hun_chimera_shot::HandleScriptEffect(), boss_shirrak_the_dead_watcher::JustEngagedWith(), AuraScript::RefreshDuration(), RefreshTimers(), RefreshTimersWithMods(), and AuraEffect::UpdatePeriodic().

◆ RefreshSpellMods()

void Aura::RefreshSpellMods ( )
1007{
1008 for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1009 if (Player* player = appIter->second->GetTarget()->ToPlayer())
1010 player->RestoreAllSpellMods(0, this);
1011}

References Unit::GetTarget(), and m_applications.

Referenced by ModStackAmount().

◆ RefreshTimers()

void Aura::RefreshTimers ( bool  periodicReset = false)
857{
860 Unit* caster = GetCaster();
861
862 if (!caster)
863 {
864 return;
865 }
866
867 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
868 {
869 if (AuraEffect* aurEff = m_effects[i])
870 {
871 aurEff->CalculatePeriodic(caster, periodicReset, false);
872 aurEff->CalculatePeriodicData();
873 }
874 }
875}
void RefreshDuration(bool withMods=false)
Definition SpellAuras.cpp:827

References CalcMaxDuration(), GetCaster(), m_effects, m_maxDuration, MAX_SPELL_EFFECTS, and RefreshDuration().

Referenced by ModStackAmount().

◆ RefreshTimersWithMods()

void Aura::RefreshTimersWithMods ( )
879{
880 Unit* caster = GetCaster();
883 {
885 }
886
887 // xinef: we should take ModSpellDuration into account, but none of the spells using this function is affected by contents of ModSpellDuration
889
890 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
891 {
892 if (AuraEffect* aurEff = m_effects[i])
893 {
894 aurEff->CalculatePeriodic(caster, false, false);
895 }
896 }
897}

References CalcMaxDuration(), GetCaster(), Object::GetFloatValue(), SpellInfo::HasAttribute(), Unit::HasAuraTypeWithAffectMask(), m_effects, m_maxDuration, m_spellInfo, MAX_SPELL_EFFECTS, RefreshDuration(), SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC, SPELL_AURA_PERIODIC_HASTE, and UNIT_MOD_CAST_SPEED.

◆ Remove()

◆ ResetProcCooldown()

void Aura::ResetProcCooldown ( )
2109{
2110 m_procCooldown = std::chrono::steady_clock::now();
2111}

References m_procCooldown.

◆ SetCharges()

◆ SetDuration()

◆ SetIsSingleTarget()

void Aura::SetIsSingleTarget ( bool  val)
inline

◆ SetLoadedState()

void Aura::SetLoadedState ( int32  maxduration,
int32  duration,
int32  charges,
uint8  stackamount,
uint8  recalculateMask,
int32 amount 
)
1155{
1156 m_maxDuration = maxduration;
1157 m_duration = duration;
1158 m_procCharges = charges;
1160 m_stackAmount = stackamount;
1161 Unit* caster = GetCaster();
1162 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1163 if (m_effects[i])
1164 {
1165 m_effects[i]->SetAmount(amount[i]);
1166 m_effects[i]->SetCanBeRecalculated(recalculateMask & (1 << i));
1167 m_effects[i]->CalculatePeriodic(caster, false, true);
1169 m_effects[i]->RecalculateAmount(caster);
1170 }
1171}
void CalculatePeriodic(Unit *caster, bool create=false, bool load=false)
Definition SpellAuraEffects.cpp:599
void CalculateSpellMod()
Definition SpellAuraEffects.cpp:690
void SetCanBeRecalculated(bool val)
Definition SpellAuraEffects.h:79

References AuraEffect::CalculatePeriodic(), AuraEffect::CalculateSpellMod(), GetCaster(), m_duration, m_effects, m_isUsingCharges, m_maxDuration, m_procCharges, m_stackAmount, MAX_SPELL_EFFECTS, AuraEffect::RecalculateAmount(), AuraEffect::SetAmount(), and AuraEffect::SetCanBeRecalculated().

◆ SetMaxDuration()

◆ SetNeedClientUpdateForTargets()

void Aura::SetNeedClientUpdateForTargets ( ) const
1210{
1211 for (ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1212 appIter->second->SetNeedClientUpdate();
1213}

References m_applications.

Referenced by Unit::DelayOwnedAuras(), ModStackAmount(), PrepareProcToTrigger(), SetCharges(), SetDuration(), and SetStackAmount().

◆ SetStackAmount()

void Aura::SetStackAmount ( uint8  num)
943{
944 m_stackAmount = stackAmount;
945 Unit* caster = GetCaster();
946
947 if (!caster)
948 return;
949
950 std::list<AuraApplication*> applications;
951 GetApplicationList(applications);
952
953 for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
954 if (!(*apptItr)->GetRemoveMode())
955 HandleAuraSpecificMods(*apptItr, caster, false, true);
956
957 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
958 if (HasEffect(i))
959 m_effects[i]->ChangeAmount(m_effects[i]->CalculateAmount(caster), false, true);
960
961 for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
962 if (!(*apptItr)->GetRemoveMode())
963 HandleAuraSpecificMods(*apptItr, caster, true, true);
964
966}
void GetApplicationList(std::list< AuraApplication * > &applicationList) const
Definition SpellAuras.cpp:1200
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
Definition SpellAuras.cpp:1216

References GetApplicationList(), GetCaster(), HandleAuraSpecificMods(), HasEffect(), m_effects, m_stackAmount, MAX_SPELL_EFFECTS, and SetNeedClientUpdateForTargets().

Referenced by Spell::DoSpellHitOnUnit(), AuraEffect::HandleAuraDummy(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_rotface_large_ooze_combine::HandleScript(), boss_shirrak_the_dead_watcher::JustEngagedWith(), ModStackAmount(), Unit::SetAuraStack(), and AuraScript::SetStackAmount().

◆ SetTriggeredByAuraSpellInfo()

void Aura::SetTriggeredByAuraSpellInfo ( SpellInfo const *  triggeredByAuraSpellInfo)
2762{
2763 m_triggeredByAuraSpellInfo = triggeredByAuraSpellInfo;
2764}

References m_triggeredByAuraSpellInfo.

Referenced by Spell::DoSpellHitOnUnit(), and Spell::EffectPersistentAA().

◆ SetUsingCharges()

void Aura::SetUsingCharges ( bool  val)
inline

◆ TriggerProcOnEvent()

void Aura::TriggerProcOnEvent ( uint8  procEffectMask,
AuraApplication aurApp,
ProcEventInfo eventInfo 
)
2310{
2311 bool prevented = CallScriptProcHandlers(aurApp, eventInfo);
2312 if (!prevented)
2313 {
2314 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2315 {
2316 if (!(procEffectMask & (1 << i)))
2317 continue;
2318
2319 // OnEffectProc / AfterEffectProc hooks handled in AuraEffect::HandleProc()
2320 if (aurApp->HasEffect(i))
2321 GetEffect(i)->HandleProc(aurApp, eventInfo);
2322 }
2323
2324 CallScriptAfterProcHandlers(aurApp, eventInfo);
2325 }
2326
2327 ConsumeProcCharges(sSpellMgr->GetSpellProcEntry(GetId()));
2328}
bool HasEffect(uint8 effect) const
Definition SpellAuras.h:67
void HandleProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:1285
void CallScriptAfterProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2715
void ConsumeProcCharges(SpellProcEntry const *procEntry)
Definition SpellAuras.cpp:2330
bool CallScriptProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2698

References CallScriptAfterProcHandlers(), CallScriptProcHandlers(), ConsumeProcCharges(), GetEffect(), GetId(), AuraEffect::HandleProc(), AuraApplication::HasEffect(), MAX_SPELL_EFFECTS, and sSpellMgr.

◆ TryCreate()

Aura * Aura::TryCreate ( SpellInfo const *  spellproto,
uint8  effMask,
WorldObject owner,
Unit caster,
int32 baseAmount = nullptr,
Item castItem = nullptr,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemGUID = ObjectGuid::Empty 
)
static
297{
298 ASSERT_NODEBUGINFO(spellproto);
299 ASSERT_NODEBUGINFO(owner);
300 ASSERT_NODEBUGINFO(caster || casterGUID);
301 ASSERT_NODEBUGINFO(tryEffMask <= MAX_EFFECT_MASK);
302 uint8 effMask = Aura::BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
303 if (!effMask)
304 return nullptr;
305 return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID, itemGUID);
306}
static uint8 BuildEffectMaskForOwner(SpellInfo const *spellProto, uint8 avalibleEffectMask, WorldObject *owner)
Definition SpellAuras.cpp:242
static Aura * Create(SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, ObjectGuid itemGUID=ObjectGuid::Empty)
Definition SpellAuras.cpp:308

References ASSERT_NODEBUGINFO, BuildEffectMaskForOwner(), Create(), and MAX_EFFECT_MASK.

Referenced by Pet::_LoadAuras(), Player::_LoadAuras(), Spell::EffectPersistentAA(), and Unit::RemoveAurasDueToSpellByDispel().

◆ TryRefreshStackOrCreate()

Aura * Aura::TryRefreshStackOrCreate ( 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
271{
272 ASSERT_NODEBUGINFO(spellproto);
273 ASSERT_NODEBUGINFO(owner);
274 ASSERT_NODEBUGINFO(caster || casterGUID);
275 ASSERT_NODEBUGINFO(tryEffMask <= MAX_EFFECT_MASK);
276 if (refresh)
277 *refresh = false;
278 uint8 effMask = Aura::BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
279 if (!effMask)
280 return nullptr;
281 if (Aura* foundAura = owner->ToUnit()->_TryStackingOrRefreshingExistingAura(spellproto, effMask, caster, baseAmount, castItem, casterGUID, periodicReset))
282 {
283 // we've here aura, which script triggered removal after modding stack amount
284 // check the state here, so we won't create new Aura object
285 if (foundAura->IsRemoved())
286 return nullptr;
287
288 if (refresh)
289 *refresh = true;
290 return foundAura;
291 }
292 else
293 return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
294}
Aura * _TryStackingOrRefreshingExistingAura(SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool periodicReset=false)
Definition Unit.cpp:4639

References Unit::_TryStackingOrRefreshingExistingAura(), ASSERT_NODEBUGINFO, BuildEffectMaskForOwner(), Create(), MAX_EFFECT_MASK, and Object::ToUnit().

Referenced by Unit::AddAura(), Spell::DoSpellHitOnUnit(), misc_commandscript::HandleAuraCommand(), misc_commandscript::HandleFreezeCommand(), spell_putricide_slime_puddle::HandleScript(), Unit::HandleSpellClick(), and Unit::RemoveAurasDueToSpellBySteal().

◆ UnregisterSingleTarget()

void Aura::UnregisterSingleTarget ( )
1119{
1121 Unit* caster = GetCaster();
1122 if (!caster)
1123 {
1124 LOG_INFO("spells", "Aura::UnregisterSingleTarget: (A1) - {}, {}, {}, {}", GetId(), GetOwner()->GetTypeId(), GetOwner()->GetEntry(), GetOwner()->GetName());
1125 LOG_ERROR("spells", "Aura::UnregisterSingleTarget: No caster was found."); //ASSERT(caster);
1126 }
1127 else
1128 caster->GetSingleCastAuras().remove(this);
1129
1130 SetIsSingleTarget(false);
1131}
#define LOG_INFO(filterType__,...)
Definition Log.h:153
void SetIsSingleTarget(bool val)
Definition SpellAuras.h:167
AuraList & GetSingleCastAuras()
Definition Unit.h:1430

References ASSERT, GetCaster(), GetId(), GetOwner(), Unit::GetSingleCastAuras(), LOG_ERROR, LOG_INFO, m_isSingleTarget, and SetIsSingleTarget().

Referenced by Unit::RemoveAurasDueToSpellBySteal(), and Unit::RemoveOwnedAura().

◆ Update()

void Aura::Update ( uint32  diff,
Unit caster 
)
746{
747 if (m_duration > 0)
748 {
749 m_duration -= diff;
750 if (m_duration < 0)
751 m_duration = 0;
752
753 // handle ManaPerSecond/ManaPerSecondPerLevel
754 if (m_timeCla)
755 {
756 if (m_timeCla > int32(diff))
757 m_timeCla -= diff;
758 else if (caster)
759 {
760 if (int32 ManaPerSecond = m_spellInfo->ManaPerSecond + m_spellInfo->ManaPerSecondPerLevel * caster->GetLevel())
761 {
762 m_timeCla += 1000 - diff;
763
764 Powers powertype = Powers(m_spellInfo->PowerType);
765 if (powertype == POWER_HEALTH)
766 {
767 if (int32(caster->GetHealth()) > ManaPerSecond)
768 caster->ModifyHealth(-ManaPerSecond);
769 else
770 {
771 Remove();
772 return;
773 }
774 }
775 else
776 {
777 if (int32(caster->GetPower(powertype)) >= ManaPerSecond)
778 caster->ModifyPower(powertype, -ManaPerSecond);
779 else
780 {
781 Remove();
782 return;
783 }
784 }
785 }
786 }
787 }
788 }
789}
Powers
Definition SharedDefines.h:256
@ POWER_HEALTH
Definition SharedDefines.h:266
uint32 PowerType
Definition SpellInfo.h:386
int32 ModifyHealth(int32 val)
Definition Unit.cpp:10974
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:11032
uint32 GetHealth() const
Definition Unit.h:1109
uint32 GetPower(Powers power) const
Definition Unit.h:1136

References Unit::GetHealth(), Unit::GetLevel(), Unit::GetPower(), m_duration, m_spellInfo, m_timeCla, SpellInfo::ManaPerSecond, SpellInfo::ManaPerSecondPerLevel, Unit::ModifyHealth(), Unit::ModifyPower(), POWER_HEALTH, SpellInfo::PowerType, and Remove().

Referenced by UpdateOwner().

◆ UpdateOwner()

void Aura::UpdateOwner ( uint32  diff,
WorldObject owner 
)
704{
705 if (owner != m_owner)
706 {
707 ABORT();
708 }
709
710 Unit* caster = GetCaster();
711 // Apply spellmods for channeled auras
712 // used for example when triggered spell of spell:10 is modded
713 Spell* modSpell = nullptr;
714 Player* modOwner = nullptr;
715 if (caster)
716 {
717 modOwner = caster->GetSpellModOwner();
718 if (modOwner)
719 {
720 modSpell = modOwner->FindCurrentSpellBySpellId(GetId());
721 if (modSpell)
722 modOwner->SetSpellModTakingSpell(modSpell, true);
723 }
724 }
725
726 Update(diff, caster);
727
728 if (m_updateTargetMapInterval <= int32(diff))
729 UpdateTargetMap(caster);
730 else
732
733 // update aura effects
734 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
735 if (m_effects[i])
736 m_effects[i]->Update(diff, caster);
737
738 // remove spellmods after effects update
739 if (modSpell)
740 modOwner->SetSpellModTakingSpell(modSpell, false);
741
743}
void Update(uint32 diff, Unit *caster)
Definition SpellAuraEffects.cpp:926
void Update(uint32 diff, Unit *caster)
Definition SpellAuras.cpp:745
void SetSpellModTakingSpell(Spell *spell, bool apply)
Definition Player.cpp:10256
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition Unit.cpp:4336

References _DeleteRemovedApplications(), ABORT, Unit::FindCurrentSpellBySpellId(), GetCaster(), GetId(), Unit::GetSpellModOwner(), m_effects, m_owner, m_updateTargetMapInterval, MAX_SPELL_EFFECTS, Player::SetSpellModTakingSpell(), AuraEffect::Update(), Update(), and UpdateTargetMap().

Referenced by DynamicObject::Update().

◆ UpdateTargetMap()

void Aura::UpdateTargetMap ( Unit caster,
bool  apply = true 
)
533{
534 if (IsRemoved())
535 return;
536
538
539 // fill up to date target list
540 // target, effMask
541 std::map<Unit*, uint8> targets;
542
543 FillTargetMap(targets, caster);
544
545 UnitList targetsToRemove;
546
547 // mark all auras as ready to remove
548 for (ApplicationMap::iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
549 {
550 std::map<Unit*, uint8>::iterator existing = targets.find(appIter->second->GetTarget());
551 // not found in current area - remove the aura
552 if (existing == targets.end())
553 targetsToRemove.push_back(appIter->second->GetTarget());
554 else
555 {
556 // xinef: check immunities here, so aura wont get removed on every tick and then reapplied
557 if (IsArea())
558 for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
559 {
560 if ((existing->second & (1 << effIndex)) && existing->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex, GetCaster()))
561 existing->second &= ~(1 << effIndex);
562 }
563
564 // needs readding - remove now, will be applied in next update cycle
565 // (dbcs do not have auras which apply on same type of targets but have different radius, so this is not really needed)
566 if (appIter->second->GetEffectMask() != existing->second || !CanBeAppliedOn(existing->first))
567 targetsToRemove.push_back(appIter->second->GetTarget());
568 // nothing todo - aura already applied
569 // remove from auras to register list
570 targets.erase(existing);
571 }
572 }
573
574 // register auras for units
575 for (std::map<Unit*, uint8>::iterator itr = targets.begin(); itr != targets.end();)
576 {
577 // aura mustn't be already applied on target
578 if (AuraApplication* aurApp = GetApplicationOfTarget(itr->first->GetGUID()))
579 {
580 // the core created 2 different units with same guid
581 // this is a major failue, which i can't fix right now
582 // let's remove one unit from aura list
583 // this may cause area aura "bouncing" between 2 units after each update
584 // but because we know the reason of a crash we can remove the assertion for now
585 if (aurApp->GetTarget() != itr->first)
586 {
587 // remove from auras to register list
588 targets.erase(itr++);
589 continue;
590 }
591 else
592 {
593 // ok, we have one unit twice in target map (impossible, but...)
594 ABORT();
595 }
596 }
597
598 bool addUnit = true;
599 // check target immunities
600 for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
601 {
602 if ((itr->second & (1 << effIndex)) && itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex, GetCaster()))
603 itr->second &= ~(1 << effIndex);
604 }
605 if (!itr->second || itr->first->IsImmunedToSpell(GetSpellInfo(), GetCaster()) || !CanBeAppliedOn(itr->first))
606 addUnit = false;
607
608 if (addUnit && !itr->first->IsHighestExclusiveAura(this, true))
609 addUnit = false;
610
611 if (addUnit)
612 {
613 // persistent area aura does not hit flying targets
614 if (GetType() == DYNOBJ_AURA_TYPE)
615 {
616 if (itr->first->IsInFlight())
617 addUnit = false;
618
619 // Allow only 1 persistent area aura to affect our targets if a custom flag is set.
620 if (itr->first->HasAura(GetId()) && GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_ONLY_ONE_AREA_AURA))
621 addUnit = false;
622 }
623 // unit auras can not stack with each other
624 else // (GetType() == UNIT_AURA_TYPE)
625 {
626 // Allow to remove by stack when aura is going to be applied on owner
627 if (itr->first != GetOwner())
628 {
629 // check if not stacking aura already on target
630 // this one prevents unwanted usefull buff loss because of stacking and prevents overriding auras periodicaly by 2 near area aura owners
631 for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
632 {
633 Aura const* aura = iter->second->GetBase();
634 if (!CanStackWith(aura))
635 {
636 addUnit = false;
637 break;
638 }
639 }
640 }
641 }
642 }
643 if (!addUnit)
644 targets.erase(itr++);
645 else
646 {
647 // owner has to be in world, or effect has to be applied to self
648 if (!GetOwner()->IsSelfOrInSameMap(itr->first))
649 {
650 //TODO: There is a crash caused by shadowfiend load addon
651 LOG_FATAL("spells.aura", "Aura {}: Owner {} (map {}) is not in the same map as target {} (map {}).", GetSpellInfo()->Id,
652 GetOwner()->GetName(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1),
653 itr->first->GetName(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1));
654 ABORT();
655 }
656 itr->first->_CreateAuraApplication(this, itr->second);
657 ++itr;
658 }
659 }
660
661 // remove auras from units no longer needing them
662 for (UnitList::iterator itr = targetsToRemove.begin(); itr != targetsToRemove.end(); ++itr)
663 if (AuraApplication* aurApp = GetApplicationOfTarget((*itr)->GetGUID()))
664 (*itr)->_UnapplyAura(aurApp, AURA_REMOVE_BY_DEFAULT);
665
666 if (!apply)
667 return;
668
669 // apply aura effects for units
670 for (std::map<Unit*, uint8>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
671 {
672 if (AuraApplication* aurApp = GetApplicationOfTarget(itr->first->GetGUID()))
673 {
674 // owner has to be in world, or effect has to be applied to self
675 ASSERT((!GetOwner()->IsInWorld() && GetOwner() == itr->first) || GetOwner()->IsInMap(itr->first));
676 itr->first->_ApplyAura(aurApp, itr->second);
677 }
678 }
679}
#define LOG_FATAL(filterType__,...)
Definition Log.h:141
@ AURA_REMOVE_BY_DEFAULT
Definition SpellAuraDefines.h:392
static constexpr int32 UPDATE_TARGET_MAP_INTERVAL
Definition SpellAuras.cpp:45
@ SPELL_ATTR0_CU_ONLY_ONE_AREA_AURA
Definition SpellInfo.h:207
virtual void FillTargetMap(std::map< Unit *, uint8 > &targets, Unit *caster)=0
bool CanStackWith(Aura const *existingAura) const
Definition SpellAuras.cpp:1939
bool CanBeAppliedOn(Unit *target)
Definition SpellAuras.cpp:1888
bool IsSelfOrInSameMap(WorldObject const *obj) const
Definition Object.cpp:1329

References ABORT, ASSERT, AURA_REMOVE_BY_DEFAULT, CanBeAppliedOn(), CanStackWith(), DYNOBJ_AURA_TYPE, FillTargetMap(), GetApplicationOfTarget(), GetCaster(), GetId(), GetOwner(), GetSpellInfo(), GetType(), SpellInfo::HasAttribute(), IsArea(), IsRemoved(), WorldObject::IsSelfOrInSameMap(), LOG_FATAL, m_applications, m_updateTargetMapInterval, MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_ONLY_ONE_AREA_AURA, and UPDATE_TARGET_MAP_INTERVAL.

Referenced by _RegisterForTargets(), ApplyForTargets(), and UpdateOwner().

Friends And Related Symbol Documentation

◆ Unit::_TryStackingOrRefreshingExistingAura

Aura * Unit::_TryStackingOrRefreshingExistingAura ( SpellInfo const *  newAura,
uint8  effMask,
Unit caster,
int32 baseAmount,
Item castItem,
ObjectGuid  casterGUID,
bool  noPeriodicReset 
)
friend

Member Data Documentation

◆ m_applications

◆ m_applyTime

time_t const Aura::m_applyTime
protected

Referenced by GetApplyTime().

◆ m_casterGuid

ObjectGuid const Aura::m_casterGuid
protected

Referenced by GetCasterGUID().

◆ m_casterLevel

uint8 const Aura::m_casterLevel
protected

Referenced by GetCasterLevel().

◆ m_castItemEntry

uint32 const Aura::m_castItemEntry
protected

Referenced by GetCastItemEntry().

◆ m_castItemGuid

ObjectGuid const Aura::m_castItemGuid
protected

◆ m_duration

int32 Aura::m_duration
protected

◆ m_effects

◆ m_isRemoved

bool Aura::m_isRemoved
protected

Referenced by _Remove(), and IsRemoved().

◆ m_isSingleTarget

bool Aura::m_isSingleTarget
protected

◆ m_isUsingCharges

bool Aura::m_isUsingCharges
protected

◆ m_loadedScripts

◆ m_maxDuration

◆ m_owner

WorldObject* const Aura::m_owner
protected

◆ m_procCharges

uint8 Aura::m_procCharges
protected

◆ m_procCooldown

TimePoint Aura::m_procCooldown
protected

◆ m_removedApplications

Unit::AuraApplicationList Aura::m_removedApplications
private

◆ m_spellInfo

◆ m_stackAmount

uint8 Aura::m_stackAmount
protected

◆ m_timeCla

int32 Aura::m_timeCla
protected

Referenced by Aura(), RefreshDuration(), and Update().

◆ m_triggeredByAuraSpellInfo

SpellInfo const* Aura::m_triggeredByAuraSpellInfo
private

◆ m_updateTargetMapInterval

int32 Aura::m_updateTargetMapInterval
protected

Referenced by UpdateOwner(), and UpdateTargetMap().


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