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

#include "SpellAuraEffects.h"

Public Member Functions

Unit * GetCaster () const
 
ObjectGuid GetCasterGUID () const
 
Aura * GetBase () const
 
void GetTargetList (std::list< Unit * > &targetList) const
 
void GetApplicationList (std::list< AuraApplication * > &applicationList) const
 
SpellModifier * GetSpellModifier () const
 
SpellInfo const * GetSpellInfo () const
 
uint32 GetId () const
 
uint32 GetEffIndex () const
 
int32 GetBaseAmount () const
 
int32 GetDieSides () const
 
int32 GetAmplitude () const
 
int32 GetMiscValueB () const
 
int32 GetMiscValue () const
 
AuraType GetAuraType () const
 
int32 GetAmount () const
 
int32 GetForcedAmount () const
 
void SetAmount (int32 amount)
 
int32 GetPeriodicTimer () const
 
void SetPeriodicTimer (int32 periodicTimer)
 
int32 CalculateAmount (Unit *caster)
 
void CalculatePeriodic (Unit *caster, bool create=false, bool load=false)
 
void CalculatePeriodicData ()
 
void CalculateSpellMod ()
 
void ChangeAmount (int32 newAmount, bool mark=true, bool onStackOrReapply=false)
 
void RecalculateAmount ()
 
void RecalculateAmount (Unit *caster)
 
bool CanBeRecalculated () const
 
void SetCanBeRecalculated (bool val)
 
void HandleEffect (AuraApplication *aurApp, uint8 mode, bool apply)
 
void HandleEffect (Unit *target, uint8 mode, bool apply)
 
void ApplySpellMod (Unit *target, bool apply)
 
void Update (uint32 diff, Unit *caster)
 
void UpdatePeriodic (Unit *caster)
 
uint32 GetTickNumber () const
 
int32 GetTotalTicks () const
 
void ResetPeriodic (bool resetPeriodicTimer=false)
 
void ResetTicks ()
 
bool IsPeriodic () const
 
void SetPeriodic (bool isPeriodic)
 
bool IsAffectedOnSpell (SpellInfo const *spell) const
 
bool HasSpellClassMask () const
 
void SendTickImmune (Unit *target, Unit *caster) const
 
void PeriodicTick (AuraApplication *aurApp, Unit *caster) const
 
void HandleProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
bool CheckEffectProc (AuraApplication *aurApp, ProcEventInfo &eventInfo) const
 
void CleanupTriggeredSpells (Unit *target)
 
void HandleShapeshiftBoosts (Unit *target, bool apply) const
 
float GetCritChance () const
 
void SetCritChance (float crit)
 
uint8 GetCasterLevel () const
 
bool CanApplyResilience () const
 
float GetPctMods () const
 
void SetPctMods (float pctMods)
 
int32 GetOldAmount () const
 
void SetOldAmount (int32 amount)
 
bool IsEnabled () const
 
void SetEnabled (bool enabled)
 
void HandleNULL (AuraApplication const *, uint8, bool) const
 
void HandleUnused (AuraApplication const *, uint8, bool) const
 
void HandleNoImmediateEffect (AuraApplication const *, uint8, bool) const
 
void HandleModInvisibilityDetect (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModInvisibility (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStealth (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStealthLevel (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStealthDetect (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleDetectAmore (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleSpiritOfRedemption (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraGhost (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePhase (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModShapeshift (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTransform (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModScale (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraCloneCaster (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleFeignDeath (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModUnattackable (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDisarm (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModSilence (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModPacify (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModPacifyAndSilence (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraAllowOnlyAbility (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTrackResources (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTrackCreatures (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTrackStealthed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStalked (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraUntrackable (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModPetTalentsPoints (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModSkill (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraMounted (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraAllowFlight (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraWaterWalk (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraFeatherFall (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraHover (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleWaterBreathing (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleForceMoveForward (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModThreat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModTotalThreat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModTaunt (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModDetaunt (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModConfuse (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModFear (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStun (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRoot (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePreventFleeing (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPossess (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPossessPet (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModCharm (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleCharmConvert (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraControlVehicle (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseMountedSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseFlightSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseSwimSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDecreaseSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModUseNormalSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStateImmunityMask (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModMechanicImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModEffectImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStateImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModSchoolImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDmgImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDispelImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModResistanceExclusive (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModResistance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModBaseResistancePCT (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModResistancePercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModBaseResistance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModTargetResistance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPercentStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellDamagePercentFromStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellHealingPercentFromStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellDamagePercentFromAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellHealingPercentFromAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModHealingDone (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModTotalPercentStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModResistenceOfStatPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModExpertise (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerRegen (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerRegenPCT (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModManaRegen (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseHealth (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseMaxHealth (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseEnergy (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseEnergyPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseHealthPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraIncreaseBaseHealthPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModParryPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDodgePercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModBlockPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRegenInterrupt (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModWeaponCritPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModHitChance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellHitChance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellCritChance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellCritChanceShool (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModCritPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModCastingSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModMeleeRangedSpeedPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModCombatSpeedPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModAttackSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModMeleeSpeedPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedHaste (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleRangedAmmoHaste (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModRating (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModRatingFromStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPowerPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedAttackPowerPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedAttackPowerOfStatPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPowerOfStatPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPowerOfArmor (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModDamageDone (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModDamagePercentDone (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModOffhandDamagePercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleShieldBlockValue (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleShieldBlockValuePercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerCostPCT (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerCost (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleArenaPreparation (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleNoReagentUseAura (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraRetainComboPoints (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraDummy (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleChannelDeathItem (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleBindSight (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleFarSight (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleForceReaction (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraEmpathy (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModFaction (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleComprehendLanguage (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraConvertRune (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraLinked (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraOpenStable (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModFakeInebriation (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraOverrideSpells (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraSetVehicle (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePreventResurrection (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePeriodicDummyAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicTriggerSpellAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicTriggerSpellWithValueAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicDamageAurasTick (Unit *target, Unit *caster) const
 
void HandlePeriodicHealthLeechAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicHealthFunnelAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicHealAurasTick (Unit *target, Unit *caster) const
 
void HandlePeriodicManaLeechAuraTick (Unit *target, Unit *caster) const
 
void HandleObsModPowerAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicEnergizeAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicPowerBurnAuraTick (Unit *target, Unit *caster) const
 
void HandleBreakableCCAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleProcTriggerSpellAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleProcTriggerSpellWithValueAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleProcTriggerDamageAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleRaidProcFromChargeAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleRaidProcFromChargeWithValueAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 

Private Member Functions

friend Aura::~Aura ()
 
 ~AuraEffect ()
 
 AuraEffect (Aura *base, uint8 effIndex, int32 *baseAmount, Unit *caster)
 
float CalcPeriodicCritChance (Unit const *caster, Unit const *target) const
 

Private Attributes

Aura *const m_base
 
SpellInfo const *const m_spellInfo
 
int32 const m_baseAmount
 
int32 const m_dieSides
 
bool m_applyResilience
 
uint8 m_casterLevel
 
int32 m_amount
 
float m_critChance
 
float m_pctMods
 
int32 m_oldAmount
 
bool m_isAuraEnabled
 
ChannelTargetData * m_channelData
 
SpellModifier * m_spellmod
 
int32 m_periodicTimer
 
int32 m_amplitude
 
uint32 m_tickNumber
 
uint8 const m_effIndex
 
bool m_canBeRecalculated
 
bool m_isPeriodic
 
bool m_isRecalculatingPassiveAuras = false
 

Friends

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

Detailed Description

Constructor & Destructor Documentation

◆ Aura::~Aura()

AuraEffect::Aura::~Aura ( )
private

◆ ~AuraEffect()

AuraEffect::~AuraEffect ( )
private
406{
407 delete m_spellmod;
408 delete m_channelData;
409}
ChannelTargetData * m_channelData
Definition SpellAuraEffects.h:137
SpellModifier * m_spellmod
Definition SpellAuraEffects.h:139

References m_channelData, and m_spellmod.

◆ AuraEffect()

AuraEffect::AuraEffect ( Aura *  base,
uint8  effIndex,
int32 *  baseAmount,
Unit *  caster 
)
explicitprivate
384 :
385 m_base(base), m_spellInfo(base->GetSpellInfo()),
386 m_baseAmount(baseAmount ? * baseAmount : m_spellInfo->Effects[effIndex].BasePoints), m_dieSides(m_spellInfo->Effects[effIndex].DieSides),
387 m_critChance(0), m_pctMods(1.0f), m_oldAmount(0), m_isAuraEnabled(true), m_channelData(nullptr), m_spellmod(nullptr), m_periodicTimer(0), m_amplitude(0), m_tickNumber(0), m_effIndex(effIndex),
389{
390 CalculatePeriodic(caster, true, false);
392
393 m_amount = CalculateAmount(caster);
394 m_casterLevel = caster ? caster->GetLevel() : 0;
395 m_applyResilience = caster && caster->CanApplyResilience();
396
398
399 // Xinef: channel data structure
400 if (caster)
401 if (Spell* spell = caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
402 m_channelData = new ChannelTargetData(caster->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT), spell->m_targets.HasDst() ? spell->m_targets.GetDst() : nullptr);
403}
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:565
@ UNIT_FIELD_CHANNEL_OBJECT
Definition UpdateFields.h:93
int32 m_periodicTimer
Definition SpellAuraEffects.h:141
bool m_canBeRecalculated
Definition SpellAuraEffects.h:146
uint8 const m_effIndex
Definition SpellAuraEffects.h:145
uint8 m_casterLevel
Definition SpellAuraEffects.h:129
bool m_applyResilience
Definition SpellAuraEffects.h:128
void CalculatePeriodic(Unit *caster, bool create=false, bool load=false)
Definition SpellAuraEffects.cpp:599
void CalculateSpellMod()
Definition SpellAuraEffects.cpp:690
int32 m_oldAmount
Definition SpellAuraEffects.h:134
int32 CalculateAmount(Unit *caster)
Definition SpellAuraEffects.cpp:452
int32 m_amount
Definition SpellAuraEffects.h:130
float m_pctMods
Definition SpellAuraEffects.h:132
int32 m_amplitude
Definition SpellAuraEffects.h:142
void CalculatePeriodicData()
Definition SpellAuraEffects.cpp:584
uint32 m_tickNumber
Definition SpellAuraEffects.h:143
int32 const m_baseAmount
Definition SpellAuraEffects.h:125
SpellInfo const *const m_spellInfo
Definition SpellAuraEffects.h:124
bool m_isAuraEnabled
Definition SpellAuraEffects.h:135
bool m_isPeriodic
Definition SpellAuraEffects.h:147
int32 const m_dieSides
Definition SpellAuraEffects.h:126
float m_critChance
Definition SpellAuraEffects.h:131
Aura *const m_base
Definition SpellAuraEffects.h:122
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:101
ObjectGuid GetGuidValue(uint16 index) const
Definition Object.cpp:335
Definition Spell.h:298
bool CanApplyResilience() const
Definition Unit.h:1186
uint8 GetLevel() const
Definition Unit.h:1117
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1593
Definition Spell.h:254

References CalculateAmount(), CalculatePeriodic(), CalculatePeriodicData(), CalculateSpellMod(), Unit::CanApplyResilience(), CURRENT_CHANNELED_SPELL, Unit::GetCurrentSpell(), Object::GetGuidValue(), Unit::GetLevel(), m_amount, m_applyResilience, m_casterLevel, m_channelData, and UNIT_FIELD_CHANNEL_OBJECT.

Member Function Documentation

◆ ApplySpellMod()

void AuraEffect::ApplySpellMod ( Unit *  target,
bool  apply 
)
814{
815 if (!m_spellmod || !target->IsPlayer())
816 return;
817
818 target->ToPlayer()->AddSpellMod(m_spellmod, apply);
819
820 // Auras with charges do not mod amount of passive auras
821 if (GetBase()->IsUsingCharges())
822 return;
823
824 // Guard against infinite recursion: a spell mod recalculating an aura that
825 // triggers ApplySpellMod again (self-referencing or mutual spell mods).
827 {
828 LOG_DEBUG("spells.aura", "AuraEffect::ApplySpellMod: Recursion detected for spell {} effect {}, skipping passive aura recalculation",
829 GetId(), GetEffIndex());
830 return;
831 }
833
834 // reapply some passive spells after add/remove related spellmods
835 // Warning: it is a dead loop if 2 auras each other amount-shouldn't happen
836 switch (GetMiscValue())
837 {
839 case SPELLMOD_EFFECT1:
840 case SPELLMOD_EFFECT2:
841 case SPELLMOD_EFFECT3:
842 {
843 ObjectGuid guid = target->GetGUID();
844 Unit::AuraApplicationMap& auras = target->GetAppliedAuras();
845 for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
846 {
847 Aura* aura = iter->second->GetBase();
848 // only passive and permament auras-active auras should have amount set on spellcast and not be affected
849 // if aura is casted by others, it will not be affected
850 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == guid &&
853 {
855 {
856 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
857 {
858 if (AuraEffect* aurEff = aura->GetEffect(i))
859 aurEff->RecalculateAmount();
860 }
861 }
862 else if (GetMiscValue() == SPELLMOD_EFFECT1)
863 {
864 if (AuraEffect* aurEff = aura->GetEffect(0))
865 aurEff->RecalculateAmount();
866 }
867 else if (GetMiscValue() == SPELLMOD_EFFECT2)
868 {
869 if (AuraEffect* aurEff = aura->GetEffect(1))
870 aurEff->RecalculateAmount();
871 }
872 else //if (modOp == SPELLMOD_EFFECT3)
873 {
874 if (AuraEffect* aurEff = aura->GetEffect(2))
875 aurEff->RecalculateAmount();
876 }
877 }
878 }
879
880 Pet* pet = target->ToPlayer()->GetPet();
881 if (!pet)
882 break;
883
884 ObjectGuid petguid = pet->GetGUID();
885 Unit::AuraApplicationMap& petauras = pet->GetAppliedAuras();
886 for (Unit::AuraApplicationMap::iterator iter = petauras.begin(); iter != petauras.end(); ++iter)
887 {
888 Aura* aura = iter->second->GetBase();
889 // only passive auras-active auras should have amount set on spellcast and not be affected
890 // if aura is casted by others, it will not be affected
891 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == petguid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
892 {
894 {
895 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
896 {
897 if (AuraEffect* aurEff = aura->GetEffect(i))
898 aurEff->RecalculateAmount();
899 }
900 }
901 else if (GetMiscValue() == SPELLMOD_EFFECT1)
902 {
903 if (AuraEffect* aurEff = aura->GetEffect(0))
904 aurEff->RecalculateAmount();
905 }
906 else if (GetMiscValue() == SPELLMOD_EFFECT2)
907 {
908 if (AuraEffect* aurEff = aura->GetEffect(1))
909 aurEff->RecalculateAmount();
910 }
911 else //if (modOp == SPELLMOD_EFFECT3)
912 {
913 if (AuraEffect* aurEff = aura->GetEffect(2))
914 aurEff->RecalculateAmount();
915 }
916 }
917 }
918 }
919 default:
920 break;
921 }
922
924}
#define MAX_SPELL_EFFECTS
Definition DBCStructure.h:1673
std::uint8_t uint8
Definition Define.h:109
#define LOG_DEBUG(filterType__,...)
Definition Log.h:157
@ SPELL_CAST_OK
Definition SharedDefines.h:1126
@ SPELLMOD_EFFECT2
Definition SpellDefines.h:96
@ SPELLMOD_ALL_EFFECTS
Definition SpellDefines.h:92
@ SPELLMOD_EFFECT3
Definition SpellDefines.h:107
@ SPELLMOD_EFFECT1
Definition SpellDefines.h:87
Definition SpellAuraEffects.h:39
uint32 GetId() const
Definition SpellAuraEffects.cpp:432
int32 GetMiscValue() const
Definition SpellAuraEffects.cpp:442
Aura * GetBase() const
Definition SpellAuraEffects.h:49
uint32 GetEffIndex() const
Definition SpellAuraEffects.h:56
bool m_isRecalculatingPassiveAuras
Definition SpellAuraEffects.h:148
Definition SpellAuras.h:88
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:106
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:178
bool IsPassive() const
Definition SpellAuras.cpp:1136
bool IsPermanent() const
Definition SpellAuras.h:141
Definition ObjectGuid.h:121
bool IsPlayer() const
Definition Object.h:207
Player * ToPlayer()
Definition Object.h:208
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
Definition Pet.h:41
Pet * GetPet() const
Definition Player.cpp:9158
void AddSpellMod(SpellModifier *mod, bool apply)
Definition Player.cpp:10107
SpellCastResult CheckShapeshift(uint32 form) const
Definition SpellInfo.cpp:1468
bool IsAffectedBySpellMod(SpellModifier const *mod) const
Definition SpellInfo.cpp:1357
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1979
boost::container::flat_multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:679
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1400

References Player::AddSpellMod(), SpellInfo::CheckShapeshift(), Unit::GetAppliedAuras(), GetBase(), Aura::GetCasterGUID(), Aura::GetEffect(), GetEffIndex(), Object::GetGUID(), GetId(), GetMiscValue(), Player::GetPet(), Unit::GetShapeshiftForm(), Aura::GetSpellInfo(), SpellInfo::IsAffectedBySpellMod(), Aura::IsPassive(), Aura::IsPermanent(), Object::IsPlayer(), LOG_DEBUG, m_isRecalculatingPassiveAuras, m_spellmod, MAX_SPELL_EFFECTS, SPELL_CAST_OK, SPELLMOD_ALL_EFFECTS, SPELLMOD_EFFECT1, SPELLMOD_EFFECT2, SPELLMOD_EFFECT3, and Object::ToPlayer().

Referenced by HandleEffect().

◆ CalcPeriodicCritChance()

float AuraEffect::CalcPeriodicCritChance ( Unit const *  caster,
Unit const *  target 
) const
private
1061{
1062 float critChance = 0.0f;
1063 if (caster)
1064 {
1065 if (Player* modOwner = caster->GetSpellModOwner())
1066 {
1067 Unit::AuraEffectList const& mPeriodicCritAuras = modOwner->GetAuraEffectsByType(SPELL_AURA_ABILITY_PERIODIC_CRIT);
1068 for (Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr)
1069 {
1070 if ((*itr)->IsAffectedOnSpell(GetSpellInfo()))
1071 {
1072 critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), (GetSpellInfo()->DmgClass == SPELL_DAMAGE_CLASS_RANGED ? RANGED_ATTACK : BASE_ATTACK), true);
1073 break;
1074 }
1075 }
1076
1077 switch (GetSpellInfo()->SpellFamilyName)
1078 {
1079 // Rupture - since 3.3.3 can crit
1080 case SPELLFAMILY_ROGUE:
1081 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100000)
1082 critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), BASE_ATTACK, true);
1083 break;
1084 }
1085 }
1086 }
1087 if (target && critChance > 0.0f)
1088 critChance = target->SpellTakenCritChance(caster, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), critChance, BASE_ATTACK, true);
1089
1090 return std::max(0.0f, critChance);
1091}
@ SPELL_DAMAGE_CLASS_RANGED
Definition SharedDefines.h:1552
@ SPELLFAMILY_ROGUE
Definition SharedDefines.h:3792
@ SPELL_AURA_ABILITY_PERIODIC_CRIT
Definition SpellAuraDefines.h:349
@ BASE_ATTACK
Definition Unit.h:223
@ RANGED_ATTACK
Definition Unit.h:225
SpellInfo const * GetSpellInfo() const
Definition SpellAuraEffects.h:54
Definition Player.h:1086
flag96 SpellFamilyFlags
Definition SpellInfo.h:412
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1921
uint32 DmgClass
Definition SpellInfo.h:413
uint32 SpellFamilyName
Definition SpellInfo.h:411
std::vector< AuraEffect * > AuraEffectList
Definition Unit.h:686
Player * GetSpellModOwner() const override
Definition Unit.cpp:12637

References BASE_ATTACK, SpellInfo::DmgClass, SpellInfo::GetSchoolMask(), GetSpellInfo(), Unit::GetSpellModOwner(), RANGED_ATTACK, SPELL_AURA_ABILITY_PERIODIC_CRIT, SPELL_DAMAGE_CLASS_RANGED, SPELLFAMILY_ROGUE, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, and Unit::SpellTakenCritChance().

Referenced by CalculatePeriodicData().

◆ CalculateAmount()

int32 AuraEffect::CalculateAmount ( Unit *  caster)
453{
454 int32 amount;
455 // default amount calculation
456 amount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, nullptr);
457
458 // check item enchant aura cast
459 if (!amount && caster)
460 if (ObjectGuid itemGUID = GetBase()->GetCastItemGUID())
461 if (Player* playerCaster = caster->ToPlayer())
462 if (Item* castItem = playerCaster->GetItemByGuid(itemGUID))
463 if (castItem->GetItemSuffixFactor())
464 {
465 ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(std::abs(castItem->GetItemRandomPropertyId()));
466 if (item_rand_suffix)
467 {
468 for (uint8 k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; k++)
469 {
470 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->Enchantment[k]);
471 if (pEnchant)
472 {
473 for (uint8 t = 0; t < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; t++)
474 if (pEnchant->spellid[t] == m_spellInfo->Id)
475 {
476 amount = uint32((item_rand_suffix->AllocationPct[k] * castItem->GetItemSuffixFactor()) / 10000);
477 break;
478 }
479 }
480
481 if (amount)
482 break;
483 }
484 }
485 }
486
487 // custom amount calculations go here
488 // xinef: normal auras
489 switch (GetAuraType())
490 {
491 // crowd control auras
497 {
498 m_canBeRecalculated = false;
499 if (!m_spellInfo->ProcFlags || m_spellInfo->HasAura(SPELL_AURA_PROC_TRIGGER_SPELL)) // xinef: skip auras with proctriggerspell, they must have procflags...
500 break;
501 if (!caster)
502 break;
503 // not impacted by gear
504 // not impacted by target level
505 // not impacted by rank
506 // asumption - depends on caster level
507 amount = sObjectMgr->GetCreatureBaseStats(caster->GetLevel(), Classes::CLASS_WARRIOR)->BaseHealth[EXPANSION_WRATH_OF_THE_LICH_KING] / 4.75f;
508 // Glyphs increasing damage cap
510 for (Unit::AuraEffectList::const_iterator itr = overrideClassScripts.begin(); itr != overrideClassScripts.end(); ++itr)
511 {
512 if ((*itr)->IsAffectedOnSpell(m_spellInfo))
513 {
514 // Glyph of Fear, Glyph of Frost nova and similar auras
515 if ((*itr)->GetMiscValue() == 7801)
516 {
517 AddPct(amount, (*itr)->GetAmount());
518 break;
519 }
520 }
521 }
522 break;
523 }
526 m_canBeRecalculated = false;
527 break;
529 // Titan's Grip
530 if (!caster)
531 break;
532 if (GetId() == 49152 && caster->ToPlayer())
533 {
534 Item* item1 = caster->ToPlayer()->GetWeaponForAttack(BASE_ATTACK);
535 Item* item2 = caster->ToPlayer()->GetWeaponForAttack(OFF_ATTACK);
536
537 if (!item2)
538 item2 = caster->ToPlayer()->GetShield();
539
540 if (item1 && item2
542 {
543 amount = -10;
544 }
545 else
546 amount = 0;
547 }
548 break;
549 default:
550 break;
551 }
552
553 // xinef: save base amount, before calculating sp etc. Used for Unit::CastDelayedSpellWithPeriodicAmount
554 SetOldAmount(amount * GetBase()->GetStackAmount());
555
556 // Xinef: Periodic auras
557 if (caster)
558 switch (GetAuraType())
559 {
562 // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value!
563 if (GetBase()->GetType() == UNIT_AURA_TYPE)
564 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex(), GetPctMods(), 1);
565 break;
567 if (GetBase()->GetType() == UNIT_AURA_TYPE)
568 amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex(), GetPctMods(), 1);
569 break;
571 if (GetBase()->GetType() == UNIT_AURA_TYPE)
572 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE, 0.0f, 1);
573 break;
574 default:
575 break;
576 }
577
579
580 amount *= GetBase()->GetStackAmount();
581 return amount;
582}
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
#define MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS
Definition DBCStructure.h:1874
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition DBCStructure.h:1243
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
@ INVTYPE_2HWEAPON
Definition ItemTemplate.h:273
#define sObjectMgr
Definition ObjectMgr.h:1731
@ CLASS_WARRIOR
Definition SharedDefines.h:126
@ EXPANSION_WRATH_OF_THE_LICH_KING
Definition SharedDefines.h:55
@ SPELL_AURA_MANA_SHIELD
Definition SpellAuraDefines.h:160
@ SPELL_AURA_PERIODIC_DAMAGE
Definition SpellAuraDefines.h:66
@ SPELL_AURA_DAMAGE_SHIELD
Definition SpellAuraDefines.h:78
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition SpellAuraDefines.h:105
@ SPELL_AURA_MOD_FEAR
Definition SpellAuraDefines.h:70
@ SPELL_AURA_PERIODIC_HEAL
Definition SpellAuraDefines.h:71
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
Definition SpellAuraDefines.h:142
@ SPELL_AURA_MOD_ROOT
Definition SpellAuraDefines.h:89
@ SPELL_AURA_TRANSFORM
Definition SpellAuraDefines.h:119
@ SPELL_AURA_SCHOOL_ABSORB
Definition SpellAuraDefines.h:132
@ SPELL_AURA_PERIODIC_LEECH
Definition SpellAuraDefines.h:116
@ SPELL_AURA_MOD_CONFUSE
Definition SpellAuraDefines.h:68
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
Definition SpellAuraDefines.h:175
@ SPELL_AURA_MOD_STUN
Definition SpellAuraDefines.h:75
@ UNIT_AURA_TYPE
Definition SpellAuraDefines.h:385
@ OFF_ATTACK
Definition Unit.h:224
@ DOT
Definition Unit.h:264
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:263
T AddPct(T &base, U pct)
Definition Util.h:58
void SetOldAmount(int32 amount)
Definition SpellAuraEffects.h:117
AuraType GetAuraType() const
Definition SpellAuraEffects.cpp:447
float GetPctMods() const
Definition SpellAuraEffects.h:113
void CallScriptEffectCalcAmountHandlers(AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
Definition SpellAuras.cpp:2630
uint8 GetStackAmount() const
Definition SpellAuras.h:150
Definition Item.h:220
ItemTemplate const * GetTemplate() const
Definition Item.cpp:545
Item * GetShield(bool useable=false) const
Definition PlayerStorage.cpp:527
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition PlayerStorage.cpp:492
uint32 Id
Definition SpellInfo.h:344
uint32 ProcFlags
Definition SpellInfo.h:379
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
bool HasAura(AuraType aura) const
Definition SpellInfo.cpp:906
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1445
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:9365
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:8537
Definition DBCStructure.h:1255
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > AllocationPct
Definition DBCStructure.h:1261
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
Definition DBCStructure.h:1260
uint32 InventoryType
Definition ItemTemplate.h:632
Definition DBCStructure.h:1877
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1883

References AddPct(), ItemRandomSuffixEntry::AllocationPct, BASE_ATTACK, Aura::CallScriptEffectCalcAmountHandlers(), CLASS_WARRIOR, DOT, SpellInfo::Effects, ItemRandomSuffixEntry::Enchantment, EXPANSION_WRATH_OF_THE_LICH_KING, Unit::GetAuraEffectsByType(), GetAuraType(), GetBase(), GetEffIndex(), GetId(), Unit::GetLevel(), GetPctMods(), Player::GetShield(), GetSpellInfo(), Aura::GetStackAmount(), Item::GetTemplate(), Player::GetWeaponForAttack(), SpellInfo::HasAura(), SpellInfo::Id, ItemTemplate::InventoryType, INVTYPE_2HWEAPON, m_baseAmount, m_canBeRecalculated, m_effIndex, m_spellInfo, MAX_ITEM_ENCHANTMENT_EFFECTS, MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS, OFF_ATTACK, SpellInfo::ProcFlags, SetOldAmount(), sItemRandomSuffixStore, sObjectMgr, SPELL_AURA_DAMAGE_SHIELD, SPELL_AURA_MANA_SHIELD, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_AURA_SCHOOL_ABSORB, SPELL_AURA_TRANSFORM, SPELL_DIRECT_DAMAGE, Unit::SpellDamageBonusDone(), Unit::SpellHealingBonusDone(), SpellItemEnchantmentEntry::spellid, sSpellItemEnchantmentStore, Object::ToPlayer(), and UNIT_AURA_TYPE.

Referenced by AuraEffect(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), RecalculateAmount(), and RecalculateAmount().

◆ CalculatePeriodic()

void AuraEffect::CalculatePeriodic ( Unit *  caster,
bool  create = false,
bool  load = false 
)
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
600{
602
603 // prepare periodics
604 switch (GetAuraType())
605 {
607 // 3 spells have no amplitude set
608 if (!m_amplitude)
610 [[fallthrough]];
624 m_isPeriodic = true;
625 break;
626 default:
627 break;
628 }
629
631
632 if (!m_isPeriodic)
633 return;
634
635 // Xinef: fix broken data in dbc
636 if (m_amplitude <= 0)
637 m_amplitude = 1000;
638
639 Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr;
640
641 // Apply casting time mods
642 if (m_amplitude)
643 {
644 // Apply periodic time mod
645 if (modOwner)
647
648 if (caster)
649 {
652 }
653 }
654
655 if (load) // aura loaded from db
656 {
660 ++m_tickNumber;
661 }
662 else // aura just created or reapplied
663 {
664 m_tickNumber = 0;
665 // reset periodic timer on aura create or on reapply when aura isn't dot
666 // possibly we should not reset periodic timers only when aura is triggered by proc
667 // or maybe there's a spell attribute somewhere
668 bool resetPeriodicTimer = create
670
671 if (resetPeriodicTimer)
672 {
673 m_periodicTimer = 0;
674 // Start periodic on next tick or at aura apply
675 if (m_amplitude)
676 {
679 else if (caster && caster->IsTotem()) // for totems only ;d
680 {
681 m_periodicTimer = 100; // make it ALMOST instant
682 if (!GetBase()->IsPassive())
683 GetBase()->SetDuration(GetBase()->GetDuration() + 100);
684 }
685 }
686 }
687 }
688}
constexpr auto IN_MILLISECONDS
Definition Common.h:53
@ SPELL_ATTR5_EXTRA_INITIAL_PERIOD
Definition SharedDefines.h:564
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition SharedDefines.h:568
@ SPELL_AURA_PERIODIC_HASTE
Definition SpellAuraDefines.h:379
@ SPELL_AURA_OBS_MOD_HEALTH
Definition SpellAuraDefines.h:83
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
Definition SpellAuraDefines.h:125
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition SpellAuraDefines.h:127
@ SPELL_AURA_OBS_MOD_POWER
Definition SpellAuraDefines.h:84
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition SpellAuraDefines.h:152
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
Definition SpellAuraDefines.h:290
@ SPELL_AURA_PERIODIC_ENERGIZE
Definition SpellAuraDefines.h:87
@ SPELL_AURA_POWER_BURN
Definition SpellAuraDefines.h:225
@ SPELL_AURA_PERIODIC_DUMMY
Definition SpellAuraDefines.h:289
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT
Definition SpellAuraDefines.h:111
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
Definition SpellAuraDefines.h:86
@ SPELLMOD_ACTIVATION_TIME
Definition SpellDefines.h:103
@ UNIT_MOD_CAST_SPEED
Definition UpdateFields.h:137
int32 GetDuration() const
Definition SpellAuras.h:135
void SetDuration(int32 duration, bool withMods=false)
Definition SpellAuras.cpp:916
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
Definition SpellAuras.cpp:2644
float GetFloatValue(uint16 index) const
Definition Object.cpp:315
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
Definition Player.cpp:10022
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:441
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition Unit.cpp:5838
bool IsTotem() const
Definition Unit.h:805

References Player::ApplySpellMod(), Aura::CallScriptEffectCalcPeriodicHandlers(), SpellInfo::Effects, GetAuraType(), GetBase(), Aura::GetDuration(), Object::GetFloatValue(), GetId(), GetSpellInfo(), Unit::GetSpellModOwner(), SpellInfo::HasAttribute(), Unit::HasAuraTypeWithAffectMask(), IN_MILLISECONDS, Aura::IsPassive(), Unit::IsTotem(), m_amplitude, m_effIndex, m_isPeriodic, m_periodicTimer, m_spellInfo, m_tickNumber, Aura::SetDuration(), SPELL_ATTR5_EXTRA_INITIAL_PERIOD, SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_DUMMY, SPELL_AURA_PERIODIC_ENERGIZE, SPELL_AURA_PERIODIC_HASTE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_HEALTH_FUNNEL, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_PERIODIC_MANA_LEECH, SPELL_AURA_PERIODIC_TRIGGER_SPELL, SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_POWER_BURN, SPELLMOD_ACTIVATION_TIME, and UNIT_MOD_CAST_SPEED.

Referenced by AuraEffect(), spell_shadowfang_keep_haunting_spirits_aura::HandleUpdatePeriodic(), and Aura::SetLoadedState().

◆ CalculatePeriodicData()

void AuraEffect::CalculatePeriodicData ( )
585{
586 // xinef: save caster depending auras with pct mods
587 if (GetBase()->GetType() == UNIT_AURA_TYPE && GetCaster())
588 {
590 m_pctMods = GetCaster()->SpellPctHealingModsDone(GetBase()->GetUnitOwner(), GetSpellInfo(), DOT, false);
593 }
594
595 if (GetCaster())
596 SetCritChance(CalcPeriodicCritChance(GetCaster(), (GetBase()->GetType() == UNIT_AURA_TYPE ? GetBase()->GetUnitOwner() : nullptr)));
597}
float CalcPeriodicCritChance(Unit const *caster, Unit const *target) const
Definition SpellAuraEffects.cpp:1060
Unit * GetCaster() const
Definition SpellAuraEffects.h:47
void SetCritChance(float crit)
Definition SpellAuraEffects.h:110
float SpellPctHealingModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype, bool includeHealingDonePct=true)
Definition Unit.cpp:9279
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:8209

References CalcPeriodicCritChance(), DOT, GetBase(), GetCaster(), GetSpellInfo(), SpellInfo::HasAura(), m_pctMods, m_spellInfo, SetCritChance(), SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, Unit::SpellPctDamageModsDone(), Unit::SpellPctHealingModsDone(), and UNIT_AURA_TYPE.

Referenced by AuraEffect().

◆ CalculateSpellMod()

void AuraEffect::CalculateSpellMod ( )
691{
692 switch (GetAuraType())
693 {
696 if (!m_spellmod)
697 {
700
701 m_spellmod->type = SpellModType(GetAuraType()); // SpellModType value == spell aura types
703 m_spellmod->mask = GetSpellInfo()->Effects[GetEffIndex()].SpellClassMask;
704 }
706 break;
707 default:
708 break;
709 }
711}
SpellModType
Definition Player.h:93
@ SPELL_AURA_ADD_PCT_MODIFIER
Definition SpellAuraDefines.h:171
@ SPELL_AURA_ADD_FLAT_MODIFIER
Definition SpellAuraDefines.h:170
SpellModOp
Definition SpellDefines.h:83
int32 GetAmount() const
Definition SpellAuraEffects.h:64
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
Definition SpellAuras.cpp:2658
Definition Player.h:182
SpellModOp op
Definition Player.h:185
SpellModType type
Definition Player.h:186
int32 value
Definition Player.h:187
uint32 spellId
Definition Player.h:189
flag96 mask
Definition Player.h:188

References Aura::CallScriptEffectCalcSpellModHandlers(), SpellInfo::Effects, GetAmount(), GetAuraType(), GetBase(), GetEffIndex(), GetId(), GetMiscValue(), GetSpellInfo(), m_spellmod, SpellModifier::mask, SpellModifier::op, SPELL_AURA_ADD_FLAT_MODIFIER, SPELL_AURA_ADD_PCT_MODIFIER, SpellModifier::spellId, SpellModifier::type, and SpellModifier::value.

Referenced by AuraEffect(), ChangeAmount(), and Aura::SetLoadedState().

◆ CanApplyResilience()

bool AuraEffect::CanApplyResilience ( ) const
inline

◆ CanBeRecalculated()

bool AuraEffect::CanBeRecalculated ( ) const
inline

◆ ChangeAmount()

void AuraEffect::ChangeAmount ( int32  newAmount,
bool  mark = true,
bool  onStackOrReapply = false 
)
714{
715 // Reapply if amount change
716 uint8 handleMask = 0;
717 if (newAmount != GetAmount())
719 if (onStackOrReapply)
720 handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
721
722 if (!handleMask)
723 return;
724
725 std::list<AuraApplication*> effectApplications;
726 GetApplicationList(effectApplications);
727
728 for (AuraApplication* aurApp : effectApplications)
729 if (aurApp->HasEffect(GetEffIndex()))
730 {
731 aurApp->GetTarget()->_RegisterAuraEffect(this, false);
732 HandleEffect(aurApp, handleMask, false);
733 }
734
735 if (handleMask & AURA_EFFECT_HANDLE_CHANGE_AMOUNT)
736 {
737 if (!mark)
738 m_amount = newAmount;
739 else
740 SetAmount(newAmount);
742 }
743
744 for (AuraApplication* aurApp : effectApplications)
745 if (aurApp->HasEffect(GetEffIndex()))
746 {
747 if (aurApp->GetRemoveMode() != AURA_REMOVE_NONE)
748 continue;
749
750 aurApp->GetTarget()->_RegisterAuraEffect(this, true);
751 HandleEffect(aurApp, handleMask, true);
752 }
753}
@ AURA_REMOVE_NONE
Definition SpellAuraDefines.h:391
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT
Definition SpellAuraDefines.h:44
@ AURA_EFFECT_HANDLE_REAPPLY
Definition SpellAuraDefines.h:45
Definition SpellAuras.h:37
void GetApplicationList(std::list< AuraApplication * > &applicationList) const
Definition SpellAuraEffects.cpp:422
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
Definition SpellAuraEffects.cpp:755
void SetAmount(int32 amount)
Definition SpellAuraEffects.h:66

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT, AURA_EFFECT_HANDLE_REAPPLY, AURA_REMOVE_NONE, CalculateSpellMod(), GetAmount(), GetApplicationList(), GetEffIndex(), HandleEffect(), m_amount, and SetAmount().

Referenced by spell_gen_arena_drink::CalcAmount(), spell_jormungars_paralytic_toxin_aura::HandlePeriodic(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), RecalculateAmount(), RecalculateAmount(), and spell_gen_arena_drink::UpdatePeriodic().

◆ CheckEffectProc()

bool AuraEffect::CheckEffectProc ( AuraApplication *  aurApp,
ProcEventInfo &  eventInfo 
) const
1215{
1216 bool result = GetBase()->CallScriptCheckEffectProcHandlers(this, aurApp, eventInfo);
1217 if (!result)
1218 return false;
1219
1220 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
1221 switch (GetAuraType())
1222 {
1228 {
1229 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
1230 if (!damageInfo || !damageInfo->GetDamage())
1231 return false;
1232
1233 // Spell own damage at apply won't break CC
1234 if (spellInfo && spellInfo == GetSpellInfo())
1235 {
1236 Aura* aura = GetBase();
1237 // called from spellcast, should not have ticked yet
1238 if (aura->GetDuration() == aura->GetMaxDuration())
1239 return false;
1240 }
1241 break;
1242 }
1245 // compare mechanic
1246 if (!spellInfo || !(spellInfo->GetAllEffectsMechanicMask() & (1ULL << GetMiscValue())))
1247 return false;
1248 break;
1250 // skip melee hits and instant cast spells
1251 if (!eventInfo.GetProcSpell() || !eventInfo.GetProcSpell()->GetCastTime())
1252 return false;
1253 break;
1255 // Spell magnets do not consume charges for spells they cannot redirect.
1256 if (!spellInfo || !spellInfo->CanBeRedirectedBySpellMagnet())
1257 return false;
1258 break;
1261 {
1262 // Skip melee hits and spells with wrong school or zero cost
1263 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue())
1264 || !spellInfo->ManaCost || !spellInfo->ManaCostPercentage)
1265 return false;
1266 break;
1267 }
1269 // Skip melee hits and spells with wrong school
1270 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue()))
1271 return false;
1272 break;
1274 // Compare casters
1275 if (GetCasterGUID() != eventInfo.GetActor()->GetGUID())
1276 return false;
1277 break;
1280 {
1281 // Don't proc extra attacks while already processing extra attack spell
1282 uint32 triggerSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1283 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
1284 {
1285 if (triggeredSpellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
1286 {
1287 uint32 lastExtraAttackSpell = eventInfo.GetActor()->GetLastExtraAttackSpell();
1288
1289 // Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
1290 if (lastExtraAttackSpell == triggerSpellId)
1291 return false;
1292
1293 // Patch 2.2.0 Sword Specialization (Warrior, Rogue) extra attack can no longer proc additional extra attacks
1294 // 3.3.5 Sword Specialization (Warrior), Hack and Slash (Rogue)
1295 if (lastExtraAttackSpell == SPELL_SWORD_SPECIALIZATION || lastExtraAttackSpell == SPELL_HACK_AND_SLASH)
1296 return false;
1297 }
1298 }
1299 break;
1300 }
1301 default:
1302 break;
1303 }
1304
1305 return result;
1306}
@ SPELL_EFFECT_ADD_EXTRA_ATTACKS
Definition SharedDefines.h:785
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
Definition SpellAuraDefines.h:294
@ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
Definition SpellAuraDefines.h:135
@ SPELL_AURA_MOD_POWER_COST_SCHOOL
Definition SpellAuraDefines.h:136
@ SPELL_AURA_MECHANIC_IMMUNITY
Definition SpellAuraDefines.h:140
@ SPELL_AURA_SPELL_MAGNET
Definition SpellAuraDefines.h:159
@ SPELL_AURA_MOD_DAMAGE_FROM_CASTER
Definition SpellAuraDefines.h:334
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
Definition SpellAuraDefines.h:137
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
Definition SpellAuraDefines.h:180
@ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
Definition SpellAuraDefines.h:128
#define sSpellMgr
Definition SpellMgr.h:851
@ SPELL_HACK_AND_SLASH
Definition Unit.h:306
@ SPELL_SWORD_SPECIALIZATION
Definition Unit.h:305
ObjectGuid GetCasterGUID() const
Definition SpellAuraEffects.h:48
int32 GetMaxDuration() const
Definition SpellAuras.h:131
bool CallScriptCheckEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2762
Definition Unit.h:344
uint32 GetDamage() const
Definition Unit.h:381
Spell const * GetProcSpell() const
Definition Unit.h:477
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:301
Unit * GetActor()
Definition Unit.h:468
DamageInfo * GetDamageInfo() const
Definition Unit.h:478
Definition SpellInfo.h:340
uint64 GetAllEffectsMechanicMask() const
Definition SpellInfo.cpp:1926
bool CanBeRedirectedBySpellMagnet() const
Definition SpellInfo.cpp:1060
uint32 ManaCostPercentage
Definition SpellInfo.h:391
uint32 ManaCost
Definition SpellInfo.h:387
int32 GetCastTime() const
Definition Spell.h:562
uint32 GetLastExtraAttackSpell() const
Definition Unit.h:1024

References Aura::CallScriptCheckEffectProcHandlers(), SpellInfo::CanBeRedirectedBySpellMagnet(), SpellInfo::Effects, ProcEventInfo::GetActor(), SpellInfo::GetAllEffectsMechanicMask(), GetAuraType(), GetBase(), GetCasterGUID(), Spell::GetCastTime(), DamageInfo::GetDamage(), ProcEventInfo::GetDamageInfo(), Aura::GetDuration(), GetEffIndex(), Object::GetGUID(), Unit::GetLastExtraAttackSpell(), Aura::GetMaxDuration(), GetMiscValue(), ProcEventInfo::GetProcSpell(), SpellInfo::GetSchoolMask(), ProcEventInfo::GetSpellInfo(), GetSpellInfo(), m_spellInfo, SpellInfo::ManaCost, SpellInfo::ManaCostPercentage, SPELL_AURA_MECHANIC_IMMUNITY, SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_MECHANIC_RESISTANCE, SPELL_AURA_MOD_POWER_COST_SCHOOL, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_AURA_SPELL_MAGNET, SPELL_AURA_TRANSFORM, SPELL_EFFECT_ADD_EXTRA_ATTACKS, SPELL_HACK_AND_SLASH, SPELL_SWORD_SPECIALIZATION, and sSpellMgr.

◆ CleanupTriggeredSpells()

void AuraEffect::CleanupTriggeredSpells ( Unit *  target)
Todo:
: is there a spell flag, which can solve this in a more sophisticated way?
1347{
1348 uint32 tSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1349 if (!tSpellId)
1350 return;
1351
1352 SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
1353 if (!tProto)
1354 return;
1355
1356 if (tProto->GetDuration() != -1)
1357 return;
1358
1359 // needed for spell 43680, maybe others
1363 return;
1364
1365 target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
1366}
int32 GetDuration() const
Definition SpellInfo.cpp:2764
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4969

References SpellInfo::Effects, GetCasterGUID(), SpellInfo::GetDuration(), GetEffIndex(), m_spellInfo, Unit::RemoveAurasDueToSpell(), SPELL_AURA_PERIODIC_TRIGGER_SPELL, and sSpellMgr.

Referenced by AuraApplication::_HandleEffect().

◆ GetAmount()

int32 AuraEffect::GetAmount ( ) const
inline
64{ return m_isAuraEnabled ? m_amount : 0; }

References m_amount, and m_isAuraEnabled.

Referenced by AuraApplication::_HandleEffect(), Pet::_SaveAuras(), spell_dru_survival_instincts_aura::AfterApply(), spell_the_lich_king_necrotic_plague_jump_aura::AfterDispel(), spell_dru_lifebloom::AfterRemove(), spell_mage_living_bomb::AfterRemove(), spell_warl_curse_of_agony::ApplyEffect(), Unit::CalcAbsorbResist(), Unit::CalcHealAbsorb(), spell_sha_earth_shield::CalculateAmount(), spell_jormungars_paralytic_toxin_aura::CalculateAmount(), spell_warl_generic_scaling::CalculateAPAmount(), CalculateSpellMod(), ChangeAmount(), spell_hun_lock_and_load::CheckPeriodicProc(), spell_hun_lock_and_load::CheckTrapProc(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), spell_nether_portal_perseverence::HandleApply(), spell_pri_renew::HandleApplyEffect(), HandleAuraDummy(), HandleAuraIncreaseBaseHealthPercent(), HandleAuraLinked(), HandleAuraModAttackPower(), HandleAuraModAttackPowerPercent(), HandleAuraModBaseResistancePCT(), HandleAuraModCritPct(), HandleAuraModFakeInebriation(), HandleAuraModIncreaseEnergy(), HandleAuraModIncreaseEnergyPercent(), HandleAuraModIncreaseHealth(), HandleAuraModIncreaseHealthPercent(), HandleAuraModIncreaseMaxHealth(), HandleAuraModRangedAttackPower(), HandleAuraModRangedAttackPowerPercent(), HandleAuraModRangedHaste(), HandleAuraModResistance(), HandleAuraModResistanceExclusive(), HandleAuraModSkill(), HandleAuraModStat(), Unit::HandleAuraRaidProcFromChargeWithValue(), HandleAuraRetainComboPoints(), Aura::HandleAuraSpecificMods(), spell_sha_maelstrom_weapon::HandleBonus(), HandleBreakableCCAuraProc(), HandleChannelDeathItem(), spell_dk_raise_ally::HandleDummy(), spell_shadowfang_keep_haunting_spirits_aura::HandleDummyTick(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_dru_idol_lifebloom::HandleEffectCalcSpellMod(), spell_pal_exorcism_and_holy_wrath_damage::HandleEffectCalcSpellMod(), spell_warl_improved_demonic_tactics::HandleEffectCalcSpellMod(), spell_warr_glyph_of_sunder_armor::HandleEffectCalcSpellMod(), spell_gen_leeching_swarm_aura::HandleEffectPeriodic(), spell_icc_yh_volley_aura::HandleEffectPeriodic(), spell_hallows_end_base_fire::HandleEffectPeriodicUpdate(), spell_gen_burn_brutallus::HandleEffectPeriodicUpdate(), spell_sha_item_t10_elemental_2p_bonus::HandleEffectProc(), spell_serpentshrine_cavern_infection::HandleEffectRemove(), HandleModAttackSpeed(), HandleModBaseResistance(), HandleModCastingSpeed(), HandleModCombatSpeedPct(), HandleModDamageDone(), HandleModHitChance(), HandleModInvisibility(), HandleModInvisibilityDetect(), HandleModMeleeRangedSpeedPct(), HandleModMeleeSpeedPct(), HandleModPercentStat(), HandleModPowerCost(), HandleModPowerCostPCT(), HandleModRating(), HandleModSpellCritChance(), HandleModSpellHitChance(), HandleModStealth(), HandleModStealthDetect(), HandleModStealthLevel(), HandleModTargetResistance(), spell_dk_chains_of_ice_aura::HandlePeriodic(), spell_jormungars_paralytic_toxin_aura::HandlePeriodic(), spell_ragin_flames_inferno::HandlePeriodic(), spell_dk_death_and_decay_aura::HandlePeriodic(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_hun_sniper_training::HandlePeriodic(), spell_hun_rapid_recuperation::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), HandlePeriodicDamageAurasTick(), HandlePeriodicHealthFunnelAuraTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicTriggerSpellWithValueAuraTick(), spell_dk_butchery::HandleProc(), spell_dk_vendetta::HandleProc(), spell_dru_living_seed_proc::HandleProc(), spell_dru_glyph_of_innervate::HandleProc(), spell_dru_leader_of_the_pack::HandleProc(), spell_mage_magic_absorption::HandleProc(), spell_pal_sacred_shield_dummy::HandleProc(), spell_pri_imp_shadowform::HandleProc(), spell_sha_earth_shield::HandleProc(), spell_sha_shamanistic_rage::HandleProc(), spell_oculus_temporal_rift_aura::HandleProc(), spell_pet_guard_dog::HandleProc(), spell_dk_improved_blood_presence_triggered::HandleProc(), spell_dk_unholy_blight::HandleProc(), spell_dk_necrosis::HandleProc(), spell_dk_threat_of_thassarian::HandleProc(), spell_dru_t10_balance_4p_bonus::HandleProc(), spell_dru_living_seed::HandleProc(), spell_dru_glyph_of_rejuvenation::HandleProc(), spell_dru_revitalize::HandleProc(), spell_dru_t3_8p_bonus::HandleProc(), spell_dru_glyph_of_shred::HandleProc(), spell_hun_glyph_of_arcane_shot::HandleProc(), spell_hun_piercing_shots::HandleProc(), spell_item_necrotic_touch::HandleProc(), spell_item_trinket_stack< StackSpell, TriggerSpell >::HandleProc(), spell_item_frozen_shadoweave::HandleProc(), spell_item_pet_healing::HandleProc(), spell_item_swift_hand_justice_dummy::HandleProc(), spell_mage_burnout::HandleProc(), spell_mage_master_of_elements::HandleProc(), spell_mage_hot_streak::HandleProc(), spell_pal_righteous_vengeance::HandleProc(), spell_pal_sheath_of_light::HandleProc(), spell_pal_judgement_of_light_heal::HandleProc(), spell_pal_spiritual_attunement::HandleProc(), spell_pal_t8_2p_bonus::HandleProc(), spell_pal_glyph_of_holy_light_dummy::HandleProc(), spell_pal_light_s_beacon::HandleProc(), spell_pri_divine_aegis::HandleProc(), spell_pri_glyph_of_prayer_of_healing::HandleProc(), spell_pri_vampiric_embrace::HandleProc(), spell_pri_glyph_of_dispel_magic::HandleProc(), spell_pri_t10_heal_2p_bonus::HandleProc(), spell_pri_blessed_recovery::HandleProc(), spell_rog_glyph_of_backstab::HandleProc(), spell_rog_quick_recovery::HandleProc(), spell_sha_t10_restoration_4p_bonus::HandleProc(), spell_sha_nature_guardian::HandleProc(), spell_sha_glyph_of_healing_wave::HandleProc(), spell_sha_spirit_hunt::HandleProc(), spell_sha_ancestral_awakening::HandleProc(), spell_sha_glyph_of_earth_shield::HandleProc(), spell_sha_glyph_of_totem_of_wrath::HandleProc(), spell_sha_t10_elemental_4p_bonus::HandleProc(), spell_sha_t8_elemental_4p_bonus::HandleProc(), spell_sha_t9_elemental_4p_bonus::HandleProc(), spell_warl_seed_of_corruption_dummy::HandleProc(), spell_warl_seed_of_corruption_generic::HandleProc(), spell_warl_soul_leech::HandleProc(), spell_putricide_gaseous_bloat_aura::HandleProc(), spell_dk_wandering_plague_aura::HandleProc(), spell_pri_body_and_soul::HandleProcDummy(), HandleProcTriggerDamageAuraProc(), HandleProcTriggerSpellWithValueAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), HandleRangedAmmoHaste(), spell_warl_haunt_aura::HandleRemove(), HandleShieldBlockValue(), HandleShieldBlockValuePercent(), spell_hun_sniper_training::HandleUpdatePeriodic(), Aura::IsAuraStronger(), Unit::IsHighestExclusiveAuraEffect(), Unit::MeleeDamageBonusTaken(), spell_valanar_kinetic_bomb_absorb_aura::OnAbsorb(), spell_the_lich_king_necrotic_plague_jump_aura::OnDispel(), spell_kalecgos_curse_of_boundless_agony_aura::OnPeriodic(), spell_xt002_gravity_bomb_aura::OnPeriodic(), spell_lurker_below_spout::OnPeriodic(), spell_blood_queen_essence_of_the_blood_queen_aura::OnProc(), spell_pal_eye_for_an_eye::OnProc(), spell_warl_siphon_life::OnProc(), spell_warl_fel_synergy::OnProc(), spell_warr_improved_spell_reflection::OnProc(), spell_warr_damage_shield::OnProc(), spell_sindragosa_instability_aura::OnRemove(), spell_the_lich_king_necrotic_plague_jump_aura::OnRemove(), spell_shield_of_runes_aura::OnRemove(), spell_xt002_searing_light_spawn_life_spark::OnRemove(), spell_xt002_gravity_bomb_aura::OnRemove(), spell_claw_swipe_check::OnRemove(), spell_ulduar_stone_grip_aura::OnRemoveStun(), spell_the_lich_king_infest_aura::OnUpdate(), spell_karazhan_overload_aura::PeriodicTick(), spell_sha_mana_tide::PeriodicTick(), Unit::RemoveAurasDueToSpellBySteal(), ArenaSpectator::ShouldSendAura(), Unit::SpellDamageBonusDone(), Unit::SpellPctDamageModsDone(), spell_black_temple_shadow_inferno_aura::Update(), spell_black_temple_spell_absorption_aura::Update(), Player::UpdateAttackPowerAndDamage(), spell_gen_arena_drink::UpdatePeriodic(), UpdatePeriodic(), Unit::UpdateResistanceBuffModsMod(), Unit::UpdateStatBuffMod(), and SpellInfo::ValidateAttribute6SpellDamageMods().

◆ GetAmplitude()

int32 AuraEffect::GetAmplitude ( ) const
inline

◆ GetApplicationList()

void AuraEffect::GetApplicationList ( std::list< AuraApplication * > &  applicationList) const
423{
424 Aura::ApplicationMap const& targetMap = GetBase()->GetApplicationMap();
425 for (Aura::ApplicationMap::const_iterator appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
426 {
427 if (appIter->second->HasEffect(GetEffIndex()))
428 applicationList.push_back(appIter->second);
429 }
430}
ApplicationMap const & GetApplicationMap()
Definition SpellAuras.h:184
std::map< ObjectGuid, AuraApplication * > ApplicationMap
Definition SpellAuras.h:91

References Aura::GetApplicationMap(), GetBase(), and GetEffIndex().

Referenced by ChangeAmount(), and Update().

◆ GetAuraType()

AuraType AuraEffect::GetAuraType ( ) const
448{
449 return (AuraType)m_spellInfo->Effects[m_effIndex].ApplyAuraName;
450}
AuraType
Definition SpellAuraDefines.h:62

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

Referenced by AuraApplication::_HandleEffect(), Unit::_RegisterAuraEffect(), CalculateAmount(), CalculatePeriodic(), CalculateSpellMod(), CheckEffectProc(), HandleArenaPreparation(), HandleAuraAllowFlight(), HandleAuraEmpathy(), HandleAuraFeatherFall(), HandleAuraHover(), HandleAuraModDisarm(), HandleAuraModIncreaseFlightSpeed(), HandleAuraModSchoolImmunity(), HandleAuraModSkill(), HandleAuraModStalked(), HandleAuraTrackStealthed(), HandleAuraUntrackable(), HandleAuraWaterWalk(), HandleComprehendLanguage(), HandleEffect(), spell_dk_pet_scaling::HandleEffectApply(), spell_dru_treant_scaling::HandleEffectApply(), spell_pet_hit_expertise_scalling::HandleEffectApply(), spell_pet_intellect_spirit_resilience_scaling::HandleEffectApply(), spell_pet_spellhit_expertise_spellpen_scaling::HandleEffectApply(), spell_mage_pet_scaling::HandleEffectApply(), spell_pri_shadowfiend_scaling::HandleEffectApply(), spell_sha_feral_spirit_scaling::HandleEffectApply(), spell_sha_fire_elemental_scaling::HandleEffectApply(), spell_warl_infernal_scaling::HandleEffectApply(), HandleForceMoveForward(), HandleModCastingSpeed(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), HandlePeriodicDamageAurasTick(), HandlePeriodicHealAurasTick(), HandleProc(), Aura::IsAuraStronger(), PeriodicTick(), Player::RestoreBaseRune(), Unit::SendPeriodicAuraLog(), ArenaSpectator::ShouldSendAura(), and UpdatePeriodic().

◆ GetBase()

Aura * AuraEffect::GetBase ( ) const
inline
49{ return m_base; }

References m_base.

Referenced by spell_rog_stealth_buff_tracker< RemoveSpellId >::AfterApply(), ApplySpellMod(), Unit::CalcAbsorbResist(), Unit::CalcHealAbsorb(), CalculateAmount(), CalculatePeriodic(), CalculatePeriodicData(), CalculateSpellMod(), CheckEffectProc(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), spell_festergut_blighted_spores_aura::ExtraEffect(), GetApplicationList(), Unit::GetAuraEffect(), GetCaster(), GetCasterGUID(), GetTargetList(), GetTotalTicks(), HandleAuraDummy(), HandleAuraLinked(), HandleAuraModShapeshift(), HandleAuraModStateImmunity(), HandleAuraMounted(), Unit::HandleAuraRaidProcFromCharge(), Unit::HandleAuraRaidProcFromChargeWithValue(), HandleAuraRetainComboPoints(), HandleEffect(), HandleEffect(), spell_pal_exorcism_and_holy_wrath_damage::HandleEffectCalcSpellMod(), spell_warl_improved_demonic_tactics::HandleEffectCalcSpellMod(), spell_warr_glyph_of_sunder_armor::HandleEffectCalcSpellMod(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_pos_glacial_strike_aura::HandleEffectPeriodic(), HandleObsModPowerAuraTick(), HandlePeriodicDamageAurasTick(), HandlePeriodicEnergizeAuraTick(), HandlePeriodicHealAurasTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicManaLeechAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandleProc(), spell_sha_static_shock::HandleProc(), spell_sha_t10_elemental_4p_bonus::HandleProc(), HandleRaidProcFromChargeAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), spell_dk_glyph_of_scourge_strike_script::HandleScriptEffect(), spell_pal_seal_of_vengeance_aura::HandleSeal(), Unit::IsHighestExclusiveAuraEffect(), spell_hor_shared_suffering_aura::OnRemove(), PeriodicTick(), Spell::prepare(), Player::RestoreBaseRune(), Unit::SpellBaseDamageBonusTaken(), Update(), UpdatePeriodic(), and SpellInfo::ValidateAttribute6SpellDamageMods().

◆ GetBaseAmount()

◆ GetCaster()

◆ GetCasterGUID()

◆ GetCasterLevel()

uint8 AuraEffect::GetCasterLevel ( ) const
inline

◆ GetCritChance()

float AuraEffect::GetCritChance ( ) const
inline

◆ GetDieSides()

int32 AuraEffect::GetDieSides ( ) const
inline
58{ return m_dieSides; }

References m_dieSides.

Referenced by spell_warl_demonic_knowledge::CalculateAmount().

◆ GetEffIndex()

uint32 AuraEffect::GetEffIndex ( ) const
inline
56{ return m_effIndex; }

References m_effIndex.

Referenced by spell_dru_lifebloom::AfterRemove(), ApplySpellMod(), Unit::CalcAbsorbResist(), spell_pal_sacred_shield::CalculateAmount(), spell_sha_earth_shield::CalculateAmount(), spell_warl_improved_demonic_tactics::CalculateAmount(), spell_warr_rend::CalculateAmount(), CalculateAmount(), spell_warl_seed_of_corruption_dummy::CalculateBuffer(), spell_dru_treant_scaling::CalculateResistanceAmount(), spell_hun_generic_scaling::CalculateResistanceAmount(), spell_mage_pet_scaling::CalculateResistanceAmount(), spell_pri_shadowfiend_scaling::CalculateResistanceAmount(), spell_sha_feral_spirit_scaling::CalculateResistanceAmount(), spell_sha_fire_elemental_scaling::CalculateResistanceAmount(), spell_warl_generic_scaling::CalculateResistanceAmount(), spell_warl_infernal_scaling::CalculateResistanceAmount(), spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), CalculateSpellMod(), spell_dk_pet_scaling::CalculateStatAmount(), spell_dru_treant_scaling::CalculateStatAmount(), spell_hun_generic_scaling::CalculateStatAmount(), spell_mage_pet_scaling::CalculateStatAmount(), spell_pri_shadowfiend_scaling::CalculateStatAmount(), spell_sha_feral_spirit_scaling::CalculateStatAmount(), spell_sha_fire_elemental_scaling::CalculateStatAmount(), spell_warl_generic_scaling::CalculateStatAmount(), spell_warl_infernal_scaling::CalculateStatAmount(), Aura::CallScriptAfterEffectApplyHandlers(), Aura::CallScriptAfterEffectProcHandlers(), Aura::CallScriptAfterEffectRemoveHandlers(), Aura::CallScriptCheckEffectProcHandlers(), Aura::CallScriptEffectAbsorbHandlers(), Aura::CallScriptEffectAfterAbsorbHandlers(), Aura::CallScriptEffectAfterManaShieldHandlers(), Aura::CallScriptEffectApplyHandlers(), Aura::CallScriptEffectCalcAmountHandlers(), Aura::CallScriptEffectCalcPeriodicHandlers(), Aura::CallScriptEffectCalcSpellModHandlers(), Aura::CallScriptEffectManaShieldHandlers(), Aura::CallScriptEffectPeriodicHandlers(), Aura::CallScriptEffectProcHandlers(), Aura::CallScriptEffectRemoveHandlers(), Aura::CallScriptEffectSplitHandlers(), Aura::CallScriptEffectUpdatePeriodicHandlers(), SpellInfo::CanSpellCastOverrideAuraEffect(), Unit::CastDelayedSpellWithPeriodicAmount(), ChangeAmount(), CheckEffectProc(), CleanupTriggeredSpells(), GetApplicationList(), GetTargetList(), spell_muru_summon_blood_elves_periodic_aura::HandleApply(), spell_gen_baby_murloc_passive::HandleApply(), HandleAuraLinked(), HandleAuraModStat(), Unit::HandleAuraRaidProcFromCharge(), Unit::HandleAuraRaidProcFromChargeWithValue(), HandleEffect(), spell_dru_idol_lifebloom::HandleEffectCalcSpellMod(), spell_warr_glyph_of_sunder_armor::HandleEffectCalcSpellMod(), spell_q12619_emblazon_runeblade::HandleEffectPeriodic(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_transitus_shield_beam_aura::HandleOnEffectApply(), spell_kiljaeden_shadow_spike_aura::HandlePeriodic(), spell_kiljaeden_armageddon_periodic_aura::HandlePeriodic(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_halion_twilight_cutter_periodic_aura::HandlePeriodic(), spell_oculus_ride_ruby_emerald_amber_drake_que_aura::HandlePeriodic(), spell_dk_pet_scaling::HandlePeriodic(), spell_dk_army_of_the_dead_passive::HandlePeriodic(), spell_pet_hit_expertise_scalling::HandlePeriodic(), spell_pet_intellect_spirit_resilience_scaling::HandlePeriodic(), spell_pet_spellhit_expertise_spellpen_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_hun_sniper_training::HandlePeriodic(), spell_hun_rapid_recuperation::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_q13413_wyrmrest_skytalon_ride_periodic::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_improved_demonic_tactics::HandlePeriodic(), spell_warl_demonic_knowledge::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), HandlePeriodicDamageAurasTick(), HandlePeriodicHealAurasTick(), HandlePeriodicHealthFunnelAuraTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicManaLeechAuraTick(), HandlePeriodicPowerBurnAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandlePeriodicTriggerSpellWithValueAuraTick(), spell_hun_cobra_strikes::HandleProc(), spell_rog_honor_among_thieves::HandleProc(), spell_karazhan_temptation::HandleProc(), spell_putricide_ooze_tank_protection::HandleProc(), spell_gen_proc_not_self::HandleProc(), spell_item_unsated_craving::HandleProc(), spell_sha_flametongue_weapon::HandleProc(), spell_sha_imp_water_shield::HandleProc(), HandleProcTriggerDamageAuraProc(), HandleProcTriggerSpellAuraProc(), HandleRaidProcFromChargeAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), spell_putricide_mutated_plague_aura::HandleTriggerSpell(), spell_hun_sniper_training::HandleUpdatePeriodic(), TriggeredByAuraSpellData::Init(), spell_hadronox_summon_periodic_aura::OnApply(), spell_gruul_ground_slam_trigger::OnApply(), spell_kalecgos_curse_of_boundless_agony_aura::OnPeriodic(), spell_the_lich_king_vile_spirits_aura::OnPeriodic(), spell_hookshot_aura::OnPeriodic(), spell_tar_blaze_aura::OnPeriodic(), spell_thorim_lightning_pillar_P2_aura::OnPeriodic(), spell_karathress_power_of_tidalvess::OnPeriodic(), spell_karathress_power_of_caribdis::OnPeriodic(), spell_leotheras_demon_link::OnPeriodic(), spell_gen_periodic_knock_away::OnPeriodic(), spell_broggok_poison_cloud::PeriodicTick(), spell_pal_beacon_of_light::PeriodicTick(), spell_illidari_council_deadly_strike_aura::Update(), spell_mother_shahraz_beam_periodic_aura::Update(), spell_mother_shahraz_saber_lash_aura::Update(), spell_black_temple_charge_rage_aura::Update(), spell_black_temple_shadow_inferno_aura::Update(), spell_black_temple_spell_absorption_aura::Update(), Update(), and Player::UpdateAttackPowerAndDamage().

◆ GetForcedAmount()

int32 AuraEffect::GetForcedAmount ( ) const
inline
65{ return m_amount; }

References m_amount.

◆ GetId()

◆ GetMiscValue()

int32 AuraEffect::GetMiscValue ( ) const
443{
444 return m_spellInfo->Effects[m_effIndex].MiscValue;
445}

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

Referenced by ApplySpellMod(), Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), CalculateSpellMod(), CheckEffectProc(), Unit::GetMaxNegativeAuraModifierByMiscMask(), Unit::GetMaxNegativeAuraModifierByMiscValue(), Unit::GetMaxPositiveAuraModifierByMiscMask(), Unit::GetMaxPositiveAuraModifierByMiscValue(), Unit::GetTotalAuraModifierByMiscMask(), Unit::GetTotalAuraModifierByMiscValue(), Unit::GetTotalAuraMultiplierByMiscMask(), Unit::GetTotalAuraMultiplierByMiscValue(), HandleAuraConvertRune(), HandleAuraDummy(), HandleAuraModBaseResistancePCT(), HandleAuraModEffectImmunity(), HandleAuraModFaction(), HandleAuraModIncreaseEnergy(), HandleAuraModIncreaseEnergyPercent(), HandleAuraModResistance(), HandleAuraModResistanceExclusive(), HandleAuraModResistenceOfStatPercent(), HandleAuraModSchoolImmunity(), HandleAuraModShapeshift(), HandleAuraModSkill(), HandleAuraModStat(), HandleAuraModStateImmunity(), HandleAuraMounted(), HandleAuraOverrideSpells(), HandleAuraSetVehicle(), HandleAuraTrackCreatures(), HandleAuraTrackResources(), HandleAuraTransform(), HandleDetectAmore(), spell_warl_improved_demonic_tactics::HandleEffectCalcSpellMod(), spell_warr_glyph_of_sunder_armor::HandleEffectCalcSpellMod(), HandleForceReaction(), HandleModBaseResistance(), HandleModDamageDone(), HandleModDamagePercentDone(), HandleModInvisibility(), HandleModInvisibilityDetect(), HandleModPercentStat(), HandleModPowerCost(), HandleModPowerCostPCT(), HandleModPowerRegen(), HandleModRating(), HandleModRatingFromStat(), HandleModResistancePercent(), HandleModSpellCritChanceShool(), HandleModStealth(), HandleModStealthDetect(), HandleModStealthLevel(), HandleModTargetResistance(), HandleModTotalPercentStat(), HandleObsModPowerAuraTick(), spell_illidan_shadow_prison_aura::HandleOnEffectApply(), spell_illidan_shadow_prison_aura::HandleOnEffectRemove(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), HandlePeriodicEnergizeAuraTick(), HandlePeriodicManaLeechAuraTick(), HandlePeriodicPowerBurnAuraTick(), HandleShapeshiftBoosts(), Aura::IsAuraStronger(), Unit::MeleeDamageBonusTaken(), Unit::SendPeriodicAuraLog(), Unit::SpellBaseDamageBonusDone(), Unit::SpellBaseDamageBonusTaken(), Unit::SpellBaseHealingBonusDone(), Unit::SpellDamageBonusDone(), Unit::SpellPctDamageModsDone(), Unit::UpdateDamageDoneMods(), Unit::UpdateDamagePctDoneMods(), Unit::UpdateResistanceBuffModsMod(), and Unit::UpdateStatBuffMod().

◆ GetMiscValueB()

int32 AuraEffect::GetMiscValueB ( ) const
438{
439 return m_spellInfo->Effects[m_effIndex].MiscValueB;
440}

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

Referenced by HandleAuraConvertRune(), and HandleModPowerRegen().

◆ GetOldAmount()

int32 AuraEffect::GetOldAmount ( ) const
inline
116{ return m_oldAmount; }

References m_oldAmount.

Referenced by Unit::CastDelayedSpellWithPeriodicAmount().

◆ GetPctMods()

float AuraEffect::GetPctMods ( ) const
inline
113{ return m_pctMods; }

References m_pctMods.

Referenced by CalculateAmount().

◆ GetPeriodicTimer()

int32 AuraEffect::GetPeriodicTimer ( ) const
inline

◆ GetSpellInfo()

SpellInfo const * AuraEffect::GetSpellInfo ( ) const
inline
54{ return m_spellInfo; }

References m_spellInfo.

Referenced by spell_dragonblight_corrosive_spit::AfterApply(), Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), CalcPeriodicCritChance(), CalculateAmount(), CalculatePeriodic(), CalculatePeriodicData(), spell_dru_treant_scaling::CalculateResistanceAmount(), spell_hun_generic_scaling::CalculateResistanceAmount(), spell_mage_pet_scaling::CalculateResistanceAmount(), spell_pri_shadowfiend_scaling::CalculateResistanceAmount(), spell_sha_feral_spirit_scaling::CalculateResistanceAmount(), spell_sha_fire_elemental_scaling::CalculateResistanceAmount(), spell_warl_generic_scaling::CalculateResistanceAmount(), spell_warl_infernal_scaling::CalculateResistanceAmount(), CalculateSpellMod(), spell_dk_pet_scaling::CalculateStatAmount(), spell_dru_treant_scaling::CalculateStatAmount(), spell_hun_generic_scaling::CalculateStatAmount(), spell_mage_pet_scaling::CalculateStatAmount(), spell_pri_shadowfiend_scaling::CalculateStatAmount(), spell_sha_feral_spirit_scaling::CalculateStatAmount(), spell_sha_fire_elemental_scaling::CalculateStatAmount(), spell_warl_generic_scaling::CalculateStatAmount(), spell_warl_infernal_scaling::CalculateStatAmount(), SpellInfo::CanSpellCastOverrideAuraEffect(), Player::CheckAttackFitToAuraRequirement(), CheckEffectProc(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Unit::GetHighestExclusiveSameEffectSpellGroupValue(), HandleAuraDummy(), HandleAuraModEffectImmunity(), HandleAuraModSchoolImmunity(), HandleAuraModShapeshift(), HandleAuraModStateImmunity(), HandleAuraMounted(), Unit::HandleAuraRaidProcFromCharge(), Unit::HandleAuraRaidProcFromChargeWithValue(), HandleAuraTransform(), HandleChannelDeathItem(), spell_dk_raise_ally::HandleDummy(), spell_dru_idol_lifebloom::HandleEffectCalcSpellMod(), spell_optic_link_aura::HandleEffectPeriodic(), HandleObsModPowerAuraTick(), spell_putricide_unbound_plague_dmg_aura::HandlePeriodic(), HandlePeriodicDamageAurasTick(), HandlePeriodicDummyAuraTick(), HandlePeriodicEnergizeAuraTick(), HandlePeriodicHealAurasTick(), HandlePeriodicHealthFunnelAuraTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicManaLeechAuraTick(), HandlePeriodicPowerBurnAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandlePeriodicTriggerSpellWithValueAuraTick(), spell_hun_cobra_strikes::HandleProc(), spell_dk_blood_caked_blade::HandleProc(), spell_gen_proc_not_self::HandleProc(), spell_pal_seal_of_command_aura::HandleProc(), spell_pal_illumination::HandleProc(), spell_pri_blessed_recovery::HandleProc(), spell_sha_imp_water_shield::HandleProc(), spell_sha_lightning_shield::HandleProc(), spell_sha_static_shock::HandleProc(), spell_warl_soul_leech::HandleProc(), HandleProcTriggerDamageAuraProc(), HandleProcTriggerSpellAuraProc(), HandleProcTriggerSpellWithValueAuraProc(), HandleRaidProcFromChargeAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), spell_dk_glyph_of_scourge_strike_script::HandleScriptEffect(), spell_pal_seal_of_vengeance_aura::HandleSeal(), TriggeredByAuraSpellData::Init(), Unit::IsHighestExclusiveAuraEffect(), spell_gen_sober_up::OnRemove(), Acore::AbsorbAuraOrderPred::operator()(), spell_entropius_negative_energy_periodic::PeriodicTick(), spell_dragonblight_corrosive_spit::PeriodicTick(), Player::RestoreBaseRune(), Unit::SendPeriodicAuraLog(), Unit::SpellBaseDamageBonusDone(), Unit::SpellBaseDamageBonusTaken(), Unit::SpellPctDamageModsDone(), Player::UpdateAttackPowerAndDamage(), Player::UpdateExpertise(), UpdatePeriodic(), and SpellInfo::ValidateAttribute6SpellDamageMods().

◆ GetSpellModifier()

SpellModifier * AuraEffect::GetSpellModifier ( ) const
inline
52{ return m_spellmod; }

References m_spellmod.

◆ GetTargetList()

void AuraEffect::GetTargetList ( std::list< Unit * > &  targetList) const
412{
413 Aura::ApplicationMap const& targetMap = GetBase()->GetApplicationMap();
414 // remove all targets which were not added to new list - they no longer deserve area aura
415 for (Aura::ApplicationMap::const_iterator appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
416 {
417 if (appIter->second->HasEffect(GetEffIndex()))
418 targetList.push_back(appIter->second->GetTarget());
419 }
420}

References Aura::GetApplicationMap(), GetBase(), and GetEffIndex().

◆ GetTickNumber()

uint32 AuraEffect::GetTickNumber ( ) const
inline
87{ return m_tickNumber; }

References m_tickNumber.

Referenced by Unit::CastDelayedSpellWithPeriodicAmount(), spell_dreamwalker_decay_periodic_timer_aura::DecayPeriodicTimer(), spell_pos_blight_aura::HandleEffectPeriodic(), spell_icc_yh_volley_aura::HandleEffectPeriodic(), spell_hodir_biting_cold_main_aura::HandleEffectPeriodic(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_ignis_scorch_aura::HandleEffectPeriodic(), spell_mimiron_rapid_burst_aura::HandleEffectPeriodic(), spell_frost_tomb_aura::HandleEffectPeriodic(), spell_optic_link_aura::HandleEffectPeriodic(), spell_quest_test_flight_charging::HandleEffectPeriodicPlatform(), spell_quest_test_flight_charging::HandleEffectPeriodicSelf(), spell_hallows_end_base_fire::HandleEffectPeriodicUpdate(), spell_gen_burn_brutallus::HandleEffectPeriodicUpdate(), spell_warl_curse_of_agony::HandleEffectPeriodicUpdate(), spell_putricide_unbound_plague_dmg_aura::HandlePeriodic(), spell_shadow_bolt_whirl::HandlePeriodic(), spell_bronjahm_soulstorm_channel_ooc_aura::HandlePeriodicTick(), spell_bronjahm_soulstorm_visual_aura::HandlePeriodicTick(), spell_wailing_souls_periodic_aura::HandlePeriodicTick(), spell_exploding_orb_auto_grow_aura::HandlePeriodicTick(), spell_item_direbrew_remote_aura::HandlePeriodicTick(), HandlePeriodicTriggerSpellAuraTick(), spell_igb_rocket_pack_aura::HandleRemove(), spell_dru_wild_growth_aura::HandleTickUpdate(), spell_alert_drums::HandleTriggerSpell(), TriggeredByAuraSpellData::Init(), spell_eredar_twins_handle_touch_periodic::OnPeriodic(), spell_kalecgos_curse_of_boundless_agony_aura::OnPeriodic(), spell_muru_darkness_aura::OnPeriodic(), spell_the_lich_king_vile_spirits_aura::OnPeriodic(), spell_the_lich_king_soul_rip_aura::OnPeriodic(), spell_web_wrap_damage::OnPeriodic(), spell_assembly_rune_of_summoning_aura::OnPeriodic(), spell_illidan_demon_transform2_aura::OnPeriodic(), spell_the_lich_king_infest_aura::OnUpdate(), spell_karazhan_overload_aura::PeriodicTick(), spell_geddon_inferno_aura::PeriodicTick(), spell_entropius_negative_energy_periodic::PeriodicTick(), spell_doomfire::PeriodicTick(), spell_trollgore_corpse_explode_aura::PeriodicTick(), spell_blood_queen_pact_of_the_darkfallen_dmg_aura::PeriodicTick(), spell_igb_explosion_main_aura::PeriodicTick(), spell_dreamwalker_mana_void_aura::PeriodicTick(), spell_summoning_rhyme_aura::PeriodicTick(), spell_broggok_poison_cloud::PeriodicTick(), spell_gen_holiday_buff_food::TriggerFoodBuff(), spell_mother_shahraz_random_periodic_aura::Update(), and spell_gen_arena_drink::UpdatePeriodic().

◆ GetTotalTicks()

◆ HandleArenaPreparation()

void AuraEffect::HandleArenaPreparation ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5134{
5135 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5136 return;
5137
5138 Unit* target = aurApp->GetTarget();
5139
5140 if (apply)
5142 else
5143 {
5144 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5145 if (target->HasAuraType(GetAuraType()))
5146 return;
5148 }
5149}
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
@ UNIT_FLAG_PREPARATION
Definition UnitDefines.h:262
Definition Unit.h:670
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:5805
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:754
ObjectGuid GetTarget() const
Definition Unit.h:867
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:755

References AURA_EFFECT_HANDLE_REAL, GetAuraType(), AuraApplication::GetTarget(), Unit::HasAuraType(), Unit::RemoveUnitFlag(), Unit::SetUnitFlag(), and UNIT_FLAG_PREPARATION.

◆ HandleAuraAllowFlight()

void AuraEffect::HandleAuraAllowFlight ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3457{
3459 return;
3460
3461 Unit* target = aurApp->GetTarget();
3462
3463 if (!apply)
3464 {
3465 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3466 if (target->HasAuraType(GetAuraType()) || target->HasIncreaseMountedFlightSpeedAura())
3467 return;
3468 }
3469
3470 target->SetCanFly(apply);
3471
3472 if (!apply && target->IsCreature() && !target->IsLevitating())
3473 target->GetMotionMaster()->MoveFall();
3474}
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK
Definition SpellAuraDefines.h:48
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
The unit will fall. Used when in the air. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:782
bool IsCreature() const
Definition Object.h:211
MotionMaster * GetMotionMaster()
Definition Unit.h:1774
bool IsLevitating() const
Definition Unit.h:1726
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:16262
bool HasIncreaseMountedFlightSpeedAura() const
Definition Unit.h:1849

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), Unit::GetMotionMaster(), AuraApplication::GetTarget(), Unit::HasAuraType(), Unit::HasIncreaseMountedFlightSpeedAura(), Object::IsCreature(), Unit::IsLevitating(), MotionMaster::MoveFall(), and Unit::SetCanFly().

◆ HandleAuraAllowOnlyAbility()

void AuraEffect::HandleAuraAllowOnlyAbility ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3235{
3237 return;
3238
3239 Unit* target = aurApp->GetTarget();
3240
3241 if (target->IsPlayer())
3242 {
3243 if (apply)
3245 else
3246 {
3247 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3248 if (target->HasAllowOnlyAbilityAura())
3249 return;
3251 }
3252 }
3253}
@ PLAYER_ALLOW_ONLY_ABILITY
Definition Player.h:482
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:1126
void RemovePlayerFlag(PlayerFlags flags)
Definition Player.h:1127
bool HasAllowOnlyAbilityAura() const
Definition Unit.h:1837

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, AuraApplication::GetTarget(), Unit::HasAllowOnlyAbilityAura(), Object::IsPlayer(), PLAYER_ALLOW_ONLY_ABILITY, Player::RemovePlayerFlag(), Player::SetPlayerFlag(), and Object::ToPlayer().

◆ HandleAuraCloneCaster()

void AuraEffect::HandleAuraCloneCaster ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2930{
2932 return;
2933
2934 Unit* target = aurApp->GetTarget();
2935
2936 if (apply)
2937 {
2938 Unit* caster = GetCaster();
2939 if (!caster || caster == target)
2940 return;
2941
2942 // What must be cloned? at least display and scale
2943 target->SetDisplayId(caster->GetDisplayId());
2945 }
2946 else
2947 {
2948 target->SetDisplayId(target->GetNativeDisplayId());
2950 }
2951}
@ UNIT_FLAG2_MIRROR_IMAGE
Definition UnitDefines.h:300
virtual void SetDisplayId(uint32 modelId, std::optional< float > displayScale={})
Definition Unit.cpp:12837
void SetUnitFlag2(UnitFlags2 flags)
Definition Unit.h:760
uint32 GetDisplayId() const
Definition Unit.h:1996
uint32 GetNativeDisplayId() const
Definition Unit.h:1998
void RemoveUnitFlag2(UnitFlags2 flags)
Definition Unit.h:761

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetCaster(), Unit::GetDisplayId(), Unit::GetNativeDisplayId(), AuraApplication::GetTarget(), Unit::RemoveUnitFlag2(), Unit::SetDisplayId(), Unit::SetUnitFlag2(), and UNIT_FLAG2_MIRROR_IMAGE.

◆ HandleAuraControlVehicle()

void AuraEffect::HandleAuraControlVehicle ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

Such auras are applied from a caster(=player) to a vehicle. This has been verified using spell #49256

3807{
3809 return;
3810
3811 Unit* target = aurApp->GetTarget();
3812
3813 if (!target->IsVehicle())
3814 return;
3815
3816 Unit* caster = GetCaster();
3817
3818 if (!caster || caster == target)
3819 return;
3820
3821 if (apply)
3822 {
3823 // Currently spells that have base points 0 and DieSides 0 = "0/0" exception are pushed to -1,
3824 // however the idea of 0/0 is to ingore flag VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT and -1 checks for it,
3825 // so this break such spells or most of them.
3826 // Current formula about m_amount: effect base points + dieside - 1
3827 // TO DO: Reasearch more about 0/0 and fix it.
3828 caster->_EnterVehicle(target->GetVehicleKit(), m_amount - 1, aurApp);
3829 }
3830 else
3831 {
3832 caster->_ExitVehicle();
3833 // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
3834 caster->RemoveAurasDueToSpell(GetId());
3835 }
3836}
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK
Definition SpellAuraDefines.h:49
bool IsVehicle() const
Definition Unit.h:806
void _ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:15424
void _EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:15306
Vehicle * GetVehicleKit() const
Definition Unit.h:1947

References Unit::_EnterVehicle(), Unit::_ExitVehicle(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetCaster(), GetId(), AuraApplication::GetTarget(), Unit::GetVehicleKit(), Unit::IsVehicle(), m_amount, and Unit::RemoveAurasDueToSpell().

◆ HandleAuraConvertRune()

void AuraEffect::HandleAuraConvertRune ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5799{
5800 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5801 return;
5802
5803 Unit* target = aurApp->GetTarget();
5804
5805 if (!target->IsPlayer())
5806 return;
5807
5808 Player* player = target->ToPlayer();
5809
5811 return;
5812
5813 uint32 runes = m_amount;
5814 // convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb
5815 if (apply)
5816 {
5817 for (uint32 i = 0; i < MAX_RUNES && runes; ++i)
5818 {
5819 if (GetMiscValue() != player->GetCurrentRune(i))
5820 continue;
5821 if (!player->GetRuneCooldown(i))
5822 {
5823 player->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
5824 --runes;
5825 }
5826 }
5827 }
5828 else
5829 player->RemoveRunesByAuraEffect(this);
5830}
RuneType
Definition Player.h:395
#define MAX_RUNES
Definition Player.h:385
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:131
@ CLASS_CONTEXT_ABILITY
Definition UnitDefines.h:241
int32 GetMiscValueB() const
Definition SpellAuraEffects.cpp:437
void RemoveRunesByAuraEffect(AuraEffect const *aura)
Definition Player.cpp:13732
uint32 GetRuneCooldown(uint8 index) const
Definition Player.h:2558
void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const *aura)
Definition Player.h:2569
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition Player.cpp:1350
RuneType GetCurrentRune(uint8 index) const
Definition Player.h:2557

References Player::AddRuneByAuraEffect(), AURA_EFFECT_HANDLE_REAL, CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, Player::GetCurrentRune(), GetMiscValue(), GetMiscValueB(), Player::GetRuneCooldown(), AuraApplication::GetTarget(), Player::IsClass(), Object::IsPlayer(), m_amount, MAX_RUNES, Player::RemoveRunesByAuraEffect(), and Object::ToPlayer().

◆ HandleAuraDummy()

void AuraEffect::HandleAuraDummy ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5192{
5194 return;
5195
5196 Unit* target = aurApp->GetTarget();
5197
5198 Unit* caster = GetCaster();
5199
5200 if (mode & AURA_EFFECT_HANDLE_REAL)
5201 {
5202 // pet auras
5203 if (PetAura const* petSpell = sSpellMgr->GetPetAura(GetId(), m_effIndex))
5204 {
5205 if (apply)
5206 target->AddPetAura(petSpell);
5207 else
5208 target->RemovePetAura(petSpell);
5209 }
5210 }
5211
5213 {
5214 // AT APPLY
5215 if (apply)
5216 {
5217 switch (GetId())
5218 {
5219 case 1515: // Tame beast
5220 // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
5221 if (caster && target->CanHaveThreatList())
5222 target->AddThreat(caster, 10.0f);
5223 break;
5224 case 34026: // kill command
5225 {
5226 Unit* pet = target->GetGuardianPet();
5227 if (!pet)
5228 break;
5229
5230 target->CastSpell(target, 34027, true, nullptr, this);
5231
5232 // set 3 stacks and 3 charges (to make all auras not disappear at once)
5233 Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
5234 Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
5235 if (owner_aura)
5236 {
5237 owner_aura->SetCharges(0);
5238 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5239 if (pet_aura)
5240 {
5241 pet_aura->SetCharges(0);
5242 pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5243 }
5244 }
5245 break;
5246 }
5247 case 37096: // Blood Elf Illusion
5248 {
5249 if (caster)
5250 {
5251 switch (caster->getGender())
5252 {
5253 case GENDER_FEMALE:
5254 caster->CastSpell(target, 37095, true, nullptr, this); // Blood Elf Disguise
5255 break;
5256 case GENDER_MALE:
5257 caster->CastSpell(target, 37093, true, nullptr, this);
5258 break;
5259 default:
5260 break;
5261 }
5262 }
5263 break;
5264 }
5265 case 55198: // Tidal Force
5266 {
5267 target->CastSpell(target, 55166, true);
5268 if (Aura* owner_aura = target->GetAura(55166))
5269 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5270 return;
5271 }
5272 case 39850: // Rocket Blast
5273 if (roll_chance_i(20)) // backfire stun
5274 target->CastSpell(target, 51581, true, nullptr, this);
5275 break;
5276 case 43873: // Headless Horseman Laugh
5277 target->PlayDistanceSound(11965);
5278 break;
5279 case 46354: // Blood Elf Illusion
5280 if (caster)
5281 {
5282 switch (caster->getGender())
5283 {
5284 case GENDER_FEMALE:
5285 caster->CastSpell(target, 46356, true, nullptr, this);
5286 break;
5287 case GENDER_MALE:
5288 caster->CastSpell(target, 46355, true, nullptr, this);
5289 break;
5290 }
5291 }
5292 break;
5293 case 46361: // Reinforced Net
5294 if (caster)
5295 target->GetMotionMaster()->MoveFall();
5296 break;
5297 case 46699: // Requires No Ammo
5298 if (target->IsPlayer())
5299 target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
5300 break;
5301 case 71563:
5302 {
5303 if (Aura* newAura = target->AddAura(71564, target))
5304 newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount);
5305 return;
5306 }
5307 }
5308 }
5309 // AT REMOVE
5310 else
5311 {
5312 if ((GetSpellInfo()->IsQuestTame()) && caster && caster->IsAlive() && target->IsAlive() && aurApp->GetRemoveMode() != AURA_REMOVE_BY_CANCEL)
5313 {
5314 uint32 finalSpelId = 0;
5315 switch (GetId())
5316 {
5317 case 19548:
5318 finalSpelId = 19597;
5319 break;
5320 case 19674:
5321 finalSpelId = 19677;
5322 break;
5323 case 19687:
5324 finalSpelId = 19676;
5325 break;
5326 case 19688:
5327 finalSpelId = 19678;
5328 break;
5329 case 19689:
5330 finalSpelId = 19679;
5331 break;
5332 case 19692:
5333 finalSpelId = 19680;
5334 break;
5335 case 19693:
5336 finalSpelId = 19684;
5337 break;
5338 case 19694:
5339 finalSpelId = 19681;
5340 break;
5341 case 19696:
5342 finalSpelId = 19682;
5343 break;
5344 case 19697:
5345 finalSpelId = 19683;
5346 break;
5347 case 19699:
5348 finalSpelId = 19685;
5349 break;
5350 case 19700:
5351 finalSpelId = 19686;
5352 break;
5353 case 30646:
5354 finalSpelId = 30647;
5355 break;
5356 case 30653:
5357 finalSpelId = 30648;
5358 break;
5359 case 30654:
5360 finalSpelId = 30652;
5361 break;
5362 case 30099:
5363 finalSpelId = 30100;
5364 break;
5365 case 30102:
5366 finalSpelId = 30103;
5367 break;
5368 case 30105:
5369 finalSpelId = 30104;
5370 break;
5371 }
5372
5373 if (finalSpelId)
5374 caster->CastSpell(target, finalSpelId, true, nullptr, this);
5375 }
5376
5378 {
5380 switch (GetId())
5381 {
5382 case 2584: // Waiting to Resurrect
5383 // Waiting to resurrect spell cancel, we must remove player from resurrect queue
5384 // bf branch omitted: it would cascade back into this handler.
5385 if (target->IsPlayer())
5386 if (Battleground* bg = target->ToPlayer()->GetBattleground())
5387 bg->RemovePlayerFromResurrectQueue(target->ToPlayer());
5388 break;
5389 case 43681: // Inactive
5390 {
5391 if (!target->IsPlayer() || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
5392 return;
5393
5394 if (target->GetMap()->IsBattleground())
5395 target->ToPlayer()->LeaveBattleground();
5396 break;
5397 }
5398 case 52172: // Coyote Spirit Despawn Aura
5399 case 60244: // Blood Parrot Despawn Aura
5400 target->CastSpell((Unit*)nullptr, GetAmount(), true, nullptr, this);
5401 break;
5402 // Halls of Lightning, Arc Lightning
5403 case 52921:
5404 {
5405 if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE )
5406 return;
5407
5408 Player* player = nullptr;
5409 Acore::AnyPlayerInObjectRangeCheck checker(target, 10.0f);
5410 Acore::PlayerSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(target, player, checker);
5411 Cell::VisitObjects(target, searcher, 10.0f);
5412
5413 if (player && player->GetGUID() != target->GetGUID())
5414 target->CastSpell(player, 52921, true);
5415
5416 return;
5417 }
5418 case 58600: // Restricted Flight Area
5419 case 58730: // Restricted Flight Area
5420 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
5421 target->CastSpell(target, 58601, true);
5422 break;
5423 case 46374: // quest The Power of the Elements (11893)
5424 {
5425 if (target->isDead() && GetBase() && target->IsCreature() && target->GetEntry() == 24601)
5426 {
5427 if (Unit* caster2 = GetBase()->GetCaster())
5428 {
5429 if (Player* player = caster2->GetCharmerOrOwnerPlayerOrPlayerItself())
5430 player->KilledMonsterCredit(25987);
5431 }
5432 }
5433 return;
5434 }
5435 }
5436 break;
5437 default:
5438 break;
5439 }
5440 }
5441 }
5442
5443 // AT APPLY & REMOVE
5444
5446 {
5448 {
5449 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5450 break;
5451 switch (GetId())
5452 {
5453 // Recently Bandaged
5454 case 11196:
5456 break;
5457 // Unstable Power
5458 case 24658:
5459 {
5460 uint32 spellId = 24659;
5461 if (apply && caster)
5462 {
5463 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
5464
5465 for (uint32 i = 0; i < spell->StackAmount; ++i)
5466 caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID());
5467 break;
5468 }
5469 target->RemoveAurasDueToSpell(spellId);
5470 break;
5471 }
5472 // Restless Strength
5473 case 24661:
5474 {
5475 uint32 spellId = 24662;
5476 if (apply && caster)
5477 {
5478 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
5479 for (uint32 i = 0; i < spell->StackAmount; ++i)
5480 caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID());
5481 break;
5482 }
5483 target->RemoveAurasDueToSpell(spellId);
5484 break;
5485 }
5486 // Tag Murloc
5487 case 30877:
5488 {
5489 // Tag/untag Blacksilt Scout
5490 target->SetEntry(apply ? 17654 : 17326);
5491 break;
5492 }
5493 case 57819: // Argent Champion
5494 case 57820: // Ebon Champion
5495 case 57821: // Champion of the Kirin Tor
5496 case 57822: // Wyrmrest Champion
5497 {
5498 if (!caster || !caster->IsPlayer())
5499 break;
5500
5501 uint32 FactionID = 0;
5502
5503 if (apply)
5504 {
5505 switch (m_spellInfo->Id)
5506 {
5507 case 57819:
5508 FactionID = 1106;
5509 break; // Argent Crusade
5510 case 57820:
5511 FactionID = 1098;
5512 break; // Knights of the Ebon Blade
5513 case 57821:
5514 FactionID = 1090;
5515 break; // Kirin Tor
5516 case 57822:
5517 FactionID = 1091;
5518 break; // The Wyrmrest Accord
5519 }
5520 }
5521 caster->ToPlayer()->SetChampioningFaction(FactionID);
5522 break;
5523 }
5524 // LK Intro VO (1)
5525 case 58204:
5526 if (target->IsPlayer())
5527 {
5528 // Play part 1
5529 if (apply)
5530 target->PlayDirectSound(14970, target->ToPlayer());
5531 // continue in 58205
5532 else
5533 target->CastSpell(target, 58205, true);
5534 }
5535 break;
5536 // LK Intro VO (2)
5537 case 58205:
5538 if (target->IsPlayer())
5539 {
5540 // Play part 2
5541 if (apply)
5542 target->PlayDirectSound(14971, target->ToPlayer());
5543 // Play part 3
5544 else
5545 target->PlayDirectSound(14972, target->ToPlayer());
5546 }
5547 break;
5548 case 62061: // Festive Holiday Mount
5549 if (target->HasMountedAura())
5550 {
5551 uint32 creatureEntry = 0;
5552 if (apply)
5553 {
5555 creatureEntry = 24906;
5556 else
5557 creatureEntry = 15665;
5558 }
5559 else
5560 creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
5561
5562 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
5563 {
5564 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
5565 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
5566
5568 }
5569 }
5570 break;
5571 case FRESH_BREWFEST_HOPS: // Festive Brewfest Mount
5572 if (target->HasMountedAura() && !target->HasIncreaseMountedFlightSpeedAura())
5573 {
5574 uint32 creatureEntry = 0;
5575
5576 if (apply)
5577 {
5578 if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
5579 {
5580 creatureEntry = GREAT_BREWFEST_KODO;
5581 }
5582 else
5583 {
5584 creatureEntry = BREWFEST_KODO;
5585 }
5586 }
5587 else
5588 {
5589 creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
5590 }
5591
5592 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
5593 {
5594 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
5595 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
5596
5598 }
5599 }
5600 break;
5601 }
5602
5603 break;
5604 }
5605 case SPELLFAMILY_MAGE:
5606 {
5607 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5608 //break;
5609 break;
5610 }
5611 case SPELLFAMILY_PRIEST:
5612 {
5613 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5614 //break;
5615 break;
5616 }
5617 case SPELLFAMILY_DRUID:
5618 {
5619 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5620 // break;
5621 break;
5622 }
5623 case SPELLFAMILY_SHAMAN:
5624 {
5625 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5626 // break;
5627 break;
5628 }
5629 }
5630}
bool roll_chance_i(int chance)
Definition Random.h:63
@ GENDER_MALE
Definition SharedDefines.h:61
@ GENDER_FEMALE
Definition SharedDefines.h:62
@ IMMUNITY_MECHANIC
Definition SharedDefines.h:1403
@ SPELLFAMILY_PRIEST
Definition SharedDefines.h:3790
@ SPELLFAMILY_MAGE
Definition SharedDefines.h:3787
@ SPELLFAMILY_GENERIC
Definition SharedDefines.h:3784
@ SPELLFAMILY_SHAMAN
Definition SharedDefines.h:3795
@ SPELLFAMILY_DRUID
Definition SharedDefines.h:3791
@ SPELL_AURA_MOUNTED
Definition SpellAuraDefines.h:141
@ AURA_REMOVE_BY_CANCEL
Definition SpellAuraDefines.h:393
@ AURA_REMOVE_BY_EXPIRE
Definition SpellAuraDefines.h:395
@ FRESH_BREWFEST_HOPS
Definition SpellAuraEffects.h:35
@ GREAT_BREWFEST_KODO
Definition SpellAuraEffects.h:34
@ BREWFEST_KODO
Definition SpellAuraEffects.h:33
@ MOVE_RUN
Definition UnitDefines.h:357
@ UNIT_FIELD_MOUNTDISPLAYID
Definition UpdateFields.h:126
Definition GridNotifiers.h:1380
void SetStackAmount(uint8 num)
Definition SpellAuras.cpp:1045
void SetCharges(uint8 charges)
Definition SpellAuras.cpp:1002
Definition Battleground.h:304
bool IsBattleground() const
Definition Map.h:305
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Definition ObjectMgr.cpp:1645
uint32 GetEntry() const
Definition Object.h:123
void SetEntry(uint32 entry)
Definition Object.h:124
Definition SpellMgr.h:469
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition PlayerQuest.cpp:2001
Battleground * GetBattleground(bool create=false) const
Definition Player.cpp:12470
void RemoveAmmo()
Definition PlayerStorage.cpp:2625
void SetChampioningFaction(uint32 faction)
Definition Player.h:2606
void LeaveBattleground(Battleground *bg=nullptr)
Definition Player.cpp:11509
uint32 StackAmount
Definition SpellInfo.h:395
uint8 getGender() const
Definition Unit.h:854
void RemovePetAura(PetAura const *petSpell)
Definition Unit.cpp:13397
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5658
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:10247
void AddPetAura(PetAura const *petSpell)
Definition Unit.cpp:13385
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition Unit.cpp:11268
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition Unit.cpp:7533
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:14819
bool HasMountedAura() const
Definition Unit.h:1818
bool IsAlive() const
Definition Unit.h:1812
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:1378
float GetSpeedRate(UnitMoveType mtype) const
Definition Unit.h:1756
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:17063
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition Unit.cpp:11249
Guardian * GetGuardianPet() const
Definition Unit.cpp:7568
bool isDead() const
Definition Unit.h:1814
Map * GetMap() const
Definition Object.h:637
void PlayDirectSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:3023
void PlayDistanceSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:3015
Definition GridNotifiers.h:533
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165
Definition CreatureData.h:170
uint32 CreatureDisplayID
Definition CreatureData.h:180
Definition CreatureData.h:187

References Unit::AddAura(), Unit::AddPetAura(), Unit::AddThreat(), Unit::ApplySpellImmune(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_REAPPLY, AURA_REMOVE_BY_CANCEL, AURA_REMOVE_BY_EXPIRE, BREWFEST_KODO, Unit::CanHaveThreatList(), Unit::CastSpell(), ObjectMgr::ChooseDisplayId(), CreatureModel::CreatureDisplayID, FRESH_BREWFEST_HOPS, GENDER_FEMALE, GENDER_MALE, GetAmount(), Unit::GetAura(), Unit::GetAuraEffectsByType(), GetBase(), Player::GetBattleground(), GetCaster(), GetCasterGUID(), Unit::GetCharmerOrOwnerPlayerOrPlayerItself(), Object::GetEntry(), Unit::getGender(), Unit::GetGuardianPet(), Object::GetGUID(), GetId(), WorldObject::GetMap(), GetMiscValue(), Unit::GetMotionMaster(), AuraApplication::GetRemoveMode(), Unit::GetSpeedRate(), GetSpellInfo(), Aura::GetSpellInfo(), AuraApplication::GetTarget(), GREAT_BREWFEST_KODO, Unit::HasIncreaseMountedFlightSpeedAura(), Unit::HasMountedAura(), SpellInfo::Id, IMMUNITY_MECHANIC, Unit::IsAlive(), Map::IsBattleground(), Object::IsCreature(), Unit::isDead(), Object::IsPlayer(), Player::LeaveBattleground(), m_effIndex, m_spellInfo, MOVE_RUN, MotionMaster::MoveFall(), WorldObject::PlayDirectSound(), WorldObject::PlayDistanceSound(), Player::RemoveAmmo(), Unit::RemoveAurasDueToSpell(), Unit::RemovePetAura(), roll_chance_i(), Player::SetChampioningFaction(), Aura::SetCharges(), Object::SetEntry(), Aura::SetStackAmount(), Unit::SetUInt32Value(), sObjectMgr, SPELL_AURA_MOUNTED, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_MAGE, SPELLFAMILY_PRIEST, SPELLFAMILY_SHAMAN, SpellInfo::SpellFamilyName, sSpellMgr, SpellInfo::StackAmount, Object::ToPlayer(), UNIT_FIELD_MOUNTDISPLAYID, and Cell::VisitObjects().

◆ HandleAuraEmpathy()

void AuraEffect::HandleAuraEmpathy ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5742{
5743 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5744 return;
5745
5746 Unit* target = aurApp->GetTarget();
5747
5748 if (!apply)
5749 {
5750 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5751 if (target->HasAuraType(GetAuraType()))
5752 return;
5753 }
5754
5755 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
5757}
@ CREATURE_TYPE_BEAST
Definition SharedDefines.h:2622
@ UNIT_DYNFLAG_SPECIALINFO
Definition SharedDefines.h:3358
@ UNIT_DYNAMIC_FLAGS
Definition UpdateFields.h:136
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:804
uint32 GetCreatureType() const
Definition Unit.cpp:11599

References Object::ApplyModUInt32Value(), AURA_EFFECT_HANDLE_REAL, CREATURE_TYPE_BEAST, GetAuraType(), Unit::GetCreatureType(), AuraApplication::GetTarget(), Unit::HasAuraType(), UNIT_DYNAMIC_FLAGS, and UNIT_DYNFLAG_SPECIALINFO.

◆ HandleAuraFeatherFall()

void AuraEffect::HandleAuraFeatherFall ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3499{
3501 return;
3502
3503 Unit* target = aurApp->GetTarget();
3504
3505 if (Player* targetPlayer = target->ToPlayer())
3506 {
3507 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3508 }
3509
3510 if (!apply)
3511 {
3512 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3513 if (target->HasAuraType(GetAuraType()))
3514 return;
3515 }
3516
3517 target->SetFeatherFall(apply);
3518
3519 // start fall from current height
3520 if (!apply && target->IsPlayer())
3521 target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ());
3522}
#define sScriptMgr
Definition ScriptMgr.h:767
void SetFallInformation(uint32 time, float z)
Definition Player.h:2385
void SetFeatherFall(bool enable)
Definition Unit.cpp:16298
Seconds GetGameTime()
Definition GameTime.cpp:39
float GetPositionZ() const
Definition Position.h:123

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), GameTime::GetGameTime(), Position::GetPositionZ(), AuraApplication::GetTarget(), Unit::HasAuraType(), Object::IsPlayer(), Player::SetFallInformation(), Unit::SetFeatherFall(), sScriptMgr, and Object::ToPlayer().

◆ HandleAuraGhost()

void AuraEffect::HandleAuraGhost ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1923{
1925 return;
1926
1927 Unit* target = aurApp->GetTarget();
1928
1929 if (!target->IsPlayer())
1930 return;
1931
1932 if (apply)
1933 {
1937 }
1938 else
1939 {
1940 if (target->HasGhostAura())
1941 return;
1942
1946 }
1947}
@ PLAYER_FLAGS_GHOST
Definition Player.h:463
@ SERVERSIDE_VISIBILITY_GHOST
Definition SharedDefines.h:1262
@ GHOST_VISIBILITY_ALIVE
Definition SharedDefines.h:1269
@ GHOST_VISIBILITY_GHOST
Definition SharedDefines.h:1270
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:405
bool HasGhostAura() const
Definition Unit.h:1817
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition Object.h:630
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:629

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, AuraApplication::GetTarget(), GHOST_VISIBILITY_ALIVE, GHOST_VISIBILITY_GHOST, Unit::HasGhostAura(), Object::IsPlayer(), WorldObject::m_serverSideVisibility, WorldObject::m_serverSideVisibilityDetect, PLAYER_FLAGS_GHOST, Player::RemovePlayerFlag(), SERVERSIDE_VISIBILITY_GHOST, Player::SetPlayerFlag(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and Object::ToPlayer().

◆ HandleAuraHover()

void AuraEffect::HandleAuraHover ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

Sets movementflags

3525{
3527 return;
3528
3529 Unit* target = aurApp->GetTarget();
3530
3531 if (Player* targetPlayer = target->ToPlayer())
3532 {
3533 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3534 }
3535
3536 if (!apply)
3537 {
3538 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3539 if (target->HasAuraType(GetAuraType()))
3540 return;
3541 }
3542
3543 target->SetHover(apply);
3544}
void SetHover(bool enable)
Definition Unit.cpp:16339

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), AuraApplication::GetTarget(), Unit::HasAuraType(), Unit::SetHover(), sScriptMgr, and Object::ToPlayer().

◆ HandleAuraIncreaseBaseHealthPercent()

void AuraEffect::HandleAuraIncreaseBaseHealthPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4608{
4610 return;
4611
4612 Unit* target = aurApp->GetTarget();
4613
4614 if (apply)
4616 else
4617 {
4620 }
4621}
@ SPELL_AURA_MOD_BASE_HEALTH_PCT
Definition SpellAuraDefines.h:345
@ AURA_EFFECT_HANDLE_STAT
Definition SpellAuraDefines.h:46
@ UNIT_MOD_HEALTH
Definition Unit.h:158
@ BASE_PCT
Definition Unit.h:138
void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val)
Definition Unit.cpp:11679
void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount)
Definition Unit.cpp:11646
float GetTotalAuraMultiplier(AuraType auratype) const
Definition Unit.cpp:6091

References Unit::ApplyStatPctModifier(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_PCT, GetAmount(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplier(), Unit::SetStatPctModifier(), SPELL_AURA_MOD_BASE_HEALTH_PCT, and UNIT_MOD_HEALTH.

◆ HandleAuraLinked()

void AuraEffect::HandleAuraLinked ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5833{
5834 Unit* target = aurApp->GetTarget();
5835
5836 uint32 triggeredSpellId = sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->Effects[m_effIndex].TriggerSpell, target);
5837 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId);
5838 if (!triggeredSpellInfo)
5839 return;
5840
5841 if (mode & AURA_EFFECT_HANDLE_REAL)
5842 {
5843 if (apply)
5844 {
5845 Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCaster() : target;
5846
5847 if (!caster)
5848 return;
5849 // If amount avalible cast with basepoints (Crypt Fever for example)
5850 if (GetAmount())
5851 caster->CastCustomSpell(target, triggeredSpellId, &m_amount, nullptr, nullptr, true, nullptr, this);
5852 else
5853 caster->CastSpell(target, triggeredSpellId, true, nullptr, this);
5854 }
5855 else
5856 {
5857 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
5858 target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
5859 }
5860 }
5861 else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
5862 {
5863 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
5864 // change the stack amount to be equal to stack amount of our aura
5865 if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
5866 triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
5867 }
5868}
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell, uint8 effIndex=MAX_SPELL_EFFECTS) const
Definition SpellInfo.cpp:1083
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4830
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:1435

References AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_REAPPLY, Unit::CastCustomSpell(), Unit::CastSpell(), SpellInfo::Effects, GetAmount(), Unit::GetAura(), GetBase(), GetCaster(), GetCasterGUID(), GetEffIndex(), Object::GetGUID(), AuraApplication::GetRemoveMode(), Aura::GetStackAmount(), AuraApplication::GetTarget(), m_amount, m_effIndex, m_spellInfo, SpellInfo::NeedsToBeTriggeredByCaster(), Unit::RemoveAura(), and sSpellMgr.

◆ HandleAuraModAttackPower()

void AuraEffect::HandleAuraModAttackPower ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4923{
4925 return;
4926
4927 Unit* target = aurApp->GetTarget();
4928
4930}
@ TOTAL_VALUE
Definition Unit.h:132
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:173
bool HandleStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply)
Definition Unit.cpp:11620

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Unit::HandleStatFlatModifier(), TOTAL_VALUE, and UNIT_MOD_ATTACK_POWER.

◆ HandleAuraModAttackPowerOfArmor()

void AuraEffect::HandleAuraModAttackPowerOfArmor ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5000{
5002 return;
5003
5004 Unit* target = aurApp->GetTarget();
5005
5006 // Recalculate bonus
5007 if (target->IsPlayer())
5008 target->ToPlayer()->UpdateAttackPowerAndDamage(false);
5009}
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition StatSystem.cpp:347

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::IsPlayer(), Object::ToPlayer(), and Player::UpdateAttackPowerAndDamage().

Referenced by HandleAuraModAttackPowerOfStatPercent().

◆ HandleAuraModAttackPowerOfStatPercent()

void AuraEffect::HandleAuraModAttackPowerOfStatPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4995{
4996 HandleAuraModAttackPowerOfArmor(aurApp, mode, apply);
4997}
void HandleAuraModAttackPowerOfArmor(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4999

References HandleAuraModAttackPowerOfArmor().

◆ HandleAuraModAttackPowerPercent()

void AuraEffect::HandleAuraModAttackPowerPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4946{
4948 return;
4949
4950 Unit* target = aurApp->GetTarget();
4951
4952 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
4953 if (apply)
4955 else
4956 {
4959 }
4960}
@ SPELL_AURA_MOD_ATTACK_POWER_PCT
Definition SpellAuraDefines.h:229
@ TOTAL_PCT
Definition Unit.h:139

References Unit::ApplyStatPctModifier(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplier(), Unit::SetStatPctModifier(), SPELL_AURA_MOD_ATTACK_POWER_PCT, TOTAL_PCT, and UNIT_MOD_ATTACK_POWER.

◆ HandleAuraModBaseResistancePCT()

void AuraEffect::HandleAuraModBaseResistancePCT ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4146{
4148 return;
4149
4150 Unit* target = aurApp->GetTarget();
4151 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4152 {
4153 if (GetMiscValue() & int32(1 << x))
4154 {
4155 if (apply)
4157 else
4158 {
4161 }
4162 }
4163 }
4164}
@ SPELL_SCHOOL_NORMAL
Definition SharedDefines.h:271
constexpr auto MAX_SPELL_SCHOOL
Definition SharedDefines.h:280
@ SPELL_AURA_MOD_BASE_RESISTANCE_PCT
Definition SpellAuraDefines.h:205
UnitMods
Definition Unit.h:152
@ UNIT_MOD_RESISTANCE_START
Definition Unit.h:182
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:6116

References Unit::ApplyStatPctModifier(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_PCT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplierByMiscMask(), MAX_SPELL_SCHOOL, Unit::SetStatPctModifier(), SPELL_AURA_MOD_BASE_RESISTANCE_PCT, SPELL_SCHOOL_NORMAL, and UNIT_MOD_RESISTANCE_START.

◆ HandleAuraModBlockPercent()

void AuraEffect::HandleAuraModBlockPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4657{
4659 return;
4660
4661 Unit* target = aurApp->GetTarget();
4662
4663 if (!target->IsPlayer())
4664 return;
4665
4666 target->ToPlayer()->UpdateBlockPercentage();
4667}
void UpdateBlockPercentage()
Definition StatSystem.cpp:633

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::IsPlayer(), Object::ToPlayer(), and Player::UpdateBlockPercentage().

◆ HandleAuraModCritPct()

void AuraEffect::HandleAuraModCritPct ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4748{
4750 return;
4751
4752 Unit* target = aurApp->GetTarget();
4753
4754 if (!target->IsPlayer())
4755 {
4756 target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
4757 return;
4758 }
4759
4761
4762 // included in Player::UpdateSpellCritChance calculation
4764}
void UpdateAllSpellCritChances()
Definition StatSystem.cpp:889
void UpdateAllWeaponDependentCritAuras()
Definition Player.cpp:7264
int32 m_baseSpellCritChance
Definition Unit.h:2105
void apply(T *val)
Definition ByteConverter.h:40

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Object::IsPlayer(), Unit::m_baseSpellCritChance, Object::ToPlayer(), Player::UpdateAllSpellCritChances(), and Player::UpdateAllWeaponDependentCritAuras().

◆ HandleAuraModDecreaseSpeed()

void AuraEffect::HandleAuraModDecreaseSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3917{
3919 return;
3920
3921 Unit* target = aurApp->GetTarget();
3922
3923 target->UpdateSpeed(MOVE_WALK, true);
3924 target->UpdateSpeed(MOVE_RUN, true);
3925 target->UpdateSpeed(MOVE_SWIM, true);
3926 target->UpdateSpeed(MOVE_FLIGHT, true);
3927 target->UpdateSpeed(MOVE_RUN_BACK, true);
3928 target->UpdateSpeed(MOVE_SWIM_BACK, true);
3929 target->UpdateSpeed(MOVE_FLIGHT_BACK, true);
3930
3931 if (Player* targetPlayer = target->ToPlayer())
3932 {
3933 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3934 }
3935}
@ MOVE_FLIGHT
Definition UnitDefines.h:362
@ MOVE_SWIM
Definition UnitDefines.h:359
@ MOVE_FLIGHT_BACK
Definition UnitDefines.h:363
@ MOVE_SWIM_BACK
Definition UnitDefines.h:360
@ MOVE_RUN_BACK
Definition UnitDefines.h:358
@ MOVE_WALK
Definition UnitDefines.h:356
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition Unit.cpp:10934

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AuraApplication::GetTarget(), MOVE_FLIGHT, MOVE_FLIGHT_BACK, MOVE_RUN, MOVE_RUN_BACK, MOVE_SWIM, MOVE_SWIM_BACK, MOVE_WALK, sScriptMgr, Object::ToPlayer(), and Unit::UpdateSpeed().

◆ HandleAuraModDisarm()

void AuraEffect::HandleAuraModDisarm ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3099{
3100 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3101 return;
3102
3103 Unit* target = aurApp->GetTarget();
3104
3105 AuraType type = GetAuraType();
3106
3107 //Prevent handling aura twice
3108 if ((apply) ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
3109 return;
3110
3111 uint32 field, flag, slot;
3112 WeaponAttackType attType;
3113 switch (type)
3114 {
3116 field = UNIT_FIELD_FLAGS;
3117 flag = UNIT_FLAG_DISARMED;
3119 attType = BASE_ATTACK;
3120 break;
3122 field = UNIT_FIELD_FLAGS_2;
3125 attType = OFF_ATTACK;
3126 break;
3128 field = UNIT_FIELD_FLAGS_2;
3130 slot = EQUIPMENT_SLOT_RANGED;
3131 attType = RANGED_ATTACK;
3132 break;
3133 default:
3134 return;
3135 }
3136
3137 // if disarm aura is to be removed, remove the flag first to reapply damage/aura mods
3138 if (!apply)
3139 target->RemoveFlag(field, flag);
3140
3141 // Handle damage modification, shapeshifted druids are not affected
3142 if (target->IsPlayer() && (!target->IsInFeralForm() || target->GetShapeshiftForm() == FORM_GHOSTWOLF))
3143 {
3144 Player* player = target->ToPlayer();
3145 if (Item* pItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
3146 {
3147 WeaponAttackType attackType = Player::GetAttackBySlot(slot);
3148
3149 player->ApplyItemDependentAuras(pItem, !apply);
3150 if (attackType < MAX_ATTACK)
3151 {
3152 player->_ApplyWeaponDamage(slot, pItem->GetTemplate(), nullptr, !apply);
3153 if (!apply) // apply case already handled on item dependent aura removal (if any)
3154 player->UpdateWeaponDependentAuras(attackType);
3155 }
3156 }
3157 }
3158
3159 // if disarm effects should be applied, wait to set flag until damage mods are unapplied
3160 if (apply)
3161 target->SetFlag(field, flag);
3162
3163 if (target->IsCreature() && target->ToCreature()->GetCurrentEquipmentId())
3164 target->UpdateDamagePhysical(attType);
3165}
@ 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
@ SPELL_AURA_MOD_DISARM_RANGED
Definition SpellAuraDefines.h:341
@ SPELL_AURA_MOD_DISARM
Definition SpellAuraDefines.h:130
@ SPELL_AURA_MOD_DISARM_OFFHAND
Definition SpellAuraDefines.h:317
@ UNIT_FLAG2_DISARM_OFFHAND
Definition UnitDefines.h:303
@ UNIT_FLAG2_DISARM_RANGED
Definition UnitDefines.h:305
@ FORM_GHOSTWOLF
Definition UnitDefines.h:88
@ UNIT_FLAG_DISARMED
Definition UnitDefines.h:278
WeaponAttackType
Definition Unit.h:222
@ MAX_ATTACK
Definition Unit.h:226
@ UNIT_FIELD_FLAGS_2
Definition UpdateFields.h:118
@ UNIT_FIELD_FLAGS
Definition UpdateFields.h:117
uint8 GetCurrentEquipmentId()
Definition Creature.h:197
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:836
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:851
Creature * ToCreature()
Definition Object.h:212
void UpdateWeaponDependentAuras(WeaponAttackType attackType)
Definition Player.cpp:7270
void ApplyItemDependentAuras(Item *item, bool apply)
Definition Player.cpp:7277
void _ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply)
Definition Player.cpp:7089
Item * GetItemByPos(uint16 pos) const
Definition PlayerStorage.cpp:445
static WeaponAttackType GetAttackBySlot(uint8 slot)
Definition PlayerStorage.cpp:546
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition StatSystem.cpp:60
bool IsInFeralForm() const
Definition Unit.h:1982

References Player::_ApplyWeaponDamage(), Player::ApplyItemDependentAuras(), AURA_EFFECT_HANDLE_REAL, BASE_ATTACK, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, FORM_GHOSTWOLF, Player::GetAttackBySlot(), Unit::GetAuraEffectsByType(), GetAuraType(), Creature::GetCurrentEquipmentId(), Player::GetItemByPos(), Unit::GetShapeshiftForm(), AuraApplication::GetTarget(), Unit::HasAuraType(), INVENTORY_SLOT_BAG_0, Object::IsCreature(), Unit::IsInFeralForm(), Object::IsPlayer(), MAX_ATTACK, OFF_ATTACK, RANGED_ATTACK, Object::RemoveFlag(), Object::SetFlag(), SPELL_AURA_MOD_DISARM, SPELL_AURA_MOD_DISARM_OFFHAND, SPELL_AURA_MOD_DISARM_RANGED, Object::ToCreature(), Object::ToPlayer(), UNIT_FIELD_FLAGS, UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_OFFHAND, UNIT_FLAG2_DISARM_RANGED, UNIT_FLAG_DISARMED, Unit::UpdateDamagePhysical(), and Player::UpdateWeaponDependentAuras().

◆ HandleAuraModDispelImmunity()

void AuraEffect::HandleAuraModDispelImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4088{
4089 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4090 return;
4091
4092 Unit* target = aurApp->GetTarget();
4094}
void ApplyAllSpellImmunitiesTo(Unit *target, SpellEffectInfo const *effect, bool apply) const
Definition SpellInfo.cpp:2515

References SpellInfo::ApplyAllSpellImmunitiesTo(), AURA_EFFECT_HANDLE_REAL, SpellInfo::Effects, AuraApplication::GetTarget(), m_effIndex, and m_spellInfo.

◆ HandleAuraModDmgImmunity()

void AuraEffect::HandleAuraModDmgImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4075{
4076 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4077 return;
4078
4079 Unit* target = aurApp->GetTarget();
4080
4082
4083 if (apply)
4084 target->GetThreatMgr().EvaluateSuppressed();
4085}
void EvaluateSuppressed(bool canExpire=false)
Definition ThreatManager.cpp:374
ThreatManager & GetThreatMgr()
Definition Unit.h:965

References SpellInfo::ApplyAllSpellImmunitiesTo(), AURA_EFFECT_HANDLE_REAL, SpellInfo::Effects, ThreatManager::EvaluateSuppressed(), AuraApplication::GetTarget(), Unit::GetThreatMgr(), m_effIndex, and m_spellInfo.

◆ HandleAuraModDodgePercent()

void AuraEffect::HandleAuraModDodgePercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4644{
4646 return;
4647
4648 Unit* target = aurApp->GetTarget();
4649
4650 if (!target->IsPlayer())
4651 return;
4652
4653 target->ToPlayer()->UpdateDodgePercentage();
4654}
void UpdateDodgePercentage()
Definition StatSystem.cpp:799

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::IsPlayer(), Object::ToPlayer(), and Player::UpdateDodgePercentage().

◆ HandleAuraModEffectImmunity()

void AuraEffect::HandleAuraModEffectImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3977{
3978 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3979 return;
3980
3981 Unit* target = aurApp->GetTarget();
3982
3983 target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
3984
3985 // when removing flag aura, handle flag drop
3986 Player* player = target->ToPlayer();
3987 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
3988 {
3989 if (player->InBattleground())
3990 {
3991 if (Battleground* bg = player->GetBattleground())
3992 bg->EventPlayerDroppedFlag(player);
3993 }
3994 else
3995 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
3996 }
3997}
#define sOutdoorPvPMgr
Definition OutdoorPvPMgr.h:102
@ IMMUNITY_EFFECT
Definition SharedDefines.h:1398
@ AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
Definition SpellDefines.h:71
bool InBattleground() const
Definition Player.h:2300

References Unit::ApplySpellImmune(), AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, Player::GetBattleground(), GetId(), GetMiscValue(), GetSpellInfo(), AuraApplication::GetTarget(), IMMUNITY_EFFECT, Player::InBattleground(), sOutdoorPvPMgr, and Object::ToPlayer().

◆ HandleAuraModExpertise()

void AuraEffect::HandleAuraModExpertise ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4429{
4431 return;
4432
4433 Unit* target = aurApp->GetTarget();
4434
4435 if (!target->IsPlayer())
4436 return;
4437
4440}
void UpdateExpertise(WeaponAttackType attType)
Definition StatSystem.cpp:895

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_ATTACK, AuraApplication::GetTarget(), Object::IsPlayer(), OFF_ATTACK, Object::ToPlayer(), and Player::UpdateExpertise().

◆ HandleAuraModFaction()

void AuraEffect::HandleAuraModFaction ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5760{
5761 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5762 return;
5763
5764 Unit* target = aurApp->GetTarget();
5765
5766 if (apply)
5767 {
5768 target->SetFaction(GetMiscValue());
5769 if (target->IsPlayer())
5771 }
5772 else
5773 {
5774 target->RestoreFaction();
5775 if (target->IsPlayer())
5777 }
5778}
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition UnitDefines.h:260
void SetFaction(uint32 faction)
Definition Unit.cpp:6886
void RestoreFaction()
Definition Unit.cpp:14651

References AURA_EFFECT_HANDLE_REAL, GetMiscValue(), AuraApplication::GetTarget(), Object::IsPlayer(), Unit::RemoveUnitFlag(), Unit::RestoreFaction(), Unit::SetFaction(), Unit::SetUnitFlag(), and UNIT_FLAG_PLAYER_CONTROLLED.

◆ HandleAuraModFakeInebriation()

void AuraEffect::HandleAuraModFakeInebriation ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5887{
5889 return;
5890
5891 Player* target = aurApp->GetTarget()->ToPlayer();
5892 if (!target)
5893 return;
5894
5897}
@ PLAYER_FAKE_INEBRIATION
Definition UpdateFields.h:325
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:813
void UpdateInvisibilityDrunkDetect()
Definition Player.cpp:1059

References Object::ApplyModInt32Value(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetAmount(), AuraApplication::GetTarget(), PLAYER_FAKE_INEBRIATION, Object::ToPlayer(), and Player::UpdateInvisibilityDrunkDetect().

◆ HandleAuraModIncreaseEnergy()

void AuraEffect::HandleAuraModIncreaseEnergy ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4535{
4537 return;
4538
4539 Unit* target = aurApp->GetTarget();
4540
4542 // do not check power type, we can always modify the maximum
4543 // as the client will not see any difference
4544 // also, placing conditions that may change during the aura duration
4545 // inside effect handlers is not a good idea
4546 //if (int32(PowerType) != GetMiscValue())
4547 // return;
4548
4549 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4550
4551 target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
4552}
std::uint16_t uint16
Definition Define.h:108
Powers
Definition SharedDefines.h:256
@ UNIT_MOD_POWER_START
Definition Unit.h:184
PowerType
Definition VehicleDefines.h:29

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Unit::HandleStatFlatModifier(), TOTAL_VALUE, and UNIT_MOD_POWER_START.

◆ HandleAuraModIncreaseEnergyPercent()

void AuraEffect::HandleAuraModIncreaseEnergyPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4555{
4557 return;
4558
4559 Unit* target = aurApp->GetTarget();
4560
4562 // do not check power type, we can always modify the maximum
4563 // as the client will not see any difference
4564 // also, placing conditions that may change during the aura duration
4565 // inside effect handlers is not a good idea
4566 //if (int32(PowerType) != GetMiscValue())
4567 // return;
4568
4569 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4570
4571 if (apply)
4572 {
4573 float amount = float(GetAmount());
4574 target->ApplyStatPctModifier(unitMod, TOTAL_PCT, amount);
4575 }
4576 else
4577 {
4579 target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
4580 }
4581}
@ SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
Definition SpellAuraDefines.h:195
float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6156

References Unit::ApplyStatPctModifier(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplierByMiscValue(), Unit::SetStatPctModifier(), SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT, TOTAL_PCT, and UNIT_MOD_POWER_START.

◆ HandleAuraModIncreaseFlightSpeed()

void AuraEffect::HandleAuraModIncreaseFlightSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

Update ability to fly

Someone should clean up these hacks and remove it from this function. It doesn't even belong here.

3862{
3864 return;
3865
3866 Unit* target = aurApp->GetTarget();
3868 target->UpdateSpeed(MOVE_FLIGHT, true);
3869
3872 {
3873 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3874 if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasIncreaseMountedFlightSpeedAura() && !target->HasFlyAura())))
3875 {
3876 target->SetCanFly(apply);
3877
3878 if (!apply && target->IsCreature() && !target->IsLevitating())
3879 target->GetMotionMaster()->MoveFall();
3880 }
3881
3883 if (mode & AURA_EFFECT_HANDLE_REAL)
3884 {
3885 //Players on flying mounts must be immune to polymorph
3886 if (target->IsPlayer())
3888
3889 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3890 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountID())
3892 }
3893 }
3894
3895 if (Player* targetPlayer = target->ToPlayer())
3896 {
3897 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3898 }
3899}
@ MECHANIC_POLYMORPH
Definition SharedDefines.h:1330
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
Definition SpellAuraDefines.h:270
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK
Definition SpellAuraDefines.h:50
bool HasFlyAura() const
Definition Unit.h:1822
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition Unit.cpp:5745
uint32 GetMountID() const
Definition Unit.h:1909

References Unit::ApplySpellImmune(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK, AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), GetId(), Unit::GetMotionMaster(), Unit::GetMountID(), AuraApplication::GetTarget(), Unit::HasAuraEffect(), Unit::HasFlyAura(), Unit::HasIncreaseMountedFlightSpeedAura(), IMMUNITY_MECHANIC, Object::IsCreature(), Unit::IsLevitating(), Object::IsPlayer(), MECHANIC_POLYMORPH, MOVE_FLIGHT, MotionMaster::MoveFall(), Unit::SetCanFly(), Unit::SetUInt32Value(), SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, sScriptMgr, Object::ToPlayer(), UNIT_FIELD_MOUNTDISPLAYID, and Unit::UpdateSpeed().

◆ HandleAuraModIncreaseHealth()

void AuraEffect::HandleAuraModIncreaseHealth ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4485{
4487 return;
4488
4489 Unit* target = aurApp->GetTarget();
4490
4491 if (apply)
4492 {
4494 // If target is dead, this could break the client's perception of their alive status
4495 if (target->IsAlive())
4496 target->ModifyHealth(GetAmount());
4497 }
4498 else
4499 {
4500 if (target->IsAlive())
4501 {
4502 if (int32(target->GetHealth()) > GetAmount())
4503 target->ModifyHealth(-GetAmount());
4504 else
4505 target->SetHealth(1);
4506 }
4508 }
4509}
int32 ModifyHealth(int32 val)
Definition Unit.cpp:10784
void SetHealth(uint32 val)
Definition Unit.cpp:12020
uint32 GetHealth() const
Definition Unit.h:1122

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), Unit::GetHealth(), AuraApplication::GetTarget(), Unit::HandleStatFlatModifier(), Unit::IsAlive(), Unit::ModifyHealth(), Unit::SetHealth(), TOTAL_VALUE, and UNIT_MOD_HEALTH.

◆ HandleAuraModIncreaseHealthPercent()

void AuraEffect::HandleAuraModIncreaseHealthPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4584{
4586 return;
4587
4588 Unit* target = aurApp->GetTarget();
4589
4590 // Unit will keep hp% after MaxHealth being modified if unit is alive.
4591 float percent = target->GetHealthPct();
4592
4593 if (apply)
4595 else
4596 {
4599 }
4600
4601 // Xinef: pct was rounded down and could "kill" creature by setting its health to 0 making npc zombie
4602 if (target->IsAlive())
4603 if (uint32 healthAmount = CalculatePct(target->GetMaxHealth(), percent))
4604 target->SetHealth(healthAmount);
4605}
@ SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
Definition SpellAuraDefines.h:196
T CalculatePct(T base, U pct)
Definition Util.h:52
float GetHealthPct() const
Definition Unit.h:1124
uint32 GetMaxHealth() const
Definition Unit.h:1123

References Unit::ApplyStatPctModifier(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, CalculatePct(), GetAmount(), Unit::GetHealthPct(), Unit::GetMaxHealth(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplier(), Unit::IsAlive(), Unit::SetHealth(), Unit::SetStatPctModifier(), SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT, TOTAL_PCT, and UNIT_MOD_HEALTH.

◆ HandleAuraModIncreaseMaxHealth()

void AuraEffect::HandleAuraModIncreaseMaxHealth ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4512{
4514 return;
4515
4516 Unit* target = aurApp->GetTarget();
4517
4518 uint32 oldhealth = target->GetHealth();
4519 double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth();
4520
4522
4523 // refresh percentage
4524 if (oldhealth > 0)
4525 {
4526 uint32 newhealth = uint32(std::ceil((double)target->GetMaxHealth() * healthPercentage));
4527 if (newhealth == 0)
4528 newhealth = 1;
4529
4530 target->SetHealth(newhealth);
4531 }
4532}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), Unit::GetHealth(), Unit::GetMaxHealth(), AuraApplication::GetTarget(), Unit::HandleStatFlatModifier(), Unit::SetHealth(), TOTAL_VALUE, and UNIT_MOD_HEALTH.

◆ HandleAuraModIncreaseMountedSpeed()

void AuraEffect::HandleAuraModIncreaseMountedSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3857{
3858 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3859}
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3841

References HandleAuraModIncreaseSpeed().

◆ HandleAuraModIncreaseSpeed()

void AuraEffect::HandleAuraModIncreaseSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3842{
3844 return;
3845
3846 Unit* target = aurApp->GetTarget();
3847
3848 target->UpdateSpeed(MOVE_RUN, true);
3849
3850 if (Player* targetPlayer = target->ToPlayer())
3851 {
3852 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3853 }
3854}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AuraApplication::GetTarget(), MOVE_RUN, sScriptMgr, Object::ToPlayer(), and Unit::UpdateSpeed().

Referenced by HandleAuraModIncreaseMountedSpeed().

◆ HandleAuraModIncreaseSwimSpeed()

void AuraEffect::HandleAuraModIncreaseSwimSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3902{
3904 return;
3905
3906 Unit* target = aurApp->GetTarget();
3907
3908 target->UpdateSpeed(MOVE_SWIM, true);
3909
3910 if (Player* targetPlayer = target->ToPlayer())
3911 {
3912 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3913 }
3914}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AuraApplication::GetTarget(), MOVE_SWIM, sScriptMgr, Object::ToPlayer(), and Unit::UpdateSpeed().

◆ HandleAuraModPacify()

void AuraEffect::HandleAuraModPacify ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3197{
3199 return;
3200
3201 Unit* target = aurApp->GetTarget();
3202
3203 if (apply)
3204 {
3206 //target->AttackStop(); // pussywizard: why having this flag prevents from being in combat? it should just prevent melee attack
3207 }
3208 else
3209 {
3210 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3211 if (target->HasPacifyAura() || target->HasPacifySilenceAura())
3212 return;
3214 }
3215}
@ UNIT_FLAG_PACIFIED
Definition UnitDefines.h:274
bool HasPacifySilenceAura() const
Definition Unit.h:1842
bool HasPacifyAura() const
Definition Unit.h:1846

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, AuraApplication::GetTarget(), Unit::HasPacifyAura(), Unit::HasPacifySilenceAura(), Unit::RemoveUnitFlag(), Unit::SetUnitFlag(), and UNIT_FLAG_PACIFIED.

Referenced by HandleAuraModPacifyAndSilence().

◆ HandleAuraModPacifyAndSilence()

void AuraEffect::HandleAuraModPacifyAndSilence ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3218{
3220 return;
3221
3222 Unit* target = aurApp->GetTarget();
3223
3224 if (!(apply))
3225 {
3226 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3227 if (target->HasPacifySilenceAura())
3228 return;
3229 }
3230 HandleAuraModPacify(aurApp, mode, apply);
3231 HandleAuraModSilence(aurApp, mode, apply);
3232}
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3167
void HandleAuraModPacify(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3196

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, AuraApplication::GetTarget(), HandleAuraModPacify(), HandleAuraModSilence(), and Unit::HasPacifySilenceAura().

◆ HandleAuraModParryPercent()

void AuraEffect::HandleAuraModParryPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4628{
4630 return;
4631
4632 Unit* target = aurApp->GetTarget();
4633
4634 if (!target->IsPlayer())
4635 return;
4636
4637 if (!target->ToPlayer()->CanParry())
4638 target->ToPlayer()->SetCanParry(true);
4639 else
4640 target->ToPlayer()->UpdateParryPercentage();
4641}
void UpdateParryPercentage()
Definition StatSystem.cpp:753
bool CanParry() const
Definition Player.h:2215
void SetCanParry(bool value)
Definition Player.cpp:13463

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, Player::CanParry(), AuraApplication::GetTarget(), Object::IsPlayer(), Player::SetCanParry(), Object::ToPlayer(), and Player::UpdateParryPercentage().

◆ HandleAuraModPetTalentsPoints()

void AuraEffect::HandleAuraModPetTalentsPoints ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3354{
3356 return;
3357
3358 Unit* target = aurApp->GetTarget();
3359
3360 if (!target->IsPlayer())
3361 return;
3362
3363 // Recalculate pet talent points
3364 if (Pet* pet = target->ToPlayer()->GetPet())
3365 pet->InitTalentForLevel();
3366}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, Player::GetPet(), AuraApplication::GetTarget(), Object::IsPlayer(), and Object::ToPlayer().

◆ HandleAuraModRangedAttackPower()

void AuraEffect::HandleAuraModRangedAttackPower ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4933{
4935 return;
4936
4937 Unit* target = aurApp->GetTarget();
4938
4939 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
4940 return;
4941
4943}
#define CLASSMASK_WAND_USERS
Definition SharedDefines.h:151
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:174
uint32 getClassMask() const
Definition Unit.h:851

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, CLASSMASK_WAND_USERS, GetAmount(), Unit::getClassMask(), AuraApplication::GetTarget(), Unit::HandleStatFlatModifier(), TOTAL_VALUE, and UNIT_MOD_ATTACK_POWER_RANGED.

◆ HandleAuraModRangedAttackPowerOfStatPercent()

void AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

◆ HandleAuraModRangedAttackPowerPercent()

void AuraEffect::HandleAuraModRangedAttackPowerPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4963{
4965 return;
4966
4967 Unit* target = aurApp->GetTarget();
4968
4969 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
4970 return;
4971
4972 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
4973 if (apply)
4975 else
4976 {
4979 }
4980}
@ SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT
Definition SpellAuraDefines.h:230

References Unit::ApplyStatPctModifier(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, CLASSMASK_WAND_USERS, GetAmount(), Unit::getClassMask(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplier(), Unit::SetStatPctModifier(), SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT, TOTAL_PCT, and UNIT_MOD_ATTACK_POWER_RANGED.

◆ HandleAuraModRangedHaste()

void AuraEffect::HandleAuraModRangedHaste ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4861{
4863 return;
4864
4865 Unit* target = aurApp->GetTarget();
4866
4867 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
4868}
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:13135

References Unit::ApplyAttackTimePercentMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), and RANGED_ATTACK.

◆ HandleAuraModRegenInterrupt()

void AuraEffect::HandleAuraModRegenInterrupt ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4670{
4671 HandleModManaRegen(aurApp, mode, apply);
4672}
void HandleModManaRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4470

References HandleModManaRegen().

◆ HandleAuraModResistance()

void AuraEffect::HandleAuraModResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4128{
4130 return;
4131
4132 Unit* target = aurApp->GetTarget();
4133
4134 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4135 {
4136 if (GetMiscValue() & int32(1 << x))
4137 {
4139 if (target->IsPlayer() || target->IsPet())
4141 }
4142 }
4143}
std::int8_t int8
Definition Define.h:105
SpellSchools
Definition SharedDefines.h:270
bool IsPet() const
Definition Unit.h:803
void UpdateResistanceBuffModsMod(SpellSchools school)
Definition Unit.cpp:6226

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Unit::HandleStatFlatModifier(), Unit::IsPet(), Object::IsPlayer(), MAX_SPELL_SCHOOL, SPELL_SCHOOL_NORMAL, TOTAL_VALUE, UNIT_MOD_RESISTANCE_START, and Unit::UpdateResistanceBuffModsMod().

◆ HandleAuraModResistanceExclusive()

void AuraEffect::HandleAuraModResistanceExclusive ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4105{
4107 return;
4108
4109 Unit* target = aurApp->GetTarget();
4110
4111 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4112 {
4113 if (GetMiscValue() & int32(1 << x))
4114 {
4116 if (amount < GetAmount())
4117 {
4118 float value = float(GetAmount() - amount);
4120 if (target->IsPlayer() || target->IsPet())
4122 }
4123 }
4124 }
4125}
@ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
Definition SpellAuraDefines.h:206
@ BASE_VALUE
Definition Unit.h:131
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, AuraEffect const *except=nullptr) const
Definition Unit.cpp:6126

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_VALUE, GetAmount(), Unit::GetMaxPositiveAuraModifierByMiscMask(), GetMiscValue(), AuraApplication::GetTarget(), Unit::HandleStatFlatModifier(), Unit::IsPet(), Object::IsPlayer(), MAX_SPELL_SCHOOL, SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE, SPELL_SCHOOL_NORMAL, UNIT_MOD_RESISTANCE_START, and Unit::UpdateResistanceBuffModsMod().

◆ HandleAuraModResistenceOfStatPercent()

void AuraEffect::HandleAuraModResistenceOfStatPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4407{
4409 return;
4410
4411 Unit* target = aurApp->GetTarget();
4412
4413 if (!target->IsPlayer())
4414 return;
4415
4417 {
4418 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
4419 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
4420 LOG_ERROR("spells.aura.effect", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
4421 return;
4422 }
4423
4424 // Recalculate Armor
4425 target->UpdateArmor();
4426}
#define LOG_ERROR(filterType__,...)
Definition Log.h:145
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:285
virtual void UpdateArmor()=0

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetMiscValue(), AuraApplication::GetTarget(), Object::IsPlayer(), LOG_ERROR, SPELL_SCHOOL_MASK_NORMAL, and Unit::UpdateArmor().

◆ HandleAuraModRoot()

void AuraEffect::HandleAuraModRoot ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3670{
3671 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3672 return;
3673
3674 Unit* target = aurApp->GetTarget();
3675
3676 target->SetControlled(apply, UNIT_STATE_ROOT);
3677}
@ UNIT_STATE_ROOT
Definition UnitDefines.h:183
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:13985

References AURA_EFFECT_HANDLE_REAL, AuraApplication::GetTarget(), Unit::SetControlled(), and UNIT_STATE_ROOT.

◆ HandleAuraModScale()

void AuraEffect::HandleAuraModScale ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2922{
2924 return;
2925
2926 aurApp->GetTarget()->RecalculateObjectScale();
2927}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK, AuraApplication::GetTarget(), and Unit::RecalculateObjectScale().

◆ HandleAuraModSchoolImmunity()

void AuraEffect::HandleAuraModSchoolImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
Todo:
: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else
4013{
4014 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4015 return;
4016
4017 Unit* target = aurApp->GetTarget();
4018
4019 target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, GetMiscValue(), (apply));
4020
4021 if (apply)
4022 target->GetThreatMgr().EvaluateSuppressed();
4023
4024 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4025 {
4026 if (apply)
4028 else
4029 {
4030 bool banishFound = false;
4031 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
4032 for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
4033 if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4034 {
4035 banishFound = true;
4036 break;
4037 }
4038 if (!banishFound)
4040 }
4041 }
4042
4043 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
4045
4046 // remove all flag auras (they are positive, but they must be removed when you are immune)
4050
4052 if ((apply)
4054 && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
4055 {
4056 uint32 school_mask = GetMiscValue();
4057 Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
4058 for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
4059 {
4060 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
4061 if ((spell->GetSchoolMask() & school_mask)//Check for school mask
4062 && GetSpellInfo()->CanDispelAura(spell)
4063 && !iter->second->IsPositive() //Don't remove positive spells
4064 && spell->Id != GetId()) //Don't remove self
4065 {
4066 target->RemoveAura(iter);
4067 }
4068 else
4069 ++iter;
4070 }
4071 }
4072}
@ SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE
Definition SharedDefines.h:465
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
Definition SharedDefines.h:422
@ MECHANIC_BANISH
Definition SharedDefines.h:1331
@ IMMUNITY_SCHOOL
Definition SharedDefines.h:1400
@ UNIT_STATE_ISOLATED
Definition UnitDefines.h:186
bool CanDispelAura(SpellInfo const *auraSpellInfo) const
Definition SpellInfo.cpp:1384
bool IsPositive() const
Definition SpellInfo.cpp:1282
void ClearUnitState(uint32 f)
Definition Unit.h:743
void AddUnitState(uint32 f)
Definition Unit.h:741
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition Unit.cpp:5249

References Unit::AddUnitState(), Unit::ApplySpellImmune(), AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, SpellInfo::CanDispelAura(), Unit::ClearUnitState(), ThreatManager::EvaluateSuppressed(), Unit::GetAppliedAuras(), Unit::GetAuraEffectsByType(), GetAuraType(), GetId(), GetMiscValue(), SpellInfo::GetSchoolMask(), GetSpellInfo(), AuraApplication::GetTarget(), Unit::GetThreatMgr(), SpellInfo::HasAttribute(), SpellInfo::Id, IMMUNITY_SCHOOL, SpellInfo::IsPositive(), MECHANIC_BANISH, Unit::RemoveAura(), Unit::RemoveAurasWithInterruptFlags(), SPELL_ATTR1_IMMUNITY_PURGES_EFFECT, SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE, SPELL_SCHOOL_MASK_NORMAL, and UNIT_STATE_ISOLATED.

◆ HandleAuraModShapeshift()

void AuraEffect::HandleAuraModShapeshift ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2010{
2012 return;
2013
2014 Unit* target = aurApp->GetTarget();
2015
2016 uint32 modelid = 0;
2019
2020 switch (form)
2021 {
2022 case FORM_CAT: // 0x01
2023 case FORM_GHOUL: // 0x07
2025 break;
2026
2027 case FORM_BEAR: // 0x05
2028 case FORM_DIREBEAR: // 0x08
2029
2030 case FORM_BATTLESTANCE: // 0x11
2031 case FORM_DEFENSIVESTANCE: // 0x12
2032 case FORM_BERSERKERSTANCE: // 0x13
2034 break;
2035
2036 case FORM_TREE: // 0x02
2037 case FORM_TRAVEL: // 0x03
2038 case FORM_AQUA: // 0x04
2039 case FORM_AMBIENT: // 0x06
2040
2041 case FORM_STEVES_GHOUL: // 0x09
2042 case FORM_THARONJA_SKELETON: // 0x0A
2043 case FORM_TEST_OF_STRENGTH: // 0x0B
2044 case FORM_BLB_PLAYER: // 0x0C
2045 case FORM_SHADOW_DANCE: // 0x0D
2046 case FORM_CREATUREBEAR: // 0x0E
2047 case FORM_CREATURECAT: // 0x0F
2048 case FORM_GHOSTWOLF: // 0x10
2049
2050 case FORM_TEST: // 0x14
2051 case FORM_ZOMBIE: // 0x15
2052 case FORM_METAMORPHOSIS: // 0x16
2053 case FORM_UNDEAD: // 0x19
2054 case FORM_MASTER_ANGLER: // 0x1A
2055 case FORM_FLIGHT_EPIC: // 0x1B
2056 case FORM_SHADOW: // 0x1C
2057 case FORM_FLIGHT: // 0x1D
2058 case FORM_STEALTH: // 0x1E
2059 case FORM_MOONKIN: // 0x1F
2060 case FORM_SPIRITOFREDEMPTION: // 0x20
2061 break;
2062 default:
2063 LOG_ERROR("spells.aura.effect", "Auras: Unknown Shapeshift Type: {}", GetMiscValue());
2064 }
2065
2066 modelid = target->GetModelForForm(form, GetId());
2067
2068 if (apply)
2069 {
2070 // remove polymorph before changing display id to keep new display id
2071 switch (form)
2072 {
2073 case FORM_CAT:
2074 case FORM_TREE:
2075 case FORM_TRAVEL:
2076 case FORM_AQUA:
2077 case FORM_BEAR:
2078 case FORM_DIREBEAR:
2079 case FORM_FLIGHT_EPIC:
2080 case FORM_FLIGHT:
2081 case FORM_MOONKIN:
2082 {
2083 if (Player* player = target->ToPlayer())
2084 {
2085 player->SetCanTeleport(true);
2086 }
2087 // remove movement affects
2088 target->RemoveAurasByShapeShift();
2089
2090 // and polymorphic affects
2091 if (target->IsPolymorphed())
2092 target->RemoveAurasDueToSpell(target->getTransForm());
2093 break;
2094 }
2095 default:
2096 break;
2097 }
2098
2099 // remove other shapeshift before applying a new one
2100 // xinef: rogue shouldnt be wrapped by this check (shadow dance vs stealth)
2101 if (GetSpellInfo()->SpellFamilyName != SPELLFAMILY_ROGUE)
2103
2104 // stop handling the effect if it was removed by linked event
2105 if (aurApp->GetRemoveMode())
2106 return;
2107
2108 if (PowerType != POWER_MANA)
2109 {
2110 uint32 oldPower = target->GetPower(PowerType);
2111 // reset power to default values only at power change
2112 if (target->getPowerType() != PowerType)
2113 target->setPowerType(PowerType);
2114
2115 switch (form)
2116 {
2117 case FORM_CAT:
2118 case FORM_BEAR:
2119 case FORM_DIREBEAR:
2120 {
2121 // get furor proc chance
2122 uint32 FurorChance = 0;
2123 if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
2124 FurorChance = std::max(dummy->GetAmount(), 0);
2125
2126 switch (GetMiscValue())
2127 {
2128 case FORM_CAT:
2129 {
2130 int32 basePoints = int32(std::min(oldPower, FurorChance));
2131 target->SetPower(POWER_ENERGY, 0);
2132 target->CastCustomSpell(target, 17099, &basePoints, nullptr, nullptr, true, nullptr, this);
2133 break;
2134 }
2135 case FORM_BEAR:
2136 case FORM_DIREBEAR:
2137 if (urand(0, 99) < FurorChance)
2138 target->CastSpell(target, 17057, true);
2139 break;
2140 default:
2141 {
2142 uint32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance);
2143 target->SetPower(POWER_ENERGY, newEnergy);
2144 break;
2145 }
2146 }
2147 break;
2148 }
2149 default:
2150 break;
2151 }
2152 }
2153 // stop handling the effect if it was removed by linked event
2154 if (aurApp->GetRemoveMode())
2155 return;
2156
2157 target->SetShapeshiftForm(form);
2158 // xinef: allow shapeshift to override model id if forced transform aura is not present!
2159 if (modelid > 0)
2160 {
2161 bool allow = true;
2162 if (target->getTransForm() && !(target->GetMapId() == MAP_THE_ESCAPE_FROM_DURNHOLDE))
2163 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm()))
2164 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !transformSpellInfo->IsPositive())
2165 allow = false;
2166
2167 if (allow)
2168 target->SetDisplayId(modelid);
2169 }
2170 }
2171 else
2172 {
2173 // reset model id if no other auras present
2174 // may happen when aura is applied on linked event on aura removal
2175 if (!target->HasShapeshiftAura())
2176 {
2179 {
2180 target->setPowerType(POWER_MANA);
2181 // Remove movement impairing effects also when shifting out
2182 target->RemoveAurasByShapeShift();
2183 }
2184 }
2185
2186 if (modelid > 0)
2187 target->RestoreDisplayId();
2188
2189 switch (form)
2190 {
2191 // Nordrassil Harness - bonus
2192 case FORM_BEAR:
2193 case FORM_DIREBEAR:
2194 case FORM_CAT:
2195 if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
2196 target->CastSpell(target, 37316, true, nullptr, dummy);
2197 break;
2198 // Nordrassil Regalia - bonus
2199 case FORM_MOONKIN:
2200 if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
2201 target->CastSpell(target, 37325, true, nullptr, dummy);
2202 break;
2203 case FORM_BATTLESTANCE:
2206 {
2207 uint32 Rage_val = 0;
2208 // Defensive Tactics
2209 if (form == FORM_DEFENSIVESTANCE)
2210 {
2211 if (AuraEffect const* aurEff = target->IsScriptOverriden(m_spellInfo, 831))
2212 Rage_val += aurEff->GetAmount() * 10;
2213 }
2214 // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
2215 if (target->IsPlayer())
2216 {
2217 // Stance mastery - trainer spell
2218 PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
2219 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
2220 {
2221 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec()))
2222 continue;
2223
2224 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
2225 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
2226 Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
2227 }
2228
2229 // Tactical Mastery - talent
2230 PlayerTalentMap const& tp_list = target->ToPlayer()->GetTalentMap();
2231 for (PlayerTalentMap::const_iterator itr = tp_list.begin(); itr != tp_list.end(); ++itr)
2232 {
2233 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec()))
2234 continue;
2235
2236 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
2237 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
2238 Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
2239 }
2240 }
2241 if (target->GetPower(POWER_RAGE) > Rage_val)
2242 target->SetPower(POWER_RAGE, Rage_val);
2243 break;
2244 }
2245 default:
2246 break;
2247 }
2248 }
2249
2250 // adding/removing linked auras
2251 // add/remove the shapeshift aura's boosts
2252 HandleShapeshiftBoosts(target, apply);
2253
2254 if (target->IsPlayer())
2255 target->ToPlayer()->InitDataForForm();
2256
2258 {
2259 // Dash
2261 aurEff->RecalculateAmount();
2262
2263 // Disarm handling
2264 // If druid shifts while being disarmed we need to deal with that since forms aren't affected by disarm
2265 // and also HandleAuraModDisarm is not triggered
2266 if (!target->CanUseAttackType(BASE_ATTACK))
2267 {
2269 {
2270 target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), nullptr, apply);
2271 }
2272 }
2273
2274 // Update crit chance for feral forms
2275 switch (form)
2276 {
2277 case FORM_CAT:
2278 case FORM_BEAR:
2279 case FORM_DIREBEAR:
2280 case FORM_GHOSTWOLF:
2282 break;
2283 default:
2284 break;
2285 }
2286 }
2287
2288 // stop handling the effect if it was removed by linked event
2289 if (apply && aurApp->GetRemoveMode())
2290 return;
2291
2292 if (target->IsPlayer())
2293 {
2294 SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
2295 // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
2296 // The client shows form spells from its own SpellShapeshiftForm.dbc, so no learned/removed spell packet
2297 // (and no chat message) is sent
2298 for (uint8 i = 0; i < MAX_SHAPESHIFT_SPELLS; ++i)
2299 {
2300 if (!shapeInfo->stanceSpell[i])
2301 continue;
2302 if (apply)
2303 target->ToPlayer()->_addSpell(shapeInfo->stanceSpell[i], SPEC_MASK_ALL, true, false,
2304 /*sendPacket*/ false);
2305 else
2306 target->ToPlayer()->removeSpell(shapeInfo->stanceSpell[i], SPEC_MASK_ALL, true, /*sendPacket*/ false);
2307 }
2308 }
2309}
@ MAP_THE_ESCAPE_FROM_DURNHOLDE
Definition AreaDefines.h:240
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormEntryfmt)
#define MAX_SHAPESHIFT_SPELLS
Definition DBCStructure.h:1850
std::unordered_map< uint32, PlayerTalent * > PlayerTalentMap
Definition Player.h:193
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition Player.h:194
#define SPEC_MASK_ALL
Definition Player.h:178
@ PLAYERSPELL_REMOVED
Definition Player.h:123
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ POWER_RAGE
Definition SharedDefines.h:258
@ POWER_ENERGY
Definition SharedDefines.h:260
@ POWER_MANA
Definition SharedDefines.h:257
@ CLASS_DRUID
Definition SharedDefines.h:136
@ SPELLFAMILY_WARRIOR
Definition SharedDefines.h:3788
@ SPELL_ATTR0_NO_IMMUNITIES
Definition SharedDefines.h:399
@ SPELL_AURA_MOD_SHAPESHIFT
Definition SpellAuraDefines.h:99
@ SPELL_AURA_MOD_INCREASE_SPEED
Definition SpellAuraDefines.h:94
@ AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK
Definition SpellAuraDefines.h:51
ShapeshiftForm
Definition UnitDefines.h:71
@ FORM_DIREBEAR
Definition UnitDefines.h:80
@ FORM_UNDEAD
Definition UnitDefines.h:95
@ FORM_TEST
Definition UnitDefines.h:92
@ FORM_TRAVEL
Definition UnitDefines.h:75
@ FORM_CREATUREBEAR
Definition UnitDefines.h:86
@ FORM_SHADOW
Definition UnitDefines.h:98
@ FORM_SHADOW_DANCE
Definition UnitDefines.h:85
@ FORM_SPIRITOFREDEMPTION
Definition UnitDefines.h:102
@ FORM_BERSERKERSTANCE
Definition UnitDefines.h:91
@ FORM_MASTER_ANGLER
Definition UnitDefines.h:96
@ FORM_DEFENSIVESTANCE
Definition UnitDefines.h:90
@ FORM_THARONJA_SKELETON
Definition UnitDefines.h:82
@ FORM_FLIGHT_EPIC
Definition UnitDefines.h:97
@ FORM_STEVES_GHOUL
Definition UnitDefines.h:81
@ FORM_MOONKIN
Definition UnitDefines.h:101
@ FORM_NONE
Definition UnitDefines.h:72
@ FORM_CREATURECAT
Definition UnitDefines.h:87
@ FORM_CAT
Definition UnitDefines.h:73
@ FORM_FLIGHT
Definition UnitDefines.h:99
@ FORM_ZOMBIE
Definition UnitDefines.h:93
@ FORM_AMBIENT
Definition UnitDefines.h:78
@ FORM_AQUA
Definition UnitDefines.h:76
@ FORM_STEALTH
Definition UnitDefines.h:100
@ FORM_BATTLESTANCE
Definition UnitDefines.h:89
@ FORM_BLB_PLAYER
Definition UnitDefines.h:84
@ FORM_METAMORPHOSIS
Definition UnitDefines.h:94
@ FORM_GHOUL
Definition UnitDefines.h:79
@ FORM_TREE
Definition UnitDefines.h:74
@ FORM_TEST_OF_STRENGTH
Definition UnitDefines.h:83
@ FORM_BEAR
Definition UnitDefines.h:77
void HandleShapeshiftBoosts(Unit *target, bool apply) const
Definition SpellAuraEffects.cpp:1368
static ObjectGuid const Empty
Definition ObjectGuid.h:123
bool _addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill=false, bool sendPacket=true)
Definition Player.cpp:3246
PlayerSpellMap const & GetSpellMap() const
Definition Player.h:1800
void InitDataForForm(bool reapplyMods=false)
Definition Player.cpp:10760
void removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporary, bool sendPacket=true)
Definition Player.cpp:3512
uint8 GetActiveSpec() const
Definition Player.h:1768
void UpdateAllCritPercentages()
Definition StatSystem.cpp:698
PlayerTalentMap const & GetTalentMap() const
Definition Player.h:2660
uint32 SpellIconID
Definition SpellInfo.h:404
void RemoveAurasByShapeShift()
Definition Unit.cpp:5338
bool IsPolymorphed() const
Definition Unit.cpp:12816
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:12108
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5571
virtual bool IsClass(Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
Definition Unit.h:850
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition Unit.cpp:5909
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId)
Definition Unit.cpp:15124
bool CanUseAttackType(WeaponAttackType attacktype) const
Definition Unit.h:1006
bool HasShapeshiftAura() const
Definition Unit.h:1844
void RestoreDisplayId()
Definition Unit.cpp:12851
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition Unit.h:1454
uint32 getTransForm() const
Definition Unit.h:1990
Powers getPowerType() const
Definition Unit.h:1145
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition Unit.cpp:5178
uint32 GetPower(Powers power) const
Definition Unit.h:1149
void setPowerType(Powers power)
Definition Unit.cpp:6809
void SetShapeshiftForm(ShapeshiftForm form)
Definition Unit.cpp:17002
uint32 GetMapId() const
Definition Position.h:281
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition Object.cpp:3378
Definition DBCStructure.h:1853
uint32 stanceSpell[MAX_SHAPESHIFT_SPELLS]
Definition DBCStructure.h:1865

References Player::_addSpell(), Player::_ApplyWeaponDamage(), AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK, BASE_ATTACK, WorldObject::CalculateSpellDamage(), Unit::CanUseAttackType(), Unit::CastCustomSpell(), Unit::CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_DRUID, ObjectGuid::Empty, EQUIPMENT_SLOT_MAINHAND, FORM_AMBIENT, FORM_AQUA, FORM_BATTLESTANCE, FORM_BEAR, FORM_BERSERKERSTANCE, FORM_BLB_PLAYER, FORM_CAT, FORM_CREATUREBEAR, FORM_CREATURECAT, FORM_DEFENSIVESTANCE, FORM_DIREBEAR, FORM_FLIGHT, FORM_FLIGHT_EPIC, FORM_GHOSTWOLF, FORM_GHOUL, FORM_MASTER_ANGLER, FORM_METAMORPHOSIS, FORM_MOONKIN, FORM_NONE, FORM_SHADOW, FORM_SHADOW_DANCE, FORM_SPIRITOFREDEMPTION, FORM_STEALTH, FORM_STEVES_GHOUL, FORM_TEST, FORM_TEST_OF_STRENGTH, FORM_THARONJA_SKELETON, FORM_TRAVEL, FORM_TREE, FORM_UNDEAD, FORM_ZOMBIE, Player::GetActiveSpec(), Unit::GetAuraEffect(), GetBase(), Unit::GetDummyAuraEffect(), GetId(), Player::GetItemByPos(), WorldLocation::GetMapId(), GetMiscValue(), Unit::GetModelForForm(), Unit::GetPower(), Unit::getPowerType(), AuraApplication::GetRemoveMode(), GetSpellInfo(), Player::GetSpellMap(), Player::GetTalentMap(), AuraApplication::GetTarget(), Unit::getTransForm(), HandleShapeshiftBoosts(), Unit::HasShapeshiftAura(), Player::InitDataForForm(), INVENTORY_SLOT_BAG_0, Unit::IsClass(), Object::IsPlayer(), Unit::IsPolymorphed(), Unit::IsScriptOverriden(), LOG_ERROR, m_spellInfo, MAP_THE_ESCAPE_FROM_DURNHOLDE, MAX_SHAPESHIFT_SPELLS, PLAYERSPELL_REMOVED, POWER_ENERGY, POWER_MANA, POWER_RAGE, Unit::RemoveAurasByShapeShift(), Unit::RemoveAurasByType(), Unit::RemoveAurasDueToSpell(), Player::removeSpell(), Unit::RestoreDisplayId(), Unit::SetDisplayId(), Unit::SetPower(), Unit::setPowerType(), Unit::SetShapeshiftForm(), SPEC_MASK_ALL, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_MOD_INCREASE_SPEED, SPELL_AURA_MOD_SHAPESHIFT, SPELLFAMILY_DRUID, SPELLFAMILY_ROGUE, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, sSpellMgr, sSpellShapeshiftFormStore, SpellShapeshiftFormEntry::stanceSpell, Object::ToPlayer(), Player::UpdateAllCritPercentages(), and urand().

◆ HandleAuraModSilence()

void AuraEffect::HandleAuraModSilence ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3168{
3169 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3170 return;
3171
3172 Unit* target = aurApp->GetTarget();
3173
3174 if (apply)
3175 {
3177
3178 // call functions which may have additional effects after chainging state of unit
3179 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
3180 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
3181 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
3182 if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
3183 // Stop spells on prepare or casting state
3184 target->InterruptSpell(CurrentSpellTypes(i), false);
3185 }
3186 else
3187 {
3188 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3189 if (target->HasSilenceAura() || target->HasPacifySilenceAura())
3190 return;
3191
3193 }
3194}
@ SPELL_PREVENTION_TYPE_SILENCE
Definition SharedDefines.h:1558
@ UNIT_FLAG_SILENCED
Definition UnitDefines.h:270
#define CURRENT_MAX_SPELL
Definition Unit.h:570
CurrentSpellTypes
Definition Unit.h:562
@ CURRENT_MELEE_SPELL
Definition Unit.h:563
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4007
bool HasSilenceAura() const
Definition Unit.h:1843

References AURA_EFFECT_HANDLE_REAL, CURRENT_MAX_SPELL, CURRENT_MELEE_SPELL, Unit::GetCurrentSpell(), AuraApplication::GetTarget(), Unit::HasPacifySilenceAura(), Unit::HasSilenceAura(), Unit::InterruptSpell(), Unit::RemoveUnitFlag(), Unit::SetUnitFlag(), SPELL_PREVENTION_TYPE_SILENCE, and UNIT_FLAG_SILENCED.

Referenced by HandleAuraModPacifyAndSilence().

◆ HandleAuraModSkill()

void AuraEffect::HandleAuraModSkill ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3369{
3371 return;
3372 Unit* target = aurApp->GetTarget();
3373
3374 if (!target->IsPlayer())
3375 return;
3376
3377 uint32 prot = GetMiscValue();
3378 int32 points = GetAmount();
3379
3380 target->ToPlayer()->ModifySkillBonus(prot, ((apply) ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
3381 if (prot == SKILL_DEFENSE)
3382 target->ToPlayer()->UpdateDefenseBonusesMod();
3383}
@ SKILL_DEFENSE
Definition SharedDefines.h:3114
@ SPELL_AURA_MOD_SKILL_TALENT
Definition SpellAuraDefines.h:161
@ AURA_EFFECT_HANDLE_SKILL
Definition SpellAuraDefines.h:47
void ModifySkillBonus(uint32 skillid, int32 val, bool talent)
Definition Player.cpp:5485
void UpdateDefenseBonusesMod()
Definition StatSystem.cpp:626

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_SKILL, GetAmount(), GetAuraType(), GetMiscValue(), AuraApplication::GetTarget(), Object::IsPlayer(), Player::ModifySkillBonus(), SKILL_DEFENSE, SPELL_AURA_MOD_SKILL_TALENT, Object::ToPlayer(), and Player::UpdateDefenseBonusesMod().

◆ HandleAuraModStalked()

void AuraEffect::HandleAuraModStalked ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3311{
3313 return;
3314
3315 Unit* target = aurApp->GetTarget();
3316
3317 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
3318 if (apply)
3320 else
3321 {
3322 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3323 if (!target->HasAuraType(GetAuraType()))
3325 }
3326
3327 // call functions which may have additional effects after chainging state of unit
3328 target->UpdateObjectVisibility(target->IsPlayer());
3329}
@ UNIT_DYNFLAG_TRACK_UNIT
Definition SharedDefines.h:3355
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:132
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:131
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition Unit.cpp:15054

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), AuraApplication::GetTarget(), Unit::HasAuraType(), Object::IsPlayer(), Object::RemoveDynamicFlag(), Object::SetDynamicFlag(), UNIT_DYNFLAG_TRACK_UNIT, and Unit::UpdateObjectVisibility().

◆ HandleAuraModStat()

void AuraEffect::HandleAuraModStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4226{
4228 return;
4229
4230 if (GetMiscValue() < -2 || GetMiscValue() > 4)
4231 {
4232 LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
4233 return;
4234 }
4235
4236 Unit* target = aurApp->GetTarget();
4238 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4239 return;
4240
4241 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4242 {
4243 // -1 or -2 is all stats (misc < -2 checked in function beginning)
4244 if (GetMiscValue() < 0 || GetMiscValue() == i)
4245 {
4246 if (spellGroupVal)
4248 float(spellGroupVal), !apply);
4249
4251 if (target->IsPlayer() || target->IsPet())
4252 target->UpdateStatBuffMod(Stats(i));
4253 }
4254 }
4255}
#define MAX_STATS
Definition SharedDefines.h:253
Stats
Definition SharedDefines.h:245
@ STAT_STRENGTH
Definition SharedDefines.h:246
@ SPELL_AURA_MOD_STAT
Definition SpellAuraDefines.h:92
@ UNIT_MOD_STAT_START
Definition Unit.h:180
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition Unit.cpp:4333
void UpdateStatBuffMod(Stats stat)
Definition Unit.cpp:6255

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetEffIndex(), Unit::GetHighestExclusiveSameEffectSpellGroupValue(), GetId(), GetMiscValue(), AuraApplication::GetTarget(), Unit::HandleStatFlatModifier(), Unit::IsPet(), Object::IsPlayer(), LOG_ERROR, MAX_STATS, SPELL_AURA_MOD_STAT, STAT_STRENGTH, TOTAL_VALUE, UNIT_MOD_STAT_START, and Unit::UpdateStatBuffMod().

◆ HandleAuraModStateImmunity()

void AuraEffect::HandleAuraModStateImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

◆ HandleAuraModStun()

void AuraEffect::HandleAuraModStun ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3658{
3659 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3660 return;
3661
3662 Unit* target = aurApp->GetTarget();
3663
3664 target->SetControlled(apply, UNIT_STATE_STUNNED);
3665 if (apply)
3666 target->GetThreatMgr().EvaluateSuppressed();
3667}
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:176

References AURA_EFFECT_HANDLE_REAL, ThreatManager::EvaluateSuppressed(), AuraApplication::GetTarget(), Unit::GetThreatMgr(), Unit::SetControlled(), and UNIT_STATE_STUNNED.

◆ HandleAuraModTotalThreat()

void AuraEffect::HandleAuraModTotalThreat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3590{
3592 return;
3593
3594 Unit* target = aurApp->GetTarget();
3595
3596 if (!target->IsAlive() || !target->IsPlayer())
3597 return;
3598
3599 Unit* caster = GetCaster();
3600 if (caster && caster->IsAlive())
3602}
void UpdateMyTempModifiers()
Definition ThreatManager.cpp:815

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetCaster(), AuraApplication::GetTarget(), Unit::GetThreatMgr(), Unit::IsAlive(), Object::IsPlayer(), and ThreatManager::UpdateMyTempModifiers().

◆ HandleAuraModUseNormalSpeed()

void AuraEffect::HandleAuraModUseNormalSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3938{
3939 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3940 return;
3941
3942 Unit* target = aurApp->GetTarget();
3943
3944 target->UpdateSpeed(MOVE_RUN, true);
3945 target->UpdateSpeed(MOVE_SWIM, true);
3946 target->UpdateSpeed(MOVE_FLIGHT, true);
3947
3948 if (Player* targetPlayer = target->ToPlayer())
3949 {
3950 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3951 }
3952}

References AURA_EFFECT_HANDLE_REAL, AuraApplication::GetTarget(), MOVE_FLIGHT, MOVE_RUN, MOVE_SWIM, sScriptMgr, Object::ToPlayer(), and Unit::UpdateSpeed().

◆ HandleAuraModWeaponCritPercent()

void AuraEffect::HandleAuraModWeaponCritPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4675{
4677 return;
4678
4679 Player* target = aurApp->GetTarget()->ToPlayer();
4680
4681 if (!target)
4682 return;
4683
4685}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::ToPlayer(), and Player::UpdateAllWeaponDependentCritAuras().

◆ HandleAuraMounted()

void AuraEffect::HandleAuraMounted ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3390{
3392 return;
3393
3394 Unit* target = aurApp->GetTarget();
3395 Unit* caster = GetCaster();
3396
3397 if (apply)
3398 {
3399 uint32 creatureEntry = GetMiscValue();
3400 uint32 displayId = 0;
3401 uint32 vehicleId = 0;
3402
3403 // Festive Holiday Mount
3404 if (target->HasAura(62061))
3405 {
3407 creatureEntry = 24906;
3408 else
3409 creatureEntry = 15665;
3410 }
3411
3412 // Festive Brewfest Mount
3414 {
3415 if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
3416 {
3417 creatureEntry = GREAT_BREWFEST_KODO;
3418 }
3419 else
3420 {
3421 creatureEntry = BREWFEST_KODO;
3422 }
3423 }
3424
3425 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
3426 {
3427 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
3428 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
3429 displayId = model.CreatureDisplayID;
3430
3431 vehicleId = creatureInfo->VehicleId;
3432
3433 //some spell has one aura of mount and one of vehicle
3434 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3435 {
3436 if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue())
3437 {
3438 displayId = 0;
3439 }
3440 }
3441
3442 }
3443 target->Mount(displayId, vehicleId, GetMiscValue());
3444 }
3445 else
3446 {
3447 target->Dismount();
3448 //some mounts like Headless Horseman's Mount or broom stick are skill based spell
3449 // need to remove ALL arura related to mounts, this will stop client crash with broom stick
3450 // and never endless flying after using Headless Horseman's Mount
3451 if (mode & AURA_EFFECT_HANDLE_REAL)
3453 }
3454}
@ SPELL_EFFECT_SUMMON
Definition SharedDefines.h:794
void Dismount()
Definition Unit.cpp:10363
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5798
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition Unit.cpp:10303

References AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, BREWFEST_KODO, ObjectMgr::ChooseDisplayId(), CreatureModel::CreatureDisplayID, Unit::Dismount(), FRESH_BREWFEST_HOPS, GetBase(), GetCaster(), GetMiscValue(), Unit::GetSpeedRate(), GetSpellInfo(), AuraApplication::GetTarget(), GREAT_BREWFEST_KODO, Unit::HasAura(), MAX_SPELL_EFFECTS, Unit::Mount(), MOVE_RUN, Unit::RemoveAurasByType(), sObjectMgr, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_MOUNTED, and SPELL_EFFECT_SUMMON.

◆ HandleAuraOpenStable()

void AuraEffect::HandleAuraOpenStable ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5871{
5872 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5873 return;
5874
5875 Unit* target = aurApp->GetTarget();
5876
5877 if (!target->IsPlayer() || !target->IsInWorld())
5878 return;
5879
5880 if (apply)
5881 target->ToPlayer()->GetSession()->SendStablePet(target->GetGUID());
5882
5883 // client auto close stable dialog at !apply aura
5884}
bool IsInWorld() const
Definition Object.h:115
WorldSession * GetSession() const
Definition Player.h:2032
void SendStablePet(ObjectGuid guid)
Definition NPCHandler.cpp:355

References AURA_EFFECT_HANDLE_REAL, Object::GetGUID(), Player::GetSession(), AuraApplication::GetTarget(), Object::IsInWorld(), Object::IsPlayer(), WorldSession::SendStablePet(), and Object::ToPlayer().

◆ HandleAuraOverrideSpells()

void AuraEffect::HandleAuraOverrideSpells ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5900{
5901 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5902 return;
5903
5904 Player* target = aurApp->GetTarget()->ToPlayer();
5905
5906 if (!target || !target->IsInWorld())
5907 return;
5908
5909 uint32 overrideId = uint32(GetMiscValue());
5910
5911 if (apply)
5912 {
5914 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5915 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5916 if (uint32 spellId = overrideSpells->spellId[i])
5917 target->_addSpell(spellId, SPEC_MASK_ALL, true);
5918 }
5919 else
5920 {
5922 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5923 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5924 if (uint32 spellId = overrideSpells->spellId[i])
5925 target->removeSpell(spellId, SPEC_MASK_ALL, true);
5926 }
5927}
DBCStorage< OverrideSpellDataEntry > sOverrideSpellDataStore(OverrideSpellDatafmt)
#define MAX_OVERRIDE_SPELL
Definition DBCStructure.h:1447
#define PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET
Definition Player.h:536
@ PLAYER_FIELD_BYTES2
Definition UpdateFields.h:378
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition Object.cpp:768
Definition DBCStructure.h:1450

References Player::_addSpell(), AURA_EFFECT_HANDLE_REAL, GetMiscValue(), AuraApplication::GetTarget(), Object::IsInWorld(), MAX_OVERRIDE_SPELL, PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET, PLAYER_FIELD_BYTES2, Player::removeSpell(), Object::SetUInt16Value(), sOverrideSpellDataStore, SPEC_MASK_ALL, and Object::ToPlayer().

◆ HandleAuraRetainComboPoints()

void AuraEffect::HandleAuraRetainComboPoints ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5172{
5173 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5174 return;
5175
5176 Unit* target = aurApp->GetTarget();
5177
5178 if (!target->IsPlayer())
5179 return;
5180
5181 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
5182 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
5183 if (!(apply) && GetBase()->GetDuration() == 0)
5184 target->AddComboPoints(-GetAmount());
5185}
void AddComboPoints(Unit *target, int8 count)
Definition Unit.cpp:12914

References Unit::AddComboPoints(), AURA_EFFECT_HANDLE_REAL, GetAmount(), GetBase(), AuraApplication::GetTarget(), and Object::IsPlayer().

◆ HandleAuraSetVehicle()

void AuraEffect::HandleAuraSetVehicle ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5930{
5931 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5932 return;
5933
5934 Unit* target = aurApp->GetTarget();
5935
5936 if (!target->IsPlayer() || !target->IsInWorld())
5937 return;
5938
5939 uint32 vehicleId = GetMiscValue();
5940
5941 if (apply)
5942 {
5943 if (!target->CreateVehicleKit(vehicleId, 0))
5944 return;
5945 }
5946 else if (target->GetVehicleKit())
5947 target->RemoveVehicleKit();
5948
5950 data << target->GetPackGUID();
5951 data << uint32(apply ? vehicleId : 0);
5952 target->SendMessageToSet(&data, true);
5953
5954 if (apply)
5955 {
5957 target->ToPlayer()->SendDirectMessage(&data);
5958 }
5959}
PackedGuid const & GetPackGUID() const
Definition Object.h:122
std::size_t size() const
Definition ObjectGuid.h:278
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5873
void RemoveVehicleKit()
Definition Unit.cpp:14683
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition Unit.cpp:14671
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:2178
Definition WorldPacket.h:26
@ SMSG_PLAYER_VEHICLE_DATA
Definition Opcodes.h:1221
@ SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA
Definition Opcodes.h:1211

References AURA_EFFECT_HANDLE_REAL, Unit::CreateVehicleKit(), GetMiscValue(), Object::GetPackGUID(), AuraApplication::GetTarget(), Unit::GetVehicleKit(), WorldPacket::Initialize(), Object::IsInWorld(), Object::IsPlayer(), Unit::RemoveVehicleKit(), Player::SendDirectMessage(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SMSG_PLAYER_VEHICLE_DATA, and Object::ToPlayer().

◆ HandleAuraTrackCreatures()

void AuraEffect::HandleAuraTrackCreatures ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3260{
3262 return;
3263
3264 Unit* target = aurApp->GetTarget();
3265
3266 if (!target->IsPlayer())
3267 return;
3268
3269 if (apply)
3270 target->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
3271 else
3272 target->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
3273}
@ PLAYER_TRACK_CREATURES
Definition UpdateFields.h:344

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetMiscValue(), AuraApplication::GetTarget(), Object::IsPlayer(), PLAYER_TRACK_CREATURES, Object::RemoveFlag(), and Object::SetFlag().

◆ HandleAuraTrackResources()

void AuraEffect::HandleAuraTrackResources ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3276{
3278 return;
3279
3280 Unit* target = aurApp->GetTarget();
3281
3282 if (!target->IsPlayer())
3283 return;
3284
3285 if (apply)
3286 target->SetFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
3287 else
3288 target->RemoveFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
3289}
@ PLAYER_TRACK_RESOURCES
Definition UpdateFields.h:345

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetMiscValue(), AuraApplication::GetTarget(), Object::IsPlayer(), PLAYER_TRACK_RESOURCES, Object::RemoveFlag(), and Object::SetFlag().

◆ HandleAuraTrackStealthed()

void AuraEffect::HandleAuraTrackStealthed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3292{
3294 return;
3295
3296 Unit* target = aurApp->GetTarget();
3297
3298 if (!target->IsPlayer())
3299 return;
3300
3301 if (!(apply))
3302 {
3303 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3304 if (target->HasAuraType(GetAuraType()))
3305 return;
3306 }
3308}
@ PLAYER_FIELD_BYTE_TRACK_STEALTHED
Definition Player.h:544
@ PLAYER_FIELD_BYTES
Definition UpdateFields.h:368
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition Object.cpp:890

References Object::ApplyModFlag(), AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), AuraApplication::GetTarget(), Unit::HasAuraType(), Object::IsPlayer(), PLAYER_FIELD_BYTE_TRACK_STEALTHED, and PLAYER_FIELD_BYTES.

◆ HandleAuraTransform()

void AuraEffect::HandleAuraTransform ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2312{
2314 return;
2315
2316 Unit* target = aurApp->GetTarget();
2317
2318 if (apply)
2319 {
2320 // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case
2321 if (GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !target->GetModelForForm(target->GetShapeshiftForm(), GetId()) || !GetSpellInfo()->IsPositive())
2322 {
2323 // special case (spell specific functionality)
2324 if (GetMiscValue() == 0)
2325 {
2326 switch (GetId())
2327 {
2328 // Orb of Deception
2329 case 16739:
2330 {
2331 if (!target->IsPlayer())
2332 return;
2333
2334 switch (target->getRace())
2335 {
2336 // Blood Elf
2337 case RACE_BLOODELF:
2338 target->SetDisplayId(target->getGender() == GENDER_MALE ? 17829 : 17830);
2339 break;
2340 // Orc
2341 case RACE_ORC:
2342 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10139 : 10140);
2343 break;
2344 // Troll
2345 case RACE_TROLL:
2346 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10135 : 10134);
2347 break;
2348 // Tauren
2349 case RACE_TAUREN:
2350 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10136 : 10147);
2351 break;
2352 // Undead
2353 case RACE_UNDEAD_PLAYER:
2354 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10146 : 10145);
2355 break;
2356 // Draenei
2357 case RACE_DRAENEI:
2358 target->SetDisplayId(target->getGender() == GENDER_MALE ? 17827 : 17828);
2359 break;
2360 // Dwarf
2361 case RACE_DWARF:
2362 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10141 : 10142);
2363 break;
2364 // Gnome
2365 case RACE_GNOME:
2366 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10148 : 10149);
2367 break;
2368 // Human
2369 case RACE_HUMAN:
2370 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10137 : 10138);
2371 break;
2372 // Night Elf
2373 case RACE_NIGHTELF:
2374 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10143 : 10144);
2375 break;
2376 default:
2377 break;
2378 }
2379 break;
2380 }
2381 // Murloc costume
2382 case 42365:
2383 target->SetDisplayId(21723);
2384 break;
2385 // Dread Corsair
2386 case 50517:
2387 // Corsair Costume
2388 case 51926:
2389 {
2390 if (!target->IsPlayer())
2391 return;
2392
2393 switch (target->getRace())
2394 {
2395 // Blood Elf
2396 case RACE_BLOODELF:
2397 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25032 : 25043);
2398 break;
2399 // Orc
2400 case RACE_ORC:
2401 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25039 : 25050);
2402 break;
2403 // Troll
2404 case RACE_TROLL:
2405 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25041 : 25052);
2406 break;
2407 // Tauren
2408 case RACE_TAUREN:
2409 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25040 : 25051);
2410 break;
2411 // Undead
2412 case RACE_UNDEAD_PLAYER:
2413 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25042 : 25053);
2414 break;
2415 // Draenei
2416 case RACE_DRAENEI:
2417 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25033 : 25044);
2418 break;
2419 // Dwarf
2420 case RACE_DWARF:
2421 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25034 : 25045);
2422 break;
2423 // Gnome
2424 case RACE_GNOME:
2425 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25035 : 25046);
2426 break;
2427 // Human
2428 case RACE_HUMAN:
2429 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25037 : 25048);
2430 break;
2431 // Night Elf
2432 case RACE_NIGHTELF:
2433 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25038 : 25049);
2434 break;
2435 default:
2436 break;
2437 }
2438 break;
2439 }
2440 // Pygmy Oil
2441 case 53806:
2442 target->SetDisplayId(22512);
2443 break;
2444 // Honor the Dead
2445 case 65386:
2446 case 65495:
2447 target->SetDisplayId(target->getGender() == GENDER_MALE ? 29203 : 29204);
2448 break;
2449 // Gossip NPC Appearance - Brewfest
2450 case 65511:
2451 {
2452 switch (target->GetDisplayRace())
2453 {
2455 if (urand(0, 1))
2456 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21839 : 21838);
2457 else
2458 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21841 : 21840);
2459 break;
2460 case DisplayRace::Orc:
2461 if (urand(0, 1))
2462 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21867 : 21866);
2463 else
2464 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21869 : 21868);
2465 break;
2466 case DisplayRace::Troll:
2467 if (urand(0, 1))
2468 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21875 : 21874);
2469 else
2470 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21877 : 21876);
2471 break;
2473 if (urand(0, 1))
2474 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21869 : 21871);
2475 else
2476 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21872 : 21873);
2477 break;
2479 if (urand(0, 1))
2480 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21879 : 21878);
2481 else
2482 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21881 : 21880);
2483 break;
2485 if (urand(0, 1))
2486 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21844 : 21842);
2487 else
2488 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21845 : 21843);
2489 break;
2490 case DisplayRace::Dwarf:
2491 if (urand(0, 1))
2492 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21846 : 21848);
2493 else
2494 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21847 : 21849);
2495 break;
2496 case DisplayRace::Gnome:
2497 if (urand(0, 1))
2498 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21851 : 21850);
2499 else
2500 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21853 : 21852);
2501 break;
2502 case DisplayRace::Human:
2503 if (urand(0, 1))
2504 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21859 : 21858);
2505 else
2506 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21861 : 21860);
2507 break;
2509 if (urand(0, 1))
2510 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21863 : 21862);
2511 else
2512 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21865 : 21864);
2513 break;
2515 if (urand(0, 1))
2516 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21854 : 21856);
2517 else
2518 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21855 : 21857);
2519 break;
2520 default:
2521 break;
2522 }
2523
2524 // equip random brewfest mug
2525 uint32 itemIds[5] = {
2526 2703, // Monster - Item, Tankard Wooden
2527 2704, // Monster - Item, Tankard Dirty
2528 2705, // Monster - Item, Tankard Metal
2529 13861, // Monster - Item, Tankard Gold
2530 33963 // NPC Equip 33963
2531 };
2532 if (target->ToCreature())
2533 target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, itemIds[urand(0, 4)]);
2534
2535 break;
2536 }
2537 // Gossip NPC Appearance - Winter Veil
2538 case 65522:
2539 {
2540 switch (target->GetDisplayRace())
2541 {
2543 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18793 : 18785);
2544 break;
2545 case DisplayRace::Orc:
2546 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18805 : 18804);
2547 break;
2548 case DisplayRace::Troll:
2549 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18809 : 18808);
2550 break;
2552 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18807 : 18806);
2553 break;
2555 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18811 : 18810);
2556 break;
2558 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18795 : 18794);
2559 break;
2560 case DisplayRace::Dwarf:
2561 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18797 : 18796);
2562 break;
2563 case DisplayRace::Gnome:
2564 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18799 : 18798);
2565 break;
2566 case DisplayRace::Human:
2567 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18801 : 18800);
2568 break;
2570 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18803 : 18802);
2571 break;
2573 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19342 : 19339);
2574 default:
2575 break;
2576 }
2577 break;
2578 }
2579 // Gossip NPC Appearance - Default
2580 case 65523:
2581 {
2582 switch (target->GetDisplayRace())
2583 {
2585 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19170 : 19169);
2586 break;
2587 case DisplayRace::Orc:
2588 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19182 : 19181);
2589 break;
2590 case DisplayRace::Troll:
2591 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19186 : 19185);
2592 break;
2594 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19184 : 19183);
2595 break;
2597 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19188 : 19187);
2598 break;
2600 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19172 : 19171);
2601 break;
2602 case DisplayRace::Dwarf:
2603 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19174 : 19173);
2604 break;
2605 case DisplayRace::Gnome:
2606 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19176 : 19175);
2607 break;
2608 case DisplayRace::Human:
2609 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19178 : 19177);
2610 break;
2612 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19180 : 19179);
2613 break;
2615 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19343 : 19340);
2616 default:
2617 break;
2618 }
2619 break;
2620 }
2621 // Gossip NPC Appearance - Lunar Festival
2622 case 65524:
2623 {
2624 switch (target->GetDisplayRace())
2625 {
2627 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18841 : 18840);
2628 break;
2629 case DisplayRace::Orc:
2630 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18870 : 18869);
2631 break;
2632 case DisplayRace::Troll:
2633 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18874 : 18873);
2634 break;
2636 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18872 : 18871);
2637 break;
2639 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18876 : 18875);
2640 break;
2642 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18843 : 18842);
2643 break;
2644 case DisplayRace::Dwarf:
2645 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18845 : 18844);
2646 break;
2647 case DisplayRace::Gnome:
2648 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18847 : 18846);
2649 break;
2650 case DisplayRace::Human:
2651 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18860 : 18858);
2652 break;
2654 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18868 : 18867);
2655 break;
2657 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21067 : 19341);
2658 default:
2659 break;
2660 }
2661 break;
2662 }
2663 // Gossip NPC Appearance - Hallow's End
2664 case 65525:
2665 {
2666 switch (target->GetDisplayRace())
2667 {
2669 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22361 : 22360);
2670 break;
2671 case DisplayRace::Orc:
2672 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22375 : 22374);
2673 break;
2674 case DisplayRace::Troll:
2675 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22379 : 22378);
2676 break;
2678 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22377 : 22376);
2679 break;
2681 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22381 : 22380);
2682 break;
2684 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22363 : 22362);
2685 break;
2686 case DisplayRace::Dwarf:
2687 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22365 : 22364);
2688 break;
2689 case DisplayRace::Gnome:
2690 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22367 : 22366);
2691 break;
2692 case DisplayRace::Human:
2693 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22371 : 22370);
2694 break;
2696 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22373 : 22372);
2697 break;
2699 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22369 : 22368);
2700 default:
2701 break;
2702 }
2703 break;
2704 }
2705 // Gossip NPC Appearance - Midsummer
2706 case 65526:
2707 {
2708 switch (target->GetDisplayRace())
2709 {
2711 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21086 : 21085);
2712 break;
2713 case DisplayRace::Orc:
2714 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16438 : 16436);
2715 break;
2716 case DisplayRace::Troll:
2717 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16446 : 16445);
2718 break;
2720 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16432 : 16442);
2721 break;
2723 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16444 : 16443);
2724 break;
2726 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21083 : 21084);
2727 break;
2728 case DisplayRace::Dwarf:
2729 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16413 : 16434);
2730 break;
2731 case DisplayRace::Gnome:
2732 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16448 : 16447);
2733 break;
2734 case DisplayRace::Human:
2735 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16433 : 16412);
2736 break;
2738 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16435 : 16414);
2739 break;
2741 target->SetDisplayId(target->getGender() == GENDER_MALE ? 29243 : 16431);
2742 default:
2743 break;
2744 }
2745 break;
2746 }
2747 // Gossip NPC Appearance - Spirit of Competition
2748 case 65527:
2749 {
2750 switch (target->GetDisplayRace())
2751 {
2753 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24508 : 24519);
2754 break;
2755 case DisplayRace::Orc:
2756 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24515 : 24526);
2757 break;
2758 case DisplayRace::Troll:
2759 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24517 : 24528);
2760 break;
2762 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24516 : 24527);
2763 break;
2765 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24518 : 24529);
2766 break;
2768 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24509 : 24520);
2769 break;
2770 case DisplayRace::Dwarf:
2771 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24510 : 24521);
2772 break;
2773 case DisplayRace::Gnome:
2774 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24511 : 24522);
2775 break;
2776 case DisplayRace::Human:
2777 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24513 : 24524);
2778 break;
2780 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24514 : 24525);
2781 break;
2783 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24512 : 24523);
2784 default:
2785 break;
2786 }
2787 break;
2788 }
2789 // Gossip NPC Appearance - Pirates' Day
2790 case 65528:
2791 {
2792 switch (target->GetDisplayRace())
2793 {
2795 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25032 : 25043);
2796 break;
2797 case DisplayRace::Orc:
2798 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25039 : 25050);
2799 break;
2800 case DisplayRace::Troll:
2801 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25041 : 25052);
2802 break;
2804 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25040 : 25051);
2805 break;
2807 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25042 : 25053);
2808 break;
2810 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25033 : 25044);
2811 break;
2812 case DisplayRace::Dwarf:
2813 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25034 : 25045);
2814 break;
2815 case DisplayRace::Gnome:
2816 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25035 : 25046);
2817 break;
2818 case DisplayRace::Human:
2819 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25037 : 25048);
2820 break;
2822 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25038 : 25049);
2823 break;
2825 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25036 : 25047);
2826 default:
2827 break;
2828 }
2829 break;
2830 }
2831 // Gossip NPC Appearance - Day of the Dead(DotD)
2832 case 65529:
2833 target->SetDisplayId(target->getGender() == GENDER_MALE ? 29203 : 29204);
2834 break;
2835 // Darkspear Pride
2836 case 75532:
2837 target->SetDisplayId(target->getGender() == GENDER_MALE ? 31737 : 31738);
2838 break;
2839 // Gnomeregan Pride
2840 case 75531:
2841 target->SetDisplayId(target->getGender() == GENDER_MALE ? 31654 : 31655);
2842 break;
2843 default:
2844 break;
2845 }
2846 }
2847 else
2848 {
2849 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(GetMiscValue());
2850 if (!ci)
2851 {
2852 target->SetDisplayId(16358); // pig pink ^_^
2853 LOG_ERROR("spells.aura.effect", "Auras: unknown creature id = {} (only need its modelid) From Spell Aura Transform in Spell ID = {}", GetMiscValue(), GetId());
2854 }
2855 else
2856 {
2857 uint32 model_id = 0;
2858
2859 if (uint32 modelid = ObjectMgr::ChooseDisplayId(ci)->CreatureDisplayID)
2860 model_id = modelid; // Will use the default model here
2861
2862 // Polymorph (sheep)
2863 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978)
2864 if (Unit* caster = GetCaster())
2865 if (caster->HasAura(52648)) // Glyph of the Penguin
2866 model_id = 26452;
2867
2868 target->SetDisplayId(model_id);
2869
2870 // Dragonmaw Illusion (set mount model also)
2871 if (GetId() == 42016 && target->GetMountID() && !target->GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
2873 }
2874 }
2875 }
2876
2877 // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case
2878 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
2879 if (!transformSpellInfo || GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
2880 target->setTransForm(GetId());
2881
2882 // polymorph case
2883 if ((mode & AURA_EFFECT_HANDLE_REAL) && target->IsPlayer() && target->IsPolymorphed())
2884 {
2885 // for players, start regeneration after 1s (in polymorph fast regeneration case)
2886 // only if caster is Player (after patch 2.4.2)
2887 if (GetCasterGUID().IsPlayer())
2889
2890 //dismount polymorphed target (after patch 2.4.2)
2891 if (target->IsMounted())
2893 }
2894 }
2895 else
2896 {
2897 // HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true) will reapply it if need
2898 if (target->getTransForm() == GetId())
2899 target->setTransForm(0);
2900
2901 target->RestoreDisplayId();
2902
2903 // Dragonmaw Illusion (restore mount model)
2904 if (GetId() == 42016 && target->GetMountID() == 16314)
2905 {
2906 if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
2907 {
2908 uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
2909 if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
2910 {
2912 sObjectMgr->GetCreatureModelRandomGender(&model, ci);
2913
2915 }
2916 }
2917 }
2918 }
2919}
@ RACE_TROLL
Definition SharedDefines.h:78
@ RACE_UNDEAD_PLAYER
Definition SharedDefines.h:75
@ RACE_ORC
Definition SharedDefines.h:72
@ RACE_DRAENEI
Definition SharedDefines.h:81
@ RACE_NIGHTELF
Definition SharedDefines.h:74
@ RACE_BLOODELF
Definition SharedDefines.h:80
@ RACE_DWARF
Definition SharedDefines.h:73
@ RACE_GNOME
Definition SharedDefines.h:77
@ RACE_HUMAN
Definition SharedDefines.h:71
@ RACE_TAUREN
Definition SharedDefines.h:76
@ UNIT_VIRTUAL_ITEM_SLOT_ID
Definition UpdateFields.h:116
void setRegenTimerCount(uint32 time)
Definition Player.h:1628
uint8 getRace(bool original=false) const
Definition Unit.cpp:16753
DisplayRace GetDisplayRace() const
Definition Unit.h:846
void setTransForm(uint32 spellid)
Definition Unit.h:1989
bool IsMounted() const
Definition Unit.h:1908

References AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, BloodElf, ObjectMgr::ChooseDisplayId(), CreatureModel::CreatureDisplayID, Draenei, Dwarf, GENDER_MALE, Unit::GetAuraEffectsByType(), GetCaster(), GetCasterGUID(), Unit::GetDisplayRace(), Unit::getGender(), GetId(), GetMiscValue(), Unit::GetModelForForm(), Unit::GetMountID(), Unit::getRace(), Unit::GetShapeshiftForm(), GetSpellInfo(), AuraApplication::GetTarget(), Unit::getTransForm(), Gnome, Goblin, Unit::HasAura(), Human, IN_MILLISECONDS, Unit::IsMounted(), Object::IsPlayer(), Unit::IsPolymorphed(), SpellInfo::IsPositive(), LOG_ERROR, NightElf, Orc, RACE_BLOODELF, RACE_DRAENEI, RACE_DWARF, RACE_GNOME, RACE_HUMAN, RACE_NIGHTELF, RACE_ORC, RACE_TAUREN, RACE_TROLL, RACE_UNDEAD_PLAYER, Unit::RemoveAurasByType(), Unit::RestoreDisplayId(), Unit::SetDisplayId(), Player::setRegenTimerCount(), Unit::setTransForm(), Unit::SetUInt32Value(), sObjectMgr, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_MOUNTED, SPELLFAMILY_MAGE, sSpellMgr, Tauren, Object::ToCreature(), Object::ToPlayer(), Troll, Undead, UNIT_FIELD_MOUNTDISPLAYID, UNIT_VIRTUAL_ITEM_SLOT_ID, and urand().

◆ HandleAuraUntrackable()

void AuraEffect::HandleAuraUntrackable ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3332{
3334 return;
3335
3336 Unit* target = aurApp->GetTarget();
3337
3338 if (apply)
3340 else
3341 {
3342 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3343 if (target->HasAuraType(GetAuraType()))
3344 return;
3346 }
3347}
@ UNIT_STAND_FLAGS_UNTRACKABLE
Definition UnitDefines.h:52
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition UnitDefines.h:28
@ UNIT_FIELD_BYTES_1
Definition UpdateFields.h:131
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:921
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:902

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), AuraApplication::GetTarget(), Unit::HasAuraType(), Object::RemoveByteFlag(), Object::SetByteFlag(), UNIT_BYTES_1_OFFSET_VIS_FLAG, UNIT_FIELD_BYTES_1, and UNIT_STAND_FLAGS_UNTRACKABLE.

◆ HandleAuraWaterWalk()

void AuraEffect::HandleAuraWaterWalk ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3477{
3479 return;
3480
3481 Unit* target = aurApp->GetTarget();
3482
3483 if (Player* targetPlayer = target->ToPlayer())
3484 {
3485 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3486 }
3487
3488 if (!apply)
3489 {
3490 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3491 if (target->HasAuraType(GetAuraType()))
3492 return;
3493 }
3494
3495 target->SetWaterWalking(apply);
3496}
void SetWaterWalking(bool enable)
Definition Unit.cpp:16392

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), AuraApplication::GetTarget(), Unit::HasAuraType(), Unit::SetWaterWalking(), sScriptMgr, and Object::ToPlayer().

◆ HandleBindSight()

void AuraEffect::HandleBindSight ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5678{
5679 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5680 return;
5681
5682 Unit* target = aurApp->GetTarget();
5683
5684 Unit* caster = GetCaster();
5685
5686 if (!caster || !caster->IsPlayer())
5687 return;
5688
5689 caster->ToPlayer()->SetViewpoint(target, apply);
5690}
void SetViewpoint(WorldObject *target, bool apply)
Definition Player.cpp:13507

References AURA_EFFECT_HANDLE_REAL, GetCaster(), AuraApplication::GetTarget(), Object::IsPlayer(), Player::SetViewpoint(), and Object::ToPlayer().

◆ HandleBreakableCCAuraProc()

void AuraEffect::HandleBreakableCCAuraProc ( AuraApplication *  aurApp,
ProcEventInfo &  eventInfo 
)
6926{
6927 int32 const damageLeft = GetAmount() - static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage());
6928
6929 if (damageLeft <= 0)
6930 aurApp->GetTarget()->RemoveAura(aurApp);
6931 else
6932 SetAmount(damageLeft);
6933}
Unit * GetTarget() const
Definition SpellAuras.h:62

References GetAmount(), DamageInfo::GetDamage(), ProcEventInfo::GetDamageInfo(), AuraApplication::GetTarget(), Unit::RemoveAura(), and SetAmount().

Referenced by HandleProc().

◆ HandleChannelDeathItem()

void AuraEffect::HandleChannelDeathItem ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5633{
5634 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5635 return;
5636
5637 if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
5638 return;
5639
5640 Unit* caster = GetCaster();
5641
5642 if (!caster || !caster->IsPlayer())
5643 return;
5644
5645 Player* plCaster = caster->ToPlayer();
5646
5647 // Item amount
5648 if (GetAmount() <= 0)
5649 return;
5650
5651 if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
5652 return;
5653
5654 //Adding items
5655 uint32 noSpaceForCount = 0;
5656 uint32 count = m_amount;
5657
5658 ItemPosCountVec dest;
5659 InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount);
5660 if (msg != EQUIP_ERR_OK)
5661 {
5662 count -= noSpaceForCount;
5663 plCaster->SendEquipError(msg, nullptr, nullptr, GetSpellInfo()->Effects[m_effIndex].ItemType);
5664 if (count == 0)
5665 return;
5666 }
5667
5668 Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true);
5669 if (!newitem)
5670 {
5671 plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
5672 return;
5673 }
5674 plCaster->SendNewItem(newitem, count, true, true);
5675}
InventoryResult
Definition Item.h:46
@ EQUIP_ERR_ITEM_NOT_FOUND
Definition Item.h:70
@ EQUIP_ERR_OK
Definition Item.h:47
@ NULL_BAG
Definition Item.h:40
@ NULL_SLOT
Definition Item.h:41
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:758
@ AURA_REMOVE_BY_DEATH
Definition SpellAuraDefines.h:396
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
Definition PlayerStorage.cpp:4855
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0, bool refund=false)
Definition PlayerStorage.cpp:2635
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition PlayerStorage.cpp:4131
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.h:1304

References AURA_EFFECT_HANDLE_REAL, AURA_REMOVE_BY_DEATH, Player::CanStoreNewItem(), EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_OK, GetAmount(), GetCaster(), AuraApplication::GetRemoveMode(), GetSpellInfo(), Object::IsPlayer(), m_amount, m_effIndex, NULL_BAG, NULL_SLOT, Player::SendEquipError(), Player::SendNewItem(), Player::StoreNewItem(), and Object::ToPlayer().

◆ HandleCharmConvert()

void AuraEffect::HandleCharmConvert ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3788{
3789 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3790 return;
3791
3792 Unit* target = aurApp->GetTarget();
3793
3794 Unit* caster = GetCaster();
3795
3796 if (apply)
3797 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
3798 else
3799 target->RemoveCharmedBy(caster);
3800}
@ CHARM_TYPE_CONVERT
Definition CharmInfo.h:48
void RemoveCharmedBy(Unit *charmer)
Definition Unit.cpp:14496
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:14292

References AURA_EFFECT_HANDLE_REAL, CHARM_TYPE_CONVERT, GetCaster(), AuraApplication::GetTarget(), Unit::RemoveCharmedBy(), and Unit::SetCharmedBy().

◆ HandleComprehendLanguage()

void AuraEffect::HandleComprehendLanguage ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5781{
5783 return;
5784
5785 Unit* target = aurApp->GetTarget();
5786
5787 if (apply)
5789 else
5790 {
5791 if (target->HasAuraType(GetAuraType()))
5792 return;
5793
5795 }
5796}
@ UNIT_FLAG2_COMPREHEND_LANG
Definition UnitDefines.h:299

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), AuraApplication::GetTarget(), Unit::HasAuraType(), Unit::RemoveUnitFlag2(), Unit::SetUnitFlag2(), and UNIT_FLAG2_COMPREHEND_LANG.

◆ HandleDetectAmore()

void AuraEffect::HandleDetectAmore ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1855{
1857 {
1858 return;
1859 }
1860
1861 Unit* target = aurApp->GetTarget();
1862 if (!target->IsPlayer())
1863 {
1864 return;
1865 }
1866
1867 if (apply)
1868 {
1869 target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1870 }
1871 else
1872 {
1873 if (target->HasDetectAmoreAura())
1874 {
1876 for (AuraEffect const* aurEff : amoreAuras)
1877 if (GetMiscValue() == aurEff->GetMiscValue())
1878 {
1879 return;
1880 }
1881 }
1882
1883 target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1884 }
1885}
@ SPELL_AURA_DETECT_AMORE
Definition SpellAuraDefines.h:233
bool HasDetectAmoreAura() const
Definition Unit.h:1836

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, Unit::GetAuraEffectsByType(), GetMiscValue(), AuraApplication::GetTarget(), Unit::HasDetectAmoreAura(), Object::IsPlayer(), PLAYER_FIELD_BYTES2, Object::RemoveByteFlag(), Object::SetByteFlag(), and SPELL_AURA_DETECT_AMORE.

◆ HandleEffect() [1/2]

void AuraEffect::HandleEffect ( AuraApplication *  aurApp,
uint8  mode,
bool  apply 
)
756{
757 // check if call is correct, we really don't want using bitmasks here (with 1 exception)
761 || mode == AURA_EFFECT_HANDLE_STAT
762 || mode == AURA_EFFECT_HANDLE_SKILL
765
766 // register/unregister effect in lists in case of real AuraEffect apply/remove
767 // registration/unregistration is done always before real effect handling (some effect handlers code is depending on this)
768 if (mode & AURA_EFFECT_HANDLE_REAL)
769 aurApp->GetTarget()->_RegisterAuraEffect(this, apply);
770
771 // xinef: stacking system, force return if effect is disabled, prevents double apply / unapply
772 // xinef: placed here so above line can unregister effect from the list
773 // xinef: this condition works under assumption that effect handlers performs ALL necessery action with CHANGE_AMOUNT mode
774 // xinef: as far as i've checked, all grouped spells meet this condition
775 if (!aurApp->IsActive(GetEffIndex()))
776 return;
777
778 // real aura apply/remove, handle modifier
780 ApplySpellMod(aurApp->GetTarget(), apply);
781
782 // call scripts helping/replacing effect handlers
783 bool prevented = false;
784 if (apply)
785 prevented = GetBase()->CallScriptEffectApplyHandlers(this, const_cast<AuraApplication const*>(aurApp), (AuraEffectHandleModes)mode);
786 else
787 prevented = GetBase()->CallScriptEffectRemoveHandlers(this, const_cast<AuraApplication const*>(aurApp), (AuraEffectHandleModes)mode);
788
789 // check if script events have removed the aura or if default effect prevention was requested
790 if ((apply && aurApp->GetRemoveMode()) || prevented)
791 return;
792
793 (*this.*AuraEffectHandler [GetAuraType()])(aurApp, mode, apply);
794
795 // check if script events have removed the aura or if default effect prevention was requested
796 if (apply && aurApp->GetRemoveMode())
797 return;
798
799 // call scripts triggering additional events after apply/remove
800 if (apply)
802 else
804}
#define ASSERT
Definition Errors.h:68
AuraEffectHandleModes
Definition SpellAuraDefines.h:40
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT
Definition SpellAuraDefines.h:43
pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]
Definition SpellAuraEffects.cpp:63
bool IsActive(uint8 effIdx)
Definition SpellAuras.h:82
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:74
void ApplySpellMod(Unit *target, bool apply)
Definition SpellAuraEffects.cpp:813
bool CallScriptEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition SpellAuras.cpp:2549
void CallScriptAfterEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition SpellAuras.cpp:2568
bool CallScriptEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition SpellAuras.cpp:2529
void CallScriptAfterEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition SpellAuras.cpp:2582
void _RegisterAuraEffect(AuraEffect *aurEff, bool apply)
Definition Unit.cpp:4754

References Unit::_RegisterAuraEffect(), ApplySpellMod(), ASSERT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_REAPPLY, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, AURA_EFFECT_HANDLE_SKILL, AURA_EFFECT_HANDLE_STAT, AuraEffectHandler, Aura::CallScriptAfterEffectApplyHandlers(), Aura::CallScriptAfterEffectRemoveHandlers(), Aura::CallScriptEffectApplyHandlers(), Aura::CallScriptEffectRemoveHandlers(), GetAuraType(), GetBase(), GetEffIndex(), AuraApplication::GetRemoveMode(), AuraApplication::GetTarget(), and AuraApplication::IsActive().

Referenced by AuraApplication::_HandleEffect(), ChangeAmount(), Aura::HandleAllEffects(), HandleEffect(), and Unit::RestoreDisplayId().

◆ HandleEffect() [2/2]

void AuraEffect::HandleEffect ( Unit *  target,
uint8  mode,
bool  apply 
)
807{
809 ASSERT(aurApp);
810 HandleEffect(aurApp, mode, apply);
811}
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
Definition SpellAuras.h:186

References ASSERT, Aura::GetApplicationOfTarget(), GetBase(), Object::GetGUID(), and HandleEffect().

◆ HandleFarSight()

void AuraEffect::HandleFarSight ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5693{
5694 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5695 {
5696 return;
5697 }
5698
5699 Unit* caster = GetCaster();
5700 if (!caster || !caster->IsPlayer())
5701 {
5702 return;
5703 }
5704
5705 Player* player = caster->ToPlayer();
5706 if (apply)
5707 {
5709 }
5710 else
5711 {
5712 player->ResetFarSightDistance();
5713 }
5714
5715 caster->UpdateObjectVisibility(!apply);
5716}
void SetFarSightDistance(float radius)
Definition Player.cpp:16657
void ResetFarSightDistance()
Definition Player.cpp:16662
float GetMaxRange(bool positive=false, WorldObject *caster=nullptr, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2750

References AURA_EFFECT_HANDLE_REAL, GetCaster(), SpellInfo::GetMaxRange(), Object::IsPlayer(), m_spellInfo, Player::ResetFarSightDistance(), Player::SetFarSightDistance(), Object::ToPlayer(), and Unit::UpdateObjectVisibility().

◆ HandleFeignDeath()

void AuraEffect::HandleFeignDeath ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2958{
2959 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2960 return;
2961
2962 Unit* target = aurApp->GetTarget();
2963
2964 if (!target->IsPlayer())
2965 return;
2966
2967 if (Player* targetPlayer = target->ToPlayer())
2968 {
2969 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2970 }
2971
2972 if (apply)
2973 {
2974 /*
2975 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2976 data<<target->GetGUID();
2977 data<<uint8(0);
2978 target->SendMessageToSet(&data, true);
2979 */
2980
2981 UnitList targets;
2982 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
2984 Cell::VisitObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2985 for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2986 {
2987 if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2988 continue;
2989
2991 {
2992 if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2993 {
2994 SpellInfo const* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo();
2995 if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->IsCreature())
2996 {
2997 Creature* c = (*iter)->ToCreature();
2998 if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
2999 continue;
3000 }
3001 bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY)
3002 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
3003 if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST))
3004 {
3005 // at least one effect truly targets an unit, interrupt the spell
3006 interrupt = true;
3007 break;
3008 }
3009 if (interrupt)
3010 (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
3011 }
3012 }
3013 }
3014
3015 for (auto& pair : target->GetThreatMgr().GetThreatenedByMeList())
3016 pair.second->ScaleThreat(0.0f);
3017
3018 if (target->GetInstanceScript() && target->GetInstanceScript()->IsEncounterInProgress())
3019 {
3020 target->AttackStop();
3021 if (Player* targetPlayer = target->ToPlayer())
3022 targetPlayer->SendAttackSwingCancelAttack();
3023 }
3024 else
3025 target->CombatStop(false, false);
3026
3028
3029 // prevent interrupt message
3030 if (GetCasterGUID() == target->GetGUID())
3031 {
3033 target->FinishSpell(CURRENT_GENERIC_SPELL, true);
3034
3035 // interrupt autoshot
3037 {
3039 target->ToPlayer()->SendAutoRepeatCancel(target);
3040 }
3041 }
3042
3043 target->InterruptNonMeleeSpells(true);
3044
3045 // stop handling the effect if it was removed by linked event
3046 if (aurApp->GetRemoveMode())
3047 return;
3048 // blizz like 2.0.x
3050 // blizz like 2.0.x
3052 // blizz like 2.0.x
3054
3056 }
3057 else
3058 {
3059 /*
3060 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
3061 data<<target->GetGUID();
3062 data<<uint8(1);
3063 target->SendMessageToSet(&data, true);
3064 */
3065 // blizz like 2.0.x
3067 // blizz like 2.0.x
3069 // blizz like 2.0.x
3071
3073 }
3074}
@ UNIT_DYNFLAG_DEAD
Definition SharedDefines.h:3359
@ CREATURE_ELITE_WORLDBOSS
Definition SharedDefines.h:2967
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition SharedDefines.h:605
@ TARGET_OBJECT_TYPE_UNIT
Definition SpellInfo.h:102
@ TARGET_OBJECT_TYPE_UNIT_AND_DEST
Definition SpellInfo.h:103
@ UNIT_FLAG2_FEIGN_DEATH
Definition UnitDefines.h:296
@ UNIT_STATE_DIED
Definition UnitDefines.h:173
@ UNIT_STATE_CASTING
Definition UnitDefines.h:188
@ UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
Definition UnitDefines.h:286
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition Unit.h:569
@ CURRENT_GENERIC_SPELL
Definition Unit.h:564
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:566
std::list< Unit * > UnitList
Definition Unit.h:79
Definition GridNotifiers.h:884
Definition Creature.h:47
bool IsDungeonBoss() const
Definition Creature.cpp:3358
bool isWorldBoss() const
Definition Creature.h:123
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:206
virtual bool IsEncounterInProgress() const
Definition InstanceScript.cpp:153
float GetVisibilityRange() const
Definition Map.h:200
void SendAutoRepeatCancel(Unit *target)
Definition PlayerMisc.cpp:154
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4079
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool keepPvPForOthers=false)
Definition Unit.cpp:7303
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition Unit.cpp:4037
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:7270
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1247
float GetVisibilityRange() const
Definition Object.cpp:1710
Definition GridNotifiers.h:446
uint32 rank
Definition CreatureData.h:206

References Unit::AddUnitState(), Unit::AttackStop(), AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, Unit::ClearUnitState(), Unit::CombatStop(), CREATURE_ELITE_WORLDBOSS, CURRENT_AUTOREPEAT_SPELL, CURRENT_FIRST_NON_MELEE_SPELL, CURRENT_GENERIC_SPELL, CURRENT_MAX_SPELL, SpellInfo::Effects, Unit::FinishSpell(), GetCasterGUID(), Creature::GetCreatureTemplate(), Unit::GetCurrentSpell(), Object::GetGUID(), WorldObject::GetInstanceScript(), WorldObject::GetMap(), AuraApplication::GetRemoveMode(), AuraApplication::GetTarget(), ThreatManager::GetThreatenedByMeList(), Unit::GetThreatMgr(), WorldObject::GetVisibilityRange(), Map::GetVisibilityRange(), SpellInfo::HasAttribute(), Unit::InterruptNonMeleeSpells(), Unit::InterruptSpell(), Creature::IsDungeonBoss(), InstanceScript::IsEncounterInProgress(), Unit::IsPet(), Object::IsPlayer(), Creature::isWorldBoss(), MAX_SPELL_EFFECTS, CreatureTemplate::rank, Unit::RemoveAurasWithInterruptFlags(), Object::RemoveDynamicFlag(), Unit::RemoveUnitFlag(), Unit::RemoveUnitFlag2(), Player::SendAutoRepeatCancel(), Object::SetDynamicFlag(), Unit::SetUnitFlag(), Unit::SetUnitFlag2(), SPELL_ATTR6_IGNORE_PHASE_SHIFT, sScriptMgr, TARGET_OBJECT_TYPE_UNIT, TARGET_OBJECT_TYPE_UNIT_AND_DEST, Object::ToCreature(), Object::ToPlayer(), UNIT_DYNFLAG_DEAD, UNIT_FLAG2_FEIGN_DEATH, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT, UNIT_STATE_CASTING, UNIT_STATE_DIED, and Cell::VisitObjects().

◆ HandleForceMoveForward()

void AuraEffect::HandleForceMoveForward ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3559{
3561 return;
3562
3563 Unit* target = aurApp->GetTarget();
3564
3565 if (apply)
3567 else
3568 {
3569 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3570 if (target->HasAuraType(GetAuraType()))
3571 return;
3573 }
3574}
@ UNIT_FLAG2_FORCE_MOVEMENT
Definition UnitDefines.h:302

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), AuraApplication::GetTarget(), Unit::HasAuraType(), Unit::RemoveUnitFlag2(), Unit::SetUnitFlag2(), and UNIT_FLAG2_FORCE_MOVEMENT.

◆ HandleForceReaction()

void AuraEffect::HandleForceReaction ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5719{
5721 return;
5722
5723 Unit* target = aurApp->GetTarget();
5724
5725 if (!target->IsPlayer())
5726 return;
5727
5728 Player* player = target->ToPlayer();
5729
5730 uint32 faction_id = GetMiscValue();
5731 ReputationRank faction_rank = ReputationRank(m_amount);
5732
5733 player->GetReputationMgr().ApplyForceReaction(faction_id, faction_rank, apply);
5735
5736 // stop fighting if at apply forced rank friendly or at remove real rank friendly
5737 if ((apply && faction_rank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(faction_id) >= REP_FRIENDLY))
5738 player->StopAttackFaction(faction_id);
5739}
ReputationRank
Definition SharedDefines.h:156
@ REP_FRIENDLY
Definition SharedDefines.h:161
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:6042
ReputationMgr & GetReputationMgr()
Definition Player.h:2157
void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply)
Definition ReputationMgr.cpp:137
void SendForceReactions()
Definition ReputationMgr.cpp:165
void StopAttackFaction(uint32 faction_id)
Definition Unit.cpp:15776

References ReputationMgr::ApplyForceReaction(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetMiscValue(), Player::GetReputationMgr(), Player::GetReputationRank(), AuraApplication::GetTarget(), Object::IsPlayer(), m_amount, REP_FRIENDLY, ReputationMgr::SendForceReactions(), Unit::StopAttackFaction(), and Object::ToPlayer().

◆ HandleModAttackSpeed()

void AuraEffect::HandleModAttackSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

◆ HandleModBaseResistance()

void AuraEffect::HandleModBaseResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

◆ HandleModCastingSpeed()

void AuraEffect::HandleModCastingSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4771{
4773 return;
4774
4775 Unit* target = aurApp->GetTarget();
4776
4777 // Xinef: Do not apply such auras in normal way
4778 if (GetAmount() >= 1000)
4779 {
4780 target->SetInstantCast(apply);
4781 return;
4782 }
4783
4784 int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, GetAuraType());
4785 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4786 return;
4787
4788 if (spellGroupVal)
4789 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
4790
4791 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
4792}
void SetInstantCast(bool set)
Definition Unit.h:1603
void ApplyCastTimePercentMod(float val, bool apply)
Definition Unit.cpp:13154

References Unit::ApplyCastTimePercentMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetAuraType(), Unit::GetHighestExclusiveSameEffectSpellGroupValue(), AuraApplication::GetTarget(), and Unit::SetInstantCast().

◆ HandleModCharm()

void AuraEffect::HandleModCharm ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3773{
3774 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3775 return;
3776
3777 Unit* target = aurApp->GetTarget();
3778
3779 Unit* caster = GetCaster();
3780
3781 if (apply)
3782 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3783 else
3784 target->RemoveCharmedBy(caster);
3785}
@ CHARM_TYPE_CHARM
Definition CharmInfo.h:45

References AURA_EFFECT_HANDLE_REAL, CHARM_TYPE_CHARM, GetCaster(), AuraApplication::GetTarget(), Unit::RemoveCharmedBy(), and Unit::SetCharmedBy().

Referenced by HandleModPossess().

◆ HandleModCombatSpeedPct()

void AuraEffect::HandleModCombatSpeedPct ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4807{
4809 return;
4810
4811 Unit* target = aurApp->GetTarget();
4813 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4814 return;
4815
4816 if (spellGroupVal)
4817 {
4818 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
4819 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4820 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4821 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
4822 }
4823
4824 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
4825 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4826 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4827 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
4828}
@ SPELL_AURA_MELEE_SLOW
Definition SpellAuraDefines.h:256

References Unit::ApplyAttackTimePercentMod(), Unit::ApplyCastTimePercentMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_ATTACK, GetAmount(), Unit::GetHighestExclusiveSameEffectSpellGroupValue(), AuraApplication::GetTarget(), OFF_ATTACK, RANGED_ATTACK, and SPELL_AURA_MELEE_SLOW.

◆ HandleModConfuse()

void AuraEffect::HandleModConfuse ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3636{
3637 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3638 return;
3639
3640 Unit* target = aurApp->GetTarget();
3641
3642 target->SetControlled(apply, UNIT_STATE_CONFUSED);
3643 if (apply)
3644 target->GetThreatMgr().EvaluateSuppressed();
3645}
@ UNIT_STATE_CONFUSED
Definition UnitDefines.h:184

References AURA_EFFECT_HANDLE_REAL, ThreatManager::EvaluateSuppressed(), AuraApplication::GetTarget(), Unit::GetThreatMgr(), Unit::SetControlled(), and UNIT_STATE_CONFUSED.

◆ HandleModDamageDone()

void AuraEffect::HandleModDamageDone ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5014{
5016 return;
5017
5018 Unit* target = aurApp->GetTarget();
5019
5021 target->UpdateAllDamageDoneMods();
5022
5023 // Magic damage modifiers implemented in Unit::SpellBaseDamageBonus
5024 // This information for client side use only
5025 if (target->IsPlayer())
5026 {
5028 for (uint16 i = 0; i < MAX_SPELL_SCHOOL; ++i)
5029 if (GetMiscValue() & (1 << i))
5030 target->ApplyModInt32Value(baseField + i, GetAmount(), apply);
5031
5032 if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
5033 pet->UpdateAttackPowerAndDamage();
5034 }
5035}
@ PLAYER_FIELD_MOD_DAMAGE_DONE_POS
Definition UpdateFields.h:360
@ PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
Definition UpdateFields.h:361
Definition TemporarySummon.h:106
void UpdateAllDamageDoneMods()
Definition Unit.cpp:11803

References Object::ApplyModInt32Value(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), Unit::GetGuardianPet(), GetMiscValue(), AuraApplication::GetTarget(), Object::IsPlayer(), MAX_SPELL_SCHOOL, PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, PLAYER_FIELD_MOD_DAMAGE_DONE_POS, SPELL_SCHOOL_MASK_NORMAL, Object::ToPlayer(), and Unit::UpdateAllDamageDoneMods().

◆ HandleModDamagePercentDone()

void AuraEffect::HandleModDamagePercentDone ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5038{
5040 return;
5041
5042 Unit* target = aurApp->GetTarget();
5043 if (!target)
5044 return;
5045
5048
5049 if (target->IsPlayer())
5050 {
5051 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
5052 {
5053 if (GetMiscValue() & (1 << i))
5054 {
5055 // only aura type modifying PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
5058 }
5059 }
5060 }
5061}
@ PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
Definition UpdateFields.h:362
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:735
void UpdateAllDamagePctDoneMods()
Definition Unit.cpp:11847

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetMiscValue(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplierByMiscMask(), Object::IsPlayer(), MAX_SPELL_SCHOOL, PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, Object::SetFloatValue(), SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_SCHOOL_MASK_NORMAL, and Unit::UpdateAllDamagePctDoneMods().

◆ HandleModDetaunt()

void AuraEffect::HandleModDetaunt ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3618{
3619 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3620 return;
3621
3622 Unit* caster = GetCaster();
3623 Unit* target = aurApp->GetTarget();
3624
3625 if (!caster || !caster->IsAlive() || !target->IsAlive() || !caster->CanHaveThreatList())
3626 return;
3627
3628 caster->GetThreatMgr().TauntUpdate();
3629}
void TauntUpdate()
Definition ThreatManager.cpp:534

References AURA_EFFECT_HANDLE_REAL, Unit::CanHaveThreatList(), GetCaster(), AuraApplication::GetTarget(), Unit::GetThreatMgr(), Unit::IsAlive(), and ThreatManager::TauntUpdate().

◆ HandleModFear()

void AuraEffect::HandleModFear ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3648{
3649 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3650 return;
3651
3652 Unit* target = aurApp->GetTarget();
3653
3654 target->SetControlled(apply, UNIT_STATE_FLEEING, GetCaster(), true);
3655}
@ UNIT_STATE_FLEEING
Definition UnitDefines.h:180

References AURA_EFFECT_HANDLE_REAL, GetCaster(), AuraApplication::GetTarget(), Unit::SetControlled(), and UNIT_STATE_FLEEING.

◆ HandleModHealingDone()

void AuraEffect::HandleModHealingDone ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4353{
4355 return;
4356
4357 Unit* target = aurApp->GetTarget();
4358
4359 if (!target->IsPlayer())
4360 return;
4361 // implemented in Unit::SpellHealingBonus
4362 // this information is for client side only
4364}
void UpdateSpellDamageAndHealingBonus()
Definition StatSystem.cpp:194

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::IsPlayer(), Object::ToPlayer(), and Player::UpdateSpellDamageAndHealingBonus().

◆ HandleModHitChance()

void AuraEffect::HandleModHitChance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4688{
4690 return;
4691
4692 Unit* target = aurApp->GetTarget();
4693
4694 if (target->IsPlayer())
4695 {
4696 target->ToPlayer()->UpdateMeleeHitChances();
4697 target->ToPlayer()->UpdateRangedHitChances();
4698 }
4699 else
4700 {
4701 target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
4702 target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
4703 }
4704}
void UpdateMeleeHitChances()
Definition StatSystem.cpp:871
void UpdateRangedHitChances()
Definition StatSystem.cpp:877
float m_modRangedHitChance
Definition Unit.h:2103
float m_modMeleeHitChance
Definition Unit.h:2102

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Object::IsPlayer(), Unit::m_modMeleeHitChance, Unit::m_modRangedHitChance, Object::ToPlayer(), Player::UpdateMeleeHitChances(), and Player::UpdateRangedHitChances().

◆ HandleModInvisibility()

void AuraEffect::HandleModInvisibility ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1697{
1699 return;
1700
1701 Unit* target = aurApp->GetTarget();
1703
1704 if (apply)
1705 {
1706 // apply glow vision
1707 if (target->IsPlayer() && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10))
1709
1710 target->m_invisibility.AddFlag(type);
1711 target->m_invisibility.AddValue(type, GetAmount());
1712 }
1713 else
1714 {
1715 if (!target->HasInvisibilityAura())
1716 {
1717 // if not have different invisibility auras.
1718 // always remove glow vision
1719 if (target->IsPlayer())
1721
1722 target->m_invisibility.DelFlag(type);
1723 }
1724 else
1725 {
1726 bool found = false;
1728 for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i)
1729 {
1730 if (GetMiscValue() == (*i)->GetMiscValue())
1731 {
1732 found = true;
1733 break;
1734 }
1735 }
1736 if (!found)
1737 {
1738 target->m_invisibility.DelFlag(type);
1739
1740 // if not have invisibility auras of type INVISIBILITY_GENERAL
1741 // remove glow vision
1743 {
1745 }
1746 }
1747 }
1748
1749 target->m_invisibility.AddValue(type, -GetAmount());
1750 }
1751
1752 // call functions which may have additional effects after chainging state of unit
1753 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1754 {
1755 // drop flag at invisibiliy in bg
1757 }
1758
1759 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1760 target->bRequestForcedVisibilityUpdate = false;
1761}
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition Player.h:554
@ PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION
Definition Player.h:531
InvisibilityType
Definition SharedDefines.h:1242
@ INVISIBILITY_UNK10
Definition SharedDefines.h:1253
@ INVISIBILITY_GENERAL
Definition SharedDefines.h:1243
@ SPELL_AURA_MOD_INVISIBILITY
Definition SpellAuraDefines.h:81
bool HasFlag(FLAG_TYPE flag) const
Definition Object.h:400
void AddFlag(FLAG_TYPE flag)
Definition Object.h:401
void DelFlag(FLAG_TYPE flag)
Definition Object.h:402
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:406
bool Instanceable() const
Definition Map.h:298
bool IsPlayer() const
Definition ObjectGuid.h:172
ObjectGuid GetOwnerGUID() const override
Definition Unit.h:719
bool bRequestForcedVisibilityUpdate
Definition Unit.h:2132
bool HasInvisibilityAura() const
Definition Unit.h:1862
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition Object.h:626

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddFlag(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddValue(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK, AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, Unit::bRequestForcedVisibilityUpdate, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::DelFlag(), GetAmount(), Unit::GetAuraEffectsByType(), WorldObject::GetMap(), GetMiscValue(), Unit::GetOwnerGUID(), AuraApplication::GetTarget(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::HasFlag(), Unit::HasInvisibilityAura(), Map::Instanceable(), INVISIBILITY_GENERAL, INVISIBILITY_UNK10, Object::IsPlayer(), ObjectGuid::IsPlayer(), WorldObject::m_invisibility, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW, PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, Unit::RemoveAurasWithInterruptFlags(), Object::RemoveByteFlag(), Object::SetByteFlag(), SPELL_AURA_MOD_INVISIBILITY, and Unit::UpdateObjectVisibility().

◆ HandleModInvisibilityDetect()

void AuraEffect::HandleModInvisibilityDetect ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1672{
1674 return;
1675
1676 Unit* target = aurApp->GetTarget();
1678
1679 if (apply)
1680 {
1681 target->m_invisibilityDetect.AddFlag(type);
1682 target->m_invisibilityDetect.AddValue(type, GetAmount());
1683 }
1684 else
1685 {
1686 if (!target->HasInvisibilityDetectAura())
1687 target->m_invisibilityDetect.DelFlag(type);
1688
1689 target->m_invisibilityDetect.AddValue(type, -GetAmount());
1690 }
1691
1692 // call functions which may have additional effects after chainging state of unit
1693 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1694}
bool HasInvisibilityDetectAura() const
Definition Unit.h:1863
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition Object.h:627

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddFlag(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddValue(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::DelFlag(), GetAmount(), GetMiscValue(), Unit::GetOwnerGUID(), AuraApplication::GetTarget(), Unit::HasInvisibilityDetectAura(), Object::IsPlayer(), ObjectGuid::IsPlayer(), WorldObject::m_invisibilityDetect, and Unit::UpdateObjectVisibility().

◆ HandleModManaRegen()

void AuraEffect::HandleModManaRegen ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4471{
4473 return;
4474
4475 Unit* target = aurApp->GetTarget();
4476
4477 if (!target->IsPlayer())
4478 return;
4479
4480 //Note: an increase in regen does NOT cause threat.
4481 target->ToPlayer()->UpdateManaRegen();
4482}
void UpdateManaRegen()
Definition StatSystem.cpp:939

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::IsPlayer(), Object::ToPlayer(), and Player::UpdateManaRegen().

Referenced by HandleAuraModRegenInterrupt().

◆ HandleModMechanicImmunity()

void AuraEffect::HandleModMechanicImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

◆ HandleModMeleeRangedSpeedPct()

void AuraEffect::HandleModMeleeRangedSpeedPct ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

◆ HandleModMeleeSpeedPct()

void AuraEffect::HandleModMeleeSpeedPct ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4842{
4844 return;
4845
4846 Unit* target = aurApp->GetTarget();
4848 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4849 return;
4850
4851 if (spellGroupVal)
4852 {
4853 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4854 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4855 }
4856 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4857 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4858}
@ SPELL_AURA_MOD_MELEE_HASTE
Definition SpellAuraDefines.h:201

References Unit::ApplyAttackTimePercentMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_ATTACK, GetAmount(), Unit::GetHighestExclusiveSameEffectSpellGroupValue(), AuraApplication::GetTarget(), OFF_ATTACK, and SPELL_AURA_MOD_MELEE_HASTE.

◆ HandleModOffhandDamagePercent()

void AuraEffect::HandleModOffhandDamagePercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5064{
5066 return;
5067
5068 Unit* target = aurApp->GetTarget();
5069
5070 // also handles spell group stacks
5072}
void UpdateDamagePctDoneMods(WeaponAttackType attackType)
Definition Unit.cpp:11809

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), OFF_ATTACK, and Unit::UpdateDamagePctDoneMods().

◆ HandleModPercentStat()

void AuraEffect::HandleModPercentStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4258{
4260 return;
4261
4262 Unit* target = aurApp->GetTarget();
4263
4264 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4265 {
4266 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4267 return;
4268 }
4269
4270 // only players currently use base stats
4271 if (!target->IsPlayer())
4272 return;
4273
4274 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
4275 {
4276 if (GetMiscValue() == i || GetMiscValue() == -1)
4277 {
4278 if (apply)
4280 else
4281 {
4282 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_PERCENT_STAT, [i](AuraEffect const* aurEff)
4283 {
4284 return (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1);
4285 });
4287 }
4288 }
4289 }
4290}
@ SPELL_AURA_MOD_PERCENT_STAT
Definition SpellAuraDefines.h:143

References Unit::ApplyStatPctModifier(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_PCT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplier(), Object::IsPlayer(), LOG_ERROR, MAX_STATS, Unit::SetStatPctModifier(), SPELL_AURA_MOD_PERCENT_STAT, STAT_STRENGTH, and UNIT_MOD_STAT_START.

◆ HandleModPossess()

void AuraEffect::HandleModPossess ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3698{
3699 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3700 return;
3701
3702 Unit* target = aurApp->GetTarget();
3703
3704 Unit* caster = GetCaster();
3705
3706 // no support for posession AI yet
3707 if (caster && caster->IsCreature())
3708 {
3709 HandleModCharm(aurApp, mode, apply);
3710 return;
3711 }
3712
3713 if (apply)
3714 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3715 else
3716 target->RemoveCharmedBy(caster);
3717}
@ CHARM_TYPE_POSSESS
Definition CharmInfo.h:46
void HandleModCharm(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3772

References AURA_EFFECT_HANDLE_REAL, CHARM_TYPE_POSSESS, GetCaster(), AuraApplication::GetTarget(), HandleModCharm(), Object::IsCreature(), Unit::RemoveCharmedBy(), and Unit::SetCharmedBy().

◆ HandleModPossessPet()

void AuraEffect::HandleModPossessPet ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3720{
3721 // Used by spell "Eyes of the Beast"
3722
3723 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3724 return;
3725
3726 Unit* caster = GetCaster();
3727 if (!caster || !caster->IsPlayer())
3728 return;
3729
3730 //seems it may happen that when removing it is no longer owner's pet
3731 //if (caster->ToPlayer()->GetPet() != target)
3732 // return;
3733
3734 Unit* target = aurApp->GetTarget();
3735 if (!target->IsCreature() || !target->IsPet())
3736 return;
3737
3738 Pet* pet = target->ToPet();
3739
3740 if (apply)
3741 {
3742 if (caster->ToPlayer()->GetPet() != pet)
3743 return;
3744
3745 // Must clear current motion or pet leashes back to owner after a few yards
3746 // when under spell 'Eyes of the Beast'
3747 pet->GetMotionMaster()->Clear();
3748 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3749 }
3750 else
3751 {
3752 pet->RemoveCharmedBy(caster);
3753
3754 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
3755 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
3756 else
3757 {
3758 // Reinitialize the pet bar or it will appear greyed out
3759 caster->ToPlayer()->PetSpellInitialize();
3760
3761 // Follow owner only if not fighting or owner didn't click "stay" at new location
3762 // This may be confusing because pet bar shows "stay" when under the spell but it retains
3763 // the "follow" flag. Player MUST click "stay" while under the spell.
3764 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3765 {
3767 }
3768 }
3769 }
3770}
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:46
constexpr float PET_FOLLOW_DIST
Definition PetDefines.h:206
@ COMMAND_STAY
Definition Unit.h:581
float GetFollowAngle() const override
Definition TemporarySummon.h:93
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE, bool inheritWalkState=true, bool inheritSpeed=true)
The unit will follow this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:448
void Clear(bool reset=true)
Definition MotionMaster.h:194
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition Pet.cpp:904
void PetSpellInitialize()
Definition Player.cpp:9761
Pet * ToPet()
Definition Unit.h:735
CharmInfo * GetCharmInfo()
Definition Unit.h:1298
Unit * GetVictim() const
Definition Unit.h:910
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1386
bool HasCommandState(CommandStates state) const
Definition CharmInfo.h:137

References AURA_EFFECT_HANDLE_REAL, CHARM_TYPE_POSSESS, MotionMaster::Clear(), COMMAND_STAY, GetCaster(), Unit::GetCharmInfo(), Minion::GetFollowAngle(), WorldObject::GetMap(), Unit::GetMotionMaster(), Player::GetPet(), AuraApplication::GetTarget(), Unit::GetVictim(), Map::GetVisibilityRange(), CharmInfo::HasCommandState(), Object::IsCreature(), Unit::IsPet(), Object::IsPlayer(), WorldObject::IsWithinDistInMap(), MotionMaster::MoveFollow(), PET_FOLLOW_DIST, PET_SAVE_NOT_IN_SLOT, Player::PetSpellInitialize(), Pet::Remove(), Unit::RemoveCharmedBy(), Unit::SetCharmedBy(), Unit::ToPet(), and Object::ToPlayer().

◆ HandleModPowerCost()

void AuraEffect::HandleModPowerCost ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5122{
5124 return;
5125
5126 Unit* target = aurApp->GetTarget();
5127
5128 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5129 if (GetMiscValue() & (1 << i))
5131}
@ UNIT_FIELD_POWER_COST_MODIFIER
Definition UpdateFields.h:170

References Object::ApplyModInt32Value(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), MAX_SPELL_SCHOOL, and UNIT_FIELD_POWER_COST_MODIFIER.

◆ HandleModPowerCostPCT()

void AuraEffect::HandleModPowerCostPCT ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5109{
5111 return;
5112
5113 Unit* target = aurApp->GetTarget();
5114
5115 float amount = CalculatePct(1.0f, GetAmount());
5116 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5117 if (GetMiscValue() & (1 << i))
5119}
@ UNIT_FIELD_POWER_COST_MULTIPLIER
Definition UpdateFields.h:171
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
Definition Object.cpp:820

References Object::ApplyModSignedFloatValue(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, CalculatePct(), GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), MAX_SPELL_SCHOOL, and UNIT_FIELD_POWER_COST_MULTIPLIER.

◆ HandleModPowerRegen()

void AuraEffect::HandleModPowerRegen ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4446{
4448 return;
4449
4450 Unit* target = aurApp->GetTarget();
4451
4452 if (!target->IsPlayer())
4453 return;
4454
4455 // Update manaregen value
4456 if (GetMiscValue() == POWER_MANA)
4457 target->ToPlayer()->UpdateManaRegen();
4458 else if (GetMiscValue() == POWER_ENERGY)
4459 target->ToPlayer()->UpdateEnergyRegen();
4460 else if (GetMiscValue() == POWER_RUNE)
4462 // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
4463}
@ POWER_RUNE
Definition SharedDefines.h:262
void UpdateRuneRegen(RuneType rune)
Definition StatSystem.cpp:983
void UpdateEnergyRegen()
Definition StatSystem.cpp:973

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetMiscValue(), GetMiscValueB(), AuraApplication::GetTarget(), Object::IsPlayer(), POWER_ENERGY, POWER_MANA, POWER_RUNE, Object::ToPlayer(), Player::UpdateEnergyRegen(), Player::UpdateManaRegen(), and Player::UpdateRuneRegen().

Referenced by HandleModPowerRegenPCT().

◆ HandleModPowerRegenPCT()

void AuraEffect::HandleModPowerRegenPCT ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4466{
4467 HandleModPowerRegen(aurApp, mode, apply);
4468}
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4445

References HandleModPowerRegen().

◆ HandleModRating()

void AuraEffect::HandleModRating ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4888{
4890 return;
4891
4892 Unit* target = aurApp->GetTarget();
4893
4894 if (!target->IsPlayer())
4895 return;
4896
4897 for (uint8 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4898 if (GetMiscValue() & (1 << rating))
4899 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
4900}
#define MAX_COMBAT_RATING
Definition Unit.h:258
CombatRating
Definition Unit.h:230
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition Player.cpp:5435

References Player::ApplyRatingMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Object::IsPlayer(), MAX_COMBAT_RATING, and Object::ToPlayer().

◆ HandleModRatingFromStat()

void AuraEffect::HandleModRatingFromStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4903{
4905 return;
4906
4907 Unit* target = aurApp->GetTarget();
4908
4909 if (!target->IsPlayer())
4910 return;
4911
4912 // Just recalculate ratings
4913 for (uint8 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4914 if (GetMiscValue() & (1 << rating))
4915 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
4916}

References Player::ApplyRatingMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetMiscValue(), AuraApplication::GetTarget(), Object::IsPlayer(), MAX_COMBAT_RATING, and Object::ToPlayer().

◆ HandleModResistancePercent()

void AuraEffect::HandleModResistancePercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4167{
4169 return;
4170
4171 Unit* target = aurApp->GetTarget();
4172
4173 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
4174 {
4175 if (GetMiscValue() & int32(1 << i))
4176 {
4179 continue;
4180
4182 if (target->IsPlayer() || target->IsPet())
4184 }
4185 }
4186}
@ SPELL_AURA_MOD_RESISTANCE_PCT
Definition SpellAuraDefines.h:164
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:11699

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetMiscValue(), Unit::GetPctModifierValue(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplierByMiscMask(), Unit::IsPet(), Object::IsPlayer(), MAX_SPELL_SCHOOL, Unit::SetStatPctModifier(), SPELL_AURA_MOD_RESISTANCE_PCT, SPELL_SCHOOL_NORMAL, TOTAL_PCT, UNIT_MOD_RESISTANCE_START, and Unit::UpdateResistanceBuffModsMod().

◆ HandleModSpellCritChance()

void AuraEffect::HandleModSpellCritChance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

◆ HandleModSpellCritChanceShool()

void AuraEffect::HandleModSpellCritChanceShool ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4733{
4735 return;
4736
4737 Unit* target = aurApp->GetTarget();
4738
4739 if (!target->IsPlayer())
4740 return;
4741
4742 for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
4743 if (GetMiscValue() & (1 << school))
4744 target->ToPlayer()->UpdateSpellCritChance(school);
4745}
void UpdateSpellCritChance(uint32 school)
Definition StatSystem.cpp:840

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetMiscValue(), AuraApplication::GetTarget(), Object::IsPlayer(), MAX_SPELL_SCHOOL, SPELL_SCHOOL_NORMAL, Object::ToPlayer(), and Player::UpdateSpellCritChance().

◆ HandleModSpellDamagePercentFromAttackPower()

void AuraEffect::HandleModSpellDamagePercentFromAttackPower ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4323{
4325 return;
4326
4327 Unit* target = aurApp->GetTarget();
4328
4329 if (!target->IsPlayer())
4330 return;
4331
4332 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4333 // This information for client side use only
4334 // Recalculate bonus
4336}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::IsPlayer(), Object::ToPlayer(), and Player::UpdateSpellDamageAndHealingBonus().

◆ HandleModSpellDamagePercentFromStat()

void AuraEffect::HandleModSpellDamagePercentFromStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4293{
4295 return;
4296
4297 Unit* target = aurApp->GetTarget();
4298
4299 if (!target->IsPlayer())
4300 return;
4301
4302 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4303 // This information for client side use only
4304 // Recalculate bonus
4306}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::IsPlayer(), Object::ToPlayer(), and Player::UpdateSpellDamageAndHealingBonus().

◆ HandleModSpellHealingPercentFromAttackPower()

void AuraEffect::HandleModSpellHealingPercentFromAttackPower ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4339{
4341 return;
4342
4343 Unit* target = aurApp->GetTarget();
4344
4345 if (!target->IsPlayer())
4346 return;
4347
4348 // Recalculate bonus
4350}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::IsPlayer(), Object::ToPlayer(), and Player::UpdateSpellDamageAndHealingBonus().

◆ HandleModSpellHealingPercentFromStat()

void AuraEffect::HandleModSpellHealingPercentFromStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4309{
4311 return;
4312
4313 Unit* target = aurApp->GetTarget();
4314
4315 if (!target->IsPlayer())
4316 return;
4317
4318 // Recalculate bonus
4320}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::IsPlayer(), Object::ToPlayer(), and Player::UpdateSpellDamageAndHealingBonus().

◆ HandleModSpellHitChance()

void AuraEffect::HandleModSpellHitChance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4707{
4709 return;
4710
4711 Unit* target = aurApp->GetTarget();
4712
4713 if (target->IsPlayer())
4714 target->ToPlayer()->UpdateSpellHitChances();
4715 else
4716 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
4717}
void UpdateSpellHitChances()
Definition StatSystem.cpp:883
float m_modSpellHitChance
Definition Unit.h:2104

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Object::IsPlayer(), Unit::m_modSpellHitChance, Object::ToPlayer(), and Player::UpdateSpellHitChances().

◆ HandleModStateImmunityMask()

void AuraEffect::HandleModStateImmunityMask ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const

◆ HandleModStealth()

void AuraEffect::HandleModStealth ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1789{
1791 return;
1792
1793 Unit* target = aurApp->GetTarget();
1795
1796 if (apply)
1797 {
1798 target->m_stealth.AddFlag(type);
1799 target->m_stealth.AddValue(type, GetAmount());
1800
1802 if (target->IsPlayer())
1804
1805 // interrupt autoshot
1807 {
1809 target->ToPlayer()->SendAutoRepeatCancel(target);
1810 }
1811 }
1812 else
1813 {
1814 target->m_stealth.AddValue(type, -GetAmount());
1815
1816 if (!target->HasStealthAura()) // if last SPELL_AURA_MOD_STEALTH
1817 {
1818 target->m_stealth.DelFlag(type);
1819
1821 if (target->IsPlayer())
1823 }
1824 }
1825
1826 // call functions which may have additional effects after chainging state of unit
1827 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1828 {
1829 // drop flag at stealth in bg
1831 }
1832
1833 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1834 target->bRequestForcedVisibilityUpdate = false;
1835}
@ PLAYER_FIELD_BYTE2_STEALTH
Definition Player.h:553
StealthType
Definition SharedDefines.h:1234
@ UNIT_STAND_FLAGS_CREEP
Definition UnitDefines.h:51
bool HasStealthAura() const
Definition Unit.h:1860
void RemoveStandFlags(uint8 flags)
Definition Unit.h:1803
void SetStandFlags(uint8 flags)
Definition Unit.h:1802
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition Object.h:623

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddFlag(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddValue(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK, AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, Unit::bRequestForcedVisibilityUpdate, CURRENT_AUTOREPEAT_SPELL, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::DelFlag(), Unit::FinishSpell(), GetAmount(), Unit::GetCurrentSpell(), WorldObject::GetMap(), GetMiscValue(), Unit::GetOwnerGUID(), AuraApplication::GetTarget(), Unit::HasStealthAura(), Map::Instanceable(), Object::IsPlayer(), ObjectGuid::IsPlayer(), WorldObject::m_stealth, PLAYER_FIELD_BYTE2_STEALTH, PLAYER_FIELD_BYTES2, Unit::RemoveAurasWithInterruptFlags(), Object::RemoveByteFlag(), Unit::RemoveStandFlags(), Player::SendAutoRepeatCancel(), Object::SetByteFlag(), Unit::SetStandFlags(), Object::ToPlayer(), UNIT_STAND_FLAGS_CREEP, and Unit::UpdateObjectVisibility().

◆ HandleModStealthDetect()

void AuraEffect::HandleModStealthDetect ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1764{
1766 return;
1767
1768 Unit* target = aurApp->GetTarget();
1770
1771 if (apply)
1772 {
1773 target->m_stealthDetect.AddFlag(type);
1774 target->m_stealthDetect.AddValue(type, GetAmount());
1775 }
1776 else
1777 {
1778 if (!target->HasStealthDetectAura())
1779 target->m_stealthDetect.DelFlag(type);
1780
1781 target->m_stealthDetect.AddValue(type, -GetAmount());
1782 }
1783
1784 // call functions which may have additional effects after chainging state of unit
1785 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1786}
bool HasStealthDetectAura() const
Definition Unit.h:1861
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition Object.h:624

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddFlag(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddValue(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::DelFlag(), GetAmount(), GetMiscValue(), Unit::GetOwnerGUID(), AuraApplication::GetTarget(), Unit::HasStealthDetectAura(), Object::IsPlayer(), ObjectGuid::IsPlayer(), WorldObject::m_stealthDetect, and Unit::UpdateObjectVisibility().

◆ HandleModStealthLevel()

void AuraEffect::HandleModStealthLevel ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1838{
1840 return;
1841
1842 Unit* target = aurApp->GetTarget();
1844
1845 if (apply)
1846 target->m_stealth.AddValue(type, GetAmount());
1847 else
1848 target->m_stealth.AddValue(type, -GetAmount());
1849
1850 // call functions which may have additional effects after chainging state of unit
1851 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1852}

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddValue(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetAmount(), GetMiscValue(), Unit::GetOwnerGUID(), AuraApplication::GetTarget(), Object::IsPlayer(), ObjectGuid::IsPlayer(), WorldObject::m_stealth, and Unit::UpdateObjectVisibility().

◆ HandleModTargetResistance()

void AuraEffect::HandleModTargetResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4204{
4206 return;
4207
4208 Unit* target = aurApp->GetTarget();
4209
4210 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
4211
4212 // show armor penetration
4213 if (target->IsPlayer() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
4215
4216 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
4219}
@ SPELL_SCHOOL_MASK_SPELL
Definition SharedDefines.h:296
@ PLAYER_FIELD_MOD_TARGET_RESISTANCE
Definition UpdateFields.h:366
@ PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
Definition UpdateFields.h:367

References Object::ApplyModInt32Value(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Object::IsPlayer(), PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE, PLAYER_FIELD_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL, and SPELL_SCHOOL_MASK_SPELL.

◆ HandleModTaunt()

void AuraEffect::HandleModTaunt ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3605{
3606 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3607 return;
3608
3609 Unit* target = aurApp->GetTarget();
3610
3611 if (!target->IsAlive() || !target->CanHaveThreatList())
3612 return;
3613
3614 target->GetThreatMgr().TauntUpdate();
3615}

References AURA_EFFECT_HANDLE_REAL, Unit::CanHaveThreatList(), AuraApplication::GetTarget(), Unit::GetThreatMgr(), Unit::IsAlive(), and ThreatManager::TauntUpdate().

◆ HandleModThreat()

void AuraEffect::HandleModThreat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3581{
3583 return;
3584
3585 Unit* target = aurApp->GetTarget();
3587}
void UpdateMySpellSchoolModifiers()
Definition ThreatManager.cpp:836

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AuraApplication::GetTarget(), Unit::GetThreatMgr(), and ThreatManager::UpdateMySpellSchoolModifiers().

◆ HandleModTotalPercentStat()

void AuraEffect::HandleModTotalPercentStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4367{
4369 return;
4370
4371 Unit* target = aurApp->GetTarget();
4372
4373 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4374 {
4375 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4376 return;
4377 }
4378
4379 // save current health state
4380 float healthPct = target->GetHealthPct();
4381 bool alive = target->IsAlive();
4382
4383 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4384 {
4385 if (GetMiscValue() == i || GetMiscValue() == -1)
4386 {
4387 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, [i](AuraEffect const* aurEff)
4388 {
4389 return (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1);
4390 });
4391
4392 if (target->GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT) == amount)
4393 continue;
4394
4396 if (target->IsPlayer() || target->IsPet())
4397 target->UpdateStatBuffMod(Stats(i));
4398 }
4399 }
4400
4401 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_UNK4 0x00000010 flag)
4403 target->SetHealth(std::max<uint32>(uint32(healthPct * target->GetMaxHealth() * 0.01f), (alive ? 1 : 0)));
4404}
@ SPELL_ATTR0_IS_ABILITY
Definition SharedDefines.h:374
@ STAT_STAMINA
Definition SharedDefines.h:248
@ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
Definition SpellAuraDefines.h:200

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, Unit::GetHealthPct(), Unit::GetMaxHealth(), GetMiscValue(), Unit::GetPctModifierValue(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplier(), SpellInfo::HasAttribute(), Unit::IsAlive(), Unit::IsPet(), Object::IsPlayer(), LOG_ERROR, m_spellInfo, MAX_STATS, Unit::SetHealth(), Unit::SetStatPctModifier(), SPELL_ATTR0_IS_ABILITY, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, STAT_STAMINA, STAT_STRENGTH, TOTAL_PCT, UNIT_MOD_STAT_START, and Unit::UpdateStatBuffMod().

◆ HandleModUnattackable()

void AuraEffect::HandleModUnattackable ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3077{
3079 return;
3080
3081 Unit* target = aurApp->GetTarget();
3082
3083 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3084 if (!apply && target->HasUnattackableAura())
3085 return;
3086
3088
3089 // call functions which may have additional effects after chainging state of unit
3090 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
3091 {
3092 // xinef: this aura should not stop combat (movie with sindragosa proves that)
3093 //target->CombatStop();
3095 }
3096}
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:258
bool HasUnattackableAura() const
Definition Unit.h:1852

References Object::ApplyModFlag(), AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, AuraApplication::GetTarget(), Unit::HasUnattackableAura(), Unit::RemoveAurasWithInterruptFlags(), UNIT_FIELD_FLAGS, and UNIT_FLAG_NON_ATTACKABLE.

◆ HandleNoImmediateEffect()

void AuraEffect::HandleNoImmediateEffect ( AuraApplication const *  ,
uint8  ,
bool   
) const
inline
163 {
164 // aura type not have immediate effect at add/remove and handled by ID in other code place
165 }

◆ HandleNoReagentUseAura()

void AuraEffect::HandleNoReagentUseAura ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5152{
5153 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5154 return;
5155
5156 Unit* target = aurApp->GetTarget();
5157
5158 if (!target->IsPlayer())
5159 return;
5160
5161 flag96 mask;
5163 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
5164 mask |= (*i)->m_spellInfo->Effects[(*i)->m_effIndex].SpellClassMask;
5165
5166 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1, mask[0]);
5167 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 1, mask[1]);
5168 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2, mask[2]);
5169}
@ SPELL_AURA_NO_REAGENT_USE
Definition SpellAuraDefines.h:319
@ PLAYER_NO_REAGENT_COST_1
Definition UpdateFields.h:387
Definition Util.h:442

References AURA_EFFECT_HANDLE_REAL, Unit::GetAuraEffectsByType(), AuraApplication::GetTarget(), Object::IsPlayer(), PLAYER_NO_REAGENT_COST_1, Unit::SetUInt32Value(), and SPELL_AURA_NO_REAGENT_USE.

◆ HandleNULL()

void AuraEffect::HandleNULL ( AuraApplication const *  ,
uint8  ,
bool   
) const
inline
155 {
156 // not implemented
157 }

◆ HandleObsModPowerAuraTick()

void AuraEffect::HandleObsModPowerAuraTick ( Unit *  target,
Unit *  caster 
) const
6811{
6813 if (GetMiscValue() == POWER_ALL)
6814 PowerType = target->getPowerType();
6815 else
6817
6818 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
6819 return;
6820
6821 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6822 {
6823 SendTickImmune(target, caster);
6824 return;
6825 }
6826
6827 // don't regen when permanent aura target has full power
6828 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
6829 return;
6830
6831 // ignore negative values (can be result apply spellmods to aura damage
6832 uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(PowerType) / 100;
6833 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
6834 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
6835 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
6836 target->SendPeriodicAuraLog(&pInfo);
6837
6838 int32 gain = target->ModifyPower(PowerType, amount);
6839
6840 if (caster)
6841 target->GetThreatMgr().ForwardThreatForAssistingMe(caster, float(gain) * 0.5f, GetSpellInfo(), true);
6842}
@ POWER_ALL
Definition SharedDefines.h:265
void SendTickImmune(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:1110
std::string ToString() const
Definition ObjectGuid.cpp:49
void ForwardThreatForAssistingMe(Unit *assistant, float baseAmount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false)
== AFFECT OTHERS' THREAT LISTS ==
Definition ThreatManager.cpp:772
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:10842
bool IsImmunedToAuraPeriodicTick(Unit const *caster, SpellInfo const *spellInfo) const
Definition Unit.cpp:9777
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1150
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition Unit.cpp:6624
std::string ToString(Type &&val, Params &&... params)
Definition StringConvert.h:250
Definition Unit.h:539

References ThreatManager::ForwardThreatForAssistingMe(), GetBase(), GetCasterGUID(), Object::GetGUID(), GetId(), Unit::GetMaxPower(), GetMiscValue(), Unit::GetPower(), Unit::getPowerType(), GetSpellInfo(), Unit::GetThreatMgr(), Unit::IsAlive(), Unit::IsImmunedToAuraPeriodicTick(), LOG_DEBUG, m_amount, Unit::ModifyPower(), POWER_ALL, Unit::SendPeriodicAuraLog(), SendTickImmune(), and ObjectGuid::ToString().

Referenced by PeriodicTick().

◆ HandlePeriodicDamageAurasTick()

void AuraEffect::HandlePeriodicDamageAurasTick ( Unit *  target,
Unit *  caster 
) const
6308{
6309 if (!target->IsAlive())
6310 return;
6311
6312 if (target->IsImmunedToDamage(caster, GetSpellInfo()) || target->IsTotem())
6313 {
6314 SendTickImmune(target, caster);
6315 return;
6316 }
6317
6318 // Consecrate ticks can miss and will not show up in the combat log
6319 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6320 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6321 return;
6322
6323 // some auras remove at specific health level or more
6325 {
6326 switch (GetSpellInfo()->Id)
6327 {
6328 case 43093:
6329 case 31956:
6330 case 38801: // Grievous Wound
6331 case 35321:
6332 case 38363:
6333 case 39215: // Gushing Wound
6334 if (target->IsFullHealth())
6335 {
6336 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6337 return;
6338 }
6339 break;
6340 case 38772: // Grievous Wound
6341 {
6342 uint32 percent = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster);
6343 if (!target->HealthBelowPct(percent))
6344 {
6345 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6346 return;
6347 }
6348 break;
6349 }
6350 }
6351 }
6352
6354
6355 // ignore non positive values (can be result apply spellmods to aura damage
6356 uint32 damage = std::max(GetAmount(), 0);
6357
6358 // If the damage is percent-max-health based, calculate damage before the Modify hook
6360 {
6361 // xinef: ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
6362 damage = uint32(std::ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
6363 }
6364
6365 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6366 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6367
6368 if (target->GetAI())
6369 {
6370 target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
6371 }
6372
6374 {
6375 // xinef: leave only target depending bonuses, rest is handled in calculate amount
6376 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE && caster)
6377 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6378 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6379
6380 // Calculate armor mitigation
6382 {
6383 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6384 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6385 damage = damageReductedArmor;
6386 }
6387
6388 }
6389
6390 // calculate crit chance
6391 bool crit = false;
6392 if ((crit = roll_chance_f(GetCritChance())))
6393 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6394
6395 // Auras reducing damage from AOE spells
6397 {
6398 if (GetSpellInfo()->Effects[GetEffIndex()].IsAreaAuraEffect() ||
6399 GetSpellInfo()->Effects[GetEffIndex()].IsTargetingArea() ||
6400 GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA || // some persistent area auras have targets like A=53 B=28
6403 {
6404 bool npcCaster = (caster && !caster->IsControlledByPlayer()) || GetSpellInfo()->HasAttribute(SPELL_ATTR7_TREAT_AS_NPC_AOE);
6405 damage = target->CalculateAOEDamageReduction(damage, GetSpellInfo()->SchoolMask, npcCaster);
6406 }
6407 }
6408
6409 int32 dmg = damage;
6410 int32 mitigatedDamage = cleanDamage.mitigated_damage;
6411 if (CanApplyResilience())
6412 {
6413 int32 resilienceReduction = dmg;
6414 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6415
6416 resilienceReduction = dmg - resilienceReduction;
6417 dmg -= resilienceReduction;
6418 mitigatedDamage += resilienceReduction;
6419 }
6420
6421 damage = std::max(0, dmg);
6422 cleanDamage.mitigated_damage = std::max(0, mitigatedDamage);
6423
6424 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6425 Unit::CalcAbsorbResist(dmgInfo, false, GetCasterLevel());
6426
6427 uint32 absorb = dmgInfo.GetAbsorb();
6428 uint32 resist = dmgInfo.GetResist();
6429 damage = dmgInfo.GetDamage();
6430
6431 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} attacked {} for {} dmg inflicted by {} abs is {}",
6432 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6433 Unit::DealDamageMods(target, damage, &absorb);
6434
6435 // Set trigger flag
6436 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6437 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6439 if (damage)
6440 procEx |= crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT;
6441 if (absorb > 0)
6442 procEx |= PROC_EX_ABSORB;
6443
6444 if (damage)
6445 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6446
6447 int32 overkill = damage - target->GetHealth();
6448 if (overkill < 0)
6449 overkill = 0;
6450
6451 SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
6452 target->SendPeriodicAuraLog(&pInfo);
6453
6454 Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
6455
6456 Unit::ProcSkillsAndAuras(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6457}
bool roll_chance_f(float chance)
Definition Random.h:57
@ EFFECT_1
Definition SharedDefines.h:32
@ SPELL_ATTR7_TREAT_AS_NPC_AOE
Definition SharedDefines.h:655
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
Definition SharedDefines.h:793
@ SPELL_ATTR5_TREAT_AS_AREA_EFFECT
Definition SharedDefines.h:570
@ SPELL_MISS_NONE
Definition SharedDefines.h:1523
@ SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS
Definition SharedDefines.h:526
@ DYNOBJ_AURA_TYPE
Definition SpellAuraDefines.h:386
@ PROC_EX_INTERNAL_DOT
Definition SpellMgr.h:224
@ PROC_EX_CRITICAL_HIT
Definition SpellMgr.h:200
@ PROC_EX_NORMAL_HIT
Definition SpellMgr.h:199
@ PROC_EX_ABSORB
Definition SpellMgr.h:209
@ PROC_FLAG_DONE_PERIODIC
Definition SpellMgr.h:137
@ PROC_FLAG_TAKEN_PERIODIC
Definition SpellMgr.h:138
@ PROC_FLAG_TAKEN_DAMAGE
Definition SpellMgr.h:140
@ CR_CRIT_TAKEN_SPELL
Definition Unit.h:247
@ MELEE_HIT_NORMAL
Definition Unit.h:300
bool CanApplyResilience() const
Definition SpellAuraEffects.h:112
float GetCritChance() const
Definition SpellAuraEffects.h:109
uint8 GetCasterLevel() const
Definition SpellAuraEffects.h:111
uint32 SchoolMask
Definition SpellInfo.h:416
virtual void OnCalculatePeriodicTickReceived(uint32 &, Unit *)
Called during calculation when receiving periodic healing or damage (DoT or HoT)
Definition UnitAI.h:392
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr, bool skipCombat=false)
Definition Unit.cpp:990
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
Definition Unit.cpp:2233
int32 CalculateAOEDamageReduction(int32 damage, uint32 schoolMask, bool npcCaster) const
Definition Unit.cpp:16024
bool IsFullHealth() const
Definition Unit.h:1128
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:9201
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1130
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:8711
bool IsImmunedToDamage(SpellSchoolMask schoolMask) const
Definition Unit.cpp:9694
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition Unit.cpp:14883
static void ProcSkillsAndAuras(Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition Unit.cpp:6590
UnitAI * GetAI()
Definition Unit.h:699
bool IsControlledByPlayer() const
Definition Unit.h:1324
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition Unit.cpp:2210
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:980
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false, uint8 casterLevel=0)
Definition Unit.cpp:2344
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spellInfo, bool canReflect=false)
Definition Object.cpp:3689
Definition Unit.h:329
uint32 mitigated_damage
Definition Unit.h:334

References Unit::ApplyResilience(), BASE_ATTACK, Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), Unit::CalculateAOEDamageReduction(), CanApplyResilience(), CR_CRIT_TAKEN_SPELL, Unit::DealDamage(), Unit::DealDamageMods(), DOT, DYNOBJ_AURA_TYPE, EFFECT_1, SpellInfo::Effects, DamageInfo::GetAbsorb(), Unit::GetAI(), GetAmount(), GetAuraType(), GetBase(), GetCasterGUID(), GetCasterLevel(), GetCritChance(), DamageInfo::GetDamage(), GetEffIndex(), Object::GetGUID(), Unit::GetHealth(), GetId(), Unit::GetMaxHealth(), DamageInfo::GetResist(), GetSpellInfo(), SpellInfo::HasAttribute(), Unit::HealthBelowPct(), Unit::IsAlive(), Unit::IsControlledByPlayer(), Unit::IsDamageReducedByArmor(), Unit::IsFullHealth(), Unit::IsImmunedToDamage(), Unit::IsTotem(), LOG_DEBUG, m_spellInfo, MELEE_HIT_NORMAL, CleanDamage::mitigated_damage, UnitAI::OnCalculatePeriodicTickReceived(), PROC_EX_ABSORB, PROC_EX_CRITICAL_HIT, PROC_EX_INTERNAL_DOT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_PERIODIC, PROC_FLAG_TAKEN_DAMAGE, PROC_FLAG_TAKEN_PERIODIC, Unit::ProcSkillsAndAuras(), Unit::RemoveAurasDueToSpell(), roll_chance_f(), SpellInfo::SchoolMask, Unit::SendPeriodicAuraLog(), SendTickImmune(), SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS, SPELL_ATTR5_TREAT_AS_AREA_EFFECT, SPELL_ATTR7_TREAT_AS_NPC_AOE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_EFFECT_PERSISTENT_AREA_AURA, SPELL_MISS_NONE, Unit::SpellCriticalDamageBonus(), Unit::SpellDamageBonusDone(), Unit::SpellDamageBonusTaken(), WorldObject::SpellHitResult(), sScriptMgr, and ObjectGuid::ToString().

Referenced by PeriodicTick().

◆ HandlePeriodicDummyAuraTick()

void AuraEffect::HandlePeriodicDummyAuraTick ( Unit *  target,
Unit *  caster 
) const
5976{
5977 switch (GetSpellInfo()->SpellFamilyName)
5978 {
5979 case SPELLFAMILY_HUNTER:
5980 {
5981 // Explosive Shot
5982 if (GetSpellInfo()->SpellFamilyFlags[1] & 0x80000000)
5983 {
5984 if (caster)
5985 caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, target, true, nullptr, this);
5986 break;
5987 }
5988 switch (GetSpellInfo()->Id)
5989 {
5990 // Feeding Frenzy Rank 1
5991 case 53511:
5992 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
5993 target->CastSpell(target, 60096, true, 0, this);
5994 return;
5995 // Feeding Frenzy Rank 2
5996 case 53512:
5997 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
5998 target->CastSpell(target, 60097, true, 0, this);
5999 return;
6000 default:
6001 break;
6002 }
6003 break;
6004 }
6006 switch (GetId())
6007 {
6008 case 49016: // Hysteria
6009 uint32 damage = uint32(target->CountPctFromMaxHealth(1));
6010 Unit::DealDamage(target, target, damage, nullptr, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
6011 break;
6012 }
6013 // Blood of the North
6014 // Reaping
6015 // Death Rune Mastery
6016 if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
6017 {
6018 if (!target->IsPlayer())
6019 return;
6021 return;
6022
6023 // timer expired - remove death runes
6024 target->ToPlayer()->RemoveRunesByAuraEffect(this);
6025 }
6026 break;
6027 default:
6028 break;
6029 }
6030}
@ SPELLFAMILY_HUNTER
Definition SharedDefines.h:3793
@ SPELLFAMILY_DEATHKNIGHT
Definition SharedDefines.h:3799
@ SPELLVALUE_BASE_POINT0
Definition SpellDefines.h:121
@ NODAMAGE
Definition Unit.h:266
uint32 CountPctFromMaxHealth(int32 pct) const
Definition Unit.h:1135

References Unit::CastCustomSpell(), Unit::CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, Unit::CountPctFromMaxHealth(), Unit::DealDamage(), GetId(), GetSpellInfo(), Unit::GetVictim(), Unit::HealthBelowPct(), Player::IsClass(), Object::IsPlayer(), m_amount, NODAMAGE, Player::RemoveRunesByAuraEffect(), SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_HUNTER, SPELLVALUE_BASE_POINT0, and Object::ToPlayer().

Referenced by PeriodicTick().

◆ HandlePeriodicEnergizeAuraTick()

void AuraEffect::HandlePeriodicEnergizeAuraTick ( Unit *  target,
Unit *  caster 
) const
6845{
6847
6849 return;
6850
6851 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
6852 return;
6853
6854 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6855 {
6856 SendTickImmune(target, caster);
6857 return;
6858 }
6859
6860 // don't regen when permanent aura target has full power
6861 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
6862 return;
6863
6864 // ignore negative values (can be result apply spellmods to aura damage
6865 int32 amount = std::max(m_amount, 0);
6866
6867 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
6868 target->SendPeriodicAuraLog(&pInfo);
6869
6870 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
6871 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
6872 int32 gain = target->ModifyPower(PowerType, amount);
6873
6874 if (caster)
6875 target->GetThreatMgr().ForwardThreatForAssistingMe(caster, float(gain) * 0.5f, GetSpellInfo(), true);
6876}
@ SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED
Definition SharedDefines.h:645
virtual bool HasActivePowerType(Powers power)
Definition Unit.h:1146

References ThreatManager::ForwardThreatForAssistingMe(), GetBase(), GetCasterGUID(), Object::GetGUID(), GetId(), Unit::GetMaxPower(), GetMiscValue(), Unit::GetPower(), GetSpellInfo(), Unit::GetThreatMgr(), Unit::HasActivePowerType(), SpellInfo::HasAttribute(), Unit::IsAlive(), Unit::IsImmunedToAuraPeriodicTick(), Object::IsPlayer(), LOG_DEBUG, m_amount, m_spellInfo, Unit::ModifyPower(), Unit::SendPeriodicAuraLog(), SendTickImmune(), SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED, and ObjectGuid::ToString().

Referenced by PeriodicTick().

◆ HandlePeriodicHealAurasTick()

void AuraEffect::HandlePeriodicHealAurasTick ( Unit *  target,
Unit *  caster 
) const
6599{
6600 if (!target->IsAlive())
6601 return;
6602
6603 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6604 {
6605 SendTickImmune(target, caster);
6606 return;
6607 }
6608
6609 // heal for caster damage (must be alive)
6610 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST) && (!caster || !caster->IsAlive()))
6611 return;
6612
6613 // don't regen when permanent aura target has full power
6614 if (GetBase()->IsPermanent() && target->IsFullHealth())
6615 return;
6616
6617 // ignore negative values (can be result apply spellmods to aura damage
6618 int32 damage = std::max(m_amount, 0);
6619
6621 {
6622 // Taken mods
6623 float TakenTotalMod = 1.0f;
6624
6625 // Tenacity increase healing % taken
6626 if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0))
6627 AddPct(TakenTotalMod, Tenacity->GetAmount());
6628
6629 // Healing taken percent
6630 float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6631 if (minval)
6632 AddPct(TakenTotalMod, minval);
6633
6634 float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6635 if (maxval)
6636 AddPct(TakenTotalMod, maxval);
6637
6638 // Healing over time taken percent
6639 float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
6640 if (minval_hot)
6641 AddPct(TakenTotalMod, minval_hot);
6642
6643 float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
6644 if (maxval_hot)
6645 AddPct(TakenTotalMod, maxval_hot);
6646
6647 // Arena / BG Dampening
6648 float minval_pct = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
6649 if (minval_pct)
6650 AddPct(TakenTotalMod, minval_pct);
6651
6652 TakenTotalMod = std::max(TakenTotalMod, 0.0f);
6653
6654 // the most ugly hack i made :P the other option is to change all spellvalues to float...
6655 // demonic aegis
6656 if (caster && GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[1] & 0x20000000))
6658 AddPct(TakenTotalMod, aurEff->GetAmount());
6659
6660 damage = uint32(target->CountPctFromMaxHealth(damage));
6661 damage = uint32(damage * TakenTotalMod);
6662 }
6663 else
6664 {
6665 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
6666 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6667
6668 if (caster && GetBase()->GetType() == UNIT_AURA_TYPE)
6669 damage = int32(float(damage) * caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_DONE_PERCENT));
6670
6671 damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6672 }
6673
6674 bool crit = false;
6675 if ((crit = roll_chance_f(GetCritChance())))
6676 damage = Unit::SpellCriticalHealingBonus(caster, GetSpellInfo(), damage, target);
6677
6678 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} heal of {} for {} health inflicted by {}",
6679 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId());
6680
6681 uint32 heal = uint32(damage);
6682
6683 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6684 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, heal, GetSpellInfo());
6685 sScriptMgr->ModifyHealReceived(target, caster, heal, GetSpellInfo());
6686
6687 if (target->GetAI())
6688 {
6689 target->GetAI()->OnCalculatePeriodicTickReceived(heal, caster);
6690 }
6691
6692 HealInfo healInfo(caster, target, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6693 Unit::CalcHealAbsorb(healInfo);
6694 int32 gain = Unit::DealHeal(caster, target, healInfo.GetHeal());
6695 healInfo.SetEffectiveHeal(gain);
6696
6697 SpellPeriodicAuraLogInfo pInfo(this, healInfo.GetHeal(), healInfo.GetHeal() - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
6698 target->SendPeriodicAuraLog(&pInfo);
6699
6700 if (caster)
6701 {
6702 float threat = float(gain) * 0.5f;
6703 if (caster->IsClass(CLASS_PALADIN))
6704 threat *= 0.5f;
6705 target->GetThreatMgr().ForwardThreatForAssistingMe(caster, threat, GetSpellInfo());
6706 }
6707
6708 bool haveCastItem = GetBase()->GetCastItemGUID();
6709
6710 // Health Funnel
6711 // damage caster for heal amount
6712 // xinef: caster is available, checked earlier
6713 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST))
6714 {
6715 uint32 manaPerSecond = GetSpellInfo()->ManaPerSecond;
6716 if ((int32)manaPerSecond > gain && gain > 0)
6717 {
6718 manaPerSecond = gain;
6719 }
6720
6721 uint32 absorb2 = 0;
6722 Unit::DealDamageMods(caster, manaPerSecond, &absorb2);
6723
6725 Unit::DealDamage(caster, caster, manaPerSecond, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
6726 }
6727
6728 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6729 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6731 if (healInfo.GetAbsorb() > 0)
6732 procEx |= PROC_EX_ABSORB;
6733
6734 // ignore item heals
6735 if (!haveCastItem && GetAuraType() != SPELL_AURA_OBS_MOD_HEALTH) // xinef: dont allow obs_mod_health to proc spells, this is passive regeneration and not hot
6736 Unit::ProcSkillsAndAuras(caster, target, caster ? procAttacker : 0, procVictim, procEx, heal, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, nullptr, &healInfo);
6737}
@ SPELL_ATTR2_NO_TARGET_PER_SECOND_COST
Definition SharedDefines.h:455
@ CLASS_PALADIN
Definition SharedDefines.h:127
@ SPELLFAMILY_WARLOCK
Definition SharedDefines.h:3789
@ SPELL_AURA_MOD_HEALING_DONE_PERCENT
Definition SpellAuraDefines.h:199
@ SPELL_AURA_MOD_HEALING_PCT
Definition SpellAuraDefines.h:181
@ SPELL_AURA_MOD_HOT_PCT
Definition SpellAuraDefines.h:322
@ PROC_EX_INTERNAL_HOT
Definition SpellMgr.h:225
@ SELF_DAMAGE
Definition Unit.h:267
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:104
Definition Unit.h:393
uint32 ManaPerSecond
Definition SpellInfo.h:389
static void CalcHealAbsorb(HealInfo &healInfo)
Definition Unit.cpp:2704
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition Unit.cpp:7874
int32 GetMaxPositiveAuraModifier(AuraType auratype) const
Definition Unit.cpp:6096
static uint32 SpellCriticalHealingBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:9240
int32 GetMaxNegativeAuraModifier(AuraType auratype) const
Definition Unit.cpp:6101
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:9485

References AddPct(), BASE_ATTACK, Unit::CalcHealAbsorb(), CLASS_PALADIN, Unit::CountPctFromMaxHealth(), Unit::DealDamage(), Unit::DealDamageMods(), Unit::DealHeal(), DOT, DYNOBJ_AURA_TYPE, ThreatManager::ForwardThreatForAssistingMe(), HealInfo::GetAbsorb(), Unit::GetAI(), Unit::GetAuraEffect(), GetAuraType(), GetBase(), GetCasterGUID(), Aura::GetCastItemGUID(), GetCritChance(), HealInfo::GetEffectiveHeal(), GetEffIndex(), Object::GetGUID(), HealInfo::GetHeal(), GetId(), Unit::GetMaxNegativeAuraModifier(), Unit::GetMaxPositiveAuraModifier(), GetSpellInfo(), Unit::GetThreatMgr(), Unit::GetTotalAuraMultiplier(), Unit::IsAlive(), Unit::IsClass(), Unit::IsFullHealth(), Unit::IsImmunedToAuraPeriodicTick(), LOG_DEBUG, m_amount, SpellInfo::ManaPerSecond, MELEE_HIT_NORMAL, UnitAI::OnCalculatePeriodicTickReceived(), PROC_EX_ABSORB, PROC_EX_CRITICAL_HIT, PROC_EX_INTERNAL_HOT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_PERIODIC, PROC_FLAG_TAKEN_PERIODIC, Unit::ProcSkillsAndAuras(), roll_chance_f(), SELF_DAMAGE, Unit::SendPeriodicAuraLog(), SendTickImmune(), HealInfo::SetEffectiveHeal(), SPELL_ATTR2_NO_TARGET_PER_SECOND_COST, SPELL_AURA_ADD_PCT_MODIFIER, SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELL_AURA_MOD_HEALING_PCT, SPELL_AURA_MOD_HOT_PCT, SPELL_AURA_OBS_MOD_HEALTH, Unit::SpellCriticalHealingBonus(), SPELLFAMILY_WARLOCK, Unit::SpellHealingBonusDone(), Unit::SpellHealingBonusTaken(), sScriptMgr, ObjectGuid::ToString(), and UNIT_AURA_TYPE.

Referenced by PeriodicTick().

◆ HandlePeriodicHealthFunnelAuraTick()

void AuraEffect::HandlePeriodicHealthFunnelAuraTick ( Unit *  target,
Unit *  caster 
) const
6570{
6571 if (!caster || !caster->IsAlive() || !target->IsAlive())
6572 return;
6573
6574 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6575 {
6576 SendTickImmune(target, caster);
6577 return;
6578 }
6579
6580 uint32 damage = std::max(GetAmount(), 0);
6581 // do not kill health donator
6582 if (caster->GetHealth() < damage)
6583 damage = caster->GetHealth() - 1;
6584 if (!damage)
6585 return;
6586
6587 caster->ModifyHealth(-(int32)damage);
6588 LOG_DEBUG("spells.aura", "PeriodicTick: donator {} target {} damage {}.", caster->GetEntry(), target->GetEntry(), damage);
6589
6590 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6591
6592 damage = int32(damage * gainMultiplier);
6593
6594 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6595 caster->HealBySpell(healInfo);
6596}
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition Unit.cpp:8170

References SpellInfo::Effects, GetAmount(), GetEffIndex(), Object::GetEntry(), Unit::GetHealth(), GetSpellInfo(), Unit::HealBySpell(), Unit::IsAlive(), Unit::IsImmunedToAuraPeriodicTick(), LOG_DEBUG, Unit::ModifyHealth(), and SendTickImmune().

Referenced by PeriodicTick().

◆ HandlePeriodicHealthLeechAuraTick()

void AuraEffect::HandlePeriodicHealthLeechAuraTick ( Unit *  target,
Unit *  caster 
) const
6460{
6461 if (!target->IsAlive())
6462 return;
6463
6464 if (target->IsImmunedToDamage(caster, GetSpellInfo()))
6465 {
6466 SendTickImmune(target, caster);
6467 return;
6468 }
6469
6470 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6471 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6472 return;
6473
6475
6476 uint32 damage = std::max(GetAmount(), 0);
6477
6478 // Script Hook For HandlePeriodicHealthLeechAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6479 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6480
6481 if (target->GetAI())
6482 {
6483 target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
6484 }
6485
6486 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
6487 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6488 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6489
6490 bool crit = false;
6491 if ((crit = roll_chance_f(GetCritChance())))
6492 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6493
6494 // Calculate armor mitigation
6496 {
6497 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6498 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6499 damage = damageReductedArmor;
6500 }
6501
6502 int32 dmg = damage;
6503 int32 cleanDamageAmount = cleanDamage.mitigated_damage;
6504 if (CanApplyResilience())
6505 {
6506 int32 resilienceReduction = dmg;
6507 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6508
6509 resilienceReduction = dmg - resilienceReduction;
6510 dmg -= resilienceReduction;
6511 cleanDamageAmount += resilienceReduction;
6512 }
6513
6514 damage = std::max(0, dmg);
6515 cleanDamage.mitigated_damage = std::max(0, cleanDamageAmount);
6516
6517 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6518 Unit::CalcAbsorbResist(dmgInfo, false, GetCasterLevel());
6519
6520 uint32 absorb = dmgInfo.GetAbsorb();
6521 uint32 resist = dmgInfo.GetResist();
6522 damage = dmgInfo.GetDamage();
6523
6524 // Set trigger flag
6525 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6526 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6528 if (dmgInfo.GetDamage())
6529 procEx |= crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT;
6530 if (absorb > 0)
6531 procEx |= PROC_EX_ABSORB;
6532
6533 if (dmgInfo.GetDamage())
6534 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6535
6536 if (target->GetHealth() < dmgInfo.GetDamage())
6537 {
6538 dmgInfo.ModifyDamage(dmgInfo.GetDamage() - target->GetHealth());
6539 }
6540
6541 damage = dmgInfo.GetDamage();
6542
6543 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} health leech of {} for {} dmg inflicted by {} abs is {}",
6544 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6545 if (caster)
6546 caster->SendSpellNonMeleeDamageLog(target, GetSpellInfo(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit);
6547
6548 int32 new_damage;
6549
6550 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
6551
6552 Unit::ProcSkillsAndAuras(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6553
6554 if (!caster || !caster->IsAlive())
6555 return;
6556
6557 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6558
6559 uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount()));
6560 heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount()));
6561
6562 HealInfo healInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6563 float threat = float(caster->HealBySpell(healInfo)) * 0.5f;
6564 if (caster->IsClass(CLASS_PALADIN))
6565 threat *= 0.5f;
6566 caster->GetThreatMgr().ForwardThreatForAssistingMe(caster, threat, GetSpellInfo());
6567}
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition Unit.cpp:6523

References Unit::ApplyResilience(), BASE_ATTACK, Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), CanApplyResilience(), CLASS_PALADIN, CR_CRIT_TAKEN_SPELL, Unit::DealDamage(), DOT, DYNOBJ_AURA_TYPE, SpellInfo::Effects, ThreatManager::ForwardThreatForAssistingMe(), DamageInfo::GetAbsorb(), Unit::GetAI(), GetAmount(), GetBase(), GetCasterGUID(), GetCasterLevel(), GetCritChance(), DamageInfo::GetDamage(), GetEffIndex(), Object::GetGUID(), Unit::GetHealth(), GetId(), DamageInfo::GetResist(), GetSpellInfo(), Unit::GetThreatMgr(), Unit::HealBySpell(), Unit::IsAlive(), Unit::IsClass(), Unit::IsDamageReducedByArmor(), Unit::IsImmunedToDamage(), LOG_DEBUG, m_effIndex, m_spellInfo, MELEE_HIT_NORMAL, CleanDamage::mitigated_damage, DamageInfo::ModifyDamage(), UnitAI::OnCalculatePeriodicTickReceived(), PROC_EX_ABSORB, PROC_EX_CRITICAL_HIT, PROC_EX_INTERNAL_DOT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_PERIODIC, PROC_FLAG_TAKEN_DAMAGE, PROC_FLAG_TAKEN_PERIODIC, Unit::ProcSkillsAndAuras(), roll_chance_f(), Unit::SendSpellNonMeleeDamageLog(), SendTickImmune(), SPELL_EFFECT_PERSISTENT_AREA_AURA, SPELL_MISS_NONE, Unit::SpellCriticalDamageBonus(), Unit::SpellDamageBonusDone(), Unit::SpellDamageBonusTaken(), Unit::SpellHealingBonusDone(), Unit::SpellHealingBonusTaken(), WorldObject::SpellHitResult(), sScriptMgr, and ObjectGuid::ToString().

Referenced by PeriodicTick().

◆ HandlePeriodicManaLeechAuraTick()

void AuraEffect::HandlePeriodicManaLeechAuraTick ( Unit *  target,
Unit *  caster 
) const
6740{
6742
6743 if (!caster || !caster->IsAlive() || !target->IsAlive() || !target->HasActivePowerType(PowerType))
6744 return;
6745
6746 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6747 {
6748 SendTickImmune(target, caster);
6749 return;
6750 }
6751
6752 if (GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6753 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6754 return;
6755
6756 // ignore negative values (can be result apply spellmods to aura damage
6757 int32 drainAmount = std::max(m_amount, 0);
6758
6759 // Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
6760 // It's mana percent cost spells, m_amount is percent drain from target
6762 {
6763 // max value
6764 int32 maxmana = CalculatePct(caster->GetMaxPower(PowerType), drainAmount * 2.0f);
6765 ApplyPct(drainAmount, target->GetMaxPower(PowerType));
6766 if (drainAmount > maxmana)
6767 drainAmount = maxmana;
6768 }
6769
6770 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} power leech of {} for {} dmg inflicted by {}",
6771 GetCasterGUID().ToString(), target->GetGUID().ToString(), drainAmount, GetId());
6772 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6773 if (PowerType == POWER_MANA)
6774 drainAmount -= target->GetSpellCritDamageReduction(drainAmount);
6775
6776 int32 drainedAmount = -target->ModifyPower(PowerType, -drainAmount);
6777
6778 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6779
6780 SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, gainMultiplier, false);
6781 target->SendPeriodicAuraLog(&pInfo);
6782
6783 int32 gainAmount = int32(drainedAmount * gainMultiplier);
6784 int32 gainedAmount = 0;
6785 if (gainAmount)
6786 {
6787 gainedAmount = caster->ModifyPower(PowerType, gainAmount);
6788 target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
6789 }
6790
6791 // remove CC auras
6793
6794 // Drain Mana
6796 && m_spellInfo->SpellFamilyFlags[0] & 0x00000010)
6797 {
6798 int32 manaFeedVal = 0;
6799 if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
6800 manaFeedVal = aurEff->GetAmount();
6801 // Mana Feed - Drain Mana
6802 if (manaFeedVal > 0)
6803 {
6804 int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
6805 caster->CastCustomSpell(caster, 32554, &feedAmount, nullptr, nullptr, true, nullptr, this);
6806 }
6807 }
6808}
@ AURA_INTERRUPT_FLAG_TAKE_DAMAGE
Definition SpellDefines.h:52
T ApplyPct(T &base, U pct)
Definition Util.h:64
uint32 GetSpellCritDamageReduction(uint32 damage) const
Definition Unit.h:1293

References Unit::AddThreat(), ApplyPct(), AURA_INTERRUPT_FLAG_TAKE_DAMAGE, CalculatePct(), Unit::CastCustomSpell(), SpellInfo::Effects, GetBase(), GetCasterGUID(), GetEffIndex(), Object::GetGUID(), GetId(), Unit::GetMaxPower(), GetMiscValue(), Unit::GetSpellCritDamageReduction(), GetSpellInfo(), Unit::HasActivePowerType(), Unit::IsAlive(), Unit::IsImmunedToAuraPeriodicTick(), LOG_DEBUG, m_amount, m_spellInfo, SpellInfo::ManaCostPercentage, Unit::ModifyPower(), POWER_MANA, Unit::RemoveAurasWithInterruptFlags(), Unit::SendPeriodicAuraLog(), SendTickImmune(), SPELL_EFFECT_PERSISTENT_AREA_AURA, SPELL_MISS_NONE, SPELLFAMILY_WARLOCK, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, WorldObject::SpellHitResult(), and ObjectGuid::ToString().

Referenced by PeriodicTick().

◆ HandlePeriodicPowerBurnAuraTick()

void AuraEffect::HandlePeriodicPowerBurnAuraTick ( Unit *  target,
Unit *  caster 
) const
6879{
6881
6882 if (!caster || !target->IsAlive() || !target->HasActivePowerType(PowerType))
6883 return;
6884
6885 if (target->IsImmunedToDamage(caster, GetSpellInfo()))
6886 {
6887 SendTickImmune(target, caster);
6888 return;
6889 }
6890
6891 // ignore negative values (can be result apply spellmods to aura damage
6892 int32 damage = std::max(m_amount, 0);
6893
6894 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6895 if (PowerType == POWER_MANA)
6896 damage -= target->GetSpellCritDamageReduction(damage);
6897
6898 uint32 gain = uint32(-target->ModifyPower(PowerType, -damage));
6899
6900 float dmgMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6901
6902 SpellInfo const* spellProto = GetSpellInfo();
6903 // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
6904 SpellNonMeleeDamage damageInfo(caster, target, spellProto, spellProto->SchoolMask);
6905 // no SpellDamageBonus for burn mana
6906 caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
6907
6908 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6909
6910 caster->SendSpellNonMeleeDamageLog(&damageInfo);
6911
6912 // Set trigger flag
6913 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6914 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6915 if (damageInfo.damage)
6916 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6917
6918 caster->DealSpellDamage(&damageInfo, true);
6919
6920 DamageInfo dmgInfo(damageInfo, DOT, BASE_ATTACK, SPELL_MISS_NONE);
6921 uint32 hitMask = dmgInfo.GetHitMask() | PROC_EX_INTERNAL_DOT;
6922 Unit::ProcSkillsAndAuras(caster, damageInfo.target, procAttacker, procVictim, hitMask, damageInfo.damage, BASE_ATTACK, spellProto, nullptr, GetEffIndex(), nullptr, &dmgInfo);
6923}
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
Definition Unit.cpp:1658
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
Definition Unit.cpp:1511
Definition Unit.h:514

References SpellNonMeleeDamage::absorb, BASE_ATTACK, Unit::CalculateSpellDamageTaken(), SpellNonMeleeDamage::damage, Unit::DealDamageMods(), Unit::DealSpellDamage(), DOT, SpellInfo::Effects, GetEffIndex(), DamageInfo::GetHitMask(), GetMiscValue(), Unit::GetSpellCritDamageReduction(), GetSpellInfo(), Unit::HasActivePowerType(), Unit::IsAlive(), Unit::IsImmunedToDamage(), m_amount, Unit::ModifyPower(), POWER_MANA, PROC_EX_INTERNAL_DOT, PROC_FLAG_DONE_PERIODIC, PROC_FLAG_TAKEN_DAMAGE, PROC_FLAG_TAKEN_PERIODIC, Unit::ProcSkillsAndAuras(), SpellInfo::SchoolMask, Unit::SendSpellNonMeleeDamageLog(), SendTickImmune(), SPELL_MISS_NONE, and SpellNonMeleeDamage::target.

Referenced by PeriodicTick().

◆ HandlePeriodicTriggerSpellAuraTick()

void AuraEffect::HandlePeriodicTriggerSpellAuraTick ( Unit *  target,
Unit *  caster 
) const
Todo:
: effect trigger spell may be independant on spell targets, and executed in spell finish phase
6033{
6034 // generic casting code with custom spells and target/caster customs
6035 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
6036
6037 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
6038 SpellInfo const* auraSpellInfo = GetSpellInfo();
6039 uint32 auraId = auraSpellInfo->Id;
6040
6041 // specific code for cases with no trigger spell provided in field
6042 if (!triggeredSpellInfo)
6043 {
6044 switch (auraSpellInfo->SpellFamilyName)
6045 {
6047 {
6048 switch (auraId)
6049 {
6050 // Thaumaturgy Channel
6051 case 9712:
6052 triggerSpellId = 21029;
6053 if (caster)
6054 caster->CastSpell(caster, triggerSpellId, true);
6055 return;
6056 // Brood Affliction: Bronze
6057 case 23170:
6058 // Only 10% chance of triggering spell
6059 if (roll_chance_f(10.f))
6060 {
6061 triggerSpellId = 23171;
6062 }
6063 break;
6064 // Restoration
6065 // The battleground buff casts it itself, so the player it lands on is the one healed.
6066 case 24379:
6067 case 23493:
6068 {
6069 int32 heal = target->CountPctFromMaxHealth(10);
6070 HealInfo healInfo(target, target, heal, auraSpellInfo, auraSpellInfo->GetSchoolMask());
6071 target->HealBySpell(healInfo);
6072
6073 if (int32 mana = target->GetMaxPower(POWER_MANA))
6074 {
6075 mana /= 10;
6076 target->EnergizeBySpell(target, auraId, mana, POWER_MANA);
6077 }
6078 return;
6079 }
6080 // Nitrous Boost
6081 case 27746:
6082 if (caster && target->GetPower(POWER_MANA) >= 10)
6083 {
6084 target->ModifyPower(POWER_MANA, -10);
6085 target->SendEnergizeSpellLog(caster, 27746, 10, POWER_MANA);
6086 }
6087 else
6088 target->RemoveAurasDueToSpell(27746);
6089 return;
6090 // Frost Blast
6091 case 27808:
6092 if (caster)
6093 {
6094 caster->CastSpell(target, 29879, true, nullptr, this);
6095 if (GetTickNumber() == 1)
6096 caster->CastSpell(target, 27808, true);
6097 }
6098 return;
6099 // Inoculate Nestlewood Owlkin
6100 case 29528:
6101 if (!target->IsCreature()) // prevent error reports in case ignored player target
6102 return;
6103 break;
6104 // Feed Captured Animal
6105 case 29917:
6106 triggerSpellId = 29916;
6107 break;
6108 // Extract Gas
6109 case 30427:
6110 {
6111 // move loot to player inventory and despawn target
6112 if (caster && caster->IsPlayer() &&
6113 target->IsCreature() &&
6115 {
6116 Player* player = caster->ToPlayer();
6117 Creature* creature = target->ToCreature();
6118 // missing lootid has been reported on startup - just return
6119 if (!creature->GetCreatureTemplate()->SkinLootId)
6120 return;
6121
6123
6124 creature->DespawnOrUnsummon();
6125 }
6126 return;
6127 }
6128 // Quake
6129 case 30576:
6130 triggerSpellId = 30571;
6131 break;
6132 // Doom
6134 // so instakill will be naturally done before trigger spell
6135 case 31347:
6136 {
6137 target->CastSpell(target, 31350, true, nullptr, this);
6138 Unit::Kill(target, target);
6139 return;
6140 }
6141 // Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam
6142 case 39857:
6143 triggerSpellId = 39856;
6144 break;
6145 // Personalized Weather
6146 case 46736:
6147 triggerSpellId = 46737;
6148 break;
6149 // Shield Level 1
6150 case 63130:
6151 // Shield Level 2
6152 case 63131:
6153 // Shield Level 3
6154 case 63132:
6155 // Ball of Flames Visual
6156 case 71706:
6157 return;
6158 // Oculus, Mage-Lord Urom, Time Bomb
6159 case 51121:
6160 case 59376:
6161 {
6162 const int32 dmg = target->GetMaxHealth() - target->GetHealth();
6163 target->CastCustomSpell(target, 51132, &dmg, 0, 0, true);
6164 return;
6165 }
6166 }
6167 break;
6168 }
6169 default:
6170 break;
6171 }
6172 }
6173 else
6174 {
6175 // Spell exist but require custom code
6176 switch (auraId)
6177 {
6178 // Poison (Grobbulus)
6179 case 28158:
6180 case 54362:
6181 // Slime Pool (Dreadscale & Acidmaw)
6182 case 66882:
6183 target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000 * 2 / 3), nullptr, true, nullptr, this);
6184 return;
6185 // Eye of Eternity, Malygos, Arcane Overload
6186 case 56432:
6187 if (triggerSpellId == 56438)
6188 {
6189 target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)(10000 * (1.0f - 0.02f * (m_tickNumber + 1))), nullptr, true, nullptr, this);
6190 return;
6191 }
6192 break;
6193 // Beacon of Light
6194 case 53563:
6195 {
6196 // area aura owner casts the spell
6197 GetBase()->GetUnitOwner()->CastSpell(target, triggeredSpellInfo, true, 0, this, GetBase()->GetUnitOwner()->GetGUID());
6198 return;
6199 }
6200 // Trial of the Crusader, Jaraxxus, Spinning Pain Spike
6201 case 66283:
6202 {
6203 const int32 dmg = target->GetMaxHealth() / 2;
6204 target->CastCustomSpell(target, 66316, &dmg, nullptr, nullptr, true);
6205 return;
6206 }
6207 // Violet Hold, Moragg, Ray of Suffering, Ray of Pain
6208 case 54442:
6209 case 59524:
6210 case 54438:
6211 case 59523:
6212 {
6213 if (caster)
6214 if (Unit* victim = caster->GetVictim())
6215 if (victim->GetDistance(caster) < 45.0f)
6216 {
6217 target = victim;
6218 break;
6219 }
6220 return;
6221 }
6222 case 24745: // Summon Templar, Trigger
6223 case 24747: // Summon Templar Fire, Trigger
6224 case 24757: // Summon Templar Air, Trigger
6225 case 24759: // Summon Templar Earth, Trigger
6226 case 24761: // Summon Templar Water, Trigger
6227 case 24762: // Summon Duke, Trigger
6228 case 24766: // Summon Duke Fire, Trigger
6229 case 24769: // Summon Duke Air, Trigger
6230 case 24771: // Summon Duke Earth, Trigger
6231 case 24773: // Summon Duke Water, Trigger
6232 case 24785: // Summon Royal, Trigger
6233 case 24787: // Summon Royal Fire, Trigger
6234 case 24791: // Summon Royal Air, Trigger
6235 case 24792: // Summon Royal Earth, Trigger
6236 case 24793: // Summon Royal Water, Trigger
6237 {
6238 // All this spells trigger a spell that requires reagents; if the
6239 // triggered spell is cast as "triggered", reagents are not consumed
6240 if (caster)
6241 caster->CastSpell(target, triggerSpellId, false);
6242 return;
6243 }
6244 }
6245 }
6246
6247 // Reget trigger spell proto
6248 triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
6249
6250 if (triggeredSpellInfo)
6251 {
6252 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6253 {
6254 SpellCastTargets targets;
6255 targets.SetUnitTarget(target);
6256 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6257 {
6260 }
6261
6262 // Xinef: do not skip reagent cost for entry casts
6264 if (GetSpellInfo()->Effects[GetEffIndex()].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || GetSpellInfo()->Effects[GetEffIndex()].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)
6266
6267 triggerCaster->CastSpell(targets, triggeredSpellInfo, nullptr, triggerFlags, nullptr, this);
6268 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6269 }
6270 }
6271}
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
@ CREATURE_TYPE_GAS_CLOUD
Definition SharedDefines.h:2634
@ SPELLVALUE_RADIUS_MOD
Definition SpellDefines.h:124
TriggerCastFlags
Definition SpellDefines.h:140
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition SpellDefines.h:158
@ TRIGGERED_IGNORE_POWER_AND_REAGENT_COST
Will ignore Spell and Category cooldowns.
Definition SpellDefines.h:144
@ TARGET_CHECK_ENTRY
Definition SpellInfo.h:116
uint32 GetTickNumber() const
Definition SpellAuraEffects.h:87
Unit * GetUnitOwner() const
Definition SpellAuras.h:109
void DespawnOrUnsummon(Milliseconds msTimeToDespawn=0ms, Seconds forcedRespawnTimer=0s)
Definition Creature.cpp:2221
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, bool broadcast=false)
Definition Player.cpp:13835
Definition Spell.h:121
void SetUnitTarget(Unit *target)
Definition Spell.cpp:276
void SetObjectTargetChannel(ObjectGuid targetGUID)
Definition Spell.cpp:491
void SetDstChannel(SpellDestination const &spellDest)
Definition Spell.cpp:496
bool IsChannelCategorySpell() const
Definition SpellInfo.cpp:1128
void EnergizeBySpell(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:8197
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition Unit.cpp:13651
void SendEnergizeSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:8186
SpellDestination spellDst
Definition Spell.h:262
ObjectGuid channelGUID
Definition Spell.h:261
uint32 type
Definition CreatureData.h:218
uint32 SkinLootId
Definition CreatureData.h:222

References Player::AutoStoreLoot(), Unit::CastCustomSpell(), Unit::CastSpell(), ChannelTargetData::channelGUID, Unit::CountPctFromMaxHealth(), CREATURE_TYPE_GAS_CLOUD, Creature::DespawnOrUnsummon(), SpellInfo::Effects, Unit::EnergizeBySpell(), GetBase(), Creature::GetCreatureTemplate(), GetEffIndex(), Unit::GetHealth(), GetId(), Unit::GetMaxHealth(), Unit::GetMaxPower(), Unit::GetPower(), SpellInfo::GetSchoolMask(), GetSpellInfo(), GetTickNumber(), Aura::GetUnitOwner(), Unit::GetVictim(), Unit::HealBySpell(), SpellInfo::Id, SpellInfo::IsChannelCategorySpell(), Object::IsCreature(), Object::IsPlayer(), Unit::Kill(), LOG_DEBUG, LootTemplates_Skinning, m_channelData, m_spellInfo, m_tickNumber, Unit::ModifyPower(), SpellInfo::NeedsToBeTriggeredByCaster(), POWER_MANA, Unit::RemoveAurasDueToSpell(), roll_chance_f(), Unit::SendEnergizeSpellLog(), SpellCastTargets::SetDstChannel(), SpellCastTargets::SetObjectTargetChannel(), SpellCastTargets::SetUnitTarget(), CreatureTemplate::SkinLootId, ChannelTargetData::spellDst, SPELLFAMILY_GENERIC, SpellInfo::SpellFamilyName, SPELLVALUE_RADIUS_MOD, sSpellMgr, TARGET_CHECK_ENTRY, Object::ToCreature(), Object::ToPlayer(), TRIGGERED_FULL_MASK, TRIGGERED_IGNORE_POWER_AND_REAGENT_COST, and CreatureTemplate::type.

Referenced by PeriodicTick().

◆ HandlePeriodicTriggerSpellWithValueAuraTick()

void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick ( Unit *  target,
Unit *  caster 
) const
6274{
6275 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
6276 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6277 {
6278 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6279 {
6280 SpellCastTargets targets;
6281 targets.SetUnitTarget(target);
6282 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6283 {
6286 }
6287
6288 CustomSpellValues values;
6290
6291 triggerCaster->CastSpell(targets, triggeredSpellInfo, &values, TRIGGERED_FULL_MASK, nullptr, this);
6292 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6293 }
6294 }
6295 else
6296 {
6297 Creature* c = target->ToCreature();
6298 if (c && caster)
6299 {
6300 sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature());
6301 }
6302
6303 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
6304 }
6305}
SpellEffIndex
Definition SharedDefines.h:30
Definition SpellDefines.h:174
void AddSpellMod(SpellValueMod mod, int32 value)
Definition SpellDefines.h:176

References CustomSpellValues::AddSpellMod(), ChannelTargetData::channelGUID, SpellInfo::Effects, GetAmount(), GetEffIndex(), GetId(), GetSpellInfo(), LOG_DEBUG, m_channelData, m_effIndex, m_spellInfo, SpellCastTargets::SetDstChannel(), SpellCastTargets::SetObjectTargetChannel(), SpellCastTargets::SetUnitTarget(), ChannelTargetData::spellDst, SPELLVALUE_BASE_POINT0, sScriptMgr, sSpellMgr, Object::ToCreature(), and TRIGGERED_FULL_MASK.

Referenced by PeriodicTick().

◆ HandlePhase()

void AuraEffect::HandlePhase ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1950{
1951 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1952 return;
1953
1954 Unit* target = aurApp->GetTarget();
1955
1956 // no-phase is also phase state so same code for apply and remove
1957 uint32 newPhase = target->GetPhaseByAuras();
1958
1959 if (Player* player = target->ToPlayer())
1960 {
1961 if (!newPhase)
1962 newPhase = PHASEMASK_NORMAL;
1963
1964 // do not change phase to GM with all phases enabled
1965 if (player->IsGameMaster())
1966 newPhase = PHASEMASK_ANYWHERE;
1967
1968 player->SetPhaseMask(newPhase, false);
1969 player->GetSession()->SendSetPhaseShift(newPhase);
1970 }
1971 else
1972 {
1973 if (!newPhase)
1974 {
1975 newPhase = PHASEMASK_NORMAL;
1976 if (Creature* creature = target->ToCreature())
1977 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
1978 newPhase = data->phaseMask;
1979 }
1980
1981 target->SetPhaseMask(newPhase, false);
1982 }
1983
1984 // call functions which may have additional effects after chainging state of unit
1985 // phase auras normally not expected at BG but anyway better check
1986 if (apply)
1987 {
1988 // drop flag at invisibiliy in bg
1990 }
1991
1992 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1993 if (target->IsVisible())
1994 {
1995 if (!target->GetMap()->Instanceable())
1996 {
1997 target->UpdateObjectVisibility(false);
1998 target->m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f);
1999 }
2000 else
2001 target->UpdateObjectVisibility();
2002 }
2003}
@ PHASEMASK_ANYWHERE
Definition Object.h:65
@ PHASEMASK_NORMAL
Definition Object.h:64
uint32 GetPhaseByAuras() const
Definition Unit.cpp:14994
bool IsVisible() const
Definition Unit.h:2035
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:15005
Position m_last_notify_position
Definition Unit.h:2128
Definition CreatureData.h:370
void Relocate(float x, float y)
Definition Position.h:77

References AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, WorldObject::GetMap(), Unit::GetPhaseByAuras(), AuraApplication::GetTarget(), Map::Instanceable(), Unit::IsVisible(), Unit::m_last_notify_position, PHASEMASK_ANYWHERE, PHASEMASK_NORMAL, Position::Relocate(), Unit::RemoveAurasWithInterruptFlags(), Unit::SetPhaseMask(), sObjectMgr, Object::ToCreature(), Object::ToPlayer(), and Unit::UpdateObjectVisibility().

◆ HandlePreventFleeing()

void AuraEffect::HandlePreventFleeing ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
Todo:
: find a way to cancel fleeing for assistance. Currently this will only stop creatures fleeing due to low health that could not find nearby allies to flee towards.
3680{
3681 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3682 return;
3683
3684 Unit* target = aurApp->GetTarget();
3685 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
3686 if (target->IsPlayer() || !apply || target->HasFearAura())
3687 return;
3690 target->SetControlled(false, UNIT_STATE_FLEEING);
3691}
bool HasFearAura() const
Definition Unit.h:1855

References AURA_EFFECT_HANDLE_REAL, AuraApplication::GetTarget(), Unit::HasFearAura(), Object::IsPlayer(), Unit::SetControlled(), and UNIT_STATE_FLEEING.

◆ HandlePreventResurrection()

void AuraEffect::HandlePreventResurrection ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5962{
5963 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5964 return;
5965
5966 if (!aurApp->GetTarget()->IsPlayer())
5967 return;
5968
5969 if (apply)
5970 aurApp->GetTarget()->RemoveByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
5971 else if (!aurApp->GetTarget()->GetMap()->Instanceable())
5972 aurApp->GetTarget()->SetByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
5973}
@ PLAYER_FIELD_BYTE_RELEASE_TIMER
Definition Player.h:545

References AURA_EFFECT_HANDLE_REAL, WorldObject::GetMap(), AuraApplication::GetTarget(), Map::Instanceable(), Object::IsPlayer(), PLAYER_FIELD_BYTE_RELEASE_TIMER, PLAYER_FIELD_BYTES, Object::RemoveByteFlag(), and Object::SetByteFlag().

◆ HandleProc()

void AuraEffect::HandleProc ( AuraApplication *  aurApp,
ProcEventInfo &  eventInfo 
)
1309{
1310 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1311 if (prevented)
1312 return;
1313
1314 switch (GetAuraType())
1315 {
1321 HandleBreakableCCAuraProc(aurApp, eventInfo);
1322 break;
1323 case SPELL_AURA_DUMMY:
1325 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1326 break;
1328 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1329 break;
1331 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1332 break;
1334 HandleRaidProcFromChargeAuraProc(aurApp, eventInfo);
1335 break;
1338 break;
1339 default:
1340 break;
1341 }
1342
1343 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1344}
@ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
Definition SpellAuraDefines.h:288
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67
@ SPELL_AURA_RAID_PROC_FROM_CHARGE
Definition SpellAuraDefines.h:286
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
Definition SpellAuraDefines.h:106
void HandleRaidProcFromChargeAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6996
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6952
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6973
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7044
void HandleBreakableCCAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6925
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6935
bool CallScriptEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2828
void CallScriptAfterEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2847

References Aura::CallScriptAfterEffectProcHandlers(), Aura::CallScriptEffectProcHandlers(), GetAuraType(), GetBase(), HandleBreakableCCAuraProc(), HandleProcTriggerDamageAuraProc(), HandleProcTriggerSpellAuraProc(), HandleProcTriggerSpellWithValueAuraProc(), HandleRaidProcFromChargeAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), SPELL_AURA_DUMMY, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_PROC_TRIGGER_DAMAGE, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_RAID_PROC_FROM_CHARGE, SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE, and SPELL_AURA_TRANSFORM.

Referenced by Aura::TriggerProcOnEvent().

◆ HandleProcTriggerDamageAuraProc()

void AuraEffect::HandleProcTriggerDamageAuraProc ( AuraApplication *  aurApp,
ProcEventInfo &  eventInfo 
)
6974{
6975 Unit* target = aurApp->GetTarget();
6976 Unit* triggerTarget = target == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6977 if (!triggerTarget)
6978 return;
6979
6980 if (triggerTarget->IsImmunedToDamage(target, GetSpellInfo()))
6981 {
6982 SendTickImmune(triggerTarget, target);
6983 return;
6984 }
6985
6986 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetSpellInfo(), GetSpellInfo()->SchoolMask);
6987 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetEffIndex());
6988 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
6989 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
6990 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6991 target->SendSpellNonMeleeDamageLog(&damageInfo);
6992 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
6993 target->DealSpellDamage(&damageInfo, true);
6994}
Unit * GetActionTarget() const
Definition Unit.h:469

References SpellNonMeleeDamage::absorb, Unit::CalculateSpellDamageTaken(), SpellNonMeleeDamage::damage, Unit::DealDamageMods(), Unit::DealSpellDamage(), ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), GetAmount(), GetEffIndex(), GetId(), GetSpellInfo(), AuraApplication::GetTarget(), Unit::IsImmunedToDamage(), LOG_DEBUG, Unit::SendSpellNonMeleeDamageLog(), SendTickImmune(), SPELL_DIRECT_DAMAGE, Unit::SpellDamageBonusDone(), Unit::SpellDamageBonusTaken(), and SpellNonMeleeDamage::target.

Referenced by HandleProc().

◆ HandleProcTriggerSpellAuraProc()

void AuraEffect::HandleProcTriggerSpellAuraProc ( AuraApplication *  aurApp,
ProcEventInfo &  eventInfo 
)
6936{
6937 Unit* triggerCaster = aurApp->GetTarget();
6938 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6939
6940 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
6941 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6942 {
6943 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
6944 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this);
6945 }
6946 else
6947 {
6948 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellAuraProc: Could not trigger spell {} from aura {} proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId());
6949 }
6950}

References Unit::CastSpell(), SpellInfo::Effects, ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), GetEffIndex(), GetId(), GetSpellInfo(), AuraApplication::GetTarget(), LOG_DEBUG, and sSpellMgr.

Referenced by HandleProc().

◆ HandleProcTriggerSpellWithValueAuraProc()

void AuraEffect::HandleProcTriggerSpellWithValueAuraProc ( AuraApplication *  aurApp,
ProcEventInfo &  eventInfo 
)
6953{
6954 Unit* triggerCaster = aurApp->GetTarget();
6955 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6956
6957 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
6958 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6959 {
6960 // used only with EXTRA_LOGS
6961 (void)triggeredSpellInfo;
6962
6963 int32 basepoints0 = GetAmount();
6964 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell {} with value {} from aura {} proc", triggeredSpellInfo->Id, basepoints0, GetId());
6965 triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, nullptr, nullptr, true, nullptr, this);
6966 }
6967 else
6968 {
6969 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Could not trigger spell {} from aura {} proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId());
6970 }
6971}

References Unit::CastCustomSpell(), SpellInfo::Effects, ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), GetAmount(), GetId(), GetSpellInfo(), AuraApplication::GetTarget(), LOG_DEBUG, m_effIndex, and sSpellMgr.

Referenced by HandleProc().

◆ HandleRaidProcFromChargeAuraProc()

void AuraEffect::HandleRaidProcFromChargeAuraProc ( AuraApplication *  aurApp,
ProcEventInfo &  eventInfo 
)
6997{
6998 Unit* target = aurApp->GetTarget();
6999
7000 uint32 triggerSpellId;
7001 switch (GetId())
7002 {
7003 case 57949: // Shiver
7004 triggerSpellId = 57952;
7005 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
7006 break;
7007 case 59978: // Shiver
7008 triggerSpellId = 59979;
7009 break;
7010 case 43593: // Cold Stare
7011 triggerSpellId = 43594;
7012 break;
7013 default:
7014 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: {}", GetId());
7015 return;
7016 }
7017
7018 int32 jumps = GetBase()->GetCharges();
7019
7020 // current aura expire on proc finish
7021 GetBase()->SetCharges(0);
7022 GetBase()->SetUsingCharges(true);
7023
7024 // next target selection
7025 if (jumps > 0)
7026 {
7027 if (Unit* caster = GetCaster())
7028 {
7029 float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
7030
7031 if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
7032 {
7033 target->CastSpell(triggerTarget, GetSpellInfo(), true, nullptr, this, GetCasterGUID());
7034 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
7035 aura->SetCharges(jumps);
7036 }
7037 }
7038 }
7039
7040 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
7041 target->CastSpell(target, triggerSpellId, true, nullptr, this, GetCasterGUID());
7042}
void SetUsingCharges(bool val)
Definition SpellAuras.h:203
uint8 GetCharges() const
Definition SpellAuras.h:143
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition Unit.cpp:8043

References Unit::CastSpell(), SpellInfo::Effects, GetBase(), GetCaster(), GetCasterGUID(), Aura::GetCharges(), GetEffIndex(), GetId(), Unit::GetNextRandomRaidMemberOrPet(), GetSpellInfo(), AuraApplication::GetTarget(), LOG_DEBUG, Aura::SetCharges(), and Aura::SetUsingCharges().

Referenced by HandleProc().

◆ HandleRaidProcFromChargeWithValueAuraProc()

void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc ( AuraApplication *  aurApp,
ProcEventInfo &  eventInfo 
)
7045{
7046 enum
7047 {
7048 SPELL_PRAYER_OF_MENDING_HEAL = 33110,
7049 SPELL_PRAYER_OF_MENDING_VISUAL = 41637
7050 };
7051
7052 Unit* target = aurApp->GetTarget();
7053
7054 // Currently only Prayer of Mending
7055 if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20))
7056 {
7057 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: {}", GetId());
7058 return;
7059 }
7060
7061 int32 value = GetAmount();
7062
7063 int32 jumps = GetBase()->GetCharges();
7064
7065 // current aura expire on proc finish
7066 GetBase()->SetCharges(0);
7067 GetBase()->SetUsingCharges(true);
7068
7069 // next target selection
7070 if (jumps > 0)
7071 {
7072 if (Unit* caster = GetCaster())
7073 {
7074 float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
7075
7076 Unit* triggerTarget = nullptr;
7077 Acore::MostHPMissingGroupInRange u_check(target, radius, 0);
7078 Acore::UnitLastSearcher<Acore::MostHPMissingGroupInRange> searcher(target, triggerTarget, u_check);
7079 Cell::VisitObjects(target, searcher, radius);
7080
7081 if (triggerTarget)
7082 {
7083 target->CastSpell(triggerTarget, SPELL_PRAYER_OF_MENDING_VISUAL, true);
7084 target->CastCustomSpell(triggerTarget, GetId(), &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
7085 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
7086 aura->SetCharges(jumps);
7087 }
7088 }
7089 }
7090
7091 target->CastCustomSpell(target, SPELL_PRAYER_OF_MENDING_HEAL, &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
7092}
Definition GridNotifiers.h:1541
Definition GridNotifiers.h:429

References Unit::CastCustomSpell(), Unit::CastSpell(), SpellInfo::Effects, GetAmount(), Unit::GetAura(), GetBase(), GetCaster(), GetCasterGUID(), Aura::GetCharges(), GetEffIndex(), GetId(), GetSpellInfo(), AuraApplication::GetTarget(), LOG_DEBUG, Aura::SetCharges(), Aura::SetUsingCharges(), SPELLFAMILY_PRIEST, and Cell::VisitObjects().

Referenced by HandleProc().

◆ HandleRangedAmmoHaste()

void AuraEffect::HandleRangedAmmoHaste ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4871{
4873 return;
4874
4875 Unit* target = aurApp->GetTarget();
4876
4877 if (!target->IsPlayer())
4878 return;
4879
4880 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
4881}

References Unit::ApplyAttackTimePercentMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Object::IsPlayer(), and RANGED_ATTACK.

◆ HandleShapeshiftBoosts()

void AuraEffect::HandleShapeshiftBoosts ( Unit *  target,
bool  apply 
) const
1369{
1370 uint32 spellId = 0;
1371 uint32 spellId2 = 0;
1372 //uint32 spellId3 = 0;
1373 uint32 HotWSpellId = 0;
1374
1375 switch (GetMiscValue())
1376 {
1377 case FORM_CAT:
1378 spellId = 3025;
1379 HotWSpellId = 24900;
1380 break;
1381 case FORM_TREE:
1382 spellId = 34123;
1383 break;
1384 case FORM_TRAVEL:
1385 spellId = 5419;
1386 break;
1387 case FORM_AQUA:
1388 spellId = 5421;
1389 break;
1390 case FORM_BEAR:
1391 spellId = 1178;
1392 spellId2 = 21178;
1393 HotWSpellId = 24899;
1394 break;
1395 case FORM_DIREBEAR:
1396 spellId = 9635;
1397 spellId2 = 21178;
1398 HotWSpellId = 24899;
1399 break;
1400 case FORM_BATTLESTANCE:
1401 spellId = 21156;
1402 break;
1404 spellId = 7376;
1405 break;
1407 spellId = 7381;
1408 break;
1409 case FORM_MOONKIN:
1410 spellId = 24905;
1411 spellId2 = 69366;
1412 break;
1413 case FORM_FLIGHT:
1414 spellId = 33948;
1415 spellId2 = 34764;
1416 break;
1417 case FORM_FLIGHT_EPIC:
1418 spellId = 40122;
1419 spellId2 = 40121;
1420 break;
1421 case FORM_METAMORPHOSIS:
1422 spellId = 54817;
1423 spellId2 = 54879;
1424 break;
1426 spellId = 27792;
1427 spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
1428 break;
1429 case FORM_SHADOW:
1430 spellId = 49868;
1431 spellId2 = 71167;
1432 break;
1433 case FORM_GHOSTWOLF:
1434 spellId = 67116;
1435 break;
1436 case FORM_GHOUL:
1437 case FORM_AMBIENT:
1438 case FORM_STEALTH:
1439 case FORM_CREATURECAT:
1440 case FORM_CREATUREBEAR:
1441 break;
1442 default:
1443 break;
1444 }
1445
1446 Player* player = target->ToPlayer();
1447 if (apply)
1448 {
1449 // Remove cooldown of spells triggered on stance change - they may share cooldown with stance spell
1450 if (spellId)
1451 {
1452 if (player)
1453 player->RemoveSpellCooldown(spellId);
1454 target->CastSpell(target, spellId, true, nullptr, this, target->GetGUID());
1455 }
1456
1457 if (spellId2)
1458 {
1459 if (player)
1460 player->RemoveSpellCooldown(spellId2);
1461 target->CastSpell(target, spellId2, true, nullptr, this, target->GetGUID());
1462 }
1463
1464 if (player)
1465 {
1466 PlayerSpellMap const& sp_list = player->GetSpellMap();
1467 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
1468 {
1469 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(player->GetActiveSpec()))
1470 continue;
1471
1472 if (itr->first == spellId || itr->first == spellId2)
1473 continue;
1474
1475 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1477 continue;
1478
1479 if (spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1480 target->CastSpell(target, itr->first, true, nullptr, this, target->GetGUID());
1481 }
1482
1483 // xinef: talent stance auras are not on m_spells map, so iterate talents
1484 PlayerTalentMap const& tl_list = player->GetTalentMap();
1485 for (PlayerTalentMap::const_iterator itr = tl_list.begin(); itr != tl_list.end(); ++itr)
1486 {
1487 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(player->GetActiveSpec()))
1488 continue;
1489
1490 if (itr->first == spellId || itr->first == spellId2)
1491 continue;
1492
1493 // Xinef: skip talents with effect learn spell
1494 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1496 continue;
1497
1498 if (spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1499 target->CastSpell(target, itr->first, true, nullptr, this, target->GetGUID());
1500 }
1501
1502 // Also do it for Glyphs
1503 for (uint32 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
1504 {
1505 if (uint32 glyphId = player->GetGlyph(i))
1506 {
1507 if (GlyphPropertiesEntry const* glyph = sGlyphPropertiesStore.LookupEntry(glyphId))
1508 {
1509 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(glyph->SpellId);
1511 continue;
1512 if (spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1513 target->CastSpell(target, glyph->SpellId, TriggerCastFlags(TRIGGERED_FULL_MASK & ~(TRIGGERED_IGNORE_SHAPESHIFT | TRIGGERED_IGNORE_CASTER_AURASTATE)), nullptr, this, target->GetGUID());
1514 }
1515 }
1516 }
1517
1518 // Leader of the Pack
1519 if (player->HasTalent(17007, player->GetActiveSpec()))
1520 {
1521 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(24932);
1522 if (spellInfo && spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1523 target->CastSpell(target, 24932, true, nullptr, this, target->GetGUID());
1524 }
1525 // Improved Barkskin - apply/remove armor bonus due to shapeshift
1526 if (player->HasTalent(63410, player->GetActiveSpec()) || player->HasTalent(63411, player->GetActiveSpec()))
1527 {
1528 target->RemoveAurasDueToSpell(66530);
1529 if (GetMiscValue() == FORM_TRAVEL || GetMiscValue() == FORM_NONE) // "while in Travel Form or while not shapeshifted"
1530 target->CastSpell(target, 66530, true);
1531 }
1532 // Heart of the Wild
1533 if (HotWSpellId)
1534 {
1535 // hacky, but the only way as spell family is not SPELLFAMILY_DRUID
1537 for (Unit::AuraEffectList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i)
1538 {
1539 // Heart of the Wild
1540 if ((*i)->GetSpellInfo()->SpellIconID == 240 && (*i)->GetMiscValue() == STAT_INTELLECT)
1541 {
1542 int32 HotWMod = (*i)->GetAmount() / 2; // For each 2% Intelligence, you get 1% stamina and 1% attack power.
1543
1544 target->CastCustomSpell(target, HotWSpellId, &HotWMod, nullptr, nullptr, true, nullptr, this, target->GetGUID());
1545 break;
1546 }
1547 }
1548 }
1549 switch (GetMiscValue())
1550 {
1551 case FORM_CAT:
1552 // Savage Roar
1553 if (target->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, 0, 0x10000000, 0))
1554 target->CastSpell(target, 62071, true);
1555 // Nurturing Instinct
1557 {
1558 uint32 spellId3 = 0;
1559 switch (aurEff->GetId())
1560 {
1561 case 33872:
1562 spellId3 = 47179;
1563 break;
1564 case 33873:
1565 spellId3 = 47180;
1566 break;
1567 }
1568 target->CastSpell(target, spellId3, true, nullptr, this, target->GetGUID());
1569 }
1570 // Master Shapeshifter - Cat
1571 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1572 {
1573 int32 bp = aurEff->GetAmount();
1574 target->CastCustomSpell(target, 48420, &bp, nullptr, nullptr, true);
1575 }
1576 break;
1577 case FORM_DIREBEAR:
1578 case FORM_BEAR:
1579 // Master Shapeshifter - Bear
1580 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1581 {
1582 int32 bp = aurEff->GetAmount();
1583 target->CastCustomSpell(target, 48418, &bp, nullptr, nullptr, true);
1584 }
1585 // Survival of the Fittest
1587 {
1588 int32 bp = aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue();
1589 target->CastCustomSpell(target, 62069, &bp, nullptr, nullptr, true, 0, this, target->GetGUID());
1590 }
1591 break;
1592 case FORM_MOONKIN:
1593 // Master Shapeshifter - Moonkin
1594 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1595 {
1596 int32 bp = aurEff->GetAmount();
1597 target->CastCustomSpell(target, 48421, &bp, nullptr, nullptr, true);
1598 }
1599 // Always cast Moonkin Aura
1600 target->CastSpell(target, 24907, true, nullptr, this, target->GetGUID());
1601 break;
1602 // Master Shapeshifter - Tree of Life
1603 case FORM_TREE:
1604 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1605 {
1606 int32 bp = aurEff->GetAmount();
1607 target->CastCustomSpell(target, 48422, &bp, nullptr, nullptr, true);
1608 }
1609 break;
1610 }
1611 }
1612 }
1613 else
1614 {
1615 if (spellId)
1616 target->RemoveOwnedAura(spellId);
1617 if (spellId2)
1618 target->RemoveOwnedAura(spellId2);
1619
1620 // Improved Barkskin - apply/remove armor bonus due to shapeshift
1621 if (player)
1622 {
1623 if (player->HasTalent(63410, player->GetActiveSpec()) || player->HasTalent(63411, player->GetActiveSpec()))
1624 {
1625 target->RemoveAurasDueToSpell(66530);
1626 target->CastSpell(target, 66530, true);
1627 }
1628 }
1629
1631 AuraEffect* newAura = nullptr;
1632 // Iterate through all the shapeshift auras that the target has, if there is another aura with SPELL_AURA_MOD_SHAPESHIFT, then this aura is being removed due to that one being applied
1633 for (Unit::AuraEffectList::const_iterator itr = shapeshifts.begin(); itr != shapeshifts.end(); ++itr)
1634 {
1635 if ((*itr) != this)
1636 {
1637 newAura = *itr;
1638 break;
1639 }
1640 }
1641
1642 // Use the new aura to see on what stance the target will be
1643 uint32 newStance = (1 << ((newAura ? newAura->GetMiscValue() : 0) - 1));
1644
1645 Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
1646 for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
1647 {
1648 // If the stances are not compatible with the spell, remove it
1649 // Xinef: Remove all passive auras, they will be added if needed
1650 if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && (!(itr->second->GetBase()->GetSpellInfo()->Stances & newStance) || itr->second->GetBase()->IsPassive()))
1651 target->RemoveAura(itr);
1652 else
1653 ++itr;
1654 }
1655
1656 // Xinef: Remove autoattack spells
1657 if (Spell* spell = target->GetCurrentSpell(CURRENT_MELEE_SPELL))
1658 if (spell->GetSpellInfo()->CheckShapeshift(newAura ? newAura->GetMiscValue() : 0) != SPELL_CAST_OK)
1659 spell->cancel(true);
1660 }
1661}
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
@ EFFECT_2
Definition SharedDefines.h:33
@ SPELL_EFFECT_LEARN_SPELL
Definition SharedDefines.h:802
#define MAX_GLYPH_SLOT_INDEX
Definition SharedDefines.h:664
SpellAttr0
Definition SharedDefines.h:369
@ SPELL_ATTR0_PASSIVE
Definition SharedDefines.h:376
@ SPELL_ATTR0_DO_NOT_DISPLAY
Definition SharedDefines.h:377
@ STAT_INTELLECT
Definition SharedDefines.h:249
@ SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
Definition SpellAuraDefines.h:238
@ TRIGGERED_IGNORE_CASTER_AURASTATE
Will ignore shapeshift checks.
Definition SpellDefines.h:153
@ TRIGGERED_IGNORE_SHAPESHIFT
Will not adjust facing to target (if any)
Definition SpellDefines.h:152
uint32 GetGlyph(uint8 slot) const
Definition Player.h:1794
bool HasTalent(uint32 spell_id, uint8 spec) const
Definition Player.cpp:4066
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:3704
uint32 Stances
Definition SpellInfo.h:357
bool HasEffect(SpellEffects effect) const
Definition SpellInfo.cpp:889
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4763
Definition DBCStructure.h:1060

References Unit::CastCustomSpell(), Unit::CastSpell(), CURRENT_MELEE_SPELL, EFFECT_2, FORM_AMBIENT, FORM_AQUA, FORM_BATTLESTANCE, FORM_BEAR, FORM_BERSERKERSTANCE, FORM_CAT, FORM_CREATUREBEAR, FORM_CREATURECAT, FORM_DEFENSIVESTANCE, FORM_DIREBEAR, FORM_FLIGHT, FORM_FLIGHT_EPIC, FORM_GHOSTWOLF, FORM_GHOUL, FORM_METAMORPHOSIS, FORM_MOONKIN, FORM_NONE, FORM_SHADOW, FORM_SPIRITOFREDEMPTION, FORM_STEALTH, FORM_TRAVEL, FORM_TREE, Player::GetActiveSpec(), Unit::GetAppliedAuras(), Unit::GetAuraEffect(), Unit::GetAuraEffectsByType(), Unit::GetCurrentSpell(), Unit::GetDummyAuraEffect(), Player::GetGlyph(), Object::GetGUID(), GetMiscValue(), Player::GetSpellMap(), Player::GetTalentMap(), SpellInfo::HasAttribute(), SpellInfo::HasEffect(), Player::HasTalent(), MAX_GLYPH_SLOT_INDEX, PLAYERSPELL_REMOVED, Unit::RemoveAura(), Unit::RemoveAurasDueToSpell(), Unit::RemoveOwnedAura(), Player::RemoveSpellCooldown(), sGlyphPropertiesStore, SPELL_ATTR0_DO_NOT_DISPLAY, SPELL_ATTR0_PASSIVE, SPELL_AURA_DUMMY, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELL_CAST_OK, SPELL_EFFECT_LEARN_SPELL, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, sSpellMgr, SpellInfo::Stances, STAT_INTELLECT, Object::ToPlayer(), TRIGGERED_FULL_MASK, TRIGGERED_IGNORE_CASTER_AURASTATE, and TRIGGERED_IGNORE_SHAPESHIFT.

Referenced by HandleAuraModShapeshift().

◆ HandleShieldBlockValue()

void AuraEffect::HandleShieldBlockValue ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5075{
5077 return;
5078
5079 Player* target = aurApp->GetTarget()->ToPlayer();
5080 if (!target)
5081 return;
5082
5083 target->HandleBaseModFlatValue(SHIELD_BLOCK_VALUE, float(GetAmount()), apply);
5084}
@ SHIELD_BLOCK_VALUE
Definition Unit.h:193
void HandleBaseModFlatValue(BaseModGroup modGroup, float amount, bool apply)
Definition Player.cpp:5114

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Player::HandleBaseModFlatValue(), SHIELD_BLOCK_VALUE, and Object::ToPlayer().

◆ HandleShieldBlockValuePercent()

void AuraEffect::HandleShieldBlockValuePercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5087{
5089 return;
5090
5091 Player* target = aurApp->GetTarget()->ToPlayer();
5092 if (!target)
5093 return;
5094
5095 if (apply)
5097 else
5098 {
5100 target->SetBaseModPctValue(SHIELD_BLOCK_VALUE, amount);
5101 }
5102}
@ SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
Definition SpellAuraDefines.h:213
void SetBaseModPctValue(BaseModGroup modGroup, float val)
Definition Player.cpp:5149
void ApplyBaseModPctValue(BaseModGroup modGroup, float pct)
Definition Player.cpp:5127

References Player::ApplyBaseModPctValue(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplier(), Player::SetBaseModPctValue(), SHIELD_BLOCK_VALUE, SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT, and Object::ToPlayer().

◆ HandleSpiritOfRedemption()

void AuraEffect::HandleSpiritOfRedemption ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1888{
1889 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1890 return;
1891
1892 Unit* target = aurApp->GetTarget();
1893
1894 if (!target->IsPlayer())
1895 return;
1896
1897 // prepare spirit state
1898 if (apply)
1899 {
1900 // disable breath/etc timers
1901 target->ToPlayer()->StopMirrorTimers();
1902
1903 // set stand state (expected in this form)
1904 if (!target->IsStandState())
1906
1907 target->SetHealth(1);
1908 }
1909 // die at aura end
1910 else if (target->IsAlive())
1911 // call functions which may have additional effects after chainging state of unit
1913
1914 // xinef: damage immunity spell, not needed because of 93 aura (adds non_attackable state)
1915 // xinef: probably blizzard added it just in case in wotlk (id > 46000)
1916 if (apply)
1917 target->CastSpell(target, 62371, true);
1918 else
1919 target->RemoveAurasDueToSpell(62371);
1920}
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:35
void StopMirrorTimers()
Definition Player.h:2088
virtual void setDeathState(DeathState s, bool despawn=false)
Definition Unit.cpp:11182
bool IsStandState() const
Definition Unit.cpp:12786
void SetStandState(uint8 state)
Definition Unit.cpp:12801

References AURA_EFFECT_HANDLE_REAL, Unit::CastSpell(), AuraApplication::GetTarget(), Unit::IsAlive(), Object::IsPlayer(), Unit::IsStandState(), JustDied, Unit::RemoveAurasDueToSpell(), Unit::setDeathState(), Unit::SetHealth(), Unit::SetStandState(), Player::StopMirrorTimers(), Object::ToPlayer(), and UNIT_STAND_STATE_STAND.

◆ HandleUnused()

void AuraEffect::HandleUnused ( AuraApplication const *  ,
uint8  ,
bool   
) const
inline
159 {
160 // useless
161 }

◆ HandleWaterBreathing()

void AuraEffect::HandleWaterBreathing ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3547{
3549 return;
3550
3551 Unit* target = aurApp->GetTarget();
3552
3553 // update timers in client
3554 if (target->IsPlayer())
3555 target->ToPlayer()->UpdateMirrorTimers();
3556}
void UpdateMirrorTimers()
Definition PlayerUpdates.cpp:428

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, AuraApplication::GetTarget(), Object::IsPlayer(), Object::ToPlayer(), and Player::UpdateMirrorTimers().

◆ HasSpellClassMask()

bool AuraEffect::HasSpellClassMask ( ) const
1106{
1107 return m_spellInfo->Effects[m_effIndex].SpellClassMask;
1108}

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

Referenced by Unit::CalcArmorReducedDamage().

◆ IsAffectedOnSpell()

◆ IsEnabled()

bool AuraEffect::IsEnabled ( ) const
inline
118{ return m_isAuraEnabled; }

References m_isAuraEnabled.

◆ IsPeriodic()

bool AuraEffect::IsPeriodic ( ) const
inline
92{ return m_isPeriodic; }

References m_isPeriodic.

Referenced by Spell::prepare().

◆ PeriodicTick()

void AuraEffect::PeriodicTick ( AuraApplication *  aurApp,
Unit *  caster 
) const
1144{
1145 // the tick's damage and spells the caster casts from its procs and scripts skip combat,
1146 // see Unit::DealDamage and Spell::prepare
1147 PreDeathAuraTickScope preDeathTick(caster, GetBase()->HasCasterDiedSinceApply(caster));
1148
1149 bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
1150 if (prevented)
1151 return;
1152
1153 Unit* target = aurApp->GetTarget();
1154
1155 // Update serverside orientation of tracking channeled auras on periodic update ticks
1156 // exclude players because can turn during channeling and shouldn't desync orientation client/server
1158 {
1159 ObjectGuid const channelGuid = caster->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT);
1160 if (!channelGuid.IsEmpty() && channelGuid != caster->GetGUID())
1161 {
1162 if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*caster, channelGuid))
1163 {
1164 caster->SetInFront(objectTarget);
1165 }
1166 }
1167 }
1168
1169 switch (GetAuraType())
1170 {
1172 HandlePeriodicDummyAuraTick(target, caster);
1173 break;
1175 HandlePeriodicTriggerSpellAuraTick(target, caster);
1176 break;
1178 // Don't actually do anything - client will trigger casts of these spells by itself
1179 break;
1182 break;
1185 HandlePeriodicDamageAurasTick(target, caster);
1186 break;
1188 HandlePeriodicHealthLeechAuraTick(target, caster);
1189 break;
1191 HandlePeriodicHealthFunnelAuraTick(target, caster);
1192 break;
1195 HandlePeriodicHealAurasTick(target, caster);
1196 break;
1198 HandlePeriodicManaLeechAuraTick(target, caster);
1199 break;
1201 HandleObsModPowerAuraTick(target, caster);
1202 break;
1204 HandlePeriodicEnergizeAuraTick(target, caster);
1205 break;
1207 HandlePeriodicPowerBurnAuraTick(target, caster);
1208 break;
1209 default:
1210 break;
1211 }
1212}
@ SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL
Definition SharedDefines.h:421
void HandlePeriodicPowerBurnAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6878
void HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6739
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6810
void HandlePeriodicHealthFunnelAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6569
void HandlePeriodicHealAurasTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6598
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6844
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6032
void HandlePeriodicDummyAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:5975
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6459
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6307
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6273
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
Definition SpellAuras.cpp:2596
bool IsEmpty() const
Definition ObjectGuid.h:165
bool IsChanneled() const
Definition SpellInfo.cpp:1301
void SetInFront(WorldObject const *target)
Definition Unit.cpp:16145
Definition Object.h:482
WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:139

References Aura::CallScriptEffectPeriodicHandlers(), GetAuraType(), GetBase(), Object::GetGUID(), Object::GetGuidValue(), AuraApplication::GetTarget(), ObjectAccessor::GetWorldObject(), HandleObsModPowerAuraTick(), HandlePeriodicDamageAurasTick(), HandlePeriodicDummyAuraTick(), HandlePeriodicEnergizeAuraTick(), HandlePeriodicHealAurasTick(), HandlePeriodicHealthFunnelAuraTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicManaLeechAuraTick(), HandlePeriodicPowerBurnAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandlePeriodicTriggerSpellWithValueAuraTick(), SpellInfo::HasAttribute(), SpellInfo::IsChanneled(), ObjectGuid::IsEmpty(), Object::IsPlayer(), m_spellInfo, Unit::SetInFront(), SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_DUMMY, SPELL_AURA_PERIODIC_ENERGIZE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_HEALTH_FUNNEL, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_PERIODIC_MANA_LEECH, SPELL_AURA_PERIODIC_TRIGGER_SPELL, SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_POWER_BURN, and UNIT_FIELD_CHANNEL_OBJECT.

Referenced by Update().

◆ RecalculateAmount() [1/2]

◆ RecalculateAmount() [2/2]

void AuraEffect::RecalculateAmount ( Unit *  caster)
inline
77{ if (!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(caster), false); }

References CalculateAmount(), CanBeRecalculated(), and ChangeAmount().

◆ ResetPeriodic()

void AuraEffect::ResetPeriodic ( bool  resetPeriodicTimer = false)
inline
89{ if (resetPeriodicTimer) m_periodicTimer = m_amplitude; m_tickNumber = 0;}

References m_amplitude, m_periodicTimer, and m_tickNumber.

Referenced by spell_dk_death_rune::HandleProc().

◆ ResetTicks()

void AuraEffect::ResetTicks ( )
inline
90{ m_tickNumber = 0; }

References m_tickNumber.

◆ SendTickImmune()

◆ SetAmount()

◆ SetCanBeRecalculated()

void AuraEffect::SetCanBeRecalculated ( bool  val)
inline
79{ m_canBeRecalculated = val; }

References m_canBeRecalculated.

Referenced by Aura::SetLoadedState().

◆ SetCritChance()

void AuraEffect::SetCritChance ( float  crit)
inline
110{ m_critChance = crit; }

References m_critChance.

Referenced by CalculatePeriodicData().

◆ SetEnabled()

void AuraEffect::SetEnabled ( bool  enabled)
inline
119{ m_isAuraEnabled = enabled; }

References m_isAuraEnabled.

◆ SetOldAmount()

void AuraEffect::SetOldAmount ( int32  amount)
inline
117{ m_oldAmount = amount; }

References m_oldAmount.

Referenced by CalculateAmount().

◆ SetPctMods()

void AuraEffect::SetPctMods ( float  pctMods)
inline
114{ m_pctMods = pctMods; }

References m_pctMods.

◆ SetPeriodic()

void AuraEffect::SetPeriodic ( bool  isPeriodic)
inline
93{ m_isPeriodic = isPeriodic; }

References m_isPeriodic.

Referenced by spell_gen_arena_drink::UpdatePeriodic().

◆ SetPeriodicTimer()

◆ Update()

void AuraEffect::Update ( uint32  diff,
Unit *  caster 
)
927{
928 if (m_isPeriodic && (GetBase()->GetDuration() >= 0 || GetBase()->IsPassive() || GetBase()->IsPermanent()))
929 {
930 uint32 totalTicks = GetTotalTicks();
931
932 m_periodicTimer -= int32(diff);
933 while (m_periodicTimer <= 0)
934 {
935 if (!GetBase()->IsPermanent() && (m_tickNumber + 1) > totalTicks)
936 {
937 break;
938 }
939
940 ++m_tickNumber;
941
942 // update before tick (aura can be removed in TriggerSpell or PeriodicTick calls)
944 UpdatePeriodic(caster);
945
946 std::list<AuraApplication*> effectApplications;
947 GetApplicationList(effectApplications);
948 // tick on targets of effects
949 for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
950 if ((*apptItr)->HasEffect(GetEffIndex()))
951 PeriodicTick(*apptItr, caster);
952 }
953 }
954}
int32 GetTotalTicks() const
Definition SpellAuraEffects.cpp:7094
void PeriodicTick(AuraApplication *aurApp, Unit *caster) const
Definition SpellAuraEffects.cpp:1143
void UpdatePeriodic(Unit *caster)
Definition SpellAuraEffects.cpp:956

References GetApplicationList(), GetBase(), GetEffIndex(), GetTotalTicks(), m_amplitude, m_isPeriodic, m_periodicTimer, m_tickNumber, PeriodicTick(), and UpdatePeriodic().

Referenced by Aura::UpdateOwner().

◆ UpdatePeriodic()

void AuraEffect::UpdatePeriodic ( Unit *  caster)
957{
958 switch (GetAuraType())
959 {
961 switch (GetSpellInfo()->SpellFamilyName)
962 {
964 switch (GetId())
965 {
966 // Drink
967 case 430:
968 case 431:
969 case 432:
970 case 1133:
971 case 1135:
972 case 1137:
973 case 10250:
974 case 22734:
975 case 27089:
976 case 34291:
977 case 43182:
978 case 43183:
979 case 46755:
980 case 49472: // Drink Coffee
981 case 57073:
982 case 61830:
983 if (!caster || !caster->IsPlayer())
984 return;
985 // Get SPELL_AURA_MOD_POWER_REGEN aura from spell
986 if (AuraEffect* aurEff = GetBase()->GetEffect(0))
987 {
988 if (aurEff->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN)
989 {
990 m_isPeriodic = false;
991 LOG_ERROR("spells.aura.effect", "Aura {} structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId());
992 }
993 else
994 {
995 // default case - not in arena
996 if (!caster->ToPlayer()->InArena())
997 {
998 aurEff->ChangeAmount(GetAmount());
999 m_isPeriodic = false;
1000 }
1001 else
1002 {
1003 // **********************************************
1004 // This feature uses only in arenas
1005 // **********************************************
1006 // Here need increase mana regen per tick (6 second rule)
1007 // on 0 tick - 0 (handled in 2 second)
1008 // on 1 tick - 166% (handled in 4 second)
1009 // on 2 tick - 133% (handled in 6 second)
1010
1011 // Apply bonus for 1 - 4 tick
1012 switch (m_tickNumber)
1013 {
1014 case 1: // 0%
1015 aurEff->ChangeAmount(0);
1016 break;
1017 case 2: // 166%
1018 aurEff->ChangeAmount(GetAmount() * 5 / 3);
1019 break;
1020 case 3: // 133%
1021 aurEff->ChangeAmount(GetAmount() * 4 / 3);
1022 break;
1023 default: // 100% - normal regen
1024 aurEff->ChangeAmount(GetAmount());
1025 // No need to update after 4th tick
1026 m_isPeriodic = false;
1027 break;
1028 }
1029 }
1030 }
1031 }
1032 break;
1033 case 58549: // Tenacity
1034 case 59911: // Tenacity (vehicle)
1036 break;
1037 case 66020:
1038 // Get 0 effect aura
1039 if (AuraEffect* slow = GetBase()->GetEffect(0))
1040 {
1041 int32 newAmount = slow->GetAmount() + GetAmount();
1042 if (newAmount > 0)
1043 newAmount = 0;
1044 slow->ChangeAmount(newAmount);
1045 }
1046 break;
1047 default:
1048 break;
1049 }
1050 break;
1051 default:
1052 break;
1053 }
1054 default:
1055 break;
1056 }
1058}
@ SPELL_AURA_MOD_POWER_REGEN
Definition SpellAuraDefines.h:148
void RefreshDuration(bool withMods=false)
Definition SpellAuras.cpp:928
void CallScriptEffectUpdatePeriodicHandlers(AuraEffect *aurEff)
Definition SpellAuras.cpp:2616
bool InArena() const
Definition Player.cpp:12577

References Aura::CallScriptEffectUpdatePeriodicHandlers(), GetAmount(), GetAuraType(), GetBase(), GetId(), GetSpellInfo(), Player::InArena(), Object::IsPlayer(), LOG_ERROR, m_isPeriodic, m_tickNumber, Aura::RefreshDuration(), SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_GENERIC, and Object::ToPlayer().

Referenced by Update().

Friends And Related Symbol Documentation

◆ Aura::_InitEffects

void Aura::_InitEffects ( uint8  effMask,
Unit *  caster,
int32 *  baseAmount 
)
friend

◆ 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_amount

◆ m_amplitude

int32 AuraEffect::m_amplitude
private

◆ m_applyResilience

bool AuraEffect::m_applyResilience
private

Referenced by AuraEffect(), and CanApplyResilience().

◆ m_base

Aura* const AuraEffect::m_base
private

Referenced by GetBase().

◆ m_baseAmount

int32 const AuraEffect::m_baseAmount
private

Referenced by CalculateAmount(), and GetBaseAmount().

◆ m_canBeRecalculated

bool AuraEffect::m_canBeRecalculated
private

◆ m_casterLevel

uint8 AuraEffect::m_casterLevel
private

Referenced by AuraEffect(), and GetCasterLevel().

◆ m_channelData

◆ m_critChance

float AuraEffect::m_critChance
private

Referenced by GetCritChance(), and SetCritChance().

◆ m_dieSides

int32 const AuraEffect::m_dieSides
private

Referenced by GetDieSides().

◆ m_effIndex

◆ m_isAuraEnabled

bool AuraEffect::m_isAuraEnabled
private

Referenced by GetAmount(), IsEnabled(), and SetEnabled().

◆ m_isPeriodic

bool AuraEffect::m_isPeriodic
private

◆ m_isRecalculatingPassiveAuras

bool AuraEffect::m_isRecalculatingPassiveAuras = false
private

Referenced by ApplySpellMod().

◆ m_oldAmount

int32 AuraEffect::m_oldAmount
private

Referenced by GetOldAmount(), and SetOldAmount().

◆ m_pctMods

float AuraEffect::m_pctMods
private

◆ m_periodicTimer

int32 AuraEffect::m_periodicTimer
private

◆ m_spellInfo

◆ m_spellmod

SpellModifier* AuraEffect::m_spellmod
private

◆ m_tickNumber


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