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
 
const AuraApplicationGetApplicationOfTarget (ObjectGuid guid) const
 
AuraApplicationGetApplicationOfTarget (ObjectGuid guid)
 
bool IsAppliedOnTarget (ObjectGuid guid) const
 
void SetNeedClientUpdateForTargets () const
 
void HandleAuraSpecificMods (AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
 
bool CanBeAppliedOn (Unit *target)
 
bool CheckAreaTarget (Unit *target)
 
bool CanStackWith (Aura const *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
348 :
349 m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
350 m_castItemGuid(itemGUID ? itemGUID : castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(GameTime::GetGameTime().count()),
352 m_casterLevel(caster ? caster->GetLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
354{
357
362 memset(m_effects, 0, sizeof(m_effects));
363 // m_casterLevel = cast item level/caster level, caster level should be saved to db, confirmed with sniffs
364}
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:118
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
387{
388 // unload scripts
389 while (!m_loadedScripts.empty())
390 {
391 std::list<AuraScript*>::iterator itr = m_loadedScripts.begin();
392 (*itr)->_Unload();
393 delete (*itr);
394 m_loadedScripts.erase(itr);
395 }
396
397 // free effects memory
398 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
399 delete m_effects[i];
400
401 ASSERT(m_applications.empty());
403}
#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:2339

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

Member Function Documentation

◆ _ApplyEffectForTargets()

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

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.

432{
433 ASSERT(target);
434 ASSERT(auraApp);
435 // aura mustn't be already applied on target
436 ASSERT (!IsAppliedOnTarget(target->GetGUID()) && "Aura::_ApplyForTarget: aura musn't be already applied on target");
437
438 m_applications[target->GetGUID()] = auraApp;
439
440 // set infinity cooldown state for spells
442 {
443 if (caster->IsPlayer())
444 {
445 caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, 0, nullptr, true);
446 }
447 else
448 {
450 }
451 }
452}
static constexpr uint32 infinityCooldownDelay
Definition Unit.h:46
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:2908
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:10828
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
2340{
2341 while (!m_removedApplications.empty())
2342 {
2343 delete m_removedApplications.front();
2344 m_removedApplications.pop_front();
2345 }
2346}
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 
)
375{
376 // shouldn't be in constructor - functions in AuraEffect::AuraEffect use polymorphism
377 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
378 {
379 if (effMask & (uint8(1) << i))
380 m_effects[i] = new AuraEffect(this, i, baseAmount ? baseAmount + i : nullptr, caster);
381 else
382 m_effects[i] = nullptr;
383 }
384}
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:410
void UpdateTargetMap(Unit *caster, bool apply=true)
Definition SpellAuras.cpp:527
Definition Unit.h:664

References GetCaster(), and UpdateTargetMap().

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

◆ _Remove()

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

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.

455{
456 ASSERT(target);
457 ASSERT(auraApp->GetRemoveMode());
458 ASSERT(auraApp);
459
460 ApplicationMap::iterator itr = m_applications.find(target->GetGUID());
461
463 if (itr == m_applications.end())
464 {
465 LOG_ERROR("spells.aura", "Aura::_UnapplyForTarget, target:{}, caster:{}, spell:{} was not found in owners application map!",
466 target->GetGUID().ToString(), caster ? caster->GetGUID().ToString() : "", auraApp->GetBase()->GetSpellInfo()->Id);
467 ABORT();
468 }
469
470 // aura has to be already applied
471 ASSERT(itr->second == auraApp);
472 m_applications.erase(itr);
473
474 m_removedApplications.push_back(auraApp);
475
476 // reset cooldown state for spells
478 {
479 if (caster->IsPlayer())
480 {
481 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
483 }
484 else
485 {
486 caster->ToCreature()->AddSpellCooldown(m_spellInfo->Id, 0, 0);
487
488 if (Unit* owner = caster->GetCharmerOrOwner())
489 {
490 if (Player* playerOwner = owner->ToPlayer())
491 {
492 WorldPacket data(SMSG_COOLDOWN_EVENT, 4 + 8);
493 data << uint32(m_spellInfo->Id);
494 data << caster->GetGUID();
495 playerOwner->SendDirectMessage(&data);
496 }
497 }
498 }
499 }
500
501 if (caster && caster->IsPlayer())
502 {
503 if (GetSpellInfo()->IsCooldownStartedOnEvent() && !m_castItemGuid)
504 {
505 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
507 }
508 }
509}
std::uint32_t uint32
Definition Define.h:107
#define ABORT
Definition Errors.h:76
#define LOG_ERROR(filterType__,...)
Definition Log.h:158
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:73
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:100
std::string ToString() const
Definition ObjectGuid.cpp:47
Definition Player.h:1084
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition Player.cpp:11026
Unit * GetCharmerOrOwner() const
Definition Unit.h:1286
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 
)
2099{
2100 AddProcCooldown(now + procEntry->Cooldown);
2101}
void AddProcCooldown(TimePoint cooldownEnd)
Definition SpellAuras.cpp:2093

References AddProcCooldown(), and SpellProcEntry::Cooldown.

◆ AddProcCooldown() [2/2]

void Aura::AddProcCooldown ( TimePoint  cooldownEnd)
2094{
2095 m_procCooldown = cooldownEnd;
2096}
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
238{
239 ASSERT_NODEBUGINFO(spellProto);
240 ASSERT_NODEBUGINFO(owner);
241 uint8 effMask = 0;
242 switch (owner->GetTypeId())
243 {
244 case TYPEID_UNIT:
245 case TYPEID_PLAYER:
246 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
247 {
248 if (spellProto->Effects[i].IsUnitOwnedAuraEffect())
249 effMask |= 1 << i;
250 }
251 break;
253 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
254 {
255 if (spellProto->Effects[i].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
256 effMask |= 1 << i;
257 }
258 break;
259 default:
260 break;
261 }
262 return effMask & avalibleEffectMask;
263}
#define ASSERT_NODEBUGINFO
Definition Errors.h:69
@ TYPEID_DYNAMICOBJECT
Definition ObjectGuid.h:38
@ TYPEID_UNIT
Definition ObjectGuid.h:35
@ TYPEID_PLAYER
Definition ObjectGuid.h:36
@ 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
1129{
1130 // we assume that aura dispel chance is 100% on start
1131 // need formula for level difference based chance
1132 int32 resistChance = 0;
1133
1134 // Apply dispel mod from aura caster
1135 if (Unit* caster = GetCaster())
1136 if (Player* modOwner = caster->GetSpellModOwner())
1137 modOwner->ApplySpellMod(GetId(), SPELLMOD_RESIST_DISPEL_CHANCE, resistChance);
1138
1139 // Dispel resistance from target SPELL_AURA_MOD_DISPEL_RESIST
1140 // Only affects offensive dispels
1141 if (offensive && auraTarget)
1142 resistChance += auraTarget->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
1143
1144 resistChance = resistChance < 0 ? 0 : resistChance;
1145 resistChance = resistChance > 100 ? 100 : resistChance;
1146 return 100 - resistChance;
1147}
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:405
Player * GetSpellModOwner() const
Definition Unit.cpp:12925
int32 GetTotalAuraModifier(AuraType auratype) const
Definition Unit.cpp:6268

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
904{
905 uint32 maxProcCharges = m_spellInfo->ProcCharges;
906 if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()))
907 maxProcCharges = procEntry->Charges;
908
909 if (caster)
910 if (Player* modOwner = caster->GetSpellModOwner())
911 modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, maxProcCharges);
912 return maxProcCharges;
913}
@ SPELLMOD_CHARGES
Definition SpellDefines.h:80
#define sSpellMgr
Definition SpellMgr.h:836
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
787{
788 Player* modOwner = nullptr;
789 int32 maxDuration;
790
791 if (caster)
792 {
793 modOwner = caster->GetSpellModOwner();
794 maxDuration = caster->CalcSpellDuration(m_spellInfo);
795 }
796 else
797 maxDuration = m_spellInfo->GetDuration();
798
800 maxDuration = -1;
801
802 sScriptMgr->OnCalcMaxDuration(this, maxDuration);
803
804 // IsPermanent() checks max duration (which we are supposed to calculate here)
805 if (maxDuration != -1 && modOwner)
806 modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, maxDuration);
807 return maxDuration;
808}
#define sScriptMgr
Definition ScriptMgr.h:734
@ SPELLMOD_DURATION
Definition SpellDefines.h:77
bool IsPassive() const
Definition SpellAuras.cpp:1028
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
Definition Player.cpp:9759
SpellDurationEntry const * DurationEntry
Definition SpellInfo.h:385
int32 GetDuration() const
Definition SpellInfo.cpp:2738
int32 CalcSpellDuration(SpellInfo const *spellProto)
Definition Unit.cpp:11563

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
2266{
2267 float chance = procEntry.Chance;
2268 // calculate chances depending on unit with caster's data
2269 // so talents modifying chances and judgements will have properly calculated proc chance
2270 if (Unit* caster = GetCaster())
2271 {
2272 // If PPM exists calculate chance from PPM
2273 if ((eventInfo.GetDamageInfo() || eventInfo.GetHealInfo()) && procEntry.ProcsPerMinute != 0)
2274 {
2275 SpellInfo const* procSpell = eventInfo.GetSpellInfo();
2276 uint32 attackSpeed = 0;
2277 if (!procSpell || procSpell->DmgClass == SPELL_DAMAGE_CLASS_MELEE || procSpell->IsRangedWeaponSpell())
2278 {
2279 attackSpeed = caster->GetAttackTime(eventInfo.GetDamageInfo()->GetAttackType());
2280 }
2281 else // spells use their cast time for PPM calculations
2282 {
2283 if (procSpell->CastTimeEntry)
2284 attackSpeed = procSpell->CastTimeEntry->CastTime;
2285
2286 // instants and fast spells use 1.5s cast speed
2287 if (attackSpeed < 1500)
2288 attackSpeed = 1500;
2289 }
2290 chance = caster->GetPPMProcChance(attackSpeed, procEntry.ProcsPerMinute, GetSpellInfo());
2291 }
2292 // apply chance modifer aura, applies also to ppm chance (see improved judgement of light spell)
2293 if (Player* modOwner = caster->GetSpellModOwner())
2294 modOwner->ApplySpellMod(GetId(), SPELLMOD_CHANCE_OF_SUCCESS, chance);
2295 }
2296
2297 // proc chance is reduced by an additional 3.333% per level past 60
2298 if ((procEntry.AttributesMask & PROC_ATTR_REDUCE_PROC_60) && eventInfo.GetActor()->GetLevel() > 60)
2299 chance = std::max(0.f, (1.f - ((eventInfo.GetActor()->GetLevel() - 60) * 1.f / 30.f)) * chance);
2300
2301 return chance;
2302}
@ SPELL_DAMAGE_CLASS_MELEE
Definition SharedDefines.h:1553
@ SPELLMOD_CHANCE_OF_SUCCESS
Definition SpellDefines.h:94
@ PROC_ATTR_REDUCE_PROC_60
Definition SpellMgr.h:281
WeaponAttackType GetAttackType() const
Definition Unit.h:371
HealInfo * GetHealInfo() const
Definition Unit.h:470
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:299
Unit * GetActor()
Definition Unit.h:459
DamageInfo * GetDamageInfo() const
Definition Unit.h:469
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:1103
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 
)
2659{
2660 bool result = isTriggeredAtSpellProcEvent;
2661 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2662 {
2663 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_CHECK_PROC, aurApp);
2664 std::list<AuraScript::AfterCheckProcHandler>::iterator hookItrEnd = (*scritr)->DoAfterCheckProc.end(), hookItr = (*scritr)->DoAfterCheckProc.begin();
2665 for (; hookItr != hookItrEnd; ++hookItr)
2666 result &= hookItr->Call(*scritr, eventInfo, isTriggeredAtSpellProcEvent);
2667
2668 (*scritr)->_FinishScriptCall();
2669 }
2670
2671 return result;
2672}
@ 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)
2396{
2397 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2398 {
2399 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_DISPEL);
2400 std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin();
2401 for (; hookItr != hookItrEnd; ++hookItr)
2402 hookItr->Call(*scritr, dispelInfo);
2403
2404 (*scritr)->_FinishScriptCall();
2405 }
2406}
@ 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 
)
2448{
2449 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2450 {
2451 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp);
2452 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
2453 for (; effItr != effEndItr; ++effItr)
2454 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2455 effItr->Call(*scritr, aurEff, mode);
2456
2457 (*scritr)->_FinishScriptCall();
2458 }
2459}
@ 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 
)
2743{
2744 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2745 {
2746 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC, aurApp);
2747 std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->AfterEffectProc.end(), effItr = (*scritr)->AfterEffectProc.begin();
2748 for (; effItr != effEndItr; ++effItr)
2749 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2750 effItr->Call(*scritr, aurEff, eventInfo);
2751
2752 (*scritr)->_FinishScriptCall();
2753 }
2754}
@ 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 
)
2462{
2463 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2464 {
2465 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp);
2466 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
2467 for (; effItr != effEndItr; ++effItr)
2468 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2469 effItr->Call(*scritr, aurEff, mode);
2470
2471 (*scritr)->_FinishScriptCall();
2472 }
2473}
@ 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 
)
2711{
2712 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2713 {
2714 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_PROC, aurApp);
2715 std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->AfterProc.end(), hookItr = (*scritr)->AfterProc.begin();
2716 for (; hookItr != hookItrEnd; ++hookItr)
2717 hookItr->Call(*scritr, eventInfo);
2718
2719 (*scritr)->_FinishScriptCall();
2720 }
2721}
@ 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)
2368{
2369 bool result = true;
2370 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2371 {
2372 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_AREA_TARGET);
2373 std::list<AuraScript::CheckAreaTargetHandler>::iterator hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin();
2374 for (; hookItr != hookItrEnd; ++hookItr)
2375 result &= hookItr->Call(*scritr, target);
2376
2377 (*scritr)->_FinishScriptCall();
2378 }
2379 return result;
2380}
@ 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 
)
2642{
2643 bool result = true;
2644 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2645 {
2646 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_EFFECT_PROC, aurApp);
2647 std::list<AuraScript::CheckEffectProcHandler>::iterator effEndItr = (*scritr)->DoCheckEffectProc.end(), effItr = (*scritr)->DoCheckEffectProc.begin();
2648 for (; effItr != effEndItr; ++effItr)
2649 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2650 result &= effItr->Call(*scritr, aurEff, eventInfo);
2651
2652 (*scritr)->_FinishScriptCall();
2653 }
2654
2655 return result;
2656}
@ 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 
)
2626{
2627 bool result = true;
2628 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2629 {
2630 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_PROC, aurApp);
2631 std::list<AuraScript::CheckProcHandler>::iterator hookItrEnd = (*scritr)->DoCheckProc.end(), hookItr = (*scritr)->DoCheckProc.begin();
2632 for (; hookItr != hookItrEnd; ++hookItr)
2633 result &= hookItr->Call(*scritr, eventInfo);
2634
2635 (*scritr)->_FinishScriptCall();
2636 }
2637
2638 return result;
2639}
@ 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)
2383{
2384 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2385 {
2386 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_DISPEL);
2387 std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin();
2388 for (; hookItr != hookItrEnd; ++hookItr)
2389 hookItr->Call(*scritr, dispelInfo);
2390
2391 (*scritr)->_FinishScriptCall();
2392 }
2393}
@ 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 
)
2552{
2553 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2554 {
2555 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp);
2556 std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
2557 for (; effItr != effEndItr; ++effItr)
2558
2559 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2560 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2561
2562 if (!defaultPrevented)
2563 defaultPrevented = (*scritr)->_IsDefaultActionPrevented();
2564
2565 (*scritr)->_FinishScriptCall();
2566 }
2567}
@ 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 
)
2570{
2571 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2572 {
2573 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp);
2574 std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
2575 for (; effItr != effEndItr; ++effItr)
2576 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2577 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2578
2579 (*scritr)->_FinishScriptCall();
2580 }
2581}
@ 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 
)
2598{
2599 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2600 {
2601 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp);
2602 std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
2603 for (; effItr != effEndItr; ++effItr)
2604 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2605 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2606
2607 (*scritr)->_FinishScriptCall();
2608 }
2609}
@ 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 
)
2409{
2410 bool preventDefault = false;
2411 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2412 {
2413 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp);
2414 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
2415 for (; effItr != effEndItr; ++effItr)
2416 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2417 effItr->Call(*scritr, aurEff, mode);
2418
2419 if (!preventDefault)
2420 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2421
2422 (*scritr)->_FinishScriptCall();
2423 }
2424
2425 return preventDefault;
2426}
@ 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 
)
2510{
2511 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2512 {
2513 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT);
2514 std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
2515 for (; effItr != effEndItr; ++effItr)
2516 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2517 effItr->Call(*scritr, aurEff, amount, canBeRecalculated);
2518
2519 (*scritr)->_FinishScriptCall();
2520 }
2521}
@ 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 
)
2524{
2525 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2526 {
2527 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC);
2528 std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
2529 for (; effItr != effEndItr; ++effItr)
2530 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2531 effItr->Call(*scritr, aurEff, isPeriodic, amplitude);
2532
2533 (*scritr)->_FinishScriptCall();
2534 }
2535}
@ 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 
)
2538{
2539 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2540 {
2541 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD);
2542 std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
2543 for (; effItr != effEndItr; ++effItr)
2544 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2545 effItr->Call(*scritr, aurEff, spellMod);
2546
2547 (*scritr)->_FinishScriptCall();
2548 }
2549}
@ 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 
)
2584{
2585 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2586 {
2587 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp);
2588 std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
2589 for (; effItr != effEndItr; ++effItr)
2590 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2591 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2592
2593 (*scritr)->_FinishScriptCall();
2594 }
2595}
@ 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 
)
2476{
2477 bool preventDefault = false;
2478 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2479 {
2480 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp);
2481 std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
2482 for (; effItr != effEndItr; ++effItr)
2483 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2484 effItr->Call(*scritr, aurEff);
2485
2486 if (!preventDefault)
2487 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2488
2489 (*scritr)->_FinishScriptCall();
2490 }
2491
2492 return preventDefault;
2493}
@ 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 
)
2724{
2725 bool preventDefault = false;
2726 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2727 {
2728 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PROC, aurApp);
2729 std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->OnEffectProc.end(), effItr = (*scritr)->OnEffectProc.begin();
2730 for (; effItr != effEndItr; ++effItr)
2731 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2732 effItr->Call(*scritr, aurEff, eventInfo);
2733
2734 if (!preventDefault)
2735 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2736
2737 (*scritr)->_FinishScriptCall();
2738 }
2739 return preventDefault;
2740}
@ 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 
)
2429{
2430 bool preventDefault = false;
2431 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2432 {
2433 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp);
2434 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
2435 for (; effItr != effEndItr; ++effItr)
2436 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2437 effItr->Call(*scritr, aurEff, mode);
2438
2439 if (!preventDefault)
2440 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2441
2442 (*scritr)->_FinishScriptCall();
2443 }
2444 return preventDefault;
2445}
@ 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 
)
2612{
2613 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2614 {
2615 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_SPLIT, aurApp);
2616 std::list<AuraScript::EffectSplitHandler>::iterator effEndItr = (*scritr)->OnEffectSplit.end(), effItr = (*scritr)->OnEffectSplit.begin();
2617 for (; effItr != effEndItr; ++effItr)
2618 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2619 effItr->Call(*scritr, aurEff, dmgInfo, splitAmount);
2620
2621 (*scritr)->_FinishScriptCall();
2622 }
2623}
@ 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)
2496{
2497 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2498 {
2499 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC);
2500 std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
2501 for (; effItr != effEndItr; ++effItr)
2502 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2503 effItr->Call(*scritr, aurEff);
2504
2505 (*scritr)->_FinishScriptCall();
2506 }
2507}
@ 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 
)
2675{
2676 bool prepare = true;
2677 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2678 {
2679 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PREPARE_PROC, aurApp);
2680 std::list<AuraScript::AuraProcHandler>::iterator effEndItr = (*scritr)->DoPrepareProc.end(), effItr = (*scritr)->DoPrepareProc.begin();
2681 for (; effItr != effEndItr; ++effItr)
2682 effItr->Call(*scritr, eventInfo);
2683
2684 if (prepare)
2685 prepare = !(*scritr)->_IsDefaultActionPrevented();
2686
2687 (*scritr)->_FinishScriptCall();
2688 }
2689
2690 return prepare;
2691}
@ 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 
)
2694{
2695 bool handled = false;
2696 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2697 {
2698 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PROC, aurApp);
2699 std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->OnProc.end(), hookItr = (*scritr)->OnProc.begin();
2700 for (; hookItr != hookItrEnd; ++hookItr)
2701 hookItr->Call(*scritr, eventInfo);
2702
2703 handled |= (*scritr)->_IsDefaultActionPrevented();
2704 (*scritr)->_FinishScriptCall();
2705 }
2706
2707 return handled;
2708}
@ 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)
1884{
1885 // unit not in world or during remove from world
1886 if (!target->IsInWorld() || target->IsDuringRemoveFromWorld())
1887 {
1888 // area auras mustn't be applied
1889 if (GetOwner() != target)
1890 return false;
1891 // not selfcasted single target auras mustn't be applied
1892 if (GetCasterGUID() != GetOwner()->GetGUID() && GetSpellInfo()->IsSingleTarget())
1893 return false;
1894 return true;
1895 }
1896 else
1897 return CheckAreaTarget(target);
1898}
bool CheckAreaTarget(Unit *target)
Definition SpellAuras.cpp:1900
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:703

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

Referenced by UpdateTargetMap().

◆ CanBeSaved()

bool Aura::CanBeSaved ( ) const
1044{
1045 SpellInfo const* spellInfo = GetSpellInfo();
1046
1048 {
1049 return true;
1050 }
1051
1053 {
1054 return false;
1055 }
1056
1057 if (IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_DO_NOT_DISPLAY) && spellInfo->Stances))
1058 {
1059 return false;
1060 }
1061
1062 // Xinef: do not save channel auras
1063 if (GetSpellInfo()->IsChanneled())
1064 {
1065 return false;
1066 }
1067
1068 // Xinef: Check if aura is single target, not only spell info
1069 if (GetCasterGUID() != GetOwner()->GetGUID() && (GetSpellInfo()->IsSingleTarget() || IsSingleTarget()))
1070 {
1071 return false;
1072 }
1073
1074 // don't save auras removed by proc system
1075 if (IsUsingCharges() && !GetCharges())
1076 {
1077 return false;
1078 }
1079
1080 return true;
1081}
@ 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
1084{
1086}
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
Definition SpellAuraDefines.h:325
bool HasEffectType(AuraType type) const
Definition SpellAuras.cpp:1168
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
1935{
1936 // Can stack with self
1937 if (this == existingAura)
1938 return true;
1939
1940 SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo();
1941 bool sameCaster = GetCasterGUID() == existingAura->GetCasterGUID();
1942
1943 // Dynobj auras always stack
1944 // xinef: dont allow different ranks (or the same rank) of same spell to stack (many flamestrikes for example)
1945 if (existingAura->GetType() == DYNOBJ_AURA_TYPE)
1946 {
1947 // xinef: desecration lag fix - bound this condition to periodics
1948 if (sameCaster && GetSpellInfo()->Id == existingSpellInfo->Id && GetSpellInfo()->HasAura(SPELL_AURA_PERIODIC_DAMAGE))
1949 return false;
1950 return true;
1951 }
1952
1953 // passive auras don't stack with another rank of the spell cast by same caster
1954 // Exception: item-sourced auras from different items can stack (e.g., weapon imbues on MH/OH)
1955 if (IsPassive() && sameCaster && (m_spellInfo->IsDifferentRankOf(existingSpellInfo) || (m_spellInfo->Id == existingSpellInfo->Id && m_castItemGuid.IsEmpty())))
1956 {
1957 // Allow stacking if both auras are from different items
1958 if (!(GetCastItemGUID() && existingAura->GetCastItemGUID() && GetCastItemGUID() != existingAura->GetCastItemGUID()))
1959 return false;
1960 }
1961
1962 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1963 {
1964 // prevent remove triggering aura by triggered aura
1965 if (existingSpellInfo->Effects[i].TriggerSpell == GetId()
1966 // prevent remove triggered aura by triggering aura refresh
1967 || m_spellInfo->Effects[i].TriggerSpell == existingAura->GetId())
1968 return true;
1969 }
1970
1971 // check spell specific stack rules
1972 if (m_spellInfo->IsAuraExclusiveBySpecificWith(existingSpellInfo)
1973 || (sameCaster && m_spellInfo->IsAuraExclusiveBySpecificPerCasterWith(existingSpellInfo)))
1974 return false;
1975
1976 // check spell group stack rules
1977 switch (sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo))
1978 {
1980 case SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST: // if it reaches this point, existing aura is lower/equal
1981 return false;
1983 if (sameCaster)
1984 return false;
1985 break;
1988 default:
1989 break;
1990 }
1991
1992 if (m_spellInfo->SpellFamilyName != existingSpellInfo->SpellFamilyName)
1993 return true;
1994
1995 if (!sameCaster)
1996 {
1997 // Channeled auras can stack if not forbidden by db or aura type
1998 if (existingAura->GetSpellInfo()->IsChanneled())
1999 return true;
2000
2002 return true;
2003
2004 // check same periodic auras
2005 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2006 {
2007 switch (m_spellInfo->Effects[i].ApplyAuraName)
2008 {
2009 // DOT or HOT from different casters will stack
2021 // periodic auras which target areas are not allowed to stack this way (replenishment for example)
2022 if (m_spellInfo->Effects[i].IsTargetingArea() || existingSpellInfo->Effects[i].IsTargetingArea())
2023 break;
2024 return true;
2025 default:
2026 break;
2027 }
2028 }
2029 }
2030
2031 uint8 VehicleAura1 = 0;
2032 uint8 VehicleAura2 = 0;
2033 uint8 i = 0;
2034 while (i < MAX_SPELL_EFFECTS && !(VehicleAura1 && VehicleAura2))
2035 {
2036 if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
2037 VehicleAura1 = i + 1;
2038 if (existingSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
2039 VehicleAura2 = i + 1;
2040
2041 ++i;
2042 }
2043
2044 if (VehicleAura1 && VehicleAura2)
2045 {
2046 Vehicle* veh = nullptr;
2047 if (GetOwner()->ToUnit())
2048 veh = GetOwner()->ToUnit()->GetVehicleKit();
2049
2050 if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
2051 return true;
2052
2053 // xinef: allow direct auras to stack if there is no passenger in this slot
2054 if (AuraEffect* aurEff = GetEffect(VehicleAura1 - 1))
2055 if (aurEff->GetAmount() > 0)
2056 if (!veh->GetPassenger(aurEff->GetAmount() - 1))
2057 return true;
2058
2059 if (!veh->GetAvailableSeatCount())
2060 return false; // No empty seat available
2061
2062 return true; // Empty seat available (skip rest)
2063 }
2064
2065 // spell of same spell rank chain
2066 if (m_spellInfo->IsRankOf(existingSpellInfo) && !(m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellInfo->SpellFamilyFlags[1] & 0x80000000))
2067 {
2068 // don't allow passive area auras to stack
2069 if (m_spellInfo->IsMultiSlotAura() && !IsArea())
2070 return true;
2071
2072 // Allow item-sourced auras from different items to stack (e.g., weapon imbues on MH/OH, enchant procs)
2073 if ((IsPassive() || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC)) && GetCastItemGUID() && existingAura->GetCastItemGUID() && GetCastItemGUID() != existingAura->GetCastItemGUID())
2074 return true;
2075
2076 // same spell with same caster should not stack
2077 return false;
2078 }
2079
2080 return true;
2081}
@ SPELL_ATTR3_DOT_STACKING_RULE
Definition SharedDefines.h:488
@ SPELLFAMILY_HUNTER
Definition SharedDefines.h:3795
@ 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:1018
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:176
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:103
bool IsEmpty() const
Definition ObjectGuid.h:161
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:630
Unit * GetPassenger(int8 seatId) const
Definition Vehicle.cpp:229

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)
1901{
1902 return CallScriptCheckAreaTargetHandlers(target);
1903}
bool CallScriptCheckAreaTargetHandlers(Unit *target)
Definition SpellAuras.cpp:2367

References CallScriptCheckAreaTargetHandlers().

Referenced by CanBeAppliedOn().

◆ ConsumeProcCharges()

void Aura::ConsumeProcCharges ( SpellProcEntry const *  procEntry)
2326{
2327 // Remove aura if we've used last charge to proc
2328 if (procEntry->AttributesMask & PROC_ATTR_USE_STACKS_FOR_CHARGES)
2329 {
2330 ModStackAmount(-1);
2331 }
2332 else if (IsUsingCharges())
2333 {
2334 if (!GetCharges())
2335 Remove();
2336 }
2337}
@ 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:963
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
304{
305 ASSERT_NODEBUGINFO(effMask);
306 ASSERT_NODEBUGINFO(spellproto);
307 ASSERT_NODEBUGINFO(owner);
308 ASSERT_NODEBUGINFO(caster || casterGUID);
310 // try to get caster of aura
311 if (casterGUID)
312 {
313 if (owner->GetGUID() == casterGUID)
314 caster = owner->ToUnit();
315 else
316 caster = ObjectAccessor::GetUnit(*owner, casterGUID);
317 }
318 else
319 casterGUID = caster->GetGUID();
320
321 // check if aura can be owned by owner
322 if (owner->IsUnit())
323 if (!owner->IsInWorld() || ((Unit*)owner)->IsDuringRemoveFromWorld())
324 // owner not in world so don't allow to own not self casted single target auras
325 if (casterGUID != owner->GetGUID() && spellproto->IsSingleTarget())
326 return nullptr;
327
328 Aura* aura = nullptr;
329 switch (owner->GetTypeId())
330 {
331 case TYPEID_UNIT:
332 case TYPEID_PLAYER:
333 aura = new UnitAura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID, itemGUID);
334 break;
336 aura = new DynObjAura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID, itemGUID);
337 break;
338 default:
339 ABORT();
340 return nullptr;
341 }
342 // aura can be removed in Unit::_AddAura call
343 if (aura->IsRemoved())
344 return nullptr;
345 return aura;
346}
#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:199

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:915

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
1196{
1197 for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1198 {
1199 if (appIter->second->GetEffectMask())
1200 applicationList.push_back(appIter->second);
1201 }
1202}

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
2762{
2763 std::stringstream sstr;
2764 sstr << std::boolalpha
2765 << "Id: " << GetId() << " Caster: " << GetCasterGUID().ToString()
2766 << "\nOwner: " << (GetOwner() ? GetOwner()->GetDebugInfo() : "NULL");
2767 return sstr.str();
2768}
std::string GetDebugInfo() const override
Definition Object.cpp:2537

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

◆ GetDuration()

◆ GetDynobjOwner()

DynamicObject * Aura::GetDynobjOwner ( ) const
inline
AuraObjectType GetType() const
Definition SpellAuras.cpp:420
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
2130{
2131 SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId());
2132
2133 // only auras with spell proc entry can trigger proc
2134 if (!procEntry)
2135 return 0;
2136
2137 // check spell triggering us
2138 if (Spell const* spell = eventInfo.GetProcSpell())
2139 {
2140 // Do not allow auras to proc from effect triggered from itself
2141 if (spell->GetTriggeredByAuraSpellInfo() == m_spellInfo)
2142 return 0;
2143
2144 // check if aura can proc when spell is triggered (exception for hunter auto shot & wands)
2145 // Kill/killed/death events should not be blocked by the triggered-spell check -
2146 // the kill itself is the proc trigger, not the spell that dealt the killing blow
2147 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_CAN_PROC_FROM_PROCS) &&
2149 !(eventInfo.GetTypeMask() & AUTO_ATTACK_PROC_FLAG_MASK) &&
2151 {
2152 if (spell->IsTriggered() && !spell->GetSpellInfo()->HasAttribute(SPELL_ATTR3_NOT_A_PROC))
2153 return 0;
2154 }
2155
2156 // do not allow aura proc if proc is caused by a spell cast by item
2157 if (spell->m_CastItem && (procEntry->AttributesMask & PROC_ATTR_CANT_PROC_FROM_ITEM_CAST))
2158 return 0;
2159 }
2160
2161 // Don't consume stealth charges from friendly spells
2163 {
2164 if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
2165 if (spellInfo->IsPositive() || !eventInfo.GetActor()->IsHostileTo(aurApp->GetTarget()) || spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH))
2166 return 0;
2167 }
2168
2169 // check if we have charges to proc with
2170 if (IsUsingCharges() && !GetCharges())
2171 return 0;
2172
2173 // check proc cooldown
2174 if (IsProcOnCooldown(now))
2175 return 0;
2176
2177 // do checks against db data
2178 if (!sSpellMgr->CanSpellTriggerProcOnEvent(*procEntry, eventInfo))
2179 return 0;
2180
2181 // check if spell was affected by this aura's spellmod (used by Arcane Potency and similar effects)
2182 // only applies when consuming charges or stacks
2184 {
2185 Spell const* procSpell = eventInfo.GetProcSpell();
2186 if (!procSpell || procSpell->m_appliedMods.find(const_cast<Aura*>(this)) == procSpell->m_appliedMods.end())
2187 return 0;
2188 }
2189
2190 // do checks using conditions table
2191 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, GetId());
2192 ConditionSourceInfo condInfo = ConditionSourceInfo(eventInfo.GetActor(), eventInfo.GetActionTarget());
2193 if (!sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
2194 return 0;
2195
2196 // AuraScript Hook
2197 if (!const_cast<Aura*>(this)->CallScriptCheckProcHandlers(aurApp, eventInfo))
2198 return 0;
2199
2200 // At least one effect has to pass checks to proc aura
2201 uint8 procEffectMask = aurApp->GetEffectMask();
2202 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2203 {
2204 if (AuraEffect* aurEff = GetEffect(i))
2205 {
2206 if (procEffectMask & (1 << i))
2207 {
2208 if ((procEntry->DisableEffectsMask & (1u << i)) || !aurEff->CheckEffectProc(aurApp, eventInfo))
2209 procEffectMask &= ~(1 << i);
2210 }
2211 }
2212 }
2213
2214 if (!procEffectMask)
2215 return 0;
2216
2217 // Check if current equipment meets aura requirements
2218 // do that only for passive spells
2219 Unit* target = aurApp->GetTarget();
2220 if (IsPassive() && target->IsPlayer() && GetSpellInfo()->EquippedItemClass != -1)
2221 {
2223 {
2224 Item* item = nullptr;
2226 {
2227 if (target->ToPlayer()->IsInFeralForm())
2228 return 0;
2229
2230 if (DamageInfo const* damageInfo = eventInfo.GetDamageInfo())
2231 {
2232 switch (damageInfo->GetAttackType())
2233 {
2234 case BASE_ATTACK:
2236 break;
2237 case OFF_ATTACK:
2239 break;
2240 default:
2242 break;
2243 }
2244 }
2245 }
2247 {
2248 // Check if player is wearing shield
2250 }
2251
2252 if (!item || item->IsBroken() || !item->IsFitToSpellRequirements(GetSpellInfo()))
2253 return 0;
2254 }
2255 }
2256
2257 float procChance = CalcProcChance(*procEntry, eventInfo);
2258
2259 if (roll_chance_f(procChance))
2260 return procEffectMask;
2261
2262 return 0;
2263}
#define sConditionMgr
Definition ConditionMgr.h:292
@ CONDITION_SOURCE_TYPE_SPELL_PROC
Definition ConditionMgr.h:149
std::list< Condition * > ConditionList
Definition ConditionMgr.h:239
@ ITEM_CLASS_ARMOR
Definition ItemTemplate.h:295
@ ITEM_CLASS_WEAPON
Definition ItemTemplate.h:293
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:676
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:677
@ EQUIPMENT_SLOT_RANGED
Definition Player.h:678
#define INVENTORY_SLOT_BAG_0
Definition Player.h:656
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:216
@ BASE_ATTACK
Definition Unit.h:215
uint8 GetEffectMask() const
Definition SpellAuras.h:66
bool CallScriptCheckProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2625
float CalcProcChance(SpellProcEntry const &procEntry, ProcEventInfo &eventInfo) const
Definition SpellAuras.cpp:2265
bool IsProcOnCooldown(TimePoint now) const
Definition SpellAuras.cpp:2083
Definition Unit.h:336
Definition Item.h:220
bool IsBroken() const
Definition Item.h:257
bool IsFitToSpellRequirements(SpellInfo const *spellInfo) const
Definition Item.cpp:884
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
Definition Player.h:1263
Unit * GetActionTarget() const
Definition Unit.h:460
Spell const * GetProcSpell() const
Definition Unit.h:468
uint32 GetTypeMask() const
Definition Unit.h:462
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:7236
Definition ConditionMgr.h:184
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:366

References GetScriptByName().

◆ GetScriptByName()

AuraScript * Aura::GetScriptByName ( std::string const &  scriptName) const
367{
368 for (std::list<AuraScript*>::const_iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)
369 if ((*itr)->_GetScriptName()->compare(scriptName) == 0)
370 return *itr;
371 return nullptr;
372}

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

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

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

◆ IsAuraStronger()

bool Aura::IsAuraStronger ( Aura const *  newAura) const
1906{
1907 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
1908 {
1909 AuraEffect* thisEffect = GetEffect(i);
1910 if (!thisEffect)
1911 continue;
1912
1913 AuraEffect* newEffect = nullptr;
1914 for (uint8 j = EFFECT_0; j < MAX_SPELL_EFFECTS; ++j)
1915 {
1916 newEffect = newAura->GetEffect(j);
1917 if (!newEffect || thisEffect->GetAuraType() != newEffect->GetAuraType() || thisEffect->GetMiscValue() != newEffect->GetMiscValue())
1918 continue;
1919
1920 // xinef: assume that all spells are either positive or negative, otherwise they should not be in one group
1921 int32 curValue = std::abs(thisEffect->GetAmount());
1922 if (curValue < std::abs(newEffect->GetAmount()))
1923 return true;
1924
1925 if (curValue == std::abs(newEffect->GetAmount()))
1926 if (!IsPassive() && !IsPermanent() && GetDuration() < newAura->GetDuration())
1927 return true;
1928 }
1929 }
1930
1931 return false;
1932}
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
1034{
1035 return GetSpellInfo()->IsDeathPersistent();
1036}
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
2084{
2085 if (GetType() == UNIT_AURA_TYPE)
2086 if (Player* player = GetUnitOwner()->ToPlayer())
2087 if (player->GetCommandStatus(CHEAT_COOLDOWN))
2088 return false;
2089
2090 return m_procCooldown > now;
2091}
@ CHEAT_COOLDOWN
Definition Player.h:997

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
1089{
1090 // Same spell?
1091 if (GetSpellInfo()->IsRankOf(aura->GetSpellInfo()))
1092 return true;
1093
1095 // spell with single target specific types
1096 switch (spec)
1097 {
1100 if (aura->GetSpellInfo()->GetSpellSpecific() == spec)
1101 return true;
1102 break;
1103 default:
1104 break;
1105 }
1106
1108 return true;
1109
1110 return false;
1111}
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 ( )
2349{
2350 sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts);
2351 for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();)
2352 {
2353 if (!(*itr)->_Load(this))
2354 {
2355 std::list<AuraScript*>::iterator bitr = itr;
2356 ++itr;
2357 delete (*bitr);
2358 m_loadedScripts.erase(bitr);
2359 continue;
2360 }
2361 LOG_DEBUG("spells.aura", "Aura::LoadScripts: Script `{}` for aura `{}` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id);
2362 (*itr)->Register();
2363 ++itr;
2364 }
2365}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:170

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 
)
916{
917 if (IsUsingCharges())
918 {
919 int32 charges = m_procCharges + num;
920 int32 maxCharges = CalcMaxCharges();
921
922 // limit charges (only on charges increase, charges may be changed manually)
923 if ((num > 0) && (charges > int32(maxCharges)))
924 charges = maxCharges;
925 // we're out of charges, remove
926 else if (charges <= 0)
927 {
928 Remove(removeMode);
929 return true;
930 }
931
932 SetCharges(charges);
933 }
934 return false;
935}
void SetCharges(uint8 charges)
Definition SpellAuras.cpp:894

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 
)
964{
965 int32 stackAmount = m_stackAmount + num;
966
967 // limit the stack amount (only on stack increase, stack amount may be changed manually)
968 if ((num > 0) && (stackAmount > int32(m_spellInfo->StackAmount)))
969 {
970 // not stackable aura - set stack amount to 1
972 stackAmount = 1;
973 else
974 stackAmount = m_spellInfo->StackAmount;
975 }
976 // we're out of stacks, remove
977 else if (stackAmount <= 0)
978 {
979 Remove(removeMode);
980 return true;
981 }
982
983 bool refresh = stackAmount >= GetStackAmount() && (m_spellInfo->StackAmount || !m_spellInfo->HasAttribute(SPELL_ATTR1_AURA_UNIQUE));
984
985 // Update stack amount
986 if (refresh)
987 {
989 RefreshTimers(periodicReset);
990
991 // reset charges
993 }
994
995 SetStackAmount(stackAmount);
996
998 return false;
999}
@ SPELL_ATTR1_AURA_UNIQUE
Definition SharedDefines.h:418
void SetStackAmount(uint8 num)
Definition SpellAuras.cpp:937
void RefreshTimers(bool periodicReset=false)
Definition SpellAuras.cpp:851
void SetNeedClientUpdateForTargets() const
Definition SpellAuras.cpp:1204
void RefreshSpellMods()
Definition SpellAuras.cpp:1001
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(), AuraScript::ModStackAmount(), Unit::RemoveAuraFromStack(), Unit::RemoveAurasDueToSpellByDispel(), and Unit::RemoveAurasDueToSpellBySteal().

◆ PrepareProcToTrigger()

void Aura::PrepareProcToTrigger ( AuraApplication aurApp,
ProcEventInfo eventInfo,
TimePoint  now 
)
2109{
2110 bool prepare = CallScriptPrepareProcHandlers(aurApp, eventInfo);
2111 if (!prepare)
2112 return;
2113
2114 // take one charge, aura expiration will be handled in Aura::TriggerProcOnEvent (if needed)
2116 {
2117 --m_procCharges;
2119 }
2120
2121 SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId());
2122
2123 ASSERT(procEntry);
2124
2125 // cooldowns should be added to the whole aura (see 51698 area aura)
2126 AddProcCooldown(now + procEntry->Cooldown);
2127}
@ SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES
Definition SharedDefines.h:597
bool CallScriptPrepareProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2674
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 ( )
1179{
1180 ASSERT (!IsRemoved());
1181 Unit* caster = GetCaster();
1182 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1183 if (HasEffect(i))
1184 m_effects[i]->RecalculateAmount(caster);
1185}
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
823{
824 Unit* caster = GetCaster();
825
826 if (!caster)
827 return;
828
829 if (withMods && caster)
830 {
831 int32 duration = m_spellInfo->GetMaxDuration();
832 // Calculate duration of periodics affected by haste.
834 duration = int32(duration * caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
835 SetMaxDuration(duration);
836
837 SetDuration(duration);
838 }
839 else
841
844
845 // also reset periodic counters
846 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
847 if (AuraEffect* aurEff = m_effects[i])
848 aurEff->ResetTicks();
849}
@ 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:306
int32 GetMaxDuration() const
Definition SpellInfo.cpp:2745
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition Unit.cpp:6022

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 ( )
1002{
1003 for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1004 if (Player* player = appIter->second->GetTarget()->ToPlayer())
1005 player->RestoreAllSpellMods(0, this);
1006}

References Unit::GetTarget(), and m_applications.

Referenced by ModStackAmount().

◆ RefreshTimers()

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

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

Referenced by ModStackAmount().

◆ RefreshTimersWithMods()

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

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 ( )
2104{
2105 m_procCooldown = std::chrono::steady_clock::now();
2106}

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 
)
1150{
1151 m_maxDuration = maxduration;
1152 m_duration = duration;
1153 m_procCharges = charges;
1155 m_stackAmount = stackamount;
1156 Unit* caster = GetCaster();
1157 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1158 if (m_effects[i])
1159 {
1160 m_effects[i]->SetAmount(amount[i]);
1161 m_effects[i]->SetCanBeRecalculated(recalculateMask & (1 << i));
1162 m_effects[i]->CalculatePeriodic(caster, false, true);
1164 m_effects[i]->RecalculateAmount(caster);
1165 }
1166}
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
1205{
1206 for (ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1207 appIter->second->SetNeedClientUpdate();
1208}

References m_applications.

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

◆ SetStackAmount()

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

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)
2757{
2758 m_triggeredByAuraSpellInfo = triggeredByAuraSpellInfo;
2759}

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 
)
2305{
2306 bool prevented = CallScriptProcHandlers(aurApp, eventInfo);
2307 if (!prevented)
2308 {
2309 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2310 {
2311 if (!(procEffectMask & (1 << i)))
2312 continue;
2313
2314 // OnEffectProc / AfterEffectProc hooks handled in AuraEffect::HandleProc()
2315 if (aurApp->HasEffect(i))
2316 GetEffect(i)->HandleProc(aurApp, eventInfo);
2317 }
2318
2319 CallScriptAfterProcHandlers(aurApp, eventInfo);
2320 }
2321
2322 ConsumeProcCharges(sSpellMgr->GetSpellProcEntry(GetId()));
2323}
bool HasEffect(uint8 effect) const
Definition SpellAuras.h:67
void HandleProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:1283
void CallScriptAfterProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2710
void ConsumeProcCharges(SpellProcEntry const *procEntry)
Definition SpellAuras.cpp:2325
bool CallScriptProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2693

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
292{
293 ASSERT_NODEBUGINFO(spellproto);
294 ASSERT_NODEBUGINFO(owner);
295 ASSERT_NODEBUGINFO(caster || casterGUID);
296 ASSERT_NODEBUGINFO(tryEffMask <= MAX_EFFECT_MASK);
297 uint8 effMask = Aura::BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
298 if (!effMask)
299 return nullptr;
300 return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID, itemGUID);
301}
static uint8 BuildEffectMaskForOwner(SpellInfo const *spellProto, uint8 avalibleEffectMask, WorldObject *owner)
Definition SpellAuras.cpp:237
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:303

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
266{
267 ASSERT_NODEBUGINFO(spellproto);
268 ASSERT_NODEBUGINFO(owner);
269 ASSERT_NODEBUGINFO(caster || casterGUID);
270 ASSERT_NODEBUGINFO(tryEffMask <= MAX_EFFECT_MASK);
271 if (refresh)
272 *refresh = false;
273 uint8 effMask = Aura::BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
274 if (!effMask)
275 return nullptr;
276 if (Aura* foundAura = owner->ToUnit()->_TryStackingOrRefreshingExistingAura(spellproto, effMask, caster, baseAmount, castItem, casterGUID, periodicReset))
277 {
278 // we've here aura, which script triggered removal after modding stack amount
279 // check the state here, so we won't create new Aura object
280 if (foundAura->IsRemoved())
281 return nullptr;
282
283 if (refresh)
284 *refresh = true;
285 return foundAura;
286 }
287 else
288 return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
289}
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:4609

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 ( )
1114{
1116 Unit* caster = GetCaster();
1117 if (!caster)
1118 {
1119 LOG_INFO("spells", "Aura::UnregisterSingleTarget: (A1) - {}, {}, {}, {}", GetId(), GetOwner()->GetTypeId(), GetOwner()->GetEntry(), GetOwner()->GetName());
1120 LOG_ERROR("spells", "Aura::UnregisterSingleTarget: No caster was found."); //ASSERT(caster);
1121 }
1122 else
1123 caster->GetSingleCastAuras().remove(this);
1124
1125 SetIsSingleTarget(false);
1126}
#define LOG_INFO(filterType__,...)
Definition Log.h:166
void SetIsSingleTarget(bool val)
Definition SpellAuras.h:167
AuraList & GetSingleCastAuras()
Definition Unit.h:1429
bool GetName(uint32 accountId, std::string &name)
Definition AccountMgr.cpp:264

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 
)
741{
742 if (m_duration > 0)
743 {
744 m_duration -= diff;
745 if (m_duration < 0)
746 m_duration = 0;
747
748 // handle ManaPerSecond/ManaPerSecondPerLevel
749 if (m_timeCla)
750 {
751 if (m_timeCla > int32(diff))
752 m_timeCla -= diff;
753 else if (caster)
754 {
755 if (int32 ManaPerSecond = m_spellInfo->ManaPerSecond + m_spellInfo->ManaPerSecondPerLevel * caster->GetLevel())
756 {
757 m_timeCla += 1000 - diff;
758
759 Powers powertype = Powers(m_spellInfo->PowerType);
760 if (powertype == POWER_HEALTH)
761 {
762 if (int32(caster->GetHealth()) > ManaPerSecond)
763 caster->ModifyHealth(-ManaPerSecond);
764 else
765 {
766 Remove();
767 return;
768 }
769 }
770 else
771 {
772 if (int32(caster->GetPower(powertype)) >= ManaPerSecond)
773 caster->ModifyPower(powertype, -ManaPerSecond);
774 else
775 {
776 Remove();
777 return;
778 }
779 }
780 }
781 }
782 }
783 }
784}
Powers
Definition SharedDefines.h:256
@ POWER_HEALTH
Definition SharedDefines.h:266
uint32 PowerType
Definition SpellInfo.h:386
int32 ModifyHealth(int32 val)
Definition Unit.cpp:10940
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:10998
uint32 GetHealth() const
Definition Unit.h:1108
uint32 GetPower(Powers power) const
Definition Unit.h:1135

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

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 Unit::_UpdateSpells(), and DynamicObject::Update().

◆ UpdateTargetMap()

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

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: