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

#include "SpellAuraEffects.h"

Public Member Functions

UnitGetCaster () const
 
ObjectGuid GetCasterGUID () const
 
AuraGetBase () const
 
void GetTargetList (std::list< Unit * > &targetList) const
 
void GetApplicationList (std::list< AuraApplication * > &applicationList) const
 
SpellModifierGetSpellModifier () 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)
 
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
 
ChannelTargetDatam_channelData
 
SpellModifierm_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)
 
AuraUnit::_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:136
SpellModifier * m_spellmod
Definition SpellAuraEffects.h:138

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:558
@ UNIT_FIELD_CHANNEL_OBJECT
Definition UpdateFields.h:93
int32 m_periodicTimer
Definition SpellAuraEffects.h:140
bool m_canBeRecalculated
Definition SpellAuraEffects.h:145
uint8 const m_effIndex
Definition SpellAuraEffects.h:144
uint8 m_casterLevel
Definition SpellAuraEffects.h:128
bool m_applyResilience
Definition SpellAuraEffects.h:127
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:133
int32 CalculateAmount(Unit *caster)
Definition SpellAuraEffects.cpp:452
int32 m_amount
Definition SpellAuraEffects.h:129
float m_pctMods
Definition SpellAuraEffects.h:131
int32 m_amplitude
Definition SpellAuraEffects.h:141
void CalculatePeriodicData()
Definition SpellAuraEffects.cpp:584
uint32 m_tickNumber
Definition SpellAuraEffects.h:142
int32 const m_baseAmount
Definition SpellAuraEffects.h:124
SpellInfo const *const m_spellInfo
Definition SpellAuraEffects.h:123
bool m_isAuraEnabled
Definition SpellAuraEffects.h:134
bool m_isPeriodic
Definition SpellAuraEffects.h:146
int32 const m_dieSides
Definition SpellAuraEffects.h:125
float m_critChance
Definition SpellAuraEffects.h:130
Aura *const m_base
Definition SpellAuraEffects.h:121
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:100
ObjectGuid GetGuidValue(uint16 index) const
Definition Object.cpp:330
Definition Spell.h:298
bool CanApplyResilience() const
Definition Unit.h:1172
uint8 GetLevel() const
Definition Unit.h:1104
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1577
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:1637
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:88
@ SPELLMOD_ALL_EFFECTS
Definition SpellDefines.h:84
@ SPELLMOD_EFFECT3
Definition SpellDefines.h:99
@ SPELLMOD_EFFECT1
Definition SpellDefines.h:79
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:147
Definition SpellAuras.h:87
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:105
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:176
bool IsPassive() const
Definition SpellAuras.cpp:1033
bool IsPermanent() const
Definition SpellAuras.h:139
Definition ObjectGuid.h:121
bool IsPlayer() const
Definition Object.h:201
Player * ToPlayer()
Definition Object.h:202
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:114
Definition Pet.h:41
Pet * GetPet() const
Definition Player.cpp:9132
void AddSpellMod(SpellModifier *mod, bool apply)
Definition Player.cpp:10078
SpellCastResult CheckShapeshift(uint32 form) const
Definition SpellInfo.cpp:1444
bool IsAffectedBySpellMod(SpellModifier const *mod) const
Definition SpellInfo.cpp:1344
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1956
boost::container::flat_multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:674
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1384

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
1074{
1075 float critChance = 0.0f;
1076 if (caster)
1077 {
1078 if (Player* modOwner = caster->GetSpellModOwner())
1079 {
1080 Unit::AuraEffectList const& mPeriodicCritAuras = modOwner->GetAuraEffectsByType(SPELL_AURA_ABILITY_PERIODIC_CRIT);
1081 for (Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr)
1082 {
1083 if ((*itr)->IsAffectedOnSpell(GetSpellInfo()))
1084 {
1085 critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), (GetSpellInfo()->DmgClass == SPELL_DAMAGE_CLASS_RANGED ? RANGED_ATTACK : BASE_ATTACK), true);
1086 break;
1087 }
1088 }
1089
1090 switch (GetSpellInfo()->SpellFamilyName)
1091 {
1092 // Rupture - since 3.3.3 can crit
1093 case SPELLFAMILY_ROGUE:
1094 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100000)
1095 critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), BASE_ATTACK, true);
1096 break;
1097 }
1098 }
1099 }
1100 if (target && critChance > 0.0f)
1101 critChance = target->SpellTakenCritChance(caster, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), critChance, BASE_ATTACK, true);
1102
1103 return std::max(0.0f, critChance);
1104}
@ 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:216
@ RANGED_ATTACK
Definition Unit.h:218
SpellInfo const * GetSpellInfo() const
Definition SpellAuraEffects.h:54
Definition Player.h:1086
flag96 SpellFamilyFlags
Definition SpellInfo.h:412
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1894
uint32 DmgClass
Definition SpellInfo.h:413
uint32 SpellFamilyName
Definition SpellInfo.h:411
std::vector< AuraEffect * > AuraEffectList
Definition Unit.h:681
Player * GetSpellModOwner() const
Definition Unit.cpp:12938

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:1838
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition DBCStructure.h:1207
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:1730
@ 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:217
@ DOT
Definition Unit.h:257
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:256
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:2514
uint8 GetStackAmount() const
Definition SpellAuras.h:148
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:902
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1429
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:9561
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:8743
Definition DBCStructure.h:1219
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > AllocationPct
Definition DBCStructure.h:1225
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
Definition DBCStructure.h:1224
uint32 InventoryType
Definition ItemTemplate.h:632
Definition DBCStructure.h:1841
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1847

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:95
@ UNIT_MOD_CAST_SPEED
Definition UpdateFields.h:137
int32 GetDuration() const
Definition SpellAuras.h:133
void SetDuration(int32 duration, bool withMods=false)
Definition SpellAuras.cpp:815
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
Definition SpellAuras.cpp:2528
float GetFloatValue(uint16 index) const
Definition Object.cpp:310
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
Definition Player.cpp:9996
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:441
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition Unit.cpp:6033
bool IsTotem() const
Definition Unit.h:800

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:1073
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:9475
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:8415

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:75
int32 GetAmount() const
Definition SpellAuraEffects.h:64
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
Definition SpellAuras.cpp:2542
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_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
1197{
1198 bool result = GetBase()->CallScriptCheckEffectProcHandlers(this, aurApp, eventInfo);
1199 if (!result)
1200 return false;
1201
1202 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
1203 switch (GetAuraType())
1204 {
1210 {
1211 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
1212 if (!damageInfo || !damageInfo->GetDamage())
1213 return false;
1214
1215 // Spell own damage at apply won't break CC
1216 if (spellInfo && spellInfo == GetSpellInfo())
1217 {
1218 Aura* aura = GetBase();
1219 // called from spellcast, should not have ticked yet
1220 if (aura->GetDuration() == aura->GetMaxDuration())
1221 return false;
1222 }
1223 break;
1224 }
1227 // compare mechanic
1228 if (!spellInfo || !(spellInfo->GetAllEffectsMechanicMask() & (1ULL << GetMiscValue())))
1229 return false;
1230 break;
1232 // skip melee hits and instant cast spells
1233 if (!eventInfo.GetProcSpell() || !eventInfo.GetProcSpell()->GetCastTime())
1234 return false;
1235 break;
1238 {
1239 // Skip melee hits and spells with wrong school or zero cost
1240 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue())
1241 || !spellInfo->ManaCost || !spellInfo->ManaCostPercentage)
1242 return false;
1243 break;
1244 }
1246 // Skip melee hits and spells with wrong school
1247 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue()))
1248 return false;
1249 break;
1251 // Compare casters
1252 if (GetCasterGUID() != eventInfo.GetActor()->GetGUID())
1253 return false;
1254 break;
1257 {
1258 // Don't proc extra attacks while already processing extra attack spell
1259 uint32 triggerSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1260 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
1261 {
1262 if (triggeredSpellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
1263 {
1264 uint32 lastExtraAttackSpell = eventInfo.GetActor()->GetLastExtraAttackSpell();
1265
1266 // Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
1267 if (lastExtraAttackSpell == triggerSpellId)
1268 return false;
1269
1270 // Patch 2.2.0 Sword Specialization (Warrior, Rogue) extra attack can no longer proc additional extra attacks
1271 // 3.3.5 Sword Specialization (Warrior), Hack and Slash (Rogue)
1272 if (lastExtraAttackSpell == SPELL_SWORD_SPECIALIZATION || lastExtraAttackSpell == SPELL_HACK_AND_SLASH)
1273 return false;
1274 }
1275 }
1276 break;
1277 }
1278 default:
1279 break;
1280 }
1281
1282 return result;
1283}
@ 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_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:847
@ SPELL_HACK_AND_SLASH
Definition Unit.h:299
@ SPELL_SWORD_SPECIALIZATION
Definition Unit.h:298
ObjectGuid GetCasterGUID() const
Definition SpellAuraEffects.h:48
int32 GetMaxDuration() const
Definition SpellAuras.h:129
bool CallScriptCheckEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2646
Definition Unit.h:337
uint32 GetDamage() const
Definition Unit.h:373
Spell const * GetProcSpell() const
Definition Unit.h:469
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:301
Unit * GetActor()
Definition Unit.h:460
DamageInfo * GetDamageInfo() const
Definition Unit.h:470
Definition SpellInfo.h:340
uint64 GetAllEffectsMechanicMask() const
Definition SpellInfo.cpp:1899
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:1011

References Aura::CallScriptCheckEffectProcHandlers(), 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_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?
1324{
1325 uint32 tSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1326 if (!tSpellId)
1327 return;
1328
1329 SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
1330 if (!tProto)
1331 return;
1332
1333 if (tProto->GetDuration() != -1)
1334 return;
1335
1336 // needed for spell 43680, maybe others
1340 return;
1341
1342 target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
1343}
int32 GetDuration() const
Definition SpellInfo.cpp:2738
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:5165

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_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_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_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(), Unit::ModSpellDuration(), 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
59{ return m_amplitude; }

References m_amplitude.

Referenced by spell_igb_rocket_pack_aura::HandleRemove().

◆ 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:182
std::map< ObjectGuid, AuraApplication * > ApplicationMap
Definition SpellAuras.h:90

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_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_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
5102{
5103 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5104 return;
5105
5106 Unit* target = aurApp->GetTarget();
5107
5108 if (apply)
5110 else
5111 {
5112 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5113 if (target->HasAuraType(GetAuraType()))
5114 return;
5116 }
5117}
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
@ UNIT_FLAG_PREPARATION
Definition UnitDefines.h:262
Definition Unit.h:665
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:6000
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:749
ObjectGuid GetTarget() const
Definition Unit.h:862
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:750

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
3431{
3433 return;
3434
3435 Unit* target = aurApp->GetTarget();
3436
3437 if (!apply)
3438 {
3439 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3440 if (target->HasAuraType(GetAuraType()) || target->HasIncreaseMountedFlightSpeedAura())
3441 return;
3442 }
3443
3444 target->SetCanFly(apply);
3445
3446 if (!apply && target->IsCreature() && !target->IsLevitating())
3447 target->GetMotionMaster()->MoveFall();
3448}
@ 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:698
bool IsCreature() const
Definition Object.h:205
MotionMaster * GetMotionMaster()
Definition Unit.h:1757
bool IsLevitating() const
Definition Unit.h:1710
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:16542
bool HasIncreaseMountedFlightSpeedAura() const
Definition Unit.h:1829

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
3209{
3211 return;
3212
3213 Unit* target = aurApp->GetTarget();
3214
3215 if (target->IsPlayer())
3216 {
3217 if (apply)
3219 else
3220 {
3221 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3222 if (target->HasAllowOnlyAbilityAura())
3223 return;
3225 }
3226 }
3227}
@ 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:1817

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
2904{
2906 return;
2907
2908 Unit* target = aurApp->GetTarget();
2909
2910 if (apply)
2911 {
2912 Unit* caster = GetCaster();
2913 if (!caster || caster == target)
2914 return;
2915
2916 // What must be cloned? at least display and scale
2917 target->SetDisplayId(caster->GetDisplayId());
2919 }
2920 else
2921 {
2922 target->SetDisplayId(target->GetNativeDisplayId());
2924 }
2925}
@ UNIT_FLAG2_MIRROR_IMAGE
Definition UnitDefines.h:300
virtual void SetDisplayId(uint32 modelId, float displayScale=1.f)
Definition Unit.cpp:13138
void SetUnitFlag2(UnitFlags2 flags)
Definition Unit.h:755
uint32 GetDisplayId() const
Definition Unit.h:1973
uint32 GetNativeDisplayId() const
Definition Unit.h:1975
void RemoveUnitFlag2(UnitFlags2 flags)
Definition Unit.h:756

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

3781{
3783 return;
3784
3785 Unit* target = aurApp->GetTarget();
3786
3787 if (!target->IsVehicle())
3788 return;
3789
3790 Unit* caster = GetCaster();
3791
3792 if (!caster || caster == target)
3793 return;
3794
3795 if (apply)
3796 {
3797 // Currently spells that have base points 0 and DieSides 0 = "0/0" exception are pushed to -1,
3798 // however the idea of 0/0 is to ingore flag VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT and -1 checks for it,
3799 // so this break such spells or most of them.
3800 // Current formula about m_amount: effect base points + dieside - 1
3801 // TO DO: Reasearch more about 0/0 and fix it.
3802 caster->_EnterVehicle(target->GetVehicleKit(), m_amount - 1, aurApp);
3803 }
3804 else
3805 {
3806 caster->_ExitVehicle();
3807 // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
3808 caster->RemoveAurasDueToSpell(GetId());
3809 }
3810}
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK
Definition SpellAuraDefines.h:49
bool IsVehicle() const
Definition Unit.h:801
void _ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:15718
void _EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:15600
Vehicle * GetVehicleKit() const
Definition Unit.h:1924

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
5767{
5768 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5769 return;
5770
5771 Unit* target = aurApp->GetTarget();
5772
5773 if (!target->IsPlayer())
5774 return;
5775
5776 Player* player = target->ToPlayer();
5777
5779 return;
5780
5781 uint32 runes = m_amount;
5782 // convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb
5783 if (apply)
5784 {
5785 for (uint32 i = 0; i < MAX_RUNES && runes; ++i)
5786 {
5787 if (GetMiscValue() != player->GetCurrentRune(i))
5788 continue;
5789 if (!player->GetRuneCooldown(i))
5790 {
5791 player->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
5792 --runes;
5793 }
5794 }
5795 }
5796 else
5797 player->RemoveRunesByAuraEffect(this);
5798}
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:13694
uint32 GetRuneCooldown(uint8 index) const
Definition Player.h:2556
void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const *aura)
Definition Player.h:2567
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition Player.cpp:1348
RuneType GetCurrentRune(uint8 index) const
Definition Player.h:2555

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
5160{
5162 return;
5163
5164 Unit* target = aurApp->GetTarget();
5165
5166 Unit* caster = GetCaster();
5167
5168 if (mode & AURA_EFFECT_HANDLE_REAL)
5169 {
5170 // pet auras
5171 if (PetAura const* petSpell = sSpellMgr->GetPetAura(GetId(), m_effIndex))
5172 {
5173 if (apply)
5174 target->AddPetAura(petSpell);
5175 else
5176 target->RemovePetAura(petSpell);
5177 }
5178 }
5179
5181 {
5182 // AT APPLY
5183 if (apply)
5184 {
5185 switch (GetId())
5186 {
5187 case 1515: // Tame beast
5188 // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
5189 if (caster && target->CanHaveThreatList())
5190 target->AddThreat(caster, 10.0f);
5191 break;
5192 case 34026: // kill command
5193 {
5194 Unit* pet = target->GetGuardianPet();
5195 if (!pet)
5196 break;
5197
5198 target->CastSpell(target, 34027, true, nullptr, this);
5199
5200 // set 3 stacks and 3 charges (to make all auras not disappear at once)
5201 Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
5202 Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
5203 if (owner_aura)
5204 {
5205 owner_aura->SetCharges(0);
5206 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5207 if (pet_aura)
5208 {
5209 pet_aura->SetCharges(0);
5210 pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5211 }
5212 }
5213 break;
5214 }
5215 case 37096: // Blood Elf Illusion
5216 {
5217 if (caster)
5218 {
5219 switch (caster->getGender())
5220 {
5221 case GENDER_FEMALE:
5222 caster->CastSpell(target, 37095, true, nullptr, this); // Blood Elf Disguise
5223 break;
5224 case GENDER_MALE:
5225 caster->CastSpell(target, 37093, true, nullptr, this);
5226 break;
5227 default:
5228 break;
5229 }
5230 }
5231 break;
5232 }
5233 case 55198: // Tidal Force
5234 {
5235 target->CastSpell(target, 55166, true);
5236 if (Aura* owner_aura = target->GetAura(55166))
5237 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5238 return;
5239 }
5240 case 39850: // Rocket Blast
5241 if (roll_chance_i(20)) // backfire stun
5242 target->CastSpell(target, 51581, true, nullptr, this);
5243 break;
5244 case 43873: // Headless Horseman Laugh
5245 target->PlayDistanceSound(11965);
5246 break;
5247 case 46354: // Blood Elf Illusion
5248 if (caster)
5249 {
5250 switch (caster->getGender())
5251 {
5252 case GENDER_FEMALE:
5253 caster->CastSpell(target, 46356, true, nullptr, this);
5254 break;
5255 case GENDER_MALE:
5256 caster->CastSpell(target, 46355, true, nullptr, this);
5257 break;
5258 }
5259 }
5260 break;
5261 case 46361: // Reinforced Net
5262 if (caster)
5263 target->GetMotionMaster()->MoveFall();
5264 break;
5265 case 46699: // Requires No Ammo
5266 if (target->IsPlayer())
5267 target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
5268 break;
5269 case 71563:
5270 {
5271 if (Aura* newAura = target->AddAura(71564, target))
5272 newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount);
5273 return;
5274 }
5275 }
5276 }
5277 // AT REMOVE
5278 else
5279 {
5280 if ((GetSpellInfo()->IsQuestTame()) && caster && caster->IsAlive() && target->IsAlive() && aurApp->GetRemoveMode() != AURA_REMOVE_BY_CANCEL)
5281 {
5282 uint32 finalSpelId = 0;
5283 switch (GetId())
5284 {
5285 case 19548:
5286 finalSpelId = 19597;
5287 break;
5288 case 19674:
5289 finalSpelId = 19677;
5290 break;
5291 case 19687:
5292 finalSpelId = 19676;
5293 break;
5294 case 19688:
5295 finalSpelId = 19678;
5296 break;
5297 case 19689:
5298 finalSpelId = 19679;
5299 break;
5300 case 19692:
5301 finalSpelId = 19680;
5302 break;
5303 case 19693:
5304 finalSpelId = 19684;
5305 break;
5306 case 19694:
5307 finalSpelId = 19681;
5308 break;
5309 case 19696:
5310 finalSpelId = 19682;
5311 break;
5312 case 19697:
5313 finalSpelId = 19683;
5314 break;
5315 case 19699:
5316 finalSpelId = 19685;
5317 break;
5318 case 19700:
5319 finalSpelId = 19686;
5320 break;
5321 case 30646:
5322 finalSpelId = 30647;
5323 break;
5324 case 30653:
5325 finalSpelId = 30648;
5326 break;
5327 case 30654:
5328 finalSpelId = 30652;
5329 break;
5330 case 30099:
5331 finalSpelId = 30100;
5332 break;
5333 case 30102:
5334 finalSpelId = 30103;
5335 break;
5336 case 30105:
5337 finalSpelId = 30104;
5338 break;
5339 }
5340
5341 if (finalSpelId)
5342 caster->CastSpell(target, finalSpelId, true, nullptr, this);
5343 }
5344
5346 {
5348 switch (GetId())
5349 {
5350 case 2584: // Waiting to Resurrect
5351 // Waiting to resurrect spell cancel, we must remove player from resurrect queue
5352 // bf branch omitted: it would cascade back into this handler.
5353 if (target->IsPlayer())
5354 if (Battleground* bg = target->ToPlayer()->GetBattleground())
5355 bg->RemovePlayerFromResurrectQueue(target->ToPlayer());
5356 break;
5357 case 43681: // Inactive
5358 {
5359 if (!target->IsPlayer() || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
5360 return;
5361
5362 if (target->GetMap()->IsBattleground())
5363 target->ToPlayer()->LeaveBattleground();
5364 break;
5365 }
5366 case 52172: // Coyote Spirit Despawn Aura
5367 case 60244: // Blood Parrot Despawn Aura
5368 target->CastSpell((Unit*)nullptr, GetAmount(), true, nullptr, this);
5369 break;
5370 // Halls of Lightning, Arc Lightning
5371 case 52921:
5372 {
5373 if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE )
5374 return;
5375
5376 Player* player = nullptr;
5377 Acore::AnyPlayerInObjectRangeCheck checker(target, 10.0f);
5378 Acore::PlayerSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(target, player, checker);
5379 Cell::VisitObjects(target, searcher, 10.0f);
5380
5381 if (player && player->GetGUID() != target->GetGUID())
5382 target->CastSpell(player, 52921, true);
5383
5384 return;
5385 }
5386 case 58600: // Restricted Flight Area
5387 case 58730: // Restricted Flight Area
5388 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
5389 target->CastSpell(target, 58601, true);
5390 break;
5391 case 46374: // quest The Power of the Elements (11893)
5392 {
5393 if (target->isDead() && GetBase() && target->IsCreature() && target->GetEntry() == 24601)
5394 {
5395 if (Unit* caster2 = GetBase()->GetCaster())
5396 {
5397 if (Player* player = caster2->GetCharmerOrOwnerPlayerOrPlayerItself())
5398 player->KilledMonsterCredit(25987);
5399 }
5400 }
5401 return;
5402 }
5403 }
5404 break;
5405 default:
5406 break;
5407 }
5408 }
5409 }
5410
5411 // AT APPLY & REMOVE
5412
5414 {
5416 {
5417 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5418 break;
5419 switch (GetId())
5420 {
5421 // Recently Bandaged
5422 case 11196:
5424 break;
5425 // Unstable Power
5426 case 24658:
5427 {
5428 uint32 spellId = 24659;
5429 if (apply && caster)
5430 {
5431 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
5432
5433 for (uint32 i = 0; i < spell->StackAmount; ++i)
5434 caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID());
5435 break;
5436 }
5437 target->RemoveAurasDueToSpell(spellId);
5438 break;
5439 }
5440 // Restless Strength
5441 case 24661:
5442 {
5443 uint32 spellId = 24662;
5444 if (apply && caster)
5445 {
5446 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
5447 for (uint32 i = 0; i < spell->StackAmount; ++i)
5448 caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID());
5449 break;
5450 }
5451 target->RemoveAurasDueToSpell(spellId);
5452 break;
5453 }
5454 // Tag Murloc
5455 case 30877:
5456 {
5457 // Tag/untag Blacksilt Scout
5458 target->SetEntry(apply ? 17654 : 17326);
5459 break;
5460 }
5461 case 57819: // Argent Champion
5462 case 57820: // Ebon Champion
5463 case 57821: // Champion of the Kirin Tor
5464 case 57822: // Wyrmrest Champion
5465 {
5466 if (!caster || !caster->IsPlayer())
5467 break;
5468
5469 uint32 FactionID = 0;
5470
5471 if (apply)
5472 {
5473 switch (m_spellInfo->Id)
5474 {
5475 case 57819:
5476 FactionID = 1106;
5477 break; // Argent Crusade
5478 case 57820:
5479 FactionID = 1098;
5480 break; // Knights of the Ebon Blade
5481 case 57821:
5482 FactionID = 1090;
5483 break; // Kirin Tor
5484 case 57822:
5485 FactionID = 1091;
5486 break; // The Wyrmrest Accord
5487 }
5488 }
5489 caster->ToPlayer()->SetChampioningFaction(FactionID);
5490 break;
5491 }
5492 // LK Intro VO (1)
5493 case 58204:
5494 if (target->IsPlayer())
5495 {
5496 // Play part 1
5497 if (apply)
5498 target->PlayDirectSound(14970, target->ToPlayer());
5499 // continue in 58205
5500 else
5501 target->CastSpell(target, 58205, true);
5502 }
5503 break;
5504 // LK Intro VO (2)
5505 case 58205:
5506 if (target->IsPlayer())
5507 {
5508 // Play part 2
5509 if (apply)
5510 target->PlayDirectSound(14971, target->ToPlayer());
5511 // Play part 3
5512 else
5513 target->PlayDirectSound(14972, target->ToPlayer());
5514 }
5515 break;
5516 case 62061: // Festive Holiday Mount
5517 if (target->HasMountedAura())
5518 {
5519 uint32 creatureEntry = 0;
5520 if (apply)
5521 {
5523 creatureEntry = 24906;
5524 else
5525 creatureEntry = 15665;
5526 }
5527 else
5528 creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
5529
5530 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
5531 {
5532 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
5533 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
5534
5536 }
5537 }
5538 break;
5539 case FRESH_BREWFEST_HOPS: // Festive Brewfest Mount
5540 if (target->HasMountedAura() && !target->HasIncreaseMountedFlightSpeedAura())
5541 {
5542 uint32 creatureEntry = 0;
5543
5544 if (apply)
5545 {
5546 if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
5547 {
5548 creatureEntry = GREAT_BREWFEST_KODO;
5549 }
5550 else
5551 {
5552 creatureEntry = BREWFEST_KODO;
5553 }
5554 }
5555 else
5556 {
5557 creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
5558 }
5559
5560 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
5561 {
5562 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
5563 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
5564
5566 }
5567 }
5568 break;
5569 }
5570
5571 break;
5572 }
5573 case SPELLFAMILY_MAGE:
5574 {
5575 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5576 //break;
5577 break;
5578 }
5579 case SPELLFAMILY_PRIEST:
5580 {
5581 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5582 //break;
5583 break;
5584 }
5585 case SPELLFAMILY_DRUID:
5586 {
5587 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5588 // break;
5589 break;
5590 }
5591 case SPELLFAMILY_SHAMAN:
5592 {
5593 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5594 // break;
5595 break;
5596 }
5597 }
5598}
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:942
void SetCharges(uint8 charges)
Definition SpellAuras.cpp:899
Definition Battleground.h:303
bool IsBattleground() const
Definition Map.h:304
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Definition ObjectMgr.cpp:1644
uint32 GetEntry() const
Definition Object.h:117
void SetEntry(uint32 entry)
Definition Object.h:118
Definition SpellMgr.h:467
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition PlayerQuest.cpp:1986
Battleground * GetBattleground(bool create=false) const
Definition Player.cpp:12430
void RemoveAmmo()
Definition PlayerStorage.cpp:2596
void SetChampioningFaction(uint32 faction)
Definition Player.h:2604
void LeaveBattleground(Battleground *bg=nullptr)
Definition Player.cpp:11491
uint32 StackAmount
Definition SpellInfo.h:395
uint8 getGender() const
Definition Unit.h:849
void RemovePetAura(PetAura const *petSpell)
Definition Unit.cpp:13697
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5853
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:10445
void AddPetAura(PetAura const *petSpell)
Definition Unit.cpp:13685
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition Unit.cpp:11426
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition Unit.cpp:7738
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:15113
bool HasMountedAura() const
Definition Unit.h:1798
bool IsAlive() const
Definition Unit.h:1792
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1361
float GetSpeedRate(UnitMoveType mtype) const
Definition Unit.h:1739
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:17343
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition Unit.cpp:11407
Guardian * GetGuardianPet() const
Definition Unit.cpp:7773
bool isDead() const
Definition Unit.h:1794
Map * GetMap() const
Definition Object.h:631
void PlayDirectSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:3011
void PlayDistanceSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:3003
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
5710{
5711 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5712 return;
5713
5714 Unit* target = aurApp->GetTarget();
5715
5716 if (!apply)
5717 {
5718 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5719 if (target->HasAuraType(GetAuraType()))
5720 return;
5721 }
5722
5723 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
5725}
@ 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:799
uint32 GetCreatureType() const
Definition Unit.cpp:11907

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
3473{
3475 return;
3476
3477 Unit* target = aurApp->GetTarget();
3478
3479 if (Player* targetPlayer = target->ToPlayer())
3480 {
3481 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3482 }
3483
3484 if (!apply)
3485 {
3486 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3487 if (target->HasAuraType(GetAuraType()))
3488 return;
3489 }
3490
3491 target->SetFeatherFall(apply);
3492
3493 // start fall from current height
3494 if (!apply && target->IsPlayer())
3495 target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ());
3496}
#define sScriptMgr
Definition ScriptMgr.h:743
void SetFallInformation(uint32 time, float z)
Definition Player.h:2383
void SetFeatherFall(bool enable)
Definition Unit.cpp:16578
Seconds GetGameTime()
Definition GameTime.cpp:38
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
1900{
1902 return;
1903
1904 Unit* target = aurApp->GetTarget();
1905
1906 if (!target->IsPlayer())
1907 return;
1908
1909 if (apply)
1910 {
1914 }
1915 else
1916 {
1917 if (target->HasGhostAura())
1918 return;
1919
1923 }
1924}
@ 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:399
bool HasGhostAura() const
Definition Unit.h:1797
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition Object.h:624
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:623

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

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->SetHover(apply);
3518}
void SetHover(bool enable)
Definition Unit.cpp:16619

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
4576{
4578 return;
4579
4580 Unit* target = aurApp->GetTarget();
4581
4582 if (apply)
4584 else
4585 {
4588 }
4589}
@ SPELL_AURA_MOD_BASE_HEALTH_PCT
Definition SpellAuraDefines.h:345
@ AURA_EFFECT_HANDLE_STAT
Definition SpellAuraDefines.h:46
@ UNIT_MOD_HEALTH
Definition Unit.h:155
@ BASE_PCT
Definition Unit.h:135
void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val)
Definition Unit.cpp:11987
void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount)
Definition Unit.cpp:11954
float GetTotalAuraMultiplier(AuraType auratype) const
Definition Unit.cpp:6284

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
5801{
5802 Unit* target = aurApp->GetTarget();
5803
5804 uint32 triggeredSpellId = sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->Effects[m_effIndex].TriggerSpell, target);
5805 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId);
5806 if (!triggeredSpellInfo)
5807 return;
5808
5809 if (mode & AURA_EFFECT_HANDLE_REAL)
5810 {
5811 if (apply)
5812 {
5813 Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCaster() : target;
5814
5815 if (!caster)
5816 return;
5817 // If amount avalible cast with basepoints (Crypt Fever for example)
5818 if (GetAmount())
5819 caster->CastCustomSpell(target, triggeredSpellId, &m_amount, nullptr, nullptr, true, nullptr, this);
5820 else
5821 caster->CastSpell(target, triggeredSpellId, true, nullptr, this);
5822 }
5823 else
5824 {
5825 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
5826 target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
5827 }
5828 }
5829 else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
5830 {
5831 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
5832 // change the stack amount to be equal to stack amount of our aura
5833 if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
5834 triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
5835 }
5836}
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell, uint8 effIndex=MAX_SPELL_EFFECTS) const
Definition SpellInfo.cpp:1070
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:5026
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1418

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
4891{
4893 return;
4894
4895 Unit* target = aurApp->GetTarget();
4896
4898}
@ TOTAL_VALUE
Definition Unit.h:129
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:170
bool HandleStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply)
Definition Unit.cpp:11928

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
4968{
4970 return;
4971
4972 Unit* target = aurApp->GetTarget();
4973
4974 // Recalculate bonus
4975 if (target->IsPlayer())
4976 target->ToPlayer()->UpdateAttackPowerAndDamage(false);
4977}
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
4963{
4964 HandleAuraModAttackPowerOfArmor(aurApp, mode, apply);
4965}
void HandleAuraModAttackPowerOfArmor(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4967

References HandleAuraModAttackPowerOfArmor().

◆ HandleAuraModAttackPowerPercent()

void AuraEffect::HandleAuraModAttackPowerPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4914{
4916 return;
4917
4918 Unit* target = aurApp->GetTarget();
4919
4920 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
4921 if (apply)
4923 else
4924 {
4927 }
4928}
@ SPELL_AURA_MOD_ATTACK_POWER_PCT
Definition SpellAuraDefines.h:229
@ TOTAL_PCT
Definition Unit.h:136

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
4120{
4122 return;
4123
4124 Unit* target = aurApp->GetTarget();
4125 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4126 {
4127 if (GetMiscValue() & int32(1 << x))
4128 {
4129 if (apply)
4131 else
4132 {
4135 }
4136 }
4137 }
4138}
@ 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:149
@ UNIT_MOD_RESISTANCE_START
Definition Unit.h:179
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:6309

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
4625{
4627 return;
4628
4629 Unit* target = aurApp->GetTarget();
4630
4631 if (!target->IsPlayer())
4632 return;
4633
4634 target->ToPlayer()->UpdateBlockPercentage();
4635}
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
4716{
4718 return;
4719
4720 Unit* target = aurApp->GetTarget();
4721
4722 if (!target->IsPlayer())
4723 {
4724 target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
4725 return;
4726 }
4727
4729
4730 // included in Player::UpdateSpellCritChance calculation
4732}
void UpdateAllSpellCritChances()
Definition StatSystem.cpp:889
void UpdateAllWeaponDependentCritAuras()
Definition Player.cpp:7243
int32 m_baseSpellCritChance
Definition Unit.h:2083
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
3891{
3893 return;
3894
3895 Unit* target = aurApp->GetTarget();
3896
3897 target->UpdateSpeed(MOVE_WALK, true);
3898 target->UpdateSpeed(MOVE_RUN, true);
3899 target->UpdateSpeed(MOVE_SWIM, true);
3900 target->UpdateSpeed(MOVE_FLIGHT, true);
3901 target->UpdateSpeed(MOVE_RUN_BACK, true);
3902 target->UpdateSpeed(MOVE_SWIM_BACK, true);
3903 target->UpdateSpeed(MOVE_FLIGHT_BACK, true);
3904
3905 if (Player* targetPlayer = target->ToPlayer())
3906 {
3907 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3908 }
3909}
@ 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:11100

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
3073{
3074 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3075 return;
3076
3077 Unit* target = aurApp->GetTarget();
3078
3079 AuraType type = GetAuraType();
3080
3081 //Prevent handling aura twice
3082 if ((apply) ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
3083 return;
3084
3085 uint32 field, flag, slot;
3086 WeaponAttackType attType;
3087 switch (type)
3088 {
3090 field = UNIT_FIELD_FLAGS;
3091 flag = UNIT_FLAG_DISARMED;
3093 attType = BASE_ATTACK;
3094 break;
3096 field = UNIT_FIELD_FLAGS_2;
3099 attType = OFF_ATTACK;
3100 break;
3102 field = UNIT_FIELD_FLAGS_2;
3104 slot = EQUIPMENT_SLOT_RANGED;
3105 attType = RANGED_ATTACK;
3106 break;
3107 default:
3108 return;
3109 }
3110
3111 // if disarm aura is to be removed, remove the flag first to reapply damage/aura mods
3112 if (!apply)
3113 target->RemoveFlag(field, flag);
3114
3115 // Handle damage modification, shapeshifted druids are not affected
3116 if (target->IsPlayer() && (!target->IsInFeralForm() || target->GetShapeshiftForm() == FORM_GHOSTWOLF))
3117 {
3118 Player* player = target->ToPlayer();
3119 if (Item* pItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
3120 {
3121 WeaponAttackType attackType = Player::GetAttackBySlot(slot);
3122
3123 player->ApplyItemDependentAuras(pItem, !apply);
3124 if (attackType < MAX_ATTACK)
3125 {
3126 player->_ApplyWeaponDamage(slot, pItem->GetTemplate(), nullptr, !apply);
3127 if (!apply) // apply case already handled on item dependent aura removal (if any)
3128 player->UpdateWeaponDependentAuras(attackType);
3129 }
3130 }
3131 }
3132
3133 // if disarm effects should be applied, wait to set flag until damage mods are unapplied
3134 if (apply)
3135 target->SetFlag(field, flag);
3136
3137 if (target->IsCreature() && target->ToCreature()->GetCurrentEquipmentId())
3138 target->UpdateDamagePhysical(attType);
3139}
@ 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:215
@ MAX_ATTACK
Definition Unit.h:219
@ UNIT_FIELD_FLAGS_2
Definition UpdateFields.h:118
@ UNIT_FIELD_FLAGS
Definition UpdateFields.h:117
uint8 GetCurrentEquipmentId()
Definition Creature.h:198
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:831
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:846
Creature * ToCreature()
Definition Object.h:206
void UpdateWeaponDependentAuras(WeaponAttackType attackType)
Definition Player.cpp:7249
void ApplyItemDependentAuras(Item *item, bool apply)
Definition Player.cpp:7256
void _ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply)
Definition Player.cpp:7068
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:1959

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
4062{
4063 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4064 return;
4065
4066 Unit* target = aurApp->GetTarget();
4068}
void ApplyAllSpellImmunitiesTo(Unit *target, SpellEffectInfo const *effect, bool apply) const
Definition SpellInfo.cpp:2488

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
4049{
4050 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4051 return;
4052
4053 Unit* target = aurApp->GetTarget();
4054
4056
4057 if (apply)
4058 target->GetThreatMgr().EvaluateSuppressed();
4059}
void EvaluateSuppressed(bool canExpire=false)
Definition ThreatManager.cpp:374
ThreatManager & GetThreatMgr()
Definition Unit.h:952

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
4612{
4614 return;
4615
4616 Unit* target = aurApp->GetTarget();
4617
4618 if (!target->IsPlayer())
4619 return;
4620
4621 target->ToPlayer()->UpdateDodgePercentage();
4622}
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
3951{
3952 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3953 return;
3954
3955 Unit* target = aurApp->GetTarget();
3956
3957 target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
3958
3959 // when removing flag aura, handle flag drop
3960 Player* player = target->ToPlayer();
3961 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
3962 {
3963 if (player->InBattleground())
3964 {
3965 if (Battleground* bg = player->GetBattleground())
3966 bg->EventPlayerDroppedFlag(player);
3967 }
3968 else
3969 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
3970 }
3971}
#define sOutdoorPvPMgr
Definition OutdoorPvPMgr.h:102
@ IMMUNITY_EFFECT
Definition SharedDefines.h:1398
@ AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
Definition SpellDefines.h:63
bool InBattleground() const
Definition Player.h:2298

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
4402{
4404 return;
4405
4406 Unit* target = aurApp->GetTarget();
4407
4408 if (!target->IsPlayer())
4409 return;
4410
4413}
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
5728{
5729 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5730 return;
5731
5732 Unit* target = aurApp->GetTarget();
5733
5734 if (apply)
5735 {
5736 target->SetFaction(GetMiscValue());
5737 if (target->IsPlayer())
5739 }
5740 else
5741 {
5742 target->RestoreFaction();
5743 if (target->IsPlayer())
5745 }
5746}
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition UnitDefines.h:260
void SetFaction(uint32 faction)
Definition Unit.cpp:7093
void RestoreFaction()
Definition Unit.cpp:14945

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
5855{
5857 return;
5858
5859 Player* target = aurApp->GetTarget()->ToPlayer();
5860 if (!target)
5861 return;
5862
5865}
@ PLAYER_FAKE_INEBRIATION
Definition UpdateFields.h:325
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:808
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
4503{
4505 return;
4506
4507 Unit* target = aurApp->GetTarget();
4508
4510 // do not check power type, we can always modify the maximum
4511 // as the client will not see any difference
4512 // also, placing conditions that may change during the aura duration
4513 // inside effect handlers is not a good idea
4514 //if (int32(PowerType) != GetMiscValue())
4515 // return;
4516
4517 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4518
4519 target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
4520}
std::uint16_t uint16
Definition Define.h:108
Powers
Definition SharedDefines.h:256
@ UNIT_MOD_POWER_START
Definition Unit.h:181
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
4523{
4525 return;
4526
4527 Unit* target = aurApp->GetTarget();
4528
4530 // do not check power type, we can always modify the maximum
4531 // as the client will not see any difference
4532 // also, placing conditions that may change during the aura duration
4533 // inside effect handlers is not a good idea
4534 //if (int32(PowerType) != GetMiscValue())
4535 // return;
4536
4537 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4538
4539 if (apply)
4540 {
4541 float amount = float(GetAmount());
4542 target->ApplyStatPctModifier(unitMod, TOTAL_PCT, amount);
4543 }
4544 else
4545 {
4547 target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
4548 }
4549}
@ SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
Definition SpellAuraDefines.h:195
float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6349

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.

3836{
3838 return;
3839
3840 Unit* target = aurApp->GetTarget();
3842 target->UpdateSpeed(MOVE_FLIGHT, true);
3843
3846 {
3847 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3848 if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasIncreaseMountedFlightSpeedAura() && !target->HasFlyAura())))
3849 {
3850 target->SetCanFly(apply);
3851
3852 if (!apply && target->IsCreature() && !target->IsLevitating())
3853 target->GetMotionMaster()->MoveFall();
3854 }
3855
3857 if (mode & AURA_EFFECT_HANDLE_REAL)
3858 {
3859 //Players on flying mounts must be immune to polymorph
3860 if (target->IsPlayer())
3862
3863 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3864 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountID())
3866 }
3867 }
3868
3869 if (Player* targetPlayer = target->ToPlayer())
3870 {
3871 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3872 }
3873}
@ 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:1802
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition Unit.cpp:5940
uint32 GetMountID() const
Definition Unit.h:1886

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
4458{
4460 return;
4461
4462 Unit* target = aurApp->GetTarget();
4463
4464 if (apply)
4465 {
4467 target->ModifyHealth(GetAmount());
4468 }
4469 else
4470 {
4471 if (int32(target->GetHealth()) > GetAmount())
4472 target->ModifyHealth(-GetAmount());
4473 else
4474 target->SetHealth(1);
4476 }
4477}
int32 ModifyHealth(int32 val)
Definition Unit.cpp:10950
void SetHealth(uint32 val)
Definition Unit.cpp:12328
uint32 GetHealth() const
Definition Unit.h:1109

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

◆ HandleAuraModIncreaseHealthPercent()

void AuraEffect::HandleAuraModIncreaseHealthPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4552{
4554 return;
4555
4556 Unit* target = aurApp->GetTarget();
4557
4558 // Unit will keep hp% after MaxHealth being modified if unit is alive.
4559 float percent = target->GetHealthPct();
4560
4561 if (apply)
4563 else
4564 {
4567 }
4568
4569 // Xinef: pct was rounded down and could "kill" creature by setting its health to 0 making npc zombie
4570 if (target->IsAlive())
4571 if (uint32 healthAmount = CalculatePct(target->GetMaxHealth(), percent))
4572 target->SetHealth(healthAmount);
4573}
@ 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:1111
uint32 GetMaxHealth() const
Definition Unit.h:1110

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
4480{
4482 return;
4483
4484 Unit* target = aurApp->GetTarget();
4485
4486 uint32 oldhealth = target->GetHealth();
4487 double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth();
4488
4490
4491 // refresh percentage
4492 if (oldhealth > 0)
4493 {
4494 uint32 newhealth = uint32(std::ceil((double)target->GetMaxHealth() * healthPercentage));
4495 if (newhealth == 0)
4496 newhealth = 1;
4497
4498 target->SetHealth(newhealth);
4499 }
4500}

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
3831{
3832 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3833}
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3815

References HandleAuraModIncreaseSpeed().

◆ HandleAuraModIncreaseSpeed()

void AuraEffect::HandleAuraModIncreaseSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3816{
3818 return;
3819
3820 Unit* target = aurApp->GetTarget();
3821
3822 target->UpdateSpeed(MOVE_RUN, true);
3823
3824 if (Player* targetPlayer = target->ToPlayer())
3825 {
3826 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3827 }
3828}

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
3876{
3878 return;
3879
3880 Unit* target = aurApp->GetTarget();
3881
3882 target->UpdateSpeed(MOVE_SWIM, true);
3883
3884 if (Player* targetPlayer = target->ToPlayer())
3885 {
3886 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3887 }
3888}

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
3171{
3173 return;
3174
3175 Unit* target = aurApp->GetTarget();
3176
3177 if (apply)
3178 {
3180 //target->AttackStop(); // pussywizard: why having this flag prevents from being in combat? it should just prevent melee attack
3181 }
3182 else
3183 {
3184 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3185 if (target->HasPacifyAura() || target->HasPacifySilenceAura())
3186 return;
3188 }
3189}
@ UNIT_FLAG_PACIFIED
Definition UnitDefines.h:274
bool HasPacifySilenceAura() const
Definition Unit.h:1822
bool HasPacifyAura() const
Definition Unit.h:1826

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
3192{
3194 return;
3195
3196 Unit* target = aurApp->GetTarget();
3197
3198 if (!(apply))
3199 {
3200 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3201 if (target->HasPacifySilenceAura())
3202 return;
3203 }
3204 HandleAuraModPacify(aurApp, mode, apply);
3205 HandleAuraModSilence(aurApp, mode, apply);
3206}
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3141
void HandleAuraModPacify(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3170

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
4596{
4598 return;
4599
4600 Unit* target = aurApp->GetTarget();
4601
4602 if (!target->IsPlayer())
4603 return;
4604
4605 if (!target->ToPlayer()->CanParry())
4606 target->ToPlayer()->SetCanParry(true);
4607 else
4608 target->ToPlayer()->UpdateParryPercentage();
4609}
void UpdateParryPercentage()
Definition StatSystem.cpp:753
bool CanParry() const
Definition Player.h:2213
void SetCanParry(bool value)
Definition Player.cpp:13425

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
3328{
3330 return;
3331
3332 Unit* target = aurApp->GetTarget();
3333
3334 if (!target->IsPlayer())
3335 return;
3336
3337 // Recalculate pet talent points
3338 if (Pet* pet = target->ToPlayer()->GetPet())
3339 pet->InitTalentForLevel();
3340}

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
4901{
4903 return;
4904
4905 Unit* target = aurApp->GetTarget();
4906
4907 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
4908 return;
4909
4911}
#define CLASSMASK_WAND_USERS
Definition SharedDefines.h:151
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:171
uint32 getClassMask() const
Definition Unit.h:846

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
4931{
4933 return;
4934
4935 Unit* target = aurApp->GetTarget();
4936
4937 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
4938 return;
4939
4940 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
4941 if (apply)
4943 else
4944 {
4947 }
4948}
@ 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
4829{
4831 return;
4832
4833 Unit* target = aurApp->GetTarget();
4834
4835 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
4836}
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:13435

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
4638{
4639 HandleModManaRegen(aurApp, mode, apply);
4640}
void HandleModManaRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4443

References HandleModManaRegen().

◆ HandleAuraModResistance()

void AuraEffect::HandleAuraModResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4102{
4104 return;
4105
4106 Unit* target = aurApp->GetTarget();
4107
4108 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4109 {
4110 if (GetMiscValue() & int32(1 << x))
4111 {
4113 if (target->IsPlayer() || target->IsPet())
4115 }
4116 }
4117}
std::int8_t int8
Definition Define.h:105
SpellSchools
Definition SharedDefines.h:270
bool IsPet() const
Definition Unit.h:798
void UpdateResistanceBuffModsMod(SpellSchools school)
Definition Unit.cpp:6419

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
4079{
4081 return;
4082
4083 Unit* target = aurApp->GetTarget();
4084
4085 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4086 {
4087 if (GetMiscValue() & int32(1 << x))
4088 {
4090 if (amount < GetAmount())
4091 {
4092 float value = float(GetAmount() - amount);
4094 if (target->IsPlayer() || target->IsPet())
4096 }
4097 }
4098 }
4099}
@ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
Definition SpellAuraDefines.h:206
@ BASE_VALUE
Definition Unit.h:128
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, AuraEffect const *except=nullptr) const
Definition Unit.cpp:6319

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
4380{
4382 return;
4383
4384 Unit* target = aurApp->GetTarget();
4385
4386 if (!target->IsPlayer())
4387 return;
4388
4390 {
4391 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
4392 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
4393 LOG_ERROR("spells.aura.effect", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
4394 return;
4395 }
4396
4397 // Recalculate Armor
4398 target->UpdateArmor();
4399}
#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
3644{
3645 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3646 return;
3647
3648 Unit* target = aurApp->GetTarget();
3649
3650 target->SetControlled(apply, UNIT_STATE_ROOT);
3651}
@ UNIT_STATE_ROOT
Definition UnitDefines.h:183
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:14281

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
2896{
2898 return;
2899
2900 aurApp->GetTarget()->RecalculateObjectScale();
2901}

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
3987{
3988 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3989 return;
3990
3991 Unit* target = aurApp->GetTarget();
3992
3993 target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, GetMiscValue(), (apply));
3994
3995 if (apply)
3996 target->GetThreatMgr().EvaluateSuppressed();
3997
3998 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3999 {
4000 if (apply)
4002 else
4003 {
4004 bool banishFound = false;
4005 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
4006 for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
4007 if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4008 {
4009 banishFound = true;
4010 break;
4011 }
4012 if (!banishFound)
4014 }
4015 }
4016
4017 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
4019
4020 // remove all flag auras (they are positive, but they must be removed when you are immune)
4024
4026 if ((apply)
4028 && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
4029 {
4030 uint32 school_mask = GetMiscValue();
4031 Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
4032 for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
4033 {
4034 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
4035 if ((spell->GetSchoolMask() & school_mask)//Check for school mask
4036 && GetSpellInfo()->CanDispelAura(spell)
4037 && !iter->second->IsPositive() //Don't remove positive spells
4038 && spell->Id != GetId()) //Don't remove self
4039 {
4040 target->RemoveAura(iter);
4041 }
4042 else
4043 ++iter;
4044 }
4045 }
4046}
@ 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:1371
bool IsPositive() const
Definition SpellInfo.cpp:1269
void ClearUnitState(uint32 f)
Definition Unit.h:738
void AddUnitState(uint32 f)
Definition Unit.h:736
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition Unit.cpp:5444

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
1987{
1989 return;
1990
1991 Unit* target = aurApp->GetTarget();
1992
1993 uint32 modelid = 0;
1996
1997 switch (form)
1998 {
1999 case FORM_CAT: // 0x01
2000 case FORM_GHOUL: // 0x07
2002 break;
2003
2004 case FORM_BEAR: // 0x05
2005 case FORM_DIREBEAR: // 0x08
2006
2007 case FORM_BATTLESTANCE: // 0x11
2008 case FORM_DEFENSIVESTANCE: // 0x12
2009 case FORM_BERSERKERSTANCE: // 0x13
2011 break;
2012
2013 case FORM_TREE: // 0x02
2014 case FORM_TRAVEL: // 0x03
2015 case FORM_AQUA: // 0x04
2016 case FORM_AMBIENT: // 0x06
2017
2018 case FORM_STEVES_GHOUL: // 0x09
2019 case FORM_THARONJA_SKELETON: // 0x0A
2020 case FORM_TEST_OF_STRENGTH: // 0x0B
2021 case FORM_BLB_PLAYER: // 0x0C
2022 case FORM_SHADOW_DANCE: // 0x0D
2023 case FORM_CREATUREBEAR: // 0x0E
2024 case FORM_CREATURECAT: // 0x0F
2025 case FORM_GHOSTWOLF: // 0x10
2026
2027 case FORM_TEST: // 0x14
2028 case FORM_ZOMBIE: // 0x15
2029 case FORM_METAMORPHOSIS: // 0x16
2030 case FORM_UNDEAD: // 0x19
2031 case FORM_MASTER_ANGLER: // 0x1A
2032 case FORM_FLIGHT_EPIC: // 0x1B
2033 case FORM_SHADOW: // 0x1C
2034 case FORM_FLIGHT: // 0x1D
2035 case FORM_STEALTH: // 0x1E
2036 case FORM_MOONKIN: // 0x1F
2037 case FORM_SPIRITOFREDEMPTION: // 0x20
2038 break;
2039 default:
2040 LOG_ERROR("spells.aura.effect", "Auras: Unknown Shapeshift Type: {}", GetMiscValue());
2041 }
2042
2043 modelid = target->GetModelForForm(form, GetId());
2044
2045 if (apply)
2046 {
2047 // remove polymorph before changing display id to keep new display id
2048 switch (form)
2049 {
2050 case FORM_CAT:
2051 case FORM_TREE:
2052 case FORM_TRAVEL:
2053 case FORM_AQUA:
2054 case FORM_BEAR:
2055 case FORM_DIREBEAR:
2056 case FORM_FLIGHT_EPIC:
2057 case FORM_FLIGHT:
2058 case FORM_MOONKIN:
2059 {
2060 if (Player* player = target->ToPlayer())
2061 {
2062 player->SetCanTeleport(true);
2063 }
2064 // remove movement affects
2065 target->RemoveAurasByShapeShift();
2066
2067 // and polymorphic affects
2068 if (target->IsPolymorphed())
2069 target->RemoveAurasDueToSpell(target->getTransForm());
2070 break;
2071 }
2072 default:
2073 break;
2074 }
2075
2076 // remove other shapeshift before applying a new one
2077 // xinef: rogue shouldnt be wrapped by this check (shadow dance vs stealth)
2078 if (GetSpellInfo()->SpellFamilyName != SPELLFAMILY_ROGUE)
2080
2081 // stop handling the effect if it was removed by linked event
2082 if (aurApp->GetRemoveMode())
2083 return;
2084
2085 if (PowerType != POWER_MANA)
2086 {
2087 uint32 oldPower = target->GetPower(PowerType);
2088 // reset power to default values only at power change
2089 if (target->getPowerType() != PowerType)
2090 target->setPowerType(PowerType);
2091
2092 switch (form)
2093 {
2094 case FORM_CAT:
2095 case FORM_BEAR:
2096 case FORM_DIREBEAR:
2097 {
2098 // get furor proc chance
2099 uint32 FurorChance = 0;
2100 if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
2101 FurorChance = std::max(dummy->GetAmount(), 0);
2102
2103 switch (GetMiscValue())
2104 {
2105 case FORM_CAT:
2106 {
2107 int32 basePoints = int32(std::min(oldPower, FurorChance));
2108 target->SetPower(POWER_ENERGY, 0);
2109 target->CastCustomSpell(target, 17099, &basePoints, nullptr, nullptr, true, nullptr, this);
2110 break;
2111 }
2112 case FORM_BEAR:
2113 case FORM_DIREBEAR:
2114 if (urand(0, 99) < FurorChance)
2115 target->CastSpell(target, 17057, true);
2116 break;
2117 default:
2118 {
2119 uint32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance);
2120 target->SetPower(POWER_ENERGY, newEnergy);
2121 break;
2122 }
2123 }
2124 break;
2125 }
2126 default:
2127 break;
2128 }
2129 }
2130 // stop handling the effect if it was removed by linked event
2131 if (aurApp->GetRemoveMode())
2132 return;
2133
2134 target->SetShapeshiftForm(form);
2135 // xinef: allow shapeshift to override model id if forced transform aura is not present!
2136 if (modelid > 0)
2137 {
2138 bool allow = true;
2139 if (target->getTransForm() && !(target->GetMapId() == MAP_THE_ESCAPE_FROM_DURNHOLDE))
2140 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm()))
2141 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !transformSpellInfo->IsPositive())
2142 allow = false;
2143
2144 if (allow)
2145 target->SetDisplayId(modelid);
2146 }
2147 }
2148 else
2149 {
2150 // reset model id if no other auras present
2151 // may happen when aura is applied on linked event on aura removal
2152 if (!target->HasShapeshiftAura())
2153 {
2156 {
2157 target->setPowerType(POWER_MANA);
2158 // Remove movement impairing effects also when shifting out
2159 target->RemoveAurasByShapeShift();
2160 }
2161 }
2162
2163 if (modelid > 0)
2164 target->RestoreDisplayId();
2165
2166 switch (form)
2167 {
2168 // Nordrassil Harness - bonus
2169 case FORM_BEAR:
2170 case FORM_DIREBEAR:
2171 case FORM_CAT:
2172 if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
2173 target->CastSpell(target, 37316, true, nullptr, dummy);
2174 break;
2175 // Nordrassil Regalia - bonus
2176 case FORM_MOONKIN:
2177 if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
2178 target->CastSpell(target, 37325, true, nullptr, dummy);
2179 break;
2180 case FORM_BATTLESTANCE:
2183 {
2184 uint32 Rage_val = 0;
2185 // Defensive Tactics
2186 if (form == FORM_DEFENSIVESTANCE)
2187 {
2188 if (AuraEffect const* aurEff = target->IsScriptOverriden(m_spellInfo, 831))
2189 Rage_val += aurEff->GetAmount() * 10;
2190 }
2191 // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
2192 if (target->IsPlayer())
2193 {
2194 // Stance mastery - trainer spell
2195 PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
2196 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
2197 {
2198 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec()))
2199 continue;
2200
2201 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
2202 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
2203 Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
2204 }
2205
2206 // Tactical Mastery - talent
2207 PlayerTalentMap const& tp_list = target->ToPlayer()->GetTalentMap();
2208 for (PlayerTalentMap::const_iterator itr = tp_list.begin(); itr != tp_list.end(); ++itr)
2209 {
2210 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec()))
2211 continue;
2212
2213 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
2214 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
2215 Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
2216 }
2217 }
2218 if (target->GetPower(POWER_RAGE) > Rage_val)
2219 target->SetPower(POWER_RAGE, Rage_val);
2220 break;
2221 }
2222 default:
2223 break;
2224 }
2225 }
2226
2227 // adding/removing linked auras
2228 // add/remove the shapeshift aura's boosts
2229 HandleShapeshiftBoosts(target, apply);
2230
2231 if (target->IsPlayer())
2232 target->ToPlayer()->InitDataForForm();
2233
2235 {
2236 // Dash
2238 aurEff->RecalculateAmount();
2239
2240 // Disarm handling
2241 // If druid shifts while being disarmed we need to deal with that since forms aren't affected by disarm
2242 // and also HandleAuraModDisarm is not triggered
2243 if (!target->CanUseAttackType(BASE_ATTACK))
2244 {
2246 {
2247 target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), nullptr, apply);
2248 }
2249 }
2250
2251 // Update crit chance for feral forms
2252 switch (form)
2253 {
2254 case FORM_CAT:
2255 case FORM_BEAR:
2256 case FORM_DIREBEAR:
2257 case FORM_GHOSTWOLF:
2259 break;
2260 default:
2261 break;
2262 }
2263 }
2264
2265 // stop handling the effect if it was removed by linked event
2266 if (apply && aurApp->GetRemoveMode())
2267 return;
2268
2269 if (target->IsPlayer())
2270 {
2271 SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
2272 // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
2273 for (uint8 i = 0; i < MAX_SHAPESHIFT_SPELLS; ++i)
2274 {
2275 if (!shapeInfo->stanceSpell[i])
2276 continue;
2277 if (apply)
2278 target->ToPlayer()->_addSpell(shapeInfo->stanceSpell[i], SPEC_MASK_ALL, true);
2279 else
2280 target->ToPlayer()->removeSpell(shapeInfo->stanceSpell[i], SPEC_MASK_ALL, true);
2281 }
2282 }
2283}
@ MAP_THE_ESCAPE_FROM_DURNHOLDE
Definition AreaDefines.h:238
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormEntryfmt)
#define MAX_SHAPESHIFT_SPELLS
Definition DBCStructure.h:1814
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:1345
static ObjectGuid const Empty
Definition ObjectGuid.h:123
bool _addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill=false)
Definition Player.cpp:3232
void removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporary)
Definition Player.cpp:3492
PlayerSpellMap const & GetSpellMap() const
Definition Player.h:1798
void InitDataForForm(bool reapplyMods=false)
Definition Player.cpp:10742
uint8 GetActiveSpec() const
Definition Player.h:1766
void UpdateAllCritPercentages()
Definition StatSystem.cpp:698
PlayerTalentMap const & GetTalentMap() const
Definition Player.h:2658
uint32 SpellIconID
Definition SpellInfo.h:404
void RemoveAurasByShapeShift()
Definition Unit.cpp:5533
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition Unit.cpp:11571
bool IsPolymorphed() const
Definition Unit.cpp:13117
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:12416
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5766
virtual bool IsClass(Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
Definition Unit.h:845
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition Unit.cpp:6104
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId)
Definition Unit.cpp:15418
bool CanUseAttackType(WeaponAttackType attacktype) const
Definition Unit.h:993
bool HasShapeshiftAura() const
Definition Unit.h:1824
void RestoreDisplayId()
Definition Unit.cpp:13151
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition Unit.h:1438
uint32 getTransForm() const
Definition Unit.h:1967
Powers getPowerType() const
Definition Unit.h:1132
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition Unit.cpp:5373
uint32 GetPower(Powers power) const
Definition Unit.h:1136
void setPowerType(Powers power)
Definition Unit.cpp:7016
void SetShapeshiftForm(ShapeshiftForm form)
Definition Unit.cpp:17282
uint32 GetMapId() const
Definition Position.h:281
Definition DBCStructure.h:1817
uint32 stanceSpell[MAX_SHAPESHIFT_SPELLS]
Definition DBCStructure.h:1829

References Player::_addSpell(), Player::_ApplyWeaponDamage(), AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK, BASE_ATTACK, Unit::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
3142{
3143 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3144 return;
3145
3146 Unit* target = aurApp->GetTarget();
3147
3148 if (apply)
3149 {
3151
3152 // call functions which may have additional effects after chainging state of unit
3153 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
3154 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
3155 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
3156 if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
3157 // Stop spells on prepare or casting state
3158 target->InterruptSpell(CurrentSpellTypes(i), false);
3159 }
3160 else
3161 {
3162 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3163 if (target->HasSilenceAura() || target->HasPacifySilenceAura())
3164 return;
3165
3167 }
3168}
@ SPELL_PREVENTION_TYPE_SILENCE
Definition SharedDefines.h:1558
@ UNIT_FLAG_SILENCED
Definition UnitDefines.h:270
#define CURRENT_MAX_SPELL
Definition Unit.h:563
CurrentSpellTypes
Definition Unit.h:555
@ CURRENT_MELEE_SPELL
Definition Unit.h:556
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4236
bool HasSilenceAura() const
Definition Unit.h:1823

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
3343{
3345 return;
3346 Unit* target = aurApp->GetTarget();
3347
3348 if (!target->IsPlayer())
3349 return;
3350
3351 uint32 prot = GetMiscValue();
3352 int32 points = GetAmount();
3353
3354 target->ToPlayer()->ModifySkillBonus(prot, ((apply) ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
3355 if (prot == SKILL_DEFENSE)
3356 target->ToPlayer()->UpdateDefenseBonusesMod();
3357}
@ 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:5464
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
3285{
3287 return;
3288
3289 Unit* target = aurApp->GetTarget();
3290
3291 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
3292 if (apply)
3294 else
3295 {
3296 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3297 if (!target->HasAuraType(GetAuraType()))
3299 }
3300
3301 // call functions which may have additional effects after chainging state of unit
3302 target->UpdateObjectVisibility(target->IsPlayer());
3303}
@ UNIT_DYNFLAG_TRACK_UNIT
Definition SharedDefines.h:3355
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:126
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:125
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition Unit.cpp:15348

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
4200{
4202 return;
4203
4204 if (GetMiscValue() < -2 || GetMiscValue() > 4)
4205 {
4206 LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
4207 return;
4208 }
4209
4210 Unit* target = aurApp->GetTarget();
4212 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4213 return;
4214
4215 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4216 {
4217 // -1 or -2 is all stats (misc < -2 checked in function beginning)
4218 if (GetMiscValue() < 0 || GetMiscValue() == i)
4219 {
4220 if (spellGroupVal)
4222
4224 if (target->IsPlayer() || target->IsPet())
4225 target->UpdateStatBuffMod(Stats(i));
4226 }
4227 }
4228}
#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:177
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition Unit.cpp:4542
void UpdateStatBuffMod(Stats stat)
Definition Unit.cpp:6448

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
3632{
3633 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3634 return;
3635
3636 Unit* target = aurApp->GetTarget();
3637
3638 target->SetControlled(apply, UNIT_STATE_STUNNED);
3639 if (apply)
3640 target->GetThreatMgr().EvaluateSuppressed();
3641}
@ 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
3564{
3566 return;
3567
3568 Unit* target = aurApp->GetTarget();
3569
3570 if (!target->IsAlive() || !target->IsPlayer())
3571 return;
3572
3573 Unit* caster = GetCaster();
3574 if (caster && caster->IsAlive())
3576}
void UpdateMyTempModifiers()
Definition ThreatManager.cpp:798

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
3912{
3913 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3914 return;
3915
3916 Unit* target = aurApp->GetTarget();
3917
3918 target->UpdateSpeed(MOVE_RUN, true);
3919 target->UpdateSpeed(MOVE_SWIM, true);
3920 target->UpdateSpeed(MOVE_FLIGHT, true);
3921
3922 if (Player* targetPlayer = target->ToPlayer())
3923 {
3924 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3925 }
3926}

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
4643{
4645 return;
4646
4647 Player* target = aurApp->GetTarget()->ToPlayer();
4648
4649 if (!target)
4650 return;
4651
4653}

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
3364{
3366 return;
3367
3368 Unit* target = aurApp->GetTarget();
3369 Unit* caster = GetCaster();
3370
3371 if (apply)
3372 {
3373 uint32 creatureEntry = GetMiscValue();
3374 uint32 displayId = 0;
3375 uint32 vehicleId = 0;
3376
3377 // Festive Holiday Mount
3378 if (target->HasAura(62061))
3379 {
3381 creatureEntry = 24906;
3382 else
3383 creatureEntry = 15665;
3384 }
3385
3386 // Festive Brewfest Mount
3388 {
3389 if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
3390 {
3391 creatureEntry = GREAT_BREWFEST_KODO;
3392 }
3393 else
3394 {
3395 creatureEntry = BREWFEST_KODO;
3396 }
3397 }
3398
3399 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
3400 {
3401 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
3402 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
3403 displayId = model.CreatureDisplayID;
3404
3405 vehicleId = creatureInfo->VehicleId;
3406
3407 //some spell has one aura of mount and one of vehicle
3408 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3409 {
3410 if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue())
3411 {
3412 displayId = 0;
3413 }
3414 }
3415
3416 }
3417 target->Mount(displayId, vehicleId, GetMiscValue());
3418 }
3419 else
3420 {
3421 target->Dismount();
3422 //some mounts like Headless Horseman's Mount or broom stick are skill based spell
3423 // need to remove ALL arura related to mounts, this will stop client crash with broom stick
3424 // and never endless flying after using Headless Horseman's Mount
3425 if (mode & AURA_EFFECT_HANDLE_REAL)
3427 }
3428}
@ SPELL_EFFECT_SUMMON
Definition SharedDefines.h:794
void Dismount()
Definition Unit.cpp:10547
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5993
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition Unit.cpp:10487

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
5839{
5840 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5841 return;
5842
5843 Unit* target = aurApp->GetTarget();
5844
5845 if (!target->IsPlayer() || !target->IsInWorld())
5846 return;
5847
5848 if (apply)
5849 target->ToPlayer()->GetSession()->SendStablePet(target->GetGUID());
5850
5851 // client auto close stable dialog at !apply aura
5852}
bool IsInWorld() const
Definition Object.h:109
WorldSession * GetSession() const
Definition Player.h:2030
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
5868{
5869 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5870 return;
5871
5872 Player* target = aurApp->GetTarget()->ToPlayer();
5873
5874 if (!target || !target->IsInWorld())
5875 return;
5876
5877 uint32 overrideId = uint32(GetMiscValue());
5878
5879 if (apply)
5880 {
5882 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5883 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5884 if (uint32 spellId = overrideSpells->spellId[i])
5885 target->_addSpell(spellId, SPEC_MASK_ALL, true);
5886 }
5887 else
5888 {
5890 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5891 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5892 if (uint32 spellId = overrideSpells->spellId[i])
5893 target->removeSpell(spellId, SPEC_MASK_ALL, true);
5894 }
5895}
DBCStorage< OverrideSpellDataEntry > sOverrideSpellDataStore(OverrideSpellDatafmt)
#define MAX_OVERRIDE_SPELL
Definition DBCStructure.h:1411
#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:763
Definition DBCStructure.h:1414

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
5140{
5141 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5142 return;
5143
5144 Unit* target = aurApp->GetTarget();
5145
5146 if (!target->IsPlayer())
5147 return;
5148
5149 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
5150 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
5151 if (!(apply) && GetBase()->GetDuration() == 0)
5152 target->AddComboPoints(-GetAmount());
5153}
void AddComboPoints(Unit *target, int8 count)
Definition Unit.cpp:13214

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
5898{
5899 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5900 return;
5901
5902 Unit* target = aurApp->GetTarget();
5903
5904 if (!target->IsPlayer() || !target->IsInWorld())
5905 return;
5906
5907 uint32 vehicleId = GetMiscValue();
5908
5909 if (apply)
5910 {
5911 if (!target->CreateVehicleKit(vehicleId, 0))
5912 return;
5913 }
5914 else if (target->GetVehicleKit())
5915 target->RemoveVehicleKit();
5916
5918 data << target->GetPackGUID();
5919 data << uint32(apply ? vehicleId : 0);
5920 target->SendMessageToSet(&data, true);
5921
5922 if (apply)
5923 {
5925 target->ToPlayer()->SendDirectMessage(&data);
5926 }
5927}
PackedGuid const & GetPackGUID() const
Definition Object.h:116
std::size_t size() const
Definition ObjectGuid.h:278
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5852
void RemoveVehicleKit()
Definition Unit.cpp:14977
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition Unit.cpp:14965
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:2166
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
3234{
3236 return;
3237
3238 Unit* target = aurApp->GetTarget();
3239
3240 if (!target->IsPlayer())
3241 return;
3242
3243 if (apply)
3244 target->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
3245 else
3246 target->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
3247}
@ 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
3250{
3252 return;
3253
3254 Unit* target = aurApp->GetTarget();
3255
3256 if (!target->IsPlayer())
3257 return;
3258
3259 if (apply)
3260 target->SetFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
3261 else
3262 target->RemoveFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
3263}
@ 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
3266{
3268 return;
3269
3270 Unit* target = aurApp->GetTarget();
3271
3272 if (!target->IsPlayer())
3273 return;
3274
3275 if (!(apply))
3276 {
3277 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3278 if (target->HasAuraType(GetAuraType()))
3279 return;
3280 }
3282}
@ 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:885

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

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, 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
3306{
3308 return;
3309
3310 Unit* target = aurApp->GetTarget();
3311
3312 if (apply)
3314 else
3315 {
3316 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3317 if (target->HasAuraType(GetAuraType()))
3318 return;
3320 }
3321}
@ 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:916
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:897

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
3451{
3453 return;
3454
3455 Unit* target = aurApp->GetTarget();
3456
3457 if (Player* targetPlayer = target->ToPlayer())
3458 {
3459 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3460 }
3461
3462 if (!apply)
3463 {
3464 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3465 if (target->HasAuraType(GetAuraType()))
3466 return;
3467 }
3468
3469 target->SetWaterWalking(apply);
3470}
void SetWaterWalking(bool enable)
Definition Unit.cpp:16672

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
5646{
5647 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5648 return;
5649
5650 Unit* target = aurApp->GetTarget();
5651
5652 Unit* caster = GetCaster();
5653
5654 if (!caster || !caster->IsPlayer())
5655 return;
5656
5657 caster->ToPlayer()->SetViewpoint(target, apply);
5658}
void SetViewpoint(WorldObject *target, bool apply)
Definition Player.cpp:13469

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

◆ HandleBreakableCCAuraProc()

void AuraEffect::HandleBreakableCCAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
6896{
6897 int32 const damageLeft = GetAmount() - static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage());
6898
6899 if (damageLeft <= 0)
6900 aurApp->GetTarget()->RemoveAura(aurApp);
6901 else
6902 SetAmount(damageLeft);
6903}
Unit * GetTarget() const
Definition SpellAuras.h:61

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
5601{
5602 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5603 return;
5604
5605 if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
5606 return;
5607
5608 Unit* caster = GetCaster();
5609
5610 if (!caster || !caster->IsPlayer())
5611 return;
5612
5613 Player* plCaster = caster->ToPlayer();
5614
5615 // Item amount
5616 if (GetAmount() <= 0)
5617 return;
5618
5619 if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
5620 return;
5621
5622 //Adding items
5623 uint32 noSpaceForCount = 0;
5624 uint32 count = m_amount;
5625
5626 ItemPosCountVec dest;
5627 InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount);
5628 if (msg != EQUIP_ERR_OK)
5629 {
5630 count -= noSpaceForCount;
5631 plCaster->SendEquipError(msg, nullptr, nullptr, GetSpellInfo()->Effects[m_effIndex].ItemType);
5632 if (count == 0)
5633 return;
5634 }
5635
5636 Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true);
5637 if (!newitem)
5638 {
5639 plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
5640 return;
5641 }
5642 plCaster->SendNewItem(newitem, count, true, true);
5643}
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:4822
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0, bool refund=false)
Definition PlayerStorage.cpp:2606
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition PlayerStorage.cpp:4098
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
3762{
3763 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3764 return;
3765
3766 Unit* target = aurApp->GetTarget();
3767
3768 Unit* caster = GetCaster();
3769
3770 if (apply)
3771 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
3772 else
3773 target->RemoveCharmedBy(caster);
3774}
@ CHARM_TYPE_CONVERT
Definition CharmInfo.h:48
void RemoveCharmedBy(Unit *charmer)
Definition Unit.cpp:14790
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:14586

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
5749{
5751 return;
5752
5753 Unit* target = aurApp->GetTarget();
5754
5755 if (apply)
5757 else
5758 {
5759 if (target->HasAuraType(GetAuraType()))
5760 return;
5761
5763 }
5764}
@ 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
1832{
1834 {
1835 return;
1836 }
1837
1838 Unit* target = aurApp->GetTarget();
1839 if (!target->IsPlayer())
1840 {
1841 return;
1842 }
1843
1844 if (apply)
1845 {
1846 target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1847 }
1848 else
1849 {
1850 if (target->HasDetectAmoreAura())
1851 {
1853 for (AuraEffect const* aurEff : amoreAuras)
1854 if (GetMiscValue() == aurEff->GetMiscValue())
1855 {
1856 return;
1857 }
1858 }
1859
1860 target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1861 }
1862}
@ SPELL_AURA_DETECT_AMORE
Definition SpellAuraDefines.h:233
bool HasDetectAmoreAura() const
Definition Unit.h:1816

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:81
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:73
void ApplySpellMod(Unit *target, bool apply)
Definition SpellAuraEffects.cpp:813
bool CallScriptEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition SpellAuras.cpp:2433
void CallScriptAfterEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition SpellAuras.cpp:2452
bool CallScriptEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition SpellAuras.cpp:2413
void CallScriptAfterEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition SpellAuras.cpp:2466
void _RegisterAuraEffect(AuraEffect *aurEff, bool apply)
Definition Unit.cpp:4950

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

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

◆ HandleFarSight()

void AuraEffect::HandleFarSight ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5661{
5662 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5663 {
5664 return;
5665 }
5666
5667 Unit* caster = GetCaster();
5668 if (!caster || !caster->IsPlayer())
5669 {
5670 return;
5671 }
5672
5673 Player* player = caster->ToPlayer();
5674 if (apply)
5675 {
5677 }
5678 else
5679 {
5680 player->ResetFarSightDistance();
5681 }
5682
5683 caster->UpdateObjectVisibility(!apply);
5684}
void SetFarSightDistance(float radius)
Definition Player.cpp:16619
void ResetFarSightDistance()
Definition Player.cpp:16624
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2723

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
2932{
2933 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2934 return;
2935
2936 Unit* target = aurApp->GetTarget();
2937
2938 if (!target->IsPlayer())
2939 return;
2940
2941 if (Player* targetPlayer = target->ToPlayer())
2942 {
2943 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2944 }
2945
2946 if (apply)
2947 {
2948 /*
2949 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2950 data<<target->GetGUID();
2951 data<<uint8(0);
2952 target->SendMessageToSet(&data, true);
2953 */
2954
2955 UnitList targets;
2956 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
2958 Cell::VisitObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2959 for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2960 {
2961 if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2962 continue;
2963
2965 {
2966 if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2967 {
2968 SpellInfo const* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo();
2969 if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->IsCreature())
2970 {
2971 Creature* c = (*iter)->ToCreature();
2972 if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
2973 continue;
2974 }
2975 bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY)
2976 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
2977 if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST))
2978 {
2979 // at least one effect truly targets an unit, interrupt the spell
2980 interrupt = true;
2981 break;
2982 }
2983 if (interrupt)
2984 (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
2985 }
2986 }
2987 }
2988
2989 for (auto& pair : target->GetThreatMgr().GetThreatenedByMeList())
2990 pair.second->ScaleThreat(0.0f);
2991
2992 if (target->GetInstanceScript() && target->GetInstanceScript()->IsEncounterInProgress())
2993 {
2994 target->AttackStop();
2995 if (Player* targetPlayer = target->ToPlayer())
2996 targetPlayer->SendAttackSwingCancelAttack();
2997 }
2998 else
2999 target->CombatStop(false, false);
3000
3002
3003 // prevent interrupt message
3004 if (GetCasterGUID() == target->GetGUID())
3005 {
3007 target->FinishSpell(CURRENT_GENERIC_SPELL, true);
3008
3009 // interrupt autoshot
3011 {
3013 target->ToPlayer()->SendAutoRepeatCancel(target);
3014 }
3015 }
3016
3017 target->InterruptNonMeleeSpells(true);
3018
3019 // stop handling the effect if it was removed by linked event
3020 if (aurApp->GetRemoveMode())
3021 return;
3022 // blizz like 2.0.x
3024 // blizz like 2.0.x
3026 // blizz like 2.0.x
3028
3030 }
3031 else
3032 {
3033 /*
3034 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
3035 data<<target->GetGUID();
3036 data<<uint8(1);
3037 target->SendMessageToSet(&data, true);
3038 */
3039 // blizz like 2.0.x
3041 // blizz like 2.0.x
3043 // blizz like 2.0.x
3045
3047 }
3048}
@ 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:562
@ CURRENT_GENERIC_SPELL
Definition Unit.h:557
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:559
std::list< Unit * > UnitList
Definition Unit.h:78
Definition GridNotifiers.h:884
Definition Creature.h:47
bool IsDungeonBoss() const
Definition Creature.cpp:3298
bool isWorldBoss() const
Definition Creature.h:124
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:207
virtual bool IsEncounterInProgress() const
Definition InstanceScript.cpp:147
float GetVisibilityRange() const
Definition Map.h:199
void SendAutoRepeatCancel(Unit *target)
Definition PlayerMisc.cpp:154
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4308
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition Unit.cpp:4266
void CombatStop(bool includingCast=false, bool mutualPvP=true)
Definition Unit.cpp:7508
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:7475
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1242
float GetVisibilityRange() const
Definition Object.cpp:1705
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
3533{
3535 return;
3536
3537 Unit* target = aurApp->GetTarget();
3538
3539 if (apply)
3541 else
3542 {
3543 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3544 if (target->HasAuraType(GetAuraType()))
3545 return;
3547 }
3548}
@ 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
5687{
5689 return;
5690
5691 Unit* target = aurApp->GetTarget();
5692
5693 if (!target->IsPlayer())
5694 return;
5695
5696 Player* player = target->ToPlayer();
5697
5698 uint32 faction_id = GetMiscValue();
5699 ReputationRank faction_rank = ReputationRank(m_amount);
5700
5701 player->GetReputationMgr().ApplyForceReaction(faction_id, faction_rank, apply);
5703
5704 // stop fighting if at apply forced rank friendly or at remove real rank friendly
5705 if ((apply && faction_rank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(faction_id) >= REP_FRIENDLY))
5706 player->StopAttackFaction(faction_id);
5707}
ReputationRank
Definition SharedDefines.h:156
@ REP_FRIENDLY
Definition SharedDefines.h:161
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:6021
ReputationMgr & GetReputationMgr()
Definition Player.h:2155
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:16067

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
4739{
4741 return;
4742
4743 Unit* target = aurApp->GetTarget();
4744
4745 // Xinef: Do not apply such auras in normal way
4746 if (GetAmount() >= 1000)
4747 {
4748 target->SetInstantCast(apply);
4749 return;
4750 }
4751
4752 int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, GetAuraType());
4753 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4754 return;
4755
4756 if (spellGroupVal)
4757 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
4758
4759 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
4760}
void SetInstantCast(bool set)
Definition Unit.h:1587
void ApplyCastTimePercentMod(float val, bool apply)
Definition Unit.cpp:13454

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
3747{
3748 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3749 return;
3750
3751 Unit* target = aurApp->GetTarget();
3752
3753 Unit* caster = GetCaster();
3754
3755 if (apply)
3756 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3757 else
3758 target->RemoveCharmedBy(caster);
3759}
@ 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
4775{
4777 return;
4778
4779 Unit* target = aurApp->GetTarget();
4781 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4782 return;
4783
4784 if (spellGroupVal)
4785 {
4786 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
4787 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4788 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4789 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
4790 }
4791
4792 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
4793 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4794 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4795 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
4796}
@ 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
3610{
3611 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3612 return;
3613
3614 Unit* target = aurApp->GetTarget();
3615
3616 target->SetControlled(apply, UNIT_STATE_CONFUSED);
3617 if (apply)
3618 target->GetThreatMgr().EvaluateSuppressed();
3619}
@ 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
4982{
4984 return;
4985
4986 Unit* target = aurApp->GetTarget();
4987
4989 target->UpdateAllDamageDoneMods();
4990
4991 // Magic damage modifiers implemented in Unit::SpellBaseDamageBonus
4992 // This information for client side use only
4993 if (target->IsPlayer())
4994 {
4996 for (uint16 i = 0; i < MAX_SPELL_SCHOOL; ++i)
4997 if (GetMiscValue() & (1 << i))
4998 target->ApplyModInt32Value(baseField + i, GetAmount(), apply);
4999
5000 if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
5001 pet->UpdateAttackPowerAndDamage();
5002 }
5003}
@ 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:12111

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
5006{
5008 return;
5009
5010 Unit* target = aurApp->GetTarget();
5011 if (!target)
5012 return;
5013
5016
5017 if (target->IsPlayer())
5018 {
5019 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
5020 {
5021 if (GetMiscValue() & (1 << i))
5022 {
5023 // only aura type modifying PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
5026 }
5027 }
5028 }
5029}
@ PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
Definition UpdateFields.h:362
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:730
void UpdateAllDamagePctDoneMods()
Definition Unit.cpp:12155

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
3592{
3593 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3594 return;
3595
3596 Unit* caster = GetCaster();
3597 Unit* target = aurApp->GetTarget();
3598
3599 if (!caster || !caster->IsAlive() || !target->IsAlive() || !caster->CanHaveThreatList())
3600 return;
3601
3602 caster->GetThreatMgr().TauntUpdate();
3603}
void TauntUpdate()
Definition ThreatManager.cpp:517

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
3622{
3623 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3624 return;
3625
3626 Unit* target = aurApp->GetTarget();
3627
3628 target->SetControlled(apply, UNIT_STATE_FLEEING, GetCaster(), true);
3629}
@ 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
4326{
4328 return;
4329
4330 Unit* target = aurApp->GetTarget();
4331
4332 if (!target->IsPlayer())
4333 return;
4334 // implemented in Unit::SpellHealingBonus
4335 // this information is for client side only
4337}
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
4656{
4658 return;
4659
4660 Unit* target = aurApp->GetTarget();
4661
4662 if (target->IsPlayer())
4663 {
4664 target->ToPlayer()->UpdateMeleeHitChances();
4665 target->ToPlayer()->UpdateRangedHitChances();
4666 }
4667 else
4668 {
4669 target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
4670 target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
4671 }
4672}
void UpdateMeleeHitChances()
Definition StatSystem.cpp:871
void UpdateRangedHitChances()
Definition StatSystem.cpp:877
float m_modRangedHitChance
Definition Unit.h:2081
float m_modMeleeHitChance
Definition Unit.h:2080

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
1674{
1676 return;
1677
1678 Unit* target = aurApp->GetTarget();
1680
1681 if (apply)
1682 {
1683 // apply glow vision
1684 if (target->IsPlayer() && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10))
1686
1687 target->m_invisibility.AddFlag(type);
1688 target->m_invisibility.AddValue(type, GetAmount());
1689 }
1690 else
1691 {
1692 if (!target->HasInvisibilityAura())
1693 {
1694 // if not have different invisibility auras.
1695 // always remove glow vision
1696 if (target->IsPlayer())
1698
1699 target->m_invisibility.DelFlag(type);
1700 }
1701 else
1702 {
1703 bool found = false;
1705 for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i)
1706 {
1707 if (GetMiscValue() == (*i)->GetMiscValue())
1708 {
1709 found = true;
1710 break;
1711 }
1712 }
1713 if (!found)
1714 {
1715 target->m_invisibility.DelFlag(type);
1716
1717 // if not have invisibility auras of type INVISIBILITY_GENERAL
1718 // remove glow vision
1720 {
1722 }
1723 }
1724 }
1725
1726 target->m_invisibility.AddValue(type, -GetAmount());
1727 }
1728
1729 // call functions which may have additional effects after chainging state of unit
1730 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1731 {
1732 // drop flag at invisibiliy in bg
1734 }
1735
1736 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1737 target->bRequestForcedVisibilityUpdate = false;
1738}
@ 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:394
void AddFlag(FLAG_TYPE flag)
Definition Object.h:395
void DelFlag(FLAG_TYPE flag)
Definition Object.h:396
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:400
bool Instanceable() const
Definition Map.h:297
bool IsPlayer() const
Definition ObjectGuid.h:172
bool bRequestForcedVisibilityUpdate
Definition Unit.h:2110
ObjectGuid GetOwnerGUID() const
Definition Unit.h:714
bool HasInvisibilityAura() const
Definition Unit.h:1842
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition Object.h:620

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
1649{
1651 return;
1652
1653 Unit* target = aurApp->GetTarget();
1655
1656 if (apply)
1657 {
1658 target->m_invisibilityDetect.AddFlag(type);
1659 target->m_invisibilityDetect.AddValue(type, GetAmount());
1660 }
1661 else
1662 {
1663 if (!target->HasInvisibilityDetectAura())
1664 target->m_invisibilityDetect.DelFlag(type);
1665
1666 target->m_invisibilityDetect.AddValue(type, -GetAmount());
1667 }
1668
1669 // call functions which may have additional effects after chainging state of unit
1670 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1671}
bool HasInvisibilityDetectAura() const
Definition Unit.h:1843
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition Object.h:621

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
4444{
4446 return;
4447
4448 Unit* target = aurApp->GetTarget();
4449
4450 if (!target->IsPlayer())
4451 return;
4452
4453 //Note: an increase in regen does NOT cause threat.
4454 target->ToPlayer()->UpdateManaRegen();
4455}
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
4810{
4812 return;
4813
4814 Unit* target = aurApp->GetTarget();
4816 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4817 return;
4818
4819 if (spellGroupVal)
4820 {
4821 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4822 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4823 }
4824 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4825 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4826}
@ 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
5032{
5034 return;
5035
5036 Unit* target = aurApp->GetTarget();
5037
5038 // also handles spell group stacks
5040}
void UpdateDamagePctDoneMods(WeaponAttackType attackType)
Definition Unit.cpp:12117

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
4231{
4233 return;
4234
4235 Unit* target = aurApp->GetTarget();
4236
4237 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4238 {
4239 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4240 return;
4241 }
4242
4243 // only players currently use base stats
4244 if (!target->IsPlayer())
4245 return;
4246
4247 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
4248 {
4249 if (GetMiscValue() == i || GetMiscValue() == -1)
4250 {
4251 if (apply)
4253 else
4254 {
4255 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_PERCENT_STAT, [i](AuraEffect const* aurEff)
4256 {
4257 return (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1);
4258 });
4260 }
4261 }
4262 }
4263}
@ 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
3672{
3673 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3674 return;
3675
3676 Unit* target = aurApp->GetTarget();
3677
3678 Unit* caster = GetCaster();
3679
3680 // no support for posession AI yet
3681 if (caster && caster->IsCreature())
3682 {
3683 HandleModCharm(aurApp, mode, apply);
3684 return;
3685 }
3686
3687 if (apply)
3688 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3689 else
3690 target->RemoveCharmedBy(caster);
3691}
@ CHARM_TYPE_POSSESS
Definition CharmInfo.h:46
void HandleModCharm(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3746

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
3694{
3695 // Used by spell "Eyes of the Beast"
3696
3697 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3698 return;
3699
3700 Unit* caster = GetCaster();
3701 if (!caster || !caster->IsPlayer())
3702 return;
3703
3704 //seems it may happen that when removing it is no longer owner's pet
3705 //if (caster->ToPlayer()->GetPet() != target)
3706 // return;
3707
3708 Unit* target = aurApp->GetTarget();
3709 if (!target->IsCreature() || !target->IsPet())
3710 return;
3711
3712 Pet* pet = target->ToPet();
3713
3714 if (apply)
3715 {
3716 if (caster->ToPlayer()->GetPet() != pet)
3717 return;
3718
3719 // Must clear current motion or pet leashes back to owner after a few yards
3720 // when under spell 'Eyes of the Beast'
3721 pet->GetMotionMaster()->Clear();
3722 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3723 }
3724 else
3725 {
3726 pet->RemoveCharmedBy(caster);
3727
3728 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
3729 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
3730 else
3731 {
3732 // Reinitialize the pet bar or it will appear greyed out
3733 caster->ToPlayer()->PetSpellInitialize();
3734
3735 // Follow owner only if not fighting or owner didn't click "stay" at new location
3736 // This may be confusing because pet bar shows "stay" when under the spell but it retains
3737 // the "follow" flag. Player MUST click "stay" while under the spell.
3738 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3739 {
3741 }
3742 }
3743 }
3744}
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:46
constexpr float PET_FOLLOW_DIST
Definition PetDefines.h:206
@ COMMAND_STAY
Definition Unit.h:574
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:193
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition Pet.cpp:881
void PetSpellInitialize()
Definition Player.cpp:9735
Pet * ToPet()
Definition Unit.h:730
CharmInfo * GetCharmInfo()
Definition Unit.h:1282
Unit * GetVictim() const
Definition Unit.h:904
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1381
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
5090{
5092 return;
5093
5094 Unit* target = aurApp->GetTarget();
5095
5096 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5097 if (GetMiscValue() & (1 << i))
5099}
@ 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
5077{
5079 return;
5080
5081 Unit* target = aurApp->GetTarget();
5082
5083 float amount = CalculatePct(1.0f, GetAmount());
5084 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5085 if (GetMiscValue() & (1 << i))
5087}
@ UNIT_FIELD_POWER_COST_MULTIPLIER
Definition UpdateFields.h:171
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
Definition Object.cpp:815

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
4419{
4421 return;
4422
4423 Unit* target = aurApp->GetTarget();
4424
4425 if (!target->IsPlayer())
4426 return;
4427
4428 // Update manaregen value
4429 if (GetMiscValue() == POWER_MANA)
4430 target->ToPlayer()->UpdateManaRegen();
4431 else if (GetMiscValue() == POWER_ENERGY)
4432 target->ToPlayer()->UpdateEnergyRegen();
4433 else if (GetMiscValue() == POWER_RUNE)
4435 // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
4436}
@ 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
4439{
4440 HandleModPowerRegen(aurApp, mode, apply);
4441}
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4418

References HandleModPowerRegen().

◆ HandleModRating()

void AuraEffect::HandleModRating ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4856{
4858 return;
4859
4860 Unit* target = aurApp->GetTarget();
4861
4862 if (!target->IsPlayer())
4863 return;
4864
4865 for (uint8 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4866 if (GetMiscValue() & (1 << rating))
4867 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
4868}
#define MAX_COMBAT_RATING
Definition Unit.h:251
CombatRating
Definition Unit.h:223
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition Player.cpp:5414

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
4871{
4873 return;
4874
4875 Unit* target = aurApp->GetTarget();
4876
4877 if (!target->IsPlayer())
4878 return;
4879
4880 // Just recalculate ratings
4881 for (uint8 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4882 if (GetMiscValue() & (1 << rating))
4883 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
4884}

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
4141{
4143 return;
4144
4145 Unit* target = aurApp->GetTarget();
4146
4147 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
4148 {
4149 if (GetMiscValue() & int32(1 << i))
4150 {
4153 continue;
4154
4156 if (target->IsPlayer() || target->IsPet())
4158 }
4159 }
4160}
@ SPELL_AURA_MOD_RESISTANCE_PCT
Definition SpellAuraDefines.h:164
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:12007

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
4701{
4703 return;
4704
4705 Unit* target = aurApp->GetTarget();
4706
4707 if (!target->IsPlayer())
4708 return;
4709
4710 for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
4711 if (GetMiscValue() & (1 << school))
4712 target->ToPlayer()->UpdateSpellCritChance(school);
4713}
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
4296{
4298 return;
4299
4300 Unit* target = aurApp->GetTarget();
4301
4302 if (!target->IsPlayer())
4303 return;
4304
4305 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4306 // This information for client side use only
4307 // Recalculate bonus
4309}

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
4266{
4268 return;
4269
4270 Unit* target = aurApp->GetTarget();
4271
4272 if (!target->IsPlayer())
4273 return;
4274
4275 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4276 // This information for client side use only
4277 // Recalculate bonus
4279}

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
4312{
4314 return;
4315
4316 Unit* target = aurApp->GetTarget();
4317
4318 if (!target->IsPlayer())
4319 return;
4320
4321 // Recalculate bonus
4323}

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
4282{
4284 return;
4285
4286 Unit* target = aurApp->GetTarget();
4287
4288 if (!target->IsPlayer())
4289 return;
4290
4291 // Recalculate bonus
4293}

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
4675{
4677 return;
4678
4679 Unit* target = aurApp->GetTarget();
4680
4681 if (target->IsPlayer())
4682 target->ToPlayer()->UpdateSpellHitChances();
4683 else
4684 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
4685}
void UpdateSpellHitChances()
Definition StatSystem.cpp:883
float m_modSpellHitChance
Definition Unit.h:2082

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
1766{
1768 return;
1769
1770 Unit* target = aurApp->GetTarget();
1772
1773 if (apply)
1774 {
1775 target->m_stealth.AddFlag(type);
1776 target->m_stealth.AddValue(type, GetAmount());
1777
1779 if (target->IsPlayer())
1781
1782 // interrupt autoshot
1784 {
1786 target->ToPlayer()->SendAutoRepeatCancel(target);
1787 }
1788 }
1789 else
1790 {
1791 target->m_stealth.AddValue(type, -GetAmount());
1792
1793 if (!target->HasStealthAura()) // if last SPELL_AURA_MOD_STEALTH
1794 {
1795 target->m_stealth.DelFlag(type);
1796
1798 if (target->IsPlayer())
1800 }
1801 }
1802
1803 // call functions which may have additional effects after chainging state of unit
1804 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1805 {
1806 // drop flag at stealth in bg
1808 }
1809
1810 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1811 target->bRequestForcedVisibilityUpdate = false;
1812}
@ 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:1840
void RemoveStandFlags(uint8 flags)
Definition Unit.h:1786
void SetStandFlags(uint8 flags)
Definition Unit.h:1785
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition Object.h:617

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
1741{
1743 return;
1744
1745 Unit* target = aurApp->GetTarget();
1747
1748 if (apply)
1749 {
1750 target->m_stealthDetect.AddFlag(type);
1751 target->m_stealthDetect.AddValue(type, GetAmount());
1752 }
1753 else
1754 {
1755 if (!target->HasStealthDetectAura())
1756 target->m_stealthDetect.DelFlag(type);
1757
1758 target->m_stealthDetect.AddValue(type, -GetAmount());
1759 }
1760
1761 // call functions which may have additional effects after chainging state of unit
1762 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1763}
bool HasStealthDetectAura() const
Definition Unit.h:1841
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition Object.h:618

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
1815{
1817 return;
1818
1819 Unit* target = aurApp->GetTarget();
1821
1822 if (apply)
1823 target->m_stealth.AddValue(type, GetAmount());
1824 else
1825 target->m_stealth.AddValue(type, -GetAmount());
1826
1827 // call functions which may have additional effects after chainging state of unit
1828 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1829}

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
4178{
4180 return;
4181
4182 Unit* target = aurApp->GetTarget();
4183
4184 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
4185
4186 // show armor penetration
4187 if (target->IsPlayer() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
4189
4190 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
4193}
@ 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
3579{
3580 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3581 return;
3582
3583 Unit* target = aurApp->GetTarget();
3584
3585 if (!target->IsAlive() || !target->CanHaveThreatList())
3586 return;
3587
3588 target->GetThreatMgr().TauntUpdate();
3589}

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
3555{
3557 return;
3558
3559 Unit* target = aurApp->GetTarget();
3561}
void UpdateMySpellSchoolModifiers()
Definition ThreatManager.cpp:819

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
4340{
4342 return;
4343
4344 Unit* target = aurApp->GetTarget();
4345
4346 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4347 {
4348 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4349 return;
4350 }
4351
4352 // save current health state
4353 float healthPct = target->GetHealthPct();
4354 bool alive = target->IsAlive();
4355
4356 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4357 {
4358 if (GetMiscValue() == i || GetMiscValue() == -1)
4359 {
4360 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, [i](AuraEffect const* aurEff)
4361 {
4362 return (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1);
4363 });
4364
4365 if (target->GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT) == amount)
4366 continue;
4367
4369 if (target->IsPlayer() || target->IsPet())
4370 target->UpdateStatBuffMod(Stats(i));
4371 }
4372 }
4373
4374 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_UNK4 0x00000010 flag)
4376 target->SetHealth(std::max<uint32>(uint32(healthPct * target->GetMaxHealth() * 0.01f), (alive ? 1 : 0)));
4377}
@ 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
3051{
3053 return;
3054
3055 Unit* target = aurApp->GetTarget();
3056
3057 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3058 if (!apply && target->HasUnattackableAura())
3059 return;
3060
3062
3063 // call functions which may have additional effects after chainging state of unit
3064 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
3065 {
3066 // xinef: this aura should not stop combat (movie with sindragosa proves that)
3067 //target->CombatStop();
3069 }
3070}
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:258
bool HasUnattackableAura() const
Definition Unit.h:1832

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
162 {
163 // aura type not have immediate effect at add/remove and handled by ID in other code place
164 }

◆ HandleNoReagentUseAura()

void AuraEffect::HandleNoReagentUseAura ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5120{
5121 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5122 return;
5123
5124 Unit* target = aurApp->GetTarget();
5125
5126 if (!target->IsPlayer())
5127 return;
5128
5129 flag96 mask;
5131 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
5132 mask |= (*i)->m_spellInfo->Effects[(*i)->m_effIndex].SpellClassMask;
5133
5134 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1, mask[0]);
5135 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 1, mask[1]);
5136 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2, mask[2]);
5137}
@ 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
154 {
155 // not implemented
156 }

◆ HandleObsModPowerAuraTick()

void AuraEffect::HandleObsModPowerAuraTick ( Unit target,
Unit caster 
) const
6781{
6783 if (GetMiscValue() == POWER_ALL)
6784 PowerType = target->getPowerType();
6785 else
6787
6788 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
6789 return;
6790
6791 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6792 {
6793 SendTickImmune(target, caster);
6794 return;
6795 }
6796
6797 // don't regen when permanent aura target has full power
6798 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
6799 return;
6800
6801 // ignore negative values (can be result apply spellmods to aura damage
6802 uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(PowerType) / 100;
6803 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
6804 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
6805 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
6806 target->SendPeriodicAuraLog(&pInfo);
6807
6808 int32 gain = target->ModifyPower(PowerType, amount);
6809
6810 if (caster)
6811 target->GetThreatMgr().ForwardThreatForAssistingMe(caster, float(gain) * 0.5f, GetSpellInfo(), true);
6812}
@ POWER_ALL
Definition SharedDefines.h:265
void SendTickImmune(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:1123
std::string ToString() const
Definition ObjectGuid.cpp:48
void ForwardThreatForAssistingMe(Unit *assistant, float baseAmount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false)
== AFFECT OTHERS' THREAT LISTS ==
Definition ThreatManager.cpp:755
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:11008
bool IsImmunedToAuraPeriodicTick(Unit const *caster, SpellInfo const *spellInfo) const
Definition Unit.cpp:9972
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1137
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition Unit.cpp:6817
std::string ToString(Type &&val, Params &&... params)
Definition StringConvert.h:250
Definition Unit.h:532

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
6278{
6279 if (!target->IsAlive())
6280 return;
6281
6282 if (target->IsImmunedToDamage(caster, GetSpellInfo()) || target->IsTotem())
6283 {
6284 SendTickImmune(target, caster);
6285 return;
6286 }
6287
6288 // Consecrate ticks can miss and will not show up in the combat log
6289 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6290 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6291 return;
6292
6293 // some auras remove at specific health level or more
6295 {
6296 switch (GetSpellInfo()->Id)
6297 {
6298 case 43093:
6299 case 31956:
6300 case 38801: // Grievous Wound
6301 case 35321:
6302 case 38363:
6303 case 39215: // Gushing Wound
6304 if (target->IsFullHealth())
6305 {
6306 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6307 return;
6308 }
6309 break;
6310 case 38772: // Grievous Wound
6311 {
6312 uint32 percent = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster);
6313 if (!target->HealthBelowPct(percent))
6314 {
6315 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6316 return;
6317 }
6318 break;
6319 }
6320 }
6321 }
6322
6324
6325 // ignore non positive values (can be result apply spellmods to aura damage
6326 uint32 damage = std::max(GetAmount(), 0);
6327
6328 // If the damage is percent-max-health based, calculate damage before the Modify hook
6330 {
6331 // xinef: ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
6332 damage = uint32(std::ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
6333 }
6334
6335 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6336 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6337
6338 if (target->GetAI())
6339 {
6340 target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
6341 }
6342
6344 {
6345 // xinef: leave only target depending bonuses, rest is handled in calculate amount
6346 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE && caster)
6347 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6348 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6349
6350 // Calculate armor mitigation
6352 {
6353 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6354 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6355 damage = damageReductedArmor;
6356 }
6357
6358 }
6359
6360 // calculate crit chance
6361 bool crit = false;
6362 if ((crit = roll_chance_f(GetCritChance())))
6363 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6364
6365 // Auras reducing damage from AOE spells
6367 {
6368 if (GetSpellInfo()->Effects[GetEffIndex()].IsAreaAuraEffect() ||
6369 GetSpellInfo()->Effects[GetEffIndex()].IsTargetingArea() ||
6370 GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA || // some persistent area auras have targets like A=53 B=28
6373 {
6374 bool npcCaster = (caster && !caster->IsControlledByPlayer()) || GetSpellInfo()->HasAttribute(SPELL_ATTR7_TREAT_AS_NPC_AOE);
6375 damage = target->CalculateAOEDamageReduction(damage, GetSpellInfo()->SchoolMask, npcCaster);
6376 }
6377 }
6378
6379 int32 dmg = damage;
6380 int32 mitigatedDamage = cleanDamage.mitigated_damage;
6381 if (CanApplyResilience())
6382 {
6383 int32 resilienceReduction = dmg;
6384 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6385
6386 resilienceReduction = dmg - resilienceReduction;
6387 dmg -= resilienceReduction;
6388 mitigatedDamage += resilienceReduction;
6389 }
6390
6391 damage = std::max(0, dmg);
6392 cleanDamage.mitigated_damage = std::max(0, mitigatedDamage);
6393
6394 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6395 Unit::CalcAbsorbResist(dmgInfo);
6396
6397 uint32 absorb = dmgInfo.GetAbsorb();
6398 uint32 resist = dmgInfo.GetResist();
6399 damage = dmgInfo.GetDamage();
6400
6401 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} attacked {} for {} dmg inflicted by {} abs is {}",
6402 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6403 Unit::DealDamageMods(target, damage, &absorb);
6404
6405 // Set trigger flag
6406 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6407 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6409 if (damage)
6410 procEx |= crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT;
6411 if (absorb > 0)
6412 procEx |= PROC_EX_ABSORB;
6413
6414 if (damage)
6415 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6416
6417 int32 overkill = damage - target->GetHealth();
6418 if (overkill < 0)
6419 overkill = 0;
6420
6421 SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
6422 target->SendPeriodicAuraLog(&pInfo);
6423
6424 Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
6425
6426 Unit::ProcSkillsAndAuras(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6427}
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:240
@ MELEE_HIT_NORMAL
Definition Unit.h:293
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:387
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:2218
int32 CalculateAOEDamageReduction(int32 damage, uint32 schoolMask, bool npcCaster) const
Definition Unit.cpp:16304
bool IsFullHealth() const
Definition Unit.h:1115
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition Unit.cpp:3629
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:9397
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1117
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:8917
bool IsImmunedToDamage(SpellSchoolMask schoolMask) const
Definition Unit.cpp:9889
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition Unit.cpp:15177
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:6783
UnitAI * GetAI()
Definition Unit.h:694
bool IsControlledByPlayer() const
Definition Unit.h:1308
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition Unit.cpp:2195
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false)
Definition Unit.cpp:2326
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:972
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)
Definition Unit.cpp:982
Definition Unit.h:322
uint32 mitigated_damage
Definition Unit.h:327

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(), Unit::SpellHitResult(), sScriptMgr, and ObjectGuid::ToString().

Referenced by PeriodicTick().

◆ HandlePeriodicDummyAuraTick()

void AuraEffect::HandlePeriodicDummyAuraTick ( Unit target,
Unit caster 
) const
5944{
5945 switch (GetSpellInfo()->SpellFamilyName)
5946 {
5947 case SPELLFAMILY_HUNTER:
5948 {
5949 // Explosive Shot
5950 if (GetSpellInfo()->SpellFamilyFlags[1] & 0x80000000)
5951 {
5952 if (caster)
5953 caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, target, true, nullptr, this);
5954 break;
5955 }
5956 switch (GetSpellInfo()->Id)
5957 {
5958 // Feeding Frenzy Rank 1
5959 case 53511:
5960 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
5961 target->CastSpell(target, 60096, true, 0, this);
5962 return;
5963 // Feeding Frenzy Rank 2
5964 case 53512:
5965 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
5966 target->CastSpell(target, 60097, true, 0, this);
5967 return;
5968 default:
5969 break;
5970 }
5971 break;
5972 }
5974 switch (GetId())
5975 {
5976 case 49016: // Hysteria
5977 uint32 damage = uint32(target->CountPctFromMaxHealth(1));
5978 Unit::DealDamage(target, target, damage, nullptr, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
5979 break;
5980 }
5981 // Blood of the North
5982 // Reaping
5983 // Death Rune Mastery
5984 if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
5985 {
5986 if (!target->IsPlayer())
5987 return;
5989 return;
5990
5991 // timer expired - remove death runes
5992 target->ToPlayer()->RemoveRunesByAuraEffect(this);
5993 }
5994 break;
5995 default:
5996 break;
5997 }
5998}
@ SPELLFAMILY_HUNTER
Definition SharedDefines.h:3793
@ SPELLFAMILY_DEATHKNIGHT
Definition SharedDefines.h:3799
@ SPELLVALUE_BASE_POINT0
Definition SpellDefines.h:113
@ NODAMAGE
Definition Unit.h:259
uint32 CountPctFromMaxHealth(int32 pct) const
Definition Unit.h:1122

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
6815{
6817
6819 return;
6820
6821 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
6822 return;
6823
6824 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6825 {
6826 SendTickImmune(target, caster);
6827 return;
6828 }
6829
6830 // don't regen when permanent aura target has full power
6831 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
6832 return;
6833
6834 // ignore negative values (can be result apply spellmods to aura damage
6835 int32 amount = std::max(m_amount, 0);
6836
6837 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
6838 target->SendPeriodicAuraLog(&pInfo);
6839
6840 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
6841 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
6842 int32 gain = target->ModifyPower(PowerType, amount);
6843
6844 if (caster)
6845 target->GetThreatMgr().ForwardThreatForAssistingMe(caster, float(gain) * 0.5f, GetSpellInfo(), true);
6846}
@ SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED
Definition SharedDefines.h:645
virtual bool HasActivePowerType(Powers power)
Definition Unit.h:1133

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
6569{
6570 if (!target->IsAlive())
6571 return;
6572
6573 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6574 {
6575 SendTickImmune(target, caster);
6576 return;
6577 }
6578
6579 // heal for caster damage (must be alive)
6580 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST) && (!caster || !caster->IsAlive()))
6581 return;
6582
6583 // don't regen when permanent aura target has full power
6584 if (GetBase()->IsPermanent() && target->IsFullHealth())
6585 return;
6586
6587 // ignore negative values (can be result apply spellmods to aura damage
6588 int32 damage = std::max(m_amount, 0);
6589
6591 {
6592 // Taken mods
6593 float TakenTotalMod = 1.0f;
6594
6595 // Tenacity increase healing % taken
6596 if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0))
6597 AddPct(TakenTotalMod, Tenacity->GetAmount());
6598
6599 // Healing taken percent
6600 float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6601 if (minval)
6602 AddPct(TakenTotalMod, minval);
6603
6604 float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6605 if (maxval)
6606 AddPct(TakenTotalMod, maxval);
6607
6608 // Healing over time taken percent
6609 float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
6610 if (minval_hot)
6611 AddPct(TakenTotalMod, minval_hot);
6612
6613 float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
6614 if (maxval_hot)
6615 AddPct(TakenTotalMod, maxval_hot);
6616
6617 // Arena / BG Dampening
6618 float minval_pct = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
6619 if (minval_pct)
6620 AddPct(TakenTotalMod, minval_pct);
6621
6622 TakenTotalMod = std::max(TakenTotalMod, 0.0f);
6623
6624 // the most ugly hack i made :P the other option is to change all spellvalues to float...
6625 // demonic aegis
6626 if (caster && GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[1] & 0x20000000))
6628 AddPct(TakenTotalMod, aurEff->GetAmount());
6629
6630 damage = uint32(target->CountPctFromMaxHealth(damage));
6631 damage = uint32(damage * TakenTotalMod);
6632 }
6633 else
6634 {
6635 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
6636 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6637
6638 if (caster && GetBase()->GetType() == UNIT_AURA_TYPE)
6639 damage = int32(float(damage) * caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_DONE_PERCENT));
6640
6641 damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6642 }
6643
6644 bool crit = false;
6645 if ((crit = roll_chance_f(GetCritChance())))
6646 damage = Unit::SpellCriticalHealingBonus(caster, GetSpellInfo(), damage, target);
6647
6648 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} heal of {} for {} health inflicted by {}",
6649 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId());
6650
6651 uint32 heal = uint32(damage);
6652
6653 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6654 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, heal, GetSpellInfo());
6655 sScriptMgr->ModifyHealReceived(target, caster, heal, GetSpellInfo());
6656
6657 if (target->GetAI())
6658 {
6659 target->GetAI()->OnCalculatePeriodicTickReceived(heal, caster);
6660 }
6661
6662 HealInfo healInfo(caster, target, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6663 Unit::CalcHealAbsorb(healInfo);
6664 int32 gain = Unit::DealHeal(caster, target, healInfo.GetHeal());
6665 healInfo.SetEffectiveHeal(gain);
6666
6667 SpellPeriodicAuraLogInfo pInfo(this, healInfo.GetHeal(), healInfo.GetHeal() - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
6668 target->SendPeriodicAuraLog(&pInfo);
6669
6670 if (caster)
6671 {
6672 float threat = float(gain) * 0.5f;
6673 if (caster->IsClass(CLASS_PALADIN))
6674 threat *= 0.5f;
6675 target->GetThreatMgr().ForwardThreatForAssistingMe(caster, threat, GetSpellInfo());
6676 }
6677
6678 bool haveCastItem = GetBase()->GetCastItemGUID();
6679
6680 // Health Funnel
6681 // damage caster for heal amount
6682 // xinef: caster is available, checked earlier
6683 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST))
6684 {
6685 uint32 manaPerSecond = GetSpellInfo()->ManaPerSecond;
6686 if ((int32)manaPerSecond > gain && gain > 0)
6687 {
6688 manaPerSecond = gain;
6689 }
6690
6691 uint32 absorb2 = 0;
6692 Unit::DealDamageMods(caster, manaPerSecond, &absorb2);
6693
6695 Unit::DealDamage(caster, caster, manaPerSecond, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
6696 }
6697
6698 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6699 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6701 if (healInfo.GetAbsorb() > 0)
6702 procEx |= PROC_EX_ABSORB;
6703
6704 // ignore item heals
6705 if (!haveCastItem && GetAuraType() != SPELL_AURA_OBS_MOD_HEALTH) // xinef: dont allow obs_mod_health to proc spells, this is passive regeneration and not hot
6706 Unit::ProcSkillsAndAuras(caster, target, caster ? procAttacker : 0, procVictim, procEx, heal, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, nullptr, &healInfo);
6707}
@ 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:260
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:103
Definition Unit.h:384
uint32 ManaPerSecond
Definition SpellInfo.h:389
static void CalcHealAbsorb(HealInfo &healInfo)
Definition Unit.cpp:2672
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition Unit.cpp:8079
int32 GetMaxPositiveAuraModifier(AuraType auratype) const
Definition Unit.cpp:6289
static uint32 SpellCriticalHealingBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:9436
int32 GetMaxNegativeAuraModifier(AuraType auratype) const
Definition Unit.cpp:6294
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:9681

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
6540{
6541 if (!caster || !caster->IsAlive() || !target->IsAlive())
6542 return;
6543
6544 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6545 {
6546 SendTickImmune(target, caster);
6547 return;
6548 }
6549
6550 uint32 damage = std::max(GetAmount(), 0);
6551 // do not kill health donator
6552 if (caster->GetHealth() < damage)
6553 damage = caster->GetHealth() - 1;
6554 if (!damage)
6555 return;
6556
6557 caster->ModifyHealth(-(int32)damage);
6558 LOG_DEBUG("spells.aura", "PeriodicTick: donator {} target {} damage {}.", caster->GetEntry(), target->GetEntry(), damage);
6559
6560 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6561
6562 damage = int32(damage * gainMultiplier);
6563
6564 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6565 caster->HealBySpell(healInfo);
6566}
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition Unit.cpp:8376

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
6430{
6431 if (!target->IsAlive())
6432 return;
6433
6434 if (target->IsImmunedToDamage(caster, GetSpellInfo()))
6435 {
6436 SendTickImmune(target, caster);
6437 return;
6438 }
6439
6440 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6441 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6442 return;
6443
6445
6446 uint32 damage = std::max(GetAmount(), 0);
6447
6448 // Script Hook For HandlePeriodicHealthLeechAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6449 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6450
6451 if (target->GetAI())
6452 {
6453 target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
6454 }
6455
6456 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
6457 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6458 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6459
6460 bool crit = false;
6461 if ((crit = roll_chance_f(GetCritChance())))
6462 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6463
6464 // Calculate armor mitigation
6466 {
6467 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6468 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6469 damage = damageReductedArmor;
6470 }
6471
6472 int32 dmg = damage;
6473 int32 cleanDamageAmount = cleanDamage.mitigated_damage;
6474 if (CanApplyResilience())
6475 {
6476 int32 resilienceReduction = dmg;
6477 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6478
6479 resilienceReduction = dmg - resilienceReduction;
6480 dmg -= resilienceReduction;
6481 cleanDamageAmount += resilienceReduction;
6482 }
6483
6484 damage = std::max(0, dmg);
6485 cleanDamage.mitigated_damage = std::max(0, cleanDamageAmount);
6486
6487 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6488 Unit::CalcAbsorbResist(dmgInfo);
6489
6490 uint32 absorb = dmgInfo.GetAbsorb();
6491 uint32 resist = dmgInfo.GetResist();
6492 damage = dmgInfo.GetDamage();
6493
6494 // Set trigger flag
6495 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6496 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6498 if (dmgInfo.GetDamage())
6499 procEx |= crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT;
6500 if (absorb > 0)
6501 procEx |= PROC_EX_ABSORB;
6502
6503 if (dmgInfo.GetDamage())
6504 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6505
6506 if (target->GetHealth() < dmgInfo.GetDamage())
6507 {
6508 dmgInfo.ModifyDamage(dmgInfo.GetDamage() - target->GetHealth());
6509 }
6510
6511 damage = dmgInfo.GetDamage();
6512
6513 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} health leech of {} for {} dmg inflicted by {} abs is {}",
6514 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6515 if (caster)
6516 caster->SendSpellNonMeleeDamageLog(target, GetSpellInfo(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit);
6517
6518 int32 new_damage;
6519
6520 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
6521
6522 Unit::ProcSkillsAndAuras(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6523
6524 if (!caster || !caster->IsAlive())
6525 return;
6526
6527 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6528
6529 uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount()));
6530 heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount()));
6531
6532 HealInfo healInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6533 float threat = float(caster->HealBySpell(healInfo)) * 0.5f;
6534 if (caster->IsClass(CLASS_PALADIN))
6535 threat *= 0.5f;
6536 caster->GetThreatMgr().ForwardThreatForAssistingMe(caster, threat, GetSpellInfo());
6537}
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition Unit.cpp:6716

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(), Unit::SpellHitResult(), sScriptMgr, and ObjectGuid::ToString().

Referenced by PeriodicTick().

◆ HandlePeriodicManaLeechAuraTick()

void AuraEffect::HandlePeriodicManaLeechAuraTick ( Unit target,
Unit caster 
) const
6710{
6712
6713 if (!caster || !caster->IsAlive() || !target->IsAlive() || !target->HasActivePowerType(PowerType))
6714 return;
6715
6716 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6717 {
6718 SendTickImmune(target, caster);
6719 return;
6720 }
6721
6722 if (GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6723 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6724 return;
6725
6726 // ignore negative values (can be result apply spellmods to aura damage
6727 int32 drainAmount = std::max(m_amount, 0);
6728
6729 // Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
6730 // It's mana percent cost spells, m_amount is percent drain from target
6732 {
6733 // max value
6734 int32 maxmana = CalculatePct(caster->GetMaxPower(PowerType), drainAmount * 2.0f);
6735 ApplyPct(drainAmount, target->GetMaxPower(PowerType));
6736 if (drainAmount > maxmana)
6737 drainAmount = maxmana;
6738 }
6739
6740 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} power leech of {} for {} dmg inflicted by {}",
6741 GetCasterGUID().ToString(), target->GetGUID().ToString(), drainAmount, GetId());
6742 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6743 if (PowerType == POWER_MANA)
6744 drainAmount -= target->GetSpellCritDamageReduction(drainAmount);
6745
6746 int32 drainedAmount = -target->ModifyPower(PowerType, -drainAmount);
6747
6748 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6749
6750 SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, gainMultiplier, false);
6751 target->SendPeriodicAuraLog(&pInfo);
6752
6753 int32 gainAmount = int32(drainedAmount * gainMultiplier);
6754 int32 gainedAmount = 0;
6755 if (gainAmount)
6756 {
6757 gainedAmount = caster->ModifyPower(PowerType, gainAmount);
6758 target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
6759 }
6760
6761 // remove CC auras
6763
6764 // Drain Mana
6766 && m_spellInfo->SpellFamilyFlags[0] & 0x00000010)
6767 {
6768 int32 manaFeedVal = 0;
6769 if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
6770 manaFeedVal = aurEff->GetAmount();
6771 // Mana Feed - Drain Mana
6772 if (manaFeedVal > 0)
6773 {
6774 int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
6775 caster->CastCustomSpell(caster, 32554, &feedAmount, nullptr, nullptr, true, nullptr, this);
6776 }
6777 }
6778}
@ AURA_INTERRUPT_FLAG_TAKE_DAMAGE
Definition SpellDefines.h:44
T ApplyPct(T &base, U pct)
Definition Util.h:64
uint32 GetSpellCritDamageReduction(uint32 damage) const
Definition Unit.h:1277

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, Unit::SpellHitResult(), and ObjectGuid::ToString().

Referenced by PeriodicTick().

◆ HandlePeriodicPowerBurnAuraTick()

void AuraEffect::HandlePeriodicPowerBurnAuraTick ( Unit target,
Unit caster 
) const
6849{
6851
6852 if (!caster || !target->IsAlive() || !target->HasActivePowerType(PowerType))
6853 return;
6854
6855 if (target->IsImmunedToDamage(caster, GetSpellInfo()))
6856 {
6857 SendTickImmune(target, caster);
6858 return;
6859 }
6860
6861 // ignore negative values (can be result apply spellmods to aura damage
6862 int32 damage = std::max(m_amount, 0);
6863
6864 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6865 if (PowerType == POWER_MANA)
6866 damage -= target->GetSpellCritDamageReduction(damage);
6867
6868 uint32 gain = uint32(-target->ModifyPower(PowerType, -damage));
6869
6870 float dmgMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6871
6872 SpellInfo const* spellProto = GetSpellInfo();
6873 // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
6874 SpellNonMeleeDamage damageInfo(caster, target, spellProto, spellProto->SchoolMask);
6875 // no SpellDamageBonus for burn mana
6876 caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
6877
6878 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6879
6880 caster->SendSpellNonMeleeDamageLog(&damageInfo);
6881
6882 // Set trigger flag
6883 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6884 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6885 if (damageInfo.damage)
6886 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6887
6888 caster->DealSpellDamage(&damageInfo, true);
6889
6890 DamageInfo dmgInfo(damageInfo, DOT, BASE_ATTACK, SPELL_MISS_NONE);
6891 uint32 hitMask = dmgInfo.GetHitMask() | PROC_EX_INTERNAL_DOT;
6892 Unit::ProcSkillsAndAuras(caster, damageInfo.target, procAttacker, procVictim, hitMask, damageInfo.damage, BASE_ATTACK, spellProto, nullptr, GetEffIndex(), nullptr, &dmgInfo);
6893}
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
Definition Unit.cpp:1641
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
Definition Unit.cpp:1494
Definition Unit.h:509

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

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
1927{
1928 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1929 return;
1930
1931 Unit* target = aurApp->GetTarget();
1932
1933 // no-phase is also phase state so same code for apply and remove
1934 uint32 newPhase = target->GetPhaseByAuras();
1935
1936 if (Player* player = target->ToPlayer())
1937 {
1938 if (!newPhase)
1939 newPhase = PHASEMASK_NORMAL;
1940
1941 // do not change phase to GM with all phases enabled
1942 if (player->IsGameMaster())
1943 newPhase = PHASEMASK_ANYWHERE;
1944
1945 player->SetPhaseMask(newPhase, false);
1946 player->GetSession()->SendSetPhaseShift(newPhase);
1947 }
1948 else
1949 {
1950 if (!newPhase)
1951 {
1952 newPhase = PHASEMASK_NORMAL;
1953 if (Creature* creature = target->ToCreature())
1954 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
1955 newPhase = data->phaseMask;
1956 }
1957
1958 target->SetPhaseMask(newPhase, false);
1959 }
1960
1961 // call functions which may have additional effects after chainging state of unit
1962 // phase auras normally not expected at BG but anyway better check
1963 if (apply)
1964 {
1965 // drop flag at invisibiliy in bg
1967 }
1968
1969 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1970 if (target->IsVisible())
1971 {
1972 if (!target->GetMap()->Instanceable())
1973 {
1974 target->UpdateObjectVisibility(false);
1975 target->m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f);
1976 }
1977 else
1978 target->UpdateObjectVisibility();
1979 }
1980}
@ PHASEMASK_ANYWHERE
Definition Object.h:64
@ PHASEMASK_NORMAL
Definition Object.h:63
uint32 GetPhaseByAuras() const
Definition Unit.cpp:15288
bool IsVisible() const
Definition Unit.h:2012
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:15299
Position m_last_notify_position
Definition Unit.h:2106
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.
3654{
3655 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3656 return;
3657
3658 Unit* target = aurApp->GetTarget();
3659 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
3660 if (target->IsPlayer() || !apply || target->HasFearAura())
3661 return;
3664 target->SetControlled(false, UNIT_STATE_FLEEING);
3665}
bool HasFearAura() const
Definition Unit.h:1835

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
5930{
5931 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5932 return;
5933
5934 if (!aurApp->GetTarget()->IsPlayer())
5935 return;
5936
5937 if (apply)
5938 aurApp->GetTarget()->RemoveByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
5939 else if (!aurApp->GetTarget()->GetMap()->Instanceable())
5940 aurApp->GetTarget()->SetByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
5941}
@ 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 
)
1286{
1287 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1288 if (prevented)
1289 return;
1290
1291 switch (GetAuraType())
1292 {
1298 HandleBreakableCCAuraProc(aurApp, eventInfo);
1299 break;
1300 case SPELL_AURA_DUMMY:
1302 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1303 break;
1305 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1306 break;
1308 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1309 break;
1311 HandleRaidProcFromChargeAuraProc(aurApp, eventInfo);
1312 break;
1315 break;
1316 default:
1317 break;
1318 }
1319
1320 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1321}
@ 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:6966
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6922
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6943
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7014
void HandleBreakableCCAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6895
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6905
bool CallScriptEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2728
void CallScriptAfterEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2747

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 
)
6944{
6945 Unit* target = aurApp->GetTarget();
6946 Unit* triggerTarget = target == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6947 if (!triggerTarget)
6948 return;
6949
6950 if (triggerTarget->IsImmunedToDamage(target, GetSpellInfo()))
6951 {
6952 SendTickImmune(triggerTarget, target);
6953 return;
6954 }
6955
6956 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetSpellInfo(), GetSpellInfo()->SchoolMask);
6957 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetEffIndex());
6958 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
6959 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
6960 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6961 target->SendSpellNonMeleeDamageLog(&damageInfo);
6962 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
6963 target->DealSpellDamage(&damageInfo, true);
6964}
Unit * GetActionTarget() const
Definition Unit.h:461

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 
)
6906{
6907 Unit* triggerCaster = aurApp->GetTarget();
6908 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6909
6910 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
6911 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6912 {
6913 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
6914 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this);
6915 }
6916 else
6917 {
6918 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());
6919 }
6920}

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 
)
6923{
6924 Unit* triggerCaster = aurApp->GetTarget();
6925 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6926
6927 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
6928 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6929 {
6930 // used only with EXTRA_LOGS
6931 (void)triggeredSpellInfo;
6932
6933 int32 basepoints0 = GetAmount();
6934 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell {} with value {} from aura {} proc", triggeredSpellInfo->Id, basepoints0, GetId());
6935 triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, nullptr, nullptr, true, nullptr, this);
6936 }
6937 else
6938 {
6939 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());
6940 }
6941}

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 
)
6967{
6968 Unit* target = aurApp->GetTarget();
6969
6970 uint32 triggerSpellId;
6971 switch (GetId())
6972 {
6973 case 57949: // Shiver
6974 triggerSpellId = 57952;
6975 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
6976 break;
6977 case 59978: // Shiver
6978 triggerSpellId = 59979;
6979 break;
6980 case 43593: // Cold Stare
6981 triggerSpellId = 43594;
6982 break;
6983 default:
6984 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: {}", GetId());
6985 return;
6986 }
6987
6988 int32 jumps = GetBase()->GetCharges();
6989
6990 // current aura expire on proc finish
6991 GetBase()->SetCharges(0);
6992 GetBase()->SetUsingCharges(true);
6993
6994 // next target selection
6995 if (jumps > 0)
6996 {
6997 if (Unit* caster = GetCaster())
6998 {
6999 float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
7000
7001 if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
7002 {
7003 target->CastSpell(triggerTarget, GetSpellInfo(), true, nullptr, this, GetCasterGUID());
7004 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
7005 aura->SetCharges(jumps);
7006 }
7007 }
7008 }
7009
7010 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
7011 target->CastSpell(target, triggerSpellId, true, nullptr, this, GetCasterGUID());
7012}
void SetUsingCharges(bool val)
Definition SpellAuras.h:201
uint8 GetCharges() const
Definition SpellAuras.h:141
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition Unit.cpp:8249

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 
)
7015{
7016 enum
7017 {
7018 SPELL_PRAYER_OF_MENDING_HEAL = 33110,
7019 SPELL_PRAYER_OF_MENDING_VISUAL = 41637
7020 };
7021
7022 Unit* target = aurApp->GetTarget();
7023
7024 // Currently only Prayer of Mending
7025 if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20))
7026 {
7027 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: {}", GetId());
7028 return;
7029 }
7030
7031 int32 value = GetAmount();
7032
7033 int32 jumps = GetBase()->GetCharges();
7034
7035 // current aura expire on proc finish
7036 GetBase()->SetCharges(0);
7037 GetBase()->SetUsingCharges(true);
7038
7039 // next target selection
7040 if (jumps > 0)
7041 {
7042 if (Unit* caster = GetCaster())
7043 {
7044 float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
7045
7046 Unit* triggerTarget = nullptr;
7047 Acore::MostHPMissingGroupInRange u_check(target, radius, 0);
7048 Acore::UnitLastSearcher<Acore::MostHPMissingGroupInRange> searcher(target, triggerTarget, u_check);
7049 Cell::VisitObjects(target, searcher, radius);
7050
7051 if (triggerTarget)
7052 {
7053 target->CastSpell(triggerTarget, SPELL_PRAYER_OF_MENDING_VISUAL, true);
7054 target->CastCustomSpell(triggerTarget, GetId(), &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
7055 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
7056 aura->SetCharges(jumps);
7057 }
7058 }
7059 }
7060
7061 target->CastCustomSpell(target, SPELL_PRAYER_OF_MENDING_HEAL, &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
7062}
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
4839{
4841 return;
4842
4843 Unit* target = aurApp->GetTarget();
4844
4845 if (!target->IsPlayer())
4846 return;
4847
4848 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
4849}

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

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
5043{
5045 return;
5046
5047 Player* target = aurApp->GetTarget()->ToPlayer();
5048 if (!target)
5049 return;
5050
5051 target->HandleBaseModFlatValue(SHIELD_BLOCK_VALUE, float(GetAmount()), apply);
5052}
@ SHIELD_BLOCK_VALUE
Definition Unit.h:190
void HandleBaseModFlatValue(BaseModGroup modGroup, float amount, bool apply)
Definition Player.cpp:5093

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
5055{
5057 return;
5058
5059 Player* target = aurApp->GetTarget()->ToPlayer();
5060 if (!target)
5061 return;
5062
5063 if (apply)
5065 else
5066 {
5068 target->SetBaseModPctValue(SHIELD_BLOCK_VALUE, amount);
5069 }
5070}
@ SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
Definition SpellAuraDefines.h:213
void SetBaseModPctValue(BaseModGroup modGroup, float val)
Definition Player.cpp:5128
void ApplyBaseModPctValue(BaseModGroup modGroup, float pct)
Definition Player.cpp:5106

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
1865{
1866 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1867 return;
1868
1869 Unit* target = aurApp->GetTarget();
1870
1871 if (!target->IsPlayer())
1872 return;
1873
1874 // prepare spirit state
1875 if (apply)
1876 {
1877 // disable breath/etc timers
1878 target->ToPlayer()->StopMirrorTimers();
1879
1880 // set stand state (expected in this form)
1881 if (!target->IsStandState())
1883
1884 target->SetHealth(1);
1885 }
1886 // die at aura end
1887 else if (target->IsAlive())
1888 // call functions which may have additional effects after chainging state of unit
1890
1891 // xinef: damage immunity spell, not needed because of 93 aura (adds non_attackable state)
1892 // xinef: probably blizzard added it just in case in wotlk (id > 46000)
1893 if (apply)
1894 target->CastSpell(target, 62371, true);
1895 else
1896 target->RemoveAurasDueToSpell(62371);
1897}
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:35
void StopMirrorTimers()
Definition Player.h:2086
virtual void setDeathState(DeathState s, bool despawn=false)
Definition Unit.cpp:11348
bool IsStandState() const
Definition Unit.cpp:13087
void SetStandState(uint8 state)
Definition Unit.cpp:13102

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
158 {
159 // useless
160 }

◆ HandleWaterBreathing()

void AuraEffect::HandleWaterBreathing ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3521{
3523 return;
3524
3525 Unit* target = aurApp->GetTarget();
3526
3527 // update timers in client
3528 if (target->IsPlayer())
3529 target->ToPlayer()->UpdateMirrorTimers();
3530}
void UpdateMirrorTimers()
Definition PlayerUpdates.cpp:429

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

◆ HasSpellClassMask()

bool AuraEffect::HasSpellClassMask ( ) const
1119{
1120 return m_spellInfo->Effects[m_effIndex].SpellClassMask;
1121}

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

Referenced by Unit::CalcArmorReducedDamage().

◆ IsAffectedOnSpell()

◆ 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
1130{
1131 bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
1132 if (prevented)
1133 return;
1134
1135 Unit* target = aurApp->GetTarget();
1136
1137 // Update serverside orientation of tracking channeled auras on periodic update ticks
1138 // exclude players because can turn during channeling and shouldn't desync orientation client/server
1140 {
1141 ObjectGuid const channelGuid = caster->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT);
1142 if (!channelGuid.IsEmpty() && channelGuid != caster->GetGUID())
1143 {
1144 if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*caster, channelGuid))
1145 {
1146 caster->SetInFront(objectTarget);
1147 }
1148 }
1149 }
1150
1151 switch (GetAuraType())
1152 {
1154 HandlePeriodicDummyAuraTick(target, caster);
1155 break;
1157 HandlePeriodicTriggerSpellAuraTick(target, caster);
1158 break;
1160 // Don't actually do anything - client will trigger casts of these spells by itself
1161 break;
1164 break;
1167 HandlePeriodicDamageAurasTick(target, caster);
1168 break;
1170 HandlePeriodicHealthLeechAuraTick(target, caster);
1171 break;
1173 HandlePeriodicHealthFunnelAuraTick(target, caster);
1174 break;
1177 HandlePeriodicHealAurasTick(target, caster);
1178 break;
1180 HandlePeriodicManaLeechAuraTick(target, caster);
1181 break;
1183 HandleObsModPowerAuraTick(target, caster);
1184 break;
1186 HandlePeriodicEnergizeAuraTick(target, caster);
1187 break;
1189 HandlePeriodicPowerBurnAuraTick(target, caster);
1190 break;
1191 default:
1192 break;
1193 }
1194}
@ SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL
Definition SharedDefines.h:421
void HandlePeriodicPowerBurnAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6848
void HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6709
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6780
void HandlePeriodicHealthFunnelAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6539
void HandlePeriodicHealAurasTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6568
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6814
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6000
void HandlePeriodicDummyAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:5943
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6429
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6277
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6243
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
Definition SpellAuras.cpp:2480
bool IsEmpty() const
Definition ObjectGuid.h:165
bool IsChanneled() const
Definition SpellInfo.cpp:1288
void SetInFront(WorldObject const *target)
Definition Unit.cpp:16425
Definition Object.h:476
WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:115

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
118{ 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:7064
void PeriodicTick(AuraApplication *aurApp, Unit *caster) const
Definition SpellAuraEffects.cpp:1129
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 66823:
1038 case 67618:
1039 case 67619:
1040 case 67620: // Paralytic Toxin
1041 // Get 0 effect aura
1042 if (AuraEffect* slow = GetBase()->GetEffect(0))
1043 {
1044 int32 newAmount = slow->GetAmount() - 10;
1045 if (newAmount < -100)
1046 newAmount = -100;
1047 slow->ChangeAmount(newAmount);
1048 }
1049 break;
1050 case 66020:
1051 // Get 0 effect aura
1052 if (AuraEffect* slow = GetBase()->GetEffect(0))
1053 {
1054 int32 newAmount = slow->GetAmount() + GetAmount();
1055 if (newAmount > 0)
1056 newAmount = 0;
1057 slow->ChangeAmount(newAmount);
1058 }
1059 break;
1060 default:
1061 break;
1062 }
1063 break;
1064 default:
1065 break;
1066 }
1067 default:
1068 break;
1069 }
1071}
@ SPELL_AURA_MOD_POWER_REGEN
Definition SpellAuraDefines.h:148
void RefreshDuration(bool withMods=false)
Definition SpellAuras.cpp:827
void CallScriptEffectUpdatePeriodicHandlers(AuraEffect *aurEff)
Definition SpellAuras.cpp:2500
bool InArena() const
Definition Player.cpp:12537

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(), 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: