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
 
uint32 GetAuraGroup () const
 
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 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
 
uint32 m_auraGroup
 
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:138
SpellModifier * m_spellmod
Definition SpellAuraEffects.h:140

References m_channelData, and m_spellmod.

◆ AuraEffect()

AuraEffect::AuraEffect ( Aura base,
uint8  effIndex,
int32 baseAmount,
Unit caster 
)
explicitprivate
383 :
384 m_base(base), m_spellInfo(base->GetSpellInfo()),
385 m_baseAmount(baseAmount ? * baseAmount : m_spellInfo->Effects[effIndex].BasePoints), m_dieSides(m_spellInfo->Effects[effIndex].DieSides),
386 m_critChance(0), m_oldAmount(0), m_isAuraEnabled(true), m_channelData(nullptr), m_spellmod(nullptr), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex),
388{
389 CalculatePeriodic(caster, true, false);
391
392 m_amount = CalculateAmount(caster);
393 m_casterLevel = caster ? caster->GetLevel() : 0;
394 m_applyResilience = caster && caster->CanApplyResilience();
395 m_auraGroup = sSpellMgr->GetSpellGroup(GetId());
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}
#define sSpellMgr
Definition SpellMgr.h:825
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:539
@ UNIT_FIELD_CHANNEL_OBJECT
Definition UpdateFields.h:93
int32 m_periodicTimer
Definition SpellAuraEffects.h:142
bool m_canBeRecalculated
Definition SpellAuraEffects.h:147
uint8 const m_effIndex
Definition SpellAuraEffects.h:146
uint8 m_casterLevel
Definition SpellAuraEffects.h:128
bool m_applyResilience
Definition SpellAuraEffects.h:127
void CalculatePeriodic(Unit *caster, bool create=false, bool load=false)
Definition SpellAuraEffects.cpp:598
void CalculateSpellMod()
Definition SpellAuraEffects.cpp:689
int32 m_oldAmount
Definition SpellAuraEffects.h:135
uint32 GetId() const
Definition SpellAuraEffects.cpp:432
int32 CalculateAmount(Unit *caster)
Definition SpellAuraEffects.cpp:452
int32 m_amount
Definition SpellAuraEffects.h:129
void CalculatePeriodicData()
Definition SpellAuraEffects.cpp:583
uint32 m_tickNumber
Definition SpellAuraEffects.h:144
int32 const m_baseAmount
Definition SpellAuraEffects.h:124
SpellInfo const *const m_spellInfo
Definition SpellAuraEffects.h:123
bool m_isAuraEnabled
Definition SpellAuraEffects.h:136
bool m_isPeriodic
Definition SpellAuraEffects.h:148
uint32 m_auraGroup
Definition SpellAuraEffects.h:134
int32 const m_dieSides
Definition SpellAuraEffects.h:125
float m_critChance
Definition SpellAuraEffects.h:130
Aura *const m_base
Definition SpellAuraEffects.h:121
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:100
ObjectGuid GetGuidValue(uint16 index) const
Definition Object.cpp:337
Definition Spell.h:287
bool CanApplyResilience() const
Definition Unit.h:1102
uint8 GetLevel() const
Definition Unit.h:1033
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1502
Definition Spell.h:244

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

Member Function Documentation

◆ ApplySpellMod()

void AuraEffect::ApplySpellMod ( Unit target,
bool  apply 
)
805{
806 if (!m_spellmod || !target->IsPlayer())
807 return;
808
809 target->ToPlayer()->AddSpellMod(m_spellmod, apply);
810
811 // Auras with charges do not mod amount of passive auras
812 if (GetBase()->IsUsingCharges())
813 return;
814 // reapply some passive spells after add/remove related spellmods
815 // Warning: it is a dead loop if 2 auras each other amount-shouldn't happen
816 switch (GetMiscValue())
817 {
819 case SPELLMOD_EFFECT1:
820 case SPELLMOD_EFFECT2:
821 case SPELLMOD_EFFECT3:
822 {
823 ObjectGuid guid = target->GetGUID();
824 Unit::AuraApplicationMap& auras = target->GetAppliedAuras();
825 for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
826 {
827 Aura* aura = iter->second->GetBase();
828 // only passive and permament auras-active auras should have amount set on spellcast and not be affected
829 // if aura is casted by others, it will not be affected
830 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == guid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
831 {
833 {
834 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
835 {
836 if (AuraEffect* aurEff = aura->GetEffect(i))
837 aurEff->RecalculateAmount();
838 }
839 }
840 else if (GetMiscValue() == SPELLMOD_EFFECT1)
841 {
842 if (AuraEffect* aurEff = aura->GetEffect(0))
843 aurEff->RecalculateAmount();
844 }
845 else if (GetMiscValue() == SPELLMOD_EFFECT2)
846 {
847 if (AuraEffect* aurEff = aura->GetEffect(1))
848 aurEff->RecalculateAmount();
849 }
850 else //if (modOp == SPELLMOD_EFFECT3)
851 {
852 if (AuraEffect* aurEff = aura->GetEffect(2))
853 aurEff->RecalculateAmount();
854 }
855 }
856 }
857
858 Pet* pet = target->ToPlayer()->GetPet();
859 if (!pet)
860 break;
861
862 ObjectGuid petguid = pet->GetGUID();
863 Unit::AuraApplicationMap& petauras = pet->GetAppliedAuras();
864 for (Unit::AuraApplicationMap::iterator iter = petauras.begin(); iter != petauras.end(); ++iter)
865 {
866 Aura* aura = iter->second->GetBase();
867 // only passive auras-active auras should have amount set on spellcast and not be affected
868 // if aura is casted by others, it will not be affected
869 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == petguid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
870 {
872 {
873 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
874 {
875 if (AuraEffect* aurEff = aura->GetEffect(i))
876 aurEff->RecalculateAmount();
877 }
878 }
879 else if (GetMiscValue() == SPELLMOD_EFFECT1)
880 {
881 if (AuraEffect* aurEff = aura->GetEffect(0))
882 aurEff->RecalculateAmount();
883 }
884 else if (GetMiscValue() == SPELLMOD_EFFECT2)
885 {
886 if (AuraEffect* aurEff = aura->GetEffect(1))
887 aurEff->RecalculateAmount();
888 }
889 else //if (modOp == SPELLMOD_EFFECT3)
890 {
891 if (AuraEffect* aurEff = aura->GetEffect(2))
892 aurEff->RecalculateAmount();
893 }
894 }
895 }
896 }
897 default:
898 break;
899 }
900}
#define MAX_SPELL_EFFECTS
Definition DBCStructure.h:1636
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:175
bool IsPassive() const
Definition SpellAuras.cpp:1082
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:112
Definition Pet.h:41
Pet * GetPet() const
Definition Player.cpp:8968
void AddSpellMod(SpellModifier *mod, bool apply)
Definition Player.cpp:9948
bool IsAffectedBySpellMod(SpellModifier const *mod) const
Definition SpellInfo.cpp:1293
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:645
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1313

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
1050{
1051 float critChance = 0.0f;
1052 if (caster)
1053 {
1054 if (Player* modOwner = caster->GetSpellModOwner())
1055 {
1056 Unit::AuraEffectList const& mPeriodicCritAuras = modOwner->GetAuraEffectsByType(SPELL_AURA_ABILITY_PERIODIC_CRIT);
1057 for (Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr)
1058 {
1059 if ((*itr)->IsAffectedOnSpell(GetSpellInfo()))
1060 {
1061 critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), (GetSpellInfo()->DmgClass == SPELL_DAMAGE_CLASS_RANGED ? RANGED_ATTACK : BASE_ATTACK), true);
1062 break;
1063 }
1064 }
1065
1066 switch (GetSpellInfo()->SpellFamilyName)
1067 {
1068 // Rupture - since 3.3.3 can crit
1069 case SPELLFAMILY_ROGUE:
1070 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100000)
1071 critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), BASE_ATTACK, true);
1072 break;
1073 }
1074 }
1075 }
1076 if (target && critChance > 0.0f)
1077 critChance = target->SpellTakenCritChance(caster, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), critChance, BASE_ATTACK, true);
1078
1079 return std::max(0.0f, critChance);
1080}
@ SPELL_DAMAGE_CLASS_RANGED
Definition SharedDefines.h:1548
@ SPELLFAMILY_ROGUE
Definition SharedDefines.h:3536
@ SPELL_AURA_ABILITY_PERIODIC_CRIT
Definition SpellAuraDefines.h:349
@ BASE_ATTACK
Definition Unit.h:209
@ RANGED_ATTACK
Definition Unit.h:211
SpellInfo const * GetSpellInfo() const
Definition SpellAuraEffects.h:54
Definition Player.h:1081
flag96 SpellFamilyFlags
Definition SpellInfo.h:388
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1987
uint32 DmgClass
Definition SpellInfo.h:389
uint32 SpellFamilyName
Definition SpellInfo.h:387
Player * GetSpellModOwner() const
Definition Unit.cpp:16629
std::list< AuraEffect * > AuraEffectList
Definition Unit.h:652

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:1837
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition DBCStructure.h:1203
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:1636
@ 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:210
@ DOT
Definition Unit.h:250
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:249
T AddPct(T &base, U pct)
Definition Util.h:67
void SetOldAmount(int32 amount)
Definition SpellAuraEffects.h:117
AuraType GetAuraType() const
Definition SpellAuraEffects.cpp:447
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:2517
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:523
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition PlayerStorage.cpp:488
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:1358
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:12497
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:11660
Definition DBCStructure.h:1216
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > AllocationPct
Definition DBCStructure.h:1223
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
Definition DBCStructure.h:1221
uint32 InventoryType
Definition ItemTemplate.h:632
Definition DBCStructure.h:1840
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1846

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:576
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition SharedDefines.h:580
@ 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:143
int32 GetDuration() const
Definition SpellAuras.h:133
void SetDuration(int32 duration, bool withMods=false)
Definition SpellAuras.cpp:868
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
Definition SpellAuras.cpp:2531
float GetFloatValue(uint16 index) const
Definition Object.cpp:317
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
Definition Player.cpp:9790
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:415
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition Unit.cpp:5793
bool IsTotem() const
Definition Unit.h:765

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:1049
float m_pctMods
Definition SpellAuraEffects.h:131
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:12405
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:11329

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;
704 }
706 break;
707 default:
708 break;
709 }
711}
SpellModType
Definition Player.h:92
@ 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:2545
uint8 GetCharges() const
Definition SpellAuras.h:141
Definition Player.h:181
int16 charges
Definition Player.h:185
SpellModOp op
Definition Player.h:183
SpellModType type
Definition Player.h:184
int32 value
Definition Player.h:186
uint32 spellId
Definition Player.h:188
flag96 mask
Definition Player.h:187

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

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

◆ CanApplyResilience()

bool AuraEffect::CanApplyResilience ( ) const
inline

◆ CanBeRecalculated()

bool AuraEffect::CanBeRecalculated ( ) const
inline

◆ ChangeAmount()

void AuraEffect::ChangeAmount ( int32  newAmount,
bool  mark = true,
bool  onStackOrReapply = false 
)
714{
715 // Reapply if amount change
716 uint8 handleMask = 0;
717 if (newAmount != GetAmount())
719 if (onStackOrReapply)
720 handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
721
722 if (!handleMask)
723 return;
724
725 std::list<AuraApplication*> effectApplications;
726 GetApplicationList(effectApplications);
727
728 for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
729 if ((*apptItr)->HasEffect(GetEffIndex()))
730 HandleEffect(*apptItr, handleMask, false);
731
732 if (handleMask & AURA_EFFECT_HANDLE_CHANGE_AMOUNT)
733 {
734 if (!mark)
735 m_amount = newAmount;
736 else
737 SetAmount(newAmount);
739 }
740
741 for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
742 if ((*apptItr)->HasEffect(GetEffIndex()))
743 HandleEffect(*apptItr, handleMask, true);
744}
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT
Definition SpellAuraDefines.h:44
@ AURA_EFFECT_HANDLE_REAPPLY
Definition SpellAuraDefines.h:45
void GetApplicationList(std::list< AuraApplication * > &applicationList) const
Definition SpellAuraEffects.cpp:422
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
Definition SpellAuraEffects.cpp:746
void SetAmount(int32 amount)
Definition SpellAuraEffects.h:66

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT, AURA_EFFECT_HANDLE_REAPPLY, 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?
1205{
1206 uint32 tSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1207 if (!tSpellId)
1208 return;
1209
1210 SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
1211 if (!tProto)
1212 return;
1213
1214 if (tProto->GetDuration() != -1)
1215 return;
1216
1217 // needed for spell 43680, maybe others
1221 return;
1222
1223 target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
1224}
ObjectGuid GetCasterGUID() const
Definition SpellAuraEffects.h:48
Definition SpellInfo.h:316
int32 GetDuration() const
Definition SpellInfo.cpp:2338
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4941

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 Player::_ApplyWeaponDependentAuraCritMod(), Player::_ApplyWeaponDependentAuraDamageMod(), 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(), CalculateSpellMod(), ChangeAmount(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), spell_nether_portal_perseverence::HandleApply(), spell_warl_glyph_of_felguard::HandleApply(), spell_warl_glyph_of_voidwalker::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(), HandleAuraModWeaponCritPercent(), 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(), HandleModDamagePercentDone(), HandleModHitChance(), HandleModInvisibility(), HandleModInvisibilityDetect(), HandleModMeleeRangedSpeedPct(), HandleModMeleeSpeedPct(), HandleModOffhandDamagePercent(), HandleModPowerCost(), HandleModPowerCostPCT(), HandleModRating(), HandleModResistancePercent(), HandleModSpellCritChance(), HandleModSpellHitChance(), HandleModStateImmunityMask(), HandleModStealth(), HandleModStealthDetect(), HandleModStealthLevel(), HandleModTargetResistance(), HandleModThreat(), HandleModTotalPercentStat(), 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(), spell_warl_glyph_of_felguard::HandleRemove(), spell_warl_glyph_of_voidwalker::HandleRemove(), HandleShieldBlockValue(), spell_hun_sniper_training::HandleUpdatePeriodic(), Aura::IsAuraStronger(), 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(), spell_black_temple_shadow_inferno_aura::Update(), spell_black_temple_spell_absorption_aura::Update(), Player::UpdateAttackPowerAndDamage(), UpdatePeriodic(), 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:181
std::map< ObjectGuid, AuraApplication * > ApplicationMap
Definition SpellAuras.h:90

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

Referenced by ChangeAmount(), and Update().

◆ GetAuraGroup()

uint32 AuraEffect::GetAuraGroup ( ) const
inline
115{ return m_auraGroup; }

References m_auraGroup.

Referenced by AuraApplication::_HandleEffect().

◆ 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 Player::_ApplyWeaponDependentAuraDamageMod(), 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_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(), 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(), HandleShieldBlockValue(), 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 AuraApplication::_HandleEffect(), 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(), spell_hor_shared_suffering_aura::OnRemove(), PeriodicTick(), Spell::prepare(), Unit::ProcDamageAndSpellFor(), Player::RestoreBaseRune(), 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 AuraApplication::_HandleEffect(), 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_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()

uint32 AuraEffect::GetId ( ) const
433{
434 return m_spellInfo->Id;
435}

References SpellInfo::Id, and m_spellInfo.

Referenced by AuraEffect(), CalculateAmount(), CalculatePeriodic(), CalculateSpellMod(), Unit::CastDelayedSpellWithPeriodicAmount(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), HandleAuraControlVehicle(), HandleAuraDummy(), HandleAuraModDmgImmunity(), HandleAuraModEffectImmunity(), HandleAuraModIncreaseFlightSpeed(), HandleAuraModSchoolImmunity(), HandleAuraModShapeshift(), HandleAuraModStat(), HandleAuraModStateImmunity(), Aura::HandleAuraSpecificMods(), HandleAuraTransform(), spell_ignis_scorch_aura::HandleEffectPeriodic(), spell_ulduar_energy_sap_aura::HandleEffectPeriodic(), HandleModMechanicImmunity(), HandleModStateImmunityMask(), HandleModTotalPercentStat(), HandleObsModPowerAuraTick(), HandlePeriodicDamageAurasTick(), HandlePeriodicDummyAuraTick(), HandlePeriodicEnergizeAuraTick(), HandlePeriodicHealAurasTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicManaLeechAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandlePeriodicTriggerSpellWithValueAuraTick(), spell_warl_demonic_pact_aura::HandleProc(), HandleProcTriggerDamageAuraProc(), Unit::HandleProcTriggerSpell(), HandleProcTriggerSpellAuraProc(), HandleProcTriggerSpellWithValueAuraProc(), HandleRaidProcFromChargeAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), spell_eredar_twins_handle_touch_periodic::OnPeriodic(), spell_brewfest_ram_fatigue::PrepareAuraScript(), Unit::ProcDamageAndSpellFor(), Unit::SendPeriodicAuraLog(), and UpdatePeriodic().

◆ 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 Player::_ApplyWeaponDependentAuraDamageMod(), AuraApplication::_HandleEffect(), ApplySpellMod(), Unit::CalcAbsorbResist(), CalculateSpellMod(), Unit::GetMaxPositiveAuraModifierByMiscMask(), 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::ProcDamageAndSpellFor(), and Unit::SendPeriodicAuraLog().

◆ GetMiscValueB()

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

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

Referenced by HandleAuraConvertRune(), and HandleModPowerRegen().

◆ GetOldAmount()

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

References m_oldAmount.

Referenced by Unit::CastDelayedSpellWithPeriodicAmount().

◆ GetPctMods()

float AuraEffect::GetPctMods ( ) const
inline

◆ GetPeriodicTimer()

int32 AuraEffect::GetPeriodicTimer ( ) const
inline

◆ GetSpellInfo()

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

References m_spellInfo.

Referenced by Player::_ApplyWeaponDependentAuraCritMod(), Player::_ApplyWeaponDependentAuraDamageMod(), AuraApplication::_HandleEffect(), spell_dragonblight_corrosive_spit::AfterApply(), Unit::CalcAbsorbResist(), 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(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), HandleAuraDummy(), HandleAuraModEffectImmunity(), HandleAuraModSchoolImmunity(), HandleAuraModShapeshift(), HandleAuraModStateImmunity(), HandleAuraModWeaponCritPercent(), HandleAuraMounted(), Unit::HandleAuraRaidProcFromCharge(), Unit::HandleAuraRaidProcFromChargeWithValue(), HandleAuraTransform(), HandleChannelDeathItem(), spell_dk_raise_ally::HandleDummy(), Unit::HandleDummyAuraProc(), spell_dru_idol_lifebloom::HandleEffectCalcSpellMod(), spell_optic_link_aura::HandleEffectPeriodic(), HandleModDamageDone(), HandleModDamagePercentDone(), 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(), 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(), Player::UpdateAttackPowerAndDamage(), 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
5357{
5358 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5359 return;
5360
5361 Unit* target = aurApp->GetTarget();
5362
5363 if (apply)
5365 else
5366 {
5367 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5368 if (target->HasAuraType(GetAuraType()))
5369 return;
5371 }
5372}
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
@ UNIT_FLAG_PREPARATION
Definition UnitDefines.h:255
Definition Unit.h:636
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:5760
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:719
ObjectGuid GetTarget() const
Definition Unit.h:827
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:720

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
3311{
3313 return;
3314
3315 Unit* target = aurApp->GetTarget();
3316
3317 if (!apply)
3318 {
3319 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3320 if (target->HasAuraType(GetAuraType()) || target->HasIncreaseMountedFlightSpeedAura())
3321 return;
3322 }
3323
3324 target->SetCanFly(apply);
3325
3326 if (!apply && target->IsCreature() && !target->IsLevitating())
3327 target->GetMotionMaster()->MoveFall();
3328}
@ 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:627
bool IsCreature() const
Definition Object.h:204
MotionMaster * GetMotionMaster()
Definition Unit.h:1673
bool IsLevitating() const
Definition Unit.h:1626
virtual bool SetCanFly(bool enable, bool packetOnly=false)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:20661
bool HasIncreaseMountedFlightSpeedAura() const
Definition Unit.h:1744

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
3089{
3091 return;
3092
3093 Unit* target = aurApp->GetTarget();
3094
3095 if (target->IsPlayer())
3096 {
3097 if (apply)
3099 else
3100 {
3101 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3102 if (target->HasAllowOnlyAbilityAura())
3103 return;
3105 }
3106 }
3107}
@ PLAYER_ALLOW_ONLY_ABILITY
Definition Player.h:502
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:1126
void RemovePlayerFlag(PlayerFlags flags)
Definition Player.h:1127
bool HasAllowOnlyAbilityAura() const
Definition Unit.h:1732

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
2785{
2787 return;
2788
2789 Unit* target = aurApp->GetTarget();
2790
2791 if (apply)
2792 {
2793 Unit* caster = GetCaster();
2794 if (!caster || caster == target)
2795 return;
2796
2797 // What must be cloned? at least display and scale
2798 target->SetDisplayId(caster->GetDisplayId());
2800 }
2801 else
2802 {
2803 target->SetDisplayId(target->GetNativeDisplayId());
2805 }
2806}
@ UNIT_FLAG2_MIRROR_IMAGE
Definition UnitDefines.h:293
virtual void SetDisplayId(uint32 modelId, float displayScale=1.f)
Definition Unit.cpp:16814
void SetUnitFlag2(UnitFlags2 flags)
Definition Unit.h:725
uint32 GetDisplayId() const
Definition Unit.h:1887
uint32 GetNativeDisplayId() const
Definition Unit.h:1889
void RemoveUnitFlag2(UnitFlags2 flags)
Definition Unit.h:726

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

3655{
3657 return;
3658
3659 Unit* target = aurApp->GetTarget();
3660
3661 if (!target->IsVehicle())
3662 return;
3663
3664 Unit* caster = GetCaster();
3665
3666 if (!caster || caster == target)
3667 return;
3668
3669 if (apply)
3670 {
3671 // Currently spells that have base points 0 and DieSides 0 = "0/0" exception are pushed to -1,
3672 // however the idea of 0/0 is to ingore flag VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT and -1 checks for it,
3673 // so this break such spells or most of them.
3674 // Current formula about m_amount: effect base points + dieside - 1
3675 // TO DO: Reasearch more about 0/0 and fix it.
3676 caster->_EnterVehicle(target->GetVehicleKit(), m_amount - 1, aurApp);
3677 }
3678 else
3679 {
3680 if (GetId() == 53111) // Devour Humanoid
3681 {
3682 Unit::Kill(target, caster);
3683 if (caster->IsCreature())
3684 caster->ToCreature()->RemoveCorpse();
3685 }
3686
3687 caster->_ExitVehicle();
3688 // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
3689 caster->RemoveAurasDueToSpell(GetId());
3690 }
3691}
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK
Definition SpellAuraDefines.h:49
void RemoveCorpse(bool setSpawnTime=true, bool skipVisibility=false)
Definition Creature.cpp:403
Creature * ToCreature()
Definition Object.h:205
bool IsVehicle() const
Definition Unit.h:766
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:17754
void _ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:19824
void _EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:19706
Vehicle * GetVehicleKit() const
Definition Unit.h:1838

References Unit::_EnterVehicle(), Unit::_ExitVehicle(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetCaster(), GetId(), AuraApplication::GetTarget(), Unit::GetVehicleKit(), Object::IsCreature(), Unit::IsVehicle(), Unit::Kill(), m_amount, Unit::RemoveAurasDueToSpell(), Creature::RemoveCorpse(), and Object::ToCreature().

◆ HandleAuraConvertRune()

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

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

◆ HandleAuraEmpathy()

void AuraEffect::HandleAuraEmpathy ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5968{
5969 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5970 return;
5971
5972 Unit* target = aurApp->GetTarget();
5973
5974 if (!apply)
5975 {
5976 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5977 if (target->HasAuraType(GetAuraType()))
5978 return;
5979 }
5980
5981 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
5983}
@ CREATURE_TYPE_BEAST
Definition SharedDefines.h:2628
@ UNIT_DYNFLAG_SPECIALINFO
Definition SharedDefines.h:3125
@ UNIT_DYNAMIC_FLAGS
Definition UpdateFields.h:136
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:806
uint32 GetCreatureType() const
Definition Unit.cpp:15234

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
3353{
3355 return;
3356
3357 Unit* target = aurApp->GetTarget();
3358
3359 if (Player* targetPlayer = target->ToPlayer())
3360 {
3361 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3362 }
3363
3364 if (!apply)
3365 {
3366 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3367 if (target->HasAuraType(GetAuraType()))
3368 return;
3369 }
3370
3371 target->SetFeatherFall(apply);
3372
3373 // start fall from current height
3374 if (!apply && target->IsPlayer())
3375 target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ());
3376}
#define sScriptMgr
Definition ScriptMgr.h:727
void SetFallInformation(uint32 time, float z)
Definition Player.h:2344
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition Unit.cpp:20705
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
1781{
1783 return;
1784
1785 Unit* target = aurApp->GetTarget();
1786
1787 if (!target->IsPlayer())
1788 return;
1789
1790 if (apply)
1791 {
1795 }
1796 else
1797 {
1798 if (target->HasGhostAura())
1799 return;
1800
1804 }
1805}
@ PLAYER_FLAGS_GHOST
Definition Player.h:483
@ SERVERSIDE_VISIBILITY_GHOST
Definition SharedDefines.h:1274
@ GHOST_VISIBILITY_ALIVE
Definition SharedDefines.h:1281
@ GHOST_VISIBILITY_GHOST
Definition SharedDefines.h:1282
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:377
bool HasGhostAura() const
Definition Unit.h:1712
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition Object.h:529
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:528

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

3379{
3381 return;
3382
3383 Unit* target = aurApp->GetTarget();
3384
3385 if (Player* targetPlayer = target->ToPlayer())
3386 {
3387 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3388 }
3389
3390 if (!apply)
3391 {
3392 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3393 if (target->HasAuraType(GetAuraType()))
3394 return;
3395 }
3396
3397 target->SetHover(apply);
3398}
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition Unit.cpp:20727

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
4803{
4805 return;
4806
4807 Unit* target = aurApp->GetTarget();
4808
4809 target->HandleStatModifier(UNIT_MOD_HEALTH, BASE_PCT, float(GetAmount()), apply);
4810}
@ AURA_EFFECT_HANDLE_STAT
Definition SpellAuraDefines.h:46
@ UNIT_MOD_HEALTH
Definition Unit.h:148
@ BASE_PCT
Definition Unit.h:127
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition Unit.cpp:15255

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_PCT, GetAmount(), AuraApplication::GetTarget(), Unit::HandleStatModifier(), and UNIT_MOD_HEALTH.

◆ HandleAuraLinked()

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

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
5105{
5107 return;
5108
5109 Unit* target = aurApp->GetTarget();
5110
5112}
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:163
@ TOTAL_VALUE
Definition Unit.h:128

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

◆ HandleAuraModAttackPowerOfArmor()

void AuraEffect::HandleAuraModAttackPowerOfArmor ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5170{
5172 return;
5173
5174 Unit* target = aurApp->GetTarget();
5175
5176 // Recalculate bonus
5177 if (target->IsPlayer())
5178 target->ToPlayer()->UpdateAttackPowerAndDamage(false);
5179}
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition StatSystem.cpp:330

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
5165{
5166 HandleAuraModAttackPowerOfArmor(aurApp, mode, apply);
5167}
void HandleAuraModAttackPowerOfArmor(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:5169

References HandleAuraModAttackPowerOfArmor().

◆ HandleAuraModAttackPowerPercent()

void AuraEffect::HandleAuraModAttackPowerPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5128{
5130 return;
5131
5132 Unit* target = aurApp->GetTarget();
5133
5134 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
5136}
@ TOTAL_PCT
Definition Unit.h:129

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Unit::HandleStatModifier(), TOTAL_PCT, and UNIT_MOD_ATTACK_POWER.

◆ HandleAuraModBaseResistancePCT()

void AuraEffect::HandleAuraModBaseResistancePCT ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4361{
4363 return;
4364
4365 Unit* target = aurApp->GetTarget();
4366 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4367 {
4368 if (GetMiscValue() & int32(1 << x))
4369 {
4371 }
4372 }
4373}
std::int8_t int8
Definition Define.h:105
@ SPELL_SCHOOL_NORMAL
Definition SharedDefines.h:283
constexpr auto MAX_SPELL_SCHOOL
Definition SharedDefines.h:292
UnitMods
Definition Unit.h:142
@ UNIT_MOD_RESISTANCE_START
Definition Unit.h:172

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_PCT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Unit::HandleStatModifier(), MAX_SPELL_SCHOOL, SPELL_SCHOOL_NORMAL, and UNIT_MOD_RESISTANCE_START.

◆ HandleAuraModBlockPercent()

void AuraEffect::HandleAuraModBlockPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4846{
4848 return;
4849
4850 Unit* target = aurApp->GetTarget();
4851
4852 if (!target->IsPlayer())
4853 return;
4854
4855 target->ToPlayer()->UpdateBlockPercentage();
4856}
void UpdateBlockPercentage()
Definition StatSystem.cpp:616

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
4954{
4956 return;
4957
4958 Unit* target = aurApp->GetTarget();
4959
4960 if (!target->IsPlayer())
4961 {
4962 target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
4963 return;
4964 }
4965
4966 target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4969
4970 // included in Player::UpdateSpellCritChance calculation
4972}
@ FLAT_MOD
Definition Unit.h:189
@ OFFHAND_CRIT_PERCENTAGE
Definition Unit.h:182
@ CRIT_PERCENTAGE
Definition Unit.h:180
@ RANGED_CRIT_PERCENTAGE
Definition Unit.h:181
void UpdateAllSpellCritChances()
Definition StatSystem.cpp:871
void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
Definition Player.cpp:5046
int32 m_baseSpellCritChance
Definition Unit.h:2000
void apply(T *val)
Definition ByteConverter.h:40

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, CRIT_PERCENTAGE, FLAT_MOD, GetAmount(), AuraApplication::GetTarget(), Player::HandleBaseModValue(), Object::IsPlayer(), Unit::m_baseSpellCritChance, OFFHAND_CRIT_PERCENTAGE, RANGED_CRIT_PERCENTAGE, Object::ToPlayer(), and Player::UpdateAllSpellCritChances().

◆ HandleAuraModDecreaseSpeed()

void AuraEffect::HandleAuraModDecreaseSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3772{
3774 return;
3775
3776 Unit* target = aurApp->GetTarget();
3777
3778 target->UpdateSpeed(MOVE_WALK, true);
3779 target->UpdateSpeed(MOVE_RUN, true);
3780 target->UpdateSpeed(MOVE_SWIM, true);
3781 target->UpdateSpeed(MOVE_FLIGHT, true);
3782 target->UpdateSpeed(MOVE_RUN_BACK, true);
3783 target->UpdateSpeed(MOVE_SWIM_BACK, true);
3784 target->UpdateSpeed(MOVE_FLIGHT_BACK, true);
3785
3786 if (Player* targetPlayer = target->ToPlayer())
3787 {
3788 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3789 }
3790}
@ MOVE_FLIGHT
Definition UnitDefines.h:355
@ MOVE_SWIM
Definition UnitDefines.h:352
@ MOVE_FLIGHT_BACK
Definition UnitDefines.h:356
@ MOVE_SWIM_BACK
Definition UnitDefines.h:353
@ MOVE_RUN_BACK
Definition UnitDefines.h:351
@ MOVE_WALK
Definition UnitDefines.h:349
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition Unit.cpp:14302

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
2956{
2957 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2958 return;
2959
2960 Unit* target = aurApp->GetTarget();
2961
2962 AuraType type = GetAuraType();
2963
2964 //Prevent handling aura twice
2965 if ((apply) ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
2966 return;
2967
2968 uint32 field, flag, slot;
2969 WeaponAttackType attType;
2970 switch (type)
2971 {
2973 field = UNIT_FIELD_FLAGS;
2974 flag = UNIT_FLAG_DISARMED;
2976 attType = BASE_ATTACK;
2977 break;
2979 field = UNIT_FIELD_FLAGS_2;
2982 attType = OFF_ATTACK;
2983 break;
2985 field = UNIT_FIELD_FLAGS_2;
2987 slot = EQUIPMENT_SLOT_RANGED;
2988 attType = RANGED_ATTACK;
2989 break;
2990 default:
2991 return;
2992 }
2993
2994 // if disarm aura is to be removed, remove the flag first to reapply damage/aura mods
2995 if (!apply)
2996 target->RemoveFlag(field, flag);
2997
2998 // Handle damage modification, shapeshifted druids are not affected
2999 if (target->IsPlayer() && (!target->IsInFeralForm() || target->GetShapeshiftForm() == FORM_GHOSTWOLF))
3000 {
3001 if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
3002 {
3003 uint8 attacktype = Player::GetAttackBySlot(slot);
3004
3005 if (attacktype < MAX_ATTACK)
3006 {
3007 target->ToPlayer()->_ApplyWeaponDamage(slot, pItem->GetTemplate(), nullptr, !apply);
3008 target->ToPlayer()->_ApplyWeaponDependentAuraMods(pItem, WeaponAttackType(attacktype), !apply);
3009 }
3010 }
3011 }
3012
3013 // if disarm effects should be applied, wait to set flag until damage mods are unapplied
3014 if (apply)
3015 target->SetFlag(field, flag);
3016
3017 if (target->IsCreature() && target->ToCreature()->GetCurrentEquipmentId())
3018 target->UpdateDamagePhysical(attType);
3019}
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:695
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:696
@ EQUIPMENT_SLOT_RANGED
Definition Player.h:697
#define INVENTORY_SLOT_BAG_0
Definition Player.h:675
@ 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:296
@ UNIT_FLAG2_DISARM_RANGED
Definition UnitDefines.h:298
@ FORM_GHOSTWOLF
Definition UnitDefines.h:85
@ UNIT_FLAG_DISARMED
Definition UnitDefines.h:271
WeaponAttackType
Definition Unit.h:208
@ MAX_ATTACK
Definition Unit.h:212
@ UNIT_FIELD_FLAGS_2
Definition UpdateFields.h:118
@ UNIT_FIELD_FLAGS
Definition UpdateFields.h:117
uint8 GetCurrentEquipmentId()
Definition Creature.h:198
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:845
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:860
void _ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply)
Definition Player.cpp:6928
Item * GetItemByPos(uint16 pos) const
Definition PlayerStorage.cpp:441
void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply)
Definition Player.cpp:7035
static uint8 GetAttackBySlot(uint8 slot)
Definition PlayerStorage.cpp:542
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1870
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition StatSystem.cpp:60
bool IsInFeralForm() const
Definition Unit.h:1873

References Player::_ApplyWeaponDamage(), Player::_ApplyWeaponDependentAuraMods(), 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, and Unit::UpdateDamagePhysical().

◆ HandleAuraModDispelImmunity()

void AuraEffect::HandleAuraModDispelImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4302{
4303 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4304 return;
4305
4306 Unit* target = aurApp->GetTarget();
4307
4309}
DispelType
Definition SharedDefines.h:1371
void ApplySpellDispelImmunity(SpellInfo const *spellProto, DispelType type, bool apply)
Definition Unit.cpp:13461

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
4292{
4293 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4294 return;
4295
4296 Unit* target = aurApp->GetTarget();
4297
4298 target->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, GetMiscValue(), apply);
4299}
@ IMMUNITY_DAMAGE
Definition SharedDefines.h:1397

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
4833{
4835 return;
4836
4837 Unit* target = aurApp->GetTarget();
4838
4839 if (!target->IsPlayer())
4840 return;
4841
4842 target->ToPlayer()->UpdateDodgePercentage();
4843}
void UpdateDodgePercentage()
Definition StatSystem.cpp:781

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
4197{
4198 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4199 return;
4200
4201 Unit* target = aurApp->GetTarget();
4202
4203 target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
4204
4205 // when removing flag aura, handle flag drop
4206 Player* player = target->ToPlayer();
4207 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
4208 {
4209 if (player->InBattleground())
4210 {
4211 if (Battleground* bg = player->GetBattleground())
4212 bg->EventPlayerDroppedFlag(player);
4213 }
4214 else
4215 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
4216 }
4217}
#define sOutdoorPvPMgr
Definition OutdoorPvPMgr.h:102
@ IMMUNITY_EFFECT
Definition SharedDefines.h:1394
@ AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
Definition SpellDefines.h:63
bool InBattleground() const
Definition Player.h:2260

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
4637{
4639 return;
4640
4641 Unit* target = aurApp->GetTarget();
4642
4643 if (!target->IsPlayer())
4644 return;
4645
4648}
void UpdateExpertise(WeaponAttackType attType)
Definition StatSystem.cpp:877

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
5986{
5987 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5988 return;
5989
5990 Unit* target = aurApp->GetTarget();
5991
5992 if (apply)
5993 {
5994 target->SetFaction(GetMiscValue());
5995 if (target->IsPlayer())
5997 }
5998 else
5999 {
6000 target->RestoreFaction();
6001 if (target->IsPlayer())
6003 }
6004}
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition UnitDefines.h:253
void SetFaction(uint32 faction)
Definition Unit.cpp:10097
void RestoreFaction()
Definition Unit.cpp:18747

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

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
4736{
4738 return;
4739
4740 Unit* target = aurApp->GetTarget();
4741
4743 // do not check power type, we can always modify the maximum
4744 // as the client will not see any difference
4745 // also, placing conditions that may change during the aura duration
4746 // inside effect handlers is not a good idea
4747 //if (int32(PowerType) != GetMiscValue())
4748 // return;
4749
4750 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4751
4752 target->HandleStatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
4753}
std::uint16_t uint16
Definition Define.h:108
Powers
Definition SharedDefines.h:268
@ UNIT_MOD_POWER_START
Definition Unit.h:174
PowerType
Definition VehicleDefines.h:29

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

◆ HandleAuraModIncreaseEnergyPercent()

void AuraEffect::HandleAuraModIncreaseEnergyPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4756{
4758 return;
4759
4760 Unit* target = aurApp->GetTarget();
4761
4763 // do not check power type, we can always modify the maximum
4764 // as the client will not see any difference
4765 // also, placing conditions that may change during the aura duration
4766 // inside effect handlers is not a good idea
4767 //if (int32(PowerType) != GetMiscValue())
4768 // return;
4769
4770 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4771 float amount = float(GetAmount());
4772
4773 if (apply)
4774 {
4775 target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
4776 target->ModifyPowerPct(PowerType, amount, apply);
4777 }
4778 else
4779 {
4780 target->ModifyPowerPct(PowerType, amount, apply);
4781 target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
4782 }
4783}
int32 ModifyPowerPct(Powers power, float pct, bool apply=true)
Definition Unit.cpp:14239

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Unit::HandleStatModifier(), Unit::ModifyPowerPct(), 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.

3717{
3719 return;
3720
3721 Unit* target = aurApp->GetTarget();
3723 target->UpdateSpeed(MOVE_FLIGHT, true);
3724
3727 {
3728 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3729 if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasIncreaseMountedFlightSpeedAura() && !target->HasFlyAura())))
3730 {
3731 target->SetCanFly(apply);
3732
3733 if (!apply && target->IsCreature() && !target->IsLevitating())
3734 target->GetMotionMaster()->MoveFall();
3735 }
3736
3738 if (mode & AURA_EFFECT_HANDLE_REAL)
3739 {
3740 //Players on flying mounts must be immune to polymorph
3741 if (target->IsPlayer())
3743
3744 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3745 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountID())
3747 }
3748 }
3749
3750 if (Player* targetPlayer = target->ToPlayer())
3751 {
3752 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3753 }
3754}
@ MECHANIC_POLYMORPH
Definition SharedDefines.h:1342
@ 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:1717
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition Unit.cpp:5700
uint32 GetMountID() const
Definition Unit.h:1801

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
4691{
4693 return;
4694
4695 Unit* target = aurApp->GetTarget();
4696
4697 if (apply)
4698 {
4699 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
4700 target->ModifyHealth(GetAmount());
4701 }
4702 else
4703 {
4704 if (int32(target->GetHealth()) > GetAmount())
4705 target->ModifyHealth(-GetAmount());
4706 else
4707 target->SetHealth(1);
4708 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
4709 }
4710}
int32 ModifyHealth(int32 val)
Definition Unit.cpp:14143
void SetHealth(uint32 val)
Definition Unit.cpp:15530
uint32 GetHealth() const
Definition Unit.h:1038

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

◆ HandleAuraModIncreaseHealthPercent()

void AuraEffect::HandleAuraModIncreaseHealthPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4786{
4788 return;
4789
4790 Unit* target = aurApp->GetTarget();
4791
4792 // Unit will keep hp% after MaxHealth being modified if unit is alive.
4793 float percent = target->GetHealthPct();
4794 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(GetAmount()), apply);
4795
4796 // Xinef: pct was rounded down and could "kill" creature by setting its health to 0 making npc zombie
4797 if (target->IsAlive())
4798 if (uint32 healthAmount = CalculatePct(target->GetMaxHealth(), percent))
4799 target->SetHealth(healthAmount);
4800}
T CalculatePct(T base, U pct)
Definition Util.h:61
float GetHealthPct() const
Definition Unit.h:1040
uint32 GetMaxHealth() const
Definition Unit.h:1039

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

◆ HandleAuraModIncreaseMaxHealth()

void AuraEffect::HandleAuraModIncreaseMaxHealth ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4713{
4715 return;
4716
4717 Unit* target = aurApp->GetTarget();
4718
4719 uint32 oldhealth = target->GetHealth();
4720 double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth();
4721
4723
4724 // refresh percentage
4725 if (oldhealth > 0)
4726 {
4727 uint32 newhealth = uint32(std::ceil((double)target->GetMaxHealth() * healthPercentage));
4728 if (newhealth == 0)
4729 newhealth = 1;
4730
4731 target->SetHealth(newhealth);
4732 }
4733}

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

◆ HandleAuraModIncreaseMountedSpeed()

void AuraEffect::HandleAuraModIncreaseMountedSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3712{
3713 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3714}
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3696

References HandleAuraModIncreaseSpeed().

◆ HandleAuraModIncreaseSpeed()

void AuraEffect::HandleAuraModIncreaseSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3697{
3699 return;
3700
3701 Unit* target = aurApp->GetTarget();
3702
3703 target->UpdateSpeed(MOVE_RUN, true);
3704
3705 if (Player* targetPlayer = target->ToPlayer())
3706 {
3707 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3708 }
3709}

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
3757{
3759 return;
3760
3761 Unit* target = aurApp->GetTarget();
3762
3763 target->UpdateSpeed(MOVE_SWIM, true);
3764
3765 if (Player* targetPlayer = target->ToPlayer())
3766 {
3767 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3768 }
3769}

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
3051{
3053 return;
3054
3055 Unit* target = aurApp->GetTarget();
3056
3057 if (apply)
3058 {
3060 //target->AttackStop(); // pussywizard: why having this flag prevents from being in combat? it should just prevent melee attack
3061 }
3062 else
3063 {
3064 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3065 if (target->HasPacifyAura() || target->HasPacifySilenceAura())
3066 return;
3068 }
3069}
@ UNIT_FLAG_PACIFIED
Definition UnitDefines.h:267
bool HasPacifySilenceAura() const
Definition Unit.h:1737
bool HasPacifyAura() const
Definition Unit.h:1741

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
3072{
3074 return;
3075
3076 Unit* target = aurApp->GetTarget();
3077
3078 if (!(apply))
3079 {
3080 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3081 if (target->HasPacifySilenceAura())
3082 return;
3083 }
3084 HandleAuraModPacify(aurApp, mode, apply);
3085 HandleAuraModSilence(aurApp, mode, apply);
3086}
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3021
void HandleAuraModPacify(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3050

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
4817{
4819 return;
4820
4821 Unit* target = aurApp->GetTarget();
4822
4823 if (!target->IsPlayer())
4824 return;
4825
4826 if (!target->ToPlayer()->CanParry())
4827 target->ToPlayer()->SetCanParry(true);
4828 else
4829 target->ToPlayer()->UpdateParryPercentage();
4830}
void UpdateParryPercentage()
Definition StatSystem.cpp:735
bool CanParry() const
Definition Player.h:2191
void SetCanParry(bool value)
Definition Player.cpp:13183

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
3208{
3210 return;
3211
3212 Unit* target = aurApp->GetTarget();
3213
3214 if (!target->IsPlayer())
3215 return;
3216
3217 // Recalculate pet talent points
3218 if (Pet* pet = target->ToPlayer()->GetPet())
3219 pet->InitTalentForLevel();
3220}

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
5115{
5117 return;
5118
5119 Unit* target = aurApp->GetTarget();
5120
5121 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
5122 return;
5123
5125}
#define CLASSMASK_WAND_USERS
Definition SharedDefines.h:174
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:164
uint32 getClassMask() const
Definition Unit.h:811

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, CLASSMASK_WAND_USERS, GetAmount(), Unit::getClassMask(), AuraApplication::GetTarget(), Unit::HandleStatModifier(), 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
5139{
5141 return;
5142
5143 Unit* target = aurApp->GetTarget();
5144
5145 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
5146 return;
5147
5148 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
5150}

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

◆ HandleAuraModRangedHaste()

void AuraEffect::HandleAuraModRangedHaste ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5043{
5045 return;
5046
5047 Unit* target = aurApp->GetTarget();
5048
5049 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
5050}
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:17106

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
4859{
4860 HandleModManaRegen(aurApp, mode, apply);
4861}
void HandleModManaRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4676

References HandleModManaRegen().

◆ HandleAuraModResistance()

void AuraEffect::HandleAuraModResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4343{
4345 return;
4346
4347 Unit* target = aurApp->GetTarget();
4348
4349 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4350 {
4351 if (GetMiscValue() & int32(1 << x))
4352 {
4354 if (target->IsPlayer() || target->IsPet())
4355 target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply);
4356 }
4357 }
4358}
SpellSchools
Definition SharedDefines.h:282
bool IsPet() const
Definition Unit.h:763
void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply)
Definition Unit.h:1135

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

◆ HandleAuraModResistanceExclusive()

void AuraEffect::HandleAuraModResistanceExclusive ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4320{
4322 return;
4323
4324 Unit* target = aurApp->GetTarget();
4325
4326 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4327 {
4328 if (GetMiscValue() & int32(1 << x))
4329 {
4331 if (amount < GetAmount())
4332 {
4333 float value = float(GetAmount() - amount);
4335 if (target->IsPlayer())
4336 target->ApplyResistanceBuffModsMod(SpellSchools(x), aurApp->IsPositive(), value, apply);
4337 }
4338 }
4339 }
4340}
@ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
Definition SpellAuraDefines.h:206
@ BASE_VALUE
Definition Unit.h:126
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
Definition Unit.cpp:6041

References Unit::ApplyResistanceBuffModsMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_VALUE, GetAmount(), Unit::GetMaxPositiveAuraModifierByMiscMask(), GetMiscValue(), AuraApplication::GetTarget(), Unit::HandleStatModifier(), Object::IsPlayer(), AuraApplication::IsPositive(), MAX_SPELL_SCHOOL, SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE, SPELL_SCHOOL_NORMAL, and UNIT_MOD_RESISTANCE_START.

◆ HandleAuraModResistenceOfStatPercent()

void AuraEffect::HandleAuraModResistenceOfStatPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4615{
4617 return;
4618
4619 Unit* target = aurApp->GetTarget();
4620
4621 if (!target->IsPlayer())
4622 return;
4623
4625 {
4626 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
4627 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
4628 LOG_ERROR("spells.aura.effect", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
4629 return;
4630 }
4631
4632 // Recalculate Armor
4633 target->UpdateArmor();
4634}
#define LOG_ERROR(filterType__,...)
Definition Log.h:157
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:297
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
3518{
3519 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3520 return;
3521
3522 Unit* target = aurApp->GetTarget();
3523
3524 target->SetControlled(apply, UNIT_STATE_ROOT);
3525}
@ UNIT_STATE_ROOT
Definition UnitDefines.h:180
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:18086

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
2777{
2779 return;
2780
2781 aurApp->GetTarget()->RecalculateObjectScale();
2782}

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
4233{
4234 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4235 return;
4236
4237 Unit* target = aurApp->GetTarget();
4238
4239 target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, GetMiscValue(), (apply));
4240
4241 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4242 {
4243 if (apply)
4245 else
4246 {
4247 bool banishFound = false;
4248 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
4249 for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
4250 if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4251 {
4252 banishFound = true;
4253 break;
4254 }
4255 if (!banishFound)
4257 }
4258 }
4259
4260 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
4262
4263 // remove all flag auras (they are positive, but they must be removed when you are immune)
4267
4269 if ((apply)
4271 && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
4272 {
4273 uint32 school_mask = GetMiscValue();
4274 Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
4275 for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
4276 {
4277 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
4278 if ((spell->GetSchoolMask() & school_mask)//Check for school mask
4279 && GetSpellInfo()->CanDispelAura(spell)
4280 && !iter->second->IsPositive() //Don't remove positive spells
4281 && spell->Id != GetId()) //Don't remove self
4282 {
4283 target->RemoveAura(iter);
4284 }
4285 else
4286 ++iter;
4287 }
4288 }
4289}
@ SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE
Definition SharedDefines.h:477
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
Definition SharedDefines.h:434
@ MECHANIC_BANISH
Definition SharedDefines.h:1343
@ IMMUNITY_SCHOOL
Definition SharedDefines.h:1396
@ 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:708
void AddUnitState(uint32 f)
Definition Unit.h:706
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition Unit.cpp:5213

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
1868{
1870 return;
1871
1872 Unit* target = aurApp->GetTarget();
1873
1874 uint32 modelid = 0;
1877
1878 switch (form)
1879 {
1880 case FORM_CAT: // 0x01
1881 case FORM_GHOUL: // 0x07
1883 break;
1884
1885 case FORM_BEAR: // 0x05
1886 case FORM_DIREBEAR: // 0x08
1887
1888 case FORM_BATTLESTANCE: // 0x11
1889 case FORM_DEFENSIVESTANCE: // 0x12
1890 case FORM_BERSERKERSTANCE: // 0x13
1892 break;
1893
1894 case FORM_TREE: // 0x02
1895 case FORM_TRAVEL: // 0x03
1896 case FORM_AQUA: // 0x04
1897 case FORM_AMBIENT: // 0x06
1898
1899 case FORM_STEVES_GHOUL: // 0x09
1900 case FORM_THARONJA_SKELETON: // 0x0A
1901 case FORM_TEST_OF_STRENGTH: // 0x0B
1902 case FORM_BLB_PLAYER: // 0x0C
1903 case FORM_SHADOW_DANCE: // 0x0D
1904 case FORM_CREATUREBEAR: // 0x0E
1905 case FORM_CREATURECAT: // 0x0F
1906 case FORM_GHOSTWOLF: // 0x10
1907
1908 case FORM_TEST: // 0x14
1909 case FORM_ZOMBIE: // 0x15
1910 case FORM_METAMORPHOSIS: // 0x16
1911 case FORM_UNDEAD: // 0x19
1912 case FORM_MASTER_ANGLER: // 0x1A
1913 case FORM_FLIGHT_EPIC: // 0x1B
1914 case FORM_SHADOW: // 0x1C
1915 case FORM_FLIGHT: // 0x1D
1916 case FORM_STEALTH: // 0x1E
1917 case FORM_MOONKIN: // 0x1F
1918 case FORM_SPIRITOFREDEMPTION: // 0x20
1919 break;
1920 default:
1921 LOG_ERROR("spells.aura.effect", "Auras: Unknown Shapeshift Type: {}", GetMiscValue());
1922 }
1923
1924 modelid = target->GetModelForForm(form, GetId());
1925
1926 if (apply)
1927 {
1928 // remove polymorph before changing display id to keep new display id
1929 switch (form)
1930 {
1931 case FORM_CAT:
1932 case FORM_TREE:
1933 case FORM_TRAVEL:
1934 case FORM_AQUA:
1935 case FORM_BEAR:
1936 case FORM_DIREBEAR:
1937 case FORM_FLIGHT_EPIC:
1938 case FORM_FLIGHT:
1939 case FORM_MOONKIN:
1940 {
1941 if (Player* player = target->ToPlayer())
1942 {
1943 player->SetCanTeleport(true);
1944 }
1945 // remove movement affects
1946 target->RemoveAurasByShapeShift();
1947
1948 // and polymorphic affects
1949 if (target->IsPolymorphed())
1950 target->RemoveAurasDueToSpell(target->getTransForm());
1951 break;
1952 }
1953 default:
1954 break;
1955 }
1956
1957 // remove other shapeshift before applying a new one
1958 // xinef: rogue shouldnt be wrapped by this check (shadow dance vs stealth)
1959 if (GetSpellInfo()->SpellFamilyName != SPELLFAMILY_ROGUE)
1961
1962 // stop handling the effect if it was removed by linked event
1963 if (aurApp->GetRemoveMode())
1964 return;
1965
1966 if (PowerType != POWER_MANA)
1967 {
1968 uint32 oldPower = target->GetPower(PowerType);
1969 // reset power to default values only at power change
1970 if (target->getPowerType() != PowerType)
1971 target->setPowerType(PowerType);
1972
1973 switch (form)
1974 {
1975 case FORM_CAT:
1976 case FORM_BEAR:
1977 case FORM_DIREBEAR:
1978 {
1979 // get furor proc chance
1980 uint32 FurorChance = 0;
1981 if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
1982 FurorChance = std::max(dummy->GetAmount(), 0);
1983
1984 switch (GetMiscValue())
1985 {
1986 case FORM_CAT:
1987 {
1988 int32 basePoints = int32(std::min(oldPower, FurorChance));
1989 target->SetPower(POWER_ENERGY, 0);
1990 target->CastCustomSpell(target, 17099, &basePoints, nullptr, nullptr, true, nullptr, this);
1991 break;
1992 }
1993 case FORM_BEAR:
1994 case FORM_DIREBEAR:
1995 if (urand(0, 99) < FurorChance)
1996 target->CastSpell(target, 17057, true);
1997 break;
1998 default:
1999 {
2000 uint32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance);
2001 target->SetPower(POWER_ENERGY, newEnergy);
2002 break;
2003 }
2004 }
2005 break;
2006 }
2007 default:
2008 break;
2009 }
2010 }
2011 // stop handling the effect if it was removed by linked event
2012 if (aurApp->GetRemoveMode())
2013 return;
2014
2015 target->SetShapeshiftForm(form);
2016 // xinef: allow shapeshift to override model id if forced transform aura is not present!
2017 if (modelid > 0)
2018 {
2019 bool allow = true;
2020 if (target->getTransForm() && !(target->GetMapId() == 560 /*The Escape From Durnholde*/))
2021 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm()))
2022 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !transformSpellInfo->IsPositive())
2023 allow = false;
2024
2025 if (allow)
2026 target->SetDisplayId(modelid);
2027 }
2028 }
2029 else
2030 {
2031 // reset model id if no other auras present
2032 // may happen when aura is applied on linked event on aura removal
2033 if (!target->HasShapeshiftAura())
2034 {
2037 {
2038 target->setPowerType(POWER_MANA);
2039 // Remove movement impairing effects also when shifting out
2040 target->RemoveAurasByShapeShift();
2041 }
2042 }
2043
2044 if (modelid > 0)
2045 target->RestoreDisplayId();
2046
2047 switch (form)
2048 {
2049 // Nordrassil Harness - bonus
2050 case FORM_BEAR:
2051 case FORM_DIREBEAR:
2052 case FORM_CAT:
2053 if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
2054 target->CastSpell(target, 37316, true, nullptr, dummy);
2055 break;
2056 // Nordrassil Regalia - bonus
2057 case FORM_MOONKIN:
2058 if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
2059 target->CastSpell(target, 37325, true, nullptr, dummy);
2060 break;
2061 case FORM_BATTLESTANCE:
2064 {
2065 uint32 Rage_val = 0;
2066 // Defensive Tactics
2067 if (form == FORM_DEFENSIVESTANCE)
2068 {
2069 if (AuraEffect const* aurEff = target->IsScriptOverriden(m_spellInfo, 831))
2070 Rage_val += aurEff->GetAmount() * 10;
2071 }
2072 // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
2073 if (target->IsPlayer())
2074 {
2075 // Stance mastery - trainer spell
2076 PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
2077 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
2078 {
2079 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec()))
2080 continue;
2081
2082 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
2083 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
2084 Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
2085 }
2086
2087 // Tactical Mastery - talent
2088 PlayerTalentMap const& tp_list = target->ToPlayer()->GetTalentMap();
2089 for (PlayerTalentMap::const_iterator itr = tp_list.begin(); itr != tp_list.end(); ++itr)
2090 {
2091 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec()))
2092 continue;
2093
2094 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
2095 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
2096 Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
2097 }
2098 }
2099 if (target->GetPower(POWER_RAGE) > Rage_val)
2100 target->SetPower(POWER_RAGE, Rage_val);
2101 break;
2102 }
2103 default:
2104 break;
2105 }
2106 }
2107
2108 // adding/removing linked auras
2109 // add/remove the shapeshift aura's boosts
2110 HandleShapeshiftBoosts(target, apply);
2111
2112 if (target->IsPlayer())
2113 target->ToPlayer()->InitDataForForm();
2114
2116 {
2117 // Dash
2119 aurEff->RecalculateAmount();
2120
2121 // Disarm handling
2122 // If druid shifts while being disarmed we need to deal with that since forms aren't affected by disarm
2123 // and also HandleAuraModDisarm is not triggered
2124 if (!target->CanUseAttackType(BASE_ATTACK))
2125 {
2127 {
2128 target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), nullptr, apply);
2129 }
2130 }
2131
2132 // Update crit chance for feral forms
2133 switch (form)
2134 {
2135 case FORM_CAT:
2136 case FORM_BEAR:
2137 case FORM_DIREBEAR:
2138 case FORM_GHOSTWOLF:
2140 break;
2141 default:
2142 break;
2143 }
2144 }
2145
2146 // stop handling the effect if it was removed by linked event
2147 if (apply && aurApp->GetRemoveMode())
2148 return;
2149
2150 if (target->IsPlayer())
2151 {
2152 SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
2153 // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
2154 for (uint8 i = 0; i < MAX_SHAPESHIFT_SPELLS; ++i)
2155 {
2156 if (!shapeInfo->stanceSpell[i])
2157 continue;
2158 if (apply)
2159 target->ToPlayer()->_addSpell(shapeInfo->stanceSpell[i], SPEC_MASK_ALL, true);
2160 else
2161 target->ToPlayer()->removeSpell(shapeInfo->stanceSpell[i], SPEC_MASK_ALL, true);
2162 }
2163 }
2164}
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormEntryfmt)
#define MAX_SHAPESHIFT_SPELLS
Definition DBCStructure.h:1813
std::unordered_map< uint32, PlayerTalent * > PlayerTalentMap
Definition Player.h:192
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition Player.h:193
#define SPEC_MASK_ALL
Definition Player.h:177
@ PLAYERSPELL_REMOVED
Definition Player.h:122
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ POWER_RAGE
Definition SharedDefines.h:270
@ POWER_ENERGY
Definition SharedDefines.h:272
@ POWER_MANA
Definition SharedDefines.h:269
@ CLASS_DRUID
Definition SharedDefines.h:151
@ SPELLFAMILY_WARRIOR
Definition SharedDefines.h:3532
@ SPELL_ATTR0_NO_IMMUNITIES
Definition SharedDefines.h:411
@ 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:1226
static ObjectGuid const Empty
Definition ObjectGuid.h:120
bool _addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill=false)
Definition Player.cpp:3123
void removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporary)
Definition Player.cpp:3352
const PlayerTalentMap & GetTalentMap() const
Definition Player.h:2618
PlayerSpellMap const & GetSpellMap() const
Definition Player.h:1780
void InitDataForForm(bool reapplyMods=false)
Definition Player.cpp:10633
uint8 GetActiveSpec() const
Definition Player.h:1748
void UpdateAllCritPercentages()
Definition StatSystem.cpp:680
uint32 SpellIconID
Definition SpellInfo.h:380
void RemoveAurasByShapeShift()
Definition Unit.cpp:5302
bool CanUseAttackType(uint8 attacktype) const
Definition Unit.h:945
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition Unit.cpp:14903
bool IsPolymorphed() const
Definition Unit.cpp:16793
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:15618
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5526
virtual bool IsClass(Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
Definition Unit.h:810
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition Unit.cpp:5864
bool HasShapeshiftAura() const
Definition Unit.h:1739
void RestoreDisplayId()
Definition Unit.cpp:16827
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition Unit.h:1367
uint32 getTransForm() const
Definition Unit.h:1881
Powers getPowerType() const
Definition Unit.h:1061
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition Unit.cpp:5142
uint32 GetPower(Powers power) const
Definition Unit.h:1065
void setPowerType(Powers power)
Definition Unit.cpp:10020
void SetShapeshiftForm(ShapeshiftForm form)
Definition Unit.cpp:21311
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const
Definition Unit.cpp:19252
uint32 GetMapId() const
Definition Position.h:280
Definition DBCStructure.h:1816
uint32 stanceSpell[MAX_SHAPESHIFT_SPELLS]
Definition DBCStructure.h:1828

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, 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
3022{
3023 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3024 return;
3025
3026 Unit* target = aurApp->GetTarget();
3027
3028 if (apply)
3029 {
3031
3032 // call functions which may have additional effects after chainging state of unit
3033 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
3034 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
3035 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
3036 if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
3037 // Stop spells on prepare or casting state
3038 target->InterruptSpell(CurrentSpellTypes(i), false);
3039 }
3040 else
3041 {
3042 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3043 if (target->HasSilenceAura() || target->HasPacifySilenceAura())
3044 return;
3045
3047 }
3048}
@ SPELL_PREVENTION_TYPE_SILENCE
Definition SharedDefines.h:1554
@ UNIT_FLAG_SILENCED
Definition UnitDefines.h:263
#define CURRENT_MAX_SPELL
Definition Unit.h:544
CurrentSpellTypes
Definition Unit.h:536
@ CURRENT_MELEE_SPELL
Definition Unit.h:537
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4092
bool HasSilenceAura() const
Definition Unit.h:1738

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
3223{
3225 return;
3226 Unit* target = aurApp->GetTarget();
3227
3228 if (!target->IsPlayer())
3229 return;
3230
3231 uint32 prot = GetMiscValue();
3232 int32 points = GetAmount();
3233
3234 target->ToPlayer()->ModifySkillBonus(prot, ((apply) ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
3235 if (prot == SKILL_DEFENSE)
3236 target->ToPlayer()->UpdateDefenseBonusesMod();
3237}
@ SKILL_DEFENSE
Definition SharedDefines.h:2881
@ 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:5337
void UpdateDefenseBonusesMod()
Definition StatSystem.cpp:609

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
3165{
3167 return;
3168
3169 Unit* target = aurApp->GetTarget();
3170
3171 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
3172 if (apply)
3174 else
3175 {
3176 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3177 if (!target->HasAuraType(GetAuraType()))
3179 }
3180
3181 // call functions which may have additional effects after chainging state of unit
3182 target->UpdateObjectVisibility(target->IsPlayer());
3183}
@ UNIT_DYNFLAG_TRACK_UNIT
Definition SharedDefines.h:3122
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:124
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:123
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition Unit.cpp:19182

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
4434{
4436 return;
4437
4438 Unit* target = aurApp->GetTarget();
4439
4440 if (GetMiscValue() < -2 || GetMiscValue() > 4)
4441 {
4442 LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
4443 return;
4444 }
4445
4446 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4447 {
4448 // -1 or -2 is all stats (misc < -2 checked in function beginning)
4449 if (GetMiscValue() < 0 || GetMiscValue() == i)
4450 {
4451 //target->ApplyStatMod(Stats(i), m_amount, apply);
4453 if (target->IsPlayer() || target->IsPet())
4454 target->ApplyStatBuffMod(Stats(i), (float)GetAmount(), apply);
4455 }
4456 }
4457}
#define MAX_STATS
Definition SharedDefines.h:265
Stats
Definition SharedDefines.h:257
@ STAT_STRENGTH
Definition SharedDefines.h:258
@ UNIT_MOD_STAT_START
Definition Unit.h:170
void ApplyStatBuffMod(Stats stat, float val, bool apply)
Definition Unit.h:1029

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

◆ HandleAuraModStateImmunity()

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

◆ HandleAuraModStun()

void AuraEffect::HandleAuraModStun ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3508{
3509 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3510 return;
3511
3512 Unit* target = aurApp->GetTarget();
3513
3514 target->SetControlled(apply, UNIT_STATE_STUNNED);
3515}
@ 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
3446{
3448 return;
3449
3450 Unit* target = aurApp->GetTarget();
3451
3452 if (!target->IsAlive() || !target->IsPlayer())
3453 return;
3454
3455 Unit* caster = GetCaster();
3456 if (caster && caster->IsAlive())
3457 target->getHostileRefMgr().addTempThreat((float)GetAmount(), apply);
3458}
void addTempThreat(float threat, bool apply)
Definition HostileRefMgr.cpp:65
HostileRefMgr & getHostileRefMgr()
Definition Unit.h:916

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
3793{
3794 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3795 return;
3796
3797 Unit* target = aurApp->GetTarget();
3798
3799 target->UpdateSpeed(MOVE_RUN, true);
3800 target->UpdateSpeed(MOVE_SWIM, true);
3801 target->UpdateSpeed(MOVE_FLIGHT, true);
3802
3803 if (Player* targetPlayer = target->ToPlayer())
3804 {
3805 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3806 }
3807}

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
4864{
4866 return;
4867
4868 Unit* target = aurApp->GetTarget();
4869
4870 if (!target->IsPlayer())
4871 return;
4872
4873 for (int i = 0; i < MAX_ATTACK; ++i)
4874 if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
4875 target->ToPlayer()->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply);
4876
4877 // mods must be applied base at equipped weapon class and subclass comparison
4878 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
4879 // GetMiscValue() comparison with item generated damage types
4880
4881 if (GetSpellInfo()->EquippedItemClass == -1)
4882 {
4883 target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4886 }
4887 else
4888 {
4889 // done in Player::_ApplyWeaponDependentAuraMods
4890 }
4891}
void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
Definition Player.cpp:7050

References Player::_ApplyWeaponDependentAuraCritMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, CRIT_PERCENTAGE, FLAT_MOD, GetAmount(), GetSpellInfo(), AuraApplication::GetTarget(), Player::GetWeaponForAttack(), Player::HandleBaseModValue(), Object::IsPlayer(), MAX_ATTACK, OFFHAND_CRIT_PERCENTAGE, RANGED_CRIT_PERCENTAGE, and Object::ToPlayer().

◆ HandleAuraMounted()

void AuraEffect::HandleAuraMounted ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3244{
3246 return;
3247
3248 Unit* target = aurApp->GetTarget();
3249 Unit* caster = GetCaster();
3250
3251 if (apply)
3252 {
3253 uint32 creatureEntry = GetMiscValue();
3254 uint32 displayId = 0;
3255 uint32 vehicleId = 0;
3256
3257 // Festive Holiday Mount
3258 if (target->HasAura(62061))
3259 {
3261 creatureEntry = 24906;
3262 else
3263 creatureEntry = 15665;
3264 }
3265
3266 // Festive Brewfest Mount
3268 {
3269 if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
3270 {
3271 creatureEntry = GREAT_BREWFEST_KODO;
3272 }
3273 else
3274 {
3275 creatureEntry = BREWFEST_KODO;
3276 }
3277 }
3278
3279 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
3280 {
3281 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
3282 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
3283 displayId = model.CreatureDisplayID;
3284
3285 vehicleId = creatureInfo->VehicleId;
3286
3287 //some spell has one aura of mount and one of vehicle
3288 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3289 {
3290 if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue())
3291 {
3292 displayId = 0;
3293 }
3294 }
3295
3296 }
3297 target->Mount(displayId, vehicleId, GetMiscValue());
3298 }
3299 else
3300 {
3301 target->Dismount();
3302 //some mounts like Headless Horseman's Mount or broom stick are skill based spell
3303 // need to remove ALL arura related to mounts, this will stop client crash with broom stick
3304 // and never endless flying after using Headless Horseman's Mount
3305 if (mode & AURA_EFFECT_HANDLE_REAL)
3307 }
3308}
@ SPELL_EFFECT_SUMMON
Definition SharedDefines.h:806
void Dismount()
Definition Unit.cpp:13569
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5753
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition Unit.cpp:13510

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
6097{
6098 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6099 return;
6100
6101 Unit* target = aurApp->GetTarget();
6102
6103 if (!target->IsPlayer() || !target->IsInWorld())
6104 return;
6105
6106 if (apply)
6107 target->ToPlayer()->GetSession()->SendStablePet(target->GetGUID());
6108
6109 // client auto close stable dialog at !apply aura
6110}
bool IsInWorld() const
Definition Object.h:107
WorldSession * GetSession() const
Definition Player.h:2005
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
6126{
6127 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6128 return;
6129
6130 Player* target = aurApp->GetTarget()->ToPlayer();
6131
6132 if (!target || !target->IsInWorld())
6133 return;
6134
6135 uint32 overrideId = uint32(GetMiscValue());
6136
6137 if (apply)
6138 {
6140 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
6141 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
6142 if (uint32 spellId = overrideSpells->spellId[i])
6143 target->_addSpell(spellId, SPEC_MASK_ALL, true);
6144 }
6145 else
6146 {
6148 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
6149 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
6150 if (uint32 spellId = overrideSpells->spellId[i])
6151 target->removeSpell(spellId, SPEC_MASK_ALL, true);
6152 }
6153}
DBCStorage< OverrideSpellDataEntry > sOverrideSpellDataStore(OverrideSpellDatafmt)
#define MAX_OVERRIDE_SPELL
Definition DBCStructure.h:1410
#define PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET
Definition Player.h:556
@ PLAYER_FIELD_BYTES2
Definition UpdateFields.h:378
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition Object.cpp:770
Definition DBCStructure.h:1413

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

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
6156{
6157 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6158 return;
6159
6160 Unit* target = aurApp->GetTarget();
6161
6162 if (!target->IsPlayer() || !target->IsInWorld())
6163 return;
6164
6165 uint32 vehicleId = GetMiscValue();
6166
6167 if (apply)
6168 {
6169 if (!target->CreateVehicleKit(vehicleId, 0))
6170 return;
6171 }
6172 else if (target->GetVehicleKit())
6173 target->RemoveVehicleKit();
6174
6176 data << target->GetPackGUID();
6177 data << uint32(apply ? vehicleId : 0);
6178 target->SendMessageToSet(&data, true);
6179
6180 if (apply)
6181 {
6183 target->ToPlayer()->GetSession()->SendPacket(&data);
6184 }
6185}
PackedGuid const & GetPackGUID() const
Definition Object.h:114
std::size_t size() const
Definition ObjectGuid.h:274
void RemoveVehicleKit()
Definition Unit.cpp:18779
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition Unit.cpp:18767
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:2091
Definition WorldPacket.h:26
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition WorldSession.cpp:226
@ 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(), Player::GetSession(), AuraApplication::GetTarget(), Unit::GetVehicleKit(), WorldPacket::Initialize(), Object::IsInWorld(), Object::IsPlayer(), Unit::RemoveVehicleKit(), WorldObject::SendMessageToSet(), WorldSession::SendPacket(), 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
3114{
3116 return;
3117
3118 Unit* target = aurApp->GetTarget();
3119
3120 if (!target->IsPlayer())
3121 return;
3122
3123 if (apply)
3124 target->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
3125 else
3126 target->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
3127}
@ 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
3130{
3132 return;
3133
3134 Unit* target = aurApp->GetTarget();
3135
3136 if (!target->IsPlayer())
3137 return;
3138
3139 if (apply)
3140 target->SetFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
3141 else
3142 target->RemoveFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
3143}
@ 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
3146{
3148 return;
3149
3150 Unit* target = aurApp->GetTarget();
3151
3152 if (!target->IsPlayer())
3153 return;
3154
3155 if (!(apply))
3156 {
3157 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3158 if (target->HasAuraType(GetAuraType()))
3159 return;
3160 }
3162}
@ PLAYER_FIELD_BYTE_TRACK_STEALTHED
Definition Player.h:564
@ PLAYER_FIELD_BYTES
Definition UpdateFields.h:368
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition Object.cpp:899

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

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
3186{
3188 return;
3189
3190 Unit* target = aurApp->GetTarget();
3191
3192 if (apply)
3194 else
3195 {
3196 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3197 if (target->HasAuraType(GetAuraType()))
3198 return;
3200 }
3201}
@ 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:930
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:911

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
3331{
3333 return;
3334
3335 Unit* target = aurApp->GetTarget();
3336
3337 if (Player* targetPlayer = target->ToPlayer())
3338 {
3339 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3340 }
3341
3342 if (!apply)
3343 {
3344 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3345 if (target->HasAuraType(GetAuraType()))
3346 return;
3347 }
3348
3349 target->SetWaterWalking(apply);
3350}
virtual bool SetWaterWalking(bool enable, bool packetOnly=false)
Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for...
Definition Unit.cpp:20683

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

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

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
3636{
3637 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3638 return;
3639
3640 Unit* target = aurApp->GetTarget();
3641
3642 Unit* caster = GetCaster();
3643
3644 if (apply)
3645 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
3646 else
3647 target->RemoveCharmedBy(caster);
3648}
@ CHARM_TYPE_CONVERT
Definition CharmInfo.h:48
void RemoveCharmedBy(Unit *charmer)
Definition Unit.cpp:18604
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:18402

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

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
1713{
1715 {
1716 return;
1717 }
1718
1719 Unit* target = aurApp->GetTarget();
1720 if (!target->IsPlayer())
1721 {
1722 return;
1723 }
1724
1725 if (apply)
1726 {
1727 target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1728 }
1729 else
1730 {
1731 if (target->HasDetectAmoreAura())
1732 {
1734 for (AuraEffect const* aurEff : amoreAuras)
1735 if (GetMiscValue() == aurEff->GetMiscValue())
1736 {
1737 return;
1738 }
1739 }
1740
1741 target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1742 }
1743}
@ SPELL_AURA_DETECT_AMORE
Definition SpellAuraDefines.h:233
bool HasDetectAmoreAura() const
Definition Unit.h:1731

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

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 
)
798{
800 ASSERT(aurApp);
801 HandleEffect(aurApp, mode, apply);
802}
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition SpellAuras.h:183

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

◆ HandleFarSight()

void AuraEffect::HandleFarSight ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5919{
5920 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5921 {
5922 return;
5923 }
5924
5925 Unit* caster = GetCaster();
5926 if (!caster || !caster->IsPlayer())
5927 {
5928 return;
5929 }
5930
5931 Player* player = caster->ToPlayer();
5932 if (apply)
5933 {
5935 }
5936 else
5937 {
5938 player->ResetFarSightDistance();
5939 }
5940
5941 caster->UpdateObjectVisibility(!apply);
5942}
void SetFarSightDistance(float radius)
Definition Player.cpp:16324
void ResetFarSightDistance()
Definition Player.cpp:16329
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2323

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
2813{
2814 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2815 return;
2816
2817 Unit* target = aurApp->GetTarget();
2818
2819 if (!target->IsPlayer())
2820 return;
2821
2822 if (Player* targetPlayer = target->ToPlayer())
2823 {
2824 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2825 }
2826
2827 if (apply)
2828 {
2829 /*
2830 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2831 data<<target->GetGUID();
2832 data<<uint8(0);
2833 target->SendMessageToSet(&data, true);
2834 */
2835
2836 UnitList targets;
2837 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
2839 Cell::VisitAllObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2840 for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2841 {
2842 if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2843 continue;
2844
2846 {
2847 if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2848 {
2849 SpellInfo const* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo();
2850 if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->IsCreature())
2851 {
2852 Creature* c = (*iter)->ToCreature();
2853 if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
2854 continue;
2855 }
2856 bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY)
2857 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
2858 if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST))
2859 {
2860 // at least one effect truly targets an unit, interrupt the spell
2861 interrupt = true;
2862 break;
2863 }
2864 if (interrupt)
2865 (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
2866 }
2867 }
2868 }
2869
2870 if (target->GetInstanceScript() && target->GetInstanceScript()->IsEncounterInProgress())
2871 {
2872 // Xinef: replaced with CombatStop(false)
2873 target->AttackStop();
2874 target->RemoveAllAttackers();
2875 target->getHostileRefMgr().addThreatPercent(-100);
2876 target->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
2877 }
2878 else
2879 {
2880 target->CombatStop();
2882 }
2883
2885
2886 // prevent interrupt message
2887 if (GetCasterGUID() == target->GetGUID())
2888 {
2890 target->FinishSpell(CURRENT_GENERIC_SPELL, true);
2891
2892 // interrupt autoshot
2894 {
2896 target->ToPlayer()->SendAutoRepeatCancel(target);
2897 }
2898 }
2899
2900 target->InterruptNonMeleeSpells(true);
2901
2902 // stop handling the effect if it was removed by linked event
2903 if (aurApp->GetRemoveMode())
2904 return;
2905 // blizz like 2.0.x
2907 // blizz like 2.0.x
2909 // blizz like 2.0.x
2911
2913 }
2914 else
2915 {
2916 /*
2917 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2918 data<<target->GetGUID();
2919 data<<uint8(1);
2920 target->SendMessageToSet(&data, true);
2921 */
2922 // blizz like 2.0.x
2924 // blizz like 2.0.x
2926 // blizz like 2.0.x
2928
2930 }
2931}
@ UNIT_DYNFLAG_DEAD
Definition SharedDefines.h:3126
@ CREATURE_ELITE_WORLDBOSS
Definition SharedDefines.h:2734
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition SharedDefines.h:617
@ 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:289
@ UNIT_STATE_DIED
Definition UnitDefines.h:170
@ UNIT_STATE_CASTING
Definition UnitDefines.h:185
@ UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
Definition UnitDefines.h:279
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition Unit.h:543
@ CURRENT_GENERIC_SPELL
Definition Unit.h:538
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:540
std::list< Unit * > UnitList
Definition Unit.h:76
Definition GridNotifiers.h:861
Definition Creature.h:43
bool IsDungeonBoss() const
Definition Creature.cpp:3179
bool isWorldBoss() const
Definition Creature.h:121
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:209
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:10481
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4161
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition Unit.cpp:4119
void RemoveAllAttackers()
Remove all units in m_attackers list and send them AttackStop()
Definition Unit.cpp:10529
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:10448
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1203
float GetVisibilityRange() const
Definition Object.cpp:1656
Definition GridNotifiers.h:423
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:185
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::VisitAllObjects().

◆ HandleForceMoveForward()

void AuraEffect::HandleForceMoveForward ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3413{
3415 return;
3416
3417 Unit* target = aurApp->GetTarget();
3418
3419 if (apply)
3421 else
3422 {
3423 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3424 if (target->HasAuraType(GetAuraType()))
3425 return;
3427 }
3428}
@ UNIT_FLAG2_FORCE_MOVEMENT
Definition UnitDefines.h:295

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

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
4979{
4981 return;
4982
4983 Unit* target = aurApp->GetTarget();
4984
4985 // Xinef: Do not apply such auras in normal way
4986 if (GetAmount() >= 1000)
4987 {
4988 target->SetInstantCast(apply);
4989 return;
4990 }
4991
4992 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
4993}
void SetInstantCast(bool set)
Definition Unit.h:1511
void ApplyCastTimePercentMod(float val, bool apply)
Definition Unit.cpp:17122

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

◆ HandleModCharm()

void AuraEffect::HandleModCharm ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3621{
3622 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3623 return;
3624
3625 Unit* target = aurApp->GetTarget();
3626
3627 Unit* caster = GetCaster();
3628
3629 if (apply)
3630 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3631 else
3632 target->RemoveCharmedBy(caster);
3633}
@ 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

◆ HandleModConfuse()

void AuraEffect::HandleModConfuse ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3488{
3489 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3490 return;
3491
3492 Unit* target = aurApp->GetTarget();
3493
3494 target->SetControlled(apply, UNIT_STATE_CONFUSED);
3495}
@ 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
5184{
5186 return;
5187
5188 Unit* target = aurApp->GetTarget();
5189
5190 // apply item specific bonuses for already equipped weapon
5191 if (target->IsPlayer())
5192 {
5193 for (int i = 0; i < MAX_ATTACK; ++i)
5194 if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
5195 target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply);
5196 }
5197
5198 // GetMiscValue() is bitmask of spell schools
5199 // 1 (0-bit) - normal school damage (SPELL_SCHOOL_MASK_NORMAL)
5200 // 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wands
5201 // 127 - full bitmask any damages
5202 //
5203 // mods must be applied base at equipped weapon class and subclass comparison
5204 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
5205 // GetMiscValue() comparison with item generated damage types
5206
5207 if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0 && sScriptMgr->CanModAuraEffectDamageDone(this, target, aurApp, mode, apply))
5208 {
5209 // apply generic physical damage bonuses including wand case
5210 if (GetSpellInfo()->EquippedItemClass == -1 || !target->IsPlayer())
5211 {
5215
5216 if (target->IsPlayer())
5217 {
5218 if (GetAmount() > 0)
5220 else
5222 }
5223 }
5224 else
5225 {
5226 // done in Player::_ApplyWeaponDependentAuraMods
5227 }
5228 }
5229
5230 // Skip non magic case for Speedup
5232 return;
5233
5234 if (GetSpellInfo()->EquippedItemClass != -1 || GetSpellInfo()->EquippedItemInventoryTypeMask != 0)
5235 {
5236 // wand magic case (skip generic to all item spell bonuses)
5237 // done in Player::_ApplyWeaponDependentAuraMods
5238
5239 // Skip item specific requirements for not wand magic damage
5240 return;
5241 }
5242
5243 // Magic damage modifiers implemented in Unit::SpellDamageBonus
5244 // This information for client side use only
5245 if (target->IsPlayer())
5246 {
5247 if (GetAmount() > 0)
5248 {
5249 for (uint32 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
5250 {
5251 if ((GetMiscValue() & (1 << i)) != 0)
5253 }
5254 }
5255 else
5256 {
5257 for (uint32 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
5258 {
5259 if ((GetMiscValue() & (1 << i)) != 0)
5261 }
5262 }
5263 if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
5264 pet->UpdateAttackPowerAndDamage();
5265 }
5266}
@ SPELL_SCHOOL_HOLY
Definition SharedDefines.h:284
@ SPELL_SCHOOL_MASK_MAGIC
Definition SharedDefines.h:312
@ UNIT_MOD_DAMAGE_OFFHAND
Definition Unit.h:166
@ UNIT_MOD_DAMAGE_RANGED
Definition Unit.h:167
@ UNIT_MOD_DAMAGE_MAINHAND
Definition Unit.h:165
@ 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 _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
Definition Player.cpp:7083

References Player::_ApplyWeaponDependentAuraDamageMod(), Object::ApplyModInt32Value(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), Unit::GetGuardianPet(), GetMiscValue(), GetSpellInfo(), AuraApplication::GetTarget(), Player::GetWeaponForAttack(), Unit::HandleStatModifier(), Object::IsPlayer(), MAX_ATTACK, MAX_SPELL_SCHOOL, PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, PLAYER_FIELD_MOD_DAMAGE_DONE_POS, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_MASK_MAGIC, SPELL_SCHOOL_MASK_NORMAL, sScriptMgr, Object::ToPlayer(), TOTAL_VALUE, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, and UNIT_MOD_DAMAGE_RANGED.

◆ HandleModDamagePercentDone()

void AuraEffect::HandleModDamagePercentDone ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5269{
5271 return;
5272
5273 Unit* target = aurApp->GetTarget();
5274 if (!target)
5275 return;
5276
5277 if (!sScriptMgr->CanModAuraEffectModDamagePercentDone(this, target, aurApp, mode, apply))
5278 return;
5279
5280 if (target->IsPlayer())
5281 {
5282 for (int i = 0; i < MAX_ATTACK; ++i)
5283 if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), false))
5284 target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply);
5285 }
5286
5287 if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) && (GetSpellInfo()->EquippedItemClass == -1 || !target->IsPlayer()))
5288 {
5292
5293 if (target->IsPlayer())
5295 }
5296 else
5297 {
5298 // done in Player::_ApplyWeaponDependentAuraMods for SPELL_SCHOOL_MASK_NORMAL && EquippedItemClass != -1 and also for wand case
5299 }
5300}
@ PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
Definition UpdateFields.h:362
void ApplyPercentModFloatValue(uint16 index, float val, bool apply)
Definition Object.cpp:829

References Player::_ApplyWeaponDependentAuraDamageMod(), Object::ApplyPercentModFloatValue(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), GetSpellInfo(), AuraApplication::GetTarget(), Player::GetWeaponForAttack(), Unit::HandleStatModifier(), Object::IsPlayer(), MAX_ATTACK, PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, SPELL_SCHOOL_MASK_NORMAL, sScriptMgr, Object::ToPlayer(), TOTAL_PCT, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, and UNIT_MOD_DAMAGE_RANGED.

◆ HandleModFear()

void AuraEffect::HandleModFear ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3498{
3499 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3500 return;
3501
3502 Unit* target = aurApp->GetTarget();
3503
3504 target->SetControlled(apply, UNIT_STATE_FLEEING, GetCaster(), true);
3505}
@ 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
4544{
4546 return;
4547
4548 Unit* target = aurApp->GetTarget();
4549
4550 if (!target->IsPlayer())
4551 return;
4552 // implemented in Unit::SpellHealingBonus
4553 // this information is for client side only
4555}
void UpdateSpellDamageAndHealingBonus()
Definition StatSystem.cpp:177

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
4894{
4896 return;
4897
4898 Unit* target = aurApp->GetTarget();
4899
4900 if (target->IsPlayer())
4901 {
4902 target->ToPlayer()->UpdateMeleeHitChances();
4903 target->ToPlayer()->UpdateRangedHitChances();
4904 }
4905 else
4906 {
4907 target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
4908 target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
4909 }
4910}
void UpdateMeleeHitChances()
Definition StatSystem.cpp:853
void UpdateRangedHitChances()
Definition StatSystem.cpp:859
float m_modRangedHitChance
Definition Unit.h:1998
float m_modMeleeHitChance
Definition Unit.h:1997

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
1555{
1557 return;
1558
1559 Unit* target = aurApp->GetTarget();
1561
1562 if (apply)
1563 {
1564 // apply glow vision
1565 if (target->IsPlayer() && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10))
1567
1568 target->m_invisibility.AddFlag(type);
1569 target->m_invisibility.AddValue(type, GetAmount());
1570 }
1571 else
1572 {
1573 if (!target->HasInvisibilityAura())
1574 {
1575 // if not have different invisibility auras.
1576 // always remove glow vision
1577 if (target->IsPlayer())
1579
1580 target->m_invisibility.DelFlag(type);
1581 }
1582 else
1583 {
1584 bool found = false;
1586 for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i)
1587 {
1588 if (GetMiscValue() == (*i)->GetMiscValue())
1589 {
1590 found = true;
1591 break;
1592 }
1593 }
1594 if (!found)
1595 {
1596 target->m_invisibility.DelFlag(type);
1597
1598 // if not have invisibility auras of type INVISIBILITY_GENERAL
1599 // remove glow vision
1601 {
1603 }
1604 }
1605 }
1606
1607 target->m_invisibility.AddValue(type, -GetAmount());
1608 }
1609
1610 // call functions which may have additional effects after chainging state of unit
1611 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1612 {
1613 // drop flag at invisibiliy in bg
1615 }
1616
1617 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1618 target->bRequestForcedVisibilityUpdate = false;
1619}
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition Player.h:574
@ PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION
Definition Player.h:551
InvisibilityType
Definition SharedDefines.h:1254
@ INVISIBILITY_UNK10
Definition SharedDefines.h:1265
@ INVISIBILITY_GENERAL
Definition SharedDefines.h:1255
@ SPELL_AURA_MOD_INVISIBILITY
Definition SpellAuraDefines.h:81
bool HasFlag(FLAG_TYPE flag) const
Definition Object.h:372
void AddFlag(FLAG_TYPE flag)
Definition Object.h:373
void DelFlag(FLAG_TYPE flag)
Definition Object.h:374
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:378
bool Instanceable() const
Definition Map.h:294
bool IsPlayer() const
Definition ObjectGuid.h:168
bool bRequestForcedVisibilityUpdate
Definition Unit.h:2026
ObjectGuid GetOwnerGUID() const
Definition Unit.h:684
bool HasInvisibilityAura() const
Definition Unit.h:1757
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition Object.h:525

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
1530{
1532 return;
1533
1534 Unit* target = aurApp->GetTarget();
1536
1537 if (apply)
1538 {
1539 target->m_invisibilityDetect.AddFlag(type);
1540 target->m_invisibilityDetect.AddValue(type, GetAmount());
1541 }
1542 else
1543 {
1544 if (!target->HasInvisibilityDetectAura())
1545 target->m_invisibilityDetect.DelFlag(type);
1546
1547 target->m_invisibilityDetect.AddValue(type, -GetAmount());
1548 }
1549
1550 // call functions which may have additional effects after chainging state of unit
1551 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1552}
bool HasInvisibilityDetectAura() const
Definition Unit.h:1758
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition Object.h:526

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
4677{
4679 return;
4680
4681 Unit* target = aurApp->GetTarget();
4682
4683 if (!target->IsPlayer())
4684 return;
4685
4686 //Note: an increase in regen does NOT cause threat.
4687 target->ToPlayer()->UpdateManaRegen();
4688}
void UpdateManaRegen()
Definition StatSystem.cpp:926

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
4128{
4129 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4130 return;
4131
4132 Unit* target = aurApp->GetTarget();
4133 uint32 mechanic = 0;
4134
4135 switch (GetId())
4136 {
4137 case 46924: // BladeStorm
4139 break;
4140 case 34471: // The Beast Within
4141 case 19574: // Bestial Wrath
4142 case 38484: // Bestial Wrath
4143 case 40081: // Free friend (Black Temple)
4161 break;
4162 case 42292: // PvP trinket
4163 case 59752: // Every Man for Himself
4164 case 65547: // PvP trinket for Faction Champions (ToC 25)
4165 case 53490: // Bullheaded
4166 case 46227: // Medalion of Immunity
4168 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.
4169 // Actually we should apply immunities here, too, but the aura has only 100 ms duration, so there is practically no point
4170 break;
4171 case 54508: // Demonic Empowerment
4172 mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
4177 break;
4178 default:
4179 if (GetMiscValue() < 1)
4180 return;
4181 mechanic = 1 << GetMiscValue();
4183 break;
4184 }
4185
4186 if (apply && GetSpellInfo()->HasAttribute(SPELL_ATTR1_IMMUNITY_PURGES_EFFECT))
4187 {
4188 // Xinef: exception for purely snare mechanic (eg. hands of freedom)!
4189 if (mechanic == (1 << MECHANIC_SNARE))
4190 target->RemoveMovementImpairingAuras(false);
4191 else
4193 }
4194}
@ MECHANIC_FEAR
Definition SharedDefines.h:1330
@ MECHANIC_DISORIENTED
Definition SharedDefines.h:1327
@ MECHANIC_KNOCKOUT
Definition SharedDefines.h:1339
@ MECHANIC_CHARM
Definition SharedDefines.h:1326
@ MECHANIC_TURN
Definition SharedDefines.h:1348
@ MECHANIC_STUN
Definition SharedDefines.h:1337
@ MECHANIC_FREEZE
Definition SharedDefines.h:1338
@ MECHANIC_ROOT
Definition SharedDefines.h:1332
@ MECHANIC_SLEEP
Definition SharedDefines.h:1335
@ MECHANIC_DAZE
Definition SharedDefines.h:1352
@ MECHANIC_SNARE
Definition SharedDefines.h:1336
@ MECHANIC_SHACKLE
Definition SharedDefines.h:1345
@ MECHANIC_SAPPED
Definition SharedDefines.h:1355
@ MECHANIC_HORROR
Definition SharedDefines.h:1349
#define IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK
Definition SharedDefines.h:1361
@ 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:5285
void RemoveMovementImpairingAuras(bool withRoot)
Definition Unit.cpp:5266

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

◆ HandleModOffhandDamagePercent()

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

◆ HandleModPercentStat()

void AuraEffect::HandleModPercentStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4460{
4462 return;
4463
4464 Unit* target = aurApp->GetTarget();
4465
4466 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4467 {
4468 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4469 return;
4470 }
4471
4472 // only players currently use base stats
4473 if (!target->IsPlayer())
4474 return;
4475
4476 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
4477 {
4478 if (GetMiscValue() == i || GetMiscValue() == -1)
4479 target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_amount), apply);
4480 }
4481}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_PCT, GetMiscValue(), AuraApplication::GetTarget(), Unit::HandleStatModifier(), Object::IsPlayer(), LOG_ERROR, m_amount, MAX_STATS, STAT_STRENGTH, and UNIT_MOD_STAT_START.

◆ HandleModPossess()

void AuraEffect::HandleModPossess ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3546{
3547 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3548 return;
3549
3550 Unit* target = aurApp->GetTarget();
3551
3552 Unit* caster = GetCaster();
3553
3554 // no support for posession AI yet
3555 if (caster && caster->IsCreature())
3556 {
3557 HandleModCharm(aurApp, mode, apply);
3558 return;
3559 }
3560
3561 if (apply)
3562 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3563 else
3564 target->RemoveCharmedBy(caster);
3565}
@ CHARM_TYPE_POSSESS
Definition CharmInfo.h:46
void HandleModCharm(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:3620

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
3568{
3569 // Used by spell "Eyes of the Beast"
3570
3571 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3572 return;
3573
3574 Unit* caster = GetCaster();
3575 if (!caster || !caster->IsPlayer())
3576 return;
3577
3578 //seems it may happen that when removing it is no longer owner's pet
3579 //if (caster->ToPlayer()->GetPet() != target)
3580 // return;
3581
3582 Unit* target = aurApp->GetTarget();
3583 if (!target->IsCreature() || !target->IsPet())
3584 return;
3585
3586 Pet* pet = target->ToPet();
3587
3588 if (apply)
3589 {
3590 if (caster->ToPlayer()->GetPet() != pet)
3591 return;
3592
3593 // Must clear current motion or pet leashes back to owner after a few yards
3594 // when under spell 'Eyes of the Beast'
3595 pet->GetMotionMaster()->Clear();
3596 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3597 }
3598 else
3599 {
3600 pet->RemoveCharmedBy(caster);
3601
3602 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
3603 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
3604 else
3605 {
3606 // Reinitialize the pet bar or it will appear greyed out
3607 caster->ToPlayer()->PetSpellInitialize();
3608
3609 // Follow owner only if not fighting or owner didn't click "stay" at new location
3610 // This may be confusing because pet bar shows "stay" when under the spell but it retains
3611 // the "follow" flag. Player MUST click "stay" while under the spell.
3612 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3613 {
3615 }
3616 }
3617 }
3618}
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:45
#define PET_FOLLOW_DIST
Definition PetDefines.h:202
@ COMMAND_STAY
Definition Unit.h:555
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:409
void Clear(bool reset=true)
Definition MotionMaster.h:167
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition Pet.cpp:880
void PetSpellInitialize()
Definition Player.cpp:9529
Pet * ToPet()
Definition Unit.h:700
CharmInfo * GetCharmInfo()
Definition Unit.h:1215
Unit * GetVictim() const
Definition Unit.h:862
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition Object.cpp:1332
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
5345{
5347 return;
5348
5349 Unit* target = aurApp->GetTarget();
5350
5351 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5352 if (GetMiscValue() & (1 << i))
5354}
@ 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
5332{
5334 return;
5335
5336 Unit* target = aurApp->GetTarget();
5337
5338 float amount = CalculatePct(1.0f, GetAmount());
5339 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5340 if (GetMiscValue() & (1 << i))
5342}
@ UNIT_FIELD_POWER_COST_MULTIPLIER
Definition UpdateFields.h:171
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
Definition Object.cpp:822

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
4654{
4656 return;
4657
4658 Unit* target = aurApp->GetTarget();
4659
4660 if (!target->IsPlayer())
4661 return;
4662
4663 // Update manaregen value
4664 if (GetMiscValue() == POWER_MANA)
4665 target->ToPlayer()->UpdateManaRegen();
4666 else if (GetMiscValue() == POWER_RUNE)
4668 // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
4669}
@ POWER_RUNE
Definition SharedDefines.h:274
void UpdateRuneRegen(RuneType rune)
Definition StatSystem.cpp:960

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

Referenced by HandleModPowerRegenPCT().

◆ HandleModPowerRegenPCT()

void AuraEffect::HandleModPowerRegenPCT ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4672{
4673 HandleModPowerRegen(aurApp, mode, apply);
4674}
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition SpellAuraEffects.cpp:4653

References HandleModPowerRegen().

◆ HandleModRating()

void AuraEffect::HandleModRating ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5070{
5072 return;
5073
5074 Unit* target = aurApp->GetTarget();
5075
5076 if (!target->IsPlayer())
5077 return;
5078
5079 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
5080 if (GetMiscValue() & (1 << rating))
5081 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
5082}
#define MAX_COMBAT_RATING
Definition Unit.h:244
CombatRating
Definition Unit.h:216
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition Player.cpp:5287

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
5085{
5087 return;
5088
5089 Unit* target = aurApp->GetTarget();
5090
5091 if (!target->IsPlayer())
5092 return;
5093
5094 // Just recalculate ratings
5095 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
5096 if (GetMiscValue() & (1 << rating))
5097 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
5098}

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
4376{
4378 return;
4379
4380 Unit* target = aurApp->GetTarget();
4381
4382 for (int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
4383 {
4384 if (GetMiscValue() & int32(1 << i))
4385 {
4387 if (target->IsPlayer() || target->IsPet())
4388 {
4389 target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)GetAmount(), apply);
4390 target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)GetAmount(), apply);
4391 }
4392 }
4393 }
4394}
void ApplyResistanceBuffModsPercentMod(SpellSchools school, bool positive, float val, bool apply)
Definition Unit.h:1136

References Unit::ApplyResistanceBuffModsPercentMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Unit::HandleStatModifier(), Unit::IsPet(), Object::IsPlayer(), MAX_SPELL_SCHOOL, SPELL_SCHOOL_NORMAL, TOTAL_PCT, and UNIT_MOD_RESISTANCE_START.

◆ HandleModSpellCritChance()

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

◆ HandleModSpellCritChanceShool()

void AuraEffect::HandleModSpellCritChanceShool ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4939{
4941 return;
4942
4943 Unit* target = aurApp->GetTarget();
4944
4945 if (!target->IsPlayer())
4946 return;
4947
4948 for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
4949 if (GetMiscValue() & (1 << school))
4950 target->ToPlayer()->UpdateSpellCritChance(school);
4951}
void UpdateSpellCritChance(uint32 school)
Definition StatSystem.cpp:822

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

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
4484{
4486 return;
4487
4488 Unit* target = aurApp->GetTarget();
4489
4490 if (!target->IsPlayer())
4491 return;
4492
4493 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4494 // This information for client side use only
4495 // Recalculate bonus
4497}

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

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
4500{
4502 return;
4503
4504 Unit* target = aurApp->GetTarget();
4505
4506 if (!target->IsPlayer())
4507 return;
4508
4509 // Recalculate bonus
4511}

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
4913{
4915 return;
4916
4917 Unit* target = aurApp->GetTarget();
4918
4919 if (target->IsPlayer())
4920 target->ToPlayer()->UpdateSpellHitChances();
4921 else
4922 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
4923}
void UpdateSpellHitChances()
Definition StatSystem.cpp:865
float m_modSpellHitChance
Definition Unit.h:1999

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
3814{
3815 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3816 return;
3817
3818 Unit* target = aurApp->GetTarget();
3819 std::list <AuraType> aura_immunity_list;
3820 uint32 mechanic_immunity_list = 0;
3821 int32 miscVal = GetMiscValue();
3822
3823 switch (miscVal)
3824 {
3825 case 96:
3826 case 1615:
3827 {
3828 if (!GetAmount())
3829 {
3830 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3831 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3832 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3833 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3835 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3836
3849 aura_immunity_list.push_back(SPELL_AURA_MOD_CHARM);
3850 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3851 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3852 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3853 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3854 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3855 }
3856 break;
3857 }
3858 case 679:
3859 {
3860 if (GetId() == 57742)
3861 {
3862 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3863 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3864 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3865 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3867 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3868
3881 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3882 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3883 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3884 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3885 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3886 }
3887 break;
3888 }
3889 case 1557:
3890 {
3891 if (GetId() == 64187)
3892 {
3893 mechanic_immunity_list = (1 << MECHANIC_STUN);
3895 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3896 }
3897 else
3898 {
3899 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3900 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3901 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3902 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3904 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3905
3918 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3919 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3920 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3921 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3922 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3923 }
3924 break;
3925 }
3926 case 1614:
3927 case 1694:
3928 {
3930 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3931 break;
3932 }
3933 case 1630:
3934 {
3935 if (!GetAmount())
3936 {
3938 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3939 }
3940 else
3941 {
3942 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3943 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3944 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3945 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3947 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3948
3961 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3962 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3963 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3964 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3965 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3966 }
3967 break;
3968 }
3969 case 477:
3970 case 1733:
3971 case 1632:
3972 {
3973 if (!GetAmount())
3974 {
3975 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3976 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3977 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3978 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3980 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN) | (1 << MECHANIC_BANISH);
3981
3997 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3998
3999 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
4000 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
4001 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
4002 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
4003 }
4004 break;
4005 }
4006 case 878:
4007 {
4008 if (GetAmount() == 1)
4009 {
4010 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN)
4011 | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE);
4012
4017 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
4018 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
4019 }
4020 break;
4021 }
4022 default:
4023 break;
4024 }
4025
4026 if (aura_immunity_list.empty())
4027 {
4028 // Roots, OK
4029 if (GetMiscValue() & (1 << 0))
4030 {
4031 mechanic_immunity_list = (1 << MECHANIC_SNARE);
4032
4034 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
4035 }
4036 // Taunt, OK
4037 if (GetMiscValue() & (1 << 1))
4038 {
4039 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
4040 }
4041 // Crowd-Control auras?
4042 if (GetMiscValue() & (1 << 2))
4043 {
4044 mechanic_immunity_list = (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED);
4045
4048 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
4049 }
4050 // Interrupt, OK
4051 if (GetMiscValue() & (1 << 3))
4052 {
4053 mechanic_immunity_list = (1 << MECHANIC_INTERRUPT);
4054
4056 }
4057 // Transform?
4058 if (GetMiscValue() & (1 << 4))
4059 {
4060 aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
4061 }
4062 // Stun auras breakable by damage (Incapacitate effects), OK
4063 if (GetMiscValue() & (1 << 5))
4064 {
4065 mechanic_immunity_list = (1 << MECHANIC_KNOCKOUT);
4066
4068 }
4069 // // Slowing effects
4070 if (GetMiscValue() & (1 << 6))
4071 {
4072 mechanic_immunity_list = (1 << MECHANIC_SNARE);
4073
4075 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
4076 }
4077 // Charm auras?, 90%
4078 if ((GetMiscValue() & (1 << 7)))
4079 {
4080 mechanic_immunity_list = (1 << MECHANIC_CHARM);
4081
4083 aura_immunity_list.push_back(SPELL_AURA_MOD_CHARM);
4084 aura_immunity_list.push_back(SPELL_AURA_MOD_POSSESS);
4085 }
4086 // UNK
4087 // if ((GetMiscValue() & (1 << 8)))
4088 // {
4089 // }
4090 // Fear, OK
4091 if (GetMiscValue() & (1 << 9))
4092 {
4093 mechanic_immunity_list = (1 << MECHANIC_FEAR);
4094
4096 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
4097 }
4098 // Stuns, OK
4099 if (GetMiscValue() & (1 << 10))
4100 {
4101 mechanic_immunity_list = (1 << MECHANIC_STUN);
4102
4104 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
4105 }
4106 }
4107
4108 // apply immunities
4109 for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
4110 target->ApplySpellImmune(GetId(), IMMUNITY_STATE, *iter, apply);
4111
4112 // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated.
4113 if (GetId() == 46924)
4114 {
4115 // Knockback and hex
4117 }
4118
4120 {
4121 target->RemoveAurasWithMechanic(mechanic_immunity_list, AURA_REMOVE_BY_DEFAULT, GetId());
4122 for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
4123 target->RemoveAurasByType(*iter);
4124 }
4125}
@ SPELL_EFFECT_ATTACK_ME
Definition SharedDefines.h:892
@ SPELL_EFFECT_KNOCK_BACK_DEST
Definition SharedDefines.h:922
@ SPELL_EFFECT_KNOCK_BACK
Definition SharedDefines.h:876
@ MECHANIC_INTERRUPT
Definition SharedDefines.h:1351
@ 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
1647{
1649 return;
1650
1651 Unit* target = aurApp->GetTarget();
1653
1654 if (apply)
1655 {
1656 target->m_stealth.AddFlag(type);
1657 target->m_stealth.AddValue(type, GetAmount());
1658
1660 if (target->IsPlayer())
1662
1663 // interrupt autoshot
1665 {
1667 target->ToPlayer()->SendAutoRepeatCancel(target);
1668 }
1669 }
1670 else
1671 {
1672 target->m_stealth.AddValue(type, -GetAmount());
1673
1674 if (!target->HasStealthAura()) // if last SPELL_AURA_MOD_STEALTH
1675 {
1676 target->m_stealth.DelFlag(type);
1677
1679 if (target->IsPlayer())
1681 }
1682 }
1683
1684 // call functions which may have additional effects after chainging state of unit
1685 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1686 {
1687 // drop flag at stealth in bg
1689 }
1690
1691 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1692 target->bRequestForcedVisibilityUpdate = false;
1693}
@ PLAYER_FIELD_BYTE2_STEALTH
Definition Player.h:573
StealthType
Definition SharedDefines.h:1246
@ UNIT_STAND_FLAGS_CREEP
Definition UnitDefines.h:48
bool HasStealthAura() const
Definition Unit.h:1755
void RemoveStandFlags(uint8 flags)
Definition Unit.h:1701
void SetStandFlags(uint8 flags)
Definition Unit.h:1700
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition Object.h:522

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
1622{
1624 return;
1625
1626 Unit* target = aurApp->GetTarget();
1628
1629 if (apply)
1630 {
1631 target->m_stealthDetect.AddFlag(type);
1632 target->m_stealthDetect.AddValue(type, GetAmount());
1633 }
1634 else
1635 {
1636 if (!target->HasStealthDetectAura())
1637 target->m_stealthDetect.DelFlag(type);
1638
1639 target->m_stealthDetect.AddValue(type, -GetAmount());
1640 }
1641
1642 // call functions which may have additional effects after chainging state of unit
1643 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1644}
bool HasStealthDetectAura() const
Definition Unit.h:1756
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition Object.h:523

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
1696{
1698 return;
1699
1700 Unit* target = aurApp->GetTarget();
1702
1703 if (apply)
1704 target->m_stealth.AddValue(type, GetAmount());
1705 else
1706 target->m_stealth.AddValue(type, -GetAmount());
1707
1708 // call functions which may have additional effects after chainging state of unit
1709 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1710}

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
4412{
4414 return;
4415
4416 Unit* target = aurApp->GetTarget();
4417
4418 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
4419
4420 // show armor penetration
4421 if (target->IsPlayer() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
4423
4424 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
4427}
@ SPELL_SCHOOL_MASK_SPELL
Definition SharedDefines.h:308
@ 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
3461{
3462 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3463 return;
3464
3465 Unit* target = aurApp->GetTarget();
3466
3467 if (!target->IsAlive() || !target->CanHaveThreatList())
3468 return;
3469
3470 Unit* caster = GetCaster();
3471 if (!caster || !caster->IsAlive())
3472 return;
3473
3474 if (apply)
3475 target->TauntApply(caster);
3476 else
3477 {
3478 // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat
3479 target->TauntFadeOut(caster);
3480 }
3481}
void TauntApply(Unit *victim)
Definition Unit.cpp:14716
void TauntFadeOut(Unit *taunter)
Definition Unit.cpp:14746

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
3435{
3437 return;
3438
3439 Unit* target = aurApp->GetTarget();
3440 for (int8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
3441 if (GetMiscValue() & (1 << i))
3442 ApplyPercentModFloatVar(target->m_threatModifier[i], float(GetAmount()), apply);
3443}
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition Util.h:50
float m_threatModifier[MAX_SPELL_SCHOOL]
Definition Unit.h:2002

References ApplyPercentModFloatVar(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Unit::m_threatModifier, and MAX_SPELL_SCHOOL.

◆ HandleModTotalPercentStat()

void AuraEffect::HandleModTotalPercentStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4558{
4560 return;
4561
4562 Unit* target = aurApp->GetTarget();
4563
4564 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4565 {
4566 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4567 return;
4568 }
4569
4570 // save current health state
4571 float healthPct = target->GetHealthPct();
4572 bool alive = target->IsAlive();
4573 float value = GetAmount();
4574
4575 if (GetId() == 67480) // xinef: hack fix for blessing of sanctuary stats stack with blessing of kings...
4576 {
4577 if (value) // not turned off
4578 value = 10.0f;
4579 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4580 {
4581 if (i == STAT_STRENGTH || i == STAT_STAMINA)
4582 {
4583 if (apply && (target->IsPlayer() || target->IsPet()))
4584 target->ApplyStatPercentBuffMod(Stats(i), value, apply);
4585
4586 target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply);
4587
4588 if (!apply && (target->IsPlayer() || target->IsPet()))
4589 target->ApplyStatPercentBuffMod(Stats(i), value, apply);
4590 }
4591 }
4592 return;
4593 }
4594
4595 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4596 {
4597 if (GetMiscValue() == i || GetMiscValue() == -1)
4598 {
4599 if (apply && (target->IsPlayer() || target->IsPet()))
4600 target->ApplyStatPercentBuffMod(Stats(i), value, apply);
4601
4602 target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply);
4603
4604 if (!apply && (target->IsPlayer() || target->IsPet()))
4605 target->ApplyStatPercentBuffMod(Stats(i), value, apply);
4606 }
4607 }
4608
4609 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_UNK4 0x00000010 flag)
4611 target->SetHealth(std::max<uint32>(uint32(healthPct * target->GetMaxHealth() * 0.01f), (alive ? 1 : 0)));
4612}
@ SPELL_ATTR0_IS_ABILITY
Definition SharedDefines.h:386
@ STAT_STAMINA
Definition SharedDefines.h:260
void ApplyStatPercentBuffMod(Stats stat, float val, bool apply)
Definition Unit.cpp:15389

References Unit::ApplyStatPercentBuffMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), Unit::GetHealthPct(), GetId(), Unit::GetMaxHealth(), GetMiscValue(), AuraApplication::GetTarget(), Unit::HandleStatModifier(), SpellInfo::HasAttribute(), Unit::IsAlive(), Unit::IsPet(), Object::IsPlayer(), LOG_ERROR, m_spellInfo, MAX_STATS, Unit::SetHealth(), SPELL_ATTR0_IS_ABILITY, STAT_STAMINA, STAT_STRENGTH, TOTAL_PCT, and UNIT_MOD_STAT_START.

◆ HandleModUnattackable()

void AuraEffect::HandleModUnattackable ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2934{
2936 return;
2937
2938 Unit* target = aurApp->GetTarget();
2939
2940 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2941 if (!apply && target->HasUnattackableAura())
2942 return;
2943
2945
2946 // call functions which may have additional effects after chainging state of unit
2947 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
2948 {
2949 // xinef: this aura should not stop combat (movie with sindragosa proves that)
2950 //target->CombatStop();
2952 }
2953}
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:251
bool HasUnattackableAura() const
Definition Unit.h:1747

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

◆ HandleNoImmediateEffect()

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

◆ HandleNoReagentUseAura()

void AuraEffect::HandleNoReagentUseAura ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5375{
5376 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5377 return;
5378
5379 Unit* target = aurApp->GetTarget();
5380
5381 if (!target->IsPlayer())
5382 return;
5383
5384 flag96 mask;
5386 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
5387 mask |= (*i)->m_spellInfo->Effects[(*i)->m_effIndex].SpellClassMask;
5388
5389 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1, mask[0]);
5390 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 1, mask[1]);
5391 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2, mask[2]);
5392}
@ SPELL_AURA_NO_REAGENT_USE
Definition SpellAuraDefines.h:319
@ PLAYER_NO_REAGENT_COST_1
Definition UpdateFields.h:387
Definition Util.h:451

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

◆ HandleNULL()

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

◆ HandleObsModPowerAuraTick()

void AuraEffect::HandleObsModPowerAuraTick ( Unit target,
Unit caster 
) const
7113{
7115 if (GetMiscValue() == POWER_ALL)
7116 PowerType = target->getPowerType();
7117 else
7119
7120 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
7121 return;
7122
7123 if (target->HasUnitState(UNIT_STATE_ISOLATED))
7124 {
7125 SendTickImmune(target, caster);
7126 return;
7127 }
7128
7129 // don't regen when permanent aura target has full power
7130 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
7131 return;
7132
7133 // ignore negative values (can be result apply spellmods to aura damage
7134 uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(PowerType) / 100;
7135 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
7136 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
7137 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
7138 target->SendPeriodicAuraLog(&pInfo);
7139
7140 int32 gain = target->ModifyPower(PowerType, amount);
7141
7142 if (caster)
7143 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
7144}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:169
@ POWER_ALL
Definition SharedDefines.h:277
void SendTickImmune(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:1101
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:14201
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1066
bool HasUnitState(const uint32 f) const
Definition Unit.h:707
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition Unit.cpp:6444
std::string ToString(Type &&val, Params &&... params)
Definition StringConvert.h:250
Definition Unit.h:512

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

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

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

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 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
7007
7008 bool haveCastItem = GetBase()->GetCastItemGUID();
7009
7010 // Health Funnel
7011 // damage caster for heal amount
7012 // xinef: caster is available, checked earlier
7013 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST))
7014 {
7015 uint32 manaPerSecond = GetSpellInfo()->ManaPerSecond;
7016 if ((int32)manaPerSecond > gain && gain > 0)
7017 {
7018 manaPerSecond = gain;
7019 }
7020
7021 uint32 absorb2 = 0;
7022 Unit::DealDamageMods(caster, manaPerSecond, &absorb2);
7023
7025 Unit::DealDamage(caster, caster, manaPerSecond, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
7026 }
7027
7028 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
7029 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
7031 if (healInfo.GetAbsorb() > 0)
7032 procEx |= PROC_EX_ABSORB;
7033
7034 // ignore item heals
7035 if (!haveCastItem && GetAuraType() != SPELL_AURA_OBS_MOD_HEALTH) // xinef: dont allow obs_mod_health to proc spells, this is passive regeneration and not hot
7036 Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, heal, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, nullptr, &healInfo);
7037}
@ SPELL_ATTR2_NO_TARGET_PER_SECOND_COST
Definition SharedDefines.h:467
@ 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:220
@ SELF_DAMAGE
Definition Unit.h:253
uint32 GetTickNumber() const
Definition SpellAuraEffects.h:87
AuraObjectType GetType() const
Definition SpellAuras.cpp:481
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:103
Definition Unit.h:373
uint32 ManaPerSecond
Definition SpellInfo.h:365
static void CalcHealAbsorb(HealInfo &healInfo)
Definition Unit.cpp:2513
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition Unit.cpp:10996
int32 GetMaxPositiveAuraModifier(AuraType auratype)
Definition Unit.cpp:5990
static uint32 SpellCriticalHealingBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:12366
int32 GetMaxNegativeAuraModifier(AuraType auratype) const
Definition Unit.cpp:6004
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:12615

References AddPct(), BASE_ATTACK, Unit::CalcHealAbsorb(), 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::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:11289

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

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

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

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
6293{
6294 // generic casting code with custom spells and target/caster customs
6295 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
6296
6297 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
6298 SpellInfo const* auraSpellInfo = GetSpellInfo();
6299 uint32 auraId = auraSpellInfo->Id;
6300
6301 // specific code for cases with no trigger spell provided in field
6302 if (!triggeredSpellInfo)
6303 {
6304 switch (auraSpellInfo->SpellFamilyName)
6305 {
6307 {
6308 switch (auraId)
6309 {
6310 // Thaumaturgy Channel
6311 case 9712:
6312 triggerSpellId = 21029;
6313 if (caster)
6314 caster->CastSpell(caster, triggerSpellId, true);
6315 return;
6316 // Brood Affliction: Bronze
6317 case 23170:
6318 // Only 10% chance of triggering spell
6319 if (roll_chance_f(10.f))
6320 {
6321 triggerSpellId = 23171;
6322 }
6323 break;
6324 // Restoration
6325 case 24379:
6326 case 23493:
6327 {
6328 if (caster)
6329 {
6330 int32 heal = caster->CountPctFromMaxHealth(10);
6331 HealInfo healInfo(caster, target, heal, auraSpellInfo, auraSpellInfo->GetSchoolMask());
6332 caster->HealBySpell(healInfo);
6333
6334 if (int32 mana = caster->GetMaxPower(POWER_MANA))
6335 {
6336 mana /= 10;
6337 caster->EnergizeBySpell(caster, 23493, mana, POWER_MANA);
6338 }
6339 }
6340 return;
6341 }
6342 // Nitrous Boost
6343 case 27746:
6344 if (caster && target->GetPower(POWER_MANA) >= 10)
6345 {
6346 target->ModifyPower(POWER_MANA, -10);
6347 target->SendEnergizeSpellLog(caster, 27746, 10, POWER_MANA);
6348 }
6349 else
6350 target->RemoveAurasDueToSpell(27746);
6351 return;
6352 // Frost Blast
6353 case 27808:
6354 if (caster)
6355 {
6356 caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, nullptr, this);
6357 if (GetTickNumber() == 1)
6358 caster->CastSpell(target, 27808, true);
6359 }
6360 return;
6361 // Inoculate Nestlewood Owlkin
6362 case 29528:
6363 if (!target->IsCreature()) // prevent error reports in case ignored player target
6364 return;
6365 break;
6366 // Feed Captured Animal
6367 case 29917:
6368 triggerSpellId = 29916;
6369 break;
6370 // Extract Gas
6371 case 30427:
6372 {
6373 // move loot to player inventory and despawn target
6374 if (caster && caster->IsPlayer() &&
6375 target->IsCreature() &&
6377 {
6378 Player* player = caster->ToPlayer();
6379 Creature* creature = target->ToCreature();
6380 // missing lootid has been reported on startup - just return
6381 if (!creature->GetCreatureTemplate()->SkinLootId)
6382 return;
6383
6385
6386 creature->DespawnOrUnsummon();
6387 }
6388 return;
6389 }
6390 // Quake
6391 case 30576:
6392 triggerSpellId = 30571;
6393 break;
6394 // Doom
6396 // so instakill will be naturally done before trigger spell
6397 case 31347:
6398 {
6399 target->CastSpell(target, 31350, true, nullptr, this);
6400 Unit::Kill(target, target);
6401 return;
6402 }
6403 // Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam
6404 case 39857:
6405 triggerSpellId = 39856;
6406 break;
6407 // Personalized Weather
6408 case 46736:
6409 triggerSpellId = 46737;
6410 break;
6411 // Shield Level 1
6412 case 63130:
6413 // Shield Level 2
6414 case 63131:
6415 // Shield Level 3
6416 case 63132:
6417 // Ball of Flames Visual
6418 case 71706:
6419 return;
6420 // Oculus, Mage-Lord Urom, Time Bomb
6421 case 51121:
6422 case 59376:
6423 {
6424 const int32 dmg = target->GetMaxHealth() - target->GetHealth();
6425 target->CastCustomSpell(target, 51132, &dmg, 0, 0, true);
6426 return;
6427 }
6428 }
6429 break;
6430 }
6431 case SPELLFAMILY_SHAMAN:
6432 {
6433 switch (auraId)
6434 {
6435 // Lightning Shield (The Earthshatterer set trigger after cast Lighting Shield)
6436 case 28820:
6437 {
6438 // Need remove self if Lightning Shield not active
6440 target->RemoveAurasDueToSpell(28820);
6441 return;
6442 }
6443 }
6444 break;
6445 }
6446 default:
6447 break;
6448 }
6449 }
6450 else
6451 {
6452 // Spell exist but require custom code
6453 switch (auraId)
6454 {
6455 // Mana Tide
6456 case 16191:
6457 target->CastCustomSpell(target, triggerSpellId, &m_amount, nullptr, nullptr, true, nullptr, this);
6458 return;
6459 // Poison (Grobbulus)
6460 case 28158:
6461 case 54362:
6462 // Slime Pool (Dreadscale & Acidmaw)
6463 case 66882:
6464 target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000 * 2 / 3), nullptr, true, nullptr, this);
6465 return;
6466 // Eye of Eternity, Malygos, Arcane Overload
6467 case 56432:
6468 if (triggerSpellId == 56438)
6469 {
6470 target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)(10000 * (1.0f - 0.02f * (m_tickNumber + 1))), nullptr, true, nullptr, this);
6471 return;
6472 }
6473 break;
6474 // Beacon of Light
6475 case 53563:
6476 {
6477 // area aura owner casts the spell
6478 GetBase()->GetUnitOwner()->CastSpell(target, triggeredSpellInfo, true, 0, this, GetBase()->GetUnitOwner()->GetGUID());
6479 return;
6480 }
6481 // Trial of the Crusader, Jaraxxus, Spinning Pain Spike
6482 case 66283:
6483 {
6484 const int32 dmg = target->GetMaxHealth() / 2;
6485 target->CastCustomSpell(target, 66316, &dmg, nullptr, nullptr, true);
6486 return;
6487 }
6488 // Violet Hold, Moragg, Ray of Suffering, Ray of Pain
6489 case 54442:
6490 case 59524:
6491 case 54438:
6492 case 59523:
6493 {
6494 if (caster)
6495 if (Unit* victim = caster->GetVictim())
6496 if (victim->GetDistance(caster) < 45.0f)
6497 {
6498 target = victim;
6499 break;
6500 }
6501 return;
6502 }
6503 case 24745: // Summon Templar, Trigger
6504 case 24747: // Summon Templar Fire, Trigger
6505 case 24757: // Summon Templar Air, Trigger
6506 case 24759: // Summon Templar Earth, Trigger
6507 case 24761: // Summon Templar Water, Trigger
6508 case 24762: // Summon Duke, Trigger
6509 case 24766: // Summon Duke Fire, Trigger
6510 case 24769: // Summon Duke Air, Trigger
6511 case 24771: // Summon Duke Earth, Trigger
6512 case 24773: // Summon Duke Water, Trigger
6513 case 24785: // Summon Royal, Trigger
6514 case 24787: // Summon Royal Fire, Trigger
6515 case 24791: // Summon Royal Air, Trigger
6516 case 24792: // Summon Royal Earth, Trigger
6517 case 24793: // Summon Royal Water, Trigger
6518 {
6519 // All this spells trigger a spell that requires reagents; if the
6520 // triggered spell is cast as "triggered", reagents are not consumed
6521 if (caster)
6522 caster->CastSpell(target, triggerSpellId, false);
6523 return;
6524 }
6525 // Hunter - Rapid Recuperation
6526 case 56654:
6527 case 58882:
6528 int32 amount = int32(target->GetMaxPower(POWER_MANA) * GetAmount() / 100.0f);
6529 target->CastCustomSpell(target, triggerSpellId, &amount, nullptr, nullptr, true, nullptr, this);
6530 return;
6531 }
6532 }
6533
6534 // Reget trigger spell proto
6535 triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
6536
6537 if (triggeredSpellInfo)
6538 {
6539 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6540 {
6541 SpellCastTargets targets;
6542 targets.SetUnitTarget(target);
6543 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6544 {
6547 }
6548
6549 // Xinef: do not skip reagent cost for entry casts
6551 if (GetSpellInfo()->Effects[GetEffIndex()].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || GetSpellInfo()->Effects[GetEffIndex()].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)
6553
6554 triggerCaster->CastSpell(targets, triggeredSpellInfo, nullptr, triggerFlags, nullptr, this);
6555 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6556 }
6557 }
6558}
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
@ CREATURE_TYPE_GAS_CLOUD
Definition SharedDefines.h:2640
@ 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, Seconds forcedRespawnTimer)
Definition Creature.cpp:2183
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, bool broadcast=false)
Definition Player.cpp:13547
Definition Spell.h:111
void SetUnitTarget(Unit *target)
Definition Spell.cpp:239
void SetObjectTargetChannel(ObjectGuid targetGUID)
Definition Spell.cpp:454
void SetDstChannel(SpellDestination const &spellDest)
Definition Spell.cpp:459
bool IsChannelCategorySpell() const
Definition SpellInfo.cpp:1083
void EnergizeBySpell(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:11316
void SendEnergizeSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:11305
SpellDestination spellDst
Definition Spell.h:252
ObjectGuid channelGUID
Definition Spell.h:251
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
6561{
6562 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
6563 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6564 {
6565 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6566 {
6567 SpellCastTargets targets;
6568 targets.SetUnitTarget(target);
6569 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6570 {
6573 }
6574
6575 CustomSpellValues values;
6577
6578 triggerCaster->CastSpell(targets, triggeredSpellInfo, &values, TRIGGERED_FULL_MASK, nullptr, this);
6579 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6580 }
6581 }
6582 else
6583 {
6584 Creature* c = target->ToCreature();
6585 if (c && caster)
6586 {
6587 sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature());
6588 }
6589
6590 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
6591 }
6592}
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
1808{
1809 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1810 return;
1811
1812 Unit* target = aurApp->GetTarget();
1813
1814 // no-phase is also phase state so same code for apply and remove
1815 uint32 newPhase = target->GetPhaseByAuras();
1816
1817 if (Player* player = target->ToPlayer())
1818 {
1819 if (!newPhase)
1820 newPhase = PHASEMASK_NORMAL;
1821
1822 // do not change phase to GM with all phases enabled
1823 if (player->IsGameMaster())
1824 newPhase = PHASEMASK_ANYWHERE;
1825
1826 player->SetPhaseMask(newPhase, false);
1827 player->GetSession()->SendSetPhaseShift(newPhase);
1828 }
1829 else
1830 {
1831 if (!newPhase)
1832 {
1833 newPhase = PHASEMASK_NORMAL;
1834 if (Creature* creature = target->ToCreature())
1835 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
1836 newPhase = data->phaseMask;
1837 }
1838
1839 target->SetPhaseMask(newPhase, false);
1840 }
1841
1842 // call functions which may have additional effects after chainging state of unit
1843 // phase auras normally not expected at BG but anyway better check
1844 if (apply)
1845 {
1846 // drop flag at invisibiliy in bg
1848 }
1849
1850 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1851 if (target->IsVisible())
1852 {
1853 if (!target->GetMap()->Instanceable())
1854 {
1855 target->UpdateObjectVisibility(false);
1856 target->m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f);
1857 }
1858 else
1859 target->UpdateObjectVisibility();
1860 }
1861}
@ PHASEMASK_ANYWHERE
Definition Object.h:61
@ PHASEMASK_NORMAL
Definition Object.h:60
uint32 GetPhaseByAuras() const
Definition Unit.cpp:19090
bool IsVisible() const
Definition Unit.h:1926
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:19101
Position m_last_notify_position
Definition Unit.h:2022
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.
3528{
3529 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3530 return;
3531
3532 Unit* target = aurApp->GetTarget();
3533 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
3534 if (target->IsPlayer() || !apply || target->HasFearAura())
3535 return;
3538 target->SetControlled(false, UNIT_STATE_FLEEING);
3539}
bool HasFearAura() const
Definition Unit.h:1750

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

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 
)
1175{
1176 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1177 if (prevented)
1178 return;
1179
1180 switch (GetAuraType())
1181 {
1183 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1184 break;
1186 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1187 break;
1189 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1190 break;
1192 HandleRaidProcFromChargeAuraProc(aurApp, eventInfo);
1193 break;
1196 break;
1197 default:
1198 break;
1199 }
1200
1201 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1202}
@ 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:7285
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7244
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7265
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7333
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7227
bool CallScriptEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2714
void CallScriptAfterEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuras.cpp:2733

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 
)
7266{
7267 Unit* target = aurApp->GetTarget();
7268 Unit* triggerTarget = eventInfo.GetProcTarget();
7269 if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamageOrSchool(GetSpellInfo()))
7270 {
7271 SendTickImmune(triggerTarget, target);
7272 return;
7273 }
7274
7275 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetSpellInfo(), GetSpellInfo()->SchoolMask);
7276 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetEffIndex());
7277 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
7278 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
7279 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
7280 target->SendSpellNonMeleeDamageLog(&damageInfo);
7281 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
7282 target->DealSpellDamage(&damageInfo, true);
7283}
Unit * GetProcTarget() const
Definition Unit.h:441

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

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

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

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

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

Referenced by HandleProc().

◆ HandleRangedAmmoHaste()

void AuraEffect::HandleRangedAmmoHaste ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5053{
5055 return;
5056
5057 Unit* target = aurApp->GetTarget();
5058
5059 if (!target->IsPlayer())
5060 return;
5061
5062 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
5063}

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

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
5313{
5315 return;
5316
5317 Unit* target = aurApp->GetTarget();
5318
5319 BaseModType modType = FLAT_MOD;
5321 modType = PCT_MOD;
5322
5323 if (target->IsPlayer())
5324 target->ToPlayer()->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply);
5325}
@ SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
Definition SpellAuraDefines.h:213
BaseModType
Definition Unit.h:188
@ PCT_MOD
Definition Unit.h:190
@ SHIELD_BLOCK_VALUE
Definition Unit.h:183

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, FLAT_MOD, GetAmount(), GetAuraType(), AuraApplication::GetTarget(), Player::HandleBaseModValue(), Object::IsPlayer(), PCT_MOD, SHIELD_BLOCK_VALUE, SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT, and Object::ToPlayer().

◆ HandleSpiritOfRedemption()

void AuraEffect::HandleSpiritOfRedemption ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1746{
1747 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1748 return;
1749
1750 Unit* target = aurApp->GetTarget();
1751
1752 if (!target->IsPlayer())
1753 return;
1754
1755 // prepare spirit state
1756 if (apply)
1757 {
1758 // disable breath/etc timers
1759 target->ToPlayer()->StopMirrorTimers();
1760
1761 // set stand state (expected in this form)
1762 if (!target->IsStandState())
1764
1765 target->SetHealth(1);
1766 }
1767 // die at aura end
1768 else if (target->IsAlive())
1769 // call functions which may have additional effects after chainging state of unit
1771
1772 // xinef: damage immunity spell, not needed because of 93 aura (adds non_attackable state)
1773 // xinef: probably blizzard added it just in case in wotlk (id > 46000)
1774 if (apply)
1775 target->CastSpell(target, 62371, true);
1776 else
1777 target->RemoveAurasDueToSpell(62371);
1778}
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:32
void StopMirrorTimers()
Definition Player.h:2062
virtual void setDeathState(DeathState s, bool despawn=false)
Definition Unit.cpp:14605
bool IsStandState() const
Definition Unit.cpp:16772
void SetStandState(uint8 state)
Definition Unit.cpp:16778

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

◆ HandleUnused()

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

◆ HandleWaterBreathing()

void AuraEffect::HandleWaterBreathing ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3401{
3403 return;
3404
3405 Unit* target = aurApp->GetTarget();
3406
3407 // update timers in client
3408 if (target->IsPlayer())
3409 target->ToPlayer()->UpdateMirrorTimers();
3410}
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
1097{
1098 return m_spellInfo->Effects[m_effIndex].SpellClassMask;
1099}

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

◆ IsAffectedOnSpell()

bool AuraEffect::IsAffectedOnSpell ( SpellInfo const *  spell) const
1083{
1084 if (!spell)
1085 return false;
1086 // Check family name
1087 if (spell->SpellFamilyName != m_spellInfo->SpellFamilyName)
1088 return false;
1089
1090 // Check EffectClassMask
1091 if (m_spellInfo->Effects[m_effIndex].SpellClassMask & spell->SpellFamilyFlags)
1092 return true;
1093 return false;
1094}

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

◆ IsPeriodic()

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

References m_isPeriodic.

Referenced by AuraApplication::_HandleEffect(), and Spell::prepare().

◆ PeriodicTick()

void AuraEffect::PeriodicTick ( AuraApplication aurApp,
Unit caster 
) const
1108{
1109 bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
1110 if (prevented)
1111 return;
1112
1113 Unit* target = aurApp->GetTarget();
1114
1115 // Update serverside orientation of tracking channeled auras on periodic update ticks
1116 // exclude players because can turn during channeling and shouldn't desync orientation client/server
1118 {
1119 ObjectGuid const channelGuid = caster->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT);
1120 if (!channelGuid.IsEmpty() && channelGuid != caster->GetGUID())
1121 {
1122 if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*caster, channelGuid))
1123 {
1124 caster->SetInFront(objectTarget);
1125 }
1126 }
1127 }
1128
1129 switch (GetAuraType())
1130 {
1132 HandlePeriodicDummyAuraTick(target, caster);
1133 break;
1135 HandlePeriodicTriggerSpellAuraTick(target, caster);
1136 break;
1138 // Don't actually do anything - client will trigger casts of these spells by itself
1139 break;
1142 break;
1145 HandlePeriodicDamageAurasTick(target, caster);
1146 break;
1148 HandlePeriodicHealthLeechAuraTick(target, caster);
1149 break;
1151 HandlePeriodicHealthFunnelAuraTick(target, caster);
1152 break;
1155 HandlePeriodicHealAurasTick(target, caster);
1156 break;
1158 HandlePeriodicManaLeechAuraTick(target, caster);
1159 break;
1161 HandleObsModPowerAuraTick(target, caster);
1162 break;
1164 HandlePeriodicEnergizeAuraTick(target, caster);
1165 break;
1167 HandlePeriodicPowerBurnAuraTick(target, caster);
1168 break;
1169 default:
1170 break;
1171 }
1172}
@ SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL
Definition SharedDefines.h:433
void HandlePeriodicPowerBurnAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:7180
void HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:7039
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:7112
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:7146
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6292
void HandlePeriodicDummyAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6201
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6756
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6594
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit *target, Unit *caster) const
Definition SpellAuraEffects.cpp:6560
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
Definition SpellAuras.cpp:2483
bool IsEmpty() const
Definition ObjectGuid.h:161
bool IsChanneled() const
Definition SpellInfo.cpp:1256
void SetInFront(WorldObject const *target)
Definition Unit.cpp:20575
Definition Object.h:410
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
118{ m_isAuraEnabled = enabled; }

References m_isAuraEnabled.

Referenced by AuraApplication::_HandleEffect().

◆ SetOldAmount()

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

References m_oldAmount.

Referenced by CalculateAmount().

◆ SetPeriodic()

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

References m_isPeriodic.

◆ SetPeriodicTimer()

◆ Update()

void AuraEffect::Update ( uint32  diff,
Unit caster 
)
903{
904 if (m_isPeriodic && (GetBase()->GetDuration() >= 0 || GetBase()->IsPassive() || GetBase()->IsPermanent()))
905 {
906 uint32 totalTicks = GetTotalTicks();
907
908 m_periodicTimer -= int32(diff);
909 while (m_periodicTimer <= 0)
910 {
911 if (!GetBase()->IsPermanent() && (m_tickNumber + 1) > totalTicks)
912 {
913 break;
914 }
915
916 ++m_tickNumber;
917
918 // update before tick (aura can be removed in TriggerSpell or PeriodicTick calls)
920 UpdatePeriodic(caster);
921
922 std::list<AuraApplication*> effectApplications;
923 GetApplicationList(effectApplications);
924 // tick on targets of effects
925 for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
926 if ((*apptItr)->HasEffect(GetEffIndex()))
927 PeriodicTick(*apptItr, caster);
928 }
929 }
930}
void PeriodicTick(AuraApplication *aurApp, Unit *caster) const
Definition SpellAuraEffects.cpp:1107
void UpdatePeriodic(Unit *caster)
Definition SpellAuraEffects.cpp:932

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

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_auraGroup

uint32 AuraEffect::m_auraGroup
private

Referenced by AuraEffect(), and GetAuraGroup().

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