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
 
Unit * GetCaster () const
 
WorldObject * GetOwner () const
 
Unit * GetUnitOwner () const
 
DynamicObject * GetDynobjOwner () 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
 
AuraEffect * GetEffect (uint8 effIndex) const
 
uint8 GetEffectMask () const
 
void RecalculateAmountOfEffects ()
 
void HandleAllEffects (AuraApplication *aurApp, uint8 mode, bool apply)
 
ApplicationMap const & GetApplicationMap ()
 
void GetApplicationList (std::list< AuraApplication * > &applicationList) const
 
AuraApplication const * GetApplicationOfTarget (ObjectGuid guid) const
 
AuraApplication * GetApplicationOfTarget (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)
 
AuraScript * GetScriptByName (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 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 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 Aura * Create (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
 
AuraEffect * m_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

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

Detailed Description

Member Typedef Documentation

◆ ApplicationMap

Constructor & Destructor Documentation

◆ Aura()

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

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

◆ ~Aura()

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

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

Member Function Documentation

◆ _ApplyEffectForTargets()

void Aura::_ApplyEffectForTargets ( uint8  effIndex)
771{
772 // prepare list of aura targets
773 UnitList targetList;
774 for (ApplicationMap::iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
775 {
776 if ((appIter->second->GetEffectsToApply() & (1 << effIndex)) && !appIter->second->HasEffect(effIndex))
777 targetList.push_back(appIter->second->GetTarget());
778 }
779
780 // apply effect to targets
781 for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
782 {
783 if (GetApplicationOfTarget((*itr)->GetGUID()))
784 {
785 // owner has to be in world, or effect has to be applied to self
786 ASSERT((!GetOwner()->IsInWorld() && GetOwner() == *itr) || GetOwner()->IsInMap(*itr));
787 (*itr)->_ApplyAuraEffect(this, effIndex);
788 }
789 }
790}
std::list< Unit * > UnitList
Definition Unit.h:78
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
Definition SpellAuras.h:185
WorldObject * GetOwner() const
Definition SpellAuras.h:108

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

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

◆ _ApplyForTarget()

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

Reimplemented in UnitAura.

437{
438 ASSERT(target);
439 ASSERT(auraApp);
440 // aura mustn't be already applied on target
441 ASSERT (!IsAppliedOnTarget(target->GetGUID()) && "Aura::_ApplyForTarget: aura musn't be already applied on target");
442
443 m_applications[target->GetGUID()] = auraApp;
444
445 // set infinity cooldown state for spells
447 {
448 if (caster->IsPlayer())
449 {
450 caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, 0, nullptr, true);
451 }
452 else
453 {
455 }
456 }
457}
static constexpr uint32 infinityCooldownDelay
Definition Unit.h:47
bool IsAppliedOnTarget(ObjectGuid guid) const
Definition SpellAuras.h:187
void AddSpellCooldown(uint32 spell_id, uint32, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Creature.cpp:3008
bool IsPlayer() const
Definition Object.h:207
Player * ToPlayer()
Definition Object.h:208
Creature * ToCreature()
Definition Object.h:212
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
Definition Player.cpp:11089
bool IsCooldownStartedOnEvent() const
Definition SpellInfo.cpp:1257
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
2440{
2441 while (!m_removedApplications.empty())
2442 {
2443 delete m_removedApplications.front();
2444 m_removedApplications.pop_front();
2445 }
2446}
Unit::AuraApplicationList m_removedApplications
Definition SpellAuras.h:284

References m_removedApplications.

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

◆ _InitEffects()

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

References m_effects, and MAX_SPELL_EFFECTS.

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

◆ _RegisterForTargets()

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

References GetCaster(), and UpdateTargetMap().

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

◆ _Remove()

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

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

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

◆ _UnapplyForTarget()

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

Reimplemented in UnitAura.

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

References AddProcCooldown(), and SpellProcEntry::Cooldown.

◆ AddProcCooldown() [2/2]

void Aura::AddProcCooldown ( TimePoint  cooldownEnd)
2194{
2195 m_procCooldown = cooldownEnd;
2196}
TimePoint m_procCooldown
Definition SpellAuras.h:281

References m_procCooldown.

Referenced by AddProcCooldown(), and PrepareProcToTrigger().

◆ ApplyForTargets()

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

References GetCaster(), and UpdateTargetMap().

Referenced by Unit::AddAura().

◆ BuildEffectMaskForOwner()

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

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
1222{
1223 // we assume that aura dispel chance is 100% on start
1224 // need formula for level difference based chance
1225 int32 resistChance = 0;
1226
1227 // Apply dispel mod from aura caster
1228 if (Unit* caster = GetCaster())
1229 if (Player* modOwner = caster->GetSpellModOwner())
1230 modOwner->ApplySpellMod(GetId(), SPELLMOD_RESIST_DISPEL_CHANCE, resistChance);
1231
1232 // Dispel resistance from target SPELL_AURA_MOD_DISPEL_RESIST
1233 // Only affects offensive dispels
1234 if (offensive && auraTarget)
1235 resistChance += auraTarget->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
1236
1237 resistChance = resistChance < 0 ? 0 : resistChance;
1238 resistChance = resistChance > 100 ? 100 : resistChance;
1239 return 100 - resistChance;
1240}
std::int32_t int32
Definition Define.h:103
@ SPELL_AURA_MOD_DISPEL_RESIST
Definition SpellAuraDefines.h:298
@ SPELLMOD_RESIST_DISPEL_CHANCE
Definition SpellDefines.h:112
uint32 GetId() const
Definition SpellAuras.cpp:410
Player * GetSpellModOwner() const override
Definition Unit.cpp:12567
int32 GetTotalAuraModifier(AuraType auratype) const
Definition Unit.cpp:6050

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
997{
998 uint32 maxProcCharges = m_spellInfo->ProcCharges;
999 if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()))
1000 maxProcCharges = procEntry->Charges;
1001
1002 if (caster)
1003 if (Player* modOwner = caster->GetSpellModOwner())
1004 modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, maxProcCharges);
1005 return maxProcCharges;
1006}
@ SPELLMOD_CHARGES
Definition SpellDefines.h:88
#define sSpellMgr
Definition SpellMgr.h:847
uint32 ProcCharges
Definition SpellInfo.h:381
Definition SpellMgr.h:286

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

Referenced by AuraScript::CalcMaxCharges().

◆ CalcMaxDuration() [1/2]

int32 Aura::CalcMaxDuration ( ) const
inline

◆ CalcMaxDuration() [2/2]

int32 Aura::CalcMaxDuration ( Unit *  caster) const
880{
881 Player* modOwner = nullptr;
882 int32 maxDuration;
883
884 if (caster)
885 {
886 modOwner = caster->GetSpellModOwner();
887 maxDuration = caster->CalcSpellDuration(m_spellInfo);
888 }
889 else
890 maxDuration = m_spellInfo->GetDuration();
891
893 maxDuration = -1;
894
895 sScriptMgr->OnCalcMaxDuration(this, maxDuration);
896
897 // IsPermanent() checks max duration (which we are supposed to calculate here)
898 if (maxDuration != -1 && modOwner)
899 modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, maxDuration);
900 return maxDuration;
901}
#define sScriptMgr
Definition ScriptMgr.h:766
@ SPELLMOD_DURATION
Definition SpellDefines.h:85
bool IsPassive() const
Definition SpellAuras.cpp:1121
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
Definition Player.cpp:10013
SpellDurationEntry const * DurationEntry
Definition SpellInfo.h:385
int32 GetDuration() const
Definition SpellInfo.cpp:2764
int32 CalcSpellDuration(SpellInfo const *spellProto) const
Definition Object.cpp:3376

References Player::ApplySpellMod(), WorldObject::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
2366{
2367 float chance = procEntry.Chance;
2368 // calculate chances depending on unit with caster's data
2369 // so talents modifying chances and judgements will have properly calculated proc chance
2370 if (Unit* caster = GetCaster())
2371 {
2372 // If PPM exists calculate chance from PPM
2373 if ((eventInfo.GetDamageInfo() || eventInfo.GetHealInfo()) && procEntry.ProcsPerMinute != 0)
2374 {
2375 SpellInfo const* procSpell = eventInfo.GetSpellInfo();
2376 uint32 attackSpeed = 0;
2377 if (!procSpell || procSpell->DmgClass == SPELL_DAMAGE_CLASS_MELEE || procSpell->IsRangedWeaponSpell())
2378 {
2379 attackSpeed = caster->GetAttackTime(eventInfo.GetDamageInfo()->GetAttackType());
2380 }
2381 else // spells use their cast time for PPM calculations
2382 {
2383 if (procSpell->CastTimeEntry)
2384 attackSpeed = procSpell->CastTimeEntry->CastTime;
2385
2386 // instants and fast spells use 1.5s cast speed
2387 if (attackSpeed < 1500)
2388 attackSpeed = 1500;
2389 }
2390 chance = caster->GetPPMProcChance(attackSpeed, procEntry.ProcsPerMinute, GetSpellInfo());
2391 }
2392 // apply chance modifer aura, applies also to ppm chance (see improved judgement of light spell)
2393 if (Player* modOwner = caster->GetSpellModOwner())
2394 modOwner->ApplySpellMod(GetId(), SPELLMOD_CHANCE_OF_SUCCESS, chance);
2395 }
2396
2397 // proc chance is reduced by an additional 3.333% per level past 60
2398 if ((procEntry.AttributesMask & PROC_ATTR_REDUCE_PROC_60) && eventInfo.GetActor()->GetLevel() > 60)
2399 chance = std::max(0.f, (1.f - ((eventInfo.GetActor()->GetLevel() - 60) * 1.f / 30.f)) * chance);
2400
2401 return chance;
2402}
@ SPELL_DAMAGE_CLASS_MELEE
Definition SharedDefines.h:1551
@ SPELLMOD_CHANCE_OF_SUCCESS
Definition SpellDefines.h:102
@ PROC_ATTR_REDUCE_PROC_60
Definition SpellMgr.h:281
WeaponAttackType GetAttackType() const
Definition Unit.h:372
HealInfo * GetHealInfo() const
Definition Unit.h:471
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:301
Unit * GetActor()
Definition Unit.h:460
DamageInfo * GetDamageInfo() const
Definition Unit.h:470
Definition SpellInfo.h:340
SpellCastTimesEntry const * CastTimeEntry
Definition SpellInfo.h:371
uint32 DmgClass
Definition SpellInfo.h:413
bool IsRangedWeaponSpell() const
Definition SpellInfo.cpp:1321
uint8 GetLevel() const
Definition Unit.h:1109
int32 CastTime
Definition DBCStructure.h:1796

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 
)
2759{
2760 bool result = isTriggeredAtSpellProcEvent;
2761 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2762 {
2763 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_CHECK_PROC, aurApp);
2764 std::list<AuraScript::AfterCheckProcHandler>::iterator hookItrEnd = (*scritr)->DoAfterCheckProc.end(), hookItr = (*scritr)->DoAfterCheckProc.begin();
2765 for (; hookItr != hookItrEnd; ++hookItr)
2766 result &= hookItr->Call(*scritr, eventInfo, isTriggeredAtSpellProcEvent);
2767
2768 (*scritr)->_FinishScriptCall();
2769 }
2770
2771 return result;
2772}
@ AURA_SCRIPT_HOOK_AFTER_CHECK_PROC
Definition SpellScript.h:504

References AURA_SCRIPT_HOOK_AFTER_CHECK_PROC, and m_loadedScripts.

◆ CallScriptAfterDispel()

void Aura::CallScriptAfterDispel ( DispelInfo *  dispelInfo)
2496{
2497 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2498 {
2499 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_DISPEL);
2500 std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin();
2501 for (; hookItr != hookItrEnd; ++hookItr)
2502 hookItr->Call(*scritr, dispelInfo);
2503
2504 (*scritr)->_FinishScriptCall();
2505 }
2506}
@ AURA_SCRIPT_HOOK_AFTER_DISPEL
Definition SpellScript.h:500

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 
)
2548{
2549 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2550 {
2551 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp);
2552 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
2553 for (; effItr != effEndItr; ++effItr)
2554 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2555 effItr->Call(*scritr, aurEff, mode);
2556
2557 (*scritr)->_FinishScriptCall();
2558 }
2559}
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY
Definition SpellScript.h:485

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 
)
2843{
2844 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2845 {
2846 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC, aurApp);
2847 std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->AfterEffectProc.end(), effItr = (*scritr)->AfterEffectProc.begin();
2848 for (; effItr != effEndItr; ++effItr)
2849 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2850 effItr->Call(*scritr, aurEff, eventInfo);
2851
2852 (*scritr)->_FinishScriptCall();
2853 }
2854}
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC
Definition SpellScript.h:508

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 
)
2562{
2563 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2564 {
2565 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp);
2566 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
2567 for (; effItr != effEndItr; ++effItr)
2568 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2569 effItr->Call(*scritr, aurEff, mode);
2570
2571 (*scritr)->_FinishScriptCall();
2572 }
2573}
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE
Definition SpellScript.h:487

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 
)
2811{
2812 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2813 {
2814 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_PROC, aurApp);
2815 std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->AfterProc.end(), hookItr = (*scritr)->AfterProc.begin();
2816 for (; hookItr != hookItrEnd; ++hookItr)
2817 hookItr->Call(*scritr, eventInfo);
2818
2819 (*scritr)->_FinishScriptCall();
2820 }
2821}
@ AURA_SCRIPT_HOOK_AFTER_PROC
Definition SpellScript.h:509

References AURA_SCRIPT_HOOK_AFTER_PROC, and m_loadedScripts.

Referenced by TriggerProcOnEvent().

◆ CallScriptCheckAreaTargetHandlers()

bool Aura::CallScriptCheckAreaTargetHandlers ( Unit *  target)
2468{
2469 bool result = true;
2470 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2471 {
2472 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_AREA_TARGET);
2473 std::list<AuraScript::CheckAreaTargetHandler>::iterator hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin();
2474 for (; hookItr != hookItrEnd; ++hookItr)
2475 result &= hookItr->Call(*scritr, target);
2476
2477 (*scritr)->_FinishScriptCall();
2478 }
2479 return result;
2480}
@ AURA_SCRIPT_HOOK_CHECK_AREA_TARGET
Definition SpellScript.h:498

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 
)
2742{
2743 bool result = true;
2744 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2745 {
2746 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_EFFECT_PROC, aurApp);
2747 std::list<AuraScript::CheckEffectProcHandler>::iterator effEndItr = (*scritr)->DoCheckEffectProc.end(), effItr = (*scritr)->DoCheckEffectProc.begin();
2748 for (; effItr != effEndItr; ++effItr)
2749 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2750 result &= effItr->Call(*scritr, aurEff, eventInfo);
2751
2752 (*scritr)->_FinishScriptCall();
2753 }
2754
2755 return result;
2756}
@ AURA_SCRIPT_HOOK_CHECK_EFFECT_PROC
Definition SpellScript.h:503

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 
)
2726{
2727 bool result = true;
2728 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2729 {
2730 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_PROC, aurApp);
2731 std::list<AuraScript::CheckProcHandler>::iterator hookItrEnd = (*scritr)->DoCheckProc.end(), hookItr = (*scritr)->DoCheckProc.begin();
2732 for (; hookItr != hookItrEnd; ++hookItr)
2733 result &= hookItr->Call(*scritr, eventInfo);
2734
2735 (*scritr)->_FinishScriptCall();
2736 }
2737
2738 return result;
2739}
@ AURA_SCRIPT_HOOK_CHECK_PROC
Definition SpellScript.h:502

References AURA_SCRIPT_HOOK_CHECK_PROC, and m_loadedScripts.

Referenced by GetProcEffectMask().

◆ CallScriptDispel()

void Aura::CallScriptDispel ( DispelInfo *  dispelInfo)
2483{
2484 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2485 {
2486 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_DISPEL);
2487 std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin();
2488 for (; hookItr != hookItrEnd; ++hookItr)
2489 hookItr->Call(*scritr, dispelInfo);
2490
2491 (*scritr)->_FinishScriptCall();
2492 }
2493}
@ AURA_SCRIPT_HOOK_DISPEL
Definition SpellScript.h:499

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 
)
2652{
2653 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2654 {
2655 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp);
2656 std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
2657 for (; effItr != effEndItr; ++effItr)
2658
2659 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2660 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2661
2662 if (!defaultPrevented)
2663 defaultPrevented = (*scritr)->_IsDefaultActionPrevented();
2664
2665 (*scritr)->_FinishScriptCall();
2666 }
2667}
@ AURA_SCRIPT_HOOK_EFFECT_ABSORB
Definition SpellScript.h:493
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 
)
2670{
2671 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2672 {
2673 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp);
2674 std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
2675 for (; effItr != effEndItr; ++effItr)
2676 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2677 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2678
2679 (*scritr)->_FinishScriptCall();
2680 }
2681}
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB
Definition SpellScript.h:494

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 
)
2698{
2699 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2700 {
2701 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp);
2702 std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
2703 for (; effItr != effEndItr; ++effItr)
2704 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2705 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2706
2707 (*scritr)->_FinishScriptCall();
2708 }
2709}
@ AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD
Definition SpellScript.h:496

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 
)
2509{
2510 bool preventDefault = false;
2511 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2512 {
2513 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp);
2514 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
2515 for (; effItr != effEndItr; ++effItr)
2516 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2517 effItr->Call(*scritr, aurEff, mode);
2518
2519 if (!preventDefault)
2520 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2521
2522 (*scritr)->_FinishScriptCall();
2523 }
2524
2525 return preventDefault;
2526}
@ AURA_SCRIPT_HOOK_EFFECT_APPLY
Definition SpellScript.h:484

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 
)
2610{
2611 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2612 {
2613 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT);
2614 std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
2615 for (; effItr != effEndItr; ++effItr)
2616 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2617 effItr->Call(*scritr, aurEff, amount, canBeRecalculated);
2618
2619 (*scritr)->_FinishScriptCall();
2620 }
2621}
@ AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT
Definition SpellScript.h:490

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 
)
2624{
2625 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2626 {
2627 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC);
2628 std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
2629 for (; effItr != effEndItr; ++effItr)
2630 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2631 effItr->Call(*scritr, aurEff, isPeriodic, amplitude);
2632
2633 (*scritr)->_FinishScriptCall();
2634 }
2635}
@ AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC
Definition SpellScript.h:491

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 
)
2638{
2639 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2640 {
2641 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD);
2642 std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
2643 for (; effItr != effEndItr; ++effItr)
2644 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2645 effItr->Call(*scritr, aurEff, spellMod);
2646
2647 (*scritr)->_FinishScriptCall();
2648 }
2649}
@ AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD
Definition SpellScript.h:492

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 
)
2684{
2685 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2686 {
2687 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp);
2688 std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
2689 for (; effItr != effEndItr; ++effItr)
2690 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2691 effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2692
2693 (*scritr)->_FinishScriptCall();
2694 }
2695}
@ AURA_SCRIPT_HOOK_EFFECT_MANASHIELD
Definition SpellScript.h:495

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 
)
2576{
2577 bool preventDefault = false;
2578 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2579 {
2580 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp);
2581 std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
2582 for (; effItr != effEndItr; ++effItr)
2583 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2584 effItr->Call(*scritr, aurEff);
2585
2586 if (!preventDefault)
2587 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2588
2589 (*scritr)->_FinishScriptCall();
2590 }
2591
2592 return preventDefault;
2593}
@ AURA_SCRIPT_HOOK_EFFECT_PERIODIC
Definition SpellScript.h:488

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 
)
2824{
2825 bool preventDefault = false;
2826 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2827 {
2828 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PROC, aurApp);
2829 std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->OnEffectProc.end(), effItr = (*scritr)->OnEffectProc.begin();
2830 for (; effItr != effEndItr; ++effItr)
2831 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2832 effItr->Call(*scritr, aurEff, eventInfo);
2833
2834 if (!preventDefault)
2835 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2836
2837 (*scritr)->_FinishScriptCall();
2838 }
2839 return preventDefault;
2840}
@ AURA_SCRIPT_HOOK_EFFECT_PROC
Definition SpellScript.h:507

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 
)
2529{
2530 bool preventDefault = false;
2531 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2532 {
2533 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp);
2534 std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
2535 for (; effItr != effEndItr; ++effItr)
2536 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2537 effItr->Call(*scritr, aurEff, mode);
2538
2539 if (!preventDefault)
2540 preventDefault = (*scritr)->_IsDefaultActionPrevented();
2541
2542 (*scritr)->_FinishScriptCall();
2543 }
2544 return preventDefault;
2545}
@ AURA_SCRIPT_HOOK_EFFECT_REMOVE
Definition SpellScript.h:486

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 
)
2712{
2713 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2714 {
2715 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_SPLIT, aurApp);
2716 std::list<AuraScript::EffectSplitHandler>::iterator effEndItr = (*scritr)->OnEffectSplit.end(), effItr = (*scritr)->OnEffectSplit.begin();
2717 for (; effItr != effEndItr; ++effItr)
2718 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2719 effItr->Call(*scritr, aurEff, dmgInfo, splitAmount);
2720
2721 (*scritr)->_FinishScriptCall();
2722 }
2723}
@ AURA_SCRIPT_HOOK_EFFECT_SPLIT
Definition SpellScript.h:497

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

◆ CallScriptEffectUpdatePeriodicHandlers()

void Aura::CallScriptEffectUpdatePeriodicHandlers ( AuraEffect *  aurEff)
2596{
2597 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2598 {
2599 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC);
2600 std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
2601 for (; effItr != effEndItr; ++effItr)
2602 if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2603 effItr->Call(*scritr, aurEff);
2604
2605 (*scritr)->_FinishScriptCall();
2606 }
2607}
@ AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC
Definition SpellScript.h:489

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 
)
2775{
2776 bool prepare = true;
2777 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2778 {
2779 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PREPARE_PROC, aurApp);
2780 std::list<AuraScript::AuraProcHandler>::iterator effEndItr = (*scritr)->DoPrepareProc.end(), effItr = (*scritr)->DoPrepareProc.begin();
2781 for (; effItr != effEndItr; ++effItr)
2782 effItr->Call(*scritr, eventInfo);
2783
2784 if (prepare)
2785 prepare = !(*scritr)->_IsDefaultActionPrevented();
2786
2787 (*scritr)->_FinishScriptCall();
2788 }
2789
2790 return prepare;
2791}
@ AURA_SCRIPT_HOOK_PREPARE_PROC
Definition SpellScript.h:505

References AURA_SCRIPT_HOOK_PREPARE_PROC, and m_loadedScripts.

Referenced by PrepareProcToTrigger().

◆ CallScriptProcHandlers()

bool Aura::CallScriptProcHandlers ( AuraApplication const *  aurApp,
ProcEventInfo &  eventInfo 
)
2794{
2795 bool handled = false;
2796 for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2797 {
2798 (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PROC, aurApp);
2799 std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->OnProc.end(), hookItr = (*scritr)->OnProc.begin();
2800 for (; hookItr != hookItrEnd; ++hookItr)
2801 hookItr->Call(*scritr, eventInfo);
2802
2803 handled |= (*scritr)->_IsDefaultActionPrevented();
2804 (*scritr)->_FinishScriptCall();
2805 }
2806
2807 return handled;
2808}
@ AURA_SCRIPT_HOOK_PROC
Definition SpellScript.h:506

References AURA_SCRIPT_HOOK_PROC, and m_loadedScripts.

Referenced by TriggerProcOnEvent().

◆ CanBeAppliedOn()

bool Aura::CanBeAppliedOn ( Unit *  target)
1978{
1979 // unit not in world or during remove from world
1980 if (!target->IsInWorld() || target->IsDuringRemoveFromWorld())
1981 {
1982 // area auras mustn't be applied
1983 if (GetOwner() != target)
1984 return false;
1985 // not selfcasted single target auras mustn't be applied
1986 if (GetCasterGUID() != GetOwner()->GetGUID() && GetSpellInfo()->IsSingleTarget())
1987 return false;
1988 return true;
1989 }
1990 else
1991 return CheckAreaTarget(target);
1992}
bool CheckAreaTarget(Unit *target)
Definition SpellAuras.cpp:1994
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:106
bool IsSingleTarget() const
Definition SpellAuras.h:166
bool IsInWorld() const
Definition Object.h:115
bool IsDuringRemoveFromWorld() const
Definition Unit.h:704

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

Referenced by UpdateTargetMap().

◆ CanBeSaved()

bool Aura::CanBeSaved ( ) const
1137{
1138 SpellInfo const* spellInfo = GetSpellInfo();
1139
1141 {
1142 return true;
1143 }
1144
1146 {
1147 return false;
1148 }
1149
1150 if (IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_DO_NOT_DISPLAY) && spellInfo->Stances))
1151 {
1152 return false;
1153 }
1154
1155 // Xinef: do not save channel auras
1156 if (GetSpellInfo()->IsChanneled())
1157 {
1158 return false;
1159 }
1160
1161 // Xinef: Check if aura is single target, not only spell info
1162 if (GetCasterGUID() != GetOwner()->GetGUID() && (GetSpellInfo()->IsSingleTarget() || IsSingleTarget()))
1163 {
1164 return false;
1165 }
1166
1167 // don't save auras removed by proc system
1168 if (IsUsingCharges() && !GetCharges())
1169 {
1170 return false;
1171 }
1172
1173 return true;
1174}
@ 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:201
uint8 GetCharges() const
Definition SpellAuras.h:142
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
1177{
1179}
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
Definition SpellAuraDefines.h:325
bool HasEffectType(AuraType type) const
Definition SpellAuras.cpp:1262
bool HasAreaAuraEffect() const
Definition SpellInfo.cpp:922

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

Referenced by Spell::EffectSummonPet().

◆ CanStackWith()

bool Aura::CanStackWith ( Aura const *  existingAura) const
2029{
2030 // Can stack with self
2031 if (this == existingAura)
2032 return true;
2033
2034 SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo();
2035 bool sameCaster = GetCasterGUID() == existingAura->GetCasterGUID();
2036
2037 // Dynobj auras always stack
2038 // xinef: dont allow different ranks (or the same rank) of same spell to stack (many flamestrikes for example)
2039 if (existingAura->GetType() == DYNOBJ_AURA_TYPE)
2040 {
2041 // xinef: desecration lag fix - bound this condition to periodics
2042 if (sameCaster && GetSpellInfo()->Id == existingSpellInfo->Id && GetSpellInfo()->HasAura(SPELL_AURA_PERIODIC_DAMAGE))
2043 return false;
2044 return true;
2045 }
2046
2047 // passive auras don't stack with another rank of the spell cast by same caster
2048 // Exception: item-sourced auras from different items can stack (e.g., weapon imbues on MH/OH)
2049 if (IsPassive() && sameCaster && (m_spellInfo->IsDifferentRankOf(existingSpellInfo) || (m_spellInfo->Id == existingSpellInfo->Id && m_castItemGuid.IsEmpty())))
2050 {
2051 // Allow stacking if both auras are from different items
2052 if (!(GetCastItemGUID() && existingAura->GetCastItemGUID() && GetCastItemGUID() != existingAura->GetCastItemGUID()))
2053 return false;
2054 }
2055
2056 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2057 {
2058 // prevent remove triggering aura by triggered aura
2059 if (existingSpellInfo->Effects[i].TriggerSpell == GetId()
2060 // prevent remove triggered aura by triggering aura refresh
2061 || m_spellInfo->Effects[i].TriggerSpell == existingAura->GetId())
2062 return true;
2063 }
2064
2065 // check spell specific stack rules
2066 if (m_spellInfo->IsAuraExclusiveBySpecificWith(existingSpellInfo)
2067 || (sameCaster && m_spellInfo->IsAuraExclusiveBySpecificPerCasterWith(existingSpellInfo)))
2068 return false;
2069
2070 // check spell group stack rules
2071 switch (sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo))
2072 {
2074 case SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST: // if it reaches this point, existing aura is lower/equal
2075 return false;
2077 if (sameCaster)
2078 return false;
2079 break;
2082 default:
2083 break;
2084 }
2085
2086 if (m_spellInfo->SpellFamilyName != existingSpellInfo->SpellFamilyName)
2087 return true;
2088
2089 if (!sameCaster)
2090 {
2091 // Channeled auras can stack if not forbidden by db or aura type
2092 if (existingAura->GetSpellInfo()->IsChanneled())
2093 return true;
2094
2096 return true;
2097
2098 // check same periodic auras
2099 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2100 {
2101 switch (m_spellInfo->Effects[i].ApplyAuraName)
2102 {
2103 // DOT or HOT from different casters will stack
2115 // periodic auras which target areas are not allowed to stack this way (replenishment for example)
2116 if (m_spellInfo->Effects[i].IsTargetingArea() || existingSpellInfo->Effects[i].IsTargetingArea())
2117 break;
2118 return true;
2119 default:
2120 break;
2121 }
2122 }
2123 }
2124
2125 uint8 VehicleAura1 = 0;
2126 uint8 VehicleAura2 = 0;
2127 uint8 i = 0;
2128 while (i < MAX_SPELL_EFFECTS && !(VehicleAura1 && VehicleAura2))
2129 {
2130 if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
2131 VehicleAura1 = i + 1;
2132 if (existingSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
2133 VehicleAura2 = i + 1;
2134
2135 ++i;
2136 }
2137
2138 if (VehicleAura1 && VehicleAura2)
2139 {
2140 Vehicle* veh = nullptr;
2141 if (GetOwner()->ToUnit())
2142 veh = GetOwner()->ToUnit()->GetVehicleKit();
2143
2144 if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
2145 return true;
2146
2147 // xinef: allow direct auras to stack if there is no passenger in this slot
2148 if (AuraEffect* aurEff = GetEffect(VehicleAura1 - 1))
2149 if (aurEff->GetAmount() > 0)
2150 if (!veh->GetPassenger(aurEff->GetAmount() - 1))
2151 return true;
2152
2153 if (!veh->GetAvailableSeatCount())
2154 return false; // No empty seat available
2155
2156 return true; // Empty seat available (skip rest)
2157 }
2158
2159 // spell of same spell rank chain
2160 if (m_spellInfo->IsRankOf(existingSpellInfo) && !(m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellInfo->SpellFamilyFlags[1] & 0x80000000))
2161 {
2162 // Each paladin's aura applies independently to group members (Aura Mastery and the
2163 // improved-aura talents depend on the caster's own aura being applied); only the
2164 // strongest keeps its effects on a shared target, see Aura::UpdateTargetMap.
2165 if (!sameCaster && m_spellInfo->GetSpellSpecific() == SPELL_SPECIFIC_AURA)
2166 return true;
2167
2168 // don't allow passive area auras to stack
2169 if (m_spellInfo->IsMultiSlotAura() && !IsArea())
2170 return true;
2171
2172 // Allow item-sourced auras from different items to stack (e.g., weapon imbues on MH/OH, enchant procs)
2173 if ((IsPassive() || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC)) && GetCastItemGUID() && existingAura->GetCastItemGUID() && GetCastItemGUID() != existingAura->GetCastItemGUID())
2174 return true;
2175
2176 // same spell with same caster should not stack
2177 return false;
2178 }
2179
2180 return true;
2181}
@ SPELL_ATTR3_DOT_STACKING_RULE
Definition SharedDefines.h:488
@ SPELLFAMILY_HUNTER
Definition SharedDefines.h:3793
@ SPELL_AURA_PERIODIC_DAMAGE
Definition SpellAuraDefines.h:66
@ SPELL_AURA_OBS_MOD_HEALTH
Definition SpellAuraDefines.h:83
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition SpellAuraDefines.h:127
@ SPELL_AURA_OBS_MOD_POWER
Definition SpellAuraDefines.h:84
@ SPELL_AURA_CONTROL_VEHICLE
Definition SpellAuraDefines.h:299
@ SPELL_AURA_PERIODIC_HEAL
Definition SpellAuraDefines.h:71
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
Definition SpellAuraDefines.h:290
@ SPELL_AURA_PERIODIC_ENERGIZE
Definition SpellAuraDefines.h:87
@ SPELL_AURA_PERIODIC_LEECH
Definition SpellAuraDefines.h:116
@ SPELL_AURA_POWER_BURN
Definition SpellAuraDefines.h:225
@ SPELL_AURA_PERIODIC_DUMMY
Definition SpellAuraDefines.h:289
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
Definition SpellAuraDefines.h:86
@ DYNOBJ_AURA_TYPE
Definition SpellAuraDefines.h:386
@ SPELL_ATTR0_CU_ENCHANT_PROC
Definition SpellInfo.h:177
@ SPELL_SPECIFIC_AURA
Definition SpellInfo.h:153
@ 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:1111
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:177
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:104
bool IsEmpty() const
Definition ObjectGuid.h:165
Unit * ToUnit()
Definition Object.h:216
bool IsRankOf(SpellInfo const *spellInfo) const
Definition SpellInfo.cpp:3006
flag96 SpellFamilyFlags
Definition SpellInfo.h:412
bool IsAuraExclusiveBySpecificPerCasterWith(SpellInfo const *spellInfo) const
Definition SpellInfo.cpp:1449
bool IsAuraExclusiveBySpecificWith(SpellInfo const *spellInfo) const
Definition SpellInfo.cpp:1406
SpellSpecificType GetSpellSpecific() const
Definition SpellInfo.cpp:2076
bool IsMultiSlotAura() const
Definition SpellInfo.cpp:1252
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
bool IsDifferentRankOf(SpellInfo const *spellInfo) const
Definition SpellInfo.cpp:3011
uint32 SpellFamilyName
Definition SpellInfo.h:411
Vehicle * GetVehicleKit() const
Definition Unit.h:1931
Definition Vehicle.h:28
uint8 GetAvailableSeatCount() const
Definition Vehicle.cpp:676
Unit * GetPassenger(int8 seatId) const
Definition Vehicle.cpp:253

References DYNOBJ_AURA_TYPE, SpellInfo::Effects, Vehicle::GetAvailableSeatCount(), GetCasterGUID(), GetCastItemGUID(), GetEffect(), GetId(), GetOwner(), Vehicle::GetPassenger(), GetSpellInfo(), SpellInfo::GetSpellSpecific(), 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, SPELL_SPECIFIC_AURA, SPELLFAMILY_HUNTER, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, sSpellMgr, and Object::ToUnit().

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

◆ CheckAreaTarget()

bool Aura::CheckAreaTarget ( Unit *  target)
1995{
1996 return CallScriptCheckAreaTargetHandlers(target);
1997}
bool CallScriptCheckAreaTargetHandlers(Unit *target)
Definition SpellAuras.cpp:2467

References CallScriptCheckAreaTargetHandlers().

Referenced by CanBeAppliedOn().

◆ ConsumeProcCharges()

void Aura::ConsumeProcCharges ( SpellProcEntry const *  procEntry)
2426{
2427 // Remove aura if we've used last charge to proc
2428 if (procEntry->AttributesMask & PROC_ATTR_USE_STACKS_FOR_CHARGES)
2429 {
2430 ModStackAmount(-1);
2431 }
2432 else if (IsUsingCharges())
2433 {
2434 if (!GetCharges())
2435 Remove();
2436 }
2437}
@ 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:1056
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0

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

Referenced by TriggerProcOnEvent().

◆ Create()

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

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

Referenced by TryCreate(), and TryRefreshStackOrCreate().

◆ DropCharge()

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

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
1290{
1291 for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1292 {
1293 if (appIter->second->GetEffectMask())
1294 applicationList.push_back(appIter->second);
1295 }
1296}

References m_applications.

Referenced by SetStackAmount().

◆ GetApplicationMap()

ApplicationMap const & Aura::GetApplicationMap ( )
inline

◆ GetApplicationOfTarget() [1/2]

AuraApplication * Aura::GetApplicationOfTarget ( ObjectGuid  guid)
inline
186{ 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
105{ return m_castItemEntry; }

References m_castItemEntry.

◆ GetCastItemGUID()

◆ GetCharges()

◆ GetDebugInfo()

std::string Aura::GetDebugInfo ( ) const
virtual
2862{
2863 std::stringstream sstr;
2864 sstr << std::boolalpha
2865 << "Id: " << GetId() << " Caster: " << GetCasterGUID().ToString()
2866 << "\nOwner: " << (GetOwner() ? GetOwner()->GetDebugInfo() : "NULL");
2867 return sstr.str();
2868}
std::string GetDebugInfo() const override
Definition Object.cpp:2596

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

◆ GetDuration()

◆ GetDynobjOwner()

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

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

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

◆ GetEffect()

◆ GetEffectMask()

◆ GetId()

◆ GetMaxDuration()

◆ GetOwner()

◆ GetProcEffectMask()

uint8 Aura::GetProcEffectMask ( AuraApplication *  aurApp,
ProcEventInfo &  eventInfo,
TimePoint  now 
) const
2230{
2231 SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId());
2232
2233 // only auras with spell proc entry can trigger proc
2234 if (!procEntry)
2235 return 0;
2236
2237 // check spell triggering us
2238 if (Spell const* spell = eventInfo.GetProcSpell())
2239 {
2240 // Do not allow auras to proc from effect triggered from itself
2241 if (spell->GetTriggeredByAuraSpellInfo() == m_spellInfo)
2242 return 0;
2243
2244 // check if aura can proc when spell is triggered (exception for hunter auto shot & wands)
2245 // Kill/killed/death events should not be blocked by the triggered-spell check -
2246 // the kill itself is the proc trigger, not the spell that dealt the killing blow
2247 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_CAN_PROC_FROM_PROCS) &&
2249 !(eventInfo.GetTypeMask() & AUTO_ATTACK_PROC_FLAG_MASK) &&
2251 {
2252 if (spell->IsTriggered() && !spell->GetSpellInfo()->HasAttribute(SPELL_ATTR3_NOT_A_PROC))
2253 return 0;
2254 }
2255
2256 // do not allow aura proc if proc is caused by a spell cast by item
2257 if (spell->m_CastItem && (procEntry->AttributesMask & PROC_ATTR_CANT_PROC_FROM_ITEM_CAST))
2258 return 0;
2259 }
2260
2261 // Don't consume stealth charges from friendly spells
2263 {
2264 if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
2265 if (spellInfo->IsPositive() || !eventInfo.GetActor()->IsHostileTo(aurApp->GetTarget()) || spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH))
2266 return 0;
2267 }
2268
2269 // check if we have charges to proc with
2270 if (IsUsingCharges() && !GetCharges())
2271 return 0;
2272
2273 // check proc cooldown
2274 if (IsProcOnCooldown(now))
2275 return 0;
2276
2277 // do checks against db data
2278 if (!sSpellMgr->CanSpellTriggerProcOnEvent(*procEntry, eventInfo))
2279 return 0;
2280
2281 // check if spell was affected by this aura's spellmod (used by Arcane Potency and similar effects)
2282 // only applies when consuming charges or stacks
2284 {
2285 Spell const* procSpell = eventInfo.GetProcSpell();
2286 if (!procSpell || procSpell->m_appliedMods.find(const_cast<Aura*>(this)) == procSpell->m_appliedMods.end())
2287 return 0;
2288 }
2289
2290 // do checks using conditions table
2291 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, GetId());
2292 ConditionSourceInfo condInfo = ConditionSourceInfo(eventInfo.GetActor(), eventInfo.GetActionTarget());
2293 if (!sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
2294 return 0;
2295
2296 // AuraScript Hook
2297 if (!const_cast<Aura*>(this)->CallScriptCheckProcHandlers(aurApp, eventInfo))
2298 return 0;
2299
2300 // At least one effect has to pass checks to proc aura
2301 uint8 procEffectMask = aurApp->GetEffectMask();
2302 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2303 {
2304 if (AuraEffect* aurEff = GetEffect(i))
2305 {
2306 if (procEffectMask & (1 << i))
2307 {
2308 if ((procEntry->DisableEffectsMask & (1u << i)) || !aurEff->CheckEffectProc(aurApp, eventInfo))
2309 procEffectMask &= ~(1 << i);
2310 }
2311 }
2312 }
2313
2314 if (!procEffectMask)
2315 return 0;
2316
2317 // Check if current equipment meets aura requirements
2318 // do that only for passive spells
2319 Unit* target = aurApp->GetTarget();
2320 if (IsPassive() && target->IsPlayer() && GetSpellInfo()->EquippedItemClass != -1)
2321 {
2323 {
2324 Item* item = nullptr;
2326 {
2327 if (target->ToPlayer()->IsInFeralForm())
2328 return 0;
2329
2330 if (DamageInfo const* damageInfo = eventInfo.GetDamageInfo())
2331 {
2332 switch (damageInfo->GetAttackType())
2333 {
2334 case BASE_ATTACK:
2336 break;
2337 case OFF_ATTACK:
2339 break;
2340 default:
2342 break;
2343 }
2344 }
2345 }
2347 {
2348 // Check if player is wearing shield
2350 }
2351
2352 if (!item || item->IsBroken() || !item->IsFitToSpellRequirements(GetSpellInfo()))
2353 return 0;
2354 }
2355 }
2356
2357 float procChance = CalcProcChance(*procEntry, eventInfo);
2358
2359 if (roll_chance_f(procChance))
2360 return procEffectMask;
2361
2362 return 0;
2363}
#define sConditionMgr
Definition ConditionMgr.h:296
@ CONDITION_SOURCE_TYPE_SPELL_PROC
Definition ConditionMgr.h:150
std::list< Condition * > ConditionList
Definition ConditionMgr.h:240
@ ITEM_CLASS_ARMOR
Definition ItemTemplate.h:295
@ ITEM_CLASS_WEAPON
Definition ItemTemplate.h:293
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:677
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:678
@ EQUIPMENT_SLOT_RANGED
Definition Player.h:679
#define INVENTORY_SLOT_BAG_0
Definition Player.h:657
bool roll_chance_f(float chance)
Definition Random.h:57
@ SPELL_ATTR3_NOT_A_PROC
Definition SharedDefines.h:490
@ SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT
Definition SharedDefines.h:482
@ SPELL_ATTR3_CAN_PROC_FROM_PROCS
Definition SharedDefines.h:507
@ SPELL_AURA_MOD_STEALTH
Definition SpellAuraDefines.h:79
@ SPELL_ATTR0_CU_DONT_BREAK_STEALTH
Definition SpellInfo.h:183
@ PROC_ATTR_CANT_PROC_FROM_ITEM_CAST
Definition SpellMgr.h:282
@ PROC_ATTR_TRIGGERED_CAN_PROC
Definition SpellMgr.h:277
@ PROC_ATTR_REQ_SPELLMOD
Definition SpellMgr.h:279
@ AUTO_ATTACK_PROC_FLAG_MASK
Definition SpellMgr.h:149
@ PROC_FLAG_KILLED
Definition SpellMgr.h:110
@ PROC_FLAG_DEATH
Definition SpellMgr.h:146
@ PROC_FLAG_KILL
Definition SpellMgr.h:111
@ OFF_ATTACK
Definition Unit.h:217
@ BASE_ATTACK
Definition Unit.h:216
uint8 GetEffectMask() const
Definition SpellAuras.h:67
bool CallScriptCheckProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2725
float CalcProcChance(SpellProcEntry const &procEntry, ProcEventInfo &eventInfo) const
Definition SpellAuras.cpp:2365
bool IsProcOnCooldown(TimePoint now) const
Definition SpellAuras.cpp:2183
Definition Unit.h:337
Definition Item.h:220
bool IsBroken() const
Definition Item.h:257
bool IsFitToSpellRequirements(SpellInfo const *spellInfo) const
Definition Item.cpp:885
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
Definition Player.h:1270
Unit * GetActionTarget() const
Definition Unit.h:461
Spell const * GetProcSpell() const
Definition Unit.h:469
uint32 GetTypeMask() const
Definition Unit.h:463
int32 EquippedItemClass
Definition SpellInfo.h:399
bool HasAura(AuraType aura) const
Definition SpellInfo.cpp:906
Definition Spell.h:298
UsedSpellMods m_appliedMods
Definition Spell.h:560
bool IsInFeralForm() const
Definition Unit.h:1966
bool IsHostileTo(Unit const *unit) const
Definition Unit.cpp:7038
Definition ConditionMgr.h:185
uint32 AttributesMask
Definition SpellMgr.h:294
uint32 DisableEffectsMask
Definition SpellMgr.h:295

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

◆ GetScript()

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

References GetScriptByName().

◆ GetScriptByName()

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

References m_loadedScripts.

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

◆ GetSpellInfo()

SpellInfo const * Aura::GetSpellInfo ( ) const
inline
101{ 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::RestoreSpellMods(), ArenaSpectator::ShouldSendAura(), Unit::SpellPctDamageModsDone(), and UpdateTargetMap().

◆ GetStackAmount()

◆ GetTriggeredByAuraSpellInfo()

SpellInfo const * Aura::GetTriggeredByAuraSpellInfo ( ) const

◆ GetType()

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

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

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
1102{
1103 uint32 count = 0;
1104 for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects())
1105 if (HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.ApplyAuraName == auraType)
1106 ++count;
1107
1108 return count > 1;
1109}
Definition SpellInfo.h:270

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

Referenced by Unit::IsHighestExclusiveAuraEffect().

◆ IsAppliedOnTarget()

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

References m_applications.

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

◆ IsArea()

bool Aura::IsArea ( ) const
1112{
1113 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1114 {
1115 if (HasEffect(i) && GetSpellInfo()->Effects[i].IsAreaAuraEffect())
1116 return true;
1117 }
1118 return false;
1119}

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

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

◆ IsAuraStronger()

bool Aura::IsAuraStronger ( Aura const *  newAura) const
2000{
2001 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
2002 {
2003 AuraEffect* thisEffect = GetEffect(i);
2004 if (!thisEffect)
2005 continue;
2006
2007 AuraEffect* newEffect = nullptr;
2008 for (uint8 j = EFFECT_0; j < MAX_SPELL_EFFECTS; ++j)
2009 {
2010 newEffect = newAura->GetEffect(j);
2011 if (!newEffect || thisEffect->GetAuraType() != newEffect->GetAuraType() || thisEffect->GetMiscValue() != newEffect->GetMiscValue())
2012 continue;
2013
2014 // xinef: assume that all spells are either positive or negative, otherwise they should not be in one group
2015 int32 curValue = std::abs(thisEffect->GetAmount());
2016 if (curValue < std::abs(newEffect->GetAmount()))
2017 return true;
2018
2019 if (curValue == std::abs(newEffect->GetAmount()))
2020 if (!IsPassive() && !IsPermanent() && GetDuration() < newAura->GetDuration())
2021 return true;
2022 }
2023 }
2024
2025 return false;
2026}
AuraType GetAuraType() const
Definition SpellAuraEffects.cpp:447
int32 GetMiscValue() const
Definition SpellAuraEffects.cpp:442
int32 GetDuration() const
Definition SpellAuras.h:134
bool IsPermanent() const
Definition SpellAuras.h:140

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

◆ IsDeathPersistent()

bool Aura::IsDeathPersistent ( ) const
1127{
1128 return GetSpellInfo()->IsDeathPersistent();
1129}
bool IsDeathPersistent() const
Definition SpellInfo.cpp:1262

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
2184{
2185 if (GetType() == UNIT_AURA_TYPE)
2186 if (Player* player = GetUnitOwner()->ToPlayer())
2187 if (player->GetCommandStatus(CHEAT_COOLDOWN))
2188 return false;
2189
2190 return m_procCooldown > now;
2191}
@ CHEAT_COOLDOWN
Definition Player.h:999

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

Referenced by GetProcEffectMask().

◆ IsRemoved()

◆ IsRemovedOnShapeLost()

bool Aura::IsRemovedOnShapeLost ( Unit *  target) const

◆ IsSingleTarget()

◆ IsSingleTargetWith()

bool Aura::IsSingleTargetWith ( Aura const *  aura) const
1182{
1183 // Same spell?
1184 if (GetSpellInfo()->IsRankOf(aura->GetSpellInfo()))
1185 return true;
1186
1188 // spell with single target specific types
1189 switch (spec)
1190 {
1193 if (aura->GetSpellInfo()->GetSpellSpecific() == spec)
1194 return true;
1195 break;
1196 default:
1197 break;
1198 }
1199
1201 return true;
1202
1203 return false;
1204}
SpellSpecificType
Definition SpellInfo.h:150
@ SPELL_SPECIFIC_JUDGEMENT
Definition SpellInfo.h:162
@ SPELL_SPECIFIC_MAGE_POLYMORPH
Definition SpellInfo.h:161

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 ( )
2449{
2450 sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts);
2451 for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();)
2452 {
2453 if (!(*itr)->_Load(this))
2454 {
2455 std::list<AuraScript*>::iterator bitr = itr;
2456 ++itr;
2457 delete (*bitr);
2458 m_loadedScripts.erase(bitr);
2459 continue;
2460 }
2461 LOG_DEBUG("spells.aura", "Aura::LoadScripts: Script `{}` for aura `{}` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id);
2462 (*itr)->Register();
2463 ++itr;
2464 }
2465}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:157

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

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

◆ ModCharges()

bool Aura::ModCharges ( int32  num,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
1009{
1010 if (IsUsingCharges())
1011 {
1012 int32 charges = m_procCharges + num;
1013 int32 maxCharges = CalcMaxCharges();
1014
1015 // limit charges (only on charges increase, charges may be changed manually)
1016 if ((num > 0) && (charges > int32(maxCharges)))
1017 charges = maxCharges;
1018 // we're out of charges, remove
1019 else if (charges <= 0)
1020 {
1021 Remove(removeMode);
1022 return true;
1023 }
1024
1025 SetCharges(charges);
1026 }
1027 return false;
1028}
void SetCharges(uint8 charges)
Definition SpellAuras.cpp:987

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 
)
1057{
1058 int32 stackAmount = m_stackAmount + num;
1059
1060 // limit the stack amount (only on stack increase, stack amount may be changed manually)
1061 if ((num > 0) && (stackAmount > int32(m_spellInfo->StackAmount)))
1062 {
1063 // not stackable aura - set stack amount to 1
1065 stackAmount = 1;
1066 else
1067 stackAmount = m_spellInfo->StackAmount;
1068 }
1069 // we're out of stacks, remove
1070 else if (stackAmount <= 0)
1071 {
1072 Remove(removeMode);
1073 return true;
1074 }
1075
1076 bool refresh = stackAmount >= GetStackAmount() && (m_spellInfo->StackAmount || !m_spellInfo->HasAttribute(SPELL_ATTR1_AURA_UNIQUE));
1077
1078 // Update stack amount
1079 if (refresh)
1080 {
1082 RefreshTimers(periodicReset);
1083
1084 // reset charges
1086 }
1087
1088 SetStackAmount(stackAmount);
1089
1091 return false;
1092}
@ SPELL_ATTR1_AURA_UNIQUE
Definition SharedDefines.h:418
void SetStackAmount(uint8 num)
Definition SpellAuras.cpp:1030
void RefreshTimers(bool periodicReset=false)
Definition SpellAuras.cpp:944
void SetNeedClientUpdateForTargets() const
Definition SpellAuras.cpp:1298
void RefreshSpellMods()
Definition SpellAuras.cpp:1094
uint32 StackAmount
Definition SpellInfo.h:395

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

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

◆ PrepareProcToTrigger()

void Aura::PrepareProcToTrigger ( AuraApplication *  aurApp,
ProcEventInfo &  eventInfo,
TimePoint  now 
)
2209{
2210 bool prepare = CallScriptPrepareProcHandlers(aurApp, eventInfo);
2211 if (!prepare)
2212 return;
2213
2214 // take one charge, aura expiration will be handled in Aura::TriggerProcOnEvent (if needed)
2216 {
2217 --m_procCharges;
2219 }
2220
2221 SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId());
2222
2223 ASSERT(procEntry);
2224
2225 // cooldowns should be added to the whole aura (see 51698 area aura)
2226 AddProcCooldown(now + procEntry->Cooldown);
2227}
@ SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES
Definition SharedDefines.h:597
bool CallScriptPrepareProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2774
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 ( )
1273{
1274 ASSERT (!IsRemoved());
1275 Unit* caster = GetCaster();
1276 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1277 if (HasEffect(i))
1278 m_effects[i]->RecalculateAmount(caster);
1279}
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
916{
917 Unit* caster = GetCaster();
918
919 if (!caster)
920 return;
921
922 if (withMods && caster)
923 {
924 int32 duration = m_spellInfo->GetMaxDuration();
925 // Calculate duration of periodics affected by haste.
927 duration = int32(duration * caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
928 SetMaxDuration(duration);
929
930 SetDuration(duration);
931 }
932 else
934
937
938 // also reset periodic counters
939 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
940 if (AuraEffect* aurEff = m_effects[i])
941 aurEff->ResetTicks();
942}
@ 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:315
int32 GetMaxDuration() const
Definition SpellInfo.cpp:2771
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition Unit.cpp:5804

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 ( )
1095{
1096 for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1097 if (Player* player = appIter->second->GetTarget()->ToPlayer())
1098 player->RestoreAllSpellMods(0, this);
1099}

References Unit::GetTarget(), and m_applications.

Referenced by ModStackAmount().

◆ RefreshTimers()

void Aura::RefreshTimers ( bool  periodicReset = false)
945{
948 Unit* caster = GetCaster();
949
950 if (!caster)
951 {
952 return;
953 }
954
955 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
956 {
957 if (AuraEffect* aurEff = m_effects[i])
958 {
959 aurEff->CalculatePeriodic(caster, periodicReset, false);
960 aurEff->CalculatePeriodicData();
961 }
962 }
963}
void RefreshDuration(bool withMods=false)
Definition SpellAuras.cpp:915

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

Referenced by ModStackAmount().

◆ RefreshTimersWithMods()

void Aura::RefreshTimersWithMods ( )
967{
968 Unit* caster = GetCaster();
971 {
973 }
974
975 // xinef: we should take ModSpellDuration into account, but none of the spells using this function is affected by contents of ModSpellDuration
977
978 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
979 {
980 if (AuraEffect* aurEff = m_effects[i])
981 {
982 aurEff->CalculatePeriodic(caster, false, false);
983 }
984 }
985}

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 ( )
2204{
2205 m_procCooldown = std::chrono::steady_clock::now();
2206}

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 
)
1243{
1244 m_maxDuration = maxduration;
1245 m_duration = duration;
1246 m_procCharges = charges;
1248 m_stackAmount = stackamount;
1249 Unit* caster = GetCaster();
1250 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1251 if (m_effects[i])
1252 {
1253 m_effects[i]->SetAmount(amount[i]);
1254 m_effects[i]->SetCanBeRecalculated(recalculateMask & (1 << i));
1255 m_effects[i]->CalculatePeriodic(caster, false, true);
1257 if (caster)
1258 m_effects[i]->RecalculateAmount(caster);
1259 }
1260}
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
1299{
1300 for (ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1301 appIter->second->SetNeedClientUpdate();
1302}

References m_applications.

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

◆ SetStackAmount()

void Aura::SetStackAmount ( uint8  num)
1031{
1032 m_stackAmount = stackAmount;
1033 Unit* caster = GetCaster();
1034
1035 if (!caster)
1036 return;
1037
1038 std::list<AuraApplication*> applications;
1039 GetApplicationList(applications);
1040
1041 for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
1042 if (!(*apptItr)->GetRemoveMode())
1043 HandleAuraSpecificMods(*apptItr, caster, false, true);
1044
1045 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1046 if (HasEffect(i))
1047 m_effects[i]->ChangeAmount(m_effects[i]->CalculateAmount(caster), false, true);
1048
1049 for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
1050 if (!(*apptItr)->GetRemoveMode())
1051 HandleAuraSpecificMods(*apptItr, caster, true, true);
1052
1054}
void GetApplicationList(std::list< AuraApplication * > &applicationList) const
Definition SpellAuras.cpp:1289
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
Definition SpellAuras.cpp:1305

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)
2857{
2858 m_triggeredByAuraSpellInfo = triggeredByAuraSpellInfo;
2859}

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 
)
2405{
2406 bool prevented = CallScriptProcHandlers(aurApp, eventInfo);
2407 if (!prevented)
2408 {
2409 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2410 {
2411 if (!(procEffectMask & (1 << i)))
2412 continue;
2413
2414 // OnEffectProc / AfterEffectProc hooks handled in AuraEffect::HandleProc()
2415 if (aurApp->HasEffect(i))
2416 GetEffect(i)->HandleProc(aurApp, eventInfo);
2417 }
2418
2419 CallScriptAfterProcHandlers(aurApp, eventInfo);
2420 }
2421
2422 ConsumeProcCharges(sSpellMgr->GetSpellProcEntry(GetId()));
2423}
bool HasEffect(uint8 effect) const
Definition SpellAuras.h:68
void HandleProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:1290
void CallScriptAfterProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2810
void ConsumeProcCharges(SpellProcEntry const *procEntry)
Definition SpellAuras.cpp:2425
bool CallScriptProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2793

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

◆ TryCreate()

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

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

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

◆ TryRefreshStackOrCreate()

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

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 ( )
1207{
1209 Unit* caster = GetCaster();
1210 if (!caster)
1211 {
1212 LOG_INFO("spells", "Aura::UnregisterSingleTarget: (A1) - {}, {}, {}, {}", GetId(), GetOwner()->GetTypeId(), GetOwner()->GetEntry(), GetOwner()->GetName());
1213 LOG_ERROR("spells", "Aura::UnregisterSingleTarget: No caster was found."); //ASSERT(caster);
1214 }
1215 else
1216 caster->GetSingleCastAuras().remove(this);
1217
1218 SetIsSingleTarget(false);
1219}
#define LOG_INFO(filterType__,...)
Definition Log.h:153
void SetIsSingleTarget(bool val)
Definition SpellAuras.h:168
AuraList & GetSingleCastAuras()
Definition Unit.h:1434

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 
)
834{
835 if (m_duration > 0)
836 {
837 m_duration -= diff;
838 if (m_duration < 0)
839 m_duration = 0;
840
841 // handle ManaPerSecond/ManaPerSecondPerLevel
842 if (m_timeCla)
843 {
844 if (m_timeCla > int32(diff))
845 m_timeCla -= diff;
846 else if (caster)
847 {
848 if (int32 ManaPerSecond = m_spellInfo->ManaPerSecond + m_spellInfo->ManaPerSecondPerLevel * caster->GetLevel())
849 {
850 m_timeCla += 1000 - diff;
851
852 Powers powertype = Powers(m_spellInfo->PowerType);
853 if (powertype == POWER_HEALTH)
854 {
855 if (int32(caster->GetHealth()) > ManaPerSecond)
856 caster->ModifyHealth(-ManaPerSecond);
857 else
858 {
859 Remove();
860 return;
861 }
862 }
863 else
864 {
865 if (int32(caster->GetPower(powertype)) >= ManaPerSecond)
866 caster->ModifyPower(powertype, -ManaPerSecond);
867 else
868 {
869 Remove();
870 return;
871 }
872 }
873 }
874 }
875 }
876 }
877}
Powers
Definition SharedDefines.h:256
@ POWER_HEALTH
Definition SharedDefines.h:266
uint32 PowerType
Definition SpellInfo.h:386
int32 ModifyHealth(int32 val)
Definition Unit.cpp:10722
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:10780
uint32 GetHealth() const
Definition Unit.h:1114
uint32 GetPower(Powers power) const
Definition Unit.h:1141

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 
)
792{
793 if (owner != m_owner)
794 {
795 ABORT();
796 }
797
798 Unit* caster = GetCaster();
799 // Apply spellmods for channeled auras
800 // used for example when triggered spell of spell:10 is modded
801 Spell* modSpell = nullptr;
802 Player* modOwner = nullptr;
803 if (caster)
804 {
805 modOwner = caster->GetSpellModOwner();
806 if (modOwner)
807 {
808 modSpell = modOwner->FindCurrentSpellBySpellId(GetId());
809 if (modSpell)
810 modOwner->SetSpellModTakingSpell(modSpell, true);
811 }
812 }
813
814 Update(diff, caster);
815
816 if (m_updateTargetMapInterval <= int32(diff))
817 UpdateTargetMap(caster);
818 else
820
821 // update aura effects
822 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
823 if (m_effects[i])
824 m_effects[i]->Update(diff, caster);
825
826 // remove spellmods after effects update
827 if (modSpell)
828 modOwner->SetSpellModTakingSpell(modSpell, false);
829
831}
void Update(uint32 diff, Unit *caster)
Definition SpellAuraEffects.cpp:926
void Update(uint32 diff, Unit *caster)
Definition SpellAuras.cpp:833
void SetSpellModTakingSpell(Spell *spell, bool apply)
Definition Player.cpp:10264
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition Unit.cpp:4071

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

Referenced by DynamicObject::Update().

◆ UpdateTargetMap()

void Aura::UpdateTargetMap ( Unit *  caster,
bool  apply = true 
)
579{
580 if (IsRemoved())
581 return;
582
584
585 // fill up to date target list
586 // target, effMask
587 std::map<Unit*, uint8> targets;
588
589 FillTargetMap(targets, caster);
590
591 UnitList targetsToRemove;
592
593 // mark all auras as ready to remove
594 for (ApplicationMap::iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
595 {
596 std::map<Unit*, uint8>::iterator existing = targets.find(appIter->second->GetTarget());
597 // not found in current area - remove the aura
598 if (existing == targets.end())
599 targetsToRemove.push_back(appIter->second->GetTarget());
600 else
601 {
602 // xinef: check immunities here, so aura wont get removed on every tick and then reapplied
603 if (IsArea())
604 for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
605 {
606 if ((existing->second & (1 << effIndex)) && existing->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex, GetCaster()))
607 existing->second &= ~(1 << effIndex);
608 }
609
610 // paladin auras of the same spell coexist per caster, but only the strongest one keeps
611 // its effects on the target. If a stronger duplicate from another paladin is present,
612 // strip this aura's effects and keep the application effect-free (Aura Mastery needs it
613 // applied) without removing it, which would otherwise churn every update cycle.
614 bool keepEffectless = false;
616 {
617 if (AuraApplication* otherApp = GetDominantOtherSameSpellApp(existing->first, GetId(), GetCasterGUID()))
618 {
619 if (!IsPaladinAuraDominant(this, otherApp->GetBase(), existing->first))
620 {
621 for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
622 if (appIter->second->HasEffect(effIndex))
623 appIter->second->_HandleEffect(effIndex, false);
624 keepEffectless = true;
625 }
626 }
627 }
628
629 // needs readding - remove now, will be applied in next update cycle
630 // (dbcs do not have auras which apply on same type of targets but have different radius, so this is not really needed)
631 if ((appIter->second->GetEffectMask() != existing->second && !keepEffectless) || !CanBeAppliedOn(existing->first))
632 targetsToRemove.push_back(appIter->second->GetTarget());
633 // nothing todo - aura already applied
634 // remove from auras to register list
635 targets.erase(existing);
636 }
637 }
638
639 // register auras for units
640 for (std::map<Unit*, uint8>::iterator itr = targets.begin(); itr != targets.end();)
641 {
642 // aura mustn't be already applied on target
643 if (AuraApplication* aurApp = GetApplicationOfTarget(itr->first->GetGUID()))
644 {
645 // the core created 2 different units with same guid
646 // this is a major failue, which i can't fix right now
647 // let's remove one unit from aura list
648 // this may cause area aura "bouncing" between 2 units after each update
649 // but because we know the reason of a crash we can remove the assertion for now
650 if (aurApp->GetTarget() != itr->first)
651 {
652 // remove from auras to register list
653 targets.erase(itr++);
654 continue;
655 }
656 else
657 {
658 // ok, we have one unit twice in target map (impossible, but...)
659 ABORT();
660 }
661 }
662
663 bool addUnit = true;
664 // check target immunities
665 for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
666 {
667 if ((itr->second & (1 << effIndex)) && itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex, GetCaster()))
668 itr->second &= ~(1 << effIndex);
669 }
670 if (!itr->second || itr->first->IsImmunedToSpell(GetSpellInfo(), GetCaster()) || !CanBeAppliedOn(itr->first))
671 addUnit = false;
672
673 if (addUnit && !itr->first->IsHighestExclusiveAura(this, true))
674 addUnit = false;
675
676 if (addUnit)
677 {
678 // persistent area aura does not hit flying targets
679 if (GetType() == DYNOBJ_AURA_TYPE)
680 {
681 if (itr->first->IsInFlight())
682 addUnit = false;
683
684 // Allow only 1 persistent area aura to affect our targets if a custom flag is set.
685 if (itr->first->HasAura(GetId()) && GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_ONLY_ONE_AREA_AURA))
686 addUnit = false;
687 }
688 // unit auras can not stack with each other
689 else // (GetType() == UNIT_AURA_TYPE)
690 {
691 // Allow to remove by stack when aura is going to be applied on owner
692 if (itr->first != GetOwner())
693 {
694 // check if not stacking aura already on target
695 // this one prevents unwanted usefull buff loss because of stacking and prevents overriding auras periodicaly by 2 near area aura owners
696 for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
697 {
698 Aura const* aura = iter->second->GetBase();
699 if (!CanStackWith(aura))
700 {
701 addUnit = false;
702 break;
703 }
704 }
705 }
706 }
707 }
708 if (!addUnit)
709 targets.erase(itr++);
710 else
711 {
712 // owner has to be in world, or effect has to be applied to self
713 if (!GetOwner()->IsSelfOrInSameMap(itr->first))
714 {
715 //TODO: There is a crash caused by shadowfiend load addon
716 LOG_FATAL("spells.aura", "Aura {}: Owner {} (map {}) is not in the same map as target {} (map {}).", GetSpellInfo()->Id,
717 GetOwner()->GetName(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1),
718 itr->first->GetName(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1));
719 ABORT();
720 }
721
722 // paladin auras of the same spell coexist per caster, but only the strongest one keeps
723 // its effects on the target; weaker duplicates are applied without effects so each
724 // paladin's Aura Mastery can still detect their own aura on the target.
725 uint8 effMask = itr->second;
727 {
728 if (AuraApplication* otherApp = GetDominantOtherSameSpellApp(itr->first, GetId(), GetCasterGUID()))
729 {
730 if (IsPaladinAuraDominant(this, otherApp->GetBase(), itr->first))
731 {
732 // this aura is stronger - strip the other aura's effects on this target
733 for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
734 if (otherApp->HasEffect(effIndex))
735 otherApp->_HandleEffect(effIndex, false);
736 }
737 else
738 {
739 effMask = 0;
740 }
741 }
742 }
743 itr->second = effMask;
744 itr->first->_CreateAuraApplication(this, effMask);
745 ++itr;
746 }
747 }
748
749 // remove auras from units no longer needing them
750 for (UnitList::iterator itr = targetsToRemove.begin(); itr != targetsToRemove.end(); ++itr)
751 if (AuraApplication* aurApp = GetApplicationOfTarget((*itr)->GetGUID()))
752 (*itr)->_UnapplyAura(aurApp, AURA_REMOVE_BY_DEFAULT);
753
754 if (!apply)
755 return;
756
757 // apply aura effects for units
758 for (std::map<Unit*, uint8>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
759 {
760 if (AuraApplication* aurApp = GetApplicationOfTarget(itr->first->GetGUID()))
761 {
762 // owner has to be in world, or effect has to be applied to self
763 ASSERT((!GetOwner()->IsInWorld() && GetOwner() == itr->first) || GetOwner()->IsInMap(itr->first));
764 itr->first->_ApplyAura(aurApp, itr->second);
765 }
766 }
767}
#define LOG_FATAL(filterType__,...)
Definition Log.h:141
@ AURA_REMOVE_BY_DEFAULT
Definition SpellAuraDefines.h:392
static bool IsPaladinAuraDominant(Aura const *aura, Aura const *other, Unit const *target)
Definition SpellAuras.cpp:535
static AuraApplication * GetDominantOtherSameSpellApp(Unit *target, uint32 spellId, ObjectGuid casterGUID)
Definition SpellAuras.cpp:560
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:2028
bool CanBeAppliedOn(Unit *target)
Definition SpellAuras.cpp:1977
bool IsSelfOrInSameMap(WorldObject const *obj) const
Definition Object.cpp:1334

References ABORT, ASSERT, AURA_REMOVE_BY_DEFAULT, CanBeAppliedOn(), CanStackWith(), DYNOBJ_AURA_TYPE, FillTargetMap(), GetApplicationOfTarget(), GetCaster(), GetCasterGUID(), GetDominantOtherSameSpellApp(), GetId(), GetOwner(), GetSpellInfo(), SpellInfo::GetSpellSpecific(), GetType(), SpellInfo::HasAttribute(), IsArea(), IsPaladinAuraDominant(), IsRemoved(), WorldObject::IsSelfOrInSameMap(), LOG_FATAL, m_applications, m_spellInfo, m_updateTargetMapInterval, MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_ONLY_ONE_AREA_AURA, SPELL_SPECIFIC_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: