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:1177
uint8 GetLevel() const
Definition Unit.h:1109
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1582
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:9137
void AddSpellMod(SpellModifier *mod, bool apply)
Definition Player.cpp:10083
SpellCastResult CheckShapeshift(uint32 form) const
Definition SpellInfo.cpp:1453
bool IsAffectedBySpellMod(SpellModifier const *mod) const
Definition SpellInfo.cpp:1353
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1962
boost::container::flat_multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:674
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1389

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:1903
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:12970

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:1434
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:9585
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:8767
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:10001
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:441
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition Unit.cpp:6058
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:9499
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:8439

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;
1237 // Spell magnets do not consume charges for spells they cannot redirect.
1238 if (!spellInfo || !spellInfo->CanBeRedirectedBySpellMagnet())
1239 return false;
1240 break;
1243 {
1244 // Skip melee hits and spells with wrong school or zero cost
1245 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue())
1246 || !spellInfo->ManaCost || !spellInfo->ManaCostPercentage)
1247 return false;
1248 break;
1249 }
1251 // Skip melee hits and spells with wrong school
1252 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue()))
1253 return false;
1254 break;
1256 // Compare casters
1257 if (GetCasterGUID() != eventInfo.GetActor()->GetGUID())
1258 return false;
1259 break;
1262 {
1263 // Don't proc extra attacks while already processing extra attack spell
1264 uint32 triggerSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1265 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
1266 {
1267 if (triggeredSpellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
1268 {
1269 uint32 lastExtraAttackSpell = eventInfo.GetActor()->GetLastExtraAttackSpell();
1270
1271 // Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
1272 if (lastExtraAttackSpell == triggerSpellId)
1273 return false;
1274
1275 // Patch 2.2.0 Sword Specialization (Warrior, Rogue) extra attack can no longer proc additional extra attacks
1276 // 3.3.5 Sword Specialization (Warrior), Hack and Slash (Rogue)
1277 if (lastExtraAttackSpell == SPELL_SWORD_SPECIALIZATION || lastExtraAttackSpell == SPELL_HACK_AND_SLASH)
1278 return false;
1279 }
1280 }
1281 break;
1282 }
1283 default:
1284 break;
1285 }
1286
1287 return result;
1288}
@ SPELL_EFFECT_ADD_EXTRA_ATTACKS
Definition SharedDefines.h:785
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
Definition SpellAuraDefines.h:294
@ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
Definition SpellAuraDefines.h:135
@ SPELL_AURA_MOD_POWER_COST_SCHOOL
Definition SpellAuraDefines.h:136
@ SPELL_AURA_MECHANIC_IMMUNITY
Definition SpellAuraDefines.h:140
@ SPELL_AURA_SPELL_MAGNET
Definition SpellAuraDefines.h:159
@ SPELL_AURA_MOD_DAMAGE_FROM_CASTER
Definition SpellAuraDefines.h:334
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
Definition SpellAuraDefines.h:137
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
Definition SpellAuraDefines.h:180
@ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
Definition SpellAuraDefines.h:128
#define sSpellMgr
Definition SpellMgr.h: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:1908
bool CanBeRedirectedBySpellMagnet() const
Definition SpellInfo.cpp:1056
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:1016

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

◆ CleanupTriggeredSpells()

void AuraEffect::CleanupTriggeredSpells ( Unit target)
Todo:
: is there a spell flag, which can solve this in a more sophisticated way?
1329{
1330 uint32 tSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1331 if (!tSpellId)
1332 return;
1333
1334 SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
1335 if (!tProto)
1336 return;
1337
1338 if (tProto->GetDuration() != -1)
1339 return;
1340
1341 // needed for spell 43680, maybe others
1345 return;
1346
1347 target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
1348}
int32 GetDuration() const
Definition SpellInfo.cpp:2747
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:5190

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
5107{
5108 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5109 return;
5110
5111 Unit* target = aurApp->GetTarget();
5112
5113 if (apply)
5115 else
5116 {
5117 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5118 if (target->HasAuraType(GetAuraType()))
5119 return;
5121 }
5122}
@ 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:6025
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
3436{
3438 return;
3439
3440 Unit* target = aurApp->GetTarget();
3441
3442 if (!apply)
3443 {
3444 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3445 if (target->HasAuraType(GetAuraType()) || target->HasIncreaseMountedFlightSpeedAura())
3446 return;
3447 }
3448
3449 target->SetCanFly(apply);
3450
3451 if (!apply && target->IsCreature() && !target->IsLevitating())
3452 target->GetMotionMaster()->MoveFall();
3453}
@ 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:1763
bool IsLevitating() const
Definition Unit.h:1715
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:16573
bool HasIncreaseMountedFlightSpeedAura() const
Definition Unit.h:1835

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
3214{
3216 return;
3217
3218 Unit* target = aurApp->GetTarget();
3219
3220 if (target->IsPlayer())
3221 {
3222 if (apply)
3224 else
3225 {
3226 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3227 if (target->HasAllowOnlyAbilityAura())
3228 return;
3230 }
3231 }
3232}
@ 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:1823

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

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

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

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

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
3478{
3480 return;
3481
3482 Unit* target = aurApp->GetTarget();
3483
3484 if (Player* targetPlayer = target->ToPlayer())
3485 {
3486 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3487 }
3488
3489 if (!apply)
3490 {
3491 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3492 if (target->HasAuraType(GetAuraType()))
3493 return;
3494 }
3495
3496 target->SetFeatherFall(apply);
3497
3498 // start fall from current height
3499 if (!apply && target->IsPlayer())
3500 target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ());
3501}
#define sScriptMgr
Definition ScriptMgr.h:751
void SetFallInformation(uint32 time, float z)
Definition Player.h:2384
void SetFeatherFall(bool enable)
Definition Unit.cpp:16609
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
1905{
1907 return;
1908
1909 Unit* target = aurApp->GetTarget();
1910
1911 if (!target->IsPlayer())
1912 return;
1913
1914 if (apply)
1915 {
1919 }
1920 else
1921 {
1922 if (target->HasGhostAura())
1923 return;
1924
1928 }
1929}
@ 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:1803
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

3504{
3506 return;
3507
3508 Unit* target = aurApp->GetTarget();
3509
3510 if (Player* targetPlayer = target->ToPlayer())
3511 {
3512 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3513 }
3514
3515 if (!apply)
3516 {
3517 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3518 if (target->HasAuraType(GetAuraType()))
3519 return;
3520 }
3521
3522 target->SetHover(apply);
3523}
void SetHover(bool enable)
Definition Unit.cpp:16650

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
4581{
4583 return;
4584
4585 Unit* target = aurApp->GetTarget();
4586
4587 if (apply)
4589 else
4590 {
4593 }
4594}
@ 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:12012
void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount)
Definition Unit.cpp:11979
float GetTotalAuraMultiplier(AuraType auratype) const
Definition Unit.cpp:6309

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

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
4896{
4898 return;
4899
4900 Unit* target = aurApp->GetTarget();
4901
4903}
@ 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:11953

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

References HandleAuraModAttackPowerOfArmor().

◆ HandleAuraModAttackPowerPercent()

void AuraEffect::HandleAuraModAttackPowerPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4919{
4921 return;
4922
4923 Unit* target = aurApp->GetTarget();
4924
4925 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
4926 if (apply)
4928 else
4929 {
4932 }
4933}
@ 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
4125{
4127 return;
4128
4129 Unit* target = aurApp->GetTarget();
4130 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4131 {
4132 if (GetMiscValue() & int32(1 << x))
4133 {
4134 if (apply)
4136 else
4137 {
4140 }
4141 }
4142 }
4143}
@ 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:6334

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
4630{
4632 return;
4633
4634 Unit* target = aurApp->GetTarget();
4635
4636 if (!target->IsPlayer())
4637 return;
4638
4639 target->ToPlayer()->UpdateBlockPercentage();
4640}
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
4721{
4723 return;
4724
4725 Unit* target = aurApp->GetTarget();
4726
4727 if (!target->IsPlayer())
4728 {
4729 target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
4730 return;
4731 }
4732
4734
4735 // included in Player::UpdateSpellCritChance calculation
4737}
void UpdateAllSpellCritChances()
Definition StatSystem.cpp:889
void UpdateAllWeaponDependentCritAuras()
Definition Player.cpp:7248
int32 m_baseSpellCritChance
Definition Unit.h:2089
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
3896{
3898 return;
3899
3900 Unit* target = aurApp->GetTarget();
3901
3902 target->UpdateSpeed(MOVE_WALK, true);
3903 target->UpdateSpeed(MOVE_RUN, true);
3904 target->UpdateSpeed(MOVE_SWIM, true);
3905 target->UpdateSpeed(MOVE_FLIGHT, true);
3906 target->UpdateSpeed(MOVE_RUN_BACK, true);
3907 target->UpdateSpeed(MOVE_SWIM_BACK, true);
3908 target->UpdateSpeed(MOVE_FLIGHT_BACK, true);
3909
3910 if (Player* targetPlayer = target->ToPlayer())
3911 {
3912 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3913 }
3914}
@ 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:11125

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

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
4067{
4068 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4069 return;
4070
4071 Unit* target = aurApp->GetTarget();
4073}
void ApplyAllSpellImmunitiesTo(Unit *target, SpellEffectInfo const *effect, bool apply) const
Definition SpellInfo.cpp:2497

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
4054{
4055 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4056 return;
4057
4058 Unit* target = aurApp->GetTarget();
4059
4061
4062 if (apply)
4063 target->GetThreatMgr().EvaluateSuppressed();
4064}
void EvaluateSuppressed(bool canExpire=false)
Definition ThreatManager.cpp:374
ThreatManager & GetThreatMgr()
Definition Unit.h:957

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
4617{
4619 return;
4620
4621 Unit* target = aurApp->GetTarget();
4622
4623 if (!target->IsPlayer())
4624 return;
4625
4626 target->ToPlayer()->UpdateDodgePercentage();
4627}
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
3956{
3957 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3958 return;
3959
3960 Unit* target = aurApp->GetTarget();
3961
3962 target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
3963
3964 // when removing flag aura, handle flag drop
3965 Player* player = target->ToPlayer();
3966 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
3967 {
3968 if (player->InBattleground())
3969 {
3970 if (Battleground* bg = player->GetBattleground())
3971 bg->EventPlayerDroppedFlag(player);
3972 }
3973 else
3974 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
3975 }
3976}
#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:2299

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
4407{
4409 return;
4410
4411 Unit* target = aurApp->GetTarget();
4412
4413 if (!target->IsPlayer())
4414 return;
4415
4418}
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
5733{
5734 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5735 return;
5736
5737 Unit* target = aurApp->GetTarget();
5738
5739 if (apply)
5740 {
5741 target->SetFaction(GetMiscValue());
5742 if (target->IsPlayer())
5744 }
5745 else
5746 {
5747 target->RestoreFaction();
5748 if (target->IsPlayer())
5750 }
5751}
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition UnitDefines.h:260
void SetFaction(uint32 faction)
Definition Unit.cpp:7118
void RestoreFaction()
Definition Unit.cpp:14973

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
5860{
5862 return;
5863
5864 Player* target = aurApp->GetTarget()->ToPlayer();
5865 if (!target)
5866 return;
5867
5870}
@ 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
4508{
4510 return;
4511
4512 Unit* target = aurApp->GetTarget();
4513
4515 // do not check power type, we can always modify the maximum
4516 // as the client will not see any difference
4517 // also, placing conditions that may change during the aura duration
4518 // inside effect handlers is not a good idea
4519 //if (int32(PowerType) != GetMiscValue())
4520 // return;
4521
4522 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4523
4524 target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
4525}
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
4528{
4530 return;
4531
4532 Unit* target = aurApp->GetTarget();
4533
4535 // do not check power type, we can always modify the maximum
4536 // as the client will not see any difference
4537 // also, placing conditions that may change during the aura duration
4538 // inside effect handlers is not a good idea
4539 //if (int32(PowerType) != GetMiscValue())
4540 // return;
4541
4542 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4543
4544 if (apply)
4545 {
4546 float amount = float(GetAmount());
4547 target->ApplyStatPctModifier(unitMod, TOTAL_PCT, amount);
4548 }
4549 else
4550 {
4552 target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
4553 }
4554}
@ SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
Definition SpellAuraDefines.h:195
float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6374

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.

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

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
4463{
4465 return;
4466
4467 Unit* target = aurApp->GetTarget();
4468
4469 if (apply)
4470 {
4472 target->ModifyHealth(GetAmount());
4473 }
4474 else
4475 {
4476 if (int32(target->GetHealth()) > GetAmount())
4477 target->ModifyHealth(-GetAmount());
4478 else
4479 target->SetHealth(1);
4481 }
4482}
int32 ModifyHealth(int32 val)
Definition Unit.cpp:10975
void SetHealth(uint32 val)
Definition Unit.cpp:12353
uint32 GetHealth() const
Definition Unit.h:1114

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
4557{
4559 return;
4560
4561 Unit* target = aurApp->GetTarget();
4562
4563 // Unit will keep hp% after MaxHealth being modified if unit is alive.
4564 float percent = target->GetHealthPct();
4565
4566 if (apply)
4568 else
4569 {
4572 }
4573
4574 // Xinef: pct was rounded down and could "kill" creature by setting its health to 0 making npc zombie
4575 if (target->IsAlive())
4576 if (uint32 healthAmount = CalculatePct(target->GetMaxHealth(), percent))
4577 target->SetHealth(healthAmount);
4578}
@ 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:1116
uint32 GetMaxHealth() const
Definition Unit.h:1115

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

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
3836{
3837 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3838}
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3820

References HandleAuraModIncreaseSpeed().

◆ HandleAuraModIncreaseSpeed()

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

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
3881{
3883 return;
3884
3885 Unit* target = aurApp->GetTarget();
3886
3887 target->UpdateSpeed(MOVE_SWIM, true);
3888
3889 if (Player* targetPlayer = target->ToPlayer())
3890 {
3891 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3892 }
3893}

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

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

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
4601{
4603 return;
4604
4605 Unit* target = aurApp->GetTarget();
4606
4607 if (!target->IsPlayer())
4608 return;
4609
4610 if (!target->ToPlayer()->CanParry())
4611 target->ToPlayer()->SetCanParry(true);
4612 else
4613 target->ToPlayer()->UpdateParryPercentage();
4614}
void UpdateParryPercentage()
Definition StatSystem.cpp:753
bool CanParry() const
Definition Player.h:2214
void SetCanParry(bool value)
Definition Player.cpp:13429

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
3333{
3335 return;
3336
3337 Unit* target = aurApp->GetTarget();
3338
3339 if (!target->IsPlayer())
3340 return;
3341
3342 // Recalculate pet talent points
3343 if (Pet* pet = target->ToPlayer()->GetPet())
3344 pet->InitTalentForLevel();
3345}

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
4906{
4908 return;
4909
4910 Unit* target = aurApp->GetTarget();
4911
4912 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
4913 return;
4914
4916}
#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
4936{
4938 return;
4939
4940 Unit* target = aurApp->GetTarget();
4941
4942 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
4943 return;
4944
4945 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
4946 if (apply)
4948 else
4949 {
4952 }
4953}
@ 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
4834{
4836 return;
4837
4838 Unit* target = aurApp->GetTarget();
4839
4840 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
4841}
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:13467

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
4643{
4644 HandleModManaRegen(aurApp, mode, apply);
4645}
void HandleModManaRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4448

References HandleModManaRegen().

◆ HandleAuraModResistance()

void AuraEffect::HandleAuraModResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4107{
4109 return;
4110
4111 Unit* target = aurApp->GetTarget();
4112
4113 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4114 {
4115 if (GetMiscValue() & int32(1 << x))
4116 {
4118 if (target->IsPlayer() || target->IsPet())
4120 }
4121 }
4122}
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:6444

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
4084{
4086 return;
4087
4088 Unit* target = aurApp->GetTarget();
4089
4090 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4091 {
4092 if (GetMiscValue() & int32(1 << x))
4093 {
4095 if (amount < GetAmount())
4096 {
4097 float value = float(GetAmount() - amount);
4099 if (target->IsPlayer() || target->IsPet())
4101 }
4102 }
4103 }
4104}
@ 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:6344

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

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
2901{
2903 return;
2904
2905 aurApp->GetTarget()->RecalculateObjectScale();
2906}

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
3992{
3993 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3994 return;
3995
3996 Unit* target = aurApp->GetTarget();
3997
3998 target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, GetMiscValue(), (apply));
3999
4000 if (apply)
4001 target->GetThreatMgr().EvaluateSuppressed();
4002
4003 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4004 {
4005 if (apply)
4007 else
4008 {
4009 bool banishFound = false;
4010 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
4011 for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
4012 if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4013 {
4014 banishFound = true;
4015 break;
4016 }
4017 if (!banishFound)
4019 }
4020 }
4021
4022 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
4024
4025 // remove all flag auras (they are positive, but they must be removed when you are immune)
4029
4031 if ((apply)
4033 && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
4034 {
4035 uint32 school_mask = GetMiscValue();
4036 Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
4037 for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
4038 {
4039 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
4040 if ((spell->GetSchoolMask() & school_mask)//Check for school mask
4041 && GetSpellInfo()->CanDispelAura(spell)
4042 && !iter->second->IsPositive() //Don't remove positive spells
4043 && spell->Id != GetId()) //Don't remove self
4044 {
4045 target->RemoveAura(iter);
4046 }
4047 else
4048 ++iter;
4049 }
4050 }
4051}
@ 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:1380
bool IsPositive() const
Definition SpellInfo.cpp:1278
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:5469

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

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
3348{
3350 return;
3351 Unit* target = aurApp->GetTarget();
3352
3353 if (!target->IsPlayer())
3354 return;
3355
3356 uint32 prot = GetMiscValue();
3357 int32 points = GetAmount();
3358
3359 target->ToPlayer()->ModifySkillBonus(prot, ((apply) ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
3360 if (prot == SKILL_DEFENSE)
3361 target->ToPlayer()->UpdateDefenseBonusesMod();
3362}
@ 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:5469
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
3290{
3292 return;
3293
3294 Unit* target = aurApp->GetTarget();
3295
3296 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
3297 if (apply)
3299 else
3300 {
3301 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3302 if (!target->HasAuraType(GetAuraType()))
3304 }
3305
3306 // call functions which may have additional effects after chainging state of unit
3307 target->UpdateObjectVisibility(target->IsPlayer());
3308}
@ 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:15376

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
4205{
4207 return;
4208
4209 if (GetMiscValue() < -2 || GetMiscValue() > 4)
4210 {
4211 LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
4212 return;
4213 }
4214
4215 Unit* target = aurApp->GetTarget();
4217 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4218 return;
4219
4220 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4221 {
4222 // -1 or -2 is all stats (misc < -2 checked in function beginning)
4223 if (GetMiscValue() < 0 || GetMiscValue() == i)
4224 {
4225 if (spellGroupVal)
4227
4229 if (target->IsPlayer() || target->IsPet())
4230 target->UpdateStatBuffMod(Stats(i));
4231 }
4232 }
4233}
#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:4567
void UpdateStatBuffMod(Stats stat)
Definition Unit.cpp:6473

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
3637{
3638 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3639 return;
3640
3641 Unit* target = aurApp->GetTarget();
3642
3643 target->SetControlled(apply, UNIT_STATE_STUNNED);
3644 if (apply)
3645 target->GetThreatMgr().EvaluateSuppressed();
3646}
@ 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
3569{
3571 return;
3572
3573 Unit* target = aurApp->GetTarget();
3574
3575 if (!target->IsAlive() || !target->IsPlayer())
3576 return;
3577
3578 Unit* caster = GetCaster();
3579 if (caster && caster->IsAlive())
3581}
void UpdateMyTempModifiers()
Definition ThreatManager.cpp:807

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

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
4648{
4650 return;
4651
4652 Player* target = aurApp->GetTarget()->ToPlayer();
4653
4654 if (!target)
4655 return;
4656
4658}

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

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
5844{
5845 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5846 return;
5847
5848 Unit* target = aurApp->GetTarget();
5849
5850 if (!target->IsPlayer() || !target->IsInWorld())
5851 return;
5852
5853 if (apply)
5854 target->ToPlayer()->GetSession()->SendStablePet(target->GetGUID());
5855
5856 // client auto close stable dialog at !apply aura
5857}
bool IsInWorld() const
Definition Object.h:109
WorldSession * GetSession() const
Definition Player.h:2031
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
5873{
5874 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5875 return;
5876
5877 Player* target = aurApp->GetTarget()->ToPlayer();
5878
5879 if (!target || !target->IsInWorld())
5880 return;
5881
5882 uint32 overrideId = uint32(GetMiscValue());
5883
5884 if (apply)
5885 {
5887 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5888 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5889 if (uint32 spellId = overrideSpells->spellId[i])
5890 target->_addSpell(spellId, SPEC_MASK_ALL, true);
5891 }
5892 else
5893 {
5895 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5896 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5897 if (uint32 spellId = overrideSpells->spellId[i])
5898 target->removeSpell(spellId, SPEC_MASK_ALL, true);
5899 }
5900}
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
5145{
5146 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5147 return;
5148
5149 Unit* target = aurApp->GetTarget();
5150
5151 if (!target->IsPlayer())
5152 return;
5153
5154 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
5155 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
5156 if (!(apply) && GetBase()->GetDuration() == 0)
5157 target->AddComboPoints(-GetAmount());
5158}
void AddComboPoints(Unit *target, int8 count)
Definition Unit.cpp:13246

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

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
3311{
3313 return;
3314
3315 Unit* target = aurApp->GetTarget();
3316
3317 if (apply)
3319 else
3320 {
3321 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3322 if (target->HasAuraType(GetAuraType()))
3323 return;
3325 }
3326}
@ 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
3456{
3458 return;
3459
3460 Unit* target = aurApp->GetTarget();
3461
3462 if (Player* targetPlayer = target->ToPlayer())
3463 {
3464 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3465 }
3466
3467 if (!apply)
3468 {
3469 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3470 if (target->HasAuraType(GetAuraType()))
3471 return;
3472 }
3473
3474 target->SetWaterWalking(apply);
3475}
void SetWaterWalking(bool enable)
Definition Unit.cpp:16703

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

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

◆ HandleBreakableCCAuraProc()

void AuraEffect::HandleBreakableCCAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
6901{
6902 int32 const damageLeft = GetAmount() - static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage());
6903
6904 if (damageLeft <= 0)
6905 aurApp->GetTarget()->RemoveAura(aurApp);
6906 else
6907 SetAmount(damageLeft);
6908}
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
5606{
5607 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5608 return;
5609
5610 if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
5611 return;
5612
5613 Unit* caster = GetCaster();
5614
5615 if (!caster || !caster->IsPlayer())
5616 return;
5617
5618 Player* plCaster = caster->ToPlayer();
5619
5620 // Item amount
5621 if (GetAmount() <= 0)
5622 return;
5623
5624 if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
5625 return;
5626
5627 //Adding items
5628 uint32 noSpaceForCount = 0;
5629 uint32 count = m_amount;
5630
5631 ItemPosCountVec dest;
5632 InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount);
5633 if (msg != EQUIP_ERR_OK)
5634 {
5635 count -= noSpaceForCount;
5636 plCaster->SendEquipError(msg, nullptr, nullptr, GetSpellInfo()->Effects[m_effIndex].ItemType);
5637 if (count == 0)
5638 return;
5639 }
5640
5641 Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true);
5642 if (!newitem)
5643 {
5644 plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
5645 return;
5646 }
5647 plCaster->SendNewItem(newitem, count, true, true);
5648}
InventoryResult
Definition Item.h:46
@ EQUIP_ERR_ITEM_NOT_FOUND
Definition Item.h:70
@ EQUIP_ERR_OK
Definition Item.h:47
@ NULL_BAG
Definition Item.h:40
@ NULL_SLOT
Definition Item.h:41
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:758
@ AURA_REMOVE_BY_DEATH
Definition SpellAuraDefines.h:396
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
Definition PlayerStorage.cpp:4855
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0, bool refund=false)
Definition PlayerStorage.cpp:2635
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition PlayerStorage.cpp:4131
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.h:1304

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

◆ HandleCharmConvert()

void AuraEffect::HandleCharmConvert ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3767{
3768 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3769 return;
3770
3771 Unit* target = aurApp->GetTarget();
3772
3773 Unit* caster = GetCaster();
3774
3775 if (apply)
3776 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
3777 else
3778 target->RemoveCharmedBy(caster);
3779}
@ CHARM_TYPE_CONVERT
Definition CharmInfo.h:48
void RemoveCharmedBy(Unit *charmer)
Definition Unit.cpp:14818
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:14614

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
5754{
5756 return;
5757
5758 Unit* target = aurApp->GetTarget();
5759
5760 if (apply)
5762 else
5763 {
5764 if (target->HasAuraType(GetAuraType()))
5765 return;
5766
5768 }
5769}
@ 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
1837{
1839 {
1840 return;
1841 }
1842
1843 Unit* target = aurApp->GetTarget();
1844 if (!target->IsPlayer())
1845 {
1846 return;
1847 }
1848
1849 if (apply)
1850 {
1851 target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1852 }
1853 else
1854 {
1855 if (target->HasDetectAmoreAura())
1856 {
1858 for (AuraEffect const* aurEff : amoreAuras)
1859 if (GetMiscValue() == aurEff->GetMiscValue())
1860 {
1861 return;
1862 }
1863 }
1864
1865 target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1866 }
1867}
@ SPELL_AURA_DETECT_AMORE
Definition SpellAuraDefines.h:233
bool HasDetectAmoreAura() const
Definition Unit.h:1822

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

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
5666{
5667 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5668 {
5669 return;
5670 }
5671
5672 Unit* caster = GetCaster();
5673 if (!caster || !caster->IsPlayer())
5674 {
5675 return;
5676 }
5677
5678 Player* player = caster->ToPlayer();
5679 if (apply)
5680 {
5682 }
5683 else
5684 {
5685 player->ResetFarSightDistance();
5686 }
5687
5688 caster->UpdateObjectVisibility(!apply);
5689}
void SetFarSightDistance(float radius)
Definition Player.cpp:16623
void ResetFarSightDistance()
Definition Player.cpp:16628
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2732

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
2937{
2938 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2939 return;
2940
2941 Unit* target = aurApp->GetTarget();
2942
2943 if (!target->IsPlayer())
2944 return;
2945
2946 if (Player* targetPlayer = target->ToPlayer())
2947 {
2948 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2949 }
2950
2951 if (apply)
2952 {
2953 /*
2954 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2955 data<<target->GetGUID();
2956 data<<uint8(0);
2957 target->SendMessageToSet(&data, true);
2958 */
2959
2960 UnitList targets;
2961 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
2963 Cell::VisitObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2964 for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2965 {
2966 if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2967 continue;
2968
2970 {
2971 if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2972 {
2973 SpellInfo const* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo();
2974 if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->IsCreature())
2975 {
2976 Creature* c = (*iter)->ToCreature();
2977 if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
2978 continue;
2979 }
2980 bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY)
2981 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
2982 if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST))
2983 {
2984 // at least one effect truly targets an unit, interrupt the spell
2985 interrupt = true;
2986 break;
2987 }
2988 if (interrupt)
2989 (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
2990 }
2991 }
2992 }
2993
2994 for (auto& pair : target->GetThreatMgr().GetThreatenedByMeList())
2995 pair.second->ScaleThreat(0.0f);
2996
2997 if (target->GetInstanceScript() && target->GetInstanceScript()->IsEncounterInProgress())
2998 {
2999 target->AttackStop();
3000 if (Player* targetPlayer = target->ToPlayer())
3001 targetPlayer->SendAttackSwingCancelAttack();
3002 }
3003 else
3004 target->CombatStop(false, false);
3005
3007
3008 // prevent interrupt message
3009 if (GetCasterGUID() == target->GetGUID())
3010 {
3012 target->FinishSpell(CURRENT_GENERIC_SPELL, true);
3013
3014 // interrupt autoshot
3016 {
3018 target->ToPlayer()->SendAutoRepeatCancel(target);
3019 }
3020 }
3021
3022 target->InterruptNonMeleeSpells(true);
3023
3024 // stop handling the effect if it was removed by linked event
3025 if (aurApp->GetRemoveMode())
3026 return;
3027 // blizz like 2.0.x
3029 // blizz like 2.0.x
3031 // blizz like 2.0.x
3033
3035 }
3036 else
3037 {
3038 /*
3039 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
3040 data<<target->GetGUID();
3041 data<<uint8(1);
3042 target->SendMessageToSet(&data, true);
3043 */
3044 // blizz like 2.0.x
3046 // blizz like 2.0.x
3048 // blizz like 2.0.x
3050
3052 }
3053}
@ 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:3301
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:200
void SendAutoRepeatCancel(Unit *target)
Definition PlayerMisc.cpp:154
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4313
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition Unit.cpp:4271
void CombatStop(bool includingCast=false, bool mutualPvP=true)
Definition Unit.cpp:7533
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:7500
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
3538{
3540 return;
3541
3542 Unit* target = aurApp->GetTarget();
3543
3544 if (apply)
3546 else
3547 {
3548 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3549 if (target->HasAuraType(GetAuraType()))
3550 return;
3552 }
3553}
@ 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
5692{
5694 return;
5695
5696 Unit* target = aurApp->GetTarget();
5697
5698 if (!target->IsPlayer())
5699 return;
5700
5701 Player* player = target->ToPlayer();
5702
5703 uint32 faction_id = GetMiscValue();
5704 ReputationRank faction_rank = ReputationRank(m_amount);
5705
5706 player->GetReputationMgr().ApplyForceReaction(faction_id, faction_rank, apply);
5708
5709 // stop fighting if at apply forced rank friendly or at remove real rank friendly
5710 if ((apply && faction_rank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(faction_id) >= REP_FRIENDLY))
5711 player->StopAttackFaction(faction_id);
5712}
ReputationRank
Definition SharedDefines.h:156
@ REP_FRIENDLY
Definition SharedDefines.h:161
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:6026
ReputationMgr & GetReputationMgr()
Definition Player.h:2156
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:16098

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

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
3752{
3753 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3754 return;
3755
3756 Unit* target = aurApp->GetTarget();
3757
3758 Unit* caster = GetCaster();
3759
3760 if (apply)
3761 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3762 else
3763 target->RemoveCharmedBy(caster);
3764}
@ 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
4780{
4782 return;
4783
4784 Unit* target = aurApp->GetTarget();
4786 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4787 return;
4788
4789 if (spellGroupVal)
4790 {
4791 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
4792 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4793 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4794 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
4795 }
4796
4797 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
4798 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4799 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4800 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
4801}
@ 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
3615{
3616 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3617 return;
3618
3619 Unit* target = aurApp->GetTarget();
3620
3621 target->SetControlled(apply, UNIT_STATE_CONFUSED);
3622 if (apply)
3623 target->GetThreatMgr().EvaluateSuppressed();
3624}
@ 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
4987{
4989 return;
4990
4991 Unit* target = aurApp->GetTarget();
4992
4994 target->UpdateAllDamageDoneMods();
4995
4996 // Magic damage modifiers implemented in Unit::SpellBaseDamageBonus
4997 // This information for client side use only
4998 if (target->IsPlayer())
4999 {
5001 for (uint16 i = 0; i < MAX_SPELL_SCHOOL; ++i)
5002 if (GetMiscValue() & (1 << i))
5003 target->ApplyModInt32Value(baseField + i, GetAmount(), apply);
5004
5005 if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
5006 pet->UpdateAttackPowerAndDamage();
5007 }
5008}
@ 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:12136

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
5011{
5013 return;
5014
5015 Unit* target = aurApp->GetTarget();
5016 if (!target)
5017 return;
5018
5021
5022 if (target->IsPlayer())
5023 {
5024 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
5025 {
5026 if (GetMiscValue() & (1 << i))
5027 {
5028 // only aura type modifying PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
5031 }
5032 }
5033 }
5034}
@ 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:12180

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
3597{
3598 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3599 return;
3600
3601 Unit* caster = GetCaster();
3602 Unit* target = aurApp->GetTarget();
3603
3604 if (!caster || !caster->IsAlive() || !target->IsAlive() || !caster->CanHaveThreatList())
3605 return;
3606
3607 caster->GetThreatMgr().TauntUpdate();
3608}
void TauntUpdate()
Definition ThreatManager.cpp:526

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
3627{
3628 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3629 return;
3630
3631 Unit* target = aurApp->GetTarget();
3632
3633 target->SetControlled(apply, UNIT_STATE_FLEEING, GetCaster(), true);
3634}
@ 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
4331{
4333 return;
4334
4335 Unit* target = aurApp->GetTarget();
4336
4337 if (!target->IsPlayer())
4338 return;
4339 // implemented in Unit::SpellHealingBonus
4340 // this information is for client side only
4342}
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
4661{
4663 return;
4664
4665 Unit* target = aurApp->GetTarget();
4666
4667 if (target->IsPlayer())
4668 {
4669 target->ToPlayer()->UpdateMeleeHitChances();
4670 target->ToPlayer()->UpdateRangedHitChances();
4671 }
4672 else
4673 {
4674 target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
4675 target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
4676 }
4677}
void UpdateMeleeHitChances()
Definition StatSystem.cpp:871
void UpdateRangedHitChances()
Definition StatSystem.cpp:877
float m_modRangedHitChance
Definition Unit.h:2087
float m_modMeleeHitChance
Definition Unit.h:2086

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
1679{
1681 return;
1682
1683 Unit* target = aurApp->GetTarget();
1685
1686 if (apply)
1687 {
1688 // apply glow vision
1689 if (target->IsPlayer() && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10))
1691
1692 target->m_invisibility.AddFlag(type);
1693 target->m_invisibility.AddValue(type, GetAmount());
1694 }
1695 else
1696 {
1697 if (!target->HasInvisibilityAura())
1698 {
1699 // if not have different invisibility auras.
1700 // always remove glow vision
1701 if (target->IsPlayer())
1703
1704 target->m_invisibility.DelFlag(type);
1705 }
1706 else
1707 {
1708 bool found = false;
1710 for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i)
1711 {
1712 if (GetMiscValue() == (*i)->GetMiscValue())
1713 {
1714 found = true;
1715 break;
1716 }
1717 }
1718 if (!found)
1719 {
1720 target->m_invisibility.DelFlag(type);
1721
1722 // if not have invisibility auras of type INVISIBILITY_GENERAL
1723 // remove glow vision
1725 {
1727 }
1728 }
1729 }
1730
1731 target->m_invisibility.AddValue(type, -GetAmount());
1732 }
1733
1734 // call functions which may have additional effects after chainging state of unit
1735 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1736 {
1737 // drop flag at invisibiliy in bg
1739 }
1740
1741 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1742 target->bRequestForcedVisibilityUpdate = false;
1743}
@ 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:298
bool IsPlayer() const
Definition ObjectGuid.h:172
bool bRequestForcedVisibilityUpdate
Definition Unit.h:2116
ObjectGuid GetOwnerGUID() const
Definition Unit.h:714
bool HasInvisibilityAura() const
Definition Unit.h:1848
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
1654{
1656 return;
1657
1658 Unit* target = aurApp->GetTarget();
1660
1661 if (apply)
1662 {
1663 target->m_invisibilityDetect.AddFlag(type);
1664 target->m_invisibilityDetect.AddValue(type, GetAmount());
1665 }
1666 else
1667 {
1668 if (!target->HasInvisibilityDetectAura())
1669 target->m_invisibilityDetect.DelFlag(type);
1670
1671 target->m_invisibilityDetect.AddValue(type, -GetAmount());
1672 }
1673
1674 // call functions which may have additional effects after chainging state of unit
1675 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1676}
bool HasInvisibilityDetectAura() const
Definition Unit.h:1849
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
4449{
4451 return;
4452
4453 Unit* target = aurApp->GetTarget();
4454
4455 if (!target->IsPlayer())
4456 return;
4457
4458 //Note: an increase in regen does NOT cause threat.
4459 target->ToPlayer()->UpdateManaRegen();
4460}
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
4815{
4817 return;
4818
4819 Unit* target = aurApp->GetTarget();
4821 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4822 return;
4823
4824 if (spellGroupVal)
4825 {
4826 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4827 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4828 }
4829 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4830 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4831}
@ 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
5037{
5039 return;
5040
5041 Unit* target = aurApp->GetTarget();
5042
5043 // also handles spell group stacks
5045}
void UpdateDamagePctDoneMods(WeaponAttackType attackType)
Definition Unit.cpp:12142

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

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
3699{
3700 // Used by spell "Eyes of the Beast"
3701
3702 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3703 return;
3704
3705 Unit* caster = GetCaster();
3706 if (!caster || !caster->IsPlayer())
3707 return;
3708
3709 //seems it may happen that when removing it is no longer owner's pet
3710 //if (caster->ToPlayer()->GetPet() != target)
3711 // return;
3712
3713 Unit* target = aurApp->GetTarget();
3714 if (!target->IsCreature() || !target->IsPet())
3715 return;
3716
3717 Pet* pet = target->ToPet();
3718
3719 if (apply)
3720 {
3721 if (caster->ToPlayer()->GetPet() != pet)
3722 return;
3723
3724 // Must clear current motion or pet leashes back to owner after a few yards
3725 // when under spell 'Eyes of the Beast'
3726 pet->GetMotionMaster()->Clear();
3727 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3728 }
3729 else
3730 {
3731 pet->RemoveCharmedBy(caster);
3732
3733 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
3734 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
3735 else
3736 {
3737 // Reinitialize the pet bar or it will appear greyed out
3738 caster->ToPlayer()->PetSpellInitialize();
3739
3740 // Follow owner only if not fighting or owner didn't click "stay" at new location
3741 // This may be confusing because pet bar shows "stay" when under the spell but it retains
3742 // the "follow" flag. Player MUST click "stay" while under the spell.
3743 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3744 {
3746 }
3747 }
3748 }
3749}
@ 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:194
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition Pet.cpp:904
void PetSpellInitialize()
Definition Player.cpp:9740
Pet * ToPet()
Definition Unit.h:730
CharmInfo * GetCharmInfo()
Definition Unit.h:1287
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
5095{
5097 return;
5098
5099 Unit* target = aurApp->GetTarget();
5100
5101 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5102 if (GetMiscValue() & (1 << i))
5104}
@ 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
5082{
5084 return;
5085
5086 Unit* target = aurApp->GetTarget();
5087
5088 float amount = CalculatePct(1.0f, GetAmount());
5089 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5090 if (GetMiscValue() & (1 << i))
5092}
@ 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
4424{
4426 return;
4427
4428 Unit* target = aurApp->GetTarget();
4429
4430 if (!target->IsPlayer())
4431 return;
4432
4433 // Update manaregen value
4434 if (GetMiscValue() == POWER_MANA)
4435 target->ToPlayer()->UpdateManaRegen();
4436 else if (GetMiscValue() == POWER_ENERGY)
4437 target->ToPlayer()->UpdateEnergyRegen();
4438 else if (GetMiscValue() == POWER_RUNE)
4440 // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
4441}
@ 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
4444{
4445 HandleModPowerRegen(aurApp, mode, apply);
4446}
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4423

References HandleModPowerRegen().

◆ HandleModRating()

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

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

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
4146{
4148 return;
4149
4150 Unit* target = aurApp->GetTarget();
4151
4152 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
4153 {
4154 if (GetMiscValue() & int32(1 << i))
4155 {
4158 continue;
4159
4161 if (target->IsPlayer() || target->IsPet())
4163 }
4164 }
4165}
@ SPELL_AURA_MOD_RESISTANCE_PCT
Definition SpellAuraDefines.h:164
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:12032

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
4706{
4708 return;
4709
4710 Unit* target = aurApp->GetTarget();
4711
4712 if (!target->IsPlayer())
4713 return;
4714
4715 for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
4716 if (GetMiscValue() & (1 << school))
4717 target->ToPlayer()->UpdateSpellCritChance(school);
4718}
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
4301{
4303 return;
4304
4305 Unit* target = aurApp->GetTarget();
4306
4307 if (!target->IsPlayer())
4308 return;
4309
4310 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4311 // This information for client side use only
4312 // Recalculate bonus
4314}

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

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
4317{
4319 return;
4320
4321 Unit* target = aurApp->GetTarget();
4322
4323 if (!target->IsPlayer())
4324 return;
4325
4326 // Recalculate bonus
4328}

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
4287{
4289 return;
4290
4291 Unit* target = aurApp->GetTarget();
4292
4293 if (!target->IsPlayer())
4294 return;
4295
4296 // Recalculate bonus
4298}

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
4680{
4682 return;
4683
4684 Unit* target = aurApp->GetTarget();
4685
4686 if (target->IsPlayer())
4687 target->ToPlayer()->UpdateSpellHitChances();
4688 else
4689 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
4690}
void UpdateSpellHitChances()
Definition StatSystem.cpp:883
float m_modSpellHitChance
Definition Unit.h:2088

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
1771{
1773 return;
1774
1775 Unit* target = aurApp->GetTarget();
1777
1778 if (apply)
1779 {
1780 target->m_stealth.AddFlag(type);
1781 target->m_stealth.AddValue(type, GetAmount());
1782
1784 if (target->IsPlayer())
1786
1787 // interrupt autoshot
1789 {
1791 target->ToPlayer()->SendAutoRepeatCancel(target);
1792 }
1793 }
1794 else
1795 {
1796 target->m_stealth.AddValue(type, -GetAmount());
1797
1798 if (!target->HasStealthAura()) // if last SPELL_AURA_MOD_STEALTH
1799 {
1800 target->m_stealth.DelFlag(type);
1801
1803 if (target->IsPlayer())
1805 }
1806 }
1807
1808 // call functions which may have additional effects after chainging state of unit
1809 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1810 {
1811 // drop flag at stealth in bg
1813 }
1814
1815 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1816 target->bRequestForcedVisibilityUpdate = false;
1817}
@ 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:1846
void RemoveStandFlags(uint8 flags)
Definition Unit.h:1792
void SetStandFlags(uint8 flags)
Definition Unit.h:1791
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
1746{
1748 return;
1749
1750 Unit* target = aurApp->GetTarget();
1752
1753 if (apply)
1754 {
1755 target->m_stealthDetect.AddFlag(type);
1756 target->m_stealthDetect.AddValue(type, GetAmount());
1757 }
1758 else
1759 {
1760 if (!target->HasStealthDetectAura())
1761 target->m_stealthDetect.DelFlag(type);
1762
1763 target->m_stealthDetect.AddValue(type, -GetAmount());
1764 }
1765
1766 // call functions which may have additional effects after chainging state of unit
1767 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1768}
bool HasStealthDetectAura() const
Definition Unit.h:1847
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
1820{
1822 return;
1823
1824 Unit* target = aurApp->GetTarget();
1826
1827 if (apply)
1828 target->m_stealth.AddValue(type, GetAmount());
1829 else
1830 target->m_stealth.AddValue(type, -GetAmount());
1831
1832 // call functions which may have additional effects after chainging state of unit
1833 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1834}

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
4183{
4185 return;
4186
4187 Unit* target = aurApp->GetTarget();
4188
4189 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
4190
4191 // show armor penetration
4192 if (target->IsPlayer() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
4194
4195 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
4198}
@ 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
3584{
3585 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3586 return;
3587
3588 Unit* target = aurApp->GetTarget();
3589
3590 if (!target->IsAlive() || !target->CanHaveThreatList())
3591 return;
3592
3593 target->GetThreatMgr().TauntUpdate();
3594}

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
3560{
3562 return;
3563
3564 Unit* target = aurApp->GetTarget();
3566}
void UpdateMySpellSchoolModifiers()
Definition ThreatManager.cpp:828

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

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
5125{
5126 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5127 return;
5128
5129 Unit* target = aurApp->GetTarget();
5130
5131 if (!target->IsPlayer())
5132 return;
5133
5134 flag96 mask;
5136 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
5137 mask |= (*i)->m_spellInfo->Effects[(*i)->m_effIndex].SpellClassMask;
5138
5139 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1, mask[0]);
5140 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 1, mask[1]);
5141 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2, mask[2]);
5142}
@ 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
6786{
6788 if (GetMiscValue() == POWER_ALL)
6789 PowerType = target->getPowerType();
6790 else
6792
6793 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
6794 return;
6795
6796 if (target->IsImmunedToAuraPeriodicTick(caster, GetSpellInfo()))
6797 {
6798 SendTickImmune(target, caster);
6799 return;
6800 }
6801
6802 // don't regen when permanent aura target has full power
6803 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
6804 return;
6805
6806 // ignore negative values (can be result apply spellmods to aura damage
6807 uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(PowerType) / 100;
6808 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
6809 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
6810 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
6811 target->SendPeriodicAuraLog(&pInfo);
6812
6813 int32 gain = target->ModifyPower(PowerType, amount);
6814
6815 if (caster)
6816 target->GetThreatMgr().ForwardThreatForAssistingMe(caster, float(gain) * 0.5f, GetSpellInfo(), true);
6817}
@ 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:764
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:11033
bool IsImmunedToAuraPeriodicTick(Unit const *caster, SpellInfo const *spellInfo) const
Definition Unit.cpp:9997
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1142
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition Unit.cpp:6842
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
6283{
6284 if (!target->IsAlive())
6285 return;
6286
6287 if (target->IsImmunedToDamage(caster, GetSpellInfo()) || target->IsTotem())
6288 {
6289 SendTickImmune(target, caster);
6290 return;
6291 }
6292
6293 // Consecrate ticks can miss and will not show up in the combat log
6294 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6295 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6296 return;
6297
6298 // some auras remove at specific health level or more
6300 {
6301 switch (GetSpellInfo()->Id)
6302 {
6303 case 43093:
6304 case 31956:
6305 case 38801: // Grievous Wound
6306 case 35321:
6307 case 38363:
6308 case 39215: // Gushing Wound
6309 if (target->IsFullHealth())
6310 {
6311 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6312 return;
6313 }
6314 break;
6315 case 38772: // Grievous Wound
6316 {
6317 uint32 percent = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster);
6318 if (!target->HealthBelowPct(percent))
6319 {
6320 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6321 return;
6322 }
6323 break;
6324 }
6325 }
6326 }
6327
6329
6330 // ignore non positive values (can be result apply spellmods to aura damage
6331 uint32 damage = std::max(GetAmount(), 0);
6332
6333 // If the damage is percent-max-health based, calculate damage before the Modify hook
6335 {
6336 // xinef: ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
6337 damage = uint32(std::ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
6338 }
6339
6340 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6341 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6342
6343 if (target->GetAI())
6344 {
6345 target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
6346 }
6347
6349 {
6350 // xinef: leave only target depending bonuses, rest is handled in calculate amount
6351 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE && caster)
6352 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6353 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6354
6355 // Calculate armor mitigation
6357 {
6358 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6359 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6360 damage = damageReductedArmor;
6361 }
6362
6363 }
6364
6365 // calculate crit chance
6366 bool crit = false;
6367 if ((crit = roll_chance_f(GetCritChance())))
6368 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6369
6370 // Auras reducing damage from AOE spells
6372 {
6373 if (GetSpellInfo()->Effects[GetEffIndex()].IsAreaAuraEffect() ||
6374 GetSpellInfo()->Effects[GetEffIndex()].IsTargetingArea() ||
6375 GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA || // some persistent area auras have targets like A=53 B=28
6378 {
6379 bool npcCaster = (caster && !caster->IsControlledByPlayer()) || GetSpellInfo()->HasAttribute(SPELL_ATTR7_TREAT_AS_NPC_AOE);
6380 damage = target->CalculateAOEDamageReduction(damage, GetSpellInfo()->SchoolMask, npcCaster);
6381 }
6382 }
6383
6384 int32 dmg = damage;
6385 int32 mitigatedDamage = cleanDamage.mitigated_damage;
6386 if (CanApplyResilience())
6387 {
6388 int32 resilienceReduction = dmg;
6389 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6390
6391 resilienceReduction = dmg - resilienceReduction;
6392 dmg -= resilienceReduction;
6393 mitigatedDamage += resilienceReduction;
6394 }
6395
6396 damage = std::max(0, dmg);
6397 cleanDamage.mitigated_damage = std::max(0, mitigatedDamage);
6398
6399 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6400 Unit::CalcAbsorbResist(dmgInfo, false, GetCasterLevel());
6401
6402 uint32 absorb = dmgInfo.GetAbsorb();
6403 uint32 resist = dmgInfo.GetResist();
6404 damage = dmgInfo.GetDamage();
6405
6406 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} attacked {} for {} dmg inflicted by {} abs is {}",
6407 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6408 Unit::DealDamageMods(target, damage, &absorb);
6409
6410 // Set trigger flag
6411 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6412 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6414 if (damage)
6415 procEx |= crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT;
6416 if (absorb > 0)
6417 procEx |= PROC_EX_ABSORB;
6418
6419 if (damage)
6420 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6421
6422 int32 overkill = damage - target->GetHealth();
6423 if (overkill < 0)
6424 overkill = 0;
6425
6426 SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
6427 target->SendPeriodicAuraLog(&pInfo);
6428
6429 Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
6430
6431 Unit::ProcSkillsAndAuras(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6432}
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:392
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:2216
int32 CalculateAOEDamageReduction(int32 damage, uint32 schoolMask, bool npcCaster) const
Definition Unit.cpp:16335
bool IsFullHealth() const
Definition Unit.h:1120
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition Unit.cpp:3632
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:9421
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1122
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:8941
bool IsImmunedToDamage(SpellSchoolMask schoolMask) const
Definition Unit.cpp:9914
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition Unit.cpp:15205
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:6808
UnitAI * GetAI()
Definition Unit.h:694
bool IsControlledByPlayer() const
Definition Unit.h:1313
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition Unit.cpp:2193
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
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false, uint8 casterLevel=0)
Definition Unit.cpp:2327
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
5949{
5950 switch (GetSpellInfo()->SpellFamilyName)
5951 {
5952 case SPELLFAMILY_HUNTER:
5953 {
5954 // Explosive Shot
5955 if (GetSpellInfo()->SpellFamilyFlags[1] & 0x80000000)
5956 {
5957 if (caster)
5958 caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, target, true, nullptr, this);
5959 break;
5960 }
5961 switch (GetSpellInfo()->Id)
5962 {
5963 // Feeding Frenzy Rank 1
5964 case 53511:
5965 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
5966 target->CastSpell(target, 60096, true, 0, this);
5967 return;
5968 // Feeding Frenzy Rank 2
5969 case 53512:
5970 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
5971 target->CastSpell(target, 60097, true, 0, this);
5972 return;
5973 default:
5974 break;
5975 }
5976 break;
5977 }
5979 switch (GetId())
5980 {
5981 case 49016: // Hysteria
5982 uint32 damage = uint32(target->CountPctFromMaxHealth(1));
5983 Unit::DealDamage(target, target, damage, nullptr, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
5984 break;
5985 }
5986 // Blood of the North
5987 // Reaping
5988 // Death Rune Mastery
5989 if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
5990 {
5991 if (!target->IsPlayer())
5992 return;
5994 return;
5995
5996 // timer expired - remove death runes
5997 target->ToPlayer()->RemoveRunesByAuraEffect(this);
5998 }
5999 break;
6000 default:
6001 break;
6002 }
6003}
@ 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:1127

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

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

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

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

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

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
6854{
6856
6857 if (!caster || !target->IsAlive() || !target->HasActivePowerType(PowerType))
6858 return;
6859
6860 if (target->IsImmunedToDamage(caster, GetSpellInfo()))
6861 {
6862 SendTickImmune(target, caster);
6863 return;
6864 }
6865
6866 // ignore negative values (can be result apply spellmods to aura damage
6867 int32 damage = std::max(m_amount, 0);
6868
6869 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6870 if (PowerType == POWER_MANA)
6871 damage -= target->GetSpellCritDamageReduction(damage);
6872
6873 uint32 gain = uint32(-target->ModifyPower(PowerType, -damage));
6874
6875 float dmgMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6876
6877 SpellInfo const* spellProto = GetSpellInfo();
6878 // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
6879 SpellNonMeleeDamage damageInfo(caster, target, spellProto, spellProto->SchoolMask);
6880 // no SpellDamageBonus for burn mana
6881 caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
6882
6883 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6884
6885 caster->SendSpellNonMeleeDamageLog(&damageInfo);
6886
6887 // Set trigger flag
6888 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6889 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6890 if (damageInfo.damage)
6891 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6892
6893 caster->DealSpellDamage(&damageInfo, true);
6894
6895 DamageInfo dmgInfo(damageInfo, DOT, BASE_ATTACK, SPELL_MISS_NONE);
6896 uint32 hitMask = dmgInfo.GetHitMask() | PROC_EX_INTERNAL_DOT;
6897 Unit::ProcSkillsAndAuras(caster, damageInfo.target, procAttacker, procVictim, hitMask, damageInfo.damage, BASE_ATTACK, spellProto, nullptr, GetEffIndex(), nullptr, &dmgInfo);
6898}
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
Definition Unit.cpp:1639
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
Definition Unit.cpp:1492
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
6006{
6007 // generic casting code with custom spells and target/caster customs
6008 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
6009
6010 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
6011 SpellInfo const* auraSpellInfo = GetSpellInfo();
6012 uint32 auraId = auraSpellInfo->Id;
6013
6014 // specific code for cases with no trigger spell provided in field
6015 if (!triggeredSpellInfo)
6016 {
6017 switch (auraSpellInfo->SpellFamilyName)
6018 {
6020 {
6021 switch (auraId)
6022 {
6023 // Thaumaturgy Channel
6024 case 9712:
6025 triggerSpellId = 21029;
6026 if (caster)
6027 caster->CastSpell(caster, triggerSpellId, true);
6028 return;
6029 // Brood Affliction: Bronze
6030 case 23170:
6031 // Only 10% chance of triggering spell
6032 if (roll_chance_f(10.f))
6033 {
6034 triggerSpellId = 23171;
6035 }
6036 break;
6037 // Restoration
6038 case 24379:
6039 case 23493:
6040 {
6041 if (caster)
6042 {
6043 int32 heal = caster->CountPctFromMaxHealth(10);
6044 HealInfo healInfo(caster, target, heal, auraSpellInfo, auraSpellInfo->GetSchoolMask());
6045 caster->HealBySpell(healInfo);
6046
6047 if (int32 mana = caster->GetMaxPower(POWER_MANA))
6048 {
6049 mana /= 10;
6050 caster->EnergizeBySpell(caster, 23493, mana, POWER_MANA);
6051 }
6052 }
6053 return;
6054 }
6055 // Nitrous Boost
6056 case 27746:
6057 if (caster && target->GetPower(POWER_MANA) >= 10)
6058 {
6059 target->ModifyPower(POWER_MANA, -10);
6060 target->SendEnergizeSpellLog(caster, 27746, 10, POWER_MANA);
6061 }
6062 else
6063 target->RemoveAurasDueToSpell(27746);
6064 return;
6065 // Frost Blast
6066 case 27808:
6067 if (caster)
6068 {
6069 caster->CastSpell(target, 29879, true, nullptr, this);
6070 if (GetTickNumber() == 1)
6071 caster->CastSpell(target, 27808, true);
6072 }
6073 return;
6074 // Inoculate Nestlewood Owlkin
6075 case 29528:
6076 if (!target->IsCreature()) // prevent error reports in case ignored player target
6077 return;
6078 break;
6079 // Feed Captured Animal
6080 case 29917:
6081 triggerSpellId = 29916;
6082 break;
6083 // Extract Gas
6084 case 30427:
6085 {
6086 // move loot to player inventory and despawn target
6087 if (caster && caster->IsPlayer() &&
6088 target->IsCreature() &&
6090 {
6091 Player* player = caster->ToPlayer();
6092 Creature* creature = target->ToCreature();
6093 // missing lootid has been reported on startup - just return
6094 if (!creature->GetCreatureTemplate()->SkinLootId)
6095 return;
6096
6098
6099 creature->DespawnOrUnsummon();
6100 }
6101 return;
6102 }
6103 // Quake
6104 case 30576:
6105 triggerSpellId = 30571;
6106 break;
6107 // Doom
6109 // so instakill will be naturally done before trigger spell
6110 case 31347:
6111 {
6112 target->CastSpell(target, 31350, true, nullptr, this);
6113 Unit::Kill(target, target);
6114 return;
6115 }
6116 // Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam
6117 case 39857:
6118 triggerSpellId = 39856;
6119 break;
6120 // Personalized Weather
6121 case 46736:
6122 triggerSpellId = 46737;
6123 break;
6124 // Shield Level 1
6125 case 63130:
6126 // Shield Level 2
6127 case 63131:
6128 // Shield Level 3
6129 case 63132:
6130 // Ball of Flames Visual
6131 case 71706:
6132 return;
6133 // Oculus, Mage-Lord Urom, Time Bomb
6134 case 51121:
6135 case 59376:
6136 {
6137 const int32 dmg = target->GetMaxHealth() - target->GetHealth();
6138 target->CastCustomSpell(target, 51132, &dmg, 0, 0, true);
6139 return;
6140 }
6141 }
6142 break;
6143 }
6144 default:
6145 break;
6146 }
6147 }
6148 else
6149 {
6150 // Spell exist but require custom code
6151 switch (auraId)
6152 {
6153 // Poison (Grobbulus)
6154 case 28158:
6155 case 54362:
6156 // Slime Pool (Dreadscale & Acidmaw)
6157 case 66882:
6158 target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000 * 2 / 3), nullptr, true, nullptr, this);
6159 return;
6160 // Eye of Eternity, Malygos, Arcane Overload
6161 case 56432:
6162 if (triggerSpellId == 56438)
6163 {
6164 target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)(10000 * (1.0f - 0.02f * (m_tickNumber + 1))), nullptr, true, nullptr, this);
6165 return;
6166 }
6167 break;
6168 // Beacon of Light
6169 case 53563:
6170 {
6171 // area aura owner casts the spell
6172 GetBase()->GetUnitOwner()->CastSpell(target, triggeredSpellInfo, true, 0, this, GetBase()->GetUnitOwner()->GetGUID());
6173 return;
6174 }
6175 // Trial of the Crusader, Jaraxxus, Spinning Pain Spike
6176 case 66283:
6177 {
6178 const int32 dmg = target->GetMaxHealth() / 2;
6179 target->CastCustomSpell(target, 66316, &dmg, nullptr, nullptr, true);
6180 return;
6181 }
6182 // Violet Hold, Moragg, Ray of Suffering, Ray of Pain
6183 case 54442:
6184 case 59524:
6185 case 54438:
6186 case 59523:
6187 {
6188 if (caster)
6189 if (Unit* victim = caster->GetVictim())
6190 if (victim->GetDistance(caster) < 45.0f)
6191 {
6192 target = victim;
6193 break;
6194 }
6195 return;
6196 }
6197 case 24745: // Summon Templar, Trigger
6198 case 24747: // Summon Templar Fire, Trigger
6199 case 24757: // Summon Templar Air, Trigger
6200 case 24759: // Summon Templar Earth, Trigger
6201 case 24761: // Summon Templar Water, Trigger
6202 case 24762: // Summon Duke, Trigger
6203 case 24766: // Summon Duke Fire, Trigger
6204 case 24769: // Summon Duke Air, Trigger
6205 case 24771: // Summon Duke Earth, Trigger
6206 case 24773: // Summon Duke Water, Trigger
6207 case 24785: // Summon Royal, Trigger
6208 case 24787: // Summon Royal Fire, Trigger
6209 case 24791: // Summon Royal Air, Trigger
6210 case 24792: // Summon Royal Earth, Trigger
6211 case 24793: // Summon Royal Water, Trigger
6212 {
6213 // All this spells trigger a spell that requires reagents; if the
6214 // triggered spell is cast as "triggered", reagents are not consumed
6215 if (caster)
6216 caster->CastSpell(target, triggerSpellId, false);
6217 return;
6218 }
6219 }
6220 }
6221
6222 // Reget trigger spell proto
6223 triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
6224
6225 if (triggeredSpellInfo)
6226 {
6227 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6228 {
6229 SpellCastTargets targets;
6230 targets.SetUnitTarget(target);
6231 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6232 {
6235 }
6236
6237 // Xinef: do not skip reagent cost for entry casts
6239 if (GetSpellInfo()->Effects[GetEffIndex()].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || GetSpellInfo()->Effects[GetEffIndex()].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)
6241
6242 triggerCaster->CastSpell(targets, triggeredSpellInfo, nullptr, triggerFlags, nullptr, this);
6243 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6244 }
6245 }
6246}
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:2199
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, bool broadcast=false)
Definition Player.cpp:13801
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:1124
void EnergizeBySpell(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:8427
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:13983
void SendEnergizeSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:8416
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
6249{
6250 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
6251 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6252 {
6253 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6254 {
6255 SpellCastTargets targets;
6256 targets.SetUnitTarget(target);
6257 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6258 {
6261 }
6262
6263 CustomSpellValues values;
6265
6266 triggerCaster->CastSpell(targets, triggeredSpellInfo, &values, TRIGGERED_FULL_MASK, nullptr, this);
6267 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6268 }
6269 }
6270 else
6271 {
6272 Creature* c = target->ToCreature();
6273 if (c && caster)
6274 {
6275 sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature());
6276 }
6277
6278 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
6279 }
6280}
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
1932{
1933 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1934 return;
1935
1936 Unit* target = aurApp->GetTarget();
1937
1938 // no-phase is also phase state so same code for apply and remove
1939 uint32 newPhase = target->GetPhaseByAuras();
1940
1941 if (Player* player = target->ToPlayer())
1942 {
1943 if (!newPhase)
1944 newPhase = PHASEMASK_NORMAL;
1945
1946 // do not change phase to GM with all phases enabled
1947 if (player->IsGameMaster())
1948 newPhase = PHASEMASK_ANYWHERE;
1949
1950 player->SetPhaseMask(newPhase, false);
1951 player->GetSession()->SendSetPhaseShift(newPhase);
1952 }
1953 else
1954 {
1955 if (!newPhase)
1956 {
1957 newPhase = PHASEMASK_NORMAL;
1958 if (Creature* creature = target->ToCreature())
1959 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
1960 newPhase = data->phaseMask;
1961 }
1962
1963 target->SetPhaseMask(newPhase, false);
1964 }
1965
1966 // call functions which may have additional effects after chainging state of unit
1967 // phase auras normally not expected at BG but anyway better check
1968 if (apply)
1969 {
1970 // drop flag at invisibiliy in bg
1972 }
1973
1974 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1975 if (target->IsVisible())
1976 {
1977 if (!target->GetMap()->Instanceable())
1978 {
1979 target->UpdateObjectVisibility(false);
1980 target->m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f);
1981 }
1982 else
1983 target->UpdateObjectVisibility();
1984 }
1985}
@ PHASEMASK_ANYWHERE
Definition Object.h:64
@ PHASEMASK_NORMAL
Definition Object.h:63
uint32 GetPhaseByAuras() const
Definition Unit.cpp:15316
bool IsVisible() const
Definition Unit.h:2018
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:15327
Position m_last_notify_position
Definition Unit.h:2112
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.
3659{
3660 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3661 return;
3662
3663 Unit* target = aurApp->GetTarget();
3664 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
3665 if (target->IsPlayer() || !apply || target->HasFearAura())
3666 return;
3669 target->SetControlled(false, UNIT_STATE_FLEEING);
3670}
bool HasFearAura() const
Definition Unit.h:1841

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
5935{
5936 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5937 return;
5938
5939 if (!aurApp->GetTarget()->IsPlayer())
5940 return;
5941
5942 if (apply)
5943 aurApp->GetTarget()->RemoveByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
5944 else if (!aurApp->GetTarget()->GetMap()->Instanceable())
5945 aurApp->GetTarget()->SetByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
5946}
@ 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 
)
1291{
1292 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1293 if (prevented)
1294 return;
1295
1296 switch (GetAuraType())
1297 {
1303 HandleBreakableCCAuraProc(aurApp, eventInfo);
1304 break;
1305 case SPELL_AURA_DUMMY:
1307 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1308 break;
1310 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1311 break;
1313 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1314 break;
1316 HandleRaidProcFromChargeAuraProc(aurApp, eventInfo);
1317 break;
1320 break;
1321 default:
1322 break;
1323 }
1324
1325 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1326}
@ 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:6971
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6927
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6948
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7019
void HandleBreakableCCAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6900
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:6910
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 
)
6949{
6950 Unit* target = aurApp->GetTarget();
6951 Unit* triggerTarget = target == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6952 if (!triggerTarget)
6953 return;
6954
6955 if (triggerTarget->IsImmunedToDamage(target, GetSpellInfo()))
6956 {
6957 SendTickImmune(triggerTarget, target);
6958 return;
6959 }
6960
6961 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetSpellInfo(), GetSpellInfo()->SchoolMask);
6962 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetEffIndex());
6963 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
6964 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
6965 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6966 target->SendSpellNonMeleeDamageLog(&damageInfo);
6967 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
6968 target->DealSpellDamage(&damageInfo, true);
6969}
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 
)
6911{
6912 Unit* triggerCaster = aurApp->GetTarget();
6913 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6914
6915 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
6916 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6917 {
6918 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
6919 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this);
6920 }
6921 else
6922 {
6923 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());
6924 }
6925}

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

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

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

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

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
5060{
5062 return;
5063
5064 Player* target = aurApp->GetTarget()->ToPlayer();
5065 if (!target)
5066 return;
5067
5068 if (apply)
5070 else
5071 {
5073 target->SetBaseModPctValue(SHIELD_BLOCK_VALUE, amount);
5074 }
5075}
@ SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
Definition SpellAuraDefines.h:213
void SetBaseModPctValue(BaseModGroup modGroup, float val)
Definition Player.cpp:5133
void ApplyBaseModPctValue(BaseModGroup modGroup, float pct)
Definition Player.cpp:5111

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

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
3526{
3528 return;
3529
3530 Unit* target = aurApp->GetTarget();
3531
3532 // update timers in client
3533 if (target->IsPlayer())
3534 target->ToPlayer()->UpdateMirrorTimers();
3535}
void UpdateMirrorTimers()
Definition PlayerUpdates.cpp:433

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:6853
void HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6714
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6785
void HandlePeriodicHealthFunnelAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6544
void HandlePeriodicHealAurasTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6573
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6819
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6005
void HandlePeriodicDummyAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:5948
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6434
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6282
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6248
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:1297
void SetInFront(WorldObject const *target)
Definition Unit.cpp:16456
Definition Object.h:476
WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:139

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

Referenced by Update().

◆ RecalculateAmount() [1/2]

◆ RecalculateAmount() [2/2]

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

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

◆ ResetPeriodic()

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

References m_amplitude, m_periodicTimer, and m_tickNumber.

Referenced by spell_dk_death_rune::HandleProc().

◆ ResetTicks()

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

References m_tickNumber.

◆ SendTickImmune()

◆ SetAmount()

◆ SetCanBeRecalculated()

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

References m_canBeRecalculated.

Referenced by Aura::SetLoadedState().

◆ SetCritChance()

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

References m_critChance.

Referenced by CalculatePeriodicData().

◆ SetEnabled()

void AuraEffect::SetEnabled ( bool  enabled)
inline
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:7069
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:12543

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: