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}
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:539
@ UNIT_FIELD_CHANNEL_OBJECT
Definition: UpdateFields.h:93
#define sSpellMgr
Definition: SpellMgr.h:825
ObjectGuid GetGuidValue(uint16 index) const
Definition: Object.cpp:337
bool CanApplyResilience() const
Definition: Unit.h:1736
uint8 GetLevel() const
Definition: Unit.h:855
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:1456
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:593
void CalculateSpellMod()
Definition: SpellAuraEffects.cpp:684
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:578
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
Definition: Spell.h:241
Definition: Spell.h:284
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:393

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

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

References BASE_ATTACK, GetSpellInfo(), Unit::GetSpellModOwner(), RANGED_ATTACK, SPELL_AURA_ABILITY_PERIODIC_CRIT, SPELL_DAMAGE_CLASS_RANGED, SPELLFAMILY_ROGUE, 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 m_canBeRecalculated = false;
498 if (!m_spellInfo->ProcFlags || m_spellInfo->HasAura(SPELL_AURA_PROC_TRIGGER_SPELL)) // xinef: skip auras with proctriggerspell, they must have procflags...
499 break;
500 amount = int32(GetBase()->GetUnitOwner()->CountPctFromMaxHealth(10));
501 if (caster)
502 {
503 // Glyphs increasing damage cap
505 for (Unit::AuraEffectList::const_iterator itr = overrideClassScripts.begin(); itr != overrideClassScripts.end(); ++itr)
506 {
507 if ((*itr)->IsAffectedOnSpell(m_spellInfo))
508 {
509 // Glyph of Fear, Glyph of Frost nova and similar auras
510 if ((*itr)->GetMiscValue() == 7801)
511 {
512 AddPct(amount, (*itr)->GetAmount());
513 break;
514 }
515 }
516 }
517 }
518 break;
521 m_canBeRecalculated = false;
522 break;
524 // Titan's Grip
525 if (!caster)
526 break;
527 if (GetId() == 49152 && caster->ToPlayer())
528 {
529 Item* item1 = caster->ToPlayer()->GetWeaponForAttack(BASE_ATTACK);
530 Item* item2 = caster->ToPlayer()->GetWeaponForAttack(OFF_ATTACK);
531
532 if (!item2)
533 item2 = caster->ToPlayer()->GetShield();
534
535 if (item1 && item2
537 {
538 amount = -10;
539 }
540 else
541 amount = 0;
542 }
543 break;
544 default:
545 break;
546 }
547
548 // xinef: save base amount, before calculating sp etc. Used for Unit::CastDelayedSpellWithPeriodicAmount
549 SetOldAmount(amount * GetBase()->GetStackAmount());
551
552 // Xinef: Periodic auras
553 if (caster)
554 switch (GetAuraType())
555 {
558 // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value!
559 if (GetBase()->GetType() == UNIT_AURA_TYPE)
560 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex(), GetPctMods(), 1);
561 break;
563 if (GetBase()->GetType() == UNIT_AURA_TYPE)
564 amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex(), GetPctMods(), 1);
565 break;
567 if (GetBase()->GetType() == UNIT_AURA_TYPE)
568 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE, 0.0f, 1);
569 break;
570 default:
571 break;
572 }
573
574 amount *= GetBase()->GetStackAmount();
575 return amount;
576}
T AddPct(T &base, U pct)
Definition: Util.h:67
std::int32_t int32
Definition: Define.h:103
std::uint32_t uint32
Definition: Define.h:107
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
@ OFF_ATTACK
Definition: Unit.h:210
@ DOT
Definition: Unit.h:250
@ SPELL_DIRECT_DAMAGE
Definition: Unit.h:249
@ INVTYPE_2HWEAPON
Definition: ItemTemplate.h:273
@ 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
#define MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS
Definition: DBCStructure.h:1838
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition: DBCStructure.h:1204
Definition: Item.h:220
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:545
uint32 InventoryType
Definition: ItemTemplate.h:632
Item * GetShield(bool useable=false) const
Definition: PlayerStorage.cpp:529
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition: PlayerStorage.cpp:494
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1362
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition: Unit.cpp:12409
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition: Unit.cpp:11572
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
uint32 Id
Definition: SpellInfo.h:320
uint32 ProcFlags
Definition: SpellInfo.h:355
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:892
Definition: DBCStructure.h:1217
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > AllocationPct
Definition: DBCStructure.h:1224
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
Definition: DBCStructure.h:1222
Definition: DBCStructure.h:1841
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1847

References AddPct(), ItemRandomSuffixEntry::AllocationPct, BASE_ATTACK, Aura::CallScriptEffectCalcAmountHandlers(), DOT, SpellInfo::Effects, ItemRandomSuffixEntry::Enchantment, Unit::GetAuraEffectsByType(), GetAuraType(), GetBase(), GetEffIndex(), GetId(), 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, 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(), 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.
594{
596
597 // prepare periodics
598 switch (GetAuraType())
599 {
601 // 3 spells have no amplitude set
602 if (!m_amplitude)
604 [[fallthrough]];
618 m_isPeriodic = true;
619 break;
620 default:
621 break;
622 }
623
625
626 if (!m_isPeriodic)
627 return;
628
629 // Xinef: fix broken data in dbc
630 if (m_amplitude <= 0)
631 m_amplitude = 1000;
632
633 Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr;
634
635 // Apply casting time mods
636 if (m_amplitude)
637 {
638 // Apply periodic time mod
639 if (modOwner)
641
642 if (caster)
643 {
646 }
647 }
648
649 if (load) // aura loaded from db
650 {
654 ++m_tickNumber;
655 }
656 else // aura just created or reapplied
657 {
658 m_tickNumber = 0;
659 // reset periodic timer on aura create or on reapply when aura isn't dot
660 // possibly we should not reset periodic timers only when aura is triggered by proc
661 // or maybe there's a spell attribute somewhere
662 bool resetPeriodicTimer = create
664
665 if (resetPeriodicTimer)
666 {
667 m_periodicTimer = 0;
668 // Start periodic on next tick or at aura apply
669 if (m_amplitude)
670 {
673 else if (caster && caster->IsTotem()) // for totems only ;d
674 {
675 m_periodicTimer = 100; // make it ALMOST instant
676 if (!GetBase()->IsPassive())
677 GetBase()->SetDuration(GetBase()->GetDuration() + 100);
678 }
679 }
680 }
681 }
682}
constexpr auto IN_MILLISECONDS
Definition: Common.h:53
@ UNIT_MOD_CAST_SPEED
Definition: UpdateFields.h:137
@ 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:96
@ SPELL_ATTR5_EXTRA_INITIAL_PERIOD
Definition: SharedDefines.h:576
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition: SharedDefines.h:580
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:9729
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition: Unit.cpp:5709
bool IsTotem() const
Definition: Unit.h:712
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
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:415

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::spell_shadowfang_keep_haunting_spirits_AuraScript::HandleUpdatePeriodic(), and Aura::SetLoadedState().

◆ CalculatePeriodicData()

void AuraEffect::CalculatePeriodicData ( )
579{
580 // xinef: save caster depending auras with pct mods
581 if (GetBase()->GetType() == UNIT_AURA_TYPE && GetCaster())
582 {
587 }
588
589 if (GetCaster())
590 SetCritChance(CalcPeriodicCritChance(GetCaster(), (GetBase()->GetType() == UNIT_AURA_TYPE ? GetBase()->GetUnitOwner() : nullptr)));
591}
float SpellPctHealingModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition: Unit.cpp:12317
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition: Unit.cpp:11241
float CalcPeriodicCritChance(Unit const *caster, Unit const *target) const
Definition: SpellAuraEffects.cpp:1044
float m_pctMods
Definition: SpellAuraEffects.h:131
Unit * GetCaster() const
Definition: SpellAuraEffects.h:47
void SetCritChance(float crit)
Definition: SpellAuraEffects.h:109

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 ( )
685{
686 switch (GetAuraType())
687 {
690 if (!m_spellmod)
691 {
694
695 m_spellmod->type = SpellModType(GetAuraType()); // SpellModType value == spell aura types
697 m_spellmod->mask = GetSpellInfo()->Effects[GetEffIndex()].SpellClassMask;
699 }
701 break;
702 default:
703 break;
704 }
706}
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:76
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
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

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 
)
709{
710 // Reapply if amount change
711 uint8 handleMask = 0;
712 if (newAmount != GetAmount())
714 if (onStackOrReapply)
715 handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
716
717 if (!handleMask)
718 return;
719
720 std::list<AuraApplication*> effectApplications;
721 GetApplicationList(effectApplications);
722
723 for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
724 if ((*apptItr)->HasEffect(GetEffIndex()))
725 HandleEffect(*apptItr, handleMask, false);
726
727 if (handleMask & AURA_EFFECT_HANDLE_CHANGE_AMOUNT)
728 {
729 if (!mark)
730 m_amount = newAmount;
731 else
732 SetAmount(newAmount);
734 }
735
736 for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
737 if ((*apptItr)->HasEffect(GetEffIndex()))
738 HandleEffect(*apptItr, handleMask, true);
739}
@ 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:741
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 Aura::SetStackAmount().

◆ CleanupTriggeredSpells()

void AuraEffect::CleanupTriggeredSpells ( Unit target)
Todo:
: is there a spell flag, which can solve this in a more sophisticated way?
1200{
1201 uint32 tSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1202 if (!tSpellId)
1203 return;
1204
1205 SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
1206 if (!tProto)
1207 return;
1208
1209 if (tProto->GetDuration() != -1)
1210 return;
1211
1212 // needed for spell 43680, maybe others
1216 return;
1217
1218 target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
1219}
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4891
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:48
Definition: SpellInfo.h:316
int32 GetDuration() const
Definition: SpellInfo.cpp:2337

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::spell_shadowfang_keep_haunting_spirits_AuraScript::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::spell_gen_leeching_swarm_AuraScript::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_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(), GetCaster(), GetCasterGUID(), GetTargetList(), GetTotalTicks(), HandleAuraDummy(), HandleAuraLinked(), HandleAuraModShapeshift(), HandleAuraModStateImmunity(), HandleAuraMounted(), Unit::HandleAuraRaidProcFromCharge(), Unit::HandleAuraRaidProcFromChargeWithValue(), HandleAuraRetainComboPoints(), Unit::HandleDummyAuraProc(), 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_pet_hit_expertise_scalling::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

◆ 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(), 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_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(), TriggeredByAuraSpellData::Init(), 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_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
5352{
5353 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5354 return;
5355
5356 Unit* target = aurApp->GetTarget();
5357
5358 if (apply)
5360 else
5361 {
5362 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5363 if (target->HasAuraType(GetAuraType()))
5364 return;
5366 }
5367}
@ UNIT_FLAG_PREPARATION
Definition: UnitDefines.h:234
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
Definition: Unit.h:630
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:5676
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:683
ObjectGuid GetTarget() const
Definition: Unit.h:1742
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:684

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
3306{
3308 return;
3309
3310 Unit* target = aurApp->GetTarget();
3311
3312 if (!apply)
3313 {
3314 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3316 return;
3317 }
3318
3319 target->SetCanFly(apply);
3320
3321 if (!apply && target->IsCreature() && !target->IsLevitating())
3322 target->GetMotionMaster()->MoveFall();
3323}
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
Definition: SpellAuraDefines.h:270
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK
Definition: SpellAuraDefines.h:48
bool IsCreature() const
Definition: Object.h:201
MotionMaster * GetMotionMaster()
Definition: Unit.h:1601
bool IsLevitating() const
Definition: Unit.h:1694
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:20563
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:624

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

◆ HandleAuraAllowOnlyAbility()

void AuraEffect::HandleAuraAllowOnlyAbility ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3084{
3086 return;
3087
3088 Unit* target = aurApp->GetTarget();
3089
3090 if (target->IsPlayer())
3091 {
3092 if (apply)
3094 else
3095 {
3096 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3098 return;
3100 }
3101 }
3102}
@ PLAYER_ALLOW_ONLY_ABILITY
Definition: Player.h:497
@ SPELL_AURA_ALLOW_ONLY_ABILITY
Definition: SpellAuraDefines.h:326
void SetPlayerFlag(PlayerFlags flags)
Definition: Player.h:1109
void RemovePlayerFlag(PlayerFlags flags)
Definition: Player.h:1110

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

◆ HandleAuraCloneCaster()

void AuraEffect::HandleAuraCloneCaster ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2780{
2782 return;
2783
2784 Unit* target = aurApp->GetTarget();
2785
2786 if (apply)
2787 {
2788 Unit* caster = GetCaster();
2789 if (!caster || caster == target)
2790 return;
2791
2792 // What must be cloned? at least display and scale
2793 target->SetDisplayId(caster->GetDisplayId());
2795 }
2796 else
2797 {
2798 target->SetDisplayId(target->GetNativeDisplayId());
2800 }
2801}
@ UNIT_FLAG2_MIRROR_IMAGE
Definition: UnitDefines.h:272
virtual void SetDisplayId(uint32 modelId, float displayScale=1.f)
Definition: Unit.cpp:16718
void SetUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:689
uint32 GetDisplayId() const
Definition: Unit.h:1507
uint32 GetNativeDisplayId() const
Definition: Unit.h:1509
void RemoveUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:690

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

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

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

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

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::HasAuraType(), 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_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, 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
5963{
5964 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5965 return;
5966
5967 Unit* target = aurApp->GetTarget();
5968
5969 if (!apply)
5970 {
5971 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5972 if (target->HasAuraType(GetAuraType()))
5973 return;
5974 }
5975
5976 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
5978}
@ UNIT_DYNAMIC_FLAGS
Definition: UpdateFields.h:136
@ CREATURE_TYPE_BEAST
Definition: SharedDefines.h:2628
@ UNIT_DYNFLAG_SPECIALINFO
Definition: SharedDefines.h:3125
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition: Object.cpp:806
uint32 GetCreatureType() const
Definition: Unit.cpp:15137

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
3348{
3350 return;
3351
3352 Unit* target = aurApp->GetTarget();
3353
3354 if (Player* targetPlayer = target->ToPlayer())
3355 {
3356 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3357 }
3358
3359 if (!apply)
3360 {
3361 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3362 if (target->HasAuraType(GetAuraType()))
3363 return;
3364 }
3365
3366 target->SetFeatherFall(apply);
3367
3368 // start fall from current height
3369 if (!apply && target->IsPlayer())
3370 target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ());
3371}
#define sScriptMgr
Definition: ScriptMgr.h:708
Seconds GetGameTime()
Definition: GameTime.cpp:38
float GetPositionZ() const
Definition: Position.h:119
void SetFallInformation(uint32 time, float z)
Definition: Player.h:2316
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20607

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
1776{
1778 return;
1779
1780 Unit* target = aurApp->GetTarget();
1781
1782 if (!target->IsPlayer())
1783 return;
1784
1785 if (apply)
1786 {
1790 }
1791 else
1792 {
1793 if (target->HasAuraType(SPELL_AURA_GHOST))
1794 return;
1795
1799 }
1800}
@ PLAYER_FLAGS_GHOST
Definition: Player.h:478
@ SPELL_AURA_GHOST
Definition: SpellAuraDefines.h:158
@ 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:372
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:524
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:523

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, AuraApplication::GetTarget(), GHOST_VISIBILITY_ALIVE, GHOST_VISIBILITY_GHOST, Unit::HasAuraType(), 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(), SPELL_AURA_GHOST, and Object::ToPlayer().

◆ HandleAuraHover()

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

Sets movementflags

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

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
4798{
4800 return;
4801
4802 Unit* target = aurApp->GetTarget();
4803
4804 target->HandleStatModifier(UNIT_MOD_HEALTH, BASE_PCT, float(GetAmount()), apply);
4805}
@ UNIT_MOD_HEALTH
Definition: Unit.h:148
@ BASE_PCT
Definition: Unit.h:127
@ AURA_EFFECT_HANDLE_STAT
Definition: SpellAuraDefines.h:46
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:15158

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

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
5100{
5102 return;
5103
5104 Unit* target = aurApp->GetTarget();
5105
5107}
@ 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
5165{
5167 return;
5168
5169 Unit* target = aurApp->GetTarget();
5170
5171 // Recalculate bonus
5172 if (target->IsPlayer())
5173 target->ToPlayer()->UpdateAttackPowerAndDamage(false);
5174}
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
5160{
5161 HandleAuraModAttackPowerOfArmor(aurApp, mode, apply);
5162}
void HandleAuraModAttackPowerOfArmor(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:5164

References HandleAuraModAttackPowerOfArmor().

◆ HandleAuraModAttackPowerPercent()

void AuraEffect::HandleAuraModAttackPowerPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5123{
5125 return;
5126
5127 Unit* target = aurApp->GetTarget();
5128
5129 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
5131}
@ 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
4356{
4358 return;
4359
4360 Unit* target = aurApp->GetTarget();
4361 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4362 {
4363 if (GetMiscValue() & int32(1 << x))
4364 {
4366 }
4367 }
4368}
std::int8_t int8
Definition: Define.h:105
UnitMods
Definition: Unit.h:142
@ UNIT_MOD_RESISTANCE_START
Definition: Unit.h:172
@ SPELL_SCHOOL_NORMAL
Definition: SharedDefines.h:283
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:292

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
4841{
4843 return;
4844
4845 Unit* target = aurApp->GetTarget();
4846
4847 if (!target->IsPlayer())
4848 return;
4849
4850 target->ToPlayer()->UpdateBlockPercentage();
4851}
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
4949{
4951 return;
4952
4953 Unit* target = aurApp->GetTarget();
4954
4955 if (!target->IsPlayer())
4956 {
4957 target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
4958 return;
4959 }
4960
4961 target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4964
4965 // included in Player::UpdateSpellCritChance calculation
4967}
@ 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 apply(T *val)
Definition: ByteConverter.h:40
void UpdateAllSpellCritChances()
Definition: StatSystem.cpp:871
void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
Definition: Player.cpp:5005
int32 m_baseSpellCritChance
Definition: Unit.h:1786

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
3767{
3769 return;
3770
3771 Unit* target = aurApp->GetTarget();
3772
3773 target->UpdateSpeed(MOVE_WALK, true);
3774 target->UpdateSpeed(MOVE_RUN, true);
3775 target->UpdateSpeed(MOVE_SWIM, true);
3776 target->UpdateSpeed(MOVE_FLIGHT, true);
3777 target->UpdateSpeed(MOVE_RUN_BACK, true);
3778 target->UpdateSpeed(MOVE_SWIM_BACK, true);
3779 target->UpdateSpeed(MOVE_FLIGHT_BACK, true);
3780
3781 if (Player* targetPlayer = target->ToPlayer())
3782 {
3783 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3784 }
3785}
@ MOVE_FLIGHT
Definition: UnitDefines.h:334
@ MOVE_SWIM
Definition: UnitDefines.h:331
@ MOVE_FLIGHT_BACK
Definition: UnitDefines.h:335
@ MOVE_SWIM_BACK
Definition: UnitDefines.h:332
@ MOVE_RUN_BACK
Definition: UnitDefines.h:330
@ MOVE_WALK
Definition: UnitDefines.h:328
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:14207

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
2951{
2952 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2953 return;
2954
2955 Unit* target = aurApp->GetTarget();
2956
2957 AuraType type = GetAuraType();
2958
2959 //Prevent handling aura twice
2960 if ((apply) ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
2961 return;
2962
2963 uint32 field, flag, slot;
2964 WeaponAttackType attType;
2965 switch (type)
2966 {
2968 field = UNIT_FIELD_FLAGS;
2969 flag = UNIT_FLAG_DISARMED;
2971 attType = BASE_ATTACK;
2972 break;
2974 field = UNIT_FIELD_FLAGS_2;
2977 attType = OFF_ATTACK;
2978 break;
2980 field = UNIT_FIELD_FLAGS_2;
2982 slot = EQUIPMENT_SLOT_RANGED;
2983 attType = RANGED_ATTACK;
2984 break;
2985 default:
2986 return;
2987 }
2988
2989 // if disarm aura is to be removed, remove the flag first to reapply damage/aura mods
2990 if (!apply)
2991 target->RemoveFlag(field, flag);
2992
2993 // Handle damage modification, shapeshifted druids are not affected
2994 if (target->IsPlayer() && (!target->IsInFeralForm() || target->GetShapeshiftForm() == FORM_GHOSTWOLF))
2995 {
2996 if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
2997 {
2998 uint8 attacktype = Player::GetAttackBySlot(slot);
2999
3000 if (attacktype < MAX_ATTACK)
3001 {
3002 target->ToPlayer()->_ApplyWeaponDamage(slot, pItem->GetTemplate(), nullptr, !apply);
3003 target->ToPlayer()->_ApplyWeaponDependentAuraMods(pItem, WeaponAttackType(attacktype), !apply);
3004 }
3005 }
3006 }
3007
3008 // if disarm effects should be applied, wait to set flag until damage mods are unapplied
3009 if (apply)
3010 target->SetFlag(field, flag);
3011
3012 if (target->IsCreature() && target->ToCreature()->GetCurrentEquipmentId())
3013 target->UpdateDamagePhysical(attType);
3014}
WeaponAttackType
Definition: Unit.h:208
@ MAX_ATTACK
Definition: Unit.h:212
@ UNIT_FLAG2_DISARM_OFFHAND
Definition: UnitDefines.h:275
@ UNIT_FLAG2_DISARM_RANGED
Definition: UnitDefines.h:277
@ FORM_GHOSTWOLF
Definition: UnitDefines.h:85
@ UNIT_FLAG_DISARMED
Definition: UnitDefines.h:250
@ UNIT_FIELD_FLAGS_2
Definition: UpdateFields.h:118
@ UNIT_FIELD_FLAGS
Definition: UpdateFields.h:117
@ EQUIPMENT_SLOT_MAINHAND
Definition: Player.h:690
@ EQUIPMENT_SLOT_OFFHAND
Definition: Player.h:691
@ EQUIPMENT_SLOT_RANGED
Definition: Player.h:692
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:670
@ 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
uint8 GetCurrentEquipmentId()
Definition: Creature.h:195
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:6887
Item * GetItemByPos(uint16 pos) const
Definition: PlayerStorage.cpp:447
void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply)
Definition: Player.cpp:6992
static uint8 GetAttackBySlot(uint8 slot)
Definition: PlayerStorage.cpp:548
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:1463
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
bool IsInFeralForm() const
Definition: Unit.h:1469

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
4297{
4298 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4299 return;
4300
4301 Unit* target = aurApp->GetTarget();
4302
4304}
DispelType
Definition: SharedDefines.h:1371
void ApplySpellDispelImmunity(SpellInfo const *spellProto, DispelType type, bool apply)
Definition: Unit.cpp:13373

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
4287{
4288 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4289 return;
4290
4291 Unit* target = aurApp->GetTarget();
4292
4293 target->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, GetMiscValue(), apply);
4294}
@ 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
4828{
4830 return;
4831
4832 Unit* target = aurApp->GetTarget();
4833
4834 if (!target->IsPlayer())
4835 return;
4836
4837 target->ToPlayer()->UpdateDodgePercentage();
4838}
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
4192{
4193 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4194 return;
4195
4196 Unit* target = aurApp->GetTarget();
4197
4198 target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
4199
4200 // when removing flag aura, handle flag drop
4201 Player* player = target->ToPlayer();
4202 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
4203 {
4204 if (player->InBattleground())
4205 {
4206 if (Battleground* bg = player->GetBattleground())
4207 bg->EventPlayerDroppedFlag(player);
4208 }
4209 else
4210 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
4211 }
4212}
#define sOutdoorPvPMgr
Definition: OutdoorPvPMgr.h:103
@ AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
Definition: SpellDefines.h:64
@ IMMUNITY_EFFECT
Definition: SharedDefines.h:1394
bool InBattleground() const
Definition: Player.h:2232

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
4632{
4634 return;
4635
4636 Unit* target = aurApp->GetTarget();
4637
4638 if (!target->IsPlayer())
4639 return;
4640
4643}
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
5981{
5982 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5983 return;
5984
5985 Unit* target = aurApp->GetTarget();
5986
5987 if (apply)
5988 {
5989 target->SetFaction(GetMiscValue());
5990 if (target->IsPlayer())
5992 }
5993 else
5994 {
5995 target->RestoreFaction();
5996 if (target->IsPlayer())
5998 }
5999}
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition: UnitDefines.h:232
void SetFaction(uint32 faction)
Definition: Unit.cpp:10018
void RestoreFaction()
Definition: Unit.cpp:18651

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

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

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

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.

3712{
3714 return;
3715
3716 Unit* target = aurApp->GetTarget();
3718 target->UpdateSpeed(MOVE_FLIGHT, true);
3719
3722 {
3723 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3725 {
3726 target->SetCanFly(apply);
3727
3728 if (!apply && target->IsCreature() && !target->IsLevitating())
3729 target->GetMotionMaster()->MoveFall();
3730 }
3731
3733 if (mode & AURA_EFFECT_HANDLE_REAL)
3734 {
3735 //Players on flying mounts must be immune to polymorph
3736 if (target->IsPlayer())
3738
3739 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3740 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountID())
3742 }
3743 }
3744
3745 if (Player* targetPlayer = target->ToPlayer())
3746 {
3747 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3748 }
3749}
@ SPELL_AURA_FLY
Definition: SpellAuraDefines.h:264
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK
Definition: SpellAuraDefines.h:50
@ MECHANIC_POLYMORPH
Definition: SharedDefines.h:1342
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition: Unit.cpp:5639
uint32 GetMountID() const
Definition: Unit.h:991

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::HasAuraType(), IMMUNITY_MECHANIC, Object::IsCreature(), Unit::IsLevitating(), Object::IsPlayer(), MECHANIC_POLYMORPH, MOVE_FLIGHT, MotionMaster::MoveFall(), Unit::SetCanFly(), Unit::SetUInt32Value(), SPELL_AURA_FLY, 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
4686{
4688 return;
4689
4690 Unit* target = aurApp->GetTarget();
4691
4692 if (apply)
4693 {
4694 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
4695 target->ModifyHealth(GetAmount());
4696 }
4697 else
4698 {
4699 if (int32(target->GetHealth()) > GetAmount())
4700 target->ModifyHealth(-GetAmount());
4701 else
4702 target->SetHealth(1);
4703 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
4704 }
4705}
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:14048
void SetHealth(uint32 val)
Definition: Unit.cpp:15433
uint32 GetHealth() const
Definition: Unit.h:869

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
4781{
4783 return;
4784
4785 Unit* target = aurApp->GetTarget();
4786
4787 // Unit will keep hp% after MaxHealth being modified if unit is alive.
4788 float percent = target->GetHealthPct();
4789 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(GetAmount()), apply);
4790
4791 // Xinef: pct was rounded down and could "kill" creature by setting its health to 0 making npc zombie
4792 if (target->IsAlive())
4793 if (uint32 healthAmount = CalculatePct(target->GetMaxHealth(), percent))
4794 target->SetHealth(healthAmount);
4795}
T CalculatePct(T base, U pct)
Definition: Util.h:61
float GetHealthPct() const
Definition: Unit.h:877
uint32 GetMaxHealth() const
Definition: Unit.h:870

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
4708{
4710 return;
4711
4712 Unit* target = aurApp->GetTarget();
4713
4714 uint32 oldhealth = target->GetHealth();
4715 double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth();
4716
4718
4719 // refresh percentage
4720 if (oldhealth > 0)
4721 {
4722 uint32 newhealth = uint32(std::ceil((double)target->GetMaxHealth() * healthPercentage));
4723 if (newhealth == 0)
4724 newhealth = 1;
4725
4726 target->SetHealth(newhealth);
4727 }
4728}

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
3707{
3708 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3709}
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3691

References HandleAuraModIncreaseSpeed().

◆ HandleAuraModIncreaseSpeed()

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

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
3752{
3754 return;
3755
3756 Unit* target = aurApp->GetTarget();
3757
3758 target->UpdateSpeed(MOVE_SWIM, true);
3759
3760 if (Player* targetPlayer = target->ToPlayer())
3761 {
3762 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3763 }
3764}

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
3046{
3048 return;
3049
3050 Unit* target = aurApp->GetTarget();
3051
3052 if (apply)
3053 {
3055 //target->AttackStop(); // pussywizard: why having this flag prevents from being in combat? it should just prevent melee attack
3056 }
3057 else
3058 {
3059 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3061 return;
3063 }
3064}
@ UNIT_FLAG_PACIFIED
Definition: UnitDefines.h:246
@ SPELL_AURA_MOD_PACIFY
Definition: SpellAuraDefines.h:88
@ SPELL_AURA_MOD_PACIFY_SILENCE
Definition: SpellAuraDefines.h:123

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, AuraApplication::GetTarget(), Unit::HasAuraType(), Unit::RemoveUnitFlag(), Unit::SetUnitFlag(), SPELL_AURA_MOD_PACIFY, SPELL_AURA_MOD_PACIFY_SILENCE, and UNIT_FLAG_PACIFIED.

Referenced by HandleAuraModPacifyAndSilence().

◆ HandleAuraModPacifyAndSilence()

void AuraEffect::HandleAuraModPacifyAndSilence ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3067{
3069 return;
3070
3071 Unit* target = aurApp->GetTarget();
3072
3073 if (!(apply))
3074 {
3075 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3077 return;
3078 }
3079 HandleAuraModPacify(aurApp, mode, apply);
3080 HandleAuraModSilence(aurApp, mode, apply);
3081}
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3016
void HandleAuraModPacify(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3045

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

◆ HandleAuraModParryPercent()

void AuraEffect::HandleAuraModParryPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4812{
4814 return;
4815
4816 Unit* target = aurApp->GetTarget();
4817
4818 if (!target->IsPlayer())
4819 return;
4820
4821 if (!target->ToPlayer()->CanParry())
4822 target->ToPlayer()->SetCanParry(true);
4823 else
4824 target->ToPlayer()->UpdateParryPercentage();
4825}
void UpdateParryPercentage()
Definition: StatSystem.cpp:735
bool CanParry() const
Definition: Player.h:2163
void SetCanParry(bool value)
Definition: Player.cpp:13124

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
3203{
3205 return;
3206
3207 Unit* target = aurApp->GetTarget();
3208
3209 if (!target->IsPlayer())
3210 return;
3211
3212 // Recalculate pet talent points
3213 if (Pet* pet = target->ToPlayer()->GetPet())
3214 pet->InitTalentForLevel();
3215}

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
5110{
5112 return;
5113
5114 Unit* target = aurApp->GetTarget();
5115
5116 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
5117 return;
5118
5120}
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition: Unit.h:164
#define CLASSMASK_WAND_USERS
Definition: SharedDefines.h:174
uint32 getClassMask() const
Definition: Unit.h:749

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
5134{
5136 return;
5137
5138 Unit* target = aurApp->GetTarget();
5139
5140 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
5141 return;
5142
5143 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
5145}

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
5038{
5040 return;
5041
5042 Unit* target = aurApp->GetTarget();
5043
5044 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
5045}
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition: Unit.cpp:17010

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
4854{
4855 HandleModManaRegen(aurApp, mode, apply);
4856}
void HandleModManaRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:4671

References HandleModManaRegen().

◆ HandleAuraModResistance()

void AuraEffect::HandleAuraModResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4338{
4340 return;
4341
4342 Unit* target = aurApp->GetTarget();
4343
4344 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4345 {
4346 if (GetMiscValue() & int32(1 << x))
4347 {
4349 if (target->IsPlayer() || target->IsPet())
4350 target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply);
4351 }
4352 }
4353}
SpellSchools
Definition: SharedDefines.h:282
bool IsPet() const
Definition: Unit.h:710
void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply)
Definition: Unit.h:1422

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
4315{
4317 return;
4318
4319 Unit* target = aurApp->GetTarget();
4320
4321 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4322 {
4323 if (GetMiscValue() & int32(1 << x))
4324 {
4326 if (amount < GetAmount())
4327 {
4328 float value = float(GetAmount() - amount);
4330 if (target->IsPlayer())
4331 target->ApplyResistanceBuffModsMod(SpellSchools(x), aurApp->IsPositive(), value, apply);
4332 }
4333 }
4334 }
4335}
@ BASE_VALUE
Definition: Unit.h:126
@ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
Definition: SpellAuraDefines.h:206
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
Definition: Unit.cpp:5957

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
4610{
4612 return;
4613
4614 Unit* target = aurApp->GetTarget();
4615
4616 if (!target->IsPlayer())
4617 return;
4618
4620 {
4621 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
4622 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
4623 LOG_ERROR("spells.aura.effect", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
4624 return;
4625 }
4626
4627 // Recalculate Armor
4628 target->UpdateArmor();
4629}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:156
@ 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
3513{
3514 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3515 return;
3516
3517 Unit* target = aurApp->GetTarget();
3518
3519 target->SetControlled(apply, UNIT_STATE_ROOT);
3520}
@ UNIT_STATE_ROOT
Definition: UnitDefines.h:159
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:17990

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
2772{
2774 return;
2775
2776 aurApp->GetTarget()->RecalculateObjectScale();
2777}

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
4228{
4229 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4230 return;
4231
4232 Unit* target = aurApp->GetTarget();
4233
4234 target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, GetMiscValue(), (apply));
4235
4236 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4237 {
4238 if (apply)
4240 else
4241 {
4242 bool banishFound = false;
4243 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
4244 for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
4245 if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4246 {
4247 banishFound = true;
4248 break;
4249 }
4250 if (!banishFound)
4252 }
4253 }
4254
4255 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
4257
4258 // remove all flag auras (they are positive, but they must be removed when you are immune)
4262
4264 if ((apply)
4266 && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
4267 {
4268 uint32 school_mask = GetMiscValue();
4269 Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
4270 for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
4271 {
4272 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
4273 if ((spell->GetSchoolMask() & school_mask)//Check for school mask
4274 && GetSpellInfo()->CanDispelAura(spell)
4275 && !iter->second->IsPositive() //Don't remove positive spells
4276 && spell->Id != GetId()) //Don't remove self
4277 {
4278 target->RemoveAura(iter);
4279 }
4280 else
4281 ++iter;
4282 }
4283 }
4284}
@ UNIT_STATE_ISOLATED
Definition: UnitDefines.h:162
@ 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
void ClearUnitState(uint32 f)
Definition: Unit.h:674
void AddUnitState(uint32 f)
Definition: Unit.h:672
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition: Unit.cpp:5152
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1986
bool IsPositive() const
Definition: SpellInfo.cpp:1236

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

References Player::_addSpell(), Player::_ApplyWeaponDamage(), AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK, BASE_ATTACK, Unit::CalculateSpellDamage(), Unit::CanUseAttackType(), Unit::CastCustomSpell(), Unit::CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_DRUID, ObjectGuid::Empty, EQUIPMENT_SLOT_MAINHAND, FORM_AMBIENT, FORM_AQUA, FORM_BATTLESTANCE, FORM_BEAR, FORM_BERSERKERSTANCE, FORM_BLB_PLAYER, FORM_CAT, FORM_CREATUREBEAR, FORM_CREATURECAT, FORM_DEFENSIVESTANCE, FORM_DIREBEAR, FORM_FLIGHT, FORM_FLIGHT_EPIC, FORM_GHOSTWOLF, FORM_GHOUL, FORM_MASTER_ANGLER, FORM_METAMORPHOSIS, FORM_MOONKIN, FORM_NONE, FORM_SHADOW, FORM_SHADOW_DANCE, FORM_SPIRITOFREDEMPTION, FORM_STEALTH, FORM_STEVES_GHOUL, FORM_TEST, FORM_TEST_OF_STRENGTH, FORM_THARONJA_SKELETON, FORM_TRAVEL, FORM_TREE, FORM_UNDEAD, FORM_ZOMBIE, Player::GetActiveSpec(), Unit::GetAuraEffect(), GetBase(), Unit::GetDummyAuraEffect(), GetId(), Player::GetItemByPos(), WorldLocation::GetMapId(), GetMiscValue(), Unit::GetModelForForm(), Unit::GetPower(), Unit::getPowerType(), AuraApplication::GetRemoveMode(), GetSpellInfo(), Player::GetSpellMap(), Player::GetTalentMap(), AuraApplication::GetTarget(), Unit::getTransForm(), HandleShapeshiftBoosts(), Unit::HasAuraType(), 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
3017{
3018 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3019 return;
3020
3021 Unit* target = aurApp->GetTarget();
3022
3023 if (apply)
3024 {
3026
3027 // call functions which may have additional effects after chainging state of unit
3028 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
3029 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
3030 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
3031 if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
3032 // Stop spells on prepare or casting state
3033 target->InterruptSpell(CurrentSpellTypes(i), false);
3034 }
3035 else
3036 {
3037 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3039 return;
3040
3042 }
3043}
#define CURRENT_MAX_SPELL
Definition: Unit.h:544
CurrentSpellTypes
Definition: Unit.h:536
@ CURRENT_MELEE_SPELL
Definition: Unit.h:537
@ UNIT_FLAG_SILENCED
Definition: UnitDefines.h:242
@ SPELL_AURA_MOD_SILENCE
Definition: SpellAuraDefines.h:90
@ SPELL_PREVENTION_TYPE_SILENCE
Definition: SharedDefines.h:1554
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4044

References AURA_EFFECT_HANDLE_REAL, CURRENT_MAX_SPELL, CURRENT_MELEE_SPELL, Unit::GetCurrentSpell(), AuraApplication::GetTarget(), Unit::HasAuraType(), Unit::InterruptSpell(), Unit::RemoveUnitFlag(), Unit::SetUnitFlag(), SPELL_AURA_MOD_PACIFY_SILENCE, SPELL_AURA_MOD_SILENCE, SPELL_PREVENTION_TYPE_SILENCE, and UNIT_FLAG_SILENCED.

Referenced by HandleAuraModPacifyAndSilence().

◆ HandleAuraModSkill()

void AuraEffect::HandleAuraModSkill ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3218{
3220 return;
3221 Unit* target = aurApp->GetTarget();
3222
3223 if (!target->IsPlayer())
3224 return;
3225
3226 uint32 prot = GetMiscValue();
3227 int32 points = GetAmount();
3228
3229 target->ToPlayer()->ModifySkillBonus(prot, ((apply) ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
3230 if (prot == SKILL_DEFENSE)
3231 target->ToPlayer()->UpdateDefenseBonusesMod();
3232}
@ SPELL_AURA_MOD_SKILL_TALENT
Definition: SpellAuraDefines.h:161
@ AURA_EFFECT_HANDLE_SKILL
Definition: SpellAuraDefines.h:47
@ SKILL_DEFENSE
Definition: SharedDefines.h:2881
void ModifySkillBonus(uint32 skillid, int32 val, bool talent)
Definition: Player.cpp:5296
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
3160{
3162 return;
3163
3164 Unit* target = aurApp->GetTarget();
3165
3166 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
3167 if (apply)
3169 else
3170 {
3171 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3172 if (!target->HasAuraType(GetAuraType()))
3174 }
3175
3176 // call functions which may have additional effects after chainging state of unit
3177 target->UpdateObjectVisibility(target->IsPlayer());
3178}
@ UNIT_DYNFLAG_TRACK_UNIT
Definition: SharedDefines.h:3122
virtual void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:121
virtual void SetDynamicFlag(uint32 flag)
Definition: Object.h:120
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: Unit.cpp:19086

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

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
3503{
3504 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3505 return;
3506
3507 Unit* target = aurApp->GetTarget();
3508
3509 target->SetControlled(apply, UNIT_STATE_STUNNED);
3510}
@ UNIT_STATE_STUNNED
Definition: UnitDefines.h:152

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
3441{
3443 return;
3444
3445 Unit* target = aurApp->GetTarget();
3446
3447 if (!target->IsAlive() || !target->IsPlayer())
3448 return;
3449
3450 Unit* caster = GetCaster();
3451 if (caster && caster->IsAlive())
3452 target->getHostileRefMgr().addTempThreat((float)GetAmount(), apply);
3453}
void addTempThreat(float threat, bool apply)
Definition: HostileRefMgr.cpp:65
HostileRefMgr & getHostileRefMgr()
Definition: Unit.h:843

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

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

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

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

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

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

◆ HandleAuraRetainComboPoints()

void AuraEffect::HandleAuraRetainComboPoints ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5390{
5391 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5392 return;
5393
5394 Unit* target = aurApp->GetTarget();
5395
5396 if (!target->IsPlayer())
5397 return;
5398
5399 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
5400 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
5401 if (!(apply) && GetBase()->GetDuration() == 0)
5402 target->AddComboPoints(-GetAmount());
5403}
void AddComboPoints(Unit *target, int8 count)
Definition: Unit.cpp:16794

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
6151{
6152 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6153 return;
6154
6155 Unit* target = aurApp->GetTarget();
6156
6157 if (!target->IsPlayer() || !target->IsInWorld())
6158 return;
6159
6160 uint32 vehicleId = GetMiscValue();
6161
6162 if (apply)
6163 {
6164 if (!target->CreateVehicleKit(vehicleId, 0))
6165 return;
6166 }
6167 else if (target->GetVehicleKit())
6168 target->RemoveVehicleKit();
6169
6171 data << target->GetPackGUID();
6172 data << uint32(apply ? vehicleId : 0);
6173 target->SendMessageToSet(&data, true);
6174
6175 if (apply)
6176 {
6178 target->ToPlayer()->GetSession()->SendPacket(&data);
6179 }
6180}
@ SMSG_PLAYER_VEHICLE_DATA
Definition: Opcodes.h:1221
@ SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA
Definition: Opcodes.h:1211
PackedGuid const & GetPackGUID() const
Definition: Object.h:111
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:2080
std::size_t size() const
Definition: ObjectGuid.h:274
void RemoveVehicleKit()
Definition: Unit.cpp:18683
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Definition: Unit.cpp:18671
Definition: WorldPacket.h:27
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:214

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

References AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, ObjectMgr::ChooseDisplayId(), CreatureModel::CreatureDisplayID, 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(), IN_MILLISECONDS, Unit::IsMounted(), Object::IsPlayer(), Unit::IsPolymorphed(), SpellInfo::IsPositive(), LOG_ERROR, 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, Object::ToCreature(), Object::ToPlayer(), UNIT_FIELD_MOUNTDISPLAYID, UNIT_VIRTUAL_ITEM_SLOT_ID, and urand().

◆ HandleAuraUntrackable()

void AuraEffect::HandleAuraUntrackable ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3181{
3183 return;
3184
3185 Unit* target = aurApp->GetTarget();
3186
3187 if (apply)
3189 else
3190 {
3191 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3192 if (target->HasAuraType(GetAuraType()))
3193 return;
3195 }
3196}
@ 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
3326{
3328 return;
3329
3330 Unit* target = aurApp->GetTarget();
3331
3332 if (Player* targetPlayer = target->ToPlayer())
3333 {
3334 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3335 }
3336
3337 if (!apply)
3338 {
3339 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3340 if (target->HasAuraType(GetAuraType()))
3341 return;
3342 }
3343
3344 target->SetWaterWalking(apply);
3345}
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:20585

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

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

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
3631{
3632 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3633 return;
3634
3635 Unit* target = aurApp->GetTarget();
3636
3637 Unit* caster = GetCaster();
3638
3639 if (apply)
3640 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
3641 else
3642 target->RemoveCharmedBy(caster);
3643}
@ CHARM_TYPE_CONVERT
Definition: CharmInfo.h:47
void RemoveCharmedBy(Unit *charmer)
Definition: Unit.cpp:18508
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition: Unit.cpp:18306

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

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

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

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 
)
793{
795 ASSERT(aurApp);
796 HandleEffect(aurApp, mode, apply);
797}
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
5914{
5915 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5916 {
5917 return;
5918 }
5919
5920 Unit* caster = GetCaster();
5921 if (!caster || !caster->IsPlayer())
5922 {
5923 return;
5924 }
5925
5926 Player* player = caster->ToPlayer();
5927 if (apply)
5928 {
5930 }
5931 else
5932 {
5933 player->ResetFarSightDistance();
5934 }
5935
5936 caster->UpdateObjectVisibility(!apply);
5937}
void SetFarSightDistance(float radius)
Definition: Player.cpp:16271
void ResetFarSightDistance()
Definition: Player.cpp:16276
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2322

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
2808{
2809 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2810 return;
2811
2812 Unit* target = aurApp->GetTarget();
2813
2814 if (!target->IsPlayer())
2815 return;
2816
2817 if (Player* targetPlayer = target->ToPlayer())
2818 {
2819 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2820 }
2821
2822 if (apply)
2823 {
2824 /*
2825 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2826 data<<target->GetGUID();
2827 data<<uint8(0);
2828 target->SendMessageToSet(&data, true);
2829 */
2830
2831 UnitList targets;
2832 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
2834 Cell::VisitAllObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2835 for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2836 {
2837 if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2838 continue;
2839
2841 {
2842 if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2843 {
2844 SpellInfo const* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo();
2845 if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->IsCreature())
2846 {
2847 Creature* c = (*iter)->ToCreature();
2848 if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
2849 continue;
2850 }
2851 bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY)
2852 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
2853 if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST))
2854 {
2855 // at least one effect truly targets an unit, interrupt the spell
2856 interrupt = true;
2857 break;
2858 }
2859 if (interrupt)
2860 (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
2861 }
2862 }
2863 }
2864
2865 if (target->GetInstanceScript() && target->GetInstanceScript()->IsEncounterInProgress())
2866 {
2867 // Xinef: replaced with CombatStop(false)
2868 target->AttackStop();
2869 target->RemoveAllAttackers();
2870 target->getHostileRefMgr().addThreatPercent(-100);
2871 target->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
2872 }
2873 else
2874 {
2875 target->CombatStop();
2877 }
2878
2880
2881 // prevent interrupt message
2882 if (GetCasterGUID() == target->GetGUID())
2883 {
2885 target->FinishSpell(CURRENT_GENERIC_SPELL, true);
2886
2887 // interrupt autoshot
2889 {
2891 target->ToPlayer()->SendAutoRepeatCancel(target);
2892 }
2893 }
2894
2895 target->InterruptNonMeleeSpells(true);
2896
2897 // stop handling the effect if it was removed by linked event
2898 if (aurApp->GetRemoveMode())
2899 return;
2900 // blizz like 2.0.x
2902 // blizz like 2.0.x
2904 // blizz like 2.0.x
2906
2908 }
2909 else
2910 {
2911 /*
2912 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2913 data<<target->GetGUID();
2914 data<<uint8(1);
2915 target->SendMessageToSet(&data, true);
2916 */
2917 // blizz like 2.0.x
2919 // blizz like 2.0.x
2921 // blizz like 2.0.x
2923
2925 }
2926}
#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
@ UNIT_FLAG2_FEIGN_DEATH
Definition: UnitDefines.h:268
@ UNIT_STATE_DIED
Definition: UnitDefines.h:149
@ UNIT_STATE_CASTING
Definition: UnitDefines.h:164
@ UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
Definition: UnitDefines.h:258
@ TARGET_OBJECT_TYPE_UNIT
Definition: SpellInfo.h:101
@ TARGET_OBJECT_TYPE_UNIT_AND_DEST
Definition: SpellInfo.h:102
@ UNIT_DYNFLAG_DEAD
Definition: SharedDefines.h:3126
@ CREATURE_ELITE_WORLDBOSS
Definition: SharedDefines.h:2734
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition: SharedDefines.h:617
void deleteReferences(bool removeFromMap=false)
Definition: HostileRefMgr.cpp:125
void addThreatPercent(int32 percent)
Definition: HostileRefMgr.cpp:85
Definition: Creature.h:46
bool IsDungeonBoss() const
Definition: Creature.cpp:3157
bool isWorldBoss() const
Definition: Creature.h:123
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:206
uint32 rank
Definition: CreatureData.h:209
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
float GetVisibilityRange() const
Definition: Object.cpp:1645
void SendAttackSwingCancelAttack()
Definition: PlayerMisc.cpp:140
void SendAutoRepeatCancel(Unit *target)
Definition: PlayerMisc.cpp:152
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:10398
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4111
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition: Unit.cpp:4069
void RemoveAllAttackers()
Remove all units in m_attackers list and send them AttackStop()
Definition: Unit.cpp:10446
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition: Unit.cpp:10365
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:423
Definition: GridNotifiers.h:861
virtual bool IsEncounterInProgress() const
Definition: InstanceScript.cpp:122
float GetVisibilityRange() const
Definition: Map.h:351

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
3408{
3410 return;
3411
3412 Unit* target = aurApp->GetTarget();
3413
3414 if (apply)
3416 else
3417 {
3418 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3419 if (target->HasAuraType(GetAuraType()))
3420 return;
3422 }
3423}
@ UNIT_FLAG2_FORCE_MOVEMENT
Definition: UnitDefines.h:274

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

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
4974{
4976 return;
4977
4978 Unit* target = aurApp->GetTarget();
4979
4980 // Xinef: Do not apply such auras in normal way
4981 if (GetAmount() >= 1000)
4982 {
4983 target->SetInstantCast(apply);
4984 return;
4985 }
4986
4987 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
4988}
void SetInstantCast(bool set)
Definition: Unit.h:1745
void ApplyCastTimePercentMod(float val, bool apply)
Definition: Unit.cpp:17026

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
3616{
3617 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3618 return;
3619
3620 Unit* target = aurApp->GetTarget();
3621
3622 Unit* caster = GetCaster();
3623
3624 if (apply)
3625 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3626 else
3627 target->RemoveCharmedBy(caster);
3628}
@ CHARM_TYPE_CHARM
Definition: CharmInfo.h:44

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
3483{
3484 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3485 return;
3486
3487 Unit* target = aurApp->GetTarget();
3488
3489 target->SetControlled(apply, UNIT_STATE_CONFUSED);
3490}
@ UNIT_STATE_CONFUSED
Definition: UnitDefines.h:160

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

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
5264{
5266 return;
5267
5268 Unit* target = aurApp->GetTarget();
5269 if (!target)
5270 return;
5271
5272 if (!sScriptMgr->CanModAuraEffectModDamagePercentDone(this, target, aurApp, mode, apply))
5273 return;
5274
5275 if (target->IsPlayer())
5276 {
5277 for (int i = 0; i < MAX_ATTACK; ++i)
5278 if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), false))
5279 target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply);
5280 }
5281
5282 if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) && (GetSpellInfo()->EquippedItemClass == -1 || !target->IsPlayer()))
5283 {
5287
5288 if (target->IsPlayer())
5290 }
5291 else
5292 {
5293 // done in Player::_ApplyWeaponDependentAuraMods for SPELL_SCHOOL_MASK_NORMAL && EquippedItemClass != -1 and also for wand case
5294 }
5295}
@ 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
3493{
3494 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3495 return;
3496
3497 Unit* target = aurApp->GetTarget();
3498
3499 target->SetControlled(apply, UNIT_STATE_FLEEING, GetCaster(), true);
3500}
@ UNIT_STATE_FLEEING
Definition: UnitDefines.h:156

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
4539{
4541 return;
4542
4543 Unit* target = aurApp->GetTarget();
4544
4545 if (!target->IsPlayer())
4546 return;
4547 // implemented in Unit::SpellHealingBonus
4548 // this information is for client side only
4550}
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
4889{
4891 return;
4892
4893 Unit* target = aurApp->GetTarget();
4894
4895 if (target->IsPlayer())
4896 {
4897 target->ToPlayer()->UpdateMeleeHitChances();
4898 target->ToPlayer()->UpdateRangedHitChances();
4899 }
4900 else
4901 {
4902 target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
4903 target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
4904 }
4905}
void UpdateMeleeHitChances()
Definition: StatSystem.cpp:853
void UpdateRangedHitChances()
Definition: StatSystem.cpp:859
float m_modRangedHitChance
Definition: Unit.h:1784
float m_modMeleeHitChance
Definition: Unit.h:1783

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
1550{
1552 return;
1553
1554 Unit* target = aurApp->GetTarget();
1556
1557 if (apply)
1558 {
1559 // apply glow vision
1560 if (target->IsPlayer() && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10))
1562
1563 target->m_invisibility.AddFlag(type);
1564 target->m_invisibility.AddValue(type, GetAmount());
1565 }
1566 else
1567 {
1569 {
1570 // if not have different invisibility auras.
1571 // always remove glow vision
1572 if (target->IsPlayer())
1574
1575 target->m_invisibility.DelFlag(type);
1576 }
1577 else
1578 {
1579 bool found = false;
1581 for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i)
1582 {
1583 if (GetMiscValue() == (*i)->GetMiscValue())
1584 {
1585 found = true;
1586 break;
1587 }
1588 }
1589 if (!found)
1590 {
1591 target->m_invisibility.DelFlag(type);
1592
1593 // if not have invisibility auras of type INVISIBILITY_GENERAL
1594 // remove glow vision
1596 {
1598 }
1599 }
1600 }
1601
1602 target->m_invisibility.AddValue(type, -GetAmount());
1603 }
1604
1605 // call functions which may have additional effects after chainging state of unit
1606 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1607 {
1608 // drop flag at invisibiliy in bg
1610 }
1611
1612 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1613 target->bRequestForcedVisibilityUpdate = false;
1614}
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition: Player.h:569
@ PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION
Definition: Player.h:546
@ SPELL_AURA_MOD_INVISIBILITY
Definition: SpellAuraDefines.h:81
InvisibilityType
Definition: SharedDefines.h:1254
@ INVISIBILITY_UNK10
Definition: SharedDefines.h:1265
@ INVISIBILITY_GENERAL
Definition: SharedDefines.h:1255
bool HasFlag(FLAG_TYPE flag) const
Definition: Object.h:367
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:368
void DelFlag(FLAG_TYPE flag)
Definition: Object.h:369
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:373
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition: Object.h:520
bool IsPlayer() const
Definition: ObjectGuid.h:168
bool bRequestForcedVisibilityUpdate
Definition: Unit.h:1815
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1210
bool Instanceable() const
Definition: Map.h:447

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(), Unit::HasAuraType(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::HasFlag(), 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
1525{
1527 return;
1528
1529 Unit* target = aurApp->GetTarget();
1531
1532 if (apply)
1533 {
1534 target->m_invisibilityDetect.AddFlag(type);
1535 target->m_invisibilityDetect.AddValue(type, GetAmount());
1536 }
1537 else
1538 {
1540 target->m_invisibilityDetect.DelFlag(type);
1541
1542 target->m_invisibilityDetect.AddValue(type, -GetAmount());
1543 }
1544
1545 // call functions which may have additional effects after chainging state of unit
1546 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1547}
@ SPELL_AURA_MOD_INVISIBILITY_DETECT
Definition: SpellAuraDefines.h:82
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition: Object.h:521

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::HasAuraType(), Object::IsPlayer(), ObjectGuid::IsPlayer(), WorldObject::m_invisibilityDetect, SPELL_AURA_MOD_INVISIBILITY_DETECT, and Unit::UpdateObjectVisibility().

◆ HandleModManaRegen()

void AuraEffect::HandleModManaRegen ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4672{
4674 return;
4675
4676 Unit* target = aurApp->GetTarget();
4677
4678 if (!target->IsPlayer())
4679 return;
4680
4681 //Note: an increase in regen does NOT cause threat.
4682 target->ToPlayer()->UpdateManaRegen();
4683}
void UpdateManaRegen()
Definition: StatSystem.cpp:924

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
4123{
4124 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4125 return;
4126
4127 Unit* target = aurApp->GetTarget();
4128 uint32 mechanic = 0;
4129
4130 switch (GetId())
4131 {
4132 case 46924: // BladeStorm
4134 break;
4135 case 34471: // The Beast Within
4136 case 19574: // Bestial Wrath
4137 case 38484: // Bestial Wrath
4138 case 40081: // Free friend (Black Temple)
4156 break;
4157 case 42292: // PvP trinket
4158 case 59752: // Every Man for Himself
4159 case 65547: // PvP trinket for Faction Champions (ToC 25)
4160 case 53490: // Bullheaded
4161 case 46227: // Medalion of Immunity
4163 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.
4164 // Actually we should apply immunities here, too, but the aura has only 100 ms duration, so there is practically no point
4165 break;
4166 case 54508: // Demonic Empowerment
4167 mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
4172 break;
4173 default:
4174 if (GetMiscValue() < 1)
4175 return;
4176 mechanic = 1 << GetMiscValue();
4178 break;
4179 }
4180
4181 if (apply && GetSpellInfo()->HasAttribute(SPELL_ATTR1_IMMUNITY_PURGES_EFFECT))
4182 {
4183 // Xinef: exception for purely snare mechanic (eg. hands of freedom)!
4184 if (mechanic == (1 << MECHANIC_SNARE))
4185 target->RemoveMovementImpairingAuras(false);
4186 else
4188 }
4189}
@ SPELL_AURA_PREVENTS_FLEEING
Definition: SpellAuraDefines.h:155
@ AURA_REMOVE_BY_DEFAULT
Definition: SpellAuraDefines.h:392
@ 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
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition: Unit.cpp:5224
void RemoveMovementImpairingAuras(bool withRoot)
Definition: Unit.cpp:5205

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
4455{
4457 return;
4458
4459 Unit* target = aurApp->GetTarget();
4460
4461 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4462 {
4463 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4464 return;
4465 }
4466
4467 // only players currently use base stats
4468 if (!target->IsPlayer())
4469 return;
4470
4471 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
4472 {
4473 if (GetMiscValue() == i || GetMiscValue() == -1)
4474 target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_amount), apply);
4475 }
4476}

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
3541{
3542 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3543 return;
3544
3545 Unit* target = aurApp->GetTarget();
3546
3547 Unit* caster = GetCaster();
3548
3549 // no support for posession AI yet
3550 if (caster && caster->IsCreature())
3551 {
3552 HandleModCharm(aurApp, mode, apply);
3553 return;
3554 }
3555
3556 if (apply)
3557 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3558 else
3559 target->RemoveCharmedBy(caster);
3560}
@ CHARM_TYPE_POSSESS
Definition: CharmInfo.h:45
void HandleModCharm(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3615

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
3563{
3564 // Used by spell "Eyes of the Beast"
3565
3566 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3567 return;
3568
3569 Unit* caster = GetCaster();
3570 if (!caster || !caster->IsPlayer())
3571 return;
3572
3573 //seems it may happen that when removing it is no longer owner's pet
3574 //if (caster->ToPlayer()->GetPet() != target)
3575 // return;
3576
3577 Unit* target = aurApp->GetTarget();
3578 if (!target->IsCreature() || !target->IsPet())
3579 return;
3580
3581 Pet* pet = target->ToPet();
3582
3583 if (apply)
3584 {
3585 if (caster->ToPlayer()->GetPet() != pet)
3586 return;
3587
3588 // Must clear current motion or pet leashes back to owner after a few yards
3589 // when under spell 'Eyes of the Beast'
3590 pet->GetMotionMaster()->Clear();
3591 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3592 }
3593 else
3594 {
3595 pet->RemoveCharmedBy(caster);
3596
3597 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
3598 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
3599 else
3600 {
3601 // Reinitialize the pet bar or it will appear greyed out
3602 caster->ToPlayer()->PetSpellInitialize();
3603
3604 // Follow owner only if not fighting or owner didn't click "stay" at new location
3605 // This may be confusing because pet bar shows "stay" when under the spell but it retains
3606 // the "follow" flag. Player MUST click "stay" while under the spell.
3607 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3608 {
3610 }
3611 }
3612 }
3613}
@ COMMAND_STAY
Definition: Unit.h:555
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:45
#define PET_FOLLOW_DIST
Definition: PetDefines.h:198
float GetFollowAngle() const override
Definition: TemporarySummon.h:82
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1321
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition: Pet.cpp:884
void PetSpellInitialize()
Definition: Player.cpp:9468
bool HasCommandState(CommandStates state) const
Definition: CharmInfo.h:135
Pet * ToPet()
Definition: Unit.h:1714
CharmInfo * GetCharmInfo()
Definition: Unit.h:1278
Unit * GetVictim() const
Definition: Unit.h:789
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE, bool inheritWalkState=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:165

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
5340{
5342 return;
5343
5344 Unit* target = aurApp->GetTarget();
5345
5346 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5347 if (GetMiscValue() & (1 << i))
5349}
@ 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
5327{
5329 return;
5330
5331 Unit* target = aurApp->GetTarget();
5332
5333 float amount = CalculatePct(1.0f, GetAmount());
5334 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5335 if (GetMiscValue() & (1 << i))
5337}
@ 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
4649{
4651 return;
4652
4653 Unit* target = aurApp->GetTarget();
4654
4655 if (!target->IsPlayer())
4656 return;
4657
4658 // Update manaregen value
4659 if (GetMiscValue() == POWER_MANA)
4660 target->ToPlayer()->UpdateManaRegen();
4661 else if (GetMiscValue() == POWER_RUNE)
4663 // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
4664}
@ POWER_RUNE
Definition: SharedDefines.h:274
void UpdateRuneRegen(RuneType rune)
Definition: StatSystem.cpp:958

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
4667{
4668 HandleModPowerRegen(aurApp, mode, apply);
4669}
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:4648

References HandleModPowerRegen().

◆ HandleModRating()

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

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

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

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
4934{
4936 return;
4937
4938 Unit* target = aurApp->GetTarget();
4939
4940 if (!target->IsPlayer())
4941 return;
4942
4943 for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
4944 if (GetMiscValue() & (1 << school))
4945 target->ToPlayer()->UpdateSpellCritChance(school);
4946}
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
4509{
4511 return;
4512
4513 Unit* target = aurApp->GetTarget();
4514
4515 if (!target->IsPlayer())
4516 return;
4517
4518 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4519 // This information for client side use only
4520 // Recalculate bonus
4522}

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

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
4525{
4527 return;
4528
4529 Unit* target = aurApp->GetTarget();
4530
4531 if (!target->IsPlayer())
4532 return;
4533
4534 // Recalculate bonus
4536}

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
4495{
4497 return;
4498
4499 Unit* target = aurApp->GetTarget();
4500
4501 if (!target->IsPlayer())
4502 return;
4503
4504 // Recalculate bonus
4506}

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
4908{
4910 return;
4911
4912 Unit* target = aurApp->GetTarget();
4913
4914 if (target->IsPlayer())
4915 target->ToPlayer()->UpdateSpellHitChances();
4916 else
4917 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
4918}
void UpdateSpellHitChances()
Definition: StatSystem.cpp:865
float m_modSpellHitChance
Definition: Unit.h:1785

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
3809{
3810 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3811 return;
3812
3813 Unit* target = aurApp->GetTarget();
3814 std::list <AuraType> aura_immunity_list;
3815 uint32 mechanic_immunity_list = 0;
3816 int32 miscVal = GetMiscValue();
3817
3818 switch (miscVal)
3819 {
3820 case 96:
3821 case 1615:
3822 {
3823 if (!GetAmount())
3824 {
3825 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3826 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3827 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3828 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3830 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3831
3844 aura_immunity_list.push_back(SPELL_AURA_MOD_CHARM);
3845 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3846 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3847 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3848 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3849 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3850 }
3851 break;
3852 }
3853 case 679:
3854 {
3855 if (GetId() == 57742)
3856 {
3857 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3858 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3859 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3860 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3862 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3863
3876 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3877 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3878 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3879 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3880 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3881 }
3882 break;
3883 }
3884 case 1557:
3885 {
3886 if (GetId() == 64187)
3887 {
3888 mechanic_immunity_list = (1 << MECHANIC_STUN);
3890 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3891 }
3892 else
3893 {
3894 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3895 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3896 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3897 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3899 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3900
3913 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3914 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3915 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3916 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3917 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3918 }
3919 break;
3920 }
3921 case 1614:
3922 case 1694:
3923 {
3925 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3926 break;
3927 }
3928 case 1630:
3929 {
3930 if (!GetAmount())
3931 {
3933 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3934 }
3935 else
3936 {
3937 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3938 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3939 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3940 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3942 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3943
3956 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3957 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3958 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3959 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3960 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3961 }
3962 break;
3963 }
3964 case 477:
3965 case 1733:
3966 case 1632:
3967 {
3968 if (!GetAmount())
3969 {
3970 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3971 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3972 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3973 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3975 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN) | (1 << MECHANIC_BANISH);
3976
3992 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3993
3994 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3995 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3996 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3997 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3998 }
3999 break;
4000 }
4001 case 878:
4002 {
4003 if (GetAmount() == 1)
4004 {
4005 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN)
4006 | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE);
4007
4012 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
4013 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
4014 }
4015 break;
4016 }
4017 default:
4018 break;
4019 }
4020
4021 if (aura_immunity_list.empty())
4022 {
4023 // Roots, OK
4024 if (GetMiscValue() & (1 << 0))
4025 {
4026 mechanic_immunity_list = (1 << MECHANIC_SNARE);
4027
4029 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
4030 }
4031 // Taunt, OK
4032 if (GetMiscValue() & (1 << 1))
4033 {
4034 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
4035 }
4036 // Crowd-Control auras?
4037 if (GetMiscValue() & (1 << 2))
4038 {
4039 mechanic_immunity_list = (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED);
4040
4043 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
4044 }
4045 // Interrupt, OK
4046 if (GetMiscValue() & (1 << 3))
4047 {
4048 mechanic_immunity_list = (1 << MECHANIC_INTERRUPT);
4049
4051 }
4052 // Transform?
4053 if (GetMiscValue() & (1 << 4))
4054 {
4055 aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
4056 }
4057 // Stun auras breakable by damage (Incapacitate effects), OK
4058 if (GetMiscValue() & (1 << 5))
4059 {
4060 mechanic_immunity_list = (1 << MECHANIC_KNOCKOUT);
4061
4063 }
4064 // // Slowing effects
4065 if (GetMiscValue() & (1 << 6))
4066 {
4067 mechanic_immunity_list = (1 << MECHANIC_SNARE);
4068
4070 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
4071 }
4072 // Charm auras?, 90%
4073 if ((GetMiscValue() & (1 << 7)))
4074 {
4075 mechanic_immunity_list = (1 << MECHANIC_CHARM);
4076
4078 aura_immunity_list.push_back(SPELL_AURA_MOD_CHARM);
4079 aura_immunity_list.push_back(SPELL_AURA_MOD_POSSESS);
4080 }
4081 // UNK
4082 // if ((GetMiscValue() & (1 << 8)))
4083 // {
4084 // }
4085 // Fear, OK
4086 if (GetMiscValue() & (1 << 9))
4087 {
4088 mechanic_immunity_list = (1 << MECHANIC_FEAR);
4089
4091 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
4092 }
4093 // Stuns, OK
4094 if (GetMiscValue() & (1 << 10))
4095 {
4096 mechanic_immunity_list = (1 << MECHANIC_STUN);
4097
4099 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
4100 }
4101 }
4102
4103 // apply immunities
4104 for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
4105 target->ApplySpellImmune(GetId(), IMMUNITY_STATE, *iter, apply);
4106
4107 // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated.
4108 if (GetId() == 46924)
4109 {
4110 // Knockback and hex
4112 }
4113
4115 {
4116 target->RemoveAurasWithMechanic(mechanic_immunity_list, AURA_REMOVE_BY_DEFAULT, GetId());
4117 for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
4118 target->RemoveAurasByType(*iter);
4119 }
4120}
@ 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
@ 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

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
1642{
1644 return;
1645
1646 Unit* target = aurApp->GetTarget();
1648
1649 if (apply)
1650 {
1651 target->m_stealth.AddFlag(type);
1652 target->m_stealth.AddValue(type, GetAmount());
1653
1655 if (target->IsPlayer())
1657
1658 // interrupt autoshot
1660 {
1662 target->ToPlayer()->SendAutoRepeatCancel(target);
1663 }
1664 }
1665 else
1666 {
1667 target->m_stealth.AddValue(type, -GetAmount());
1668
1669 if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
1670 {
1671 target->m_stealth.DelFlag(type);
1672
1674 if (target->IsPlayer())
1676 }
1677 }
1678
1679 // call functions which may have additional effects after chainging state of unit
1680 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1681 {
1682 // drop flag at stealth in bg
1684 }
1685
1686 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1687 target->bRequestForcedVisibilityUpdate = false;
1688}
@ UNIT_STAND_FLAGS_CREEP
Definition: UnitDefines.h:48
@ PLAYER_FIELD_BYTE2_STEALTH
Definition: Player.h:568
@ SPELL_AURA_MOD_STEALTH
Definition: SpellAuraDefines.h:79
StealthType
Definition: SharedDefines.h:1246
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:517
void RemoveStandFlags(uint8 flags)
Definition: Unit.h:988
void SetStandFlags(uint8 flags)
Definition: Unit.h:987

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::HasAuraType(), 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(), SPELL_AURA_MOD_STEALTH, Object::ToPlayer(), UNIT_STAND_FLAGS_CREEP, and Unit::UpdateObjectVisibility().

◆ HandleModStealthDetect()

void AuraEffect::HandleModStealthDetect ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1617{
1619 return;
1620
1621 Unit* target = aurApp->GetTarget();
1623
1624 if (apply)
1625 {
1626 target->m_stealthDetect.AddFlag(type);
1627 target->m_stealthDetect.AddValue(type, GetAmount());
1628 }
1629 else
1630 {
1632 target->m_stealthDetect.DelFlag(type);
1633
1634 target->m_stealthDetect.AddValue(type, -GetAmount());
1635 }
1636
1637 // call functions which may have additional effects after chainging state of unit
1638 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1639}
@ SPELL_AURA_MOD_STEALTH_DETECT
Definition: SpellAuraDefines.h:80
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition: Object.h:518

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::HasAuraType(), Object::IsPlayer(), ObjectGuid::IsPlayer(), WorldObject::m_stealthDetect, SPELL_AURA_MOD_STEALTH_DETECT, and Unit::UpdateObjectVisibility().

◆ HandleModStealthLevel()

void AuraEffect::HandleModStealthLevel ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1691{
1693 return;
1694
1695 Unit* target = aurApp->GetTarget();
1697
1698 if (apply)
1699 target->m_stealth.AddValue(type, GetAmount());
1700 else
1701 target->m_stealth.AddValue(type, -GetAmount());
1702
1703 // call functions which may have additional effects after chainging state of unit
1704 target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
1705}

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
4407{
4409 return;
4410
4411 Unit* target = aurApp->GetTarget();
4412
4413 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
4414
4415 // show armor penetration
4416 if (target->IsPlayer() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
4418
4419 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
4422}
@ PLAYER_FIELD_MOD_TARGET_RESISTANCE
Definition: UpdateFields.h:366
@ PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
Definition: UpdateFields.h:367
@ SPELL_SCHOOL_MASK_SPELL
Definition: SharedDefines.h:308

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
3456{
3457 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3458 return;
3459
3460 Unit* target = aurApp->GetTarget();
3461
3462 if (!target->IsAlive() || !target->CanHaveThreatList())
3463 return;
3464
3465 Unit* caster = GetCaster();
3466 if (!caster || !caster->IsAlive())
3467 return;
3468
3469 if (apply)
3470 target->TauntApply(caster);
3471 else
3472 {
3473 // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat
3474 target->TauntFadeOut(caster);
3475 }
3476}
void TauntApply(Unit *victim)
Definition: Unit.cpp:14619
void TauntFadeOut(Unit *taunter)
Definition: Unit.cpp:14649

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

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

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
2929{
2931 return;
2932
2933 Unit* target = aurApp->GetTarget();
2934
2935 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2936 if (!apply && target->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
2937 return;
2938
2940
2941 // call functions which may have additional effects after chainging state of unit
2942 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
2943 {
2944 // xinef: this aura should not stop combat (movie with sindragosa proves that)
2945 //target->CombatStop();
2947 }
2948}
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:230
@ SPELL_AURA_MOD_UNATTACKABLE
Definition: SpellAuraDefines.h:156

References Object::ApplyModFlag(), AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, AuraApplication::GetTarget(), Unit::HasAuraType(), Unit::RemoveAurasWithInterruptFlags(), SPELL_AURA_MOD_UNATTACKABLE, 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
5370{
5371 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5372 return;
5373
5374 Unit* target = aurApp->GetTarget();
5375
5376 if (!target->IsPlayer())
5377 return;
5378
5379 flag96 mask;
5381 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
5382 mask |= (*i)->m_spellInfo->Effects[(*i)->m_effIndex].SpellClassMask;
5383
5384 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1, mask[0]);
5385 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 1, mask[1]);
5386 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2, mask[2]);
5387}
@ PLAYER_NO_REAGENT_COST_1
Definition: UpdateFields.h:387
@ SPELL_AURA_NO_REAGENT_USE
Definition: SpellAuraDefines.h:319
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
7100{
7102 if (GetMiscValue() == POWER_ALL)
7103 PowerType = target->getPowerType();
7104 else
7106
7107 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
7108 return;
7109
7110 if (target->HasUnitState(UNIT_STATE_ISOLATED))
7111 {
7112 SendTickImmune(target, caster);
7113 return;
7114 }
7115
7116 // don't regen when permanent aura target has full power
7117 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
7118 return;
7119
7120 // ignore negative values (can be result apply spellmods to aura damage
7121 uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(PowerType) / 100;
7122 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
7123 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
7124 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
7125 target->SendPeriodicAuraLog(&pInfo);
7126
7127 int32 gain = target->ModifyPower(PowerType, amount);
7128
7129 if (caster)
7130 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
7131}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:168
@ POWER_ALL
Definition: SharedDefines.h:277
std::string ToString(Type &&val, Params &&... params)
Definition: StringConvert.h:250
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=nullptr)
Definition: HostileRefMgr.cpp:35
std::string ToString() const
Definition: ObjectGuid.cpp:47
Definition: Unit.h:512
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:14106
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:892
bool HasUnitState(const uint32 f) const
Definition: Unit.h:673
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition: Unit.cpp:6360
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1096

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

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

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

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
6850{
6851 if (!caster || !caster->IsAlive() || !target->IsAlive())
6852 return;
6853
6854 if (target->HasUnitState(UNIT_STATE_ISOLATED))
6855 {
6856 SendTickImmune(target, caster);
6857 return;
6858 }
6859
6860 uint32 damage = std::max(GetAmount(), 0);
6861 // do not kill health donator
6862 if (caster->GetHealth() < damage)
6863 damage = caster->GetHealth() - 1;
6864 if (!damage)
6865 return;
6866
6867 caster->ModifyHealth(-(int32)damage);
6868 LOG_DEBUG("spells.aura", "PeriodicTick: donator {} target {} damage {}.", caster->GetEntry(), target->GetEntry(), damage);
6869
6870 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6871
6872 damage = int32(damage * gainMultiplier);
6873
6874 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6875 caster->HealBySpell(healInfo);
6876}
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition: Unit.cpp:11201

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

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

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

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

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
6556{
6557 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
6558 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6559 {
6560 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6561 {
6562 SpellCastTargets targets;
6563 targets.SetUnitTarget(target);
6564 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6565 {
6568 }
6569
6570 CustomSpellValues values;
6572
6573 triggerCaster->CastSpell(targets, triggeredSpellInfo, &values, TRIGGERED_FULL_MASK, nullptr, this);
6574 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6575 }
6576 }
6577 else
6578 {
6579 Creature* c = target->ToCreature();
6580 if (c && caster)
6581 {
6582 sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature());
6583 }
6584
6585 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
6586 }
6587}
SpellEffIndex
Definition: SharedDefines.h:30
Definition: SpellDefines.h:163
void AddSpellMod(SpellValueMod mod, int32 value)
Definition: SpellDefines.h:165

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
1803{
1804 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1805 return;
1806
1807 Unit* target = aurApp->GetTarget();
1808
1809 // no-phase is also phase state so same code for apply and remove
1810 uint32 newPhase = target->GetPhaseByAuras();
1811
1812 if (Player* player = target->ToPlayer())
1813 {
1814 if (!newPhase)
1815 newPhase = PHASEMASK_NORMAL;
1816
1817 // do not change phase to GM with all phases enabled
1818 if (player->IsGameMaster())
1819 newPhase = PHASEMASK_ANYWHERE;
1820
1821 player->SetPhaseMask(newPhase, false);
1822 player->GetSession()->SendSetPhaseShift(newPhase);
1823 }
1824 else
1825 {
1826 if (!newPhase)
1827 {
1828 newPhase = PHASEMASK_NORMAL;
1829 if (Creature* creature = target->ToCreature())
1830 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
1831 newPhase = data->phaseMask;
1832 }
1833
1834 target->SetPhaseMask(newPhase, false);
1835 }
1836
1837 // call functions which may have additional effects after chainging state of unit
1838 // phase auras normally not expected at BG but anyway better check
1839 if (apply)
1840 {
1841 // drop flag at invisibiliy in bg
1843 }
1844
1845 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1846 if (target->IsVisible())
1847 {
1848 if (!target->GetMap()->Instanceable())
1849 {
1850 target->UpdateObjectVisibility(false);
1851 target->m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f);
1852 }
1853 else
1854 target->UpdateObjectVisibility();
1855 }
1856}
@ PHASEMASK_ANYWHERE
Definition: Object.h:60
@ PHASEMASK_NORMAL
Definition: Object.h:59
Definition: CreatureData.h:373
void Relocate(float x, float y)
Definition: Position.h:73
uint32 GetPhaseByAuras() const
Definition: Unit.cpp:18994
bool IsVisible() const
Definition: Unit.h:1481
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:19005
Position m_last_notify_position
Definition: Unit.h:1811

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.
3523{
3524 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3525 return;
3526
3527 Unit* target = aurApp->GetTarget();
3528 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
3529 if (target->IsPlayer() || !apply || target->HasAuraType(SPELL_AURA_MOD_FEAR))
3530 return;
3533 target->SetControlled(false, UNIT_STATE_FLEEING);
3534}

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

◆ HandlePreventResurrection()

void AuraEffect::HandlePreventResurrection ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
6183{
6184 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6185 return;
6186
6187 if (!aurApp->GetTarget()->IsPlayer())
6188 return;
6189
6190 if (apply)
6191 aurApp->GetTarget()->RemoveByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
6192 else if (!aurApp->GetTarget()->GetMap()->Instanceable())
6193 aurApp->GetTarget()->SetByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
6194}
@ PLAYER_FIELD_BYTE_RELEASE_TIMER
Definition: Player.h:560

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 
)
1170{
1171 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1172 if (prevented)
1173 return;
1174
1175 switch (GetAuraType())
1176 {
1178 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1179 break;
1181 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1182 break;
1184 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1185 break;
1187 HandleRaidProcFromChargeAuraProc(aurApp, eventInfo);
1188 break;
1191 break;
1192 default:
1193 break;
1194 }
1195
1196 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1197}
@ 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:7272
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:7231
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:7252
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:7320
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:7214
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 
)
7253{
7254 Unit* target = aurApp->GetTarget();
7255 Unit* triggerTarget = eventInfo.GetProcTarget();
7256 if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamageOrSchool(GetSpellInfo()))
7257 {
7258 SendTickImmune(triggerTarget, target);
7259 return;
7260 }
7261
7262 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetSpellInfo(), GetSpellInfo()->SchoolMask);
7263 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetEffIndex());
7264 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
7265 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
7266 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
7267 target->SendSpellNonMeleeDamageLog(&damageInfo);
7268 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
7269 target->DealSpellDamage(&damageInfo, true);
7270}
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 
)
7215{
7216 Unit* triggerCaster = aurApp->GetTarget();
7217 Unit* triggerTarget = eventInfo.GetProcTarget();
7218
7219 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
7220 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
7221 {
7222 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
7223 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this);
7224 }
7225 else
7226 {
7227 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());
7228 }
7229}

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 
)
7232{
7233 Unit* triggerCaster = aurApp->GetTarget();
7234 Unit* triggerTarget = eventInfo.GetProcTarget();
7235
7236 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
7237 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
7238 {
7239 // used only with EXTRA_LOGS
7240 (void)triggeredSpellInfo;
7241
7242 int32 basepoints0 = GetAmount();
7243 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell {} with value {} from aura {} proc", triggeredSpellInfo->Id, basepoints0, GetId());
7244 triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, nullptr, nullptr, true, nullptr, this);
7245 }
7246 else
7247 {
7248 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());
7249 }
7250}

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

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

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
5048{
5050 return;
5051
5052 Unit* target = aurApp->GetTarget();
5053
5054 if (!target->IsPlayer())
5055 return;
5056
5057 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
5058}

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

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

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

References AURA_EFFECT_HANDLE_REAL, Unit::CastSpell(), AuraApplication::GetTarget(), Unit::IsAlive(), Object::IsPlayer(), Unit::IsStandState(), 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
3396{
3398 return;
3399
3400 Unit* target = aurApp->GetTarget();
3401
3402 // update timers in client
3403 if (target->IsPlayer())
3404 target->ToPlayer()->UpdateMirrorTimers();
3405}
void UpdateMirrorTimers()
Definition: PlayerUpdates.cpp:427

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

◆ HasSpellClassMask()

bool AuraEffect::HasSpellClassMask ( ) const
1092{
1093 return m_spellInfo->Effects[m_effIndex].SpellClassMask;
1094}

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

◆ IsAffectedOnSpell()

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

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
1103{
1104 bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
1105 if (prevented)
1106 return;
1107
1108 Unit* target = aurApp->GetTarget();
1109
1110 // Update serverside orientation of tracking channeled auras on periodic update ticks
1111 // exclude players because can turn during channeling and shouldn't desync orientation client/server
1113 {
1114 ObjectGuid const channelGuid = caster->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT);
1115 if (!channelGuid.IsEmpty() && channelGuid != caster->GetGUID())
1116 {
1117 if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*caster, channelGuid))
1118 {
1119 caster->SetInFront(objectTarget);
1120 }
1121 }
1122 }
1123
1124 switch (GetAuraType())
1125 {
1127 HandlePeriodicDummyAuraTick(target, caster);
1128 break;
1130 HandlePeriodicTriggerSpellAuraTick(target, caster);
1131 break;
1133 // Don't actually do anything - client will trigger casts of these spells by itself
1134 break;
1137 break;
1140 HandlePeriodicDamageAurasTick(target, caster);
1141 break;
1143 HandlePeriodicHealthLeechAuraTick(target, caster);
1144 break;
1146 HandlePeriodicHealthFunnelAuraTick(target, caster);
1147 break;
1150 HandlePeriodicHealAurasTick(target, caster);
1151 break;
1153 HandlePeriodicManaLeechAuraTick(target, caster);
1154 break;
1156 HandleObsModPowerAuraTick(target, caster);
1157 break;
1159 HandlePeriodicEnergizeAuraTick(target, caster);
1160 break;
1162 HandlePeriodicPowerBurnAuraTick(target, caster);
1163 break;
1164 default:
1165 break;
1166 }
1167}
@ SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL
Definition: SharedDefines.h:433
WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:118
Definition: Object.h:405
bool IsEmpty() const
Definition: ObjectGuid.h:161
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20477
void HandlePeriodicPowerBurnAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:7167
void HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:7026
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:7099
void HandlePeriodicHealthFunnelAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6849
void HandlePeriodicHealAurasTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6878
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:7133
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6287
void HandlePeriodicDummyAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6196
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6743
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6589
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6555
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
Definition: SpellAuras.cpp:2483
bool IsChanneled() const
Definition: SpellInfo.cpp:1255

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

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

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