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)
 
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 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 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
 

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:135
SpellModifier * m_spellmod
Definition SpellAuraEffects.h:137

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_oldAmount(0), m_isAuraEnabled(true), m_channelData(nullptr), m_spellmod(nullptr), m_periodicTimer(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:546
@ UNIT_FIELD_CHANNEL_OBJECT
Definition UpdateFields.h:93
int32 m_periodicTimer
Definition SpellAuraEffects.h:139
bool m_canBeRecalculated
Definition SpellAuraEffects.h:144
uint8 const m_effIndex
Definition SpellAuraEffects.h:143
uint8 m_casterLevel
Definition SpellAuraEffects.h:127
bool m_applyResilience
Definition SpellAuraEffects.h:126
void CalculatePeriodic(Unit *caster, bool create=false, bool load=false)
Definition SpellAuraEffects.cpp:598
void CalculateSpellMod()
Definition SpellAuraEffects.cpp:689
int32 m_oldAmount
Definition SpellAuraEffects.h:132
int32 CalculateAmount(Unit *caster)
Definition SpellAuraEffects.cpp:452
int32 m_amount
Definition SpellAuraEffects.h:128
void CalculatePeriodicData()
Definition SpellAuraEffects.cpp:583
uint32 m_tickNumber
Definition SpellAuraEffects.h:141
int32 const m_baseAmount
Definition SpellAuraEffects.h:123
SpellInfo const *const m_spellInfo
Definition SpellAuraEffects.h:122
bool m_isAuraEnabled
Definition SpellAuraEffects.h:133
bool m_isPeriodic
Definition SpellAuraEffects.h:145
int32 const m_dieSides
Definition SpellAuraEffects.h:124
float m_critChance
Definition SpellAuraEffects.h:129
Aura *const m_base
Definition SpellAuraEffects.h:120
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:100
ObjectGuid GetGuidValue(uint16 index) const
Definition Object.cpp:326
Definition Spell.h:295
bool CanApplyResilience() const
Definition Unit.h:1154
uint8 GetLevel() const
Definition Unit.h:1086
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1559
Definition Spell.h:252

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 
)
815{
816 if (!m_spellmod || !target->IsPlayer())
817 return;
818
819 target->ToPlayer()->AddSpellMod(m_spellmod, apply);
820
821 // Auras with charges do not mod amount of passive auras
822 if (GetBase()->IsUsingCharges())
823 return;
824 // reapply some passive spells after add/remove related spellmods
825 // Warning: it is a dead loop if 2 auras each other amount-shouldn't happen
826 switch (GetMiscValue())
827 {
829 case SPELLMOD_EFFECT1:
830 case SPELLMOD_EFFECT2:
831 case SPELLMOD_EFFECT3:
832 {
833 ObjectGuid guid = target->GetGUID();
834 Unit::AuraApplicationMap& auras = target->GetAppliedAuras();
835 for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
836 {
837 Aura* aura = iter->second->GetBase();
838 // only passive and permament auras-active auras should have amount set on spellcast and not be affected
839 // if aura is casted by others, it will not be affected
840 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == guid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
841 {
843 {
844 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
845 {
846 if (AuraEffect* aurEff = aura->GetEffect(i))
847 aurEff->RecalculateAmount();
848 }
849 }
850 else if (GetMiscValue() == SPELLMOD_EFFECT1)
851 {
852 if (AuraEffect* aurEff = aura->GetEffect(0))
853 aurEff->RecalculateAmount();
854 }
855 else if (GetMiscValue() == SPELLMOD_EFFECT2)
856 {
857 if (AuraEffect* aurEff = aura->GetEffect(1))
858 aurEff->RecalculateAmount();
859 }
860 else //if (modOp == SPELLMOD_EFFECT3)
861 {
862 if (AuraEffect* aurEff = aura->GetEffect(2))
863 aurEff->RecalculateAmount();
864 }
865 }
866 }
867
868 Pet* pet = target->ToPlayer()->GetPet();
869 if (!pet)
870 break;
871
872 ObjectGuid petguid = pet->GetGUID();
873 Unit::AuraApplicationMap& petauras = pet->GetAppliedAuras();
874 for (Unit::AuraApplicationMap::iterator iter = petauras.begin(); iter != petauras.end(); ++iter)
875 {
876 Aura* aura = iter->second->GetBase();
877 // only passive auras-active auras should have amount set on spellcast and not be affected
878 // if aura is casted by others, it will not be affected
879 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == petguid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
880 {
882 {
883 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
884 {
885 if (AuraEffect* aurEff = aura->GetEffect(i))
886 aurEff->RecalculateAmount();
887 }
888 }
889 else if (GetMiscValue() == SPELLMOD_EFFECT1)
890 {
891 if (AuraEffect* aurEff = aura->GetEffect(0))
892 aurEff->RecalculateAmount();
893 }
894 else if (GetMiscValue() == SPELLMOD_EFFECT2)
895 {
896 if (AuraEffect* aurEff = aura->GetEffect(1))
897 aurEff->RecalculateAmount();
898 }
899 else //if (modOp == SPELLMOD_EFFECT3)
900 {
901 if (AuraEffect* aurEff = aura->GetEffect(2))
902 aurEff->RecalculateAmount();
903 }
904 }
905 }
906 }
907 default:
908 break;
909 }
910}
#define MAX_SPELL_EFFECTS
Definition DBCStructure.h:1635
std::uint8_t uint8
Definition Define.h:109
@ 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
int32 GetMiscValue() const
Definition SpellAuraEffects.cpp:442
Aura * GetBase() const
Definition SpellAuraEffects.h:49
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:1034
bool IsPermanent() const
Definition SpellAuras.h:139
Definition ObjectGuid.h:118
bool IsPlayer() const
Definition Object.h:200
Player * ToPlayer()
Definition Object.h:201
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
Definition Pet.h:41
Pet * GetPet() const
Definition Player.cpp:8996
void AddSpellMod(SpellModifier *mod, bool apply)
Definition Player.cpp:9913
bool IsAffectedBySpellMod(SpellModifier const *mod) const
Definition SpellInfo.cpp:1293
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:664
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1366

References Player::AddSpellMod(), Unit::GetAppliedAuras(), GetBase(), Aura::GetCasterGUID(), Aura::GetEffect(), Object::GetGUID(), GetMiscValue(), Player::GetPet(), Aura::GetSpellInfo(), SpellInfo::IsAffectedBySpellMod(), Aura::IsPassive(), Aura::IsPermanent(), Object::IsPlayer(), m_spellmod, MAX_SPELL_EFFECTS, 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
1060{
1061 float critChance = 0.0f;
1062 if (caster)
1063 {
1064 if (Player* modOwner = caster->GetSpellModOwner())
1065 {
1066 Unit::AuraEffectList const& mPeriodicCritAuras = modOwner->GetAuraEffectsByType(SPELL_AURA_ABILITY_PERIODIC_CRIT);
1067 for (Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr)
1068 {
1069 if ((*itr)->IsAffectedOnSpell(GetSpellInfo()))
1070 {
1071 critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), (GetSpellInfo()->DmgClass == SPELL_DAMAGE_CLASS_RANGED ? RANGED_ATTACK : BASE_ATTACK), true);
1072 break;
1073 }
1074 }
1075
1076 switch (GetSpellInfo()->SpellFamilyName)
1077 {
1078 // Rupture - since 3.3.3 can crit
1079 case SPELLFAMILY_ROGUE:
1080 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100000)
1081 critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), BASE_ATTACK, true);
1082 break;
1083 }
1084 }
1085 }
1086 if (target && critChance > 0.0f)
1087 critChance = target->SpellTakenCritChance(caster, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), critChance, BASE_ATTACK, true);
1088
1089 return std::max(0.0f, critChance);
1090}
@ SPELL_DAMAGE_CLASS_RANGED
Definition SharedDefines.h:1559
@ SPELLFAMILY_ROGUE
Definition SharedDefines.h:3802
@ 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:1071
flag96 SpellFamilyFlags
Definition SpellInfo.h:388
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1878
uint32 DmgClass
Definition SpellInfo.h:389
uint32 SpellFamilyName
Definition SpellInfo.h:387
std::vector< AuraEffect * > AuraEffectList
Definition Unit.h:671
Player * GetSpellModOwner() const
Definition Unit.cpp:16789

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());
556
557 // Xinef: Periodic auras
558 if (caster)
559 switch (GetAuraType())
560 {
563 // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value!
564 if (GetBase()->GetType() == UNIT_AURA_TYPE)
565 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex(), GetPctMods(), 1);
566 break;
568 if (GetBase()->GetType() == UNIT_AURA_TYPE)
569 amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex(), GetPctMods(), 1);
570 break;
572 if (GetBase()->GetType() == UNIT_AURA_TYPE)
573 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE, 0.0f, 1);
574 break;
575 default:
576 break;
577 }
578
579 amount *= GetBase()->GetStackAmount();
580 return amount;
581}
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
#define MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS
Definition DBCStructure.h:1836
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition DBCStructure.h:1205
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:1650
@ CLASS_WARRIOR
Definition SharedDefines.h:141
@ 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:116
AuraType GetAuraType() const
Definition SpellAuraEffects.cpp:447
uint32 GetId() const
Definition SpellAuraEffects.cpp:432
float GetPctMods() const
Definition SpellAuraEffects.h:112
uint32 GetEffIndex() const
Definition SpellAuraEffects.h:56
void CallScriptEffectCalcAmountHandlers(AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
Definition SpellAuras.cpp:2441
uint8 GetStackAmount() const
Definition SpellAuras.h:148
Definition Item.h:220
ItemTemplate const * GetTemplate() const
Definition Item.cpp:544
Item * GetShield(bool useable=false) const
Definition PlayerStorage.cpp:525
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition PlayerStorage.cpp:490
uint32 Id
Definition SpellInfo.h:320
uint32 ProcFlags
Definition SpellInfo.h:355
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:393
bool HasAura(AuraType aura) const
Definition SpellInfo.cpp:893
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1411
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:12628
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:11817
Definition DBCStructure.h:1217
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > AllocationPct
Definition DBCStructure.h:1223
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
Definition DBCStructure.h:1222
uint32 InventoryType
Definition ItemTemplate.h:632
Definition DBCStructure.h:1839
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1845

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.
599{
601
602 // prepare periodics
603 switch (GetAuraType())
604 {
606 // 3 spells have no amplitude set
607 if (!m_amplitude)
609 [[fallthrough]];
623 m_isPeriodic = true;
624 break;
625 default:
626 break;
627 }
628
630
631 if (!m_isPeriodic)
632 return;
633
634 // Xinef: fix broken data in dbc
635 if (m_amplitude <= 0)
636 m_amplitude = 1000;
637
638 Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr;
639
640 // Apply casting time mods
641 if (m_amplitude)
642 {
643 // Apply periodic time mod
644 if (modOwner)
646
647 if (caster)
648 {
651 }
652 }
653
654 if (load) // aura loaded from db
655 {
659 ++m_tickNumber;
660 }
661 else // aura just created or reapplied
662 {
663 m_tickNumber = 0;
664 // reset periodic timer on aura create or on reapply when aura isn't dot
665 // possibly we should not reset periodic timers only when aura is triggered by proc
666 // or maybe there's a spell attribute somewhere
667 bool resetPeriodicTimer = create
669
670 if (resetPeriodicTimer)
671 {
672 m_periodicTimer = 0;
673 // Start periodic on next tick or at aura apply
674 if (m_amplitude)
675 {
678 else if (caster && caster->IsTotem()) // for totems only ;d
679 {
680 m_periodicTimer = 100; // make it ALMOST instant
681 if (!GetBase()->IsPassive())
682 GetBase()->SetDuration(GetBase()->GetDuration() + 100);
683 }
684 }
685 }
686 }
687}
constexpr auto IN_MILLISECONDS
Definition Common.h:53
@ SPELL_ATTR5_EXTRA_INITIAL_PERIOD
Definition SharedDefines.h:587
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition SharedDefines.h:591
@ 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 m_amplitude
Definition SpellAuraEffects.h:140
int32 GetDuration() const
Definition SpellAuras.h:133
void SetDuration(int32 duration, bool withMods=false)
Definition SpellAuras.cpp:810
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
Definition SpellAuras.cpp:2455
float GetFloatValue(uint16 index) const
Definition Object.cpp:306
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
Definition Player.cpp:9816
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:415
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition Unit.cpp:5880
bool IsTotem() const
Definition Unit.h:787

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 ( )
584{
585 // xinef: save caster depending auras with pct mods
586 if (GetBase()->GetType() == UNIT_AURA_TYPE && GetCaster())
587 {
592 }
593
594 if (GetCaster())
595 SetCritChance(CalcPeriodicCritChance(GetCaster(), (GetBase()->GetType() == UNIT_AURA_TYPE ? GetBase()->GetUnitOwner() : nullptr)));
596}
float CalcPeriodicCritChance(Unit const *caster, Unit const *target) const
Definition SpellAuraEffects.cpp:1059
float m_pctMods
Definition SpellAuraEffects.h:130
Unit * GetCaster() const
Definition SpellAuraEffects.h:47
void SetCritChance(float crit)
Definition SpellAuraEffects.h:109
float SpellPctHealingModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:12543
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:11489

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 ( )
690{
691 switch (GetAuraType())
692 {
695 if (!m_spellmod)
696 {
699
700 m_spellmod->type = SpellModType(GetAuraType()); // SpellModType value == spell aura types
702 m_spellmod->mask = GetSpellInfo()->Effects[GetEffIndex()].SpellClassMask;
705 }
707 break;
708 default:
709 break;
710 }
712}
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:2469
uint8 GetCharges() const
Definition SpellAuras.h:141
uint32 SpellPriority
Definition SpellInfo.h:382
Definition Player.h:182
uint32 priority
Definition Player.h:191
int16 charges
Definition Player.h:186
SpellModOp op
Definition Player.h:184
SpellModType type
Definition Player.h:185
int32 value
Definition Player.h:187
uint32 spellId
Definition Player.h:189
flag96 mask
Definition Player.h:188

References Aura::CallScriptEffectCalcSpellModHandlers(), SpellModifier::charges, SpellInfo::Effects, GetAmount(), GetAuraType(), GetBase(), Aura::GetCharges(), GetEffIndex(), GetId(), GetMiscValue(), GetSpellInfo(), m_spellmod, SpellModifier::mask, SpellModifier::op, SpellModifier::priority, SPELL_AURA_ADD_FLAT_MODIFIER, SPELL_AURA_ADD_PCT_MODIFIER, SpellModifier::spellId, SpellInfo::SpellPriority, 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 
)
715{
716 // Reapply if amount change
717 uint8 handleMask = 0;
718 if (newAmount != GetAmount())
720 if (onStackOrReapply)
721 handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
722
723 if (!handleMask)
724 return;
725
726 std::list<AuraApplication*> effectApplications;
727 GetApplicationList(effectApplications);
728
729 for (AuraApplication* aurApp : effectApplications)
730 if (aurApp->HasEffect(GetEffIndex()))
731 {
732 aurApp->GetTarget()->_RegisterAuraEffect(this, false);
733 HandleEffect(aurApp, handleMask, false);
734 }
735
736 if (handleMask & AURA_EFFECT_HANDLE_CHANGE_AMOUNT)
737 {
738 if (!mark)
739 m_amount = newAmount;
740 else
741 SetAmount(newAmount);
743 }
744
745 for (AuraApplication* aurApp : effectApplications)
746 if (aurApp->HasEffect(GetEffIndex()))
747 {
748 if (aurApp->GetRemoveMode() != AURA_REMOVE_NONE)
749 continue;
750
751 aurApp->GetTarget()->_RegisterAuraEffect(this, true);
752 HandleEffect(aurApp, handleMask, true);
753 }
754}
@ 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:756
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_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().

◆ CleanupTriggeredSpells()

void AuraEffect::CleanupTriggeredSpells ( Unit target)
Todo:
: is there a spell flag, which can solve this in a more sophisticated way?
1215{
1216 uint32 tSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1217 if (!tSpellId)
1218 return;
1219
1220 SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
1221 if (!tProto)
1222 return;
1223
1224 if (tProto->GetDuration() != -1)
1225 return;
1226
1227 // needed for spell 43680, maybe others
1231 return;
1232
1233 target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
1234}
#define sSpellMgr
Definition SpellMgr.h:825
ObjectGuid GetCasterGUID() const
Definition SpellAuraEffects.h:48
Definition SpellInfo.h:316
int32 GetDuration() const
Definition SpellInfo.cpp:2232
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:5028

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(), Unit::CalcAbsorbResist(), Unit::CalcHealAbsorb(), spell_sha_earth_shield::CalculateAmount(), spell_warl_generic_scaling::CalculateAPAmount(), CalculateSpellMod(), ChangeAmount(), 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(), HandleAuraModTotalThreat(), Unit::HandleAuraRaidProcFromChargeWithValue(), HandleAuraRetainComboPoints(), Aura::HandleAuraSpecificMods(), HandleChannelDeathItem(), spell_dk_raise_ally::HandleDummy(), Unit::HandleDummyAuraProc(), 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(), HandleModStateImmunityMask(), HandleModStealth(), HandleModStealthDetect(), HandleModStealthLevel(), HandleModTargetResistance(), HandleModThreat(), Unit::HandleOverrideClassScriptAuraProc(), 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_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), HandlePeriodicDamageAurasTick(), HandlePeriodicHealthFunnelAuraTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandlePeriodicTriggerSpellWithValueAuraTick(), spell_dru_living_seed_proc::HandleProc(), spell_sha_earth_shield::HandleProc(), spell_oculus_temporal_rift_aura::HandleProc(), spell_dk_wandering_plague_aura::HandleProc(), spell_dru_t10_balance_4p_bonus::HandleProc(), spell_dru_living_seed::HandleProc(), spell_hun_glyph_of_arcane_shot::HandleProc(), spell_item_necrotic_touch::HandleProc(), spell_mage_burnout::HandleProc(), spell_mage_master_of_elements::HandleProc(), spell_pal_sacred_shield_base::HandleProc(), spell_pri_divine_aegis::HandleProc(), spell_pri_glyph_of_prayer_of_healing::HandleProc(), spell_sha_t10_restoration_4p_bonus::HandleProc(), spell_sha_t8_electrified::HandleProc(), spell_warl_seed_of_corruption_aura::HandleProc(), spell_warl_seed_of_corruption_generic_aura::HandleProc(), spell_hun_lock_and_load::HandleProcs(), HandleProcTriggerDamageAuraProc(), Unit::HandleProcTriggerSpell(), HandleProcTriggerSpellWithValueAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), HandleRangedAmmoHaste(), spell_warl_haunt_aura::HandleRemove(), HandleShieldBlockValue(), HandleShieldBlockValuePercent(), spell_hun_sniper_training::HandleUpdatePeriodic(), Aura::IsAuraStronger(), Unit::IsHighestExclusiveAuraEffect(), 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_gravity_bomb_aura::OnRemove(), spell_xt002_searing_light_spawn_life_spark_aura::OnRemove(), spell_ulduar_stone_grip_aura::OnRemoveStun(), spell_the_lich_king_infest_aura::OnUpdate(), spell_karazhan_overload_aura::PeriodicTick(), Unit::ProcDamageAndSpellFor(), Unit::RemoveAurasDueToSpellBySteal(), ArenaSpectator::ShouldSendAura(), Unit::SpellPctDamageModsDone(), spell_black_temple_shadow_inferno_aura::Update(), spell_black_temple_spell_absorption_aura::Update(), Player::UpdateAttackPowerAndDamage(), 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(), 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(), Unit::HandleProcTriggerSpell(), Aura::IsAuraStronger(), PeriodicTick(), Unit::ProcDamageAndSpellFor(), Player::RestoreBaseRune(), Unit::SendPeriodicAuraLog(), ArenaSpectator::ShouldSendAura(), and UpdatePeriodic().

◆ GetBase()

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

References m_base.

Referenced by ApplySpellMod(), Unit::CalcAbsorbResist(), Unit::CalcHealAbsorb(), CalculateAmount(), CalculatePeriodic(), CalculatePeriodicData(), CalculateSpellMod(), 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(), Unit::HandleDummyAuraProc(), 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(), Unit::HandleOverrideClassScriptAuraProc(), HandlePeriodicDamageAurasTick(), HandlePeriodicEnergizeAuraTick(), HandlePeriodicHealAurasTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicManaLeechAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandleProc(), Unit::HandleProcTriggerSpell(), HandleRaidProcFromChargeAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), Unit::IsHighestExclusiveAuraEffect(), spell_hor_shared_suffering_aura::OnRemove(), PeriodicTick(), Spell::prepare(), Unit::ProcDamageAndSpellFor(), 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(), Unit::CalcAbsorbResist(), spell_pal_sacred_shield_base::CalculateAmount(), spell_sha_earth_shield::CalculateAmount(), spell_warl_improved_demonic_tactics::CalculateAmount(), spell_warl_seed_of_corruption_aura::CalculateAmount(), spell_warr_rend::CalculateAmount(), CalculateAmount(), 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::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(), Unit::CastDelayedSpellWithPeriodicAmount(), ChangeAmount(), CleanupTriggeredSpells(), GetApplicationList(), GetTargetList(), spell_muru_summon_blood_elves_periodic_aura::HandleApply(), spell_gen_baby_murloc_passive::HandleApply(), HandleAuraLinked(), HandleAuraModStat(), Unit::HandleAuraRaidProcFromCharge(), Unit::HandleAuraRaidProcFromChargeWithValue(), Unit::HandleDummyAuraProc(), 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_mage_pet_scaling::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_karazhan_temptation::HandleProc(), spell_gen_proc_not_self::HandleProc(), spell_item_unsated_craving::HandleProc(), spell_pal_sacred_shield_base::HandleProc(), HandleProcTriggerDamageAuraProc(), Unit::HandleProcTriggerSpell(), 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_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_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(), Unit::GetMaxNegativeAuraModifierByMiscMask(), Unit::GetMaxNegativeAuraModifierByMiscValue(), Unit::GetMaxPositiveAuraModifierByMiscMask(), Unit::GetMaxPositiveAuraModifierByMiscValue(), Unit::GetTotalAuraModifierByMiscMask(), Unit::GetTotalAuraModifierByMiscValue(), Unit::GetTotalAuraMultiplierByMiscMask(), Unit::GetTotalAuraMultiplierByMiscValue(), HandleAuraConvertRune(), HandleAuraDummy(), HandleAuraModBaseResistancePCT(), HandleAuraModDispelImmunity(), HandleAuraModDmgImmunity(), 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(), HandleModMechanicImmunity(), HandleModPercentStat(), HandleModPowerCost(), HandleModPowerCostPCT(), HandleModPowerRegen(), HandleModRating(), HandleModRatingFromStat(), HandleModResistancePercent(), HandleModSpellCritChanceShool(), HandleModStateImmunityMask(), HandleModStealth(), HandleModStealthDetect(), HandleModStealthLevel(), HandleModTargetResistance(), HandleModThreat(), HandleModTotalPercentStat(), HandleObsModPowerAuraTick(), spell_illidan_shadow_prison_aura::HandleOnEffectApply(), spell_illidan_shadow_prison_aura::HandleOnEffectRemove(), Unit::HandleOverrideClassScriptAuraProc(), 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::ProcDamageAndSpellFor(), Unit::SendPeriodicAuraLog(), Unit::SpellBaseDamageBonusDone(), Unit::SpellBaseDamageBonusTaken(), Unit::SpellBaseHealingBonusDone(), 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
115{ return m_oldAmount; }

References m_oldAmount.

Referenced by Unit::CastDelayedSpellWithPeriodicAmount().

◆ GetPctMods()

float AuraEffect::GetPctMods ( ) const
inline

◆ 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(), Player::CheckAttackFitToAuraRequirement(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Unit::GetHighestExclusiveSameEffectSpellGroupValue(), HandleAuraDummy(), HandleAuraModEffectImmunity(), HandleAuraModSchoolImmunity(), HandleAuraModShapeshift(), HandleAuraModStateImmunity(), HandleAuraMounted(), Unit::HandleAuraRaidProcFromCharge(), Unit::HandleAuraRaidProcFromChargeWithValue(), HandleAuraTransform(), HandleChannelDeathItem(), spell_dk_raise_ally::HandleDummy(), Unit::HandleDummyAuraProc(), spell_dru_idol_lifebloom::HandleEffectCalcSpellMod(), spell_optic_link_aura::HandleEffectPeriodic(), HandleModMechanicImmunity(), HandleModStateImmunityMask(), HandleObsModPowerAuraTick(), spell_putricide_unbound_plague_dmg_aura::HandlePeriodic(), HandlePeriodicDamageAurasTick(), HandlePeriodicDummyAuraTick(), HandlePeriodicEnergizeAuraTick(), HandlePeriodicHealAurasTick(), HandlePeriodicHealthFunnelAuraTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicManaLeechAuraTick(), HandlePeriodicPowerBurnAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandlePeriodicTriggerSpellWithValueAuraTick(), spell_dk_blood_caked_blade::HandleProc(), spell_gen_proc_not_self::HandleProc(), spell_pal_seal_of_command_aura::HandleProc(), HandleProcTriggerDamageAuraProc(), Unit::HandleProcTriggerSpell(), HandleProcTriggerSpellAuraProc(), HandleProcTriggerSpellWithValueAuraProc(), HandleRaidProcFromChargeAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), TriggeredByAuraSpellData::Init(), Unit::IsHighestExclusiveAuraEffect(), spell_gen_sober_up::OnRemove(), Acore::AbsorbAuraOrderPred::operator()(), spell_entropius_negative_energy_periodic::PeriodicTick(), spell_dragonblight_corrosive_spit::PeriodicTick(), Unit::ProcDamageAndSpellFor(), 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.

Referenced by Unit::ProcDamageAndSpellFor().

◆ 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_putricide_unbound_plague_dmg_aura::HandlePeriodic(), spell_shadow_bolt_whirl::HandlePeriodic(), HandlePeriodicHealAurasTick(), 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_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(), and spell_mother_shahraz_random_periodic_aura::Update().

◆ GetTotalTicks()

◆ HandleArenaPreparation()

void AuraEffect::HandleArenaPreparation ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5355{
5356 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5357 return;
5358
5359 Unit* target = aurApp->GetTarget();
5360
5361 if (apply)
5363 else
5364 {
5365 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5366 if (target->HasAuraType(GetAuraType()))
5367 return;
5369 }
5370}
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
@ UNIT_FLAG_PREPARATION
Definition UnitDefines.h:259
Definition Unit.h:655
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:5847
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:738
ObjectGuid GetTarget() const
Definition Unit.h:849
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:739

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
3324{
3326 return;
3327
3328 Unit* target = aurApp->GetTarget();
3329
3330 if (!apply)
3331 {
3332 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3333 if (target->HasAuraType(GetAuraType()) || target->HasIncreaseMountedFlightSpeedAura())
3334 return;
3335 }
3336
3337 target->SetCanFly(apply);
3338
3339 if (!apply && target->IsCreature() && !target->IsLevitating())
3340 target->GetMotionMaster()->MoveFall();
3341}
@ 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:676
bool IsCreature() const
Definition Object.h:204
MotionMaster * GetMotionMaster()
Definition Unit.h:1736
bool IsLevitating() const
Definition Unit.h:1684
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:20602
bool HasIncreaseMountedFlightSpeedAura() const
Definition Unit.h:1808

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
3102{
3104 return;
3105
3106 Unit* target = aurApp->GetTarget();
3107
3108 if (target->IsPlayer())
3109 {
3110 if (apply)
3112 else
3113 {
3114 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3115 if (target->HasAllowOnlyAbilityAura())
3116 return;
3118 }
3119 }
3120}
@ PLAYER_ALLOW_ONLY_ABILITY
Definition Player.h:491
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:1111
void RemovePlayerFlag(PlayerFlags flags)
Definition Player.h:1112
bool HasAllowOnlyAbilityAura() const
Definition Unit.h:1796

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
2795{
2797 return;
2798
2799 Unit* target = aurApp->GetTarget();
2800
2801 if (apply)
2802 {
2803 Unit* caster = GetCaster();
2804 if (!caster || caster == target)
2805 return;
2806
2807 // What must be cloned? at least display and scale
2808 target->SetDisplayId(caster->GetDisplayId());
2810 }
2811 else
2812 {
2813 target->SetDisplayId(target->GetNativeDisplayId());
2815 }
2816}
@ UNIT_FLAG2_MIRROR_IMAGE
Definition UnitDefines.h:297
virtual void SetDisplayId(uint32 modelId, float displayScale=1.f)
Definition Unit.cpp:16989
void SetUnitFlag2(UnitFlags2 flags)
Definition Unit.h:744
uint32 GetDisplayId() const
Definition Unit.h:1951
uint32 GetNativeDisplayId() const
Definition Unit.h:1953
void RemoveUnitFlag2(UnitFlags2 flags)
Definition Unit.h:745

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

3676{
3678 return;
3679
3680 Unit* target = aurApp->GetTarget();
3681
3682 if (!target->IsVehicle())
3683 return;
3684
3685 Unit* caster = GetCaster();
3686
3687 if (!caster || caster == target)
3688 return;
3689
3690 if (apply)
3691 {
3692 // Currently spells that have base points 0 and DieSides 0 = "0/0" exception are pushed to -1,
3693 // however the idea of 0/0 is to ingore flag VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT and -1 checks for it,
3694 // so this break such spells or most of them.
3695 // Current formula about m_amount: effect base points + dieside - 1
3696 // TO DO: Reasearch more about 0/0 and fix it.
3697 caster->_EnterVehicle(target->GetVehicleKit(), m_amount - 1, aurApp);
3698 }
3699 else
3700 {
3701 caster->_ExitVehicle();
3702 // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
3703 caster->RemoveAurasDueToSpell(GetId());
3704 }
3705}
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK
Definition SpellAuraDefines.h:49
bool IsVehicle() const
Definition Unit.h:788
void _ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:19745
void _EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:19627
Vehicle * GetVehicleKit() const
Definition Unit.h:1902

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
6023{
6024 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6025 return;
6026
6027 Unit* target = aurApp->GetTarget();
6028
6029 if (!target->IsPlayer())
6030 return;
6031
6032 Player* player = target->ToPlayer();
6033
6035 return;
6036
6037 uint32 runes = m_amount;
6038 // convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb
6039 if (apply)
6040 {
6041 for (uint32 i = 0; i < MAX_RUNES && runes; ++i)
6042 {
6043 if (GetMiscValue() != player->GetCurrentRune(i))
6044 continue;
6045 if (!player->GetRuneCooldown(i))
6046 {
6047 player->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
6048 --runes;
6049 }
6050 }
6051 }
6052 else
6053 player->RemoveRunesByAuraEffect(this);
6054}
RuneType
Definition Player.h:404
#define MAX_RUNES
Definition Player.h:394
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:146
@ CLASS_CONTEXT_ABILITY
Definition UnitDefines.h:238
int32 GetMiscValueB() const
Definition SpellAuraEffects.cpp:437
void RemoveRunesByAuraEffect(AuraEffect const *aura)
Definition Player.cpp:13424
uint32 GetRuneCooldown(uint8 index) const
Definition Player.h:2522
void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const *aura)
Definition Player.h:2533
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition Player.cpp:1301
RuneType GetCurrentRune(uint8 index) const
Definition Player.h:2521

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
5413{
5415 return;
5416
5417 Unit* target = aurApp->GetTarget();
5418
5419 Unit* caster = GetCaster();
5420
5421 if (mode & AURA_EFFECT_HANDLE_REAL)
5422 {
5423 // pet auras
5424 if (PetAura const* petSpell = sSpellMgr->GetPetAura(GetId(), m_effIndex))
5425 {
5426 if (apply)
5427 target->AddPetAura(petSpell);
5428 else
5429 target->RemovePetAura(petSpell);
5430 }
5431 }
5432
5434 {
5435 // AT APPLY
5436 if (apply)
5437 {
5438 switch (GetId())
5439 {
5440 case 1515: // Tame beast
5441 // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
5442 if (caster && target->CanHaveThreatList())
5443 target->AddThreat(caster, 10.0f);
5444 break;
5445 case 34026: // kill command
5446 {
5447 Unit* pet = target->GetGuardianPet();
5448 if (!pet)
5449 break;
5450
5451 target->CastSpell(target, 34027, true, nullptr, this);
5452
5453 // set 3 stacks and 3 charges (to make all auras not disappear at once)
5454 Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
5455 Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
5456 if (owner_aura)
5457 {
5458 owner_aura->SetCharges(0);
5459 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5460 if (pet_aura)
5461 {
5462 pet_aura->SetCharges(0);
5463 pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5464 }
5465 }
5466 break;
5467 }
5468 case 37096: // Blood Elf Illusion
5469 {
5470 if (caster)
5471 {
5472 switch (caster->getGender())
5473 {
5474 case GENDER_FEMALE:
5475 caster->CastSpell(target, 37095, true, nullptr, this); // Blood Elf Disguise
5476 break;
5477 case GENDER_MALE:
5478 caster->CastSpell(target, 37093, true, nullptr, this);
5479 break;
5480 default:
5481 break;
5482 }
5483 }
5484 break;
5485 }
5486 case 55198: // Tidal Force
5487 {
5488 target->CastSpell(target, 55166, true);
5489 if (Aura* owner_aura = target->GetAura(55166))
5490 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5491 return;
5492 }
5493 case 39850: // Rocket Blast
5494 if (roll_chance_i(20)) // backfire stun
5495 target->CastSpell(target, 51581, true, nullptr, this);
5496 break;
5497 case 43873: // Headless Horseman Laugh
5498 target->PlayDistanceSound(11965);
5499 break;
5500 case 46354: // Blood Elf Illusion
5501 if (caster)
5502 {
5503 switch (caster->getGender())
5504 {
5505 case GENDER_FEMALE:
5506 caster->CastSpell(target, 46356, true, nullptr, this);
5507 break;
5508 case GENDER_MALE:
5509 caster->CastSpell(target, 46355, true, nullptr, this);
5510 break;
5511 }
5512 }
5513 break;
5514 case 46361: // Reinforced Net
5515 if (caster)
5516 target->GetMotionMaster()->MoveFall();
5517 break;
5518 case 46699: // Requires No Ammo
5519 if (target->IsPlayer())
5520 target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
5521 break;
5522 case 71563:
5523 {
5524 if (Aura* newAura = target->AddAura(71564, target))
5525 newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount);
5526 return;
5527 }
5528 }
5529 }
5530 // AT REMOVE
5531 else
5532 {
5533 if ((GetSpellInfo()->IsQuestTame()) && caster && caster->IsAlive() && target->IsAlive() && aurApp->GetRemoveMode() != AURA_REMOVE_BY_CANCEL)
5534 {
5535 uint32 finalSpelId = 0;
5536 switch (GetId())
5537 {
5538 case 19548:
5539 finalSpelId = 19597;
5540 break;
5541 case 19674:
5542 finalSpelId = 19677;
5543 break;
5544 case 19687:
5545 finalSpelId = 19676;
5546 break;
5547 case 19688:
5548 finalSpelId = 19678;
5549 break;
5550 case 19689:
5551 finalSpelId = 19679;
5552 break;
5553 case 19692:
5554 finalSpelId = 19680;
5555 break;
5556 case 19693:
5557 finalSpelId = 19684;
5558 break;
5559 case 19694:
5560 finalSpelId = 19681;
5561 break;
5562 case 19696:
5563 finalSpelId = 19682;
5564 break;
5565 case 19697:
5566 finalSpelId = 19683;
5567 break;
5568 case 19699:
5569 finalSpelId = 19685;
5570 break;
5571 case 19700:
5572 finalSpelId = 19686;
5573 break;
5574 case 30646:
5575 finalSpelId = 30647;
5576 break;
5577 case 30653:
5578 finalSpelId = 30648;
5579 break;
5580 case 30654:
5581 finalSpelId = 30652;
5582 break;
5583 case 30099:
5584 finalSpelId = 30100;
5585 break;
5586 case 30102:
5587 finalSpelId = 30103;
5588 break;
5589 case 30105:
5590 finalSpelId = 30104;
5591 break;
5592 }
5593
5594 if (finalSpelId)
5595 caster->CastSpell(target, finalSpelId, true, nullptr, this);
5596 }
5597
5599 {
5601 switch (GetId())
5602 {
5603 case 2584: // Waiting to Resurrect
5604 // Waiting to resurrect spell cancel, we must remove player from resurrect queue
5605 if (target->IsPlayer())
5606 {
5607 if (Battleground* bg = target->ToPlayer()->GetBattleground())
5608 bg->RemovePlayerFromResurrectQueue(target->ToPlayer());
5609 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()))
5610 bf->RemovePlayerFromResurrectQueue(target->GetGUID());
5611 }
5612 break;
5613 case 43681: // Inactive
5614 {
5615 if (!target->IsPlayer() || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
5616 return;
5617
5618 if (target->GetMap()->IsBattleground())
5619 target->ToPlayer()->LeaveBattleground();
5620 break;
5621 }
5622 case 52172: // Coyote Spirit Despawn Aura
5623 case 60244: // Blood Parrot Despawn Aura
5624 target->CastSpell((Unit*)nullptr, GetAmount(), true, nullptr, this);
5625 break;
5626 // Halls of Lightning, Arc Lightning
5627 case 52921:
5628 {
5629 if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE )
5630 return;
5631
5632 Player* player = nullptr;
5633 Acore::AnyPlayerInObjectRangeCheck checker(target, 10.0f);
5634 Acore::PlayerSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(target, player, checker);
5635 Cell::VisitObjects(target, searcher, 10.0f);
5636
5637 if (player && player->GetGUID() != target->GetGUID())
5638 target->CastSpell(player, 52921, true);
5639
5640 return;
5641 }
5642 case 58600: // Restricted Flight Area
5643 case 58730: // Restricted Flight Area
5644 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
5645 target->CastSpell(target, 58601, true);
5646 break;
5647 case 46374: // quest The Power of the Elements (11893)
5648 {
5649 if (target->isDead() && GetBase() && target->IsCreature() && target->GetEntry() == 24601)
5650 {
5651 auto caster2 = GetBase()->GetCaster();
5652 if (caster2 && caster2->IsPlayer())
5653 {
5654 caster2->ToPlayer()->KilledMonsterCredit(25987);
5655 }
5656 }
5657 return;
5658 }
5659 }
5660 break;
5661 default:
5662 break;
5663 }
5664 }
5665 }
5666
5667 // AT APPLY & REMOVE
5668
5670 {
5672 {
5673 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5674 break;
5675 switch (GetId())
5676 {
5677 // Recently Bandaged
5678 case 11196:
5680 break;
5681 // Unstable Power
5682 case 24658:
5683 {
5684 uint32 spellId = 24659;
5685 if (apply && caster)
5686 {
5687 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
5688
5689 for (uint32 i = 0; i < spell->StackAmount; ++i)
5690 caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID());
5691 break;
5692 }
5693 target->RemoveAurasDueToSpell(spellId);
5694 break;
5695 }
5696 // Restless Strength
5697 case 24661:
5698 {
5699 uint32 spellId = 24662;
5700 if (apply && caster)
5701 {
5702 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
5703 for (uint32 i = 0; i < spell->StackAmount; ++i)
5704 caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID());
5705 break;
5706 }
5707 target->RemoveAurasDueToSpell(spellId);
5708 break;
5709 }
5710 // Tag Murloc
5711 case 30877:
5712 {
5713 // Tag/untag Blacksilt Scout
5714 target->SetEntry(apply ? 17654 : 17326);
5715 break;
5716 }
5717 case 57819: // Argent Champion
5718 case 57820: // Ebon Champion
5719 case 57821: // Champion of the Kirin Tor
5720 case 57822: // Wyrmrest Champion
5721 {
5722 if (!caster || !caster->IsPlayer())
5723 break;
5724
5725 uint32 FactionID = 0;
5726
5727 if (apply)
5728 {
5729 switch (m_spellInfo->Id)
5730 {
5731 case 57819:
5732 FactionID = 1106;
5733 break; // Argent Crusade
5734 case 57820:
5735 FactionID = 1098;
5736 break; // Knights of the Ebon Blade
5737 case 57821:
5738 FactionID = 1090;
5739 break; // Kirin Tor
5740 case 57822:
5741 FactionID = 1091;
5742 break; // The Wyrmrest Accord
5743 }
5744 }
5745 caster->ToPlayer()->SetChampioningFaction(FactionID);
5746 break;
5747 }
5748 // LK Intro VO (1)
5749 case 58204:
5750 if (target->IsPlayer())
5751 {
5752 // Play part 1
5753 if (apply)
5754 target->PlayDirectSound(14970, target->ToPlayer());
5755 // continue in 58205
5756 else
5757 target->CastSpell(target, 58205, true);
5758 }
5759 break;
5760 // LK Intro VO (2)
5761 case 58205:
5762 if (target->IsPlayer())
5763 {
5764 // Play part 2
5765 if (apply)
5766 target->PlayDirectSound(14971, target->ToPlayer());
5767 // Play part 3
5768 else
5769 target->PlayDirectSound(14972, target->ToPlayer());
5770 }
5771 break;
5772 case 62061: // Festive Holiday Mount
5773 if (target->HasMountedAura())
5774 {
5775 uint32 creatureEntry = 0;
5776 if (apply)
5777 {
5779 creatureEntry = 24906;
5780 else
5781 creatureEntry = 15665;
5782 }
5783 else
5784 creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
5785
5786 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
5787 {
5788 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
5789 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
5790
5792 }
5793 }
5794 break;
5795 case FRESH_BREWFEST_HOPS: // Festive Brewfest Mount
5796 if (target->HasMountedAura() && !target->HasIncreaseMountedFlightSpeedAura())
5797 {
5798 uint32 creatureEntry = 0;
5799
5800 if (apply)
5801 {
5802 if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
5803 {
5804 creatureEntry = GREAT_BREWFEST_KODO;
5805 }
5806 else
5807 {
5808 creatureEntry = BREWFEST_KODO;
5809 }
5810 }
5811 else
5812 {
5813 creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
5814 }
5815
5816 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
5817 {
5818 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
5819 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
5820
5822 }
5823 }
5824 break;
5825 }
5826
5827 break;
5828 }
5829 case SPELLFAMILY_MAGE:
5830 {
5831 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5832 //break;
5833 break;
5834 }
5835 case SPELLFAMILY_PRIEST:
5836 {
5837 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5838 //break;
5839 break;
5840 }
5841 case SPELLFAMILY_DRUID:
5842 {
5843 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5844 // break;
5845 break;
5846 }
5847 case SPELLFAMILY_SHAMAN:
5848 {
5849 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5850 // break;
5851 break;
5852 }
5853 }
5854}
#define sBattlefieldMgr
Definition BattlefieldMgr.h:77
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:1410
@ SPELLFAMILY_PRIEST
Definition SharedDefines.h:3800
@ SPELLFAMILY_MAGE
Definition SharedDefines.h:3797
@ SPELLFAMILY_GENERIC
Definition SharedDefines.h:3794
@ SPELLFAMILY_SHAMAN
Definition SharedDefines.h:3805
@ SPELLFAMILY_DRUID
Definition SharedDefines.h:3801
@ 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:354
@ UNIT_FIELD_MOUNTDISPLAYID
Definition UpdateFields.h:126
Definition GridNotifiers.h:1348
void SetStackAmount(uint8 num)
Definition SpellAuras.cpp:937
void SetCharges(uint8 charges)
Definition SpellAuras.cpp:894
Definition Battlefield.h:205
Definition Battleground.h:294
bool IsBattleground() const
Definition Map.h:301
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Definition ObjectMgr.cpp:1661
uint32 GetEntry() const
Definition Object.h:116
void SetEntry(uint32 entry)
Definition Object.h:117
Definition SpellMgr.h:462
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition PlayerQuest.cpp:1925
Battleground * GetBattleground(bool create=false) const
Definition Player.cpp:12237
void RemoveAmmo()
Definition PlayerStorage.cpp:2521
void SetChampioningFaction(uint32 faction)
Definition Player.h:2567
void LeaveBattleground(Battleground *bg=nullptr)
Definition Player.cpp:11343
uint32 StackAmount
Definition SpellInfo.h:371
uint8 getGender() const
Definition Unit.h:836
void RemovePetAura(PetAura const *petSpell)
Definition Unit.cpp:17548
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5700
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:13538
void AddPetAura(PetAura const *petSpell)
Definition Unit.cpp:17536
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition Unit.cpp:14758
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:19105
bool HasMountedAura() const
Definition Unit.h:1777
bool IsAlive() const
Definition Unit.h:1771
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:1194
float GetSpeedRate(UnitMoveType mtype) const
Definition Unit.h:1719
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:21409
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition Unit.cpp:14719
Guardian * GetGuardianPet() const
Definition Unit.cpp:10855
bool isDead() const
Definition Unit.h:1773
Map * GetMap() const
Definition Object.h:620
void PlayDirectSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:2901
void PlayDistanceSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:2893
uint32 GetZoneId() const
Definition Object.cpp:3056
Definition GridNotifiers.h:501
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165
Definition CreatureData.h:169
uint32 CreatureDisplayID
Definition CreatureData.h:179
Definition CreatureData.h:186

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(), Aura::GetCaster(), GetCasterGUID(), Object::GetEntry(), Unit::getGender(), Unit::GetGuardianPet(), Object::GetGUID(), GetId(), WorldObject::GetMap(), GetMiscValue(), Unit::GetMotionMaster(), AuraApplication::GetRemoveMode(), Unit::GetSpeedRate(), GetSpellInfo(), Aura::GetSpellInfo(), AuraApplication::GetTarget(), WorldObject::GetZoneId(), GREAT_BREWFEST_KODO, Unit::HasIncreaseMountedFlightSpeedAura(), Unit::HasMountedAura(), SpellInfo::Id, IMMUNITY_MECHANIC, Unit::IsAlive(), Map::IsBattleground(), Object::IsCreature(), Unit::isDead(), Object::IsPlayer(), Player::KilledMonsterCredit(), Player::LeaveBattleground(), m_effIndex, m_spellInfo, MOVE_RUN, MotionMaster::MoveFall(), WorldObject::PlayDirectSound(), WorldObject::PlayDistanceSound(), Player::RemoveAmmo(), Unit::RemoveAurasDueToSpell(), Unit::RemovePetAura(), roll_chance_i(), sBattlefieldMgr, 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
5966{
5967 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5968 return;
5969
5970 Unit* target = aurApp->GetTarget();
5971
5972 if (!apply)
5973 {
5974 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5975 if (target->HasAuraType(GetAuraType()))
5976 return;
5977 }
5978
5979 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
5981}
@ CREATURE_TYPE_BEAST
Definition SharedDefines.h:2639
@ UNIT_DYNFLAG_SPECIALINFO
Definition SharedDefines.h:3375
@ UNIT_DYNAMIC_FLAGS
Definition UpdateFields.h:136
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:795
uint32 GetCreatureType() const
Definition Unit.cpp:15287

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
3366{
3368 return;
3369
3370 Unit* target = aurApp->GetTarget();
3371
3372 if (Player* targetPlayer = target->ToPlayer())
3373 {
3374 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3375 }
3376
3377 if (!apply)
3378 {
3379 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3380 if (target->HasAuraType(GetAuraType()))
3381 return;
3382 }
3383
3384 target->SetFeatherFall(apply);
3385
3386 // start fall from current height
3387 if (!apply && target->IsPlayer())
3388 target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ());
3389}
#define sScriptMgr
Definition ScriptMgr.h:718
void SetFallInformation(uint32 time, float z)
Definition Player.h:2350
void SetFeatherFall(bool enable)
Definition Unit.cpp:20638
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
1791{
1793 return;
1794
1795 Unit* target = aurApp->GetTarget();
1796
1797 if (!target->IsPlayer())
1798 return;
1799
1800 if (apply)
1801 {
1805 }
1806 else
1807 {
1808 if (target->HasGhostAura())
1809 return;
1810
1814 }
1815}
@ PLAYER_FLAGS_GHOST
Definition Player.h:472
@ SERVERSIDE_VISIBILITY_GHOST
Definition SharedDefines.h:1285
@ GHOST_VISIBILITY_ALIVE
Definition SharedDefines.h:1292
@ GHOST_VISIBILITY_GHOST
Definition SharedDefines.h:1293
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:394
bool HasGhostAura() const
Definition Unit.h:1776
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition Object.h:613
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:612

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

3392{
3394 return;
3395
3396 Unit* target = aurApp->GetTarget();
3397
3398 if (Player* targetPlayer = target->ToPlayer())
3399 {
3400 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3401 }
3402
3403 if (!apply)
3404 {
3405 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3406 if (target->HasAuraType(GetAuraType()))
3407 return;
3408 }
3409
3410 target->SetHover(apply);
3411}
void SetHover(bool enable)
Definition Unit.cpp:20679

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
4828{
4830 return;
4831
4832 Unit* target = aurApp->GetTarget();
4833
4834 if (apply)
4836 else
4837 {
4840 }
4841}
@ 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:15367
void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount)
Definition Unit.cpp:15334
float GetTotalAuraMultiplier(AuraType auratype) const
Definition Unit.cpp:6131

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
6057{
6058 Unit* target = aurApp->GetTarget();
6059
6060 uint32 triggeredSpellId = sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->Effects[m_effIndex].TriggerSpell, target);
6061 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId);
6062 if (!triggeredSpellInfo)
6063 return;
6064
6065 if (mode & AURA_EFFECT_HANDLE_REAL)
6066 {
6067 if (apply)
6068 {
6069 Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCaster() : target;
6070
6071 if (!caster)
6072 return;
6073 // If amount avalible cast with basepoints (Crypt Fever for example)
6074 if (GetAmount())
6075 caster->CastCustomSpell(target, triggeredSpellId, &m_amount, nullptr, nullptr, true, nullptr, this);
6076 else
6077 caster->CastSpell(target, triggeredSpellId, true, nullptr, this);
6078 }
6079 else
6080 {
6081 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
6082 target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
6083 }
6084 }
6085 else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
6086 {
6087 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
6088 // change the stack amount to be equal to stack amount of our aura
6089 if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
6090 triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
6091 }
6092}
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell, uint8 effIndex=MAX_SPELL_EFFECTS) const
Definition SpellInfo.cpp:1038
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4895
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:1251

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
5143{
5145 return;
5146
5147 Unit* target = aurApp->GetTarget();
5148
5150}
@ 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:15308

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
5220{
5222 return;
5223
5224 Unit* target = aurApp->GetTarget();
5225
5226 // Recalculate bonus
5227 if (target->IsPlayer())
5228 target->ToPlayer()->UpdateAttackPowerAndDamage(false);
5229}
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
5215{
5216 HandleAuraModAttackPowerOfArmor(aurApp, mode, apply);
5217}
void HandleAuraModAttackPowerOfArmor(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:5219

References HandleAuraModAttackPowerOfArmor().

◆ HandleAuraModAttackPowerPercent()

void AuraEffect::HandleAuraModAttackPowerPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5166{
5168 return;
5169
5170 Unit* target = aurApp->GetTarget();
5171
5172 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
5173 if (apply)
5175 else
5176 {
5179 }
5180}
@ 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
4375{
4377 return;
4378
4379 Unit* target = aurApp->GetTarget();
4380 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4381 {
4382 if (GetMiscValue() & int32(1 << x))
4383 {
4384 if (apply)
4386 else
4387 {
4390 }
4391 }
4392 }
4393}
@ SPELL_SCHOOL_NORMAL
Definition SharedDefines.h:294
constexpr auto MAX_SPELL_SCHOOL
Definition SharedDefines.h:303
@ 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:6156

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
4877{
4879 return;
4880
4881 Unit* target = aurApp->GetTarget();
4882
4883 if (!target->IsPlayer())
4884 return;
4885
4886 target->ToPlayer()->UpdateBlockPercentage();
4887}
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
4968{
4970 return;
4971
4972 Unit* target = aurApp->GetTarget();
4973
4974 if (!target->IsPlayer())
4975 {
4976 target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
4977 return;
4978 }
4979
4981
4982 // included in Player::UpdateSpellCritChance calculation
4984}
void UpdateAllSpellCritChances()
Definition StatSystem.cpp:889
void UpdateAllWeaponDependentCritAuras()
Definition Player.cpp:7144
int32 m_baseSpellCritChance
Definition Unit.h:2065
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
3786{
3788 return;
3789
3790 Unit* target = aurApp->GetTarget();
3791
3792 target->UpdateSpeed(MOVE_WALK, true);
3793 target->UpdateSpeed(MOVE_RUN, true);
3794 target->UpdateSpeed(MOVE_SWIM, true);
3795 target->UpdateSpeed(MOVE_FLIGHT, true);
3796 target->UpdateSpeed(MOVE_RUN_BACK, true);
3797 target->UpdateSpeed(MOVE_SWIM_BACK, true);
3798 target->UpdateSpeed(MOVE_FLIGHT_BACK, true);
3799
3800 if (Player* targetPlayer = target->ToPlayer())
3801 {
3802 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3803 }
3804}
@ MOVE_FLIGHT
Definition UnitDefines.h:359
@ MOVE_SWIM
Definition UnitDefines.h:356
@ MOVE_FLIGHT_BACK
Definition UnitDefines.h:360
@ MOVE_SWIM_BACK
Definition UnitDefines.h:357
@ MOVE_RUN_BACK
Definition UnitDefines.h:355
@ MOVE_WALK
Definition UnitDefines.h:353
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition Unit.cpp:14414

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
2966{
2967 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2968 return;
2969
2970 Unit* target = aurApp->GetTarget();
2971
2972 AuraType type = GetAuraType();
2973
2974 //Prevent handling aura twice
2975 if ((apply) ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
2976 return;
2977
2978 uint32 field, flag, slot;
2979 WeaponAttackType attType;
2980 switch (type)
2981 {
2983 field = UNIT_FIELD_FLAGS;
2984 flag = UNIT_FLAG_DISARMED;
2986 attType = BASE_ATTACK;
2987 break;
2989 field = UNIT_FIELD_FLAGS_2;
2992 attType = OFF_ATTACK;
2993 break;
2995 field = UNIT_FIELD_FLAGS_2;
2997 slot = EQUIPMENT_SLOT_RANGED;
2998 attType = RANGED_ATTACK;
2999 break;
3000 default:
3001 return;
3002 }
3003
3004 // if disarm aura is to be removed, remove the flag first to reapply damage/aura mods
3005 if (!apply)
3006 target->RemoveFlag(field, flag);
3007
3008 // Handle damage modification, shapeshifted druids are not affected
3009 if (target->IsPlayer() && (!target->IsInFeralForm() || target->GetShapeshiftForm() == FORM_GHOSTWOLF))
3010 {
3011 Player* player = target->ToPlayer();
3012 if (Item* pItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
3013 {
3014 WeaponAttackType attackType = Player::GetAttackBySlot(slot);
3015
3016 player->ApplyItemDependentAuras(pItem, !apply);
3017 if (attackType < MAX_ATTACK)
3018 {
3019 player->_ApplyWeaponDamage(slot, pItem->GetTemplate(), nullptr, !apply);
3020 if (!apply) // apply case already handled on item dependent aura removal (if any)
3021 player->UpdateWeaponDependentAuras(attackType);
3022 }
3023 }
3024 }
3025
3026 // if disarm effects should be applied, wait to set flag until damage mods are unapplied
3027 if (apply)
3028 target->SetFlag(field, flag);
3029
3030 if (target->IsCreature() && target->ToCreature()->GetCurrentEquipmentId())
3031 target->UpdateDamagePhysical(attType);
3032}
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:685
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:686
@ EQUIPMENT_SLOT_RANGED
Definition Player.h:687
#define INVENTORY_SLOT_BAG_0
Definition Player.h:665
@ 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:300
@ UNIT_FLAG2_DISARM_RANGED
Definition UnitDefines.h:302
@ FORM_GHOSTWOLF
Definition UnitDefines.h:85
@ UNIT_FLAG_DISARMED
Definition UnitDefines.h:275
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:197
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:827
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:842
Creature * ToCreature()
Definition Object.h:205
void UpdateWeaponDependentAuras(WeaponAttackType attackType)
Definition Player.cpp:7150
void ApplyItemDependentAuras(Item *item, bool apply)
Definition Player.cpp:7157
void _ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply)
Definition Player.cpp:6969
Item * GetItemByPos(uint16 pos) const
Definition PlayerStorage.cpp:443
static WeaponAttackType GetAttackBySlot(uint8 slot)
Definition PlayerStorage.cpp:544
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1934
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition StatSystem.cpp:60
bool IsInFeralForm() const
Definition Unit.h:1937

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
4316{
4317 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4318 return;
4319
4320 Unit* target = aurApp->GetTarget();
4321
4323}
DispelType
Definition SharedDefines.h:1382
void ApplySpellDispelImmunity(SpellInfo const *spellProto, DispelType type, bool apply)
Definition Unit.cpp:13565

References Unit::ApplySpellDispelImmunity(), AURA_EFFECT_HANDLE_REAL, GetMiscValue(), AuraApplication::GetTarget(), and m_spellInfo.

◆ HandleAuraModDmgImmunity()

void AuraEffect::HandleAuraModDmgImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4306{
4307 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4308 return;
4309
4310 Unit* target = aurApp->GetTarget();
4311
4312 target->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, GetMiscValue(), apply);
4313}
@ IMMUNITY_DAMAGE
Definition SharedDefines.h:1408

References Unit::ApplySpellImmune(), AURA_EFFECT_HANDLE_REAL, GetId(), GetMiscValue(), AuraApplication::GetTarget(), and IMMUNITY_DAMAGE.

◆ HandleAuraModDodgePercent()

void AuraEffect::HandleAuraModDodgePercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4864{
4866 return;
4867
4868 Unit* target = aurApp->GetTarget();
4869
4870 if (!target->IsPlayer())
4871 return;
4872
4873 target->ToPlayer()->UpdateDodgePercentage();
4874}
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
4211{
4212 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4213 return;
4214
4215 Unit* target = aurApp->GetTarget();
4216
4217 target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
4218
4219 // when removing flag aura, handle flag drop
4220 Player* player = target->ToPlayer();
4221 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
4222 {
4223 if (player->InBattleground())
4224 {
4225 if (Battleground* bg = player->GetBattleground())
4226 bg->EventPlayerDroppedFlag(player);
4227 }
4228 else
4229 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
4230 }
4231}
#define sOutdoorPvPMgr
Definition OutdoorPvPMgr.h:102
@ IMMUNITY_EFFECT
Definition SharedDefines.h:1405
@ AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
Definition SpellDefines.h:63
bool InBattleground() const
Definition Player.h:2266

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
4654{
4656 return;
4657
4658 Unit* target = aurApp->GetTarget();
4659
4660 if (!target->IsPlayer())
4661 return;
4662
4665}
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
5984{
5985 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5986 return;
5987
5988 Unit* target = aurApp->GetTarget();
5989
5990 if (apply)
5991 {
5992 target->SetFaction(GetMiscValue());
5993 if (target->IsPlayer())
5995 }
5996 else
5997 {
5998 target->RestoreFaction();
5999 if (target->IsPlayer())
6001 }
6002}
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition UnitDefines.h:257
void SetFaction(uint32 faction)
Definition Unit.cpp:10235
void RestoreFaction()
Definition Unit.cpp:18937

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
6111{
6113 return;
6114
6115 Player* target = aurApp->GetTarget()->ToPlayer();
6116 if (!target)
6117 return;
6118
6121}
@ PLAYER_FAKE_INEBRIATION
Definition UpdateFields.h:325
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:804
void UpdateInvisibilityDrunkDetect()
Definition Player.cpp:1012

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
4755{
4757 return;
4758
4759 Unit* target = aurApp->GetTarget();
4760
4762 // do not check power type, we can always modify the maximum
4763 // as the client will not see any difference
4764 // also, placing conditions that may change during the aura duration
4765 // inside effect handlers is not a good idea
4766 //if (int32(PowerType) != GetMiscValue())
4767 // return;
4768
4769 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4770
4771 target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
4772}
std::uint16_t uint16
Definition Define.h:108
Powers
Definition SharedDefines.h:279
@ 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
4775{
4777 return;
4778
4779 Unit* target = aurApp->GetTarget();
4780
4782 // do not check power type, we can always modify the maximum
4783 // as the client will not see any difference
4784 // also, placing conditions that may change during the aura duration
4785 // inside effect handlers is not a good idea
4786 //if (int32(PowerType) != GetMiscValue())
4787 // return;
4788
4789 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4790
4791 if (apply)
4792 {
4793 float amount = float(GetAmount());
4794 target->ApplyStatPctModifier(unitMod, TOTAL_PCT, amount);
4795 }
4796 else
4797 {
4799 target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
4800 }
4801}
@ SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
Definition SpellAuraDefines.h:195
float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6196

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.

3731{
3733 return;
3734
3735 Unit* target = aurApp->GetTarget();
3737 target->UpdateSpeed(MOVE_FLIGHT, true);
3738
3741 {
3742 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3743 if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasIncreaseMountedFlightSpeedAura() && !target->HasFlyAura())))
3744 {
3745 target->SetCanFly(apply);
3746
3747 if (!apply && target->IsCreature() && !target->IsLevitating())
3748 target->GetMotionMaster()->MoveFall();
3749 }
3750
3752 if (mode & AURA_EFFECT_HANDLE_REAL)
3753 {
3754 //Players on flying mounts must be immune to polymorph
3755 if (target->IsPlayer())
3757
3758 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3759 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountID())
3761 }
3762 }
3763
3764 if (Player* targetPlayer = target->ToPlayer())
3765 {
3766 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3767 }
3768}
@ MECHANIC_POLYMORPH
Definition SharedDefines.h:1353
@ 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:1781
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition Unit.cpp:5787
uint32 GetMountID() const
Definition Unit.h:1865

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
4710{
4712 return;
4713
4714 Unit* target = aurApp->GetTarget();
4715
4716 if (apply)
4717 {
4719 target->ModifyHealth(GetAmount());
4720 }
4721 else
4722 {
4723 if (int32(target->GetHealth()) > GetAmount())
4724 target->ModifyHealth(-GetAmount());
4725 else
4726 target->SetHealth(1);
4728 }
4729}
int32 ModifyHealth(int32 val)
Definition Unit.cpp:14264
void SetHealth(uint32 val)
Definition Unit.cpp:15708
uint32 GetHealth() const
Definition Unit.h:1091

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
4804{
4806 return;
4807
4808 Unit* target = aurApp->GetTarget();
4809
4810 // Unit will keep hp% after MaxHealth being modified if unit is alive.
4811 float percent = target->GetHealthPct();
4812
4813 if (apply)
4815 else
4816 {
4819 }
4820
4821 // Xinef: pct was rounded down and could "kill" creature by setting its health to 0 making npc zombie
4822 if (target->IsAlive())
4823 if (uint32 healthAmount = CalculatePct(target->GetMaxHealth(), percent))
4824 target->SetHealth(healthAmount);
4825}
@ 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:1093
uint32 GetMaxHealth() const
Definition Unit.h:1092

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
4732{
4734 return;
4735
4736 Unit* target = aurApp->GetTarget();
4737
4738 uint32 oldhealth = target->GetHealth();
4739 double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth();
4740
4742
4743 // refresh percentage
4744 if (oldhealth > 0)
4745 {
4746 uint32 newhealth = uint32(std::ceil((double)target->GetMaxHealth() * healthPercentage));
4747 if (newhealth == 0)
4748 newhealth = 1;
4749
4750 target->SetHealth(newhealth);
4751 }
4752}

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
3726{
3727 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3728}
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3710

References HandleAuraModIncreaseSpeed().

◆ HandleAuraModIncreaseSpeed()

void AuraEffect::HandleAuraModIncreaseSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3711{
3713 return;
3714
3715 Unit* target = aurApp->GetTarget();
3716
3717 target->UpdateSpeed(MOVE_RUN, true);
3718
3719 if (Player* targetPlayer = target->ToPlayer())
3720 {
3721 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3722 }
3723}

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
3771{
3773 return;
3774
3775 Unit* target = aurApp->GetTarget();
3776
3777 target->UpdateSpeed(MOVE_SWIM, true);
3778
3779 if (Player* targetPlayer = target->ToPlayer())
3780 {
3781 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3782 }
3783}

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
3064{
3066 return;
3067
3068 Unit* target = aurApp->GetTarget();
3069
3070 if (apply)
3071 {
3073 //target->AttackStop(); // pussywizard: why having this flag prevents from being in combat? it should just prevent melee attack
3074 }
3075 else
3076 {
3077 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3078 if (target->HasPacifyAura() || target->HasPacifySilenceAura())
3079 return;
3081 }
3082}
@ UNIT_FLAG_PACIFIED
Definition UnitDefines.h:271
bool HasPacifySilenceAura() const
Definition Unit.h:1801
bool HasPacifyAura() const
Definition Unit.h:1805

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
3085{
3087 return;
3088
3089 Unit* target = aurApp->GetTarget();
3090
3091 if (!(apply))
3092 {
3093 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3094 if (target->HasPacifySilenceAura())
3095 return;
3096 }
3097 HandleAuraModPacify(aurApp, mode, apply);
3098 HandleAuraModSilence(aurApp, mode, apply);
3099}
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3034
void HandleAuraModPacify(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3063

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
4848{
4850 return;
4851
4852 Unit* target = aurApp->GetTarget();
4853
4854 if (!target->IsPlayer())
4855 return;
4856
4857 if (!target->ToPlayer()->CanParry())
4858 target->ToPlayer()->SetCanParry(true);
4859 else
4860 target->ToPlayer()->UpdateParryPercentage();
4861}
void UpdateParryPercentage()
Definition StatSystem.cpp:753
bool CanParry() const
Definition Player.h:2181
void SetCanParry(bool value)
Definition Player.cpp:13163

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
3221{
3223 return;
3224
3225 Unit* target = aurApp->GetTarget();
3226
3227 if (!target->IsPlayer())
3228 return;
3229
3230 // Recalculate pet talent points
3231 if (Pet* pet = target->ToPlayer()->GetPet())
3232 pet->InitTalentForLevel();
3233}

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
5153{
5155 return;
5156
5157 Unit* target = aurApp->GetTarget();
5158
5159 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
5160 return;
5161
5163}
#define CLASSMASK_WAND_USERS
Definition SharedDefines.h:174
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:171
uint32 getClassMask() const
Definition Unit.h:833

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
5183{
5185 return;
5186
5187 Unit* target = aurApp->GetTarget();
5188
5189 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
5190 return;
5191
5192 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
5193 if (apply)
5195 else
5196 {
5199 }
5200}
@ 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
5081{
5083 return;
5084
5085 Unit* target = aurApp->GetTarget();
5086
5087 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
5088}
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:17286

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
4890{
4891 HandleModManaRegen(aurApp, mode, apply);
4892}
void HandleModManaRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4695

References HandleModManaRegen().

◆ HandleAuraModResistance()

void AuraEffect::HandleAuraModResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4357{
4359 return;
4360
4361 Unit* target = aurApp->GetTarget();
4362
4363 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4364 {
4365 if (GetMiscValue() & int32(1 << x))
4366 {
4368 if (target->IsPlayer() || target->IsPet())
4370 }
4371 }
4372}
std::int8_t int8
Definition Define.h:105
SpellSchools
Definition SharedDefines.h:293
bool IsPet() const
Definition Unit.h:785
void UpdateResistanceBuffModsMod(SpellSchools school)
Definition Unit.cpp:6266

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
4334{
4336 return;
4337
4338 Unit* target = aurApp->GetTarget();
4339
4340 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4341 {
4342 if (GetMiscValue() & int32(1 << x))
4343 {
4345 if (amount < GetAmount())
4346 {
4347 float value = float(GetAmount() - amount);
4349 if (target->IsPlayer() || target->IsPet())
4351 }
4352 }
4353 }
4354}
@ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
Definition SpellAuraDefines.h:206
@ BASE_VALUE
Definition Unit.h:128
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
Definition Unit.cpp:6166

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
4632{
4634 return;
4635
4636 Unit* target = aurApp->GetTarget();
4637
4638 if (!target->IsPlayer())
4639 return;
4640
4642 {
4643 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
4644 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
4645 LOG_ERROR("spells.aura.effect", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
4646 return;
4647 }
4648
4649 // Recalculate Armor
4650 target->UpdateArmor();
4651}
#define LOG_ERROR(filterType__,...)
Definition Log.h:158
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:308
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
3539{
3540 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3541 return;
3542
3543 Unit* target = aurApp->GetTarget();
3544
3545 target->SetControlled(apply, UNIT_STATE_ROOT);
3546}
@ UNIT_STATE_ROOT
Definition UnitDefines.h:180
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:18287

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
2787{
2789 return;
2790
2791 aurApp->GetTarget()->RecalculateObjectScale();
2792}

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
4247{
4248 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4249 return;
4250
4251 Unit* target = aurApp->GetTarget();
4252
4253 target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, GetMiscValue(), (apply));
4254
4255 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4256 {
4257 if (apply)
4259 else
4260 {
4261 bool banishFound = false;
4262 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
4263 for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
4264 if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4265 {
4266 banishFound = true;
4267 break;
4268 }
4269 if (!banishFound)
4271 }
4272 }
4273
4274 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
4276
4277 // remove all flag auras (they are positive, but they must be removed when you are immune)
4281
4283 if ((apply)
4285 && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
4286 {
4287 uint32 school_mask = GetMiscValue();
4288 Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
4289 for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
4290 {
4291 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
4292 if ((spell->GetSchoolMask() & school_mask)//Check for school mask
4293 && GetSpellInfo()->CanDispelAura(spell)
4294 && !iter->second->IsPositive() //Don't remove positive spells
4295 && spell->Id != GetId()) //Don't remove self
4296 {
4297 target->RemoveAura(iter);
4298 }
4299 else
4300 ++iter;
4301 }
4302 }
4303}
@ SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE
Definition SharedDefines.h:488
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
Definition SharedDefines.h:445
@ MECHANIC_BANISH
Definition SharedDefines.h:1354
@ IMMUNITY_SCHOOL
Definition SharedDefines.h:1407
@ UNIT_STATE_ISOLATED
Definition UnitDefines.h:183
bool IsPositive() const
Definition SpellInfo.cpp:1237
bool CanDispelAura(SpellInfo const *aura) const
Definition SpellInfo.cpp:1350
void ClearUnitState(uint32 f)
Definition Unit.h:727
void AddUnitState(uint32 f)
Definition Unit.h:725
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition Unit.cpp:5300

References Unit::AddUnitState(), Unit::ApplySpellImmune(), AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, SpellInfo::CanDispelAura(), Unit::ClearUnitState(), Unit::GetAppliedAuras(), Unit::GetAuraEffectsByType(), GetAuraType(), GetId(), GetMiscValue(), SpellInfo::GetSchoolMask(), GetSpellInfo(), AuraApplication::GetTarget(), 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
1878{
1880 return;
1881
1882 Unit* target = aurApp->GetTarget();
1883
1884 uint32 modelid = 0;
1887
1888 switch (form)
1889 {
1890 case FORM_CAT: // 0x01
1891 case FORM_GHOUL: // 0x07
1893 break;
1894
1895 case FORM_BEAR: // 0x05
1896 case FORM_DIREBEAR: // 0x08
1897
1898 case FORM_BATTLESTANCE: // 0x11
1899 case FORM_DEFENSIVESTANCE: // 0x12
1900 case FORM_BERSERKERSTANCE: // 0x13
1902 break;
1903
1904 case FORM_TREE: // 0x02
1905 case FORM_TRAVEL: // 0x03
1906 case FORM_AQUA: // 0x04
1907 case FORM_AMBIENT: // 0x06
1908
1909 case FORM_STEVES_GHOUL: // 0x09
1910 case FORM_THARONJA_SKELETON: // 0x0A
1911 case FORM_TEST_OF_STRENGTH: // 0x0B
1912 case FORM_BLB_PLAYER: // 0x0C
1913 case FORM_SHADOW_DANCE: // 0x0D
1914 case FORM_CREATUREBEAR: // 0x0E
1915 case FORM_CREATURECAT: // 0x0F
1916 case FORM_GHOSTWOLF: // 0x10
1917
1918 case FORM_TEST: // 0x14
1919 case FORM_ZOMBIE: // 0x15
1920 case FORM_METAMORPHOSIS: // 0x16
1921 case FORM_UNDEAD: // 0x19
1922 case FORM_MASTER_ANGLER: // 0x1A
1923 case FORM_FLIGHT_EPIC: // 0x1B
1924 case FORM_SHADOW: // 0x1C
1925 case FORM_FLIGHT: // 0x1D
1926 case FORM_STEALTH: // 0x1E
1927 case FORM_MOONKIN: // 0x1F
1928 case FORM_SPIRITOFREDEMPTION: // 0x20
1929 break;
1930 default:
1931 LOG_ERROR("spells.aura.effect", "Auras: Unknown Shapeshift Type: {}", GetMiscValue());
1932 }
1933
1934 modelid = target->GetModelForForm(form, GetId());
1935
1936 if (apply)
1937 {
1938 // remove polymorph before changing display id to keep new display id
1939 switch (form)
1940 {
1941 case FORM_CAT:
1942 case FORM_TREE:
1943 case FORM_TRAVEL:
1944 case FORM_AQUA:
1945 case FORM_BEAR:
1946 case FORM_DIREBEAR:
1947 case FORM_FLIGHT_EPIC:
1948 case FORM_FLIGHT:
1949 case FORM_MOONKIN:
1950 {
1951 if (Player* player = target->ToPlayer())
1952 {
1953 player->SetCanTeleport(true);
1954 }
1955 // remove movement affects
1956 target->RemoveAurasByShapeShift();
1957
1958 // and polymorphic affects
1959 if (target->IsPolymorphed())
1960 target->RemoveAurasDueToSpell(target->getTransForm());
1961 break;
1962 }
1963 default:
1964 break;
1965 }
1966
1967 // remove other shapeshift before applying a new one
1968 // xinef: rogue shouldnt be wrapped by this check (shadow dance vs stealth)
1969 if (GetSpellInfo()->SpellFamilyName != SPELLFAMILY_ROGUE)
1971
1972 // stop handling the effect if it was removed by linked event
1973 if (aurApp->GetRemoveMode())
1974 return;
1975
1976 if (PowerType != POWER_MANA)
1977 {
1978 uint32 oldPower = target->GetPower(PowerType);
1979 // reset power to default values only at power change
1980 if (target->getPowerType() != PowerType)
1981 target->setPowerType(PowerType);
1982
1983 switch (form)
1984 {
1985 case FORM_CAT:
1986 case FORM_BEAR:
1987 case FORM_DIREBEAR:
1988 {
1989 // get furor proc chance
1990 uint32 FurorChance = 0;
1991 if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
1992 FurorChance = std::max(dummy->GetAmount(), 0);
1993
1994 switch (GetMiscValue())
1995 {
1996 case FORM_CAT:
1997 {
1998 int32 basePoints = int32(std::min(oldPower, FurorChance));
1999 target->SetPower(POWER_ENERGY, 0);
2000 target->CastCustomSpell(target, 17099, &basePoints, nullptr, nullptr, true, nullptr, this);
2001 break;
2002 }
2003 case FORM_BEAR:
2004 case FORM_DIREBEAR:
2005 if (urand(0, 99) < FurorChance)
2006 target->CastSpell(target, 17057, true);
2007 break;
2008 default:
2009 {
2010 uint32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance);
2011 target->SetPower(POWER_ENERGY, newEnergy);
2012 break;
2013 }
2014 }
2015 break;
2016 }
2017 default:
2018 break;
2019 }
2020 }
2021 // stop handling the effect if it was removed by linked event
2022 if (aurApp->GetRemoveMode())
2023 return;
2024
2025 target->SetShapeshiftForm(form);
2026 // xinef: allow shapeshift to override model id if forced transform aura is not present!
2027 if (modelid > 0)
2028 {
2029 bool allow = true;
2030 if (target->getTransForm() && !(target->GetMapId() == MAP_THE_ESCAPE_FROM_DURNHOLDE))
2031 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm()))
2032 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !transformSpellInfo->IsPositive())
2033 allow = false;
2034
2035 if (allow)
2036 target->SetDisplayId(modelid);
2037 }
2038 }
2039 else
2040 {
2041 // reset model id if no other auras present
2042 // may happen when aura is applied on linked event on aura removal
2043 if (!target->HasShapeshiftAura())
2044 {
2047 {
2048 target->setPowerType(POWER_MANA);
2049 // Remove movement impairing effects also when shifting out
2050 target->RemoveAurasByShapeShift();
2051 }
2052 }
2053
2054 if (modelid > 0)
2055 target->RestoreDisplayId();
2056
2057 switch (form)
2058 {
2059 // Nordrassil Harness - bonus
2060 case FORM_BEAR:
2061 case FORM_DIREBEAR:
2062 case FORM_CAT:
2063 if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
2064 target->CastSpell(target, 37316, true, nullptr, dummy);
2065 break;
2066 // Nordrassil Regalia - bonus
2067 case FORM_MOONKIN:
2068 if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
2069 target->CastSpell(target, 37325, true, nullptr, dummy);
2070 break;
2071 case FORM_BATTLESTANCE:
2074 {
2075 uint32 Rage_val = 0;
2076 // Defensive Tactics
2077 if (form == FORM_DEFENSIVESTANCE)
2078 {
2079 if (AuraEffect const* aurEff = target->IsScriptOverriden(m_spellInfo, 831))
2080 Rage_val += aurEff->GetAmount() * 10;
2081 }
2082 // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
2083 if (target->IsPlayer())
2084 {
2085 // Stance mastery - trainer spell
2086 PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
2087 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
2088 {
2089 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec()))
2090 continue;
2091
2092 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
2093 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
2094 Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
2095 }
2096
2097 // Tactical Mastery - talent
2098 PlayerTalentMap const& tp_list = target->ToPlayer()->GetTalentMap();
2099 for (PlayerTalentMap::const_iterator itr = tp_list.begin(); itr != tp_list.end(); ++itr)
2100 {
2101 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec()))
2102 continue;
2103
2104 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
2105 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
2106 Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
2107 }
2108 }
2109 if (target->GetPower(POWER_RAGE) > Rage_val)
2110 target->SetPower(POWER_RAGE, Rage_val);
2111 break;
2112 }
2113 default:
2114 break;
2115 }
2116 }
2117
2118 // adding/removing linked auras
2119 // add/remove the shapeshift aura's boosts
2120 HandleShapeshiftBoosts(target, apply);
2121
2122 if (target->IsPlayer())
2123 target->ToPlayer()->InitDataForForm();
2124
2126 {
2127 // Dash
2129 aurEff->RecalculateAmount();
2130
2131 // Disarm handling
2132 // If druid shifts while being disarmed we need to deal with that since forms aren't affected by disarm
2133 // and also HandleAuraModDisarm is not triggered
2134 if (!target->CanUseAttackType(BASE_ATTACK))
2135 {
2137 {
2138 target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), nullptr, apply);
2139 }
2140 }
2141
2142 // Update crit chance for feral forms
2143 switch (form)
2144 {
2145 case FORM_CAT:
2146 case FORM_BEAR:
2147 case FORM_DIREBEAR:
2148 case FORM_GHOSTWOLF:
2150 break;
2151 default:
2152 break;
2153 }
2154 }
2155
2156 // stop handling the effect if it was removed by linked event
2157 if (apply && aurApp->GetRemoveMode())
2158 return;
2159
2160 if (target->IsPlayer())
2161 {
2162 SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
2163 // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
2164 for (uint8 i = 0; i < MAX_SHAPESHIFT_SPELLS; ++i)
2165 {
2166 if (!shapeInfo->stanceSpell[i])
2167 continue;
2168 if (apply)
2169 target->ToPlayer()->_addSpell(shapeInfo->stanceSpell[i], SPEC_MASK_ALL, true);
2170 else
2171 target->ToPlayer()->removeSpell(shapeInfo->stanceSpell[i], SPEC_MASK_ALL, true);
2172 }
2173 }
2174}
@ MAP_THE_ESCAPE_FROM_DURNHOLDE
Definition AreaDefines.h:237
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormEntryfmt)
#define MAX_SHAPESHIFT_SPELLS
Definition DBCStructure.h:1812
std::unordered_map< uint32, PlayerTalent * > PlayerTalentMap
Definition Player.h:194
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition Player.h:195
#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:281
@ POWER_ENERGY
Definition SharedDefines.h:283
@ POWER_MANA
Definition SharedDefines.h:280
@ CLASS_DRUID
Definition SharedDefines.h:151
@ SPELLFAMILY_WARRIOR
Definition SharedDefines.h:3798
@ SPELL_ATTR0_NO_IMMUNITIES
Definition SharedDefines.h:422
@ 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:68
@ FORM_DIREBEAR
Definition UnitDefines.h:77
@ FORM_UNDEAD
Definition UnitDefines.h:92
@ FORM_TEST
Definition UnitDefines.h:89
@ FORM_TRAVEL
Definition UnitDefines.h:72
@ FORM_CREATUREBEAR
Definition UnitDefines.h:83
@ FORM_SHADOW
Definition UnitDefines.h:95
@ FORM_SHADOW_DANCE
Definition UnitDefines.h:82
@ FORM_SPIRITOFREDEMPTION
Definition UnitDefines.h:99
@ FORM_BERSERKERSTANCE
Definition UnitDefines.h:88
@ FORM_MASTER_ANGLER
Definition UnitDefines.h:93
@ FORM_DEFENSIVESTANCE
Definition UnitDefines.h:87
@ FORM_THARONJA_SKELETON
Definition UnitDefines.h:79
@ FORM_FLIGHT_EPIC
Definition UnitDefines.h:94
@ FORM_STEVES_GHOUL
Definition UnitDefines.h:78
@ FORM_MOONKIN
Definition UnitDefines.h:98
@ FORM_NONE
Definition UnitDefines.h:69
@ FORM_CREATURECAT
Definition UnitDefines.h:84
@ FORM_CAT
Definition UnitDefines.h:70
@ FORM_FLIGHT
Definition UnitDefines.h:96
@ FORM_ZOMBIE
Definition UnitDefines.h:90
@ FORM_AMBIENT
Definition UnitDefines.h:75
@ FORM_AQUA
Definition UnitDefines.h:73
@ FORM_STEALTH
Definition UnitDefines.h:97
@ FORM_BATTLESTANCE
Definition UnitDefines.h:86
@ FORM_BLB_PLAYER
Definition UnitDefines.h:81
@ FORM_METAMORPHOSIS
Definition UnitDefines.h:91
@ FORM_GHOUL
Definition UnitDefines.h:76
@ FORM_TREE
Definition UnitDefines.h:71
@ FORM_TEST_OF_STRENGTH
Definition UnitDefines.h:80
@ FORM_BEAR
Definition UnitDefines.h:74
void HandleShapeshiftBoosts(Unit *target, bool apply) const
Definition SpellAuraEffects.cpp:1236
static ObjectGuid const Empty
Definition ObjectGuid.h:120
bool _addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill=false)
Definition Player.cpp:3120
void removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporary)
Definition Player.cpp:3339
const PlayerTalentMap & GetTalentMap() const
Definition Player.h:2620
PlayerSpellMap const & GetSpellMap() const
Definition Player.h:1768
void InitDataForForm(bool reapplyMods=false)
Definition Player.cpp:10594
uint8 GetActiveSpec() const
Definition Player.h:1736
void UpdateAllCritPercentages()
Definition StatSystem.cpp:698
uint32 SpellIconID
Definition SpellInfo.h:380
void RemoveAurasByShapeShift()
Definition Unit.cpp:5389
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition Unit.cpp:14956
bool IsPolymorphed() const
Definition Unit.cpp:16968
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:15796
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5613
virtual bool IsClass(Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
Definition Unit.h:832
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition Unit.cpp:5951
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId)
Definition Unit.cpp:19440
bool CanUseAttackType(WeaponAttackType attacktype) const
Definition Unit.h:975
bool HasShapeshiftAura() const
Definition Unit.h:1803
void RestoreDisplayId()
Definition Unit.cpp:17002
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition Unit.h:1420
uint32 getTransForm() const
Definition Unit.h:1945
Powers getPowerType() const
Definition Unit.h:1114
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition Unit.cpp:5229
uint32 GetPower(Powers power) const
Definition Unit.h:1118
void setPowerType(Powers power)
Definition Unit.cpp:10158
void SetShapeshiftForm(ShapeshiftForm form)
Definition Unit.cpp:21348
uint32 GetMapId() const
Definition Position.h:281
Definition DBCStructure.h:1815
uint32 stanceSpell[MAX_SHAPESHIFT_SPELLS]
Definition DBCStructure.h:1827

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
3035{
3036 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3037 return;
3038
3039 Unit* target = aurApp->GetTarget();
3040
3041 if (apply)
3042 {
3044
3045 // call functions which may have additional effects after chainging state of unit
3046 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
3047 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
3048 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
3049 if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
3050 // Stop spells on prepare or casting state
3051 target->InterruptSpell(CurrentSpellTypes(i), false);
3052 }
3053 else
3054 {
3055 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3056 if (target->HasSilenceAura() || target->HasPacifySilenceAura())
3057 return;
3058
3060 }
3061}
@ SPELL_PREVENTION_TYPE_SILENCE
Definition SharedDefines.h:1565
@ UNIT_FLAG_SILENCED
Definition UnitDefines.h:267
#define CURRENT_MAX_SPELL
Definition Unit.h:551
CurrentSpellTypes
Definition Unit.h:543
@ CURRENT_MELEE_SPELL
Definition Unit.h:544
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4104
bool HasSilenceAura() const
Definition Unit.h:1802

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
3236{
3238 return;
3239 Unit* target = aurApp->GetTarget();
3240
3241 if (!target->IsPlayer())
3242 return;
3243
3244 uint32 prot = GetMiscValue();
3245 int32 points = GetAmount();
3246
3247 target->ToPlayer()->ModifySkillBonus(prot, ((apply) ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
3248 if (prot == SKILL_DEFENSE)
3249 target->ToPlayer()->UpdateDefenseBonusesMod();
3250}
@ SKILL_DEFENSE
Definition SharedDefines.h:3131
@ 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:5379
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
3178{
3180 return;
3181
3182 Unit* target = aurApp->GetTarget();
3183
3184 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
3185 if (apply)
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->HasAuraType(GetAuraType()))
3192 }
3193
3194 // call functions which may have additional effects after chainging state of unit
3195 target->UpdateObjectVisibility(target->IsPlayer());
3196}
@ UNIT_DYNFLAG_TRACK_UNIT
Definition SharedDefines.h:3372
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:125
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:124
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition Unit.cpp:19372

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
4455{
4457 return;
4458
4459 if (GetMiscValue() < -2 || GetMiscValue() > 4)
4460 {
4461 LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
4462 return;
4463 }
4464
4465 Unit* target = aurApp->GetTarget();
4467 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4468 return;
4469
4470 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4471 {
4472 // -1 or -2 is all stats (misc < -2 checked in function beginning)
4473 if (GetMiscValue() < 0 || GetMiscValue() == i)
4474 {
4475 if (spellGroupVal)
4477
4479 if (target->IsPlayer() || target->IsPet())
4480 target->UpdateStatBuffMod(Stats(i));
4481 }
4482 }
4483}
#define MAX_STATS
Definition SharedDefines.h:276
Stats
Definition SharedDefines.h:268
@ STAT_STRENGTH
Definition SharedDefines.h:269
@ 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:4410
void UpdateStatBuffMod(Stats stat)
Definition Unit.cpp:6295

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
3529{
3530 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3531 return;
3532
3533 Unit* target = aurApp->GetTarget();
3534
3535 target->SetControlled(apply, UNIT_STATE_STUNNED);
3536}
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:173

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

◆ HandleAuraModTotalThreat()

void AuraEffect::HandleAuraModTotalThreat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3467{
3469 return;
3470
3471 Unit* target = aurApp->GetTarget();
3472
3473 if (!target->IsAlive() || !target->IsPlayer())
3474 return;
3475
3476 Unit* caster = GetCaster();
3477 if (caster && caster->IsAlive())
3478 target->getHostileRefMgr().addTempThreat((float)GetAmount(), apply);
3479}
void addTempThreat(float threat, bool apply)
Definition HostileRefMgr.cpp:65
HostileRefMgr & getHostileRefMgr()
Definition Unit.h:945

References HostileRefMgr::addTempThreat(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetAmount(), GetCaster(), Unit::getHostileRefMgr(), AuraApplication::GetTarget(), Unit::IsAlive(), and Object::IsPlayer().

◆ HandleAuraModUseNormalSpeed()

void AuraEffect::HandleAuraModUseNormalSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3807{
3808 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3809 return;
3810
3811 Unit* target = aurApp->GetTarget();
3812
3813 target->UpdateSpeed(MOVE_RUN, true);
3814 target->UpdateSpeed(MOVE_SWIM, true);
3815 target->UpdateSpeed(MOVE_FLIGHT, true);
3816
3817 if (Player* targetPlayer = target->ToPlayer())
3818 {
3819 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3820 }
3821}

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
4895{
4897 return;
4898
4899 Player* target = aurApp->GetTarget()->ToPlayer();
4900
4901 if (!target)
4902 return;
4903
4905}

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
3257{
3259 return;
3260
3261 Unit* target = aurApp->GetTarget();
3262 Unit* caster = GetCaster();
3263
3264 if (apply)
3265 {
3266 uint32 creatureEntry = GetMiscValue();
3267 uint32 displayId = 0;
3268 uint32 vehicleId = 0;
3269
3270 // Festive Holiday Mount
3271 if (target->HasAura(62061))
3272 {
3274 creatureEntry = 24906;
3275 else
3276 creatureEntry = 15665;
3277 }
3278
3279 // Festive Brewfest Mount
3281 {
3282 if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
3283 {
3284 creatureEntry = GREAT_BREWFEST_KODO;
3285 }
3286 else
3287 {
3288 creatureEntry = BREWFEST_KODO;
3289 }
3290 }
3291
3292 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
3293 {
3294 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
3295 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
3296 displayId = model.CreatureDisplayID;
3297
3298 vehicleId = creatureInfo->VehicleId;
3299
3300 //some spell has one aura of mount and one of vehicle
3301 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3302 {
3303 if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue())
3304 {
3305 displayId = 0;
3306 }
3307 }
3308
3309 }
3310 target->Mount(displayId, vehicleId, GetMiscValue());
3311 }
3312 else
3313 {
3314 target->Dismount();
3315 //some mounts like Headless Horseman's Mount or broom stick are skill based spell
3316 // need to remove ALL arura related to mounts, this will stop client crash with broom stick
3317 // and never endless flying after using Headless Horseman's Mount
3318 if (mode & AURA_EFFECT_HANDLE_REAL)
3320 }
3321}
@ SPELL_EFFECT_SUMMON
Definition SharedDefines.h:817
void Dismount()
Definition Unit.cpp:13674
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5840
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition Unit.cpp:13614

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
6095{
6096 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6097 return;
6098
6099 Unit* target = aurApp->GetTarget();
6100
6101 if (!target->IsPlayer() || !target->IsInWorld())
6102 return;
6103
6104 if (apply)
6105 target->ToPlayer()->GetSession()->SendStablePet(target->GetGUID());
6106
6107 // client auto close stable dialog at !apply aura
6108}
bool IsInWorld() const
Definition Object.h:108
WorldSession * GetSession() const
Definition Player.h:1998
void SendStablePet(ObjectGuid guid)
Definition NPCHandler.cpp:480

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
6124{
6125 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6126 return;
6127
6128 Player* target = aurApp->GetTarget()->ToPlayer();
6129
6130 if (!target || !target->IsInWorld())
6131 return;
6132
6133 uint32 overrideId = uint32(GetMiscValue());
6134
6135 if (apply)
6136 {
6138 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
6139 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
6140 if (uint32 spellId = overrideSpells->spellId[i])
6141 target->_addSpell(spellId, SPEC_MASK_ALL, true);
6142 }
6143 else
6144 {
6146 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
6147 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
6148 if (uint32 spellId = overrideSpells->spellId[i])
6149 target->removeSpell(spellId, SPEC_MASK_ALL, true);
6150 }
6151}
DBCStorage< OverrideSpellDataEntry > sOverrideSpellDataStore(OverrideSpellDatafmt)
#define MAX_OVERRIDE_SPELL
Definition DBCStructure.h:1409
#define PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET
Definition Player.h:545
@ PLAYER_FIELD_BYTES2
Definition UpdateFields.h:378
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition Object.cpp:759
Definition DBCStructure.h:1412

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
5393{
5394 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5395 return;
5396
5397 Unit* target = aurApp->GetTarget();
5398
5399 if (!target->IsPlayer())
5400 return;
5401
5402 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
5403 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
5404 if (!(apply) && GetBase()->GetDuration() == 0)
5405 target->AddComboPoints(-GetAmount());
5406}
void AddComboPoints(Unit *target, int8 count)
Definition Unit.cpp:17065

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
6154{
6155 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6156 return;
6157
6158 Unit* target = aurApp->GetTarget();
6159
6160 if (!target->IsPlayer() || !target->IsInWorld())
6161 return;
6162
6163 uint32 vehicleId = GetMiscValue();
6164
6165 if (apply)
6166 {
6167 if (!target->CreateVehicleKit(vehicleId, 0))
6168 return;
6169 }
6170 else if (target->GetVehicleKit())
6171 target->RemoveVehicleKit();
6172
6174 data << target->GetPackGUID();
6175 data << uint32(apply ? vehicleId : 0);
6176 target->SendMessageToSet(&data, true);
6177
6178 if (apply)
6179 {
6181 target->ToPlayer()->SendDirectMessage(&data);
6182 }
6183}
PackedGuid const & GetPackGUID() const
Definition Object.h:115
std::size_t size() const
Definition ObjectGuid.h:274
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5762
void RemoveVehicleKit()
Definition Unit.cpp:18969
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition Unit.cpp:18957
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:2083
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
3127{
3129 return;
3130
3131 Unit* target = aurApp->GetTarget();
3132
3133 if (!target->IsPlayer())
3134 return;
3135
3136 if (apply)
3137 target->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
3138 else
3139 target->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
3140}
@ 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
3143{
3145 return;
3146
3147 Unit* target = aurApp->GetTarget();
3148
3149 if (!target->IsPlayer())
3150 return;
3151
3152 if (apply)
3153 target->SetFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
3154 else
3155 target->RemoveFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
3156}
@ 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
3159{
3161 return;
3162
3163 Unit* target = aurApp->GetTarget();
3164
3165 if (!target->IsPlayer())
3166 return;
3167
3168 if (!(apply))
3169 {
3170 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3171 if (target->HasAuraType(GetAuraType()))
3172 return;
3173 }
3175}
@ PLAYER_FIELD_BYTE_TRACK_STEALTHED
Definition Player.h:553
@ PLAYER_FIELD_BYTES
Definition UpdateFields.h:368
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition Object.cpp:881

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
2177{
2179 return;
2180
2181 Unit* target = aurApp->GetTarget();
2182
2183 if (apply)
2184 {
2185 // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case
2186 if (GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !target->GetModelForForm(target->GetShapeshiftForm(), GetId()) || !GetSpellInfo()->IsPositive())
2187 {
2188 // special case (spell specific functionality)
2189 if (GetMiscValue() == 0)
2190 {
2191 switch (GetId())
2192 {
2193 // Orb of Deception
2194 case 16739:
2195 {
2196 if (!target->IsPlayer())
2197 return;
2198
2199 switch (target->getRace())
2200 {
2201 // Blood Elf
2202 case RACE_BLOODELF:
2203 target->SetDisplayId(target->getGender() == GENDER_MALE ? 17829 : 17830);
2204 break;
2205 // Orc
2206 case RACE_ORC:
2207 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10139 : 10140);
2208 break;
2209 // Troll
2210 case RACE_TROLL:
2211 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10135 : 10134);
2212 break;
2213 // Tauren
2214 case RACE_TAUREN:
2215 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10136 : 10147);
2216 break;
2217 // Undead
2218 case RACE_UNDEAD_PLAYER:
2219 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10146 : 10145);
2220 break;
2221 // Draenei
2222 case RACE_DRAENEI:
2223 target->SetDisplayId(target->getGender() == GENDER_MALE ? 17827 : 17828);
2224 break;
2225 // Dwarf
2226 case RACE_DWARF:
2227 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10141 : 10142);
2228 break;
2229 // Gnome
2230 case RACE_GNOME:
2231 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10148 : 10149);
2232 break;
2233 // Human
2234 case RACE_HUMAN:
2235 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10137 : 10138);
2236 break;
2237 // Night Elf
2238 case RACE_NIGHTELF:
2239 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10143 : 10144);
2240 break;
2241 default:
2242 break;
2243 }
2244 break;
2245 }
2246 // Murloc costume
2247 case 42365:
2248 target->SetDisplayId(21723);
2249 break;
2250 // Dread Corsair
2251 case 50517:
2252 // Corsair Costume
2253 case 51926:
2254 {
2255 if (!target->IsPlayer())
2256 return;
2257
2258 switch (target->getRace())
2259 {
2260 // Blood Elf
2261 case RACE_BLOODELF:
2262 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25032 : 25043);
2263 break;
2264 // Orc
2265 case RACE_ORC:
2266 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25039 : 25050);
2267 break;
2268 // Troll
2269 case RACE_TROLL:
2270 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25041 : 25052);
2271 break;
2272 // Tauren
2273 case RACE_TAUREN:
2274 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25040 : 25051);
2275 break;
2276 // Undead
2277 case RACE_UNDEAD_PLAYER:
2278 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25042 : 25053);
2279 break;
2280 // Draenei
2281 case RACE_DRAENEI:
2282 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25033 : 25044);
2283 break;
2284 // Dwarf
2285 case RACE_DWARF:
2286 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25034 : 25045);
2287 break;
2288 // Gnome
2289 case RACE_GNOME:
2290 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25035 : 25046);
2291 break;
2292 // Human
2293 case RACE_HUMAN:
2294 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25037 : 25048);
2295 break;
2296 // Night Elf
2297 case RACE_NIGHTELF:
2298 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25038 : 25049);
2299 break;
2300 default:
2301 break;
2302 }
2303 break;
2304 }
2305 // Pygmy Oil
2306 case 53806:
2307 target->SetDisplayId(22512);
2308 break;
2309 // Honor the Dead
2310 case 65386:
2311 case 65495:
2312 target->SetDisplayId(target->getGender() == GENDER_MALE ? 29203 : 29204);
2313 break;
2314 // Gossip NPC Appearance - Brewfest
2315 case 65511:
2316 {
2317 switch (target->GetDisplayRace())
2318 {
2320 if (urand(0, 1))
2321 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21839 : 21838);
2322 else
2323 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21841 : 21840);
2324 break;
2325 case DisplayRace::Orc:
2326 if (urand(0, 1))
2327 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21867 : 21866);
2328 else
2329 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21869 : 21868);
2330 break;
2331 case DisplayRace::Troll:
2332 if (urand(0, 1))
2333 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21875 : 21874);
2334 else
2335 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21877 : 21876);
2336 break;
2338 if (urand(0, 1))
2339 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21869 : 21871);
2340 else
2341 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21872 : 21873);
2342 break;
2344 if (urand(0, 1))
2345 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21879 : 21878);
2346 else
2347 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21881 : 21880);
2348 break;
2350 if (urand(0, 1))
2351 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21844 : 21842);
2352 else
2353 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21845 : 21843);
2354 break;
2355 case DisplayRace::Dwarf:
2356 if (urand(0, 1))
2357 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21846 : 21848);
2358 else
2359 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21847 : 21849);
2360 break;
2361 case DisplayRace::Gnome:
2362 if (urand(0, 1))
2363 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21851 : 21850);
2364 else
2365 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21853 : 21852);
2366 break;
2367 case DisplayRace::Human:
2368 if (urand(0, 1))
2369 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21859 : 21858);
2370 else
2371 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21861 : 21860);
2372 break;
2374 if (urand(0, 1))
2375 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21863 : 21862);
2376 else
2377 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21865 : 21864);
2378 break;
2380 if (urand(0, 1))
2381 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21854 : 21856);
2382 else
2383 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21855 : 21857);
2384 break;
2385 default:
2386 break;
2387 }
2388
2389 // equip random brewfest mug
2390 uint32 itemIds[5] = {
2391 2703, // Monster - Item, Tankard Wooden
2392 2704, // Monster - Item, Tankard Dirty
2393 2705, // Monster - Item, Tankard Metal
2394 13861, // Monster - Item, Tankard Gold
2395 33963 // NPC Equip 33963
2396 };
2397 if (target->ToCreature())
2398 target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, itemIds[urand(0, 4)]);
2399
2400 break;
2401 }
2402 // Gossip NPC Appearance - Winter Veil
2403 case 65522:
2404 {
2405 switch (target->GetDisplayRace())
2406 {
2408 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18793 : 18785);
2409 break;
2410 case DisplayRace::Orc:
2411 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18805 : 18804);
2412 break;
2413 case DisplayRace::Troll:
2414 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18809 : 18808);
2415 break;
2417 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18807 : 18806);
2418 break;
2420 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18811 : 18810);
2421 break;
2423 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18795 : 18794);
2424 break;
2425 case DisplayRace::Dwarf:
2426 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18797 : 18796);
2427 break;
2428 case DisplayRace::Gnome:
2429 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18799 : 18798);
2430 break;
2431 case DisplayRace::Human:
2432 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18801 : 18800);
2433 break;
2435 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18803 : 18802);
2436 break;
2438 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19342 : 19339);
2439 default:
2440 break;
2441 }
2442 break;
2443 }
2444 // Gossip NPC Appearance - Default
2445 case 65523:
2446 {
2447 switch (target->GetDisplayRace())
2448 {
2450 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19170 : 19169);
2451 break;
2452 case DisplayRace::Orc:
2453 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19182 : 19181);
2454 break;
2455 case DisplayRace::Troll:
2456 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19186 : 19185);
2457 break;
2459 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19184 : 19183);
2460 break;
2462 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19188 : 19187);
2463 break;
2465 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19172 : 19171);
2466 break;
2467 case DisplayRace::Dwarf:
2468 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19174 : 19173);
2469 break;
2470 case DisplayRace::Gnome:
2471 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19176 : 19175);
2472 break;
2473 case DisplayRace::Human:
2474 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19178 : 19177);
2475 break;
2477 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19180 : 19179);
2478 break;
2480 target->SetDisplayId(target->getGender() == GENDER_MALE ? 19343 : 19340);
2481 default:
2482 break;
2483 }
2484 break;
2485 }
2486 // Gossip NPC Appearance - Lunar Festival
2487 case 65524:
2488 {
2489 switch (target->GetDisplayRace())
2490 {
2492 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18841 : 18840);
2493 break;
2494 case DisplayRace::Orc:
2495 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18870 : 18869);
2496 break;
2497 case DisplayRace::Troll:
2498 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18874 : 18873);
2499 break;
2501 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18872 : 18871);
2502 break;
2504 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18876 : 18875);
2505 break;
2507 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18843 : 18842);
2508 break;
2509 case DisplayRace::Dwarf:
2510 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18845 : 18844);
2511 break;
2512 case DisplayRace::Gnome:
2513 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18847 : 18846);
2514 break;
2515 case DisplayRace::Human:
2516 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18860 : 18858);
2517 break;
2519 target->SetDisplayId(target->getGender() == GENDER_MALE ? 18868 : 18867);
2520 break;
2522 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21067 : 19341);
2523 default:
2524 break;
2525 }
2526 break;
2527 }
2528 // Gossip NPC Appearance - Hallow's End
2529 case 65525:
2530 {
2531 switch (target->GetDisplayRace())
2532 {
2534 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22361 : 22360);
2535 break;
2536 case DisplayRace::Orc:
2537 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22375 : 22374);
2538 break;
2539 case DisplayRace::Troll:
2540 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22379 : 22378);
2541 break;
2543 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22377 : 22376);
2544 break;
2546 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22381 : 22380);
2547 break;
2549 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22363 : 22362);
2550 break;
2551 case DisplayRace::Dwarf:
2552 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22365 : 22364);
2553 break;
2554 case DisplayRace::Gnome:
2555 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22367 : 22366);
2556 break;
2557 case DisplayRace::Human:
2558 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22371 : 22370);
2559 break;
2561 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22373 : 22372);
2562 break;
2564 target->SetDisplayId(target->getGender() == GENDER_MALE ? 22369 : 22368);
2565 default:
2566 break;
2567 }
2568 break;
2569 }
2570 // Gossip NPC Appearance - Midsummer
2571 case 65526:
2572 {
2573 switch (target->GetDisplayRace())
2574 {
2576 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21086 : 21085);
2577 break;
2578 case DisplayRace::Orc:
2579 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16438 : 16436);
2580 break;
2581 case DisplayRace::Troll:
2582 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16446 : 16445);
2583 break;
2585 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16432 : 16442);
2586 break;
2588 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16444 : 16443);
2589 break;
2591 target->SetDisplayId(target->getGender() == GENDER_MALE ? 21083 : 21084);
2592 break;
2593 case DisplayRace::Dwarf:
2594 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16413 : 16434);
2595 break;
2596 case DisplayRace::Gnome:
2597 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16448 : 16447);
2598 break;
2599 case DisplayRace::Human:
2600 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16433 : 16412);
2601 break;
2603 target->SetDisplayId(target->getGender() == GENDER_MALE ? 16435 : 16414);
2604 break;
2606 target->SetDisplayId(target->getGender() == GENDER_MALE ? 29243 : 16431);
2607 default:
2608 break;
2609 }
2610 break;
2611 }
2612 // Gossip NPC Appearance - Spirit of Competition
2613 case 65527:
2614 {
2615 switch (target->GetDisplayRace())
2616 {
2618 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24508 : 24519);
2619 break;
2620 case DisplayRace::Orc:
2621 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24515 : 24526);
2622 break;
2623 case DisplayRace::Troll:
2624 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24517 : 24528);
2625 break;
2627 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24516 : 24527);
2628 break;
2630 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24518 : 24529);
2631 break;
2633 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24509 : 24520);
2634 break;
2635 case DisplayRace::Dwarf:
2636 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24510 : 24521);
2637 break;
2638 case DisplayRace::Gnome:
2639 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24511 : 24522);
2640 break;
2641 case DisplayRace::Human:
2642 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24513 : 24524);
2643 break;
2645 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24514 : 24525);
2646 break;
2648 target->SetDisplayId(target->getGender() == GENDER_MALE ? 24512 : 24523);
2649 default:
2650 break;
2651 }
2652 break;
2653 }
2654 // Gossip NPC Appearance - Pirates' Day
2655 case 65528:
2656 {
2657 switch (target->GetDisplayRace())
2658 {
2660 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25032 : 25043);
2661 break;
2662 case DisplayRace::Orc:
2663 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25039 : 25050);
2664 break;
2665 case DisplayRace::Troll:
2666 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25041 : 25052);
2667 break;
2669 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25040 : 25051);
2670 break;
2672 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25042 : 25053);
2673 break;
2675 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25033 : 25044);
2676 break;
2677 case DisplayRace::Dwarf:
2678 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25034 : 25045);
2679 break;
2680 case DisplayRace::Gnome:
2681 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25035 : 25046);
2682 break;
2683 case DisplayRace::Human:
2684 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25037 : 25048);
2685 break;
2687 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25038 : 25049);
2688 break;
2690 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25036 : 25047);
2691 default:
2692 break;
2693 }
2694 break;
2695 }
2696 // Gossip NPC Appearance - Day of the Dead(DotD)
2697 case 65529:
2698 target->SetDisplayId(target->getGender() == GENDER_MALE ? 29203 : 29204);
2699 break;
2700 // Darkspear Pride
2701 case 75532:
2702 target->SetDisplayId(target->getGender() == GENDER_MALE ? 31737 : 31738);
2703 break;
2704 // Gnomeregan Pride
2705 case 75531:
2706 target->SetDisplayId(target->getGender() == GENDER_MALE ? 31654 : 31655);
2707 break;
2708 default:
2709 break;
2710 }
2711 }
2712 else
2713 {
2714 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(GetMiscValue());
2715 if (!ci)
2716 {
2717 target->SetDisplayId(16358); // pig pink ^_^
2718 LOG_ERROR("spells.aura.effect", "Auras: unknown creature id = {} (only need its modelid) From Spell Aura Transform in Spell ID = {}", GetMiscValue(), GetId());
2719 }
2720 else
2721 {
2722 uint32 model_id = 0;
2723
2724 if (uint32 modelid = ObjectMgr::ChooseDisplayId(ci)->CreatureDisplayID)
2725 model_id = modelid; // Will use the default model here
2726
2727 // Polymorph (sheep)
2728 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978)
2729 if (Unit* caster = GetCaster())
2730 if (caster->HasAura(52648)) // Glyph of the Penguin
2731 model_id = 26452;
2732
2733 target->SetDisplayId(model_id);
2734
2735 // Dragonmaw Illusion (set mount model also)
2736 if (GetId() == 42016 && target->GetMountID() && !target->GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
2738 }
2739 }
2740 }
2741
2742 // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case
2743 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
2744 if (!transformSpellInfo || GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
2745 target->setTransForm(GetId());
2746
2747 // polymorph case
2748 if ((mode & AURA_EFFECT_HANDLE_REAL) && target->IsPlayer() && target->IsPolymorphed())
2749 {
2750 // for players, start regeneration after 1s (in polymorph fast regeneration case)
2751 // only if caster is Player (after patch 2.4.2)
2752 if (GetCasterGUID().IsPlayer())
2754
2755 //dismount polymorphed target (after patch 2.4.2)
2756 if (target->IsMounted())
2758 }
2759 }
2760 else
2761 {
2762 // HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true) will reapply it if need
2763 if (target->getTransForm() == GetId())
2764 target->setTransForm(0);
2765
2766 target->RestoreDisplayId();
2767
2768 // Dragonmaw Illusion (restore mount model)
2769 if (GetId() == 42016 && target->GetMountID() == 16314)
2770 {
2771 if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
2772 {
2773 uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
2774 if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
2775 {
2777 sObjectMgr->GetCreatureModelRandomGender(&model, ci);
2778
2780 }
2781 }
2782 }
2783 }
2784}
@ 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:1600
uint8 getRace(bool original=false) const
Definition Unit.cpp:21093
DisplayRace GetDisplayRace() const
Definition Unit.h:828
void setTransForm(uint32 spellid)
Definition Unit.h:1944
bool IsMounted() const
Definition Unit.h:1864

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
3199{
3201 return;
3202
3203 Unit* target = aurApp->GetTarget();
3204
3205 if (apply)
3207 else
3208 {
3209 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3210 if (target->HasAuraType(GetAuraType()))
3211 return;
3213 }
3214}
@ UNIT_STAND_FLAGS_UNTRACKABLE
Definition UnitDefines.h:49
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition UnitDefines.h:25
@ UNIT_FIELD_BYTES_1
Definition UpdateFields.h:131
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:912
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:893

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
3344{
3346 return;
3347
3348 Unit* target = aurApp->GetTarget();
3349
3350 if (Player* targetPlayer = target->ToPlayer())
3351 {
3352 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3353 }
3354
3355 if (!apply)
3356 {
3357 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3358 if (target->HasAuraType(GetAuraType()))
3359 return;
3360 }
3361
3362 target->SetWaterWalking(apply);
3363}
void SetWaterWalking(bool enable)
Definition Unit.cpp:20732

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
5902{
5903 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5904 return;
5905
5906 Unit* target = aurApp->GetTarget();
5907
5908 Unit* caster = GetCaster();
5909
5910 if (!caster || !caster->IsPlayer())
5911 return;
5912
5913 caster->ToPlayer()->SetViewpoint(target, apply);
5914}
void SetViewpoint(WorldObject *target, bool apply)
Definition Player.cpp:13207

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

◆ HandleChannelDeathItem()

void AuraEffect::HandleChannelDeathItem ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5857{
5858 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5859 return;
5860
5861 if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
5862 return;
5863
5864 Unit* caster = GetCaster();
5865
5866 if (!caster || !caster->IsPlayer())
5867 return;
5868
5869 Player* plCaster = caster->ToPlayer();
5870
5871 // Item amount
5872 if (GetAmount() <= 0)
5873 return;
5874
5875 if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
5876 return;
5877
5878 //Adding items
5879 uint32 noSpaceForCount = 0;
5880 uint32 count = m_amount;
5881
5882 ItemPosCountVec dest;
5883 InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount);
5884 if (msg != EQUIP_ERR_OK)
5885 {
5886 count -= noSpaceForCount;
5887 plCaster->SendEquipError(msg, nullptr, nullptr, GetSpellInfo()->Effects[m_effIndex].ItemType);
5888 if (count == 0)
5889 return;
5890 }
5891
5892 Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true);
5893 if (!newitem)
5894 {
5895 plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
5896 return;
5897 }
5898 plCaster->SendNewItem(newitem, count, true, true);
5899}
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:766
@ 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:4736
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0)
Definition PlayerStorage.cpp:2531
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition PlayerStorage.cpp:4012
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.h:1280

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
3657{
3658 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3659 return;
3660
3661 Unit* target = aurApp->GetTarget();
3662
3663 Unit* caster = GetCaster();
3664
3665 if (apply)
3666 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
3667 else
3668 target->RemoveCharmedBy(caster);
3669}
@ CHARM_TYPE_CONVERT
Definition CharmInfo.h:48
void RemoveCharmedBy(Unit *charmer)
Definition Unit.cpp:18794
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:18592

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
6005{
6007 return;
6008
6009 Unit* target = aurApp->GetTarget();
6010
6011 if (apply)
6013 else
6014 {
6015 if (target->HasAuraType(GetAuraType()))
6016 return;
6017
6019 }
6020}
@ UNIT_FLAG2_COMPREHEND_LANG
Definition UnitDefines.h:296

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
1723{
1725 {
1726 return;
1727 }
1728
1729 Unit* target = aurApp->GetTarget();
1730 if (!target->IsPlayer())
1731 {
1732 return;
1733 }
1734
1735 if (apply)
1736 {
1737 target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1738 }
1739 else
1740 {
1741 if (target->HasDetectAmoreAura())
1742 {
1744 for (AuraEffect const* aurEff : amoreAuras)
1745 if (GetMiscValue() == aurEff->GetMiscValue())
1746 {
1747 return;
1748 }
1749 }
1750
1751 target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1752 }
1753}
@ SPELL_AURA_DETECT_AMORE
Definition SpellAuraDefines.h:233
bool HasDetectAmoreAura() const
Definition Unit.h:1795

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

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 
)
808{
810 ASSERT(aurApp);
811 HandleEffect(aurApp, mode, apply);
812}
const AuraApplication * 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
5917{
5918 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5919 {
5920 return;
5921 }
5922
5923 Unit* caster = GetCaster();
5924 if (!caster || !caster->IsPlayer())
5925 {
5926 return;
5927 }
5928
5929 Player* player = caster->ToPlayer();
5930 if (apply)
5931 {
5933 }
5934 else
5935 {
5936 player->ResetFarSightDistance();
5937 }
5938
5939 caster->UpdateObjectVisibility(!apply);
5940}
void SetFarSightDistance(float radius)
Definition Player.cpp:16276
void ResetFarSightDistance()
Definition Player.cpp:16281
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2217

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
2823{
2824 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2825 return;
2826
2827 Unit* target = aurApp->GetTarget();
2828
2829 if (!target->IsPlayer())
2830 return;
2831
2832 if (Player* targetPlayer = target->ToPlayer())
2833 {
2834 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2835 }
2836
2837 if (apply)
2838 {
2839 /*
2840 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2841 data<<target->GetGUID();
2842 data<<uint8(0);
2843 target->SendMessageToSet(&data, true);
2844 */
2845
2846 UnitList targets;
2847 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
2849 Cell::VisitObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2850 for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2851 {
2852 if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2853 continue;
2854
2856 {
2857 if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2858 {
2859 SpellInfo const* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo();
2860 if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->IsCreature())
2861 {
2862 Creature* c = (*iter)->ToCreature();
2863 if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
2864 continue;
2865 }
2866 bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY)
2867 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
2868 if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST))
2869 {
2870 // at least one effect truly targets an unit, interrupt the spell
2871 interrupt = true;
2872 break;
2873 }
2874 if (interrupt)
2875 (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
2876 }
2877 }
2878 }
2879
2880 if (target->GetInstanceScript() && target->GetInstanceScript()->IsEncounterInProgress())
2881 {
2882 // Xinef: replaced with CombatStop(false)
2883 target->AttackStop();
2884 target->RemoveAllAttackers();
2885 target->getHostileRefMgr().addThreatPercent(-100);
2886 target->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
2887 }
2888 else
2889 {
2890 target->CombatStop();
2892 }
2893
2895
2896 // prevent interrupt message
2897 if (GetCasterGUID() == target->GetGUID())
2898 {
2900 target->FinishSpell(CURRENT_GENERIC_SPELL, true);
2901
2902 // interrupt autoshot
2904 {
2906 target->ToPlayer()->SendAutoRepeatCancel(target);
2907 }
2908 }
2909
2910 target->InterruptNonMeleeSpells(true);
2911
2912 // stop handling the effect if it was removed by linked event
2913 if (aurApp->GetRemoveMode())
2914 return;
2915 // blizz like 2.0.x
2917 // blizz like 2.0.x
2919 // blizz like 2.0.x
2921
2923 }
2924 else
2925 {
2926 /*
2927 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2928 data<<target->GetGUID();
2929 data<<uint8(1);
2930 target->SendMessageToSet(&data, true);
2931 */
2932 // blizz like 2.0.x
2934 // blizz like 2.0.x
2936 // blizz like 2.0.x
2938
2940 }
2941}
@ UNIT_DYNFLAG_DEAD
Definition SharedDefines.h:3376
@ CREATURE_ELITE_WORLDBOSS
Definition SharedDefines.h:2984
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition SharedDefines.h:628
@ TARGET_OBJECT_TYPE_UNIT
Definition SpellInfo.h:101
@ TARGET_OBJECT_TYPE_UNIT_AND_DEST
Definition SpellInfo.h:102
@ UNIT_FLAG2_FEIGN_DEATH
Definition UnitDefines.h:293
@ UNIT_STATE_DIED
Definition UnitDefines.h:170
@ UNIT_STATE_CASTING
Definition UnitDefines.h:185
@ UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
Definition UnitDefines.h:283
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition Unit.h:550
@ CURRENT_GENERIC_SPELL
Definition Unit.h:545
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:547
std::list< Unit * > UnitList
Definition Unit.h:78
Definition GridNotifiers.h:852
Definition Creature.h:47
bool IsDungeonBoss() const
Definition Creature.cpp:3176
bool isWorldBoss() const
Definition Creature.h:125
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:208
void deleteReferences(bool removeFromMap=false)
Definition HostileRefMgr.cpp:125
void addThreatPercent(int32 percent)
Definition HostileRefMgr.cpp:85
virtual bool IsEncounterInProgress() const
Definition InstanceScript.cpp:137
float GetVisibilityRange() const
Definition Map.h:195
void SendAttackSwingCancelAttack()
Definition PlayerMisc.cpp:140
void SendAutoRepeatCancel(Unit *target)
Definition PlayerMisc.cpp:152
void CombatStop(bool includingCast=false)
Definition Unit.cpp:10640
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4176
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition Unit.cpp:4134
void RemoveAllAttackers()
Remove all units in m_attackers list and send them AttackStop()
Definition Unit.cpp:10688
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:10607
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1214
float GetVisibilityRange() const
Definition Object.cpp:1671
Definition GridNotifiers.h:414
uint32 rank
Definition CreatureData.h:206

References HostileRefMgr::addThreatPercent(), 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, HostileRefMgr::deleteReferences(), SpellInfo::Effects, Unit::FinishSpell(), GetCasterGUID(), Creature::GetCreatureTemplate(), Unit::GetCurrentSpell(), Object::GetGUID(), Unit::getHostileRefMgr(), WorldObject::GetInstanceScript(), WorldObject::GetMap(), AuraApplication::GetRemoveMode(), AuraApplication::GetTarget(), 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::RemoveAllAttackers(), Unit::RemoveAurasWithInterruptFlags(), Object::RemoveDynamicFlag(), Unit::RemoveUnitFlag(), Unit::RemoveUnitFlag2(), Player::SendAttackSwingCancelAttack(), 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
3426{
3428 return;
3429
3430 Unit* target = aurApp->GetTarget();
3431
3432 if (apply)
3434 else
3435 {
3436 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3437 if (target->HasAuraType(GetAuraType()))
3438 return;
3440 }
3441}
@ UNIT_FLAG2_FORCE_MOVEMENT
Definition UnitDefines.h:299

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
5943{
5945 return;
5946
5947 Unit* target = aurApp->GetTarget();
5948
5949 if (!target->IsPlayer())
5950 return;
5951
5952 Player* player = target->ToPlayer();
5953
5954 uint32 faction_id = GetMiscValue();
5955 ReputationRank faction_rank = ReputationRank(m_amount);
5956
5957 player->GetReputationMgr().ApplyForceReaction(faction_id, faction_rank, apply);
5959
5960 // stop fighting if at apply forced rank friendly or at remove real rank friendly
5961 if ((apply && faction_rank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(faction_id) >= REP_FRIENDLY))
5962 player->StopAttackFaction(faction_id);
5963}
ReputationRank
Definition SharedDefines.h:179
@ REP_FRIENDLY
Definition SharedDefines.h:184
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:5932
ReputationMgr & GetReputationMgr()
Definition Player.h:2123
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:20139

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
4991{
4993 return;
4994
4995 Unit* target = aurApp->GetTarget();
4996
4997 // Xinef: Do not apply such auras in normal way
4998 if (GetAmount() >= 1000)
4999 {
5000 target->SetInstantCast(apply);
5001 return;
5002 }
5003
5004 int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, GetAuraType());
5005 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
5006 return;
5007
5008 if (spellGroupVal)
5009 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
5010
5011 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
5012}
void SetInstantCast(bool set)
Definition Unit.h:1569
void ApplyCastTimePercentMod(float val, bool apply)
Definition Unit.cpp:17305

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
3642{
3643 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3644 return;
3645
3646 Unit* target = aurApp->GetTarget();
3647
3648 Unit* caster = GetCaster();
3649
3650 if (apply)
3651 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3652 else
3653 target->RemoveCharmedBy(caster);
3654}
@ 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
5027{
5029 return;
5030
5031 Unit* target = aurApp->GetTarget();
5033 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
5034 return;
5035
5036 if (spellGroupVal)
5037 {
5038 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
5039 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
5040 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
5041 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
5042 }
5043
5044 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
5045 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
5046 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
5047 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
5048}
@ 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
3509{
3510 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3511 return;
3512
3513 Unit* target = aurApp->GetTarget();
3514
3515 target->SetControlled(apply, UNIT_STATE_CONFUSED);
3516}
@ UNIT_STATE_CONFUSED
Definition UnitDefines.h:181

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

◆ HandleModDamageDone()

void AuraEffect::HandleModDamageDone ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5234{
5236 return;
5237
5238 Unit* target = aurApp->GetTarget();
5239
5241 target->UpdateAllDamageDoneMods();
5242
5243 // Magic damage modifiers implemented in Unit::SpellBaseDamageBonus
5244 // This information for client side use only
5245 if (target->IsPlayer())
5246 {
5247
5249 for (uint16 i = 0; i < MAX_SPELL_SCHOOL; ++i)
5250 if (GetMiscValue() & (1 << i))
5251 target->ApplyModUInt32Value(baseField + i, GetAmount(), apply);
5252
5253 if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
5254 pet->UpdateAttackPowerAndDamage();
5255 }
5256}
@ PLAYER_FIELD_MOD_DAMAGE_DONE_POS
Definition UpdateFields.h:360
@ PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
Definition UpdateFields.h:361
Definition TemporarySummon.h:96
void UpdateAllDamageDoneMods()
Definition Unit.cpp:15491

References Object::ApplyModUInt32Value(), 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
5259{
5261 return;
5262
5263 Unit* target = aurApp->GetTarget();
5264 if (!target)
5265 return;
5266
5269
5270 if (target->IsPlayer())
5271 {
5272 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
5273 {
5274 if (GetMiscValue() & (1 << i))
5275 {
5276 // only aura type modifying PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
5279 }
5280 }
5281 }
5282}
@ PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
Definition UpdateFields.h:362
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:726
void UpdateAllDamagePctDoneMods()
Definition Unit.cpp:15535

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().

◆ HandleModFear()

void AuraEffect::HandleModFear ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3519{
3520 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3521 return;
3522
3523 Unit* target = aurApp->GetTarget();
3524
3525 target->SetControlled(apply, UNIT_STATE_FLEEING, GetCaster(), true);
3526}
@ UNIT_STATE_FLEEING
Definition UnitDefines.h:177

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
4578{
4580 return;
4581
4582 Unit* target = aurApp->GetTarget();
4583
4584 if (!target->IsPlayer())
4585 return;
4586 // implemented in Unit::SpellHealingBonus
4587 // this information is for client side only
4589}
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
4908{
4910 return;
4911
4912 Unit* target = aurApp->GetTarget();
4913
4914 if (target->IsPlayer())
4915 {
4916 target->ToPlayer()->UpdateMeleeHitChances();
4917 target->ToPlayer()->UpdateRangedHitChances();
4918 }
4919 else
4920 {
4921 target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
4922 target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
4923 }
4924}
void UpdateMeleeHitChances()
Definition StatSystem.cpp:871
void UpdateRangedHitChances()
Definition StatSystem.cpp:877
float m_modRangedHitChance
Definition Unit.h:2063
float m_modMeleeHitChance
Definition Unit.h:2062

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
1565{
1567 return;
1568
1569 Unit* target = aurApp->GetTarget();
1571
1572 if (apply)
1573 {
1574 // apply glow vision
1575 if (target->IsPlayer() && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10))
1577
1578 target->m_invisibility.AddFlag(type);
1579 target->m_invisibility.AddValue(type, GetAmount());
1580 }
1581 else
1582 {
1583 if (!target->HasInvisibilityAura())
1584 {
1585 // if not have different invisibility auras.
1586 // always remove glow vision
1587 if (target->IsPlayer())
1589
1590 target->m_invisibility.DelFlag(type);
1591 }
1592 else
1593 {
1594 bool found = false;
1596 for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i)
1597 {
1598 if (GetMiscValue() == (*i)->GetMiscValue())
1599 {
1600 found = true;
1601 break;
1602 }
1603 }
1604 if (!found)
1605 {
1606 target->m_invisibility.DelFlag(type);
1607
1608 // if not have invisibility auras of type INVISIBILITY_GENERAL
1609 // remove glow vision
1611 {
1613 }
1614 }
1615 }
1616
1617 target->m_invisibility.AddValue(type, -GetAmount());
1618 }
1619
1620 // call functions which may have additional effects after chainging state of unit
1621 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1622 {
1623 // drop flag at invisibiliy in bg
1625 }
1626
1627 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1628 target->bRequestForcedVisibilityUpdate = false;
1629}
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition Player.h:563
@ PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION
Definition Player.h:540
InvisibilityType
Definition SharedDefines.h:1265
@ INVISIBILITY_UNK10
Definition SharedDefines.h:1276
@ INVISIBILITY_GENERAL
Definition SharedDefines.h:1266
@ SPELL_AURA_MOD_INVISIBILITY
Definition SpellAuraDefines.h:81
bool HasFlag(FLAG_TYPE flag) const
Definition Object.h:389
void AddFlag(FLAG_TYPE flag)
Definition Object.h:390
void DelFlag(FLAG_TYPE flag)
Definition Object.h:391
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:395
bool Instanceable() const
Definition Map.h:294
bool IsPlayer() const
Definition ObjectGuid.h:168
bool bRequestForcedVisibilityUpdate
Definition Unit.h:2091
ObjectGuid GetOwnerGUID() const
Definition Unit.h:703
bool HasInvisibilityAura() const
Definition Unit.h:1821
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition Object.h:609

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
1540{
1542 return;
1543
1544 Unit* target = aurApp->GetTarget();
1546
1547 if (apply)
1548 {
1549 target->m_invisibilityDetect.AddFlag(type);
1550 target->m_invisibilityDetect.AddValue(type, GetAmount());
1551 }
1552 else
1553 {
1554 if (!target->HasInvisibilityDetectAura())
1555 target->m_invisibilityDetect.DelFlag(type);
1556
1557 target->m_invisibilityDetect.AddValue(type, -GetAmount());
1558 }
1559
1560 // call functions which may have additional effects after chainging state of unit
1561 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1562}
bool HasInvisibilityDetectAura() const
Definition Unit.h:1822
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition Object.h:610

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
4696{
4698 return;
4699
4700 Unit* target = aurApp->GetTarget();
4701
4702 if (!target->IsPlayer())
4703 return;
4704
4705 //Note: an increase in regen does NOT cause threat.
4706 target->ToPlayer()->UpdateManaRegen();
4707}
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
4142{
4143 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4144 return;
4145
4146 Unit* target = aurApp->GetTarget();
4147 uint32 mechanic = 0;
4148
4149 switch (GetId())
4150 {
4151 case 46924: // BladeStorm
4153 break;
4154 case 34471: // The Beast Within
4155 case 19574: // Bestial Wrath
4156 case 38484: // Bestial Wrath
4157 case 40081: // Free friend (Black Temple)
4175 break;
4176 case 42292: // PvP trinket
4177 case 59752: // Every Man for Himself
4178 case 65547: // PvP trinket for Faction Champions (ToC 25)
4179 case 53490: // Bullheaded
4180 case 46227: // Medalion of Immunity
4182 target->RemoveAurasByType(SPELL_AURA_PREVENTS_FLEEING); // xinef: Patch 2.3.0 PvP Trinkets: Insignia of the Alliance, Insignia of the Horde, Medallion of the Alliance, and Medallion of the Horde now clear the debuff from Judgement of Justice.
4183 // Actually we should apply immunities here, too, but the aura has only 100 ms duration, so there is practically no point
4184 break;
4185 case 54508: // Demonic Empowerment
4186 mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
4191 break;
4192 default:
4193 if (GetMiscValue() < 1)
4194 return;
4195 mechanic = 1 << GetMiscValue();
4197 break;
4198 }
4199
4200 if (apply && GetSpellInfo()->HasAttribute(SPELL_ATTR1_IMMUNITY_PURGES_EFFECT))
4201 {
4202 // Xinef: exception for purely snare mechanic (eg. hands of freedom)!
4203 if (mechanic == (1 << MECHANIC_SNARE))
4204 target->RemoveMovementImpairingAuras(false);
4205 else
4207 }
4208}
@ MECHANIC_FEAR
Definition SharedDefines.h:1341
@ MECHANIC_DISORIENTED
Definition SharedDefines.h:1338
@ MECHANIC_KNOCKOUT
Definition SharedDefines.h:1350
@ MECHANIC_CHARM
Definition SharedDefines.h:1337
@ MECHANIC_TURN
Definition SharedDefines.h:1359
@ MECHANIC_STUN
Definition SharedDefines.h:1348
@ MECHANIC_FREEZE
Definition SharedDefines.h:1349
@ MECHANIC_ROOT
Definition SharedDefines.h:1343
@ MECHANIC_SLEEP
Definition SharedDefines.h:1346
@ MECHANIC_DAZE
Definition SharedDefines.h:1363
@ MECHANIC_SNARE
Definition SharedDefines.h:1347
@ MECHANIC_SHACKLE
Definition SharedDefines.h:1356
@ MECHANIC_SAPPED
Definition SharedDefines.h:1366
@ MECHANIC_HORROR
Definition SharedDefines.h:1360
#define IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK
Definition SharedDefines.h:1372
@ SPELL_AURA_PREVENTS_FLEEING
Definition SpellAuraDefines.h:155
@ AURA_REMOVE_BY_DEFAULT
Definition SpellAuraDefines.h:392
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition Unit.cpp:5372
void RemoveMovementImpairingAuras(bool withRoot)
Definition Unit.cpp:5353

References Unit::ApplySpellImmune(), AURA_EFFECT_HANDLE_REAL, AURA_REMOVE_BY_DEFAULT, GetId(), GetMiscValue(), GetSpellInfo(), AuraApplication::GetTarget(), IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK, IMMUNITY_MECHANIC, MECHANIC_BANISH, MECHANIC_CHARM, MECHANIC_DAZE, MECHANIC_DISORIENTED, MECHANIC_FEAR, MECHANIC_FREEZE, MECHANIC_HORROR, MECHANIC_KNOCKOUT, MECHANIC_POLYMORPH, MECHANIC_ROOT, MECHANIC_SAPPED, MECHANIC_SHACKLE, MECHANIC_SLEEP, MECHANIC_SNARE, MECHANIC_STUN, MECHANIC_TURN, Unit::RemoveAurasByType(), Unit::RemoveAurasWithMechanic(), Unit::RemoveMovementImpairingAuras(), SPELL_ATTR1_IMMUNITY_PURGES_EFFECT, SPELL_AURA_MOD_STUN, and SPELL_AURA_PREVENTS_FLEEING.

◆ HandleModMeleeRangedSpeedPct()

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

◆ HandleModMeleeSpeedPct()

void AuraEffect::HandleModMeleeSpeedPct ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5062{
5064 return;
5065
5066 Unit* target = aurApp->GetTarget();
5068 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
5069 return;
5070
5071 if (spellGroupVal)
5072 {
5073 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
5074 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
5075 }
5076 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
5077 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
5078}
@ 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
5285{
5287 return;
5288
5289 Unit* target = aurApp->GetTarget();
5290
5291 // also handles spell group stacks
5293}
void UpdateDamagePctDoneMods(WeaponAttackType attackType)
Definition Unit.cpp:15497

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
4486{
4488 return;
4489
4490 Unit* target = aurApp->GetTarget();
4491
4492 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4493 {
4494 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4495 return;
4496 }
4497
4498 // only players currently use base stats
4499 if (!target->IsPlayer())
4500 return;
4501
4502 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
4503 {
4504 if (apply)
4506 else
4507 {
4508 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_PERCENT_STAT, [i](AuraEffect const* aurEff)
4509 {
4510 return (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1);
4511 });
4513 }
4514 }
4515}
@ 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
3567{
3568 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3569 return;
3570
3571 Unit* target = aurApp->GetTarget();
3572
3573 Unit* caster = GetCaster();
3574
3575 // no support for posession AI yet
3576 if (caster && caster->IsCreature())
3577 {
3578 HandleModCharm(aurApp, mode, apply);
3579 return;
3580 }
3581
3582 if (apply)
3583 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3584 else
3585 target->RemoveCharmedBy(caster);
3586}
@ CHARM_TYPE_POSSESS
Definition CharmInfo.h:46
void HandleModCharm(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3641

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
3589{
3590 // Used by spell "Eyes of the Beast"
3591
3592 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3593 return;
3594
3595 Unit* caster = GetCaster();
3596 if (!caster || !caster->IsPlayer())
3597 return;
3598
3599 //seems it may happen that when removing it is no longer owner's pet
3600 //if (caster->ToPlayer()->GetPet() != target)
3601 // return;
3602
3603 Unit* target = aurApp->GetTarget();
3604 if (!target->IsCreature() || !target->IsPet())
3605 return;
3606
3607 Pet* pet = target->ToPet();
3608
3609 if (apply)
3610 {
3611 if (caster->ToPlayer()->GetPet() != pet)
3612 return;
3613
3614 // Must clear current motion or pet leashes back to owner after a few yards
3615 // when under spell 'Eyes of the Beast'
3616 pet->GetMotionMaster()->Clear();
3617 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3618 }
3619 else
3620 {
3621 pet->RemoveCharmedBy(caster);
3622
3623 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
3624 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
3625 else
3626 {
3627 // Reinitialize the pet bar or it will appear greyed out
3628 caster->ToPlayer()->PetSpellInitialize();
3629
3630 // Follow owner only if not fighting or owner didn't click "stay" at new location
3631 // This may be confusing because pet bar shows "stay" when under the spell but it retains
3632 // the "follow" flag. Player MUST click "stay" while under the spell.
3633 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3634 {
3636 }
3637 }
3638 }
3639}
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:46
constexpr float PET_FOLLOW_DIST
Definition PetDefines.h:206
@ COMMAND_STAY
Definition Unit.h:562
float GetFollowAngle() const override
Definition TemporarySummon.h:83
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:446
void Clear(bool reset=true)
Definition MotionMaster.h:182
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition Pet.cpp:881
void PetSpellInitialize()
Definition Player.cpp:9555
Pet * ToPet()
Definition Unit.h:719
CharmInfo * GetCharmInfo()
Definition Unit.h:1264
Unit * GetVictim() const
Definition Unit.h:891
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1347
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
5343{
5345 return;
5346
5347 Unit* target = aurApp->GetTarget();
5348
5349 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5350 if (GetMiscValue() & (1 << i))
5352}
@ 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
5330{
5332 return;
5333
5334 Unit* target = aurApp->GetTarget();
5335
5336 float amount = CalculatePct(1.0f, GetAmount());
5337 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5338 if (GetMiscValue() & (1 << i))
5340}
@ UNIT_FIELD_POWER_COST_MULTIPLIER
Definition UpdateFields.h:171
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
Definition Object.cpp:811

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
4671{
4673 return;
4674
4675 Unit* target = aurApp->GetTarget();
4676
4677 if (!target->IsPlayer())
4678 return;
4679
4680 // Update manaregen value
4681 if (GetMiscValue() == POWER_MANA)
4682 target->ToPlayer()->UpdateManaRegen();
4683 else if (GetMiscValue() == POWER_ENERGY)
4684 target->ToPlayer()->UpdateEnergyRegen();
4685 else if (GetMiscValue() == POWER_RUNE)
4687 // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
4688}
@ POWER_RUNE
Definition SharedDefines.h:285
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
4691{
4692 HandleModPowerRegen(aurApp, mode, apply);
4693}
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4670

References HandleModPowerRegen().

◆ HandleModRating()

void AuraEffect::HandleModRating ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5108{
5110 return;
5111
5112 Unit* target = aurApp->GetTarget();
5113
5114 if (!target->IsPlayer())
5115 return;
5116
5117 for (uint8 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
5118 if (GetMiscValue() & (1 << rating))
5119 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
5120}
#define MAX_COMBAT_RATING
Definition Unit.h:251
CombatRating
Definition Unit.h:223
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition Player.cpp:5329

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
5123{
5125 return;
5126
5127 Unit* target = aurApp->GetTarget();
5128
5129 if (!target->IsPlayer())
5130 return;
5131
5132 // Just recalculate ratings
5133 for (uint8 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
5134 if (GetMiscValue() & (1 << rating))
5135 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
5136}

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
4396{
4398 return;
4399
4400 Unit* target = aurApp->GetTarget();
4401
4402 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
4403 {
4404 if (GetMiscValue() & int32(1 << i))
4405 {
4408 continue;
4409
4411 if (target->IsPlayer() || target->IsPet())
4413 }
4414 }
4415}
@ SPELL_AURA_MOD_RESISTANCE_PCT
Definition SpellAuraDefines.h:164
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:15387

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
4953{
4955 return;
4956
4957 Unit* target = aurApp->GetTarget();
4958
4959 if (!target->IsPlayer())
4960 return;
4961
4962 for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
4963 if (GetMiscValue() & (1 << school))
4964 target->ToPlayer()->UpdateSpellCritChance(school);
4965}
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
4548{
4550 return;
4551
4552 Unit* target = aurApp->GetTarget();
4553
4554 if (!target->IsPlayer())
4555 return;
4556
4557 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4558 // This information for client side use only
4559 // Recalculate bonus
4561}

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
4518{
4520 return;
4521
4522 Unit* target = aurApp->GetTarget();
4523
4524 if (!target->IsPlayer())
4525 return;
4526
4527 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4528 // This information for client side use only
4529 // Recalculate bonus
4531}

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
4564{
4566 return;
4567
4568 Unit* target = aurApp->GetTarget();
4569
4570 if (!target->IsPlayer())
4571 return;
4572
4573 // Recalculate bonus
4575}

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
4534{
4536 return;
4537
4538 Unit* target = aurApp->GetTarget();
4539
4540 if (!target->IsPlayer())
4541 return;
4542
4543 // Recalculate bonus
4545}

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
4927{
4929 return;
4930
4931 Unit* target = aurApp->GetTarget();
4932
4933 if (target->IsPlayer())
4934 target->ToPlayer()->UpdateSpellHitChances();
4935 else
4936 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
4937}
void UpdateSpellHitChances()
Definition StatSystem.cpp:883
float m_modSpellHitChance
Definition Unit.h:2064

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
3828{
3829 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3830 return;
3831
3832 Unit* target = aurApp->GetTarget();
3833 std::list <AuraType> aura_immunity_list;
3834 uint32 mechanic_immunity_list = 0;
3835 int32 miscVal = GetMiscValue();
3836
3837 switch (miscVal)
3838 {
3839 case 96:
3840 case 1615:
3841 {
3842 if (!GetAmount())
3843 {
3844 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3845 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3846 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3847 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3849 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3850
3863 aura_immunity_list.push_back(SPELL_AURA_MOD_CHARM);
3864 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3865 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3866 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3867 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3868 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3869 }
3870 break;
3871 }
3872 case 679:
3873 {
3874 if (GetId() == 57742)
3875 {
3876 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3877 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3878 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3879 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3881 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3882
3895 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3896 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3897 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3898 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3899 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3900 }
3901 break;
3902 }
3903 case 1557:
3904 {
3905 if (GetId() == 64187)
3906 {
3907 mechanic_immunity_list = (1 << MECHANIC_STUN);
3909 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3910 }
3911 else
3912 {
3913 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3914 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3915 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3916 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3918 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3919
3932 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3933 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3934 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3935 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3936 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3937 }
3938 break;
3939 }
3940 case 1614:
3941 case 1694:
3942 {
3944 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3945 break;
3946 }
3947 case 1630:
3948 {
3949 if (!GetAmount())
3950 {
3952 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3953 }
3954 else
3955 {
3956 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3957 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3958 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3959 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3961 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3962
3975 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3976 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3977 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3978 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3979 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3980 }
3981 break;
3982 }
3983 case 477:
3984 case 1733:
3985 case 1632:
3986 {
3987 if (!GetAmount())
3988 {
3989 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3990 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3991 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3992 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3994 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN) | (1 << MECHANIC_BANISH);
3995
4011 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
4012
4013 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
4014 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
4015 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
4016 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
4017 }
4018 break;
4019 }
4020 case 878:
4021 {
4022 if (GetAmount() == 1)
4023 {
4024 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN)
4025 | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE);
4026
4031 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
4032 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
4033 }
4034 break;
4035 }
4036 default:
4037 break;
4038 }
4039
4040 if (aura_immunity_list.empty())
4041 {
4042 // Roots, OK
4043 if (GetMiscValue() & (1 << 0))
4044 {
4045 mechanic_immunity_list = (1 << MECHANIC_SNARE);
4046
4048 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
4049 }
4050 // Taunt, OK
4051 if (GetMiscValue() & (1 << 1))
4052 {
4053 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
4054 }
4055 // Crowd-Control auras?
4056 if (GetMiscValue() & (1 << 2))
4057 {
4058 mechanic_immunity_list = (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED);
4059
4062 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
4063 }
4064 // Interrupt, OK
4065 if (GetMiscValue() & (1 << 3))
4066 {
4067 mechanic_immunity_list = (1 << MECHANIC_INTERRUPT);
4068
4070 }
4071 // Transform?
4072 if (GetMiscValue() & (1 << 4))
4073 {
4074 aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
4075 }
4076 // Stun auras breakable by damage (Incapacitate effects), OK
4077 if (GetMiscValue() & (1 << 5))
4078 {
4079 mechanic_immunity_list = (1 << MECHANIC_KNOCKOUT);
4080
4082 }
4083 // // Slowing effects
4084 if (GetMiscValue() & (1 << 6))
4085 {
4086 mechanic_immunity_list = (1 << MECHANIC_SNARE);
4087
4089 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
4090 }
4091 // Charm auras?, 90%
4092 if ((GetMiscValue() & (1 << 7)))
4093 {
4094 mechanic_immunity_list = (1 << MECHANIC_CHARM);
4095
4097 aura_immunity_list.push_back(SPELL_AURA_MOD_CHARM);
4098 aura_immunity_list.push_back(SPELL_AURA_MOD_POSSESS);
4099 }
4100 // UNK
4101 // if ((GetMiscValue() & (1 << 8)))
4102 // {
4103 // }
4104 // Fear, OK
4105 if (GetMiscValue() & (1 << 9))
4106 {
4107 mechanic_immunity_list = (1 << MECHANIC_FEAR);
4108
4110 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
4111 }
4112 // Stuns, OK
4113 if (GetMiscValue() & (1 << 10))
4114 {
4115 mechanic_immunity_list = (1 << MECHANIC_STUN);
4116
4118 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
4119 }
4120 }
4121
4122 // apply immunities
4123 for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
4124 target->ApplySpellImmune(GetId(), IMMUNITY_STATE, *iter, apply);
4125
4126 // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated.
4127 if (GetId() == 46924)
4128 {
4129 // Knockback and hex
4131 }
4132
4134 {
4135 target->RemoveAurasWithMechanic(mechanic_immunity_list, AURA_REMOVE_BY_DEFAULT, GetId());
4136 for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
4137 target->RemoveAurasByType(*iter);
4138 }
4139}
@ SPELL_EFFECT_ATTACK_ME
Definition SharedDefines.h:903
@ SPELL_EFFECT_KNOCK_BACK_DEST
Definition SharedDefines.h:933
@ SPELL_EFFECT_KNOCK_BACK
Definition SharedDefines.h:887
@ MECHANIC_INTERRUPT
Definition SharedDefines.h:1362
@ SPELL_AURA_MOD_CHARM
Definition SpellAuraDefines.h:69
@ SPELL_AURA_MOD_TAUNT
Definition SpellAuraDefines.h:74
@ SPELL_AURA_MOD_DECREASE_SPEED
Definition SpellAuraDefines.h:96
@ SPELL_AURA_MOD_POSSESS
Definition SpellAuraDefines.h:65

References Unit::ApplySpellImmune(), AURA_EFFECT_HANDLE_REAL, AURA_REMOVE_BY_DEFAULT, GetAmount(), GetId(), GetMiscValue(), GetSpellInfo(), AuraApplication::GetTarget(), SpellInfo::HasAttribute(), IMMUNITY_EFFECT, IMMUNITY_MECHANIC, IMMUNITY_STATE, MECHANIC_BANISH, MECHANIC_CHARM, MECHANIC_DISORIENTED, MECHANIC_FEAR, MECHANIC_FREEZE, MECHANIC_HORROR, MECHANIC_INTERRUPT, MECHANIC_KNOCKOUT, MECHANIC_POLYMORPH, MECHANIC_ROOT, MECHANIC_SAPPED, MECHANIC_SLEEP, MECHANIC_SNARE, MECHANIC_STUN, MECHANIC_TURN, Unit::RemoveAurasByType(), Unit::RemoveAurasWithMechanic(), SPELL_ATTR1_IMMUNITY_PURGES_EFFECT, SPELL_AURA_MOD_CHARM, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_POSSESS, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_MOD_TAUNT, SPELL_AURA_TRANSFORM, SPELL_EFFECT_ATTACK_ME, SPELL_EFFECT_KNOCK_BACK, and SPELL_EFFECT_KNOCK_BACK_DEST.

◆ HandleModStealth()

void AuraEffect::HandleModStealth ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1657{
1659 return;
1660
1661 Unit* target = aurApp->GetTarget();
1663
1664 if (apply)
1665 {
1666 target->m_stealth.AddFlag(type);
1667 target->m_stealth.AddValue(type, GetAmount());
1668
1670 if (target->IsPlayer())
1672
1673 // interrupt autoshot
1675 {
1677 target->ToPlayer()->SendAutoRepeatCancel(target);
1678 }
1679 }
1680 else
1681 {
1682 target->m_stealth.AddValue(type, -GetAmount());
1683
1684 if (!target->HasStealthAura()) // if last SPELL_AURA_MOD_STEALTH
1685 {
1686 target->m_stealth.DelFlag(type);
1687
1689 if (target->IsPlayer())
1691 }
1692 }
1693
1694 // call functions which may have additional effects after chainging state of unit
1695 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1696 {
1697 // drop flag at stealth in bg
1699 }
1700
1701 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1702 target->bRequestForcedVisibilityUpdate = false;
1703}
@ PLAYER_FIELD_BYTE2_STEALTH
Definition Player.h:562
StealthType
Definition SharedDefines.h:1257
@ UNIT_STAND_FLAGS_CREEP
Definition UnitDefines.h:48
bool HasStealthAura() const
Definition Unit.h:1819
void RemoveStandFlags(uint8 flags)
Definition Unit.h:1765
void SetStandFlags(uint8 flags)
Definition Unit.h:1764
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition Object.h:606

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
1632{
1634 return;
1635
1636 Unit* target = aurApp->GetTarget();
1638
1639 if (apply)
1640 {
1641 target->m_stealthDetect.AddFlag(type);
1642 target->m_stealthDetect.AddValue(type, GetAmount());
1643 }
1644 else
1645 {
1646 if (!target->HasStealthDetectAura())
1647 target->m_stealthDetect.DelFlag(type);
1648
1649 target->m_stealthDetect.AddValue(type, -GetAmount());
1650 }
1651
1652 // call functions which may have additional effects after chainging state of unit
1653 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1654}
bool HasStealthDetectAura() const
Definition Unit.h:1820
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition Object.h:607

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
1706{
1708 return;
1709
1710 Unit* target = aurApp->GetTarget();
1712
1713 if (apply)
1714 target->m_stealth.AddValue(type, GetAmount());
1715 else
1716 target->m_stealth.AddValue(type, -GetAmount());
1717
1718 // call functions which may have additional effects after chainging state of unit
1719 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1720}

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
4433{
4435 return;
4436
4437 Unit* target = aurApp->GetTarget();
4438
4439 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
4440
4441 // show armor penetration
4442 if (target->IsPlayer() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
4444
4445 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
4448}
@ SPELL_SCHOOL_MASK_SPELL
Definition SharedDefines.h:319
@ 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
3482{
3483 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3484 return;
3485
3486 Unit* target = aurApp->GetTarget();
3487
3488 if (!target->IsAlive() || !target->CanHaveThreatList())
3489 return;
3490
3491 Unit* caster = GetCaster();
3492 if (!caster || !caster->IsAlive())
3493 return;
3494
3495 if (apply)
3496 target->TauntApply(caster);
3497 else
3498 {
3499 // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat
3500 target->TauntFadeOut(caster);
3501 }
3502}
void TauntApply(Unit *victim)
Definition Unit.cpp:14769
void TauntFadeOut(Unit *taunter)
Definition Unit.cpp:14799

References AURA_EFFECT_HANDLE_REAL, Unit::CanHaveThreatList(), GetCaster(), AuraApplication::GetTarget(), Unit::IsAlive(), Unit::TauntApply(), and Unit::TauntFadeOut().

◆ HandleModThreat()

void AuraEffect::HandleModThreat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3448{
3450 return;
3451
3452 Unit* target = aurApp->GetTarget();
3453 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
3454 if (GetMiscValue() & (1 << i))
3455 {
3456 if (apply)
3457 AddPct(target->m_threatModifier[i], GetAmount());
3458 else
3459 {
3460 float amount = target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_THREAT, 1 << i);
3461 target->m_threatModifier[i] = amount;
3462 }
3463 }
3464}
@ SPELL_AURA_MOD_THREAT
Definition SpellAuraDefines.h:73
float m_threatModifier[MAX_SPELL_SCHOOL]
Definition Unit.h:2067

References AddPct(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Unit::GetTotalAuraMultiplierByMiscMask(), Unit::m_threatModifier, MAX_SPELL_SCHOOL, and SPELL_AURA_MOD_THREAT.

◆ HandleModTotalPercentStat()

void AuraEffect::HandleModTotalPercentStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4592{
4594 return;
4595
4596 Unit* target = aurApp->GetTarget();
4597
4598 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4599 {
4600 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4601 return;
4602 }
4603
4604 // save current health state
4605 float healthPct = target->GetHealthPct();
4606 bool alive = target->IsAlive();
4607
4608 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4609 {
4610 if (GetMiscValue() == i || GetMiscValue() == -1)
4611 {
4612 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, [i](AuraEffect const* aurEff)
4613 {
4614 return (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1);
4615 });
4616
4617 if (target->GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT) == amount)
4618 continue;
4619
4621 if (target->IsPlayer() || target->IsPet())
4622 target->UpdateStatBuffMod(Stats(i));
4623 }
4624 }
4625
4626 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_UNK4 0x00000010 flag)
4628 target->SetHealth(std::max<uint32>(uint32(healthPct * target->GetMaxHealth() * 0.01f), (alive ? 1 : 0)));
4629}
@ SPELL_ATTR0_IS_ABILITY
Definition SharedDefines.h:397
@ STAT_STAMINA
Definition SharedDefines.h:271
@ 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
2944{
2946 return;
2947
2948 Unit* target = aurApp->GetTarget();
2949
2950 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2951 if (!apply && target->HasUnattackableAura())
2952 return;
2953
2955
2956 // call functions which may have additional effects after chainging state of unit
2957 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
2958 {
2959 // xinef: this aura should not stop combat (movie with sindragosa proves that)
2960 //target->CombatStop();
2962 }
2963}
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:255
bool HasUnattackableAura() const
Definition Unit.h:1811

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

◆ HandleNoReagentUseAura()

void AuraEffect::HandleNoReagentUseAura ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5373{
5374 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5375 return;
5376
5377 Unit* target = aurApp->GetTarget();
5378
5379 if (!target->IsPlayer())
5380 return;
5381
5382 flag96 mask;
5384 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
5385 mask |= (*i)->m_spellInfo->Effects[(*i)->m_effIndex].SpellClassMask;
5386
5387 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1, mask[0]);
5388 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 1, mask[1]);
5389 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2, mask[2]);
5390}
@ 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
152 {
153 // not implemented
154 }

◆ HandleObsModPowerAuraTick()

void AuraEffect::HandleObsModPowerAuraTick ( Unit target,
Unit caster 
) const
7119{
7121 if (GetMiscValue() == POWER_ALL)
7122 PowerType = target->getPowerType();
7123 else
7125
7126 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
7127 return;
7128
7129 if (target->HasUnitState(UNIT_STATE_ISOLATED))
7130 {
7131 SendTickImmune(target, caster);
7132 return;
7133 }
7134
7135 // don't regen when permanent aura target has full power
7136 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
7137 return;
7138
7139 // ignore negative values (can be result apply spellmods to aura damage
7140 uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(PowerType) / 100;
7141 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
7142 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
7143 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
7144 target->SendPeriodicAuraLog(&pInfo);
7145
7146 int32 gain = target->ModifyPower(PowerType, amount);
7147
7148 if (caster)
7149 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
7150}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:170
@ POWER_ALL
Definition SharedDefines.h:288
void SendTickImmune(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:1111
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=nullptr)
Definition HostileRefMgr.cpp:35
std::string ToString() const
Definition ObjectGuid.cpp:47
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:14322
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1119
bool HasUnitState(const uint32 f) const
Definition Unit.h:726
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition Unit.cpp:6616
std::string ToString(Type &&val, Params &&... params)
Definition StringConvert.h:250
Definition Unit.h:519

References GetBase(), GetCasterGUID(), Object::GetGUID(), Unit::getHostileRefMgr(), GetId(), Unit::GetMaxPower(), GetMiscValue(), Unit::GetPower(), Unit::getPowerType(), GetSpellInfo(), Unit::HasUnitState(), Unit::IsAlive(), LOG_DEBUG, m_amount, Unit::ModifyPower(), POWER_ALL, Unit::SendPeriodicAuraLog(), SendTickImmune(), HostileRefMgr::threatAssist(), ObjectGuid::ToString(), and UNIT_STATE_ISOLATED.

Referenced by PeriodicTick().

◆ HandlePeriodicDamageAurasTick()

void AuraEffect::HandlePeriodicDamageAurasTick ( Unit target,
Unit caster 
) const
6593{
6594 if (!target->IsAlive())
6595 return;
6596
6597 if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamageOrSchool(GetSpellInfo()) || target->IsTotem())
6598 {
6599 SendTickImmune(target, caster);
6600 return;
6601 }
6602
6603 // Consecrate ticks can miss and will not show up in the combat log
6604 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6605 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6606 return;
6607
6608 // some auras remove at specific health level or more
6610 {
6611 switch (GetSpellInfo()->Id)
6612 {
6613 case 43093:
6614 case 31956:
6615 case 38801: // Grievous Wound
6616 case 35321:
6617 case 38363:
6618 case 39215: // Gushing Wound
6619 if (target->IsFullHealth())
6620 {
6621 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6622 return;
6623 }
6624 break;
6625 case 38772: // Grievous Wound
6626 {
6627 uint32 percent = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster);
6628 if (!target->HealthBelowPct(percent))
6629 {
6630 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6631 return;
6632 }
6633 break;
6634 }
6635 }
6636 }
6637
6639
6640 // ignore non positive values (can be result apply spellmods to aura damage
6641 uint32 damage = std::max(GetAmount(), 0);
6642
6643 // If the damage is percent-max-health based, calculate damage before the Modify hook
6645 {
6646 // xinef: ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
6647 damage = uint32(std::ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
6648 }
6649
6650 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6651 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6652
6653 if (target->GetAI())
6654 {
6655 target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
6656 }
6657
6659 {
6660 // xinef: leave only target depending bonuses, rest is handled in calculate amount
6661 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE && caster)
6662 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6663 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6664
6665 // Calculate armor mitigation
6667 {
6668 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6669 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6670 damage = damageReductedArmor;
6671 }
6672
6673 // Curse of Agony damage-per-tick calculation
6674 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x400) && GetSpellInfo()->SpellIconID == 544)
6675 {
6676 uint32 totalTick = GetTotalTicks();
6677 // 1..4 ticks, 1/2 from normal tick damage
6678 if (m_tickNumber <= totalTick / 3)
6679 damage = damage / 2;
6680 // 9..12 ticks, 3/2 from normal tick damage
6681 else if (m_tickNumber > totalTick * 2 / 3)
6682 damage += (damage + 1) / 2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
6683 // 5..8 ticks have normal tick damage
6684 }
6685 }
6686
6687 // calculate crit chance
6688 bool crit = false;
6689 if ((crit = roll_chance_f(GetCritChance())))
6690 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6691
6692 // Auras reducing damage from AOE spells
6694 {
6695 if (GetSpellInfo()->Effects[GetEffIndex()].IsAreaAuraEffect() ||
6696 GetSpellInfo()->Effects[GetEffIndex()].IsTargetingArea() ||
6697 GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA || // some persistent area auras have targets like A=53 B=28
6700 {
6701 bool npcCaster = (caster && !caster->IsControlledByPlayer()) || GetSpellInfo()->HasAttribute(SPELL_ATTR7_TREAT_AS_NPC_AOE);
6702 damage = target->CalculateAOEDamageReduction(damage, GetSpellInfo()->SchoolMask, npcCaster);
6703 }
6704 }
6705
6706 int32 dmg = damage;
6707 int32 mitigatedDamage = cleanDamage.mitigated_damage;
6708 if (CanApplyResilience())
6709 {
6710 int32 resilienceReduction = dmg;
6711 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6712
6713 resilienceReduction = dmg - resilienceReduction;
6714 dmg -= resilienceReduction;
6715 mitigatedDamage += resilienceReduction;
6716 }
6717
6718 damage = std::max(0, dmg);
6719 cleanDamage.mitigated_damage = std::max(0, mitigatedDamage);
6720
6721 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6722 Unit::CalcAbsorbResist(dmgInfo);
6723
6724 uint32 absorb = dmgInfo.GetAbsorb();
6725 uint32 resist = dmgInfo.GetResist();
6726 damage = dmgInfo.GetDamage();
6727
6728 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} attacked {} for {} dmg inflicted by {} abs is {}",
6729 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6730 Unit::DealDamageMods(target, damage, &absorb);
6731
6732 // Set trigger flag
6733 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6734 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6736 if (absorb > 0)
6737 procEx |= PROC_EX_ABSORB;
6738
6739 if (damage)
6740 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6741
6742 int32 overkill = damage - target->GetHealth();
6743 if (overkill < 0)
6744 overkill = 0;
6745
6746 SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
6747 target->SendPeriodicAuraLog(&pInfo);
6748
6749 Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
6750
6751 Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6752}
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:678
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
Definition SharedDefines.h:816
@ SPELL_ATTR5_TREAT_AS_AREA_EFFECT
Definition SharedDefines.h:593
@ SPELLFAMILY_WARLOCK
Definition SharedDefines.h:3799
@ SPELL_MISS_NONE
Definition SharedDefines.h:1530
@ SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS
Definition SharedDefines.h:549
@ DYNOBJ_AURA_TYPE
Definition SpellAuraDefines.h:386
@ PROC_EX_INTERNAL_DOT
Definition SpellMgr.h:218
@ PROC_EX_CRITICAL_HIT
Definition SpellMgr.h:194
@ PROC_EX_NORMAL_HIT
Definition SpellMgr.h:193
@ PROC_EX_ABSORB
Definition SpellMgr.h:203
@ PROC_FLAG_DONE_PERIODIC
Definition SpellMgr.h:133
@ PROC_FLAG_TAKEN_PERIODIC
Definition SpellMgr.h:134
@ PROC_FLAG_TAKEN_DAMAGE
Definition SpellMgr.h:136
@ CR_CRIT_TAKEN_SPELL
Definition Unit.h:240
@ MELEE_HIT_NORMAL
Definition Unit.h:293
bool CanApplyResilience() const
Definition SpellAuraEffects.h:111
float GetCritChance() const
Definition SpellAuraEffects.h:108
int32 GetTotalTicks() const
Definition SpellAuraEffects.cpp:7384
uint8 GetCasterLevel() const
Definition SpellAuraEffects.h:110
Definition Unit.h:337
uint32 SchoolMask
Definition SpellInfo.h:392
virtual void OnCalculatePeriodicTickReceived(uint32 &, Unit *)
Called during calculation when receiving periodic healing or damage (DoT or HoT)
Definition UnitAI.h:384
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:2067
int32 CalculateAOEDamageReduction(int32 damage, uint32 schoolMask, bool npcCaster) const
Definition Unit.cpp:20364
bool IsFullHealth() const
Definition Unit.h:1097
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition Unit.cpp:3508
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:12464
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1099
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:11993
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition Unit.cpp:19169
static void ProcDamageAndSpell(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:6605
UnitAI * GetAI()
Definition Unit.h:683
bool IsControlledByPlayer() const
Definition Unit.h:1290
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition Unit.cpp:2044
bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:13067
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false)
Definition Unit.cpp:2183
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:814
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:824
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(), GetTotalTicks(), SpellInfo::HasAttribute(), Unit::HasUnitState(), Unit::HealthBelowPct(), Unit::IsAlive(), Unit::IsControlledByPlayer(), Unit::IsDamageReducedByArmor(), Unit::IsFullHealth(), Unit::IsImmunedToDamageOrSchool(), Unit::IsTotem(), LOG_DEBUG, m_spellInfo, m_tickNumber, 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::ProcDamageAndSpell(), 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(), SPELLFAMILY_WARLOCK, Unit::SpellHitResult(), sScriptMgr, ObjectGuid::ToString(), and UNIT_STATE_ISOLATED.

Referenced by PeriodicTick().

◆ HandlePeriodicDummyAuraTick()

void AuraEffect::HandlePeriodicDummyAuraTick ( Unit target,
Unit caster 
) const
6200{
6201 switch (GetSpellInfo()->SpellFamilyName)
6202 {
6203 case SPELLFAMILY_DRUID:
6204 {
6205 switch (GetSpellInfo()->Id)
6206 {
6207 // Frenzied Regeneration
6208 case 22842:
6209 {
6210 // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health.
6211 // Should be manauser
6212 if (!target->HasActivePowerType(POWER_RAGE))
6213 break;
6214 uint32 rage = target->GetPower(POWER_RAGE);
6215 // Nothing todo
6216 if (rage == 0)
6217 break;
6218 int32 mod = (rage < 100) ? rage : 100;
6219 int32 points = target->CalculateSpellDamage(target, GetSpellInfo(), 1);
6220 int32 regen = target->GetMaxHealth() * (mod * points / 10) / 1000;
6221 target->CastCustomSpell(target, 22845, &regen, 0, 0, true, 0, this);
6222 target->SetPower(POWER_RAGE, rage - mod);
6223 break;
6224 }
6225 }
6226 break;
6227 }
6228 case SPELLFAMILY_HUNTER:
6229 {
6230 // Explosive Shot
6231 if (GetSpellInfo()->SpellFamilyFlags[1] & 0x80000000)
6232 {
6233 if (caster)
6234 caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, target, true, nullptr, this);
6235 break;
6236 }
6237 switch (GetSpellInfo()->Id)
6238 {
6239 // Feeding Frenzy Rank 1
6240 case 53511:
6241 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
6242 target->CastSpell(target, 60096, true, 0, this);
6243 return;
6244 // Feeding Frenzy Rank 2
6245 case 53512:
6246 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
6247 target->CastSpell(target, 60097, true, 0, this);
6248 return;
6249 default:
6250 break;
6251 }
6252 break;
6253 }
6254 case SPELLFAMILY_SHAMAN:
6255 if (GetId() == 52179) // Astral Shift
6256 {
6257 // Periodic need for remove visual on stun/fear/silence lost
6259 target->RemoveAurasDueToSpell(52179);
6260 break;
6261 }
6262 break;
6264 switch (GetId())
6265 {
6266 case 49016: // Hysteria
6267 uint32 damage = uint32(target->CountPctFromMaxHealth(1));
6268 Unit::DealDamage(target, target, damage, nullptr, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
6269 break;
6270 }
6271 // Blood of the North
6272 // Reaping
6273 // Death Rune Mastery
6274 if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
6275 {
6276 if (!target->IsPlayer())
6277 return;
6279 return;
6280
6281 // timer expired - remove death runes
6282 target->ToPlayer()->RemoveRunesByAuraEffect(this);
6283 }
6284 break;
6285 default:
6286 break;
6287 }
6288}
@ SPELLFAMILY_HUNTER
Definition SharedDefines.h:3803
@ SPELLFAMILY_DEATHKNIGHT
Definition SharedDefines.h:3809
@ SPELLVALUE_BASE_POINT0
Definition SpellDefines.h:113
@ UNIT_FLAG_STUNNED
Definition UnitDefines.h:272
@ UNIT_FLAG_FLEEING
Definition UnitDefines.h:277
@ NODAMAGE
Definition Unit.h:259
UnitFlags GetUnitFlags() const
Definition Unit.h:736
uint32 CountPctFromMaxHealth(int32 pct) const
Definition Unit.h:1104
virtual bool HasActivePowerType(Powers power)
Definition Unit.h:1115

References Unit::CalculateSpellDamage(), Unit::CastCustomSpell(), Unit::CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, Unit::CountPctFromMaxHealth(), Unit::DealDamage(), GetId(), Unit::GetMaxHealth(), Unit::GetPower(), GetSpellInfo(), Unit::GetUnitFlags(), Unit::GetVictim(), Unit::HasActivePowerType(), Unit::HealthBelowPct(), SpellInfo::Id, Player::IsClass(), Object::IsPlayer(), m_amount, NODAMAGE, POWER_RAGE, Unit::RemoveAurasDueToSpell(), Player::RemoveRunesByAuraEffect(), Unit::SetPower(), SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_HUNTER, SPELLFAMILY_SHAMAN, SpellInfo::SpellFamilyFlags, SPELLVALUE_BASE_POINT0, Object::ToPlayer(), UNIT_FLAG_FLEEING, UNIT_FLAG_SILENCED, and UNIT_FLAG_STUNNED.

Referenced by PeriodicTick().

◆ HandlePeriodicEnergizeAuraTick()

void AuraEffect::HandlePeriodicEnergizeAuraTick ( Unit target,
Unit caster 
) const
7153{
7155
7157 return;
7158
7159 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
7160 return;
7161
7162 if (target->HasUnitState(UNIT_STATE_ISOLATED))
7163 {
7164 SendTickImmune(target, caster);
7165 return;
7166 }
7167
7168 // don't regen when permanent aura target has full power
7169 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
7170 return;
7171
7172 // ignore negative values (can be result apply spellmods to aura damage
7173 int32 amount = std::max(m_amount, 0);
7174
7175 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
7176 target->SendPeriodicAuraLog(&pInfo);
7177
7178 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
7179 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
7180 int32 gain = target->ModifyPower(PowerType, amount);
7181
7182 if (caster)
7183 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
7184}
@ SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED
Definition SharedDefines.h:668

References GetBase(), GetCasterGUID(), Object::GetGUID(), Unit::getHostileRefMgr(), GetId(), Unit::GetMaxPower(), GetMiscValue(), Unit::GetPower(), GetSpellInfo(), Unit::HasActivePowerType(), SpellInfo::HasAttribute(), Unit::HasUnitState(), Unit::IsAlive(), Object::IsPlayer(), LOG_DEBUG, m_amount, m_spellInfo, Unit::ModifyPower(), Unit::SendPeriodicAuraLog(), SendTickImmune(), SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED, HostileRefMgr::threatAssist(), ObjectGuid::ToString(), and UNIT_STATE_ISOLATED.

Referenced by PeriodicTick().

◆ HandlePeriodicHealAurasTick()

void AuraEffect::HandlePeriodicHealAurasTick ( Unit target,
Unit caster 
) const
6892{
6893 if (!target->IsAlive())
6894 return;
6895
6896 if (target->HasUnitState(UNIT_STATE_ISOLATED))
6897 {
6898 SendTickImmune(target, caster);
6899 return;
6900 }
6901
6902 // heal for caster damage (must be alive)
6903 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST) && (!caster || !caster->IsAlive()))
6904 return;
6905
6906 // don't regen when permanent aura target has full power
6907 if (GetBase()->IsPermanent() && target->IsFullHealth())
6908 return;
6909
6910 // ignore negative values (can be result apply spellmods to aura damage
6911 int32 damage = std::max(m_amount, 0);
6912
6914 {
6915 // Taken mods
6916 float TakenTotalMod = 1.0f;
6917
6918 // Tenacity increase healing % taken
6919 if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0))
6920 AddPct(TakenTotalMod, Tenacity->GetAmount());
6921
6922 // Healing taken percent
6923 float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6924 if (minval)
6925 AddPct(TakenTotalMod, minval);
6926
6927 float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6928 if (maxval)
6929 AddPct(TakenTotalMod, maxval);
6930
6931 // Healing over time taken percent
6932 float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
6933 if (minval_hot)
6934 AddPct(TakenTotalMod, minval_hot);
6935
6936 float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
6937 if (maxval_hot)
6938 AddPct(TakenTotalMod, maxval_hot);
6939
6940 // Arena / BG Dampening
6941 float minval_pct = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
6942 if (minval_pct)
6943 AddPct(TakenTotalMod, minval_pct);
6944
6945 TakenTotalMod = std::max(TakenTotalMod, 0.0f);
6946
6947 // the most ugly hack i made :P the other option is to change all spellvalues to float...
6948 // demonic aegis
6949 if (caster && GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[1] & 0x20000000))
6951 AddPct(TakenTotalMod, aurEff->GetAmount());
6952
6953 damage = uint32(target->CountPctFromMaxHealth(damage));
6954 damage = uint32(damage * TakenTotalMod);
6955 }
6956 else
6957 {
6958 // Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100
6959 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellInfo()->SpellIconID == 2864)
6960 {
6961 uint32 tickNumber = GetTickNumber() - 1;
6962 int32 tempAmount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, nullptr);
6963
6964 float drop = 2.0f;
6965
6966 // Item - Druid T10 Restoration 2P Bonus
6967 if (caster)
6968 if (AuraEffect* aurEff = caster->GetAuraEffect(70658, 0))
6969 AddPct(drop, -aurEff->GetAmount());
6970
6971 damage += GetTotalTicks() * tempAmount * (6 - (drop * tickNumber)) * 0.01f;
6972 }
6973
6974 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
6975 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6976 damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6977 }
6978
6979 bool crit = false;
6980 if ((crit = roll_chance_f(GetCritChance())))
6981 damage = Unit::SpellCriticalHealingBonus(caster, GetSpellInfo(), damage, target);
6982
6983 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} heal of {} for {} health inflicted by {}",
6984 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId());
6985
6986 uint32 heal = uint32(damage);
6987
6988 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6989 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, heal, GetSpellInfo());
6990 sScriptMgr->ModifyHealReceived(target, caster, heal, GetSpellInfo());
6991
6992 if (target->GetAI())
6993 {
6994 target->GetAI()->OnCalculatePeriodicTickReceived(heal, caster);
6995 }
6996
6997 HealInfo healInfo(caster, target, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6998 Unit::CalcHealAbsorb(healInfo);
6999 int32 gain = Unit::DealHeal(caster, target, healInfo.GetHeal());
7000 healInfo.SetEffectiveHeal(gain);
7001
7002 SpellPeriodicAuraLogInfo pInfo(this, healInfo.GetHeal(), healInfo.GetHeal() - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
7003 target->SendPeriodicAuraLog(&pInfo);
7004
7005 if (caster)
7006 {
7007 float threat = float(gain) * 0.5f;
7008 if (caster->IsClass(CLASS_PALADIN))
7009 threat *= 0.5f;
7010
7011 target->getHostileRefMgr().threatAssist(caster, threat, GetSpellInfo());
7012 }
7013
7014 bool haveCastItem = GetBase()->GetCastItemGUID();
7015
7016 // Health Funnel
7017 // damage caster for heal amount
7018 // xinef: caster is available, checked earlier
7019 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST))
7020 {
7021 uint32 manaPerSecond = GetSpellInfo()->ManaPerSecond;
7022 if ((int32)manaPerSecond > gain && gain > 0)
7023 {
7024 manaPerSecond = gain;
7025 }
7026
7027 uint32 absorb2 = 0;
7028 Unit::DealDamageMods(caster, manaPerSecond, &absorb2);
7029
7031 Unit::DealDamage(caster, caster, manaPerSecond, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
7032 }
7033
7034 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
7035 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
7037 if (healInfo.GetAbsorb() > 0)
7038 procEx |= PROC_EX_ABSORB;
7039
7040 // ignore item heals
7041 if (!haveCastItem && GetAuraType() != SPELL_AURA_OBS_MOD_HEALTH) // xinef: dont allow obs_mod_health to proc spells, this is passive regeneration and not hot
7042 Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, heal, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, nullptr, &healInfo);
7043}
@ SPELL_ATTR2_NO_TARGET_PER_SECOND_COST
Definition SharedDefines.h:478
@ CLASS_PALADIN
Definition SharedDefines.h:142
@ 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:219
@ SELF_DAMAGE
Definition Unit.h:260
uint32 GetTickNumber() const
Definition SpellAuraEffects.h:87
AuraObjectType GetType() const
Definition SpellAuras.cpp:420
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:103
Definition Unit.h:380
uint32 ManaPerSecond
Definition SpellInfo.h:365
static void CalcHealAbsorb(HealInfo &healInfo)
Definition Unit.cpp:2538
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition Unit.cpp:11159
int32 GetMaxPositiveAuraModifier(AuraType auratype) const
Definition Unit.cpp:6136
static uint32 SpellCriticalHealingBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:12504
int32 GetMaxNegativeAuraModifier(AuraType auratype) const
Definition Unit.cpp:6141
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:12748

References AddPct(), BASE_ATTACK, Unit::CalcHealAbsorb(), CLASS_PALADIN, Unit::CountPctFromMaxHealth(), Unit::DealDamage(), Unit::DealDamageMods(), Unit::DealHeal(), DOT, DYNOBJ_AURA_TYPE, SpellInfo::Effects, HealInfo::GetAbsorb(), Unit::GetAI(), Unit::GetAuraEffect(), GetAuraType(), GetBase(), GetCasterGUID(), Aura::GetCastItemGUID(), GetCritChance(), HealInfo::GetEffectiveHeal(), GetEffIndex(), Object::GetGUID(), HealInfo::GetHeal(), Unit::getHostileRefMgr(), GetId(), Unit::GetMaxNegativeAuraModifier(), Unit::GetMaxPositiveAuraModifier(), GetSpellInfo(), Aura::GetStackAmount(), GetTickNumber(), GetTotalTicks(), Aura::GetType(), Unit::HasUnitState(), Unit::IsAlive(), Unit::IsClass(), Unit::IsFullHealth(), LOG_DEBUG, m_amount, m_baseAmount, m_effIndex, m_spellInfo, 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::ProcDamageAndSpell(), 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_DRUID, SPELLFAMILY_WARLOCK, Unit::SpellHealingBonusDone(), Unit::SpellHealingBonusTaken(), sScriptMgr, HostileRefMgr::threatAssist(), ObjectGuid::ToString(), and UNIT_STATE_ISOLATED.

Referenced by PeriodicTick().

◆ HandlePeriodicHealthFunnelAuraTick()

void AuraEffect::HandlePeriodicHealthFunnelAuraTick ( Unit target,
Unit caster 
) const
6863{
6864 if (!caster || !caster->IsAlive() || !target->IsAlive())
6865 return;
6866
6867 if (target->HasUnitState(UNIT_STATE_ISOLATED))
6868 {
6869 SendTickImmune(target, caster);
6870 return;
6871 }
6872
6873 uint32 damage = std::max(GetAmount(), 0);
6874 // do not kill health donator
6875 if (caster->GetHealth() < damage)
6876 damage = caster->GetHealth() - 1;
6877 if (!damage)
6878 return;
6879
6880 caster->ModifyHealth(-(int32)damage);
6881 LOG_DEBUG("spells.aura", "PeriodicTick: donator {} target {} damage {}.", caster->GetEntry(), target->GetEntry(), damage);
6882
6883 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6884
6885 damage = int32(damage * gainMultiplier);
6886
6887 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6888 caster->HealBySpell(healInfo);
6889}
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition Unit.cpp:11449

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

Referenced by PeriodicTick().

◆ HandlePeriodicHealthLeechAuraTick()

void AuraEffect::HandlePeriodicHealthLeechAuraTick ( Unit target,
Unit caster 
) const
6755{
6756 if (!target->IsAlive())
6757 return;
6758
6760 {
6761 SendTickImmune(target, caster);
6762 return;
6763 }
6764
6765 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6766 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6767 return;
6768
6770
6771 uint32 damage = std::max(GetAmount(), 0);
6772
6773 // Script Hook For HandlePeriodicHealthLeechAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6774 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6775
6776 if (target->GetAI())
6777 {
6778 target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
6779 }
6780
6781 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
6782 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6783 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6784
6785 bool crit = false;
6786 if ((crit = roll_chance_f(GetCritChance())))
6787 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6788
6789 // Calculate armor mitigation
6791 {
6792 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6793 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6794 damage = damageReductedArmor;
6795 }
6796
6797 int32 dmg = damage;
6798 int32 cleanDamageAmount = cleanDamage.mitigated_damage;
6799 if (CanApplyResilience())
6800 {
6801 int32 resilienceReduction = dmg;
6802 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6803
6804 resilienceReduction = dmg - resilienceReduction;
6805 dmg -= resilienceReduction;
6806 cleanDamageAmount += resilienceReduction;
6807 }
6808
6809 damage = std::max(0, dmg);
6810 cleanDamage.mitigated_damage = std::max(0, cleanDamageAmount);
6811
6812 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6813 Unit::CalcAbsorbResist(dmgInfo);
6814
6815 uint32 absorb = dmgInfo.GetAbsorb();
6816 uint32 resist = dmgInfo.GetResist();
6817 damage = dmgInfo.GetDamage();
6818
6819 // Set trigger flag
6820 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6821 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6823 if (absorb > 0)
6824 procEx |= PROC_EX_ABSORB;
6825
6826 if (dmgInfo.GetDamage())
6827 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6828
6829 if (target->GetHealth() < dmgInfo.GetDamage())
6830 {
6831 dmgInfo.ModifyDamage(dmgInfo.GetDamage() - target->GetHealth());
6832 }
6833
6834 damage = dmgInfo.GetDamage();
6835
6836 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} health leech of {} for {} dmg inflicted by {} abs is {}",
6837 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6838 if (caster)
6839 caster->SendSpellNonMeleeDamageLog(target, GetSpellInfo(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit);
6840
6841 int32 new_damage;
6842
6843 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
6844
6845 Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6846
6847 if (!caster || !caster->IsAlive())
6848 return;
6849
6850 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6851
6852 uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount()));
6853 heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount()));
6854
6855 HealInfo healInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6856 float threat = float(caster->HealBySpell(healInfo)) * 0.5f;
6857 if (caster->IsClass(CLASS_PALADIN))
6858 threat *= 0.5f;
6859 caster->getHostileRefMgr().threatAssist(caster, threat, GetSpellInfo());
6860}
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition Unit.cpp:6537

References Unit::ApplyResilience(), BASE_ATTACK, Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), CanApplyResilience(), CLASS_PALADIN, CR_CRIT_TAKEN_SPELL, Unit::DealDamage(), DOT, DYNOBJ_AURA_TYPE, SpellInfo::Effects, DamageInfo::GetAbsorb(), Unit::GetAI(), GetAmount(), GetBase(), GetCasterGUID(), GetCasterLevel(), GetCritChance(), DamageInfo::GetDamage(), GetEffIndex(), Object::GetGUID(), Unit::GetHealth(), Unit::getHostileRefMgr(), GetId(), DamageInfo::GetResist(), GetSpellInfo(), Unit::HasUnitState(), Unit::HealBySpell(), Unit::IsAlive(), Unit::IsClass(), Unit::IsDamageReducedByArmor(), Unit::IsImmunedToDamageOrSchool(), 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::ProcDamageAndSpell(), 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, HostileRefMgr::threatAssist(), ObjectGuid::ToString(), and UNIT_STATE_ISOLATED.

Referenced by PeriodicTick().

◆ HandlePeriodicManaLeechAuraTick()

void AuraEffect::HandlePeriodicManaLeechAuraTick ( Unit target,
Unit caster 
) const
7046{
7048
7049 if (!caster || !caster->IsAlive() || !target->IsAlive() || !target->HasActivePowerType(PowerType))
7050 return;
7051
7053 {
7054 SendTickImmune(target, caster);
7055 return;
7056 }
7057
7058 if (GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
7059 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
7060 return;
7061
7062 // ignore negative values (can be result apply spellmods to aura damage
7063 int32 drainAmount = std::max(m_amount, 0);
7064
7065 // Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
7066 // It's mana percent cost spells, m_amount is percent drain from target
7068 {
7069 // max value
7070 int32 maxmana = CalculatePct(caster->GetMaxPower(PowerType), drainAmount * 2.0f);
7071 ApplyPct(drainAmount, target->GetMaxPower(PowerType));
7072 if (drainAmount > maxmana)
7073 drainAmount = maxmana;
7074 }
7075
7076 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} power leech of {} for {} dmg inflicted by {}",
7077 GetCasterGUID().ToString(), target->GetGUID().ToString(), drainAmount, GetId());
7078 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
7079 if (PowerType == POWER_MANA)
7080 drainAmount -= target->GetSpellCritDamageReduction(drainAmount);
7081
7082 int32 drainedAmount = -target->ModifyPower(PowerType, -drainAmount);
7083
7084 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
7085
7086 SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, gainMultiplier, false);
7087 target->SendPeriodicAuraLog(&pInfo);
7088
7089 int32 gainAmount = int32(drainedAmount * gainMultiplier);
7090 int32 gainedAmount = 0;
7091 if (gainAmount)
7092 {
7093 gainedAmount = caster->ModifyPower(PowerType, gainAmount);
7094 target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
7095 }
7096
7097 target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
7098
7099 // remove CC auras
7101
7102 // Drain Mana
7104 && m_spellInfo->SpellFamilyFlags[0] & 0x00000010)
7105 {
7106 int32 manaFeedVal = 0;
7107 if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
7108 manaFeedVal = aurEff->GetAmount();
7109 // Mana Feed - Drain Mana
7110 if (manaFeedVal > 0)
7111 {
7112 int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
7113 caster->CastCustomSpell(caster, 32554, &feedAmount, nullptr, nullptr, true, nullptr, this);
7114 }
7115 }
7116}
@ AURA_INTERRUPT_FLAG_TAKE_DAMAGE
Definition SpellDefines.h:44
T ApplyPct(T &base, U pct)
Definition Util.h:64
uint32 ManaCostPercentage
Definition SpellInfo.h:367
uint32 GetSpellCritDamageReduction(uint32 damage) const
Definition Unit.h:1259

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::HasUnitState(), Unit::IsAlive(), Unit::IsImmunedToDamageOrSchool(), 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(), ObjectGuid::ToString(), and UNIT_STATE_ISOLATED.

Referenced by PeriodicTick().

◆ HandlePeriodicPowerBurnAuraTick()

void AuraEffect::HandlePeriodicPowerBurnAuraTick ( Unit target,
Unit caster 
) const
7187{
7189
7190 if (!caster || !target->IsAlive() || !target->HasActivePowerType(PowerType))
7191 return;
7192
7194 {
7195 SendTickImmune(target, caster);
7196 return;
7197 }
7198
7199 // ignore negative values (can be result apply spellmods to aura damage
7200 int32 damage = std::max(m_amount, 0);
7201
7202 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
7203 if (PowerType == POWER_MANA)
7204 damage -= target->GetSpellCritDamageReduction(damage);
7205
7206 uint32 gain = uint32(-target->ModifyPower(PowerType, -damage));
7207
7208 float dmgMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
7209
7210 SpellInfo const* spellProto = GetSpellInfo();
7211 // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
7212 SpellNonMeleeDamage damageInfo(caster, target, spellProto, spellProto->SchoolMask);
7213 // no SpellDamageBonus for burn mana
7214 caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
7215
7216 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
7217
7218 caster->SendSpellNonMeleeDamageLog(&damageInfo);
7219
7220 // Set trigger flag
7221 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
7222 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
7224 if (damageInfo.damage)
7225 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
7226
7227 caster->DealSpellDamage(&damageInfo, true);
7228
7229 DamageInfo dmgInfo(damageInfo, DOT);
7230 Unit::ProcDamageAndSpell(caster, damageInfo.target, procAttacker, procVictim, procEx, damageInfo.damage, BASE_ATTACK, spellProto, nullptr, GetEffIndex(), nullptr, &dmgInfo);
7231}
uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition)
Definition Unit.cpp:16210
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
Definition Unit.cpp:1470
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
Definition Unit.cpp:1327
Definition Unit.h:496

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

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
6291{
6292 // generic casting code with custom spells and target/caster customs
6293 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
6294
6295 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
6296 SpellInfo const* auraSpellInfo = GetSpellInfo();
6297 uint32 auraId = auraSpellInfo->Id;
6298
6299 // specific code for cases with no trigger spell provided in field
6300 if (!triggeredSpellInfo)
6301 {
6302 switch (auraSpellInfo->SpellFamilyName)
6303 {
6305 {
6306 switch (auraId)
6307 {
6308 // Thaumaturgy Channel
6309 case 9712:
6310 triggerSpellId = 21029;
6311 if (caster)
6312 caster->CastSpell(caster, triggerSpellId, true);
6313 return;
6314 // Brood Affliction: Bronze
6315 case 23170:
6316 // Only 10% chance of triggering spell
6317 if (roll_chance_f(10.f))
6318 {
6319 triggerSpellId = 23171;
6320 }
6321 break;
6322 // Restoration
6323 case 24379:
6324 case 23493:
6325 {
6326 if (caster)
6327 {
6328 int32 heal = caster->CountPctFromMaxHealth(10);
6329 HealInfo healInfo(caster, target, heal, auraSpellInfo, auraSpellInfo->GetSchoolMask());
6330 caster->HealBySpell(healInfo);
6331
6332 if (int32 mana = caster->GetMaxPower(POWER_MANA))
6333 {
6334 mana /= 10;
6335 caster->EnergizeBySpell(caster, 23493, mana, POWER_MANA);
6336 }
6337 }
6338 return;
6339 }
6340 // Nitrous Boost
6341 case 27746:
6342 if (caster && target->GetPower(POWER_MANA) >= 10)
6343 {
6344 target->ModifyPower(POWER_MANA, -10);
6345 target->SendEnergizeSpellLog(caster, 27746, 10, POWER_MANA);
6346 }
6347 else
6348 target->RemoveAurasDueToSpell(27746);
6349 return;
6350 // Frost Blast
6351 case 27808:
6352 if (caster)
6353 {
6354 caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, nullptr, this);
6355 if (GetTickNumber() == 1)
6356 caster->CastSpell(target, 27808, true);
6357 }
6358 return;
6359 // Inoculate Nestlewood Owlkin
6360 case 29528:
6361 if (!target->IsCreature()) // prevent error reports in case ignored player target
6362 return;
6363 break;
6364 // Feed Captured Animal
6365 case 29917:
6366 triggerSpellId = 29916;
6367 break;
6368 // Extract Gas
6369 case 30427:
6370 {
6371 // move loot to player inventory and despawn target
6372 if (caster && caster->IsPlayer() &&
6373 target->IsCreature() &&
6375 {
6376 Player* player = caster->ToPlayer();
6377 Creature* creature = target->ToCreature();
6378 // missing lootid has been reported on startup - just return
6379 if (!creature->GetCreatureTemplate()->SkinLootId)
6380 return;
6381
6383
6384 creature->DespawnOrUnsummon();
6385 }
6386 return;
6387 }
6388 // Quake
6389 case 30576:
6390 triggerSpellId = 30571;
6391 break;
6392 // Doom
6394 // so instakill will be naturally done before trigger spell
6395 case 31347:
6396 {
6397 target->CastSpell(target, 31350, true, nullptr, this);
6398 Unit::Kill(target, target);
6399 return;
6400 }
6401 // Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam
6402 case 39857:
6403 triggerSpellId = 39856;
6404 break;
6405 // Personalized Weather
6406 case 46736:
6407 triggerSpellId = 46737;
6408 break;
6409 // Shield Level 1
6410 case 63130:
6411 // Shield Level 2
6412 case 63131:
6413 // Shield Level 3
6414 case 63132:
6415 // Ball of Flames Visual
6416 case 71706:
6417 return;
6418 // Oculus, Mage-Lord Urom, Time Bomb
6419 case 51121:
6420 case 59376:
6421 {
6422 const int32 dmg = target->GetMaxHealth() - target->GetHealth();
6423 target->CastCustomSpell(target, 51132, &dmg, 0, 0, true);
6424 return;
6425 }
6426 }
6427 break;
6428 }
6429 case SPELLFAMILY_SHAMAN:
6430 {
6431 switch (auraId)
6432 {
6433 // Lightning Shield (The Earthshatterer set trigger after cast Lighting Shield)
6434 case 28820:
6435 {
6436 // Need remove self if Lightning Shield not active
6438 target->RemoveAurasDueToSpell(28820);
6439 return;
6440 }
6441 }
6442 break;
6443 }
6444 default:
6445 break;
6446 }
6447 }
6448 else
6449 {
6450 // Spell exist but require custom code
6451 switch (auraId)
6452 {
6453 // Mana Tide
6454 case 16191:
6455 target->CastCustomSpell(target, triggerSpellId, &m_amount, nullptr, nullptr, true, nullptr, this);
6456 return;
6457 // Poison (Grobbulus)
6458 case 28158:
6459 case 54362:
6460 // Slime Pool (Dreadscale & Acidmaw)
6461 case 66882:
6462 target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000 * 2 / 3), nullptr, true, nullptr, this);
6463 return;
6464 // Eye of Eternity, Malygos, Arcane Overload
6465 case 56432:
6466 if (triggerSpellId == 56438)
6467 {
6468 target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)(10000 * (1.0f - 0.02f * (m_tickNumber + 1))), nullptr, true, nullptr, this);
6469 return;
6470 }
6471 break;
6472 // Beacon of Light
6473 case 53563:
6474 {
6475 // area aura owner casts the spell
6476 GetBase()->GetUnitOwner()->CastSpell(target, triggeredSpellInfo, true, 0, this, GetBase()->GetUnitOwner()->GetGUID());
6477 return;
6478 }
6479 // Trial of the Crusader, Jaraxxus, Spinning Pain Spike
6480 case 66283:
6481 {
6482 const int32 dmg = target->GetMaxHealth() / 2;
6483 target->CastCustomSpell(target, 66316, &dmg, nullptr, nullptr, true);
6484 return;
6485 }
6486 // Violet Hold, Moragg, Ray of Suffering, Ray of Pain
6487 case 54442:
6488 case 59524:
6489 case 54438:
6490 case 59523:
6491 {
6492 if (caster)
6493 if (Unit* victim = caster->GetVictim())
6494 if (victim->GetDistance(caster) < 45.0f)
6495 {
6496 target = victim;
6497 break;
6498 }
6499 return;
6500 }
6501 case 24745: // Summon Templar, Trigger
6502 case 24747: // Summon Templar Fire, Trigger
6503 case 24757: // Summon Templar Air, Trigger
6504 case 24759: // Summon Templar Earth, Trigger
6505 case 24761: // Summon Templar Water, Trigger
6506 case 24762: // Summon Duke, Trigger
6507 case 24766: // Summon Duke Fire, Trigger
6508 case 24769: // Summon Duke Air, Trigger
6509 case 24771: // Summon Duke Earth, Trigger
6510 case 24773: // Summon Duke Water, Trigger
6511 case 24785: // Summon Royal, Trigger
6512 case 24787: // Summon Royal Fire, Trigger
6513 case 24791: // Summon Royal Air, Trigger
6514 case 24792: // Summon Royal Earth, Trigger
6515 case 24793: // Summon Royal Water, Trigger
6516 {
6517 // All this spells trigger a spell that requires reagents; if the
6518 // triggered spell is cast as "triggered", reagents are not consumed
6519 if (caster)
6520 caster->CastSpell(target, triggerSpellId, false);
6521 return;
6522 }
6523 // Hunter - Rapid Recuperation
6524 case 56654:
6525 case 58882:
6526 int32 amount = int32(target->GetMaxPower(POWER_MANA) * GetAmount() / 100.0f);
6527 target->CastCustomSpell(target, triggerSpellId, &amount, nullptr, nullptr, true, nullptr, this);
6528 return;
6529 }
6530 }
6531
6532 // Reget trigger spell proto
6533 triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
6534
6535 if (triggeredSpellInfo)
6536 {
6537 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6538 {
6539 SpellCastTargets targets;
6540 targets.SetUnitTarget(target);
6541 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6542 {
6545 }
6546
6547 // Xinef: do not skip reagent cost for entry casts
6549 if (GetSpellInfo()->Effects[GetEffIndex()].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || GetSpellInfo()->Effects[GetEffIndex()].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)
6551
6552 triggerCaster->CastSpell(targets, triggeredSpellInfo, nullptr, triggerFlags, nullptr, this);
6553 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6554 }
6555 }
6556}
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
@ CREATURE_TYPE_GAS_CLOUD
Definition SharedDefines.h:2651
@ 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:115
Unit * GetUnitOwner() const
Definition SpellAuras.h:108
void DespawnOrUnsummon(Milliseconds msTimeToDespawn=0ms, Seconds forcedRespawnTimer=0s)
Definition Creature.cpp:2178
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, bool broadcast=false)
Definition Player.cpp:13527
Definition Spell.h:119
void SetUnitTarget(Unit *target)
Definition Spell.cpp:238
void SetObjectTargetChannel(ObjectGuid targetGUID)
Definition Spell.cpp:453
void SetDstChannel(SpellDestination const &spellDest)
Definition Spell.cpp:458
bool IsChannelCategorySpell() const
Definition SpellInfo.cpp:1083
void EnergizeBySpell(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:11476
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:17955
void SendEnergizeSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:11465
SpellDestination spellDst
Definition Spell.h:260
ObjectGuid channelGUID
Definition Spell.h:259
uint32 type
Definition CreatureData.h:222
uint32 SkinLootId
Definition CreatureData.h:226

References Player::AutoStoreLoot(), Unit::CastCustomSpell(), Unit::CastSpell(), ChannelTargetData::channelGUID, Unit::CountPctFromMaxHealth(), CREATURE_TYPE_GAS_CLOUD, Creature::DespawnOrUnsummon(), SpellInfo::Effects, Unit::EnergizeBySpell(), GetAmount(), Unit::GetAuraEffect(), 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_amount, 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, SPELL_AURA_PROC_TRIGGER_SPELL, ChannelTargetData::spellDst, SPELLFAMILY_GENERIC, SPELLFAMILY_SHAMAN, SpellInfo::SpellFamilyName, SPELLVALUE_BASE_POINT0, 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
6559{
6560 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
6561 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6562 {
6563 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6564 {
6565 SpellCastTargets targets;
6566 targets.SetUnitTarget(target);
6567 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6568 {
6571 }
6572
6573 CustomSpellValues values;
6575
6576 triggerCaster->CastSpell(targets, triggeredSpellInfo, &values, TRIGGERED_FULL_MASK, nullptr, this);
6577 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6578 }
6579 }
6580 else
6581 {
6582 Creature* c = target->ToCreature();
6583 if (c && caster)
6584 {
6585 sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature());
6586 }
6587
6588 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
6589 }
6590}
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
1818{
1819 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1820 return;
1821
1822 Unit* target = aurApp->GetTarget();
1823
1824 // no-phase is also phase state so same code for apply and remove
1825 uint32 newPhase = target->GetPhaseByAuras();
1826
1827 if (Player* player = target->ToPlayer())
1828 {
1829 if (!newPhase)
1830 newPhase = PHASEMASK_NORMAL;
1831
1832 // do not change phase to GM with all phases enabled
1833 if (player->IsGameMaster())
1834 newPhase = PHASEMASK_ANYWHERE;
1835
1836 player->SetPhaseMask(newPhase, false);
1837 player->GetSession()->SendSetPhaseShift(newPhase);
1838 }
1839 else
1840 {
1841 if (!newPhase)
1842 {
1843 newPhase = PHASEMASK_NORMAL;
1844 if (Creature* creature = target->ToCreature())
1845 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
1846 newPhase = data->phaseMask;
1847 }
1848
1849 target->SetPhaseMask(newPhase, false);
1850 }
1851
1852 // call functions which may have additional effects after chainging state of unit
1853 // phase auras normally not expected at BG but anyway better check
1854 if (apply)
1855 {
1856 // drop flag at invisibiliy in bg
1858 }
1859
1860 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1861 if (target->IsVisible())
1862 {
1863 if (!target->GetMap()->Instanceable())
1864 {
1865 target->UpdateObjectVisibility(false);
1866 target->m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f);
1867 }
1868 else
1869 target->UpdateObjectVisibility();
1870 }
1871}
@ PHASEMASK_ANYWHERE
Definition Object.h:63
@ PHASEMASK_NORMAL
Definition Object.h:62
uint32 GetPhaseByAuras() const
Definition Unit.cpp:19280
bool IsVisible() const
Definition Unit.h:1990
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:19291
Position m_last_notify_position
Definition Unit.h:2087
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.
3549{
3550 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3551 return;
3552
3553 Unit* target = aurApp->GetTarget();
3554 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
3555 if (target->IsPlayer() || !apply || target->HasFearAura())
3556 return;
3559 target->SetControlled(false, UNIT_STATE_FLEEING);
3560}
bool HasFearAura() const
Definition Unit.h:1814

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
6186{
6187 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6188 return;
6189
6190 if (!aurApp->GetTarget()->IsPlayer())
6191 return;
6192
6193 if (apply)
6194 aurApp->GetTarget()->RemoveByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
6195 else if (!aurApp->GetTarget()->GetMap()->Instanceable())
6196 aurApp->GetTarget()->SetByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
6197}
@ PLAYER_FIELD_BYTE_RELEASE_TIMER
Definition Player.h:554

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 
)
1185{
1186 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1187 if (prevented)
1188 return;
1189
1190 switch (GetAuraType())
1191 {
1193 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1194 break;
1196 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1197 break;
1199 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1200 break;
1202 HandleRaidProcFromChargeAuraProc(aurApp, eventInfo);
1203 break;
1206 break;
1207 default:
1208 break;
1209 }
1210
1211 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1212}
@ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
Definition SpellAuraDefines.h:288
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
Definition SpellAuraDefines.h:294
@ 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:7291
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7250
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7271
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7339
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7233
bool CallScriptEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2638
void CallScriptAfterEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2657

References Aura::CallScriptAfterEffectProcHandlers(), Aura::CallScriptEffectProcHandlers(), GetAuraType(), GetBase(), HandleProcTriggerDamageAuraProc(), HandleProcTriggerSpellAuraProc(), HandleProcTriggerSpellWithValueAuraProc(), HandleRaidProcFromChargeAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), SPELL_AURA_PROC_TRIGGER_DAMAGE, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_RAID_PROC_FROM_CHARGE, and SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE.

Referenced by Aura::TriggerProcOnEvent().

◆ HandleProcTriggerDamageAuraProc()

void AuraEffect::HandleProcTriggerDamageAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
7272{
7273 Unit* target = aurApp->GetTarget();
7274 Unit* triggerTarget = eventInfo.GetProcTarget();
7275 if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamageOrSchool(GetSpellInfo()))
7276 {
7277 SendTickImmune(triggerTarget, target);
7278 return;
7279 }
7280
7281 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetSpellInfo(), GetSpellInfo()->SchoolMask);
7282 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetEffIndex());
7283 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
7284 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
7285 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
7286 target->SendSpellNonMeleeDamageLog(&damageInfo);
7287 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
7288 target->DealSpellDamage(&damageInfo, true);
7289}
Unit * GetProcTarget() const
Definition Unit.h:448

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

Referenced by HandleProc(), and Unit::ProcDamageAndSpellFor().

◆ HandleProcTriggerSpellAuraProc()

void AuraEffect::HandleProcTriggerSpellAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
7234{
7235 Unit* triggerCaster = aurApp->GetTarget();
7236 Unit* triggerTarget = eventInfo.GetProcTarget();
7237
7238 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
7239 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
7240 {
7241 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
7242 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this);
7243 }
7244 else
7245 {
7246 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());
7247 }
7248}

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

Referenced by HandleProc().

◆ HandleProcTriggerSpellWithValueAuraProc()

void AuraEffect::HandleProcTriggerSpellWithValueAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
7251{
7252 Unit* triggerCaster = aurApp->GetTarget();
7253 Unit* triggerTarget = eventInfo.GetProcTarget();
7254
7255 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
7256 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
7257 {
7258 // used only with EXTRA_LOGS
7259 (void)triggeredSpellInfo;
7260
7261 int32 basepoints0 = GetAmount();
7262 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell {} with value {} from aura {} proc", triggeredSpellInfo->Id, basepoints0, GetId());
7263 triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, nullptr, nullptr, true, nullptr, this);
7264 }
7265 else
7266 {
7267 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());
7268 }
7269}

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

Referenced by HandleProc().

◆ HandleRaidProcFromChargeAuraProc()

void AuraEffect::HandleRaidProcFromChargeAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
7292{
7293 Unit* target = aurApp->GetTarget();
7294
7295 uint32 triggerSpellId;
7296 switch (GetId())
7297 {
7298 case 57949: // Shiver
7299 triggerSpellId = 57952;
7300 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
7301 break;
7302 case 59978: // Shiver
7303 triggerSpellId = 59979;
7304 break;
7305 case 43593: // Cold Stare
7306 triggerSpellId = 43594;
7307 break;
7308 default:
7309 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: {}", GetId());
7310 return;
7311 }
7312
7313 int32 jumps = GetBase()->GetCharges();
7314
7315 // current aura expire on proc finish
7316 GetBase()->SetCharges(0);
7317 GetBase()->SetUsingCharges(true);
7318
7319 // next target selection
7320 if (jumps > 0)
7321 {
7322 if (Unit* caster = GetCaster())
7323 {
7324 float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
7325
7326 if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
7327 {
7328 target->CastSpell(triggerTarget, GetSpellInfo(), true, nullptr, this, GetCasterGUID());
7329 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
7330 aura->SetCharges(jumps);
7331 }
7332 }
7333 }
7334
7335 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
7336 target->CastSpell(target, triggerSpellId, true, nullptr, this, GetCasterGUID());
7337}
void SetUsingCharges(bool val)
Definition SpellAuras.h:202
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition Unit.cpp:11322

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 
)
7340{
7341 Unit* target = aurApp->GetTarget();
7342
7343 // Currently only Prayer of Mending
7344 if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20))
7345 {
7346 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: {}", GetId());
7347 return;
7348 }
7349 uint32 triggerSpellId = 33110;
7350
7351 int32 value = GetAmount();
7352
7353 int32 jumps = GetBase()->GetCharges();
7354
7355 // current aura expire on proc finish
7356 GetBase()->SetCharges(0);
7357 GetBase()->SetUsingCharges(true);
7358
7359 // next target selection
7360 if (jumps > 0)
7361 {
7362 if (Unit* caster = GetCaster())
7363 {
7364 float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
7365
7366 Unit* triggerTarget = nullptr;
7367 Acore::MostHPMissingGroupInRange u_check(target, radius, 0);
7368 Acore::UnitLastSearcher<Acore::MostHPMissingGroupInRange> searcher(target, triggerTarget, u_check);
7369 Cell::VisitObjects(target, searcher, radius);
7370
7371 if (triggerTarget)
7372 {
7373 target->CastCustomSpell(triggerTarget, GetId(), &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
7374 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
7375 aura->SetCharges(jumps);
7376 }
7377 }
7378 }
7379
7380 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
7381 target->CastCustomSpell(target, triggerSpellId, &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
7382}
Definition GridNotifiers.h:1509
Definition GridNotifiers.h:397

References Unit::CastCustomSpell(), 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
5091{
5093 return;
5094
5095 Unit* target = aurApp->GetTarget();
5096
5097 if (!target->IsPlayer())
5098 return;
5099
5100 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
5101}

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
1237{
1238 uint32 spellId = 0;
1239 uint32 spellId2 = 0;
1240 //uint32 spellId3 = 0;
1241 uint32 HotWSpellId = 0;
1242
1243 switch (GetMiscValue())
1244 {
1245 case FORM_CAT:
1246 spellId = 3025;
1247 HotWSpellId = 24900;
1248 break;
1249 case FORM_TREE:
1250 spellId = 34123;
1251 break;
1252 case FORM_TRAVEL:
1253 spellId = 5419;
1254 break;
1255 case FORM_AQUA:
1256 spellId = 5421;
1257 break;
1258 case FORM_BEAR:
1259 spellId = 1178;
1260 spellId2 = 21178;
1261 HotWSpellId = 24899;
1262 break;
1263 case FORM_DIREBEAR:
1264 spellId = 9635;
1265 spellId2 = 21178;
1266 HotWSpellId = 24899;
1267 break;
1268 case FORM_BATTLESTANCE:
1269 spellId = 21156;
1270 break;
1272 spellId = 7376;
1273 break;
1275 spellId = 7381;
1276 break;
1277 case FORM_MOONKIN:
1278 spellId = 24905;
1279 spellId2 = 69366;
1280 break;
1281 case FORM_FLIGHT:
1282 spellId = 33948;
1283 spellId2 = 34764;
1284 break;
1285 case FORM_FLIGHT_EPIC:
1286 spellId = 40122;
1287 spellId2 = 40121;
1288 break;
1289 case FORM_METAMORPHOSIS:
1290 spellId = 54817;
1291 spellId2 = 54879;
1292 break;
1294 spellId = 27792;
1295 spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
1296 break;
1297 case FORM_SHADOW:
1298 spellId = 49868;
1299 spellId2 = 71167;
1300 break;
1301 case FORM_GHOSTWOLF:
1302 spellId = 67116;
1303 break;
1304 case FORM_GHOUL:
1305 case FORM_AMBIENT:
1306 case FORM_STEALTH:
1307 case FORM_CREATURECAT:
1308 case FORM_CREATUREBEAR:
1309 break;
1310 default:
1311 break;
1312 }
1313
1314 Player* player = target->ToPlayer();
1315 if (apply)
1316 {
1317 // Remove cooldown of spells triggered on stance change - they may share cooldown with stance spell
1318 if (spellId)
1319 {
1320 if (player)
1321 player->RemoveSpellCooldown(spellId);
1322 target->CastSpell(target, spellId, true, nullptr, this, target->GetGUID());
1323 }
1324
1325 if (spellId2)
1326 {
1327 if (player)
1328 player->RemoveSpellCooldown(spellId2);
1329 target->CastSpell(target, spellId2, true, nullptr, this, target->GetGUID());
1330 }
1331
1332 if (player)
1333 {
1334 const PlayerSpellMap& sp_list = player->GetSpellMap();
1335 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
1336 {
1337 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(player->GetActiveSpec()))
1338 continue;
1339
1340 if (itr->first == spellId || itr->first == spellId2)
1341 continue;
1342
1343 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1345 continue;
1346
1347 if (spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1348 target->CastSpell(target, itr->first, true, nullptr, this, target->GetGUID());
1349 }
1350
1351 // xinef: talent stance auras are not on m_spells map, so iterate talents
1352 const PlayerTalentMap& tl_list = player->GetTalentMap();
1353 for (PlayerTalentMap::const_iterator itr = tl_list.begin(); itr != tl_list.end(); ++itr)
1354 {
1355 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(player->GetActiveSpec()))
1356 continue;
1357
1358 if (itr->first == spellId || itr->first == spellId2)
1359 continue;
1360
1361 // Xinef: skip talents with effect learn spell
1362 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1364 continue;
1365
1366 if (spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1367 target->CastSpell(target, itr->first, true, nullptr, this, target->GetGUID());
1368 }
1369
1370 // Also do it for Glyphs
1371 for (uint32 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
1372 {
1373 if (uint32 glyphId = player->GetGlyph(i))
1374 {
1375 if (GlyphPropertiesEntry const* glyph = sGlyphPropertiesStore.LookupEntry(glyphId))
1376 {
1377 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(glyph->SpellId);
1379 continue;
1380 if (spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1381 target->CastSpell(target, glyph->SpellId, TriggerCastFlags(TRIGGERED_FULL_MASK & ~(TRIGGERED_IGNORE_SHAPESHIFT | TRIGGERED_IGNORE_CASTER_AURASTATE)), nullptr, this, target->GetGUID());
1382 }
1383 }
1384 }
1385
1386 // Leader of the Pack
1387 if (player->HasTalent(17007, player->GetActiveSpec()))
1388 {
1389 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(24932);
1390 if (spellInfo && spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1391 target->CastSpell(target, 24932, true, nullptr, this, target->GetGUID());
1392 }
1393 // Improved Barkskin - apply/remove armor bonus due to shapeshift
1394 if (player->HasTalent(63410, player->GetActiveSpec()) || player->HasTalent(63411, player->GetActiveSpec()))
1395 {
1396 target->RemoveAurasDueToSpell(66530);
1397 if (GetMiscValue() == FORM_TRAVEL || GetMiscValue() == FORM_NONE) // "while in Travel Form or while not shapeshifted"
1398 target->CastSpell(target, 66530, true);
1399 }
1400 // Heart of the Wild
1401 if (HotWSpellId)
1402 {
1403 // hacky, but the only way as spell family is not SPELLFAMILY_DRUID
1405 for (Unit::AuraEffectList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i)
1406 {
1407 // Heart of the Wild
1408 if ((*i)->GetSpellInfo()->SpellIconID == 240 && (*i)->GetMiscValue() == STAT_INTELLECT)
1409 {
1410 int32 HotWMod = (*i)->GetAmount() / 2; // For each 2% Intelligence, you get 1% stamina and 1% attack power.
1411
1412 target->CastCustomSpell(target, HotWSpellId, &HotWMod, nullptr, nullptr, true, nullptr, this, target->GetGUID());
1413 break;
1414 }
1415 }
1416 }
1417 switch (GetMiscValue())
1418 {
1419 case FORM_CAT:
1420 // Savage Roar
1421 if (target->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, 0, 0x10000000, 0))
1422 target->CastSpell(target, 62071, true);
1423 // Nurturing Instinct
1425 {
1426 uint32 spellId3 = 0;
1427 switch (aurEff->GetId())
1428 {
1429 case 33872:
1430 spellId3 = 47179;
1431 break;
1432 case 33873:
1433 spellId3 = 47180;
1434 break;
1435 }
1436 target->CastSpell(target, spellId3, true, nullptr, this, target->GetGUID());
1437 }
1438 // Master Shapeshifter - Cat
1439 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1440 {
1441 int32 bp = aurEff->GetAmount();
1442 target->CastCustomSpell(target, 48420, &bp, nullptr, nullptr, true);
1443 }
1444 break;
1445 case FORM_DIREBEAR:
1446 case FORM_BEAR:
1447 // Master Shapeshifter - Bear
1448 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1449 {
1450 int32 bp = aurEff->GetAmount();
1451 target->CastCustomSpell(target, 48418, &bp, nullptr, nullptr, true);
1452 }
1453 // Survival of the Fittest
1455 {
1456 int32 bp = aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue();
1457 target->CastCustomSpell(target, 62069, &bp, nullptr, nullptr, true, 0, this, target->GetGUID());
1458 }
1459 break;
1460 case FORM_MOONKIN:
1461 // Master Shapeshifter - Moonkin
1462 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1463 {
1464 int32 bp = aurEff->GetAmount();
1465 target->CastCustomSpell(target, 48421, &bp, nullptr, nullptr, true);
1466 }
1467 // Always cast Moonkin Aura
1468 target->CastSpell(target, 24907, true, nullptr, this, target->GetGUID());
1469 break;
1470 // Master Shapeshifter - Tree of Life
1471 case FORM_TREE:
1472 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1473 {
1474 int32 bp = aurEff->GetAmount();
1475 target->CastCustomSpell(target, 48422, &bp, nullptr, nullptr, true);
1476 }
1477 break;
1478 }
1479 }
1480 }
1481 else
1482 {
1483 if (spellId)
1484 target->RemoveOwnedAura(spellId);
1485 if (spellId2)
1486 target->RemoveOwnedAura(spellId2);
1487
1488 // Improved Barkskin - apply/remove armor bonus due to shapeshift
1489 if (player)
1490 {
1491 if (player->HasTalent(63410, player->GetActiveSpec()) || player->HasTalent(63411, player->GetActiveSpec()))
1492 {
1493 target->RemoveAurasDueToSpell(66530);
1494 target->CastSpell(target, 66530, true);
1495 }
1496 }
1497
1499 AuraEffect* newAura = nullptr;
1500 // 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
1501 for (Unit::AuraEffectList::const_iterator itr = shapeshifts.begin(); itr != shapeshifts.end(); ++itr)
1502 {
1503 if ((*itr) != this)
1504 {
1505 newAura = *itr;
1506 break;
1507 }
1508 }
1509
1510 // Use the new aura to see on what stance the target will be
1511 uint32 newStance = (1 << ((newAura ? newAura->GetMiscValue() : 0) - 1));
1512
1513 Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
1514 for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
1515 {
1516 // If the stances are not compatible with the spell, remove it
1517 // Xinef: Remove all passive auras, they will be added if needed
1518 if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && (!(itr->second->GetBase()->GetSpellInfo()->Stances & newStance) || itr->second->GetBase()->IsPassive()))
1519 target->RemoveAura(itr);
1520 else
1521 ++itr;
1522 }
1523
1524 // Xinef: Remove autoattack spells
1525 if (Spell* spell = target->GetCurrentSpell(CURRENT_MELEE_SPELL))
1526 if (spell->GetSpellInfo()->CheckShapeshift(newAura ? newAura->GetMiscValue() : 0) != SPELL_CAST_OK)
1527 spell->cancel(true);
1528 }
1529}
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
@ EFFECT_2
Definition SharedDefines.h:33
@ SPELL_EFFECT_LEARN_SPELL
Definition SharedDefines.h:825
#define MAX_GLYPH_SLOT_INDEX
Definition SharedDefines.h:687
SpellAttr0
Definition SharedDefines.h:392
@ SPELL_ATTR0_PASSIVE
Definition SharedDefines.h:399
@ SPELL_ATTR0_DO_NOT_DISPLAY
Definition SharedDefines.h:400
@ STAT_INTELLECT
Definition SharedDefines.h:272
@ SPELL_CAST_OK
Definition SharedDefines.h:1149
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67
@ 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:1762
bool HasTalent(uint32 spell_id, uint8 spec) const
Definition Player.cpp:3892
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:3530
uint32 Stances
Definition SpellInfo.h:333
bool HasEffect(SpellEffects effect) const
Definition SpellInfo.cpp:876
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4824
Definition DBCStructure.h:1022

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
5296{
5298 return;
5299
5300 Player* target = aurApp->GetTarget()->ToPlayer();
5301 if (!target)
5302 return;
5303
5304 target->HandleBaseModFlatValue(SHIELD_BLOCK_VALUE, float(GetAmount()), apply);
5305}
@ SHIELD_BLOCK_VALUE
Definition Unit.h:190
void HandleBaseModFlatValue(BaseModGroup modGroup, float amount, bool apply)
Definition Player.cpp:5008

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
5308{
5310 return;
5311
5312 Player* target = aurApp->GetTarget()->ToPlayer();
5313 if (!target)
5314 return;
5315
5316 if (apply)
5318 else
5319 {
5321 target->SetBaseModPctValue(SHIELD_BLOCK_VALUE, amount);
5322 }
5323}
@ SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
Definition SpellAuraDefines.h:213
void SetBaseModPctValue(BaseModGroup modGroup, float val)
Definition Player.cpp:5043
void ApplyBaseModPctValue(BaseModGroup modGroup, float pct)
Definition Player.cpp:5021

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
1756{
1757 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1758 return;
1759
1760 Unit* target = aurApp->GetTarget();
1761
1762 if (!target->IsPlayer())
1763 return;
1764
1765 // prepare spirit state
1766 if (apply)
1767 {
1768 // disable breath/etc timers
1769 target->ToPlayer()->StopMirrorTimers();
1770
1771 // set stand state (expected in this form)
1772 if (!target->IsStandState())
1774
1775 target->SetHealth(1);
1776 }
1777 // die at aura end
1778 else if (target->IsAlive())
1779 // call functions which may have additional effects after chainging state of unit
1781
1782 // xinef: damage immunity spell, not needed because of 93 aura (adds non_attackable state)
1783 // xinef: probably blizzard added it just in case in wotlk (id > 46000)
1784 if (apply)
1785 target->CastSpell(target, 62371, true);
1786 else
1787 target->RemoveAurasDueToSpell(62371);
1788}
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:32
void StopMirrorTimers()
Definition Player.h:2054
virtual void setDeathState(DeathState s, bool despawn=false)
Definition Unit.cpp:14658
bool IsStandState() const
Definition Unit.cpp:16938
void SetStandState(uint8 state)
Definition Unit.cpp:16953

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
156 {
157 // useless
158 }

◆ HandleWaterBreathing()

void AuraEffect::HandleWaterBreathing ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3414{
3416 return;
3417
3418 Unit* target = aurApp->GetTarget();
3419
3420 // update timers in client
3421 if (target->IsPlayer())
3422 target->ToPlayer()->UpdateMirrorTimers();
3423}
void UpdateMirrorTimers()
Definition PlayerUpdates.cpp:429

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

◆ HasSpellClassMask()

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

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

Referenced by Unit::CalcArmorReducedDamage().

◆ IsAffectedOnSpell()

bool AuraEffect::IsAffectedOnSpell ( SpellInfo const *  spell) const
1093{
1094 if (!spell)
1095 return false;
1096 // Check family name
1097 if (spell->SpellFamilyName != m_spellInfo->SpellFamilyName)
1098 return false;
1099
1100 // Check EffectClassMask
1101 if (m_spellInfo->Effects[m_effIndex].SpellClassMask & spell->SpellFamilyFlags)
1102 return true;
1103 return false;
1104}

References SpellInfo::Effects, m_effIndex, m_spellInfo, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by Unit::CalcArmorReducedDamage(), Unit::GetMaxNegativeAuraModifierByAffectMask(), Unit::GetMaxPositiveAuraModifierByAffectMask(), Unit::GetTotalAuraModifierByAffectMask(), Unit::GetTotalAuraMultiplierByAffectMask(), Unit::MeleeDamageBonusTaken(), Unit::SpellDamageBonusTaken(), and Unit::SpellHealingBonusTaken().

◆ 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
1118{
1119 bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
1120 if (prevented)
1121 return;
1122
1123 Unit* target = aurApp->GetTarget();
1124
1125 // Update serverside orientation of tracking channeled auras on periodic update ticks
1126 // exclude players because can turn during channeling and shouldn't desync orientation client/server
1128 {
1129 ObjectGuid const channelGuid = caster->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT);
1130 if (!channelGuid.IsEmpty() && channelGuid != caster->GetGUID())
1131 {
1132 if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*caster, channelGuid))
1133 {
1134 caster->SetInFront(objectTarget);
1135 }
1136 }
1137 }
1138
1139 switch (GetAuraType())
1140 {
1142 HandlePeriodicDummyAuraTick(target, caster);
1143 break;
1145 HandlePeriodicTriggerSpellAuraTick(target, caster);
1146 break;
1148 // Don't actually do anything - client will trigger casts of these spells by itself
1149 break;
1152 break;
1155 HandlePeriodicDamageAurasTick(target, caster);
1156 break;
1158 HandlePeriodicHealthLeechAuraTick(target, caster);
1159 break;
1161 HandlePeriodicHealthFunnelAuraTick(target, caster);
1162 break;
1165 HandlePeriodicHealAurasTick(target, caster);
1166 break;
1168 HandlePeriodicManaLeechAuraTick(target, caster);
1169 break;
1171 HandleObsModPowerAuraTick(target, caster);
1172 break;
1174 HandlePeriodicEnergizeAuraTick(target, caster);
1175 break;
1177 HandlePeriodicPowerBurnAuraTick(target, caster);
1178 break;
1179 default:
1180 break;
1181 }
1182}
@ SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL
Definition SharedDefines.h:444
void HandlePeriodicPowerBurnAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:7186
void HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:7045
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:7118
void HandlePeriodicHealthFunnelAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6862
void HandlePeriodicHealAurasTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6891
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:7152
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6290
void HandlePeriodicDummyAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6199
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6754
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6592
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6558
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
Definition SpellAuras.cpp:2407
bool IsEmpty() const
Definition ObjectGuid.h:161
bool IsChanneled() const
Definition SpellInfo.cpp:1256
void SetInFront(WorldObject const *target)
Definition Unit.cpp:20485
Definition Object.h:471
WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:115

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

Referenced by Update().

◆ RecalculateAmount() [1/2]

◆ RecalculateAmount() [2/2]

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

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

◆ ResetPeriodic()

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

References m_amplitude, m_periodicTimer, and m_tickNumber.

Referenced by Unit::HandleAuraProc().

◆ 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
109{ m_critChance = crit; }

References m_critChance.

Referenced by CalculatePeriodicData().

◆ SetEnabled()

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

References m_isAuraEnabled.

◆ SetOldAmount()

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

References m_oldAmount.

Referenced by CalculateAmount().

◆ SetPctMods()

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

References m_pctMods.

◆ SetPeriodic()

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

References m_isPeriodic.

◆ SetPeriodicTimer()

◆ Update()

void AuraEffect::Update ( uint32  diff,
Unit caster 
)
913{
914 if (m_isPeriodic && (GetBase()->GetDuration() >= 0 || GetBase()->IsPassive() || GetBase()->IsPermanent()))
915 {
916 uint32 totalTicks = GetTotalTicks();
917
918 m_periodicTimer -= int32(diff);
919 while (m_periodicTimer <= 0)
920 {
921 if (!GetBase()->IsPermanent() && (m_tickNumber + 1) > totalTicks)
922 {
923 break;
924 }
925
926 ++m_tickNumber;
927
928 // update before tick (aura can be removed in TriggerSpell or PeriodicTick calls)
930 UpdatePeriodic(caster);
931
932 std::list<AuraApplication*> effectApplications;
933 GetApplicationList(effectApplications);
934 // tick on targets of effects
935 for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
936 if ((*apptItr)->HasEffect(GetEffIndex()))
937 PeriodicTick(*apptItr, caster);
938 }
939 }
940}
void PeriodicTick(AuraApplication *aurApp, Unit *caster) const
Definition SpellAuraEffects.cpp:1117
void UpdatePeriodic(Unit *caster)
Definition SpellAuraEffects.cpp:942

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

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

◆ 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_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: