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

References m_channelData, and m_spellmod.

◆ AuraEffect()

AuraEffect::AuraEffect ( Aura base,
uint8  effIndex,
int32 baseAmount,
Unit caster 
)
explicitprivate
383 :
384 m_base(base), m_spellInfo(base->GetSpellInfo()),
385 m_baseAmount(baseAmount ? * baseAmount : m_spellInfo->Effects[effIndex].BasePoints), m_critChance(0),
386 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}
@ UNIT_FIELD_CHANNEL_OBJECT
Definition: UpdateFields.h:93
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:980
#define sSpellMgr
Definition: SpellMgr.h:818
ObjectGuid GetGuidValue(uint16 index) const
Definition: Object.cpp:337
bool CanApplyResilience() const
Definition: Unit.h:2427
uint8 GetLevel() const
Definition: Unit.h:1420
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:2061
int32 m_periodicTimer
Definition: SpellAuraEffects.h:140
bool m_canBeRecalculated
Definition: SpellAuraEffects.h:145
uint8 const m_effIndex
Definition: SpellAuraEffects.h:144
uint8 m_casterLevel
Definition: SpellAuraEffects.h:126
bool m_applyResilience
Definition: SpellAuraEffects.h:125
void CalculatePeriodic(Unit *caster, bool create=false, bool load=false)
Definition: SpellAuraEffects.cpp:587
void CalculateSpellMod()
Definition: SpellAuraEffects.cpp:678
int32 m_oldAmount
Definition: SpellAuraEffects.h:133
uint32 GetId() const
Definition: SpellAuraEffects.cpp:432
int32 CalculateAmount(Unit *caster)
Definition: SpellAuraEffects.cpp:452
int32 m_amount
Definition: SpellAuraEffects.h:127
void CalculatePeriodicData()
Definition: SpellAuraEffects.cpp:572
uint32 m_tickNumber
Definition: SpellAuraEffects.h:142
int32 const m_baseAmount
Definition: SpellAuraEffects.h:123
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:122
bool m_isAuraEnabled
Definition: SpellAuraEffects.h:134
bool m_isPeriodic
Definition: SpellAuraEffects.h:146
uint32 m_auraGroup
Definition: SpellAuraEffects.h:132
float m_critChance
Definition: SpellAuraEffects.h:128
Aura *const m_base
Definition: SpellAuraEffects.h:120
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:391

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 
)
794{
795 if (!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
796 return;
797
798 target->ToPlayer()->AddSpellMod(m_spellmod, apply);
799
800 // Auras with charges do not mod amount of passive auras
801 if (GetBase()->IsUsingCharges())
802 return;
803 // reapply some passive spells after add/remove related spellmods
804 // Warning: it is a dead loop if 2 auras each other amount-shouldn't happen
805 switch (GetMiscValue())
806 {
808 case SPELLMOD_EFFECT1:
809 case SPELLMOD_EFFECT2:
810 case SPELLMOD_EFFECT3:
811 {
812 ObjectGuid guid = target->GetGUID();
813 Unit::AuraApplicationMap& auras = target->GetAppliedAuras();
814 for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
815 {
816 Aura* aura = iter->second->GetBase();
817 // only passive and permament auras-active auras should have amount set on spellcast and not be affected
818 // if aura is casted by others, it will not be affected
819 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == guid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
820 {
822 {
823 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
824 {
825 if (AuraEffect* aurEff = aura->GetEffect(i))
826 aurEff->RecalculateAmount();
827 }
828 }
829 else if (GetMiscValue() == SPELLMOD_EFFECT1)
830 {
831 if (AuraEffect* aurEff = aura->GetEffect(0))
832 aurEff->RecalculateAmount();
833 }
834 else if (GetMiscValue() == SPELLMOD_EFFECT2)
835 {
836 if (AuraEffect* aurEff = aura->GetEffect(1))
837 aurEff->RecalculateAmount();
838 }
839 else //if (modOp == SPELLMOD_EFFECT3)
840 {
841 if (AuraEffect* aurEff = aura->GetEffect(2))
842 aurEff->RecalculateAmount();
843 }
844 }
845 }
846
847 Pet* pet = target->ToPlayer()->GetPet();
848 if (!pet)
849 break;
850
851 ObjectGuid petguid = pet->GetGUID();
852 Unit::AuraApplicationMap& petauras = pet->GetAppliedAuras();
853 for (Unit::AuraApplicationMap::iterator iter = petauras.begin(); iter != petauras.end(); ++iter)
854 {
855 Aura* aura = iter->second->GetBase();
856 // only passive auras-active auras should have amount set on spellcast and not be affected
857 // if aura is casted by others, it will not be affected
858 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == petguid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
859 {
861 {
862 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
863 {
864 if (AuraEffect* aurEff = aura->GetEffect(i))
865 aurEff->RecalculateAmount();
866 }
867 }
868 else if (GetMiscValue() == SPELLMOD_EFFECT1)
869 {
870 if (AuraEffect* aurEff = aura->GetEffect(0))
871 aurEff->RecalculateAmount();
872 }
873 else if (GetMiscValue() == SPELLMOD_EFFECT2)
874 {
875 if (AuraEffect* aurEff = aura->GetEffect(1))
876 aurEff->RecalculateAmount();
877 }
878 else //if (modOp == SPELLMOD_EFFECT3)
879 {
880 if (AuraEffect* aurEff = aura->GetEffect(2))
881 aurEff->RecalculateAmount();
882 }
883 }
884 }
885 }
886 default:
887 break;
888 }
889}
std::uint8_t uint8
Definition: Define.h:110
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ 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:1610
Player * ToPlayer()
Definition: Object.h:195
TypeID GetTypeId() const
Definition: Object.h:121
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
Definition: ObjectGuid.h:120
Definition: Pet.h:40
Pet * GetPet() const
Definition: Player.cpp:8784
void AddSpellMod(SpellModifier *mod, bool apply)
Definition: Player.cpp:9785
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:1299
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1924
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:1096
bool IsPermanent() const
Definition: SpellAuras.h:139
bool IsAffectedBySpellMod(SpellModifier const *mod) const
Definition: SpellInfo.cpp:1277

References Player::AddSpellMod(), Unit::GetAppliedAuras(), GetBase(), Aura::GetCasterGUID(), Aura::GetEffect(), Object::GetGUID(), GetMiscValue(), Player::GetPet(), Aura::GetSpellInfo(), Object::GetTypeId(), SpellInfo::IsAffectedBySpellMod(), Aura::IsPassive(), Aura::IsPermanent(), m_spellmod, MAX_SPELL_EFFECTS, SPELLMOD_ALL_EFFECTS, SPELLMOD_EFFECT1, SPELLMOD_EFFECT2, SPELLMOD_EFFECT3, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by HandleEffect().

◆ CalcPeriodicCritChance()

float AuraEffect::CalcPeriodicCritChance ( Unit const *  caster,
Unit const *  target 
) const
private
1039{
1040 float critChance = 0.0f;
1041 if (caster)
1042 {
1043 if (Player* modOwner = caster->GetSpellModOwner())
1044 {
1045 Unit::AuraEffectList const& mPeriodicCritAuras = modOwner->GetAuraEffectsByType(SPELL_AURA_ABILITY_PERIODIC_CRIT);
1046 for (Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr)
1047 {
1048 if ((*itr)->IsAffectedOnSpell(GetSpellInfo()))
1049 {
1050 critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), (GetSpellInfo()->DmgClass == SPELL_DAMAGE_CLASS_RANGED ? RANGED_ATTACK : BASE_ATTACK), true);
1051 break;
1052 }
1053 }
1054
1055 switch(GetSpellInfo()->SpellFamilyName)
1056 {
1057 // Rupture - since 3.3.3 can crit
1058 case SPELLFAMILY_ROGUE:
1059 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100000)
1060 critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), BASE_ATTACK, true);
1061 break;
1062 }
1063 }
1064 }
1065 if (target && critChance > 0.0f)
1066 critChance = target->SpellTakenCritChance(caster, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), critChance, BASE_ATTACK, true);
1067
1068 return std::max(0.0f, critChance);
1069}
@ BASE_ATTACK
Definition: Unit.h:396
@ RANGED_ATTACK
Definition: Unit.h:398
@ SPELL_AURA_ABILITY_PERIODIC_CRIT
Definition: SpellAuraDefines.h:349
@ SPELL_DAMAGE_CLASS_RANGED
Definition: SharedDefines.h:1520
@ SPELLFAMILY_ROGUE
Definition: SharedDefines.h:3508
Definition: Player.h:1046
Player * GetSpellModOwner() const
Definition: Unit.cpp:16751
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1306
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 (item1 && item2 && (item1->GetTemplate()->InventoryType == INVTYPE_2HWEAPON || item2->GetTemplate()->InventoryType == INVTYPE_2HWEAPON))
533 amount = -10;
534 else
535 amount = 0;
536 }
537 break;
538 default:
539 break;
540 }
541
542 // xinef: save base amount, before calculating sp etc. Used for Unit::CastDelayedSpellWithPeriodicAmount
543 SetOldAmount(amount * GetBase()->GetStackAmount());
545
546 // Xinef: Periodic auras
547 if (caster)
548 switch (GetAuraType())
549 {
552 // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value!
553 if (GetBase()->GetType() == UNIT_AURA_TYPE)
554 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex(), GetPctMods(), 1);
555 break;
557 if (GetBase()->GetType() == UNIT_AURA_TYPE)
558 amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex(), GetPctMods(), 1);
559 break;
561 if (GetBase()->GetType() == UNIT_AURA_TYPE)
562 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE, 0.0f, 1);
563 break;
564 default:
565 break;
566 }
567
568 amount *= GetBase()->GetStackAmount();
569 return amount;
570}
std::int32_t int32
Definition: Define.h:104
std::uint32_t uint32
Definition: Define.h:108
T AddPct(T &base, U pct)
Definition: Util.h:67
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
@ INVTYPE_2HWEAPON
Definition: ItemTemplate.h:282
@ OFF_ATTACK
Definition: Unit.h:397
@ DOT
Definition: Unit.h:437
@ SPELL_DIRECT_DAMAGE
Definition: Unit.h:436
@ 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:1814
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition: DBCStructure.h:1183
Definition: Item.h:214
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:546
uint32 InventoryType
Definition: ItemTemplate.h:641
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition: PlayerStorage.cpp:519
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1967
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition: Unit.cpp:12370
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition: Unit.cpp:11566
void SetOldAmount(int32 amount)
Definition: SpellAuraEffects.h:116
AuraType GetAuraType() const
Definition: SpellAuraEffects.cpp:447
float GetPctMods() const
Definition: SpellAuraEffects.h:111
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:56
void CallScriptEffectCalcAmountHandlers(AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
Definition: SpellAuras.cpp:2521
uint8 GetStackAmount() const
Definition: SpellAuras.h:148
uint32 Id
Definition: SpellInfo.h:318
uint32 ProcFlags
Definition: SpellInfo.h:353
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:877
Definition: DBCStructure.h:1196
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > AllocationPct
Definition: DBCStructure.h:1203
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
Definition: DBCStructure.h:1201
Definition: DBCStructure.h:1817
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1823

References AddPct(), ItemRandomSuffixEntry::AllocationPct, BASE_ATTACK, Aura::CallScriptEffectCalcAmountHandlers(), DOT, SpellInfo::Effects, ItemRandomSuffixEntry::Enchantment, Unit::GetAuraEffectsByType(), GetAuraType(), GetBase(), GetEffIndex(), GetId(), GetPctMods(), 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.
588{
590
591 // prepare periodics
592 switch (GetAuraType())
593 {
595 // 3 spells have no amplitude set
596 if (!m_amplitude)
598 [[fallthrough]];
612 m_isPeriodic = true;
613 break;
614 default:
615 break;
616 }
617
619
620 if (!m_isPeriodic)
621 return;
622
623 // Xinef: fix broken data in dbc
624 if (m_amplitude <= 0)
625 m_amplitude = 1000;
626
627 Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr;
628
629 // Apply casting time mods
630 if (m_amplitude)
631 {
632 // Apply periodic time mod
633 if (modOwner)
635
636 if (caster)
637 {
640 }
641 }
642
643 if (load) // aura loaded from db
644 {
648 ++m_tickNumber;
649 }
650 else // aura just created or reapplied
651 {
652 m_tickNumber = 0;
653 // reset periodic timer on aura create or on reapply when aura isn't dot
654 // possibly we should not reset periodic timers only when aura is triggered by proc
655 // or maybe there's a spell attribute somewhere
656 bool resetPeriodicTimer = create
658
659 if (resetPeriodicTimer)
660 {
661 m_periodicTimer = 0;
662 // Start periodic on next tick or at aura apply
663 if (m_amplitude)
664 {
667 else if (caster && caster->IsTotem()) // for totems only ;d
668 {
669 m_periodicTimer = 100; // make it ALMOST instant
670 if (!GetBase()->IsPassive())
671 GetBase()->SetDuration(GetBase()->GetDuration() + 100);
672 }
673 }
674 }
675 }
676}
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
@ 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:548
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition: SharedDefines.h:552
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:9627
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition: Unit.cpp:5650
bool IsTotem() const
Definition: Unit.h:1415
int32 m_amplitude
Definition: SpellAuraEffects.h:141
int32 GetDuration() const
Definition: SpellAuras.h:133
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:882
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
Definition: SpellAuras.cpp:2535
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:412

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 ( )
573{
574 // xinef: save caster depending auras with pct mods
575 if (GetBase()->GetType() == UNIT_AURA_TYPE && GetCaster())
576 {
581 }
582
583 if (GetCaster())
584 SetCritChance(CalcPeriodicCritChance(GetCaster(), (GetBase()->GetType() == UNIT_AURA_TYPE ? GetBase()->GetUnitOwner() : nullptr)));
585}
float SpellPctHealingModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition: Unit.cpp:12278
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition: Unit.cpp:11235
float CalcPeriodicCritChance(Unit const *caster, Unit const *target) const
Definition: SpellAuraEffects.cpp:1038
float m_pctMods
Definition: SpellAuraEffects.h:129
Unit * GetCaster() const
Definition: SpellAuraEffects.h:47
void SetCritChance(float crit)
Definition: SpellAuraEffects.h:108

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 ( )
679{
680 switch (GetAuraType())
681 {
684 if (!m_spellmod)
685 {
688
689 m_spellmod->type = SpellModType(GetAuraType()); // SpellModType value == spell aura types
691 m_spellmod->mask = GetSpellInfo()->Effects[GetEffIndex()].SpellClassMask;
693 }
695 break;
696 default:
697 break;
698 }
700}
SpellModType
Definition: Player.h:93
@ SPELL_AURA_ADD_PCT_MODIFIER
Definition: SpellAuraDefines.h:171
@ SPELL_AURA_ADD_FLAT_MODIFIER
Definition: SpellAuraDefines.h:170
SpellModOp
Definition: SpellDefines.h:76
Definition: Player.h:182
int16 charges
Definition: Player.h:186
SpellModOp op
Definition: Player.h:184
SpellModType type
Definition: Player.h:185
int32 value
Definition: Player.h:187
uint32 spellId
Definition: Player.h:189
flag96 mask
Definition: Player.h:188
int32 GetAmount() const
Definition: SpellAuraEffects.h:63
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
Definition: SpellAuras.cpp:2549
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 
)
703{
704 // Reapply if amount change
705 uint8 handleMask = 0;
706 if (newAmount != GetAmount())
708 if (onStackOrReapply)
709 handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
710
711 if (!handleMask)
712 return;
713
714 std::list<AuraApplication*> effectApplications;
715 GetApplicationList(effectApplications);
716
717 for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
718 if ((*apptItr)->HasEffect(GetEffIndex()))
719 HandleEffect(*apptItr, handleMask, false);
720
721 if (handleMask & AURA_EFFECT_HANDLE_CHANGE_AMOUNT)
722 {
723 if (!mark)
724 m_amount = newAmount;
725 else
726 SetAmount(newAmount);
728 }
729
730 for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
731 if ((*apptItr)->HasEffect(GetEffIndex()))
732 HandleEffect(*apptItr, handleMask, true);
733}
@ 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:735
void SetAmount(int32 amount)
Definition: SpellAuraEffects.h:65

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(), Unit::RemoveMovementImpairingAuras(), and Aura::SetStackAmount().

◆ CleanupTriggeredSpells()

void AuraEffect::CleanupTriggeredSpells ( Unit target)
Todo:
: is there a spell flag, which can solve this in a more sophisticated way?
1180{
1181 uint32 tSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1182 if (!tSpellId)
1183 return;
1184
1185 SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
1186 if (!tProto)
1187 return;
1188
1189 if (tProto->GetDuration() != -1)
1190 return;
1191
1192 // needed for spell 43680, maybe others
1196 return;
1197
1198 target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
1199}
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4835
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:48
Definition: SpellInfo.h:314
int32 GetDuration() const
Definition: SpellInfo.cpp:2321

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
63{ 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::spell_the_lich_king_necrotic_plague_AuraScript::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_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_hallows_end_base_fire::HandleEffectPeriodicUpdate(), spell_gen_burn_brutallus::HandleEffectPeriodicUpdate(), spell_sha_item_t10_elemental_2p_bonus::HandleEffectProc(), 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::spell_ragin_flames_inferno_AuraScript::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::spell_oculus_temporal_rift_AuraScript::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_hun_lock_and_load::HandleProcs(), HandleProcTriggerDamageAuraProc(), Unit::HandleProcTriggerSpell(), HandleProcTriggerSpellWithValueAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), HandleRangedAmmoHaste(), spell_warl_haunt_aura::HandleRemove(), spell_warl_glyph_of_felguard::HandleRemove(), HandleShieldBlockValue(), spell_hun_sniper_training::HandleUpdatePeriodic(), Aura::IsAuraStronger(), spell_valanar_kinetic_bomb_absorb::spell_valanar_kinetic_bomb_absorb_AuraScript::OnAbsorb(), spell_alar_ember_blast_death::spell_alar_ember_blast_death_AuraScript::OnApply(), spell_the_lich_king_necrotic_plague_jump::spell_the_lich_king_necrotic_plague_AuraScript::OnDispel(), spell_kalecgos_curse_of_boundless_agony::spell_kalecgos_curse_of_boundless_agony_AuraScript::OnPeriodic(), spell_xt002_gravity_bomb_aura::spell_xt002_gravity_bomb_aura_AuraScript::OnPeriodic(), spell_lurker_below_spout::spell_lurker_below_spout_AuraScript::OnPeriodic(), spell_blood_queen_essence_of_the_blood_queen::spell_blood_queen_essence_of_the_blood_queen_AuraScript::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::spell_sindragosa_instability_AuraScript::OnRemove(), spell_the_lich_king_necrotic_plague_jump::spell_the_lich_king_necrotic_plague_AuraScript::OnRemove(), spell_shield_of_runes::spell_shield_of_runes_AuraScript::OnRemove(), spell_xt002_gravity_bomb_aura::spell_xt002_gravity_bomb_aura_AuraScript::OnRemove(), spell_xt002_searing_light_spawn_life_spark::spell_xt002_searing_light_spawn_life_spark_AuraScript::OnRemove(), spell_ulduar_stone_grip::spell_ulduar_stone_grip_AuraScript::OnRemoveStun(), spell_the_lich_king_infest::spell_the_lich_king_infest_AuraScript::OnUpdate(), spell_karazhan_overload::spell_karazhan_overload_AuraScript::PeriodicTick(), spell_icc_yh_volley::spell_icc_yh_volley_AuraScript::PrepareAuraScript(), spell_serpentshrine_cavern_infection::spell_serpentshrine_cavern_infection_AuraScript::PrepareAuraScript(), Unit::ProcDamageAndSpellFor(), Unit::RemoveAurasDueToSpellBySteal(), ArenaSpectator::ShouldSendAura(), spell_mother_shahraz_fatal_attraction_aura::spell_mother_shahraz_fatal_attraction_aura_AuraScript::Update(), spell_black_temple_shadow_inferno::spell_black_temple_shadow_inferno_AuraScript::Update(), spell_black_temple_spell_absorption::spell_black_temple_spell_absorption_AuraScript::Update(), Player::UpdateAttackPowerAndDamage(), UpdatePeriodic(), and SpellInfo::ValidateAttribute6SpellDamageMods().

◆ GetAmplitude()

int32 AuraEffect::GetAmplitude ( ) const
inline

◆ 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
114{ 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::spell_festergut_blighted_spores_AuraScript::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(), HandleObsModPowerAuraTick(), Unit::HandleOverrideClassScriptAuraProc(), HandlePeriodicDamageAurasTick(), HandlePeriodicEnergizeAuraTick(), HandlePeriodicHealAurasTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicManaLeechAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandleProc(), Unit::HandleProcTriggerSpell(), HandleRaidProcFromChargeAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), spell_hor_shared_suffering::spell_hor_shared_sufferingAuraScript::OnRemove(), PeriodicTick(), Spell::prepare(), spell_pos_glacial_strike::spell_pos_glacial_strikeAuraScript::PrepareAuraScript(), Unit::ProcDamageAndSpellFor(), Player::RestoreBaseRune(), Update(), UpdatePeriodic(), and SpellInfo::ValidateAttribute6SpellDamageMods().

◆ GetBaseAmount()

◆ GetCaster()

◆ GetCasterGUID()

◆ GetCasterLevel()

uint8 AuraEffect::GetCasterLevel ( ) const
inline

◆ GetCritChance()

float AuraEffect::GetCritChance ( ) const
inline

◆ 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_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::spell_muru_summon_blood_elves_periodic_AuraScript::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::spell_oculus_rider_auraAuraScript::HandleOnEffectApply(), spell_transitus_shield_beam::spell_transitus_shield_beam_AuraScript::HandleOnEffectApply(), spell_kiljaeden_shadow_spike::spell_kiljaeden_shadow_spike_AuraScript::HandlePeriodic(), spell_kiljaeden_armageddon_periodic::spell_kiljaeden_armageddon_periodic_AuraScript::HandlePeriodic(), spell_halion_twilight_cutter_periodic::spell_halion_twilight_cutter_periodic_AuraScript::HandlePeriodic(), spell_oculus_ride_ruby_emerald_amber_drake_que::spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript::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_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::spell_putricide_mutated_plague_AuraScript::HandleTriggerSpell(), spell_hun_sniper_training::HandleUpdatePeriodic(), TriggeredByAuraSpellData::Init(), spell_hadronox_summon_periodic::spell_hadronox_summon_periodic_AuraScript::OnApply(), spell_gruul_ground_slam_trigger::OnApply(), spell_kalecgos_curse_of_boundless_agony::spell_kalecgos_curse_of_boundless_agony_AuraScript::OnPeriodic(), spell_the_lich_king_vile_spirits::spell_the_lich_king_vile_spirits_AuraScript::OnPeriodic(), spell_tar_blaze::spell_tar_blaze_AuraScript::OnPeriodic(), spell_thorim_lightning_pillar_P2::spell_thorim_lightning_pillar_P2_AuraScript::OnPeriodic(), spell_karathress_power_of_caribdis::spell_karathress_power_of_caribdis_AuraScript::OnPeriodic(), spell_leotheras_demon_link::spell_leotheras_demon_link_AuraScript::OnPeriodic(), spell_gen_periodic_knock_away::OnPeriodic(), spell_broggok_poison_cloud::PeriodicTick(), spell_mother_shahraz_beam_periodic::spell_mother_shahraz_beam_periodic_AuraScript::Update(), spell_mother_shahraz_saber_lash::spell_mother_shahraz_saber_lash_AuraScript::Update(), spell_illidari_council_deadly_strike::spell_illidari_council_deadly_strike_AuraScript::Update(), spell_black_temple_charge_rage::spell_black_temple_charge_rage_AuraScript::Update(), spell_black_temple_shadow_inferno::spell_black_temple_shadow_inferno_AuraScript::Update(), spell_black_temple_spell_absorption::spell_black_temple_spell_absorption_AuraScript::Update(), Update(), and Player::UpdateAttackPowerAndDamage().

◆ GetForcedAmount()

int32 AuraEffect::GetForcedAmount ( ) const
inline
64{ return m_amount; }

References m_amount.

◆ GetId()

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

References SpellInfo::Id, and m_spellInfo.

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

◆ GetMiscValue()

int32 AuraEffect::GetMiscValue ( ) const
443{
444 return m_spellInfo->Effects[m_effIndex].MiscValue;
445}

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

Referenced by Player::_ApplyWeaponDependentAuraDamageMod(), AuraApplication::_HandleEffect(), ApplySpellMod(), Unit::CalcAbsorbResist(), CalculateSpellMod(), Unit::GetMaxPositiveAuraModifierByMiscMask(), HandleAuraConvertRune(), HandleAuraDummy(), HandleAuraModBaseResistancePCT(), HandleAuraModDispelImmunity(), HandleAuraModDmgImmunity(), HandleAuraModEffectImmunity(), HandleAuraModFaction(), HandleAuraModIncreaseEnergy(), HandleAuraModIncreaseEnergyPercent(), HandleAuraModResistance(), HandleAuraModResistanceExclusive(), HandleAuraModResistenceOfStatPercent(), HandleAuraModSchoolImmunity(), HandleAuraModShapeshift(), HandleAuraModSkill(), HandleAuraModStat(), HandleAuraModStateImmunity(), HandleAuraMounted(), HandleAuraOverrideSpells(), HandleAuraSetVehicle(), HandleAuraTrackCreatures(), HandleAuraTrackResources(), HandleAuraTransform(), HandleDetectAmore(), spell_warl_improved_demonic_tactics::HandleEffectCalcSpellMod(), spell_warr_glyph_of_sunder_armor::HandleEffectCalcSpellMod(), HandleForceReaction(), HandleModBaseResistance(), HandleModDamageDone(), HandleModDamagePercentDone(), HandleModInvisibility(), HandleModInvisibilityDetect(), HandleModMechanicImmunity(), HandleModPercentStat(), HandleModPowerCost(), HandleModPowerCostPCT(), HandleModPowerRegen(), HandleModRating(), HandleModRatingFromStat(), HandleModResistancePercent(), HandleModSpellCritChanceShool(), HandleModStateImmunityMask(), HandleModStealth(), HandleModStealthDetect(), HandleModStealthLevel(), HandleModTargetResistance(), HandleModThreat(), HandleModTotalPercentStat(), HandleObsModPowerAuraTick(), 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(), spell_alar_ember_blast_death::spell_alar_ember_blast_death_AuraScript::OnApply(), Unit::ProcDamageAndSpellFor(), and Unit::SendPeriodicAuraLog().

◆ GetMiscValueB()

int32 AuraEffect::GetMiscValueB ( ) const

◆ GetOldAmount()

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

References m_oldAmount.

Referenced by Unit::CastDelayedSpellWithPeriodicAmount().

◆ GetPctMods()

float AuraEffect::GetPctMods ( ) const
inline
111{ return m_pctMods; }

References m_pctMods.

Referenced by CalculateAmount().

◆ GetPeriodicTimer()

◆ 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(), HandleModDamageDone(), HandleModDamagePercentDone(), HandleModMechanicImmunity(), HandleModStateImmunityMask(), HandleObsModPowerAuraTick(), spell_putricide_unbound_plague_dmg::spell_putricide_unbound_plague_dmg_AuraScript::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(), Acore::AbsorbAuraOrderPred::operator()(), spell_dragonblight_corrosive_spit::PeriodicTick(), spell_optic_link::spell_optic_linkAuraScript::PrepareAuraScript(), 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
86{ return m_tickNumber; }

References m_tickNumber.

Referenced by Unit::CastDelayedSpellWithPeriodicAmount(), spell_frost_tomb::spell_frost_tombAuraScript::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::spell_putricide_unbound_plague_dmg_AuraScript::HandlePeriodic(), spell_shadow_bolt_whirl::HandlePeriodic(), HandlePeriodicHealAurasTick(), spell_bronjahm_soulstorm_channel_ooc::spell_bronjahm_soulstorm_channel_ooc_AuraScript::HandlePeriodicTick(), spell_bronjahm_soulstorm_visual::spell_bronjahm_soulstorm_visual_AuraScript::HandlePeriodicTick(), spell_wailing_souls_periodic::spell_wailing_souls_periodic_AuraScript::HandlePeriodicTick(), spell_exploding_orb_auto_grow::spell_exploding_orb_auto_grow_AuraScript::HandlePeriodicTick(), spell_item_direbrew_remote_aura::HandlePeriodicTick(), HandlePeriodicTriggerSpellAuraTick(), spell_igb_rocket_pack::spell_igb_rocket_pack_AuraScript::HandleRemove(), TriggeredByAuraSpellData::Init(), spell_kalecgos_curse_of_boundless_agony::spell_kalecgos_curse_of_boundless_agony_AuraScript::OnPeriodic(), spell_muru_darkness::spell_muru_darkness_AuraScript::OnPeriodic(), spell_the_lich_king_vile_spirits::spell_the_lich_king_vile_spirits_AuraScript::OnPeriodic(), spell_the_lich_king_soul_rip::spell_the_lich_king_soul_rip_AuraScript::OnPeriodic(), spell_assembly_rune_of_summoning::spell_assembly_rune_of_summoning_AuraScript::OnPeriodic(), spell_illidan_demon_transform2::spell_illidan_demon_transform2_AuraScript::OnPeriodic(), spell_the_lich_king_infest::spell_the_lich_king_infest_AuraScript::OnUpdate(), spell_karazhan_overload::spell_karazhan_overload_AuraScript::PeriodicTick(), spell_geddon_inferno::spell_geddon_inferno_AuraScript::PeriodicTick(), spell_trollgore_corpse_explode::spell_trollgore_corpse_explode_AuraScript::PeriodicTick(), spell_blood_queen_pact_of_the_darkfallen_dmg::spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript::PeriodicTick(), spell_igb_explosion_main::spell_igb_explosion_main_AuraScript::PeriodicTick(), spell_dreamwalker_mana_void::spell_dreamwalker_mana_void_AuraScript::PeriodicTick(), spell_broggok_poison_cloud::PeriodicTick(), spell_hodir_biting_cold_main_aura::spell_hodir_biting_cold_main_aura_AuraScript::PrepareAuraScript(), spell_hodir_flash_freeze::spell_hodir_flash_freeze_AuraScript::PrepareAuraScript(), spell_icc_yh_volley::spell_icc_yh_volley_AuraScript::PrepareAuraScript(), spell_ignis_scorch::spell_ignis_scorch_AuraScript::PrepareAuraScript(), spell_mimiron_rapid_burst::spell_mimiron_rapid_burst_AuraScript::PrepareAuraScript(), spell_optic_link::spell_optic_linkAuraScript::PrepareAuraScript(), spell_pos_blight::spell_pos_blightAuraScript::PrepareAuraScript(), spell_gen_holiday_buff_food::TriggerFoodBuff(), spell_mother_shahraz_random_periodic::spell_mother_shahraz_random_periodic_AuraScript::Update(), and spell_mother_shahraz_fatal_attraction_aura::spell_mother_shahraz_fatal_attraction_aura_AuraScript::Update().

◆ GetTotalTicks()

◆ HandleArenaPreparation()

void AuraEffect::HandleArenaPreparation ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4956{
4957 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4958 return;
4959
4960 Unit* target = aurApp->GetTarget();
4961
4962 if (apply)
4964 else
4965 {
4966 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
4967 if (target->HasAuraType(GetAuraType()))
4968 return;
4970 }
4971}
@ UNIT_FLAG_PREPARATION
Definition: Unit.h:453
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
Definition: Unit.h:1290
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:5617
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:1481
ObjectGuid GetTarget() const
Definition: Unit.h:2433
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:1482

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
2906{
2908 return;
2909
2910 Unit* target = aurApp->GetTarget();
2911
2912 if (!apply)
2913 {
2914 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2916 return;
2917 }
2918
2919 target->SetCanFly(apply);
2920
2921 if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
2922 target->GetMotionMaster()->MoveFall();
2923}
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
Definition: SpellAuraDefines.h:270
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK
Definition: SpellAuraDefines.h:48
MotionMaster * GetMotionMaster()
Definition: Unit.h:2262
bool IsLevitating() const
Definition: Unit.h:2378
virtual bool SetCanFly(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20856
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
Definition: MotionMaster.cpp:545

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

◆ HandleAuraAllowOnlyAbility()

void AuraEffect::HandleAuraAllowOnlyAbility ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2678{
2680 return;
2681
2682 Unit* target = aurApp->GetTarget();
2683
2684 if (target->GetTypeId() == TYPEID_PLAYER)
2685 {
2686 if (apply)
2688 else
2689 {
2690 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2692 return;
2694 }
2695 }
2696}
@ PLAYER_ALLOW_ONLY_ABILITY
Definition: Player.h:498
@ SPELL_AURA_ALLOW_ONLY_ABILITY
Definition: SpellAuraDefines.h:326
void SetPlayerFlag(PlayerFlags flags)
Definition: Player.h:1091
void RemovePlayerFlag(PlayerFlags flags)
Definition: Player.h:1092

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

◆ HandleAuraCloneCaster()

void AuraEffect::HandleAuraCloneCaster ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2374{
2376 return;
2377
2378 Unit* target = aurApp->GetTarget();
2379
2380 if (apply)
2381 {
2382 Unit* caster = GetCaster();
2383 if (!caster || caster == target)
2384 return;
2385
2386 // What must be cloned? at least display and scale
2387 target->SetDisplayId(caster->GetDisplayId());
2389 }
2390 else
2391 {
2392 target->SetDisplayId(target->GetNativeDisplayId());
2394 }
2395}
@ UNIT_FLAG2_MIRROR_IMAGE
Definition: Unit.h:492
void SetUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:1487
uint32 GetDisplayId() const
Definition: Unit.h:2168
uint32 GetNativeDisplayId() const
Definition: Unit.h:2170
void RemoveUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:1488
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:16936

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

3250{
3252 return;
3253
3254 Unit* target = aurApp->GetTarget();
3255
3256 if (!target->IsVehicle())
3257 return;
3258
3259 Unit* caster = GetCaster();
3260
3261 if (!caster || caster == target)
3262 return;
3263
3264 if (apply)
3265 {
3266 // Currently spells that have base points 0 and DieSides 0 = "0/0" exception are pushed to -1,
3267 // however the idea of 0/0 is to ingore flag VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT and -1 checks for it,
3268 // so this break such spells or most of them.
3269 // Current formula about m_amount: effect base points + dieside - 1
3270 // TO DO: Reasearch more about 0/0 and fix it.
3271 caster->_EnterVehicle(target->GetVehicleKit(), m_amount - 1, aurApp);
3272 }
3273 else
3274 {
3275 if (GetId() == 53111) // Devour Humanoid
3276 {
3277 Unit::Kill(target, caster);
3278 if (caster->GetTypeId() == TYPEID_UNIT)
3279 caster->ToCreature()->RemoveCorpse();
3280 }
3281
3282 caster->_ExitVehicle();
3283 // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
3284 caster->RemoveAurasDueToSpell(GetId());
3285 }
3286}
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK
Definition: SpellAuraDefines.h:49
void RemoveCorpse(bool setSpawnTime=true, bool skipVisibility=false)
Definition: Creature.cpp:347
Creature * ToCreature()
Definition: Object.h:197
bool IsVehicle() const
Definition: Unit.h:1416
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:17862
void _ExitVehicle(Position const *exitPosition=nullptr)
Definition: Unit.cpp:19934
void _EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
Definition: Unit.cpp:19814
Vehicle * GetVehicleKit() const
Definition: Unit.h:2353

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

◆ HandleAuraConvertRune()

void AuraEffect::HandleAuraConvertRune ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5629{
5630 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5631 return;
5632
5633 Unit* target = aurApp->GetTarget();
5634
5635 if (target->GetTypeId() != TYPEID_PLAYER)
5636 return;
5637
5638 Player* player = target->ToPlayer();
5639
5640 if (player->getClass() != CLASS_DEATH_KNIGHT)
5641 return;
5642
5643 uint32 runes = m_amount;
5644 // convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb
5645 if (apply)
5646 {
5647 for (uint32 i = 0; i < MAX_RUNES && runes; ++i)
5648 {
5649 if (GetMiscValue() != player->GetCurrentRune(i))
5650 continue;
5651 if (!player->GetRuneCooldown(i))
5652 {
5653 player->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
5654 --runes;
5655 }
5656 }
5657 }
5658 else
5659 player->RemoveRunesByAuraEffect(this);
5660}
RuneType
Definition: Player.h:409
#define MAX_RUNES
Definition: Player.h:399
@ CLASS_DEATH_KNIGHT
Definition: SharedDefines.h:118
void RemoveRunesByAuraEffect(AuraEffect const *aura)
Definition: Player.cpp:13277
uint32 GetRuneCooldown(uint8 index) const
Definition: Player.h:2458
void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const *aura)
Definition: Player.h:2469
RuneType GetCurrentRune(uint8 index) const
Definition: Player.h:2457
uint8 getClass() const
Definition: Unit.h:1426
int32 GetMiscValueB() const
Definition: SpellAuraEffects.cpp:437

References Player::AddRuneByAuraEffect(), AURA_EFFECT_HANDLE_REAL, CLASS_DEATH_KNIGHT, Unit::getClass(), Player::GetCurrentRune(), GetMiscValue(), GetMiscValueB(), Player::GetRuneCooldown(), AuraApplication::GetTarget(), Object::GetTypeId(), m_amount, MAX_RUNES, Player::RemoveRunesByAuraEffect(), Object::ToPlayer(), and TYPEID_PLAYER.

◆ HandleAuraDummy()

void AuraEffect::HandleAuraDummy ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5014{
5016 return;
5017
5018 Unit* target = aurApp->GetTarget();
5019
5020 Unit* caster = GetCaster();
5021
5022 if (mode & AURA_EFFECT_HANDLE_REAL)
5023 {
5024 // pet auras
5025 if (PetAura const* petSpell = sSpellMgr->GetPetAura(GetId(), m_effIndex))
5026 {
5027 if (apply)
5028 target->AddPetAura(petSpell);
5029 else
5030 target->RemovePetAura(petSpell);
5031 }
5032 }
5033
5035 {
5036 // AT APPLY
5037 if (apply)
5038 {
5039 switch (GetId())
5040 {
5041 case 1515: // Tame beast
5042 // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
5043 if (caster && target->CanHaveThreatList())
5044 target->AddThreat(caster, 10.0f);
5045 break;
5046 case 13139: // net-o-matic
5047 // root to self part of (root_target->charge->root_self sequence
5048 if (caster)
5049 caster->CastSpell(caster, 13138, true, nullptr, this);
5050 break;
5051 case 34026: // kill command
5052 {
5053 Unit* pet = target->GetGuardianPet();
5054 if (!pet)
5055 break;
5056
5057 target->CastSpell(target, 34027, true, nullptr, this);
5058
5059 // set 3 stacks and 3 charges (to make all auras not disappear at once)
5060 Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
5061 Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
5062 if (owner_aura)
5063 {
5064 owner_aura->SetCharges(0);
5065 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5066 if (pet_aura)
5067 {
5068 pet_aura->SetCharges(0);
5069 pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5070 }
5071 }
5072 break;
5073 }
5074 case 37096: // Blood Elf Illusion
5075 {
5076 if (caster)
5077 {
5078 switch (caster->getGender())
5079 {
5080 case GENDER_FEMALE:
5081 caster->CastSpell(target, 37095, true, nullptr, this); // Blood Elf Disguise
5082 break;
5083 case GENDER_MALE:
5084 caster->CastSpell(target, 37093, true, nullptr, this);
5085 break;
5086 default:
5087 break;
5088 }
5089 }
5090 break;
5091 }
5092 case 55198: // Tidal Force
5093 {
5094 target->CastSpell(target, 55166, true);
5095 if (Aura* owner_aura = target->GetAura(55166))
5096 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5097 return;
5098 }
5099 case 39850: // Rocket Blast
5100 if (roll_chance_i(20)) // backfire stun
5101 target->CastSpell(target, 51581, true, nullptr, this);
5102 break;
5103 case 43873: // Headless Horseman Laugh
5104 target->PlayDistanceSound(11965);
5105 break;
5106 case 46354: // Blood Elf Illusion
5107 if (caster)
5108 {
5109 switch (caster->getGender())
5110 {
5111 case GENDER_FEMALE:
5112 caster->CastSpell(target, 46356, true, nullptr, this);
5113 break;
5114 case GENDER_MALE:
5115 caster->CastSpell(target, 46355, true, nullptr, this);
5116 break;
5117 }
5118 }
5119 break;
5120 case 46361: // Reinforced Net
5121 if (caster)
5122 target->GetMotionMaster()->MoveFall();
5123 break;
5124 case 46699: // Requires No Ammo
5125 if (target->GetTypeId() == TYPEID_PLAYER)
5126 target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
5127 break;
5128 case 71563:
5129 {
5130 if (Aura* newAura = target->AddAura(71564, target))
5131 newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount);
5132 return;
5133 }
5134 }
5135 }
5136 // AT REMOVE
5137 else
5138 {
5139 if ((GetSpellInfo()->IsQuestTame()) && caster && caster->IsAlive() && target->IsAlive() && aurApp->GetRemoveMode() != AURA_REMOVE_BY_CANCEL)
5140 {
5141 uint32 finalSpelId = 0;
5142 switch (GetId())
5143 {
5144 case 19548:
5145 finalSpelId = 19597;
5146 break;
5147 case 19674:
5148 finalSpelId = 19677;
5149 break;
5150 case 19687:
5151 finalSpelId = 19676;
5152 break;
5153 case 19688:
5154 finalSpelId = 19678;
5155 break;
5156 case 19689:
5157 finalSpelId = 19679;
5158 break;
5159 case 19692:
5160 finalSpelId = 19680;
5161 break;
5162 case 19693:
5163 finalSpelId = 19684;
5164 break;
5165 case 19694:
5166 finalSpelId = 19681;
5167 break;
5168 case 19696:
5169 finalSpelId = 19682;
5170 break;
5171 case 19697:
5172 finalSpelId = 19683;
5173 break;
5174 case 19699:
5175 finalSpelId = 19685;
5176 break;
5177 case 19700:
5178 finalSpelId = 19686;
5179 break;
5180 case 30646:
5181 finalSpelId = 30647;
5182 break;
5183 case 30653:
5184 finalSpelId = 30648;
5185 break;
5186 case 30654:
5187 finalSpelId = 30652;
5188 break;
5189 case 30099:
5190 finalSpelId = 30100;
5191 break;
5192 case 30102:
5193 finalSpelId = 30103;
5194 break;
5195 case 30105:
5196 finalSpelId = 30104;
5197 break;
5198 }
5199
5200 if (finalSpelId)
5201 caster->CastSpell(target, finalSpelId, true, nullptr, this);
5202 }
5203
5205 {
5207 switch (GetId())
5208 {
5209 case 2584: // Waiting to Resurrect
5210 // Waiting to resurrect spell cancel, we must remove player from resurrect queue
5211 if (target->GetTypeId() == TYPEID_PLAYER)
5212 {
5213 if (Battleground* bg = target->ToPlayer()->GetBattleground())
5214 bg->RemovePlayerFromResurrectQueue(target->ToPlayer());
5215 if(Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()))
5216 bf->RemovePlayerFromResurrectQueue(target->GetGUID());
5217 }
5218 break;
5219 case 43681: // Inactive
5220 {
5221 if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
5222 return;
5223
5224 if (target->GetMap()->IsBattleground())
5225 target->ToPlayer()->LeaveBattleground();
5226 break;
5227 }
5228 case 52172: // Coyote Spirit Despawn Aura
5229 case 60244: // Blood Parrot Despawn Aura
5230 target->CastSpell((Unit*)nullptr, GetAmount(), true, nullptr, this);
5231 break;
5232 // Halls of Lightning, Arc Lightning
5233 case 52921:
5234 {
5235 if( aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE )
5236 return;
5237
5238 Player* player = nullptr;
5239 Acore::AnyPlayerInObjectRangeCheck checker(target, 10.0f);
5240 Acore::PlayerSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(target, player, checker);
5241 Cell::VisitWorldObjects(target, searcher, 10.0f);
5242
5243 if( player && player->GetGUID() != target->GetGUID() )
5244 target->CastSpell(player, 52921, true);
5245
5246 return;
5247 }
5248 case 58600: // Restricted Flight Area
5249 case 58730: // Restricted Flight Area
5250 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
5251 target->CastSpell(target, 58601, true);
5252 break;
5253 case 46374: // quest The Power of the Elements (11893)
5254 {
5255 if (target->isDead() && GetBase() && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == 24601)
5256 {
5257 auto caster2 = GetBase()->GetCaster();
5258 if (caster2 && caster2->GetTypeId() == TYPEID_PLAYER)
5259 {
5260 caster2->ToPlayer()->KilledMonsterCredit(25987);
5261 }
5262 }
5263 return;
5264 }
5265 }
5266 break;
5267 default:
5268 break;
5269 }
5270 }
5271 }
5272
5273 // AT APPLY & REMOVE
5274
5276 {
5278 {
5279 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5280 break;
5281 switch (GetId())
5282 {
5283 // Recently Bandaged
5284 case 11196:
5286 break;
5287 // Unstable Power
5288 case 24658:
5289 {
5290 uint32 spellId = 24659;
5291 if (apply && caster)
5292 {
5293 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
5294
5295 for (uint32 i = 0; i < spell->StackAmount; ++i)
5296 caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID());
5297 break;
5298 }
5299 target->RemoveAurasDueToSpell(spellId);
5300 break;
5301 }
5302 // Restless Strength
5303 case 24661:
5304 {
5305 uint32 spellId = 24662;
5306 if (apply && caster)
5307 {
5308 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
5309 for (uint32 i = 0; i < spell->StackAmount; ++i)
5310 caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID());
5311 break;
5312 }
5313 target->RemoveAurasDueToSpell(spellId);
5314 break;
5315 }
5316 // Tag Murloc
5317 case 30877:
5318 {
5319 // Tag/untag Blacksilt Scout
5320 target->SetEntry(apply ? 17654 : 17326);
5321 break;
5322 }
5323 case 57819: // Argent Champion
5324 case 57820: // Ebon Champion
5325 case 57821: // Champion of the Kirin Tor
5326 case 57822: // Wyrmrest Champion
5327 {
5328 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5329 break;
5330
5331 uint32 FactionID = 0;
5332
5333 if (apply)
5334 {
5335 switch (m_spellInfo->Id)
5336 {
5337 case 57819:
5338 FactionID = 1106;
5339 break; // Argent Crusade
5340 case 57820:
5341 FactionID = 1098;
5342 break; // Knights of the Ebon Blade
5343 case 57821:
5344 FactionID = 1090;
5345 break; // Kirin Tor
5346 case 57822:
5347 FactionID = 1091;
5348 break; // The Wyrmrest Accord
5349 }
5350 }
5351 caster->ToPlayer()->SetChampioningFaction(FactionID);
5352 break;
5353 }
5354 // LK Intro VO (1)
5355 case 58204:
5356 if (target->GetTypeId() == TYPEID_PLAYER)
5357 {
5358 // Play part 1
5359 if (apply)
5360 target->PlayDirectSound(14970, target->ToPlayer());
5361 // continue in 58205
5362 else
5363 target->CastSpell(target, 58205, true);
5364 }
5365 break;
5366 // LK Intro VO (2)
5367 case 58205:
5368 if (target->GetTypeId() == TYPEID_PLAYER)
5369 {
5370 // Play part 2
5371 if (apply)
5372 target->PlayDirectSound(14971, target->ToPlayer());
5373 // Play part 3
5374 else
5375 target->PlayDirectSound(14972, target->ToPlayer());
5376 }
5377 break;
5378 case 62061: // Festive Holiday Mount
5379 if (target->HasAuraType(SPELL_AURA_MOUNTED))
5380 {
5381 uint32 creatureEntry = 0;
5382 if (apply)
5383 {
5385 creatureEntry = 24906;
5386 else
5387 creatureEntry = 15665;
5388 }
5389 else
5390 creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
5391
5392 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
5393 {
5394 uint32 displayID = ObjectMgr::ChooseDisplayId(creatureInfo);
5395 sObjectMgr->GetCreatureModelRandomGender(&displayID);
5396
5397 target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayID);
5398 }
5399 }
5400 break;
5401 case FRESH_BREWFEST_HOPS: // Festive Brewfest Mount
5403 {
5404 uint32 creatureEntry = 0;
5405
5406 if (apply)
5407 {
5408 if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
5409 {
5410 creatureEntry = GREAT_BREWFEST_KODO;
5411 }
5412 else
5413 {
5414 creatureEntry = BREWFEST_KODO;
5415 }
5416 }
5417 else
5418 {
5419 creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
5420 }
5421
5422 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
5423 {
5424 uint32 displayID = ObjectMgr::ChooseDisplayId(creatureInfo);
5425 sObjectMgr->GetCreatureModelRandomGender(&displayID);
5426
5427 target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayID);
5428 }
5429 }
5430 break;
5431 }
5432
5433 break;
5434 }
5435 case SPELLFAMILY_MAGE:
5436 {
5437 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5438 //break;
5439 break;
5440 }
5441 case SPELLFAMILY_PRIEST:
5442 {
5443 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5444 //break;
5445 break;
5446 }
5447 case SPELLFAMILY_DRUID:
5448 {
5449 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5450 // break;
5451 break;
5452 }
5453 case SPELLFAMILY_SHAMAN:
5454 {
5455 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5456 // break;
5457 break;
5458 }
5459 }
5460}
bool roll_chance_i(int chance)
Definition: Random.h:59
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
@ UNIT_FIELD_MOUNTDISPLAYID
Definition: UpdateFields.h:126
@ MOVE_RUN
Definition: Unit.h:379
#define sObjectMgr
Definition: ObjectMgr.h:1640
@ 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:60
@ GENDER_FEMALE
Definition: SharedDefines.h:61
@ IMMUNITY_MECHANIC
Definition: SharedDefines.h:1371
@ SPELLFAMILY_PRIEST
Definition: SharedDefines.h:3506
@ SPELLFAMILY_MAGE
Definition: SharedDefines.h:3503
@ SPELLFAMILY_GENERIC
Definition: SharedDefines.h:3500
@ SPELLFAMILY_SHAMAN
Definition: SharedDefines.h:3511
@ SPELLFAMILY_DRUID
Definition: SharedDefines.h:3507
Definition: Battlefield.h:205
Definition: Battleground.h:293
Definition: CreatureData.h:176
uint32 GetEntry() const
Definition: Object.h:109
void SetEntry(uint32 entry)
Definition: Object.h:110
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
Map * GetMap() const
Definition: Object.h:517
void PlayDirectSound(uint32 sound_id, Player *target=nullptr)
Definition: Object.cpp:2853
void PlayDistanceSound(uint32 sound_id, Player *target=nullptr)
Definition: Object.cpp:2845
uint32 GetZoneId() const
Definition: Object.cpp:3075
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition: PlayerQuest.cpp:1911
Battleground * GetBattleground(bool create=false) const
Definition: Player.cpp:12097
void RemoveAmmo()
Definition: PlayerStorage.cpp:2542
void SetChampioningFaction(uint32 faction)
Definition: Player.h:2498
void LeaveBattleground(Battleground *bg=nullptr)
Definition: Player.cpp:11216
uint8 getGender() const
Definition: Unit.h:1428
void RemovePetAura(PetAura const *petSpell)
Definition: Unit.cpp:17469
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5499
bool CanHaveThreatList() const
Definition: Unit.cpp:14509
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition: Unit.cpp:13300
void AddPetAura(PetAura const *petSpell)
Definition: Unit.cpp:17457
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: Unit.cpp:14548
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:19031
bool IsAlive() const
Definition: Unit.h:1808
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:1169
float GetSpeedRate(UnitMoveType mtype) const
Definition: Unit.h:2248
Guardian * GetGuardianPet() const
Definition: Unit.cpp:10611
bool isDead() const
Definition: Unit.h:1810
static uint32 ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Definition: ObjectMgr.cpp:1717
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:193
Definition: GridNotifiers.h:507
Definition: GridNotifiers.h:1350
bool IsBattleground() const
Definition: Map.h:453
void SetStackAmount(uint8 num)
Definition: SpellAuras.cpp:1009
void SetCharges(uint8 charges)
Definition: SpellAuras.cpp:966
uint32 StackAmount
Definition: SpellInfo.h:369
uint32 SpellFamilyName
Definition: SpellInfo.h:385
Definition: SpellMgr.h:463

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(), 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(), Object::GetTypeId(), WorldObject::GetZoneId(), GREAT_BREWFEST_KODO, Unit::HasAuraType(), SpellInfo::Id, IMMUNITY_MECHANIC, Unit::IsAlive(), Map::IsBattleground(), Unit::isDead(), 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(), Object::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(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_FIELD_MOUNTDISPLAYID, and Cell::VisitWorldObjects().

◆ HandleAuraEmpathy()

void AuraEffect::HandleAuraEmpathy ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5572{
5573 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5574 return;
5575
5576 Unit* target = aurApp->GetTarget();
5577
5578 if (!apply)
5579 {
5580 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5581 if (target->HasAuraType(GetAuraType()))
5582 return;
5583 }
5584
5585 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
5587}
@ UNIT_DYNAMIC_FLAGS
Definition: UpdateFields.h:136
@ CREATURE_TYPE_BEAST
Definition: SharedDefines.h:2600
@ UNIT_DYNFLAG_SPECIALINFO
Definition: SharedDefines.h:3097
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition: Object.cpp:806
uint32 GetCreatureType() const
Definition: Unit.cpp:15074

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
2948{
2950 return;
2951
2952 Unit* target = aurApp->GetTarget();
2953
2954 if (Player* targetPlayer = target->ToPlayer())
2955 {
2956 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2957 }
2958
2959 if (!apply)
2960 {
2961 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2962 if (target->HasAuraType(GetAuraType()))
2963 return;
2964 }
2965
2966 target->SetFeatherFall(apply);
2967
2968 // start fall from current height
2969 if (!apply && target->GetTypeId() == TYPEID_PLAYER)
2970 target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ());
2971}
#define sScriptMgr
Definition: ScriptMgr.h:2702
Seconds GetGameTime()
Definition: GameTime.cpp:38
float GetPositionZ() const
Definition: Position.h:119
void SetFallInformation(uint32 time, float z)
Definition: Player.h:2285
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20896

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), GameTime::GetGameTime(), Position::GetPositionZ(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::HasAuraType(), Player::SetFallInformation(), Unit::SetFeatherFall(), sScriptMgr, Object::ToPlayer(), and TYPEID_PLAYER.

◆ HandleAuraGhost()

void AuraEffect::HandleAuraGhost ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1756{
1758 return;
1759
1760 Unit* target = aurApp->GetTarget();
1761
1762 if (target->GetTypeId() != TYPEID_PLAYER)
1763 return;
1764
1765 if (apply)
1766 {
1770 }
1771 else
1772 {
1773 if (target->HasAuraType(SPELL_AURA_GHOST))
1774 return;
1775
1779 }
1780}
@ PLAYER_FLAGS_GHOST
Definition: Player.h:479
@ SPELL_AURA_GHOST
Definition: SpellAuraDefines.h:158
@ SERVERSIDE_VISIBILITY_GHOST
Definition: SharedDefines.h:1246
@ GHOST_VISIBILITY_ALIVE
Definition: SharedDefines.h:1253
@ GHOST_VISIBILITY_GHOST
Definition: SharedDefines.h:1254
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:360
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:510
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:509

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

◆ HandleAuraHover()

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

Sets movementflags

2974{
2976 return;
2977
2978 Unit* target = aurApp->GetTarget();
2979
2980 if (Player* targetPlayer = target->ToPlayer())
2981 {
2982 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2983 }
2984
2985 if (!apply)
2986 {
2987 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2988 if (target->HasAuraType(GetAuraType()))
2989 return;
2990 }
2991
2992 target->SetHover(apply);
2993}
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20918

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
4402{
4404 return;
4405
4406 Unit* target = aurApp->GetTarget();
4407
4408 target->HandleStatModifier(UNIT_MOD_HEALTH, BASE_PCT, float(GetAmount()), apply);
4409}
@ UNIT_MOD_HEALTH
Definition: Unit.h:267
@ BASE_PCT
Definition: Unit.h:246
@ AURA_EFFECT_HANDLE_STAT
Definition: SpellAuraDefines.h:46
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:15095

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
5663{
5664 Unit* target = aurApp->GetTarget();
5665
5666 uint32 triggeredSpellId = sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->Effects[m_effIndex].TriggerSpell, target);
5667 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId);
5668 if (!triggeredSpellInfo)
5669 return;
5670
5671 if (mode & AURA_EFFECT_HANDLE_REAL)
5672 {
5673 if (apply)
5674 {
5675 Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCaster() : target;
5676
5677 if (!caster)
5678 return;
5679 // If amount avalible cast with basepoints (Crypt Fever for example)
5680 if (GetAmount())
5681 caster->CastCustomSpell(target, triggeredSpellId, &m_amount, nullptr, nullptr, true, nullptr, this);
5682 else
5683 caster->CastSpell(target, triggeredSpellId, true, nullptr, this);
5684 }
5685 else
5686 {
5687 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
5688 target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
5689 }
5690 }
5691 else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
5692 {
5693 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
5694 // change the stack amount to be equal to stack amount of our aura
5695 if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
5696 triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
5697 }
5698}
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4708
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:1226
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell, uint8 effIndex=MAX_SPELL_EFFECTS) const
Definition: SpellInfo.cpp:1022

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
4704{
4706 return;
4707
4708 Unit* target = aurApp->GetTarget();
4709
4711}
@ UNIT_MOD_ATTACK_POWER
Definition: Unit.h:282
@ TOTAL_VALUE
Definition: Unit.h:247

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
4769{
4771 return;
4772
4773 Unit* target = aurApp->GetTarget();
4774
4775 // Recalculate bonus
4776 if (target->GetTypeId() == TYPEID_PLAYER)
4777 target->ToPlayer()->UpdateAttackPowerAndDamage(false);
4778}
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition: StatSystem.cpp:330

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::GetTypeId(), Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateAttackPowerAndDamage().

Referenced by HandleAuraModAttackPowerOfStatPercent().

◆ HandleAuraModAttackPowerOfStatPercent()

void AuraEffect::HandleAuraModAttackPowerOfStatPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4764{
4765 HandleAuraModAttackPowerOfArmor(aurApp, mode, apply);
4766}
void HandleAuraModAttackPowerOfArmor(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:4768

References HandleAuraModAttackPowerOfArmor().

◆ HandleAuraModAttackPowerPercent()

void AuraEffect::HandleAuraModAttackPowerPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4727{
4729 return;
4730
4731 Unit* target = aurApp->GetTarget();
4732
4733 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
4735}
@ TOTAL_PCT
Definition: Unit.h:248

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
3960{
3962 return;
3963
3964 Unit* target = aurApp->GetTarget();
3965 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
3966 {
3967 if (GetMiscValue() & int32(1 << x))
3968 {
3970 }
3971 }
3972}
std::int8_t int8
Definition: Define.h:106
UnitMods
Definition: Unit.h:261
@ UNIT_MOD_RESISTANCE_START
Definition: Unit.h:291
@ SPELL_SCHOOL_NORMAL
Definition: SharedDefines.h:255
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:264

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
4445{
4447 return;
4448
4449 Unit* target = aurApp->GetTarget();
4450
4451 if (target->GetTypeId() != TYPEID_PLAYER)
4452 return;
4453
4454 target->ToPlayer()->UpdateBlockPercentage();
4455}
void UpdateBlockPercentage()
Definition: StatSystem.cpp:623

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::GetTypeId(), Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateBlockPercentage().

◆ HandleAuraModCritPct()

void AuraEffect::HandleAuraModCritPct ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4553{
4555 return;
4556
4557 Unit* target = aurApp->GetTarget();
4558
4559 if (target->GetTypeId() != TYPEID_PLAYER)
4560 {
4561 target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
4562 return;
4563 }
4564
4565 target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4568
4569 // included in Player::UpdateSpellCritChance calculation
4571}
@ FLAT_MOD
Definition: Unit.h:308
@ OFFHAND_CRIT_PERCENTAGE
Definition: Unit.h:301
@ CRIT_PERCENTAGE
Definition: Unit.h:299
@ RANGED_CRIT_PERCENTAGE
Definition: Unit.h:300
void apply(T *val)
Definition: ByteConverter.h:40
void UpdateAllSpellCritChances()
Definition: StatSystem.cpp:878
void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
Definition: Player.cpp:4920
int32 m_baseSpellCritChance
Definition: Unit.h:2088

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

◆ HandleAuraModDecreaseSpeed()

void AuraEffect::HandleAuraModDecreaseSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3367{
3369 return;
3370
3371 Unit* target = aurApp->GetTarget();
3372
3373 target->UpdateSpeed(MOVE_WALK, true);
3374 target->UpdateSpeed(MOVE_RUN, true);
3375 target->UpdateSpeed(MOVE_SWIM, true);
3376 target->UpdateSpeed(MOVE_FLIGHT, true);
3377 target->UpdateSpeed(MOVE_RUN_BACK, true);
3378 target->UpdateSpeed(MOVE_SWIM_BACK, true);
3379 target->UpdateSpeed(MOVE_FLIGHT_BACK, true);
3380
3381 if (Player* targetPlayer = target->ToPlayer())
3382 {
3383 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3384 }
3385}
@ MOVE_FLIGHT
Definition: Unit.h:384
@ MOVE_SWIM
Definition: Unit.h:381
@ MOVE_FLIGHT_BACK
Definition: Unit.h:385
@ MOVE_SWIM_BACK
Definition: Unit.h:382
@ MOVE_RUN_BACK
Definition: Unit.h:380
@ MOVE_WALK
Definition: Unit.h:378
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:14147

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
2545{
2546 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2547 return;
2548
2549 Unit* target = aurApp->GetTarget();
2550
2551 AuraType type = GetAuraType();
2552
2553 //Prevent handling aura twice
2554 if ((apply) ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
2555 return;
2556
2557 uint32 field, flag, slot;
2558 WeaponAttackType attType;
2559 switch (type)
2560 {
2562 field = UNIT_FIELD_FLAGS;
2563 flag = UNIT_FLAG_DISARMED;
2565 attType = BASE_ATTACK;
2566 break;
2568 field = UNIT_FIELD_FLAGS_2;
2571 attType = OFF_ATTACK;
2572 break;
2574 field = UNIT_FIELD_FLAGS_2;
2576 slot = EQUIPMENT_SLOT_RANGED;
2577 attType = RANGED_ATTACK;
2578 break;
2579 default:
2580 return;
2581 }
2582
2583 // if disarm aura is to be removed, remove the flag first to reapply damage/aura mods
2584 if (!apply)
2585 target->RemoveFlag(field, flag);
2586
2587 // Handle damage modification, shapeshifted druids are not affected
2588 if (target->GetTypeId() == TYPEID_PLAYER && (!target->IsInFeralForm() || target->GetShapeshiftForm() == FORM_GHOSTWOLF))
2589 {
2590 if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
2591 {
2592 uint8 attacktype = Player::GetAttackBySlot(slot);
2593
2594 if (attacktype < MAX_ATTACK)
2595 {
2596 target->ToPlayer()->_ApplyWeaponDamage(slot, pItem->GetTemplate(), nullptr, !apply);
2597 target->ToPlayer()->_ApplyWeaponDependentAuraMods(pItem, WeaponAttackType(attacktype), !apply);
2598 }
2599 }
2600 }
2601
2602 // if disarm effects should be applied, wait to set flag until damage mods are unapplied
2603 if (apply)
2604 target->SetFlag(field, flag);
2605
2606 if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
2607 target->UpdateDamagePhysical(attType);
2608}
@ UNIT_FIELD_FLAGS_2
Definition: UpdateFields.h:118
@ UNIT_FIELD_FLAGS
Definition: UpdateFields.h:117
@ EQUIPMENT_SLOT_MAINHAND
Definition: Player.h:691
@ EQUIPMENT_SLOT_OFFHAND
Definition: Player.h:692
@ EQUIPMENT_SLOT_RANGED
Definition: Player.h:693
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:671
WeaponAttackType
Definition: Unit.h:395
@ MAX_ATTACK
Definition: Unit.h:399
@ UNIT_FLAG2_DISARM_OFFHAND
Definition: Unit.h:495
@ UNIT_FLAG2_DISARM_RANGED
Definition: Unit.h:497
@ FORM_GHOSTWOLF
Definition: Unit.h:106
@ UNIT_FLAG_DISARMED
Definition: Unit.h:469
@ 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:186
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:6784
Item * GetItemByPos(uint16 pos) const
Definition: PlayerStorage.cpp:472
void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply)
Definition: Player.cpp:6887
static uint8 GetAttackBySlot(uint8 slot)
Definition: PlayerStorage.cpp:573
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:2071
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
bool IsInFeralForm() const
Definition: Unit.h:2077

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(), Object::GetTypeId(), Unit::HasAuraType(), INVENTORY_SLOT_BAG_0, Unit::IsInFeralForm(), 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(), TYPEID_PLAYER, TYPEID_UNIT, 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
3901{
3902 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3903 return;
3904
3905 Unit* target = aurApp->GetTarget();
3906
3908}
DispelType
Definition: SharedDefines.h:1343
void ApplySpellDispelImmunity(SpellInfo const *spellProto, DispelType type, bool apply)
Definition: Unit.cpp:13327

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
3891{
3892 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3893 return;
3894
3895 Unit* target = aurApp->GetTarget();
3896
3897 target->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, GetMiscValue(), apply);
3898}
@ IMMUNITY_DAMAGE
Definition: SharedDefines.h:1369

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
4432{
4434 return;
4435
4436 Unit* target = aurApp->GetTarget();
4437
4438 if (target->GetTypeId() != TYPEID_PLAYER)
4439 return;
4440
4441 target->ToPlayer()->UpdateDodgePercentage();
4442}
void UpdateDodgePercentage()
Definition: StatSystem.cpp:788

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::GetTypeId(), Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateDodgePercentage().

◆ HandleAuraModEffectImmunity()

void AuraEffect::HandleAuraModEffectImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3796{
3797 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3798 return;
3799
3800 Unit* target = aurApp->GetTarget();
3801
3802 target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
3803
3804 // when removing flag aura, handle flag drop
3805 Player* player = target->ToPlayer();
3806 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
3807 {
3808 if (player->InBattleground())
3809 {
3810 if (Battleground* bg = player->GetBattleground())
3811 bg->EventPlayerDroppedFlag(player);
3812 }
3813 else
3814 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
3815 }
3816}
#define sOutdoorPvPMgr
Definition: OutdoorPvPMgr.h:106
@ AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
Definition: SpellDefines.h:64
@ IMMUNITY_EFFECT
Definition: SharedDefines.h:1366
bool InBattleground() const
Definition: Player.h:2201

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
4236{
4238 return;
4239
4240 Unit* target = aurApp->GetTarget();
4241
4242 if (target->GetTypeId() != TYPEID_PLAYER)
4243 return;
4244
4247}
void UpdateExpertise(WeaponAttackType attType)
Definition: StatSystem.cpp:884

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, BASE_ATTACK, AuraApplication::GetTarget(), Object::GetTypeId(), OFF_ATTACK, Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateExpertise().

◆ HandleAuraModFaction()

void AuraEffect::HandleAuraModFaction ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5590{
5591 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5592 return;
5593
5594 Unit* target = aurApp->GetTarget();
5595
5596 if (apply)
5597 {
5598 target->SetFaction(GetMiscValue());
5599 if (target->GetTypeId() == TYPEID_PLAYER)
5601 }
5602 else
5603 {
5604 target->RestoreFaction();
5605 if (target->GetTypeId() == TYPEID_PLAYER)
5607 }
5608}
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition: Unit.h:451
void SetFaction(uint32 faction)
Definition: Unit.cpp:10029
void RestoreFaction()
Definition: Unit.cpp:18863

References AURA_EFFECT_HANDLE_REAL, GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::RemoveUnitFlag(), Unit::RestoreFaction(), Unit::SetFaction(), Unit::SetUnitFlag(), TYPEID_PLAYER, and UNIT_FLAG_PLAYER_CONTROLLED.

◆ HandleAuraModFakeInebriation()

void AuraEffect::HandleAuraModFakeInebriation ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5717{
5719 return;
5720
5721 Unit* target = aurApp->GetTarget();
5722
5723 if (apply)
5724 {
5727
5728 if (target->GetTypeId() == TYPEID_PLAYER)
5729 {
5732 }
5733 }
5734 else
5735 {
5736 bool removeDetect = !target->HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE);
5737
5739
5740 if (target->GetTypeId() == TYPEID_PLAYER)
5741 {
5744
5745 if (removeDetect)
5746 removeDetect = !target->ToPlayer()->GetDrunkValue();
5747 }
5748
5749 if (removeDetect)
5751 }
5752
5753 // call functions which may have additional effects after chainging state of unit
5754 target->UpdateObjectVisibility(false);
5755}
@ PLAYER_FAKE_INEBRIATION
Definition: UpdateFields.h:325
@ SPELL_AURA_MOD_FAKE_INEBRIATE
Definition: SpellAuraDefines.h:367
@ INVISIBILITY_DRUNK
Definition: SharedDefines.h:1233
int32 GetInt32Value(uint16 index) const
Definition: Object.cpp:299
void SetInt32Value(uint16 index, int32 value)
Definition: Object.cpp:637
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:356
void DelFlag(FLAG_TYPE flag)
Definition: Object.h:357
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:361
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition: Object.h:507
uint8 GetDrunkValue() const
Definition: Player.h:2122
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: Unit.cpp:19298

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(), Player::GetDrunkValue(), Object::GetInt32Value(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::HasAuraType(), INVISIBILITY_DRUNK, WorldObject::m_invisibilityDetect, PLAYER_FAKE_INEBRIATION, Object::SetInt32Value(), SPELL_AURA_MOD_FAKE_INEBRIATE, Object::ToPlayer(), TYPEID_PLAYER, and Unit::UpdateObjectVisibility().

◆ HandleAuraModIncreaseEnergy()

void AuraEffect::HandleAuraModIncreaseEnergy ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4335{
4337 return;
4338
4339 Unit* target = aurApp->GetTarget();
4340
4342 // do not check power type, we can always modify the maximum
4343 // as the client will not see any difference
4344 // also, placing conditions that may change during the aura duration
4345 // inside effect handlers is not a good idea
4346 //if (int32(PowerType) != GetMiscValue())
4347 // return;
4348
4349 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4350
4351 target->HandleStatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
4352}
std::uint16_t uint16
Definition: Define.h:109
@ UNIT_MOD_POWER_START
Definition: Unit.h:293
PowerType
Definition: VehicleDefines.h:30
Powers
Definition: SharedDefines.h:240

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
4355{
4357 return;
4358
4359 Unit* target = aurApp->GetTarget();
4360
4362 // do not check power type, we can always modify the maximum
4363 // as the client will not see any difference
4364 // also, placing conditions that may change during the aura duration
4365 // inside effect handlers is not a good idea
4366 //if (int32(PowerType) != GetMiscValue())
4367 // return;
4368
4369 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4370 float amount = float(GetAmount());
4371
4372 if (apply)
4373 {
4374 target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
4375 target->ModifyPowerPct(PowerType, amount, apply);
4376 }
4377 else
4378 {
4379 target->ModifyPowerPct(PowerType, amount, apply);
4380 target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
4381 }
4382}
int32 ModifyPowerPct(Powers power, float pct, bool apply=true)
Definition: Unit.cpp:14084

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.

3312{
3314 return;
3315
3316 Unit* target = aurApp->GetTarget();
3318 target->UpdateSpeed(MOVE_FLIGHT, true);
3319
3322 {
3323 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3325 {
3326 target->SetCanFly(apply);
3327
3328 if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
3329 target->GetMotionMaster()->MoveFall();
3330 }
3331
3333 if (mode & AURA_EFFECT_HANDLE_REAL)
3334 {
3335 //Players on flying mounts must be immune to polymorph
3336 if (target->GetTypeId() == TYPEID_PLAYER)
3338
3339 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3340 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountID())
3342 }
3343 }
3344
3345 if (Player* targetPlayer = target->ToPlayer())
3346 {
3347 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3348 }
3349}
@ 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:1314
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition: Unit.cpp:5580
uint32 GetMountID() const
Definition: Unit.h:1543

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(), Object::GetTypeId(), Unit::HasAuraEffect(), Unit::HasAuraType(), IMMUNITY_MECHANIC, Unit::IsLevitating(), MECHANIC_POLYMORPH, MOVE_FLIGHT, MotionMaster::MoveFall(), Unit::SetCanFly(), Object::SetUInt32Value(), SPELL_AURA_FLY, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, sScriptMgr, Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_FIELD_MOUNTDISPLAYID, and Unit::UpdateSpeed().

◆ HandleAuraModIncreaseHealth()

void AuraEffect::HandleAuraModIncreaseHealth ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4290{
4292 return;
4293
4294 Unit* target = aurApp->GetTarget();
4295
4296 if (apply)
4297 {
4298 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
4299 target->ModifyHealth(GetAmount());
4300 }
4301 else
4302 {
4303 if (int32(target->GetHealth()) > GetAmount())
4304 target->ModifyHealth(-GetAmount());
4305 else
4306 target->SetHealth(1);
4307 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
4308 }
4309}
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:13993
void SetHealth(uint32 val)
Definition: Unit.cpp:15370
uint32 GetHealth() const
Definition: Unit.h:1440

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
4385{
4387 return;
4388
4389 Unit* target = aurApp->GetTarget();
4390
4391 // Unit will keep hp% after MaxHealth being modified if unit is alive.
4392 float percent = target->GetHealthPct();
4393 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(GetAmount()), apply);
4394
4395 // Xinef: pct was rounded down and could "kill" creature by setting its health to 0 making npc zombie
4396 if (target->IsAlive())
4397 if (uint32 healthAmount = CalculatePct(target->GetMaxHealth(), percent))
4398 target->SetHealth(healthAmount);
4399}
T CalculatePct(T base, U pct)
Definition: Util.h:61
float GetHealthPct() const
Definition: Unit.h:1448
uint32 GetMaxHealth() const
Definition: Unit.h:1441

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
4312{
4314 return;
4315
4316 Unit* target = aurApp->GetTarget();
4317
4318 uint32 oldhealth = target->GetHealth();
4319 double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth();
4320
4322
4323 // refresh percentage
4324 if (oldhealth > 0)
4325 {
4326 uint32 newhealth = uint32(std::ceil((double)target->GetMaxHealth() * healthPercentage));
4327 if (newhealth == 0)
4328 newhealth = 1;
4329
4330 target->SetHealth(newhealth);
4331 }
4332}

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
3307{
3308 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3309}
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3291

References HandleAuraModIncreaseSpeed().

◆ HandleAuraModIncreaseSpeed()

void AuraEffect::HandleAuraModIncreaseSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3292{
3294 return;
3295
3296 Unit* target = aurApp->GetTarget();
3297
3298 target->UpdateSpeed(MOVE_RUN, true);
3299
3300 if (Player* targetPlayer = target->ToPlayer())
3301 {
3302 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3303 }
3304}

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
3352{
3354 return;
3355
3356 Unit* target = aurApp->GetTarget();
3357
3358 target->UpdateSpeed(MOVE_SWIM, true);
3359
3360 if (Player* targetPlayer = target->ToPlayer())
3361 {
3362 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3363 }
3364}

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
2640{
2642 return;
2643
2644 Unit* target = aurApp->GetTarget();
2645
2646 if (apply)
2647 {
2649 //target->AttackStop(); // pussywizard: why having this flag prevents from being in combat? it should just prevent melee attack
2650 }
2651 else
2652 {
2653 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2655 return;
2657 }
2658}
@ UNIT_FLAG_PACIFIED
Definition: Unit.h:465
@ 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
2661{
2663 return;
2664
2665 Unit* target = aurApp->GetTarget();
2666
2667 if (!(apply))
2668 {
2669 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2671 return;
2672 }
2673 HandleAuraModPacify(aurApp, mode, apply);
2674 HandleAuraModSilence(aurApp, mode, apply);
2675}
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:2610
void HandleAuraModPacify(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:2639

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
4416{
4418 return;
4419
4420 Unit* target = aurApp->GetTarget();
4421
4422 if (target->GetTypeId() != TYPEID_PLAYER)
4423 return;
4424
4425 if (!target->ToPlayer()->CanParry())
4426 target->ToPlayer()->SetCanParry(true);
4427 else
4428 target->ToPlayer()->UpdateParryPercentage();
4429}
void UpdateParryPercentage()
Definition: StatSystem.cpp:742
bool CanParry() const
Definition: Player.h:2132
void SetCanParry(bool value)
Definition: Player.cpp:13018

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, Player::CanParry(), AuraApplication::GetTarget(), Object::GetTypeId(), Player::SetCanParry(), Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateParryPercentage().

◆ HandleAuraModPetTalentsPoints()

void AuraEffect::HandleAuraModPetTalentsPoints ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2797{
2799 return;
2800
2801 Unit* target = aurApp->GetTarget();
2802
2803 if (target->GetTypeId() != TYPEID_PLAYER)
2804 return;
2805
2806 // Recalculate pet talent points
2807 if (Pet* pet = target->ToPlayer()->GetPet())
2808 pet->InitTalentForLevel();
2809}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, Player::GetPet(), AuraApplication::GetTarget(), Object::GetTypeId(), Object::ToPlayer(), and TYPEID_PLAYER.

◆ HandleAuraModRangedAttackPower()

void AuraEffect::HandleAuraModRangedAttackPower ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4714{
4716 return;
4717
4718 Unit* target = aurApp->GetTarget();
4719
4720 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
4721 return;
4722
4724}
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition: Unit.h:283
#define CLASSMASK_WAND_USERS
Definition: SharedDefines.h:146
uint32 getClassMask() const
Definition: Unit.h:1427

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
4738{
4740 return;
4741
4742 Unit* target = aurApp->GetTarget();
4743
4744 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
4745 return;
4746
4747 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
4749}

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
4642{
4644 return;
4645
4646 Unit* target = aurApp->GetTarget();
4647
4648 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
4649}
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition: Unit.cpp:17225

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
4458{
4459 HandleModManaRegen(aurApp, mode, apply);
4460}
void HandleModManaRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:4275

References HandleModManaRegen().

◆ HandleAuraModResistance()

void AuraEffect::HandleAuraModResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3942{
3944 return;
3945
3946 Unit* target = aurApp->GetTarget();
3947
3948 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
3949 {
3950 if (GetMiscValue() & int32(1 << x))
3951 {
3953 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3954 target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply);
3955 }
3956 }
3957}
SpellSchools
Definition: SharedDefines.h:254
bool IsPet() const
Definition: Unit.h:1413
void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply)
Definition: Unit.h:2027

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

◆ HandleAuraModResistanceExclusive()

void AuraEffect::HandleAuraModResistanceExclusive ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3919{
3921 return;
3922
3923 Unit* target = aurApp->GetTarget();
3924
3925 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
3926 {
3927 if (GetMiscValue() & int32(1 << x))
3928 {
3930 if (amount < GetAmount())
3931 {
3932 float value = float(GetAmount() - amount);
3934 if (target->GetTypeId() == TYPEID_PLAYER)
3935 target->ApplyResistanceBuffModsMod(SpellSchools(x), aurApp->IsPositive(), value, apply);
3936 }
3937 }
3938 }
3939}
@ BASE_VALUE
Definition: Unit.h:245
@ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
Definition: SpellAuraDefines.h:206
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
Definition: Unit.cpp:5898

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

◆ HandleAuraModResistenceOfStatPercent()

void AuraEffect::HandleAuraModResistenceOfStatPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4214{
4216 return;
4217
4218 Unit* target = aurApp->GetTarget();
4219
4220 if (target->GetTypeId() != TYPEID_PLAYER)
4221 return;
4222
4224 {
4225 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
4226 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
4227 LOG_ERROR("spells.aura.effect", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
4228 return;
4229 }
4230
4231 // Recalculate Armor
4232 target->UpdateArmor();
4233}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:269
virtual void UpdateArmor()=0

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), LOG_ERROR, SPELL_SCHOOL_MASK_NORMAL, TYPEID_PLAYER, and Unit::UpdateArmor().

◆ HandleAuraModRoot()

void AuraEffect::HandleAuraModRoot ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3113{
3114 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3115 return;
3116
3117 Unit* target = aurApp->GetTarget();
3118
3119 target->SetControlled(apply, UNIT_STATE_ROOT);
3120}
@ UNIT_STATE_ROOT
Definition: Unit.h:335
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18192

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
2366{
2368 return;
2369
2370 aurApp->GetTarget()->RecalculateObjectScale();
2371}

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
3832{
3833 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3834 return;
3835
3836 Unit* target = aurApp->GetTarget();
3837
3838 target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, GetMiscValue(), (apply));
3839
3840 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3841 {
3842 if (apply)
3844 else
3845 {
3846 bool banishFound = false;
3847 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
3848 for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
3849 if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3850 {
3851 banishFound = true;
3852 break;
3853 }
3854 if (!banishFound)
3856 }
3857 }
3858
3859 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
3861
3862 // remove all flag auras (they are positive, but they must be removed when you are immune)
3866
3868 if ((apply)
3870 && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
3871 {
3872 uint32 school_mask = GetMiscValue();
3873 Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
3874 for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
3875 {
3876 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
3877 if ((spell->GetSchoolMask() & school_mask)//Check for school mask
3878 && GetSpellInfo()->CanDispelAura(spell)
3879 && !iter->second->IsPositive() //Don't remove positive spells
3880 && spell->Id != GetId()) //Don't remove self
3881 {
3882 target->RemoveAura(iter);
3883 }
3884 else
3885 ++iter;
3886 }
3887 }
3888}
@ UNIT_STATE_ISOLATED
Definition: Unit.h:338
@ SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE
Definition: SharedDefines.h:449
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
Definition: SharedDefines.h:406
@ MECHANIC_BANISH
Definition: SharedDefines.h:1315
@ IMMUNITY_SCHOOL
Definition: SharedDefines.h:1368
void ClearUnitState(uint32 f)
Definition: Unit.h:1399
void AddUnitState(uint32 f)
Definition: Unit.h:1397
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition: Unit.cpp:5096
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1972
bool IsPositive() const
Definition: SpellInfo.cpp:1221

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
1843{
1845 return;
1846
1847 Unit* target = aurApp->GetTarget();
1848
1849 uint32 modelid = 0;
1852
1853 switch (form)
1854 {
1855 case FORM_CAT: // 0x01
1856 case FORM_GHOUL: // 0x07
1858 break;
1859
1860 case FORM_BEAR: // 0x05
1861 case FORM_DIREBEAR: // 0x08
1862
1863 case FORM_BATTLESTANCE: // 0x11
1864 case FORM_DEFENSIVESTANCE: // 0x12
1865 case FORM_BERSERKERSTANCE: // 0x13
1867 break;
1868
1869 case FORM_TREE: // 0x02
1870 case FORM_TRAVEL: // 0x03
1871 case FORM_AQUA: // 0x04
1872 case FORM_AMBIENT: // 0x06
1873
1874 case FORM_STEVES_GHOUL: // 0x09
1875 case FORM_THARONJA_SKELETON: // 0x0A
1876 case FORM_TEST_OF_STRENGTH: // 0x0B
1877 case FORM_BLB_PLAYER: // 0x0C
1878 case FORM_SHADOW_DANCE: // 0x0D
1879 case FORM_CREATUREBEAR: // 0x0E
1880 case FORM_CREATURECAT: // 0x0F
1881 case FORM_GHOSTWOLF: // 0x10
1882
1883 case FORM_TEST: // 0x14
1884 case FORM_ZOMBIE: // 0x15
1885 case FORM_METAMORPHOSIS: // 0x16
1886 case FORM_UNDEAD: // 0x19
1887 case FORM_MASTER_ANGLER: // 0x1A
1888 case FORM_FLIGHT_EPIC: // 0x1B
1889 case FORM_SHADOW: // 0x1C
1890 case FORM_FLIGHT: // 0x1D
1891 case FORM_STEALTH: // 0x1E
1892 case FORM_MOONKIN: // 0x1F
1893 case FORM_SPIRITOFREDEMPTION: // 0x20
1894 break;
1895 default:
1896 LOG_ERROR("spells.aura.effect", "Auras: Unknown Shapeshift Type: {}", GetMiscValue());
1897 }
1898
1899 modelid = target->GetModelForForm(form, GetId());
1900
1901 if (apply)
1902 {
1903 // remove polymorph before changing display id to keep new display id
1904 switch (form)
1905 {
1906 case FORM_CAT:
1907 case FORM_TREE:
1908 case FORM_TRAVEL:
1909 case FORM_AQUA:
1910 case FORM_BEAR:
1911 case FORM_DIREBEAR:
1912 case FORM_FLIGHT_EPIC:
1913 case FORM_FLIGHT:
1914 case FORM_MOONKIN:
1915 {
1916 if (Player* player = target->ToPlayer())
1917 {
1918 player->SetCanTeleport(true);
1919 }
1920 // remove movement affects
1921 target->RemoveAurasByShapeShift();
1922
1923 // and polymorphic affects
1924 if (target->IsPolymorphed())
1925 target->RemoveAurasDueToSpell(target->getTransForm());
1926 break;
1927 }
1928 default:
1929 break;
1930 }
1931
1932 // remove other shapeshift before applying a new one
1933 // xinef: rogue shouldnt be wrapped by this check (shadow dance vs stealth)
1934 if (GetSpellInfo()->SpellFamilyName != SPELLFAMILY_ROGUE)
1936
1937 // stop handling the effect if it was removed by linked event
1938 if (aurApp->GetRemoveMode())
1939 return;
1940
1941 if (PowerType != POWER_MANA)
1942 {
1943 uint32 oldPower = target->GetPower(PowerType);
1944 // reset power to default values only at power change
1945 if (target->getPowerType() != PowerType)
1946 target->setPowerType(PowerType);
1947
1948 switch (form)
1949 {
1950 case FORM_CAT:
1951 case FORM_BEAR:
1952 case FORM_DIREBEAR:
1953 {
1954 // get furor proc chance
1955 uint32 FurorChance = 0;
1956 if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
1957 FurorChance = std::max(dummy->GetAmount(), 0);
1958
1959 switch (GetMiscValue())
1960 {
1961 case FORM_CAT:
1962 {
1963 int32 basePoints = int32(std::min(oldPower, FurorChance));
1964 target->SetPower(POWER_ENERGY, 0);
1965 target->CastCustomSpell(target, 17099, &basePoints, nullptr, nullptr, true, nullptr, this);
1966 break;
1967 }
1968 case FORM_BEAR:
1969 case FORM_DIREBEAR:
1970 if (urand(0, 99) < FurorChance)
1971 target->CastSpell(target, 17057, true);
1972 break;
1973 default:
1974 {
1975 uint32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance);
1976 target->SetPower(POWER_ENERGY, newEnergy);
1977 break;
1978 }
1979 }
1980 break;
1981 }
1982 default:
1983 break;
1984 }
1985 }
1986 // stop handling the effect if it was removed by linked event
1987 if (aurApp->GetRemoveMode())
1988 return;
1989
1990 target->SetShapeshiftForm(form);
1991 // xinef: allow shapeshift to override model id if forced transform aura is not present!
1992 if (modelid > 0)
1993 {
1994 bool allow = true;
1995 if (target->getTransForm())
1996 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm()))
1997 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !transformSpellInfo->IsPositive())
1998 allow = false;
1999
2000 if (allow)
2001 target->SetDisplayId(modelid);
2002 }
2003 }
2004 else
2005 {
2006 // reset model id if no other auras present
2007 // may happen when aura is applied on linked event on aura removal
2009 {
2011 if (target->getClass() == CLASS_DRUID)
2012 {
2013 target->setPowerType(POWER_MANA);
2014 // Remove movement impairing effects also when shifting out
2015 target->RemoveAurasByShapeShift();
2016 }
2017 }
2018
2019 if (modelid > 0)
2020 target->RestoreDisplayId();
2021
2022 switch (form)
2023 {
2024 // Nordrassil Harness - bonus
2025 case FORM_BEAR:
2026 case FORM_DIREBEAR:
2027 case FORM_CAT:
2028 if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
2029 target->CastSpell(target, 37316, true, nullptr, dummy);
2030 break;
2031 // Nordrassil Regalia - bonus
2032 case FORM_MOONKIN:
2033 if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
2034 target->CastSpell(target, 37325, true, nullptr, dummy);
2035 break;
2036 case FORM_BATTLESTANCE:
2039 {
2040 uint32 Rage_val = 0;
2041 // Defensive Tactics
2042 if (form == FORM_DEFENSIVESTANCE)
2043 {
2044 if (AuraEffect const* aurEff = target->IsScriptOverriden(m_spellInfo, 831))
2045 Rage_val += aurEff->GetAmount() * 10;
2046 }
2047 // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
2048 if (target->GetTypeId() == TYPEID_PLAYER)
2049 {
2050 // Stance mastery - trainer spell
2051 PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
2052 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
2053 {
2054 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec()))
2055 continue;
2056
2057 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
2058 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
2059 Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
2060 }
2061
2062 // Tactical Mastery - talent
2063 PlayerTalentMap const& tp_list = target->ToPlayer()->GetTalentMap();
2064 for (PlayerTalentMap::const_iterator itr = tp_list.begin(); itr != tp_list.end(); ++itr)
2065 {
2066 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec()))
2067 continue;
2068
2069 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
2070 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
2071 Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
2072 }
2073 }
2074 if (target->GetPower(POWER_RAGE) > Rage_val)
2075 target->SetPower(POWER_RAGE, Rage_val);
2076 break;
2077 }
2078 default:
2079 break;
2080 }
2081 }
2082
2083 // adding/removing linked auras
2084 // add/remove the shapeshift aura's boosts
2085 HandleShapeshiftBoosts(target, apply);
2086
2087 if (target->GetTypeId() == TYPEID_PLAYER)
2088 target->ToPlayer()->InitDataForForm();
2089
2090 if (target->getClass() == CLASS_DRUID)
2091 {
2092 // Dash
2094 aurEff->RecalculateAmount();
2095
2096 // Disarm handling
2097 // If druid shifts while being disarmed we need to deal with that since forms aren't affected by disarm
2098 // and also HandleAuraModDisarm is not triggered
2099 if (!target->CanUseAttackType(BASE_ATTACK))
2100 {
2102 {
2103 target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), nullptr, apply);
2104 }
2105 }
2106
2107 // Update crit chance for feral forms
2108 switch (form)
2109 {
2110 case FORM_CAT:
2111 case FORM_BEAR:
2112 case FORM_DIREBEAR:
2113 case FORM_GHOSTWOLF:
2115 break;
2116 default:
2117 break;
2118 }
2119 }
2120
2121 // stop handling the effect if it was removed by linked event
2122 if (apply && aurApp->GetRemoveMode())
2123 return;
2124
2125 if (target->GetTypeId() == TYPEID_PLAYER)
2126 {
2127 SpellShapeshiftEntry const* shapeInfo = sSpellShapeshiftStore.LookupEntry(form);
2128 // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
2129 for (uint8 i = 0; i < MAX_SHAPESHIFT_SPELLS; ++i)
2130 {
2131 if (!shapeInfo->stanceSpell[i])
2132 continue;
2133 if (apply)
2134 target->ToPlayer()->_addSpell(shapeInfo->stanceSpell[i], SPEC_MASK_ALL, true);
2135 else
2136 target->ToPlayer()->removeSpell(shapeInfo->stanceSpell[i], SPEC_MASK_ALL, true);
2137 }
2138 }
2139}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
DBCStorage< SpellShapeshiftEntry > sSpellShapeshiftStore(SpellShapeshiftfmt)
std::unordered_map< uint32, PlayerTalent * > PlayerTalentMap
Definition: Player.h:193
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition: Player.h:194
#define SPEC_MASK_ALL
Definition: Player.h:178
@ PLAYERSPELL_REMOVED
Definition: Player.h:123
ShapeshiftForm
Definition: Unit.h:89
@ FORM_DIREBEAR
Definition: Unit.h:98
@ FORM_UNDEAD
Definition: Unit.h:113
@ FORM_TEST
Definition: Unit.h:110
@ FORM_TRAVEL
Definition: Unit.h:93
@ FORM_CREATUREBEAR
Definition: Unit.h:104
@ FORM_SHADOW
Definition: Unit.h:116
@ FORM_SHADOW_DANCE
Definition: Unit.h:103
@ FORM_SPIRITOFREDEMPTION
Definition: Unit.h:120
@ FORM_BERSERKERSTANCE
Definition: Unit.h:109
@ FORM_MASTER_ANGLER
Definition: Unit.h:114
@ FORM_DEFENSIVESTANCE
Definition: Unit.h:108
@ FORM_THARONJA_SKELETON
Definition: Unit.h:100
@ FORM_FLIGHT_EPIC
Definition: Unit.h:115
@ FORM_STEVES_GHOUL
Definition: Unit.h:99
@ FORM_MOONKIN
Definition: Unit.h:119
@ FORM_NONE
Definition: Unit.h:90
@ FORM_CREATURECAT
Definition: Unit.h:105
@ FORM_CAT
Definition: Unit.h:91
@ FORM_FLIGHT
Definition: Unit.h:117
@ FORM_ZOMBIE
Definition: Unit.h:111
@ FORM_AMBIENT
Definition: Unit.h:96
@ FORM_AQUA
Definition: Unit.h:94
@ FORM_STEALTH
Definition: Unit.h:118
@ FORM_BATTLESTANCE
Definition: Unit.h:107
@ FORM_BLB_PLAYER
Definition: Unit.h:102
@ FORM_METAMORPHOSIS
Definition: Unit.h:112
@ FORM_GHOUL
Definition: Unit.h:97
@ FORM_TREE
Definition: Unit.h:92
@ FORM_TEST_OF_STRENGTH
Definition: Unit.h:101
@ FORM_BEAR
Definition: Unit.h:95
@ 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
#define MAX_SHAPESHIFT_SPELLS
Definition: DBCStructure.h:1789
@ POWER_RAGE
Definition: SharedDefines.h:242
@ POWER_ENERGY
Definition: SharedDefines.h:244
@ POWER_MANA
Definition: SharedDefines.h:241
@ CLASS_DRUID
Definition: SharedDefines.h:123
@ SPELLFAMILY_WARRIOR
Definition: SharedDefines.h:3504
@ SPELL_ATTR0_NO_IMMUNITIES
Definition: SharedDefines.h:383
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
bool _addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill=false)
Definition: Player.cpp:3042
void removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporary)
Definition: Player.cpp:3271
const PlayerTalentMap & GetTalentMap() const
Definition: Player.h:2557
PlayerSpellMap const & GetSpellMap() const
Definition: Player.h:1726
void InitDataForForm(bool reapplyMods=false)
Definition: Player.cpp:10467
uint8 GetActiveSpec() const
Definition: Player.h:1694
void UpdateAllCritPercentages()
Definition: StatSystem.cpp:687
void RemoveAurasByShapeShift()
Definition: Unit.cpp:5190
bool CanUseAttackType(uint8 attacktype) const
Definition: Unit.h:1607
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition: Unit.cpp:14743
bool IsPolymorphed() const
Definition: Unit.cpp:16915
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition: Unit.cpp:15458
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5412
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition: Unit.cpp:5721
void RestoreDisplayId()
Definition: Unit.cpp:16946
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition: Unit.h:1976
uint32 getTransForm() const
Definition: Unit.h:2174
Powers getPowerType() const
Definition: Unit.h:1459
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition: Unit.cpp:5025
uint32 GetPower(Powers power) const
Definition: Unit.h:1461
void setPowerType(Powers power)
Definition: Unit.cpp:9952
void SetShapeshiftForm(ShapeshiftForm form)
Definition: Unit.h:2072
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const
Definition: Unit.cpp:19369
void HandleShapeshiftBoosts(Unit *target, bool apply) const
Definition: SpellAuraEffects.cpp:1201
uint32 SpellIconID
Definition: SpellInfo.h:378
Definition: DBCStructure.h:1792
uint32 stanceSpell[MAX_SHAPESHIFT_SPELLS]
Definition: DBCStructure.h:1805

References Player::_addSpell(), Player::_ApplyWeaponDamage(), AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK, BASE_ATTACK, Unit::CalculateSpellDamage(), Unit::CanUseAttackType(), Unit::CastCustomSpell(), Unit::CastSpell(), 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::getClass(), Unit::GetDummyAuraEffect(), GetId(), Player::GetItemByPos(), GetMiscValue(), Unit::GetModelForForm(), Unit::GetPower(), Unit::getPowerType(), AuraApplication::GetRemoveMode(), GetSpellInfo(), Player::GetSpellMap(), Player::GetTalentMap(), AuraApplication::GetTarget(), Unit::getTransForm(), Object::GetTypeId(), HandleShapeshiftBoosts(), Unit::HasAuraType(), Player::InitDataForForm(), INVENTORY_SLOT_BAG_0, 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, sSpellShapeshiftStore, SpellShapeshiftEntry::stanceSpell, Object::ToPlayer(), TYPEID_PLAYER, Player::UpdateAllCritPercentages(), and urand().

◆ HandleAuraModSilence()

void AuraEffect::HandleAuraModSilence ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2611{
2612 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2613 return;
2614
2615 Unit* target = aurApp->GetTarget();
2616
2617 if (apply)
2618 {
2620
2621 // call functions which may have additional effects after chainging state of unit
2622 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
2623 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
2624 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
2625 if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
2626 // Stop spells on prepare or casting state
2627 target->InterruptSpell(CurrentSpellTypes(i), false);
2628 }
2629 else
2630 {
2631 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2633 return;
2634
2636 }
2637}
#define CURRENT_MAX_SPELL
Definition: Unit.h:985
CurrentSpellTypes
Definition: Unit.h:977
@ CURRENT_MELEE_SPELL
Definition: Unit.h:978
@ UNIT_FLAG_SILENCED
Definition: Unit.h:461
@ SPELL_AURA_MOD_SILENCE
Definition: SpellAuraDefines.h:90
@ SPELL_PREVENTION_TYPE_SILENCE
Definition: SharedDefines.h:1526
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4002

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
2812{
2814 return;
2815 Unit* target = aurApp->GetTarget();
2816
2817 if (target->GetTypeId() != TYPEID_PLAYER)
2818 return;
2819
2820 uint32 prot = GetMiscValue();
2821 int32 points = GetAmount();
2822
2823 target->ToPlayer()->ModifySkillBonus(prot, ((apply) ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
2824 if (prot == SKILL_DEFENSE)
2825 target->ToPlayer()->UpdateDefenseBonusesMod();
2826}
@ SPELL_AURA_MOD_SKILL_TALENT
Definition: SpellAuraDefines.h:161
@ AURA_EFFECT_HANDLE_SKILL
Definition: SpellAuraDefines.h:47
@ SKILL_DEFENSE
Definition: SharedDefines.h:2853
void ModifySkillBonus(uint32 skillid, int32 val, bool talent)
Definition: Player.cpp:5211
void UpdateDefenseBonusesMod()
Definition: StatSystem.cpp:616

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_SKILL, GetAmount(), GetAuraType(), GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), Player::ModifySkillBonus(), SKILL_DEFENSE, SPELL_AURA_MOD_SKILL_TALENT, Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateDefenseBonusesMod().

◆ HandleAuraModStalked()

void AuraEffect::HandleAuraModStalked ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2754{
2756 return;
2757
2758 Unit* target = aurApp->GetTarget();
2759
2760 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
2761 if (apply)
2763 else
2764 {
2765 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2766 if (!target->HasAuraType(GetAuraType()))
2768 }
2769
2770 // call functions which may have additional effects after chainging state of unit
2771 target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER);
2772}
@ UNIT_DYNFLAG_TRACK_UNIT
Definition: SharedDefines.h:3094
virtual void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:118
virtual void SetDynamicFlag(uint32 flag)
Definition: Object.h:117

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetAuraType(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::HasAuraType(), Object::RemoveDynamicFlag(), Object::SetDynamicFlag(), TYPEID_PLAYER, UNIT_DYNFLAG_TRACK_UNIT, and Unit::UpdateObjectVisibility().

◆ HandleAuraModStat()

void AuraEffect::HandleAuraModStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4033{
4035 return;
4036
4037 Unit* target = aurApp->GetTarget();
4038
4039 if (GetMiscValue() < -2 || GetMiscValue() > 4)
4040 {
4041 LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
4042 return;
4043 }
4044
4045 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4046 {
4047 // -1 or -2 is all stats (misc < -2 checked in function beginning)
4048 if (GetMiscValue() < 0 || GetMiscValue() == i)
4049 {
4050 //target->ApplyStatMod(Stats(i), m_amount, apply);
4052 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
4053 target->ApplyStatBuffMod(Stats(i), (float)GetAmount(), apply);
4054 }
4055 }
4056}
@ UNIT_MOD_STAT_START
Definition: Unit.h:289
#define MAX_STATS
Definition: SharedDefines.h:237
Stats
Definition: SharedDefines.h:229
@ STAT_STRENGTH
Definition: SharedDefines.h:230
void ApplyStatBuffMod(Stats stat, float val, bool apply)
Definition: Unit.h:2034

References Unit::ApplyStatBuffMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetEffIndex(), GetId(), GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::HandleStatModifier(), Unit::IsPet(), LOG_ERROR, MAX_STATS, STAT_STRENGTH, TOTAL_VALUE, TYPEID_PLAYER, 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
3103{
3104 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3105 return;
3106
3107 Unit* target = aurApp->GetTarget();
3108
3109 target->SetControlled(apply, UNIT_STATE_STUNNED);
3110}
@ UNIT_STATE_STUNNED
Definition: Unit.h:328

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
3041{
3043 return;
3044
3045 Unit* target = aurApp->GetTarget();
3046
3047 if (!target->IsAlive() || target->GetTypeId() != TYPEID_PLAYER)
3048 return;
3049
3050 Unit* caster = GetCaster();
3051 if (caster && caster->IsAlive())
3052 target->getHostileRefMgr().addTempThreat((float)GetAmount(), apply);
3053}
void addTempThreat(float threat, bool apply)
Definition: HostileRefMgr.cpp:65
HostileRefMgr & getHostileRefMgr()
Definition: Unit.h:2149

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

◆ HandleAuraModUseNormalSpeed()

void AuraEffect::HandleAuraModUseNormalSpeed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3388{
3389 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3390 return;
3391
3392 Unit* target = aurApp->GetTarget();
3393
3394 target->UpdateSpeed(MOVE_RUN, true);
3395 target->UpdateSpeed(MOVE_SWIM, true);
3396 target->UpdateSpeed(MOVE_FLIGHT, true);
3397
3398 if (Player* targetPlayer = target->ToPlayer())
3399 {
3400 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3401 }
3402}

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
4463{
4465 return;
4466
4467 Unit* target = aurApp->GetTarget();
4468
4469 if (target->GetTypeId() != TYPEID_PLAYER)
4470 return;
4471
4472 for (int i = 0; i < MAX_ATTACK; ++i)
4473 if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
4474 target->ToPlayer()->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply);
4475
4476 // mods must be applied base at equipped weapon class and subclass comparison
4477 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
4478 // GetMiscValue() comparison with item generated damage types
4479
4480 if (GetSpellInfo()->EquippedItemClass == -1)
4481 {
4482 target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4485 }
4486 else
4487 {
4488 // done in Player::_ApplyWeaponDependentAuraMods
4489 }
4490}
void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
Definition: Player.cpp:6902

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

◆ HandleAuraMounted()

void AuraEffect::HandleAuraMounted ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2833{
2835 return;
2836
2837 Unit* target = aurApp->GetTarget();
2838 Unit* caster = GetCaster();
2839
2840 if (apply)
2841 {
2842 uint32 creatureEntry = GetMiscValue();
2843 uint32 displayId = 0;
2844 uint32 vehicleId = 0;
2845
2846 // Festive Holiday Mount
2847 if (target->HasAura(62061))
2848 {
2850 creatureEntry = 24906;
2851 else
2852 creatureEntry = 15665;
2853 }
2854
2855 // Festive Brewfest Mount
2857 {
2858 if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
2859 {
2860 creatureEntry = GREAT_BREWFEST_KODO;
2861 }
2862 else
2863 {
2864 creatureEntry = BREWFEST_KODO;
2865 }
2866 }
2867
2868 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
2869 {
2870 if (GetMiscValueB() > 0) // Choose proper modelid
2871 {
2872 displayId = GetMiscValueB() == 2 && creatureInfo->Modelid2 > 0 ? creatureInfo->Modelid2 : creatureInfo->Modelid1;
2873 }
2874 else // Should we choose random modelid in this case?
2875 {
2876 displayId = ObjectMgr::ChooseDisplayId(creatureInfo);
2877 }
2878 sObjectMgr->GetCreatureModelRandomGender(&displayId);
2879
2880 vehicleId = creatureInfo->VehicleId;
2881
2882 //some spell has one aura of mount and one of vehicle
2883 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2884 {
2885 if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue())
2886 {
2887 displayId = 0;
2888 }
2889 }
2890
2891 }
2892 target->Mount(displayId, vehicleId, GetMiscValue());
2893 }
2894 else
2895 {
2896 target->Dismount();
2897 //some mounts like Headless Horseman's Mount or broom stick are skill based spell
2898 // need to remove ALL arura related to mounts, this will stop client crash with broom stick
2899 // and never endless flying after using Headless Horseman's Mount
2900 if (mode & AURA_EFFECT_HANDLE_REAL)
2902 }
2903}
@ SPELL_EFFECT_SUMMON
Definition: SharedDefines.h:778
void Dismount()
Definition: Unit.cpp:13435
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5610
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition: Unit.cpp:13376

References AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, BREWFEST_KODO, ObjectMgr::ChooseDisplayId(), Unit::Dismount(), FRESH_BREWFEST_HOPS, GetBase(), GetCaster(), GetMiscValue(), GetMiscValueB(), 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
5701{
5702 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5703 return;
5704
5705 Unit* target = aurApp->GetTarget();
5706
5707 if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
5708 return;
5709
5710 if (apply)
5711 target->ToPlayer()->GetSession()->SendStablePet(target->GetGUID());
5712
5713 // client auto close stable dialog at !apply aura
5714}
bool IsInWorld() const
Definition: Object.h:101
WorldSession * GetSession() const
Definition: Player.h:1948
void SendStablePet(ObjectGuid guid)
Definition: NPCHandler.cpp:483

References AURA_EFFECT_HANDLE_REAL, Object::GetGUID(), Player::GetSession(), AuraApplication::GetTarget(), Object::GetTypeId(), Object::IsInWorld(), WorldSession::SendStablePet(), Object::ToPlayer(), and TYPEID_PLAYER.

◆ HandleAuraOverrideSpells()

void AuraEffect::HandleAuraOverrideSpells ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5758{
5759 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5760 return;
5761
5762 Player* target = aurApp->GetTarget()->ToPlayer();
5763
5764 if (!target || !target->IsInWorld())
5765 return;
5766
5767 uint32 overrideId = uint32(GetMiscValue());
5768
5769 if (apply)
5770 {
5772 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5773 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5774 if (uint32 spellId = overrideSpells->spellId[i])
5775 target->_addSpell(spellId, SPEC_MASK_ALL, true);
5776 }
5777 else
5778 {
5780 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5781 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5782 if (uint32 spellId = overrideSpells->spellId[i])
5783 target->removeSpell(spellId, SPEC_MASK_ALL, true);
5784 }
5785}
DBCStorage< OverrideSpellDataEntry > sOverrideSpellDataStore(OverrideSpellDatafmt)
@ PLAYER_FIELD_BYTES2
Definition: UpdateFields.h:378
#define PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET
Definition: Player.h:552
#define MAX_OVERRIDE_SPELL
Definition: DBCStructure.h:1394
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition: Object.cpp:770
Definition: DBCStructure.h:1397

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
4994{
4995 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4996 return;
4997
4998 Unit* target = aurApp->GetTarget();
4999
5000 if (target->GetTypeId() != TYPEID_PLAYER)
5001 return;
5002
5003 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
5004 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
5005 if (!(apply) && GetBase()->GetDuration() == 0)
5006 target->AddComboPoints(-GetAmount());
5007}
void AddComboPoints(Unit *target, int8 count)
Definition: Unit.cpp:17009

References Unit::AddComboPoints(), AURA_EFFECT_HANDLE_REAL, GetAmount(), GetBase(), AuraApplication::GetTarget(), Object::GetTypeId(), and TYPEID_PLAYER.

◆ HandleAuraSetVehicle()

void AuraEffect::HandleAuraSetVehicle ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5788{
5789 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5790 return;
5791
5792 Unit* target = aurApp->GetTarget();
5793
5794 if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
5795 return;
5796
5797 uint32 vehicleId = GetMiscValue();
5798
5799 if (apply)
5800 {
5801 if (!target->CreateVehicleKit(vehicleId, 0))
5802 return;
5803 }
5804 else if (target->GetVehicleKit())
5805 target->RemoveVehicleKit();
5806
5808 data << target->GetPackGUID();
5809 data << uint32(apply ? vehicleId : 0);
5810 target->SendMessageToSet(&data, true);
5811
5812 if (apply)
5813 {
5815 target->ToPlayer()->GetSession()->SendPacket(&data);
5816 }
5817}
@ 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:108
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.h:482
std::size_t size() const
Definition: ObjectGuid.h:276
void RemoveVehicleKit()
Definition: Unit.cpp:18895
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Definition: Unit.cpp:18883
Definition: WorldPacket.h:27
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:207

References AURA_EFFECT_HANDLE_REAL, Unit::CreateVehicleKit(), GetMiscValue(), Object::GetPackGUID(), Player::GetSession(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::GetVehicleKit(), WorldPacket::Initialize(), Object::IsInWorld(), Unit::RemoveVehicleKit(), WorldObject::SendMessageToSet(), WorldSession::SendPacket(), PackedGuid::size(), SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SMSG_PLAYER_VEHICLE_DATA, Object::ToPlayer(), and TYPEID_PLAYER.

◆ HandleAuraTrackCreatures()

void AuraEffect::HandleAuraTrackCreatures ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2703{
2705 return;
2706
2707 Unit* target = aurApp->GetTarget();
2708
2709 if (target->GetTypeId() != TYPEID_PLAYER)
2710 return;
2711
2712 if (apply)
2713 target->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
2714 else
2715 target->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
2716}
@ PLAYER_TRACK_CREATURES
Definition: UpdateFields.h:344

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), PLAYER_TRACK_CREATURES, Object::RemoveFlag(), Object::SetFlag(), and TYPEID_PLAYER.

◆ HandleAuraTrackResources()

void AuraEffect::HandleAuraTrackResources ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2719{
2721 return;
2722
2723 Unit* target = aurApp->GetTarget();
2724
2725 if (target->GetTypeId() != TYPEID_PLAYER)
2726 return;
2727
2728 if (apply)
2729 target->SetFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
2730 else
2731 target->RemoveFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
2732}
@ PLAYER_TRACK_RESOURCES
Definition: UpdateFields.h:345

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), PLAYER_TRACK_RESOURCES, Object::RemoveFlag(), Object::SetFlag(), and TYPEID_PLAYER.

◆ HandleAuraTrackStealthed()

void AuraEffect::HandleAuraTrackStealthed ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2735{
2737 return;
2738
2739 Unit* target = aurApp->GetTarget();
2740
2741 if (target->GetTypeId() != TYPEID_PLAYER)
2742 return;
2743
2744 if (!(apply))
2745 {
2746 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2747 if (target->HasAuraType(GetAuraType()))
2748 return;
2749 }
2751}
@ PLAYER_FIELD_BYTES
Definition: UpdateFields.h:368
@ PLAYER_FIELD_BYTE_TRACK_STEALTHED
Definition: Player.h:560
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(), Object::GetTypeId(), Unit::HasAuraType(), PLAYER_FIELD_BYTE_TRACK_STEALTHED, PLAYER_FIELD_BYTES, and TYPEID_PLAYER.

◆ HandleAuraTransform()

void AuraEffect::HandleAuraTransform ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2142{
2144 return;
2145
2146 Unit* target = aurApp->GetTarget();
2147
2148 if (apply)
2149 {
2150 // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case
2151 if (GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !target->GetModelForForm(target->GetShapeshiftForm(), GetId()) || !GetSpellInfo()->IsPositive())
2152 {
2153 // special case (spell specific functionality)
2154 if (GetMiscValue() == 0)
2155 {
2156 switch (GetId())
2157 {
2158 // Orb of Deception
2159 case 16739:
2160 {
2161 if (target->GetTypeId() != TYPEID_PLAYER)
2162 return;
2163
2164 switch (target->getRace())
2165 {
2166 // Blood Elf
2167 case RACE_BLOODELF:
2168 target->SetDisplayId(target->getGender() == GENDER_MALE ? 17829 : 17830);
2169 break;
2170 // Orc
2171 case RACE_ORC:
2172 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10139 : 10140);
2173 break;
2174 // Troll
2175 case RACE_TROLL:
2176 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10135 : 10134);
2177 break;
2178 // Tauren
2179 case RACE_TAUREN:
2180 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10136 : 10147);
2181 break;
2182 // Undead
2183 case RACE_UNDEAD_PLAYER:
2184 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10146 : 10145);
2185 break;
2186 // Draenei
2187 case RACE_DRAENEI:
2188 target->SetDisplayId(target->getGender() == GENDER_MALE ? 17827 : 17828);
2189 break;
2190 // Dwarf
2191 case RACE_DWARF:
2192 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10141 : 10142);
2193 break;
2194 // Gnome
2195 case RACE_GNOME:
2196 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10148 : 10149);
2197 break;
2198 // Human
2199 case RACE_HUMAN:
2200 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10137 : 10138);
2201 break;
2202 // Night Elf
2203 case RACE_NIGHTELF:
2204 target->SetDisplayId(target->getGender() == GENDER_MALE ? 10143 : 10144);
2205 break;
2206 default:
2207 break;
2208 }
2209 break;
2210 }
2211 // Murloc costume
2212 case 42365:
2213 target->SetDisplayId(21723);
2214 break;
2215 // Dread Corsair
2216 case 50517:
2217 // Corsair Costume
2218 case 51926:
2219 {
2220 if (target->GetTypeId() != TYPEID_PLAYER)
2221 return;
2222
2223 switch (target->getRace())
2224 {
2225 // Blood Elf
2226 case RACE_BLOODELF:
2227 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25032 : 25043);
2228 break;
2229 // Orc
2230 case RACE_ORC:
2231 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25039 : 25050);
2232 break;
2233 // Troll
2234 case RACE_TROLL:
2235 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25041 : 25052);
2236 break;
2237 // Tauren
2238 case RACE_TAUREN:
2239 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25040 : 25051);
2240 break;
2241 // Undead
2242 case RACE_UNDEAD_PLAYER:
2243 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25042 : 25053);
2244 break;
2245 // Draenei
2246 case RACE_DRAENEI:
2247 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25033 : 25044);
2248 break;
2249 // Dwarf
2250 case RACE_DWARF:
2251 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25034 : 25045);
2252 break;
2253 // Gnome
2254 case RACE_GNOME:
2255 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25035 : 25046);
2256 break;
2257 // Human
2258 case RACE_HUMAN:
2259 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25037 : 25048);
2260 break;
2261 // Night Elf
2262 case RACE_NIGHTELF:
2263 target->SetDisplayId(target->getGender() == GENDER_MALE ? 25038 : 25049);
2264 break;
2265 default:
2266 break;
2267 }
2268 break;
2269 }
2270 // Pygmy Oil
2271 case 53806:
2272 target->SetDisplayId(22512);
2273 break;
2274 // Honor the Dead
2275 case 65386:
2276 case 65495:
2277 target->SetDisplayId(target->getGender() == GENDER_MALE ? 29203 : 29204);
2278 break;
2279 // Darkspear Pride
2280 case 75532:
2281 target->SetDisplayId(target->getGender() == GENDER_MALE ? 31737 : 31738);
2282 break;
2283 // Gnomeregan Pride
2284 case 75531:
2285 target->SetDisplayId(target->getGender() == GENDER_MALE ? 31654 : 31655);
2286 break;
2287 default:
2288 break;
2289 }
2290 }
2291 else
2292 {
2293 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(GetMiscValue());
2294 if (!ci)
2295 {
2296 target->SetDisplayId(16358); // pig pink ^_^
2297 LOG_ERROR("spells.aura.effect", "Auras: unknown creature id = {} (only need its modelid) From Spell Aura Transform in Spell ID = {}", GetMiscValue(), GetId());
2298 }
2299 else
2300 {
2301 uint32 model_id = 0;
2302
2303 if (uint32 modelid = ci->GetRandomValidModelId())
2304 model_id = modelid; // Will use the default model here
2305
2306 // Polymorph (sheep)
2307 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978)
2308 if (Unit* caster = GetCaster())
2309 if (caster->HasAura(52648)) // Glyph of the Penguin
2310 model_id = 26452;
2311
2312 target->SetDisplayId(model_id);
2313
2314 // Dragonmaw Illusion (set mount model also)
2315 if (GetId() == 42016 && target->GetMountID() && !target->GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
2317 }
2318 }
2319 }
2320
2321 // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case
2322 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
2323 if (!transformSpellInfo || GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
2324 target->setTransForm(GetId());
2325
2326 // polymorph case
2327 if ((mode & AURA_EFFECT_HANDLE_REAL) && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed())
2328 {
2329 // for players, start regeneration after 1s (in polymorph fast regeneration case)
2330 // only if caster is Player (after patch 2.4.2)
2331 if (GetCasterGUID().IsPlayer())
2333
2334 //dismount polymorphed target (after patch 2.4.2)
2335 if (target->IsMounted())
2337 }
2338 }
2339 else
2340 {
2341 // HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true) will reapply it if need
2342 if (target->getTransForm() == GetId())
2343 target->setTransForm(0);
2344
2345 target->RestoreDisplayId();
2346
2347 // Dragonmaw Illusion (restore mount model)
2348 if (GetId() == 42016 && target->GetMountID() == 16314)
2349 {
2350 if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
2351 {
2352 uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
2353 if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
2354 {
2355 uint32 displayID = ObjectMgr::ChooseDisplayId(ci);
2356 sObjectMgr->GetCreatureModelRandomGender(&displayID);
2357
2358 target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayID);
2359 }
2360 }
2361 }
2362 }
2363}
@ RACE_TROLL
Definition: SharedDefines.h:77
@ RACE_UNDEAD_PLAYER
Definition: SharedDefines.h:74
@ RACE_ORC
Definition: SharedDefines.h:71
@ RACE_DRAENEI
Definition: SharedDefines.h:80
@ RACE_NIGHTELF
Definition: SharedDefines.h:73
@ RACE_BLOODELF
Definition: SharedDefines.h:79
@ RACE_DWARF
Definition: SharedDefines.h:72
@ RACE_GNOME
Definition: SharedDefines.h:76
@ RACE_HUMAN
Definition: SharedDefines.h:70
@ RACE_TAUREN
Definition: SharedDefines.h:75
uint32 GetRandomValidModelId() const
Definition: Creature.cpp:120
void setRegenTimerCount(uint32 time)
Definition: Player.h:1564
uint8 getRace(bool original=false) const
Definition: Unit.cpp:21185
void setTransForm(uint32 spellid)
Definition: Unit.h:2173
bool IsMounted() const
Definition: Unit.h:1542

References AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, ObjectMgr::ChooseDisplayId(), GENDER_MALE, Unit::GetAuraEffectsByType(), GetCaster(), GetCasterGUID(), Unit::getGender(), GetId(), GetMiscValue(), Unit::GetModelForForm(), Unit::GetMountID(), Unit::getRace(), CreatureTemplate::GetRandomValidModelId(), Unit::GetShapeshiftForm(), GetSpellInfo(), AuraApplication::GetTarget(), Unit::getTransForm(), Object::GetTypeId(), IN_MILLISECONDS, Unit::IsMounted(), 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(), Object::SetUInt32Value(), sObjectMgr, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_MOUNTED, SPELLFAMILY_MAGE, sSpellMgr, Object::ToPlayer(), TYPEID_PLAYER, and UNIT_FIELD_MOUNTDISPLAYID.

◆ HandleAuraUntrackable()

void AuraEffect::HandleAuraUntrackable ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2775{
2777 return;
2778
2779 Unit* target = aurApp->GetTarget();
2780
2781 if (apply)
2783 else
2784 {
2785 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2786 if (target->HasAuraType(GetAuraType()))
2787 return;
2789 }
2790}
@ UNIT_FIELD_BYTES_1
Definition: UpdateFields.h:131
@ UNIT_STAND_FLAGS_UNTRACKABLE
Definition: Unit.h:70
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition: Unit.h:46
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
2926{
2928 return;
2929
2930 Unit* target = aurApp->GetTarget();
2931
2932 if (Player* targetPlayer = target->ToPlayer())
2933 {
2934 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2935 }
2936
2937 if (!apply)
2938 {
2939 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2940 if (target->HasAuraType(GetAuraType()))
2941 return;
2942 }
2943
2944 target->SetWaterWalking(apply);
2945}
virtual bool SetWaterWalking(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20874

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
5508{
5509 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5510 return;
5511
5512 Unit* target = aurApp->GetTarget();
5513
5514 Unit* caster = GetCaster();
5515
5516 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5517 return;
5518
5519 caster->ToPlayer()->SetViewpoint(target, apply);
5520}
void SetViewpoint(WorldObject *target, bool apply)
Definition: Player.cpp:13062

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

◆ HandleChannelDeathItem()

void AuraEffect::HandleChannelDeathItem ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5463{
5464 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5465 return;
5466
5467 if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
5468 return;
5469
5470 Unit* caster = GetCaster();
5471
5472 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5473 return;
5474
5475 Player* plCaster = caster->ToPlayer();
5476
5477 // Item amount
5478 if (GetAmount() <= 0)
5479 return;
5480
5481 if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
5482 return;
5483
5484 //Adding items
5485 uint32 noSpaceForCount = 0;
5486 uint32 count = m_amount;
5487
5488 ItemPosCountVec dest;
5489 InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount);
5490 if (msg != EQUIP_ERR_OK)
5491 {
5492 count -= noSpaceForCount;
5493 plCaster->SendEquipError(msg, nullptr, nullptr, GetSpellInfo()->Effects[m_effIndex].ItemType);
5494 if (count == 0)
5495 return;
5496 }
5497
5498 Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true);
5499 if (!newitem)
5500 {
5501 plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
5502 return;
5503 }
5504 plCaster->SendNewItem(newitem, count, true, true);
5505}
InventoryResult
Definition: Item.h:40
@ EQUIP_ERR_ITEM_NOT_FOUND
Definition: Item.h:64
@ EQUIP_ERR_OK
Definition: Item.h:41
std::vector< ItemPosCount > ItemPosCountVec
Definition: Player.h:772
@ NULL_BAG
Definition: Unit.h:210
@ NULL_SLOT
Definition: Unit.h:211
@ 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:4776
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0)
Definition: PlayerStorage.cpp:2552
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition: PlayerStorage.cpp:4049
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition: Player.h:1248

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::GetTypeId(), m_amount, m_effIndex, NULL_BAG, NULL_SLOT, Player::SendEquipError(), Player::SendNewItem(), Player::StoreNewItem(), Object::ToPlayer(), and TYPEID_PLAYER.

◆ HandleCharmConvert()

void AuraEffect::HandleCharmConvert ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3231{
3232 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3233 return;
3234
3235 Unit* target = aurApp->GetTarget();
3236
3237 Unit* caster = GetCaster();
3238
3239 if (apply)
3240 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
3241 else
3242 target->RemoveCharmedBy(caster);
3243}
@ CHARM_TYPE_CONVERT
Definition: Unit.h:1078
void RemoveCharmedBy(Unit *charmer)
Definition: Unit.cpp:18720
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition: Unit.cpp:18518

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
5611{
5613 return;
5614
5615 Unit* target = aurApp->GetTarget();
5616
5617 if (apply)
5619 else
5620 {
5621 if (target->HasAuraType(GetAuraType()))
5622 return;
5623
5625 }
5626}
@ UNIT_FLAG2_COMPREHEND_LANG
Definition: Unit.h:491

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
1688{
1690 {
1691 return;
1692 }
1693
1694 Unit* target = aurApp->GetTarget();
1695 if (target->GetTypeId() != TYPEID_PLAYER)
1696 {
1697 return;
1698 }
1699
1700 if (apply)
1701 {
1702 target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1703 }
1704 else
1705 {
1707 {
1709 for (AuraEffect const* aurEff : amoreAuras)
1710 if (GetMiscValue() == aurEff->GetMiscValue())
1711 {
1712 return;
1713 }
1714 }
1715
1716 target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, 1 << (GetMiscValue() - 1));
1717 }
1718}
@ SPELL_AURA_DETECT_AMORE
Definition: SpellAuraDefines.h:233

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, Unit::GetAuraEffectsByType(), GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::HasAuraType(), PLAYER_FIELD_BYTES2, Object::RemoveByteFlag(), Object::SetByteFlag(), SPELL_AURA_DETECT_AMORE, and TYPEID_PLAYER.

◆ HandleEffect() [1/2]

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

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 
)
787{
789 ASSERT(aurApp);
790 HandleEffect(aurApp, mode, apply);
791}
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
5523{
5524 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5525 {
5526 return;
5527 }
5528
5529 Unit* caster = GetCaster();
5530 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5531 {
5532 return;
5533 }
5534
5535 Player* player = caster->ToPlayer();
5536 if (apply)
5537 {
5539 }
5540 else
5541 {
5542 player->ResetFarSightDistance();
5543 }
5544
5545 caster->UpdateObjectVisibility(!apply);
5546}
void SetFarSightDistance(float radius)
Definition: Player.cpp:16151
void ResetFarSightDistance()
Definition: Player.cpp:16156
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2306

References AURA_EFFECT_HANDLE_REAL, GetCaster(), SpellInfo::GetMaxRange(), Object::GetTypeId(), m_spellInfo, Player::ResetFarSightDistance(), Player::SetFarSightDistance(), Object::ToPlayer(), TYPEID_PLAYER, and Unit::UpdateObjectVisibility().

◆ HandleFeignDeath()

void AuraEffect::HandleFeignDeath ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2402{
2403 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2404 return;
2405
2406 Unit* target = aurApp->GetTarget();
2407
2408 if (target->GetTypeId() != TYPEID_PLAYER)
2409 return;
2410
2411 if (Player* targetPlayer = target->ToPlayer())
2412 {
2413 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2414 }
2415
2416 if (apply)
2417 {
2418 /*
2419 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2420 data<<target->GetGUID();
2421 data<<uint8(0);
2422 target->SendMessageToSet(&data, true);
2423 */
2424
2425 UnitList targets;
2426 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
2428 Cell::VisitAllObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2429 for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2430 {
2431 if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2432 continue;
2433
2435 {
2436 if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2437 {
2438 SpellInfo const* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo();
2439 if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->GetTypeId() == TYPEID_UNIT)
2440 {
2441 Creature* c = (*iter)->ToCreature();
2442 if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
2443 continue;
2444 }
2445 bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY)
2446 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
2447 if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST))
2448 {
2449 // at least one effect truly targets an unit, interrupt the spell
2450 interrupt = true;
2451 break;
2452 }
2453 if (interrupt)
2454 (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
2455 }
2456 }
2457 }
2458
2459 if (target->GetInstanceScript() && target->GetInstanceScript()->IsEncounterInProgress())
2460 {
2461 // Xinef: replaced with CombatStop(false)
2462 target->AttackStop();
2463 target->RemoveAllAttackers();
2464 target->getHostileRefMgr().addThreatPercent(-100);
2465 target->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
2466 }
2467 else
2468 {
2469 target->CombatStop();
2471 }
2472
2474
2475 // prevent interrupt message
2476 if (GetCasterGUID() == target->GetGUID())
2477 {
2479 target->FinishSpell(CURRENT_GENERIC_SPELL, true);
2480
2481 // interrupt autoshot
2483 {
2485 target->ToPlayer()->SendAutoRepeatCancel(target);
2486 }
2487 }
2488
2489 target->InterruptNonMeleeSpells(true);
2490
2491 // stop handling the effect if it was removed by linked event
2492 if (aurApp->GetRemoveMode())
2493 return;
2494 // blizz like 2.0.x
2496 // blizz like 2.0.x
2498 // blizz like 2.0.x
2500
2502 }
2503 else
2504 {
2505 /*
2506 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2507 data<<target->GetGUID();
2508 data<<uint8(1);
2509 target->SendMessageToSet(&data, true);
2510 */
2511 // blizz like 2.0.x
2513 // blizz like 2.0.x
2515 // blizz like 2.0.x
2517
2519 }
2520}
@ UNIT_FLAG2_FEIGN_DEATH
Definition: Unit.h:488
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition: Unit.h:984
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:979
@ CURRENT_AUTOREPEAT_SPELL
Definition: Unit.h:981
std::list< Unit * > UnitList
Definition: Unit.h:240
@ UNIT_STATE_DIED
Definition: Unit.h:325
@ UNIT_STATE_CASTING
Definition: Unit.h:340
@ UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
Definition: Unit.h:477
@ TARGET_OBJECT_TYPE_UNIT
Definition: SpellInfo.h:101
@ TARGET_OBJECT_TYPE_UNIT_AND_DEST
Definition: SpellInfo.h:102
@ UNIT_DYNFLAG_DEAD
Definition: SharedDefines.h:3098
@ CREATURE_ELITE_WORLDBOSS
Definition: SharedDefines.h:2706
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition: SharedDefines.h:589
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:3063
bool isWorldBoss() const
Definition: Creature.h:115
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:197
uint32 rank
Definition: CreatureData.h:199
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:10401
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4069
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition: Unit.cpp:4027
void RemoveAllAttackers()
Definition: Unit.cpp:10444
bool AttackStop()
Definition: Unit.cpp:10368
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:420
Definition: GridNotifiers.h:858
virtual bool IsEncounterInProgress() const
Definition: InstanceScript.cpp:121
float GetVisibilityRange() const
Definition: Map.h:350

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(), Object::GetTypeId(), WorldObject::GetVisibilityRange(), Map::GetVisibilityRange(), SpellInfo::HasAttribute(), Unit::InterruptNonMeleeSpells(), Unit::InterruptSpell(), Creature::IsDungeonBoss(), InstanceScript::IsEncounterInProgress(), Unit::IsPet(), 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(), TYPEID_PLAYER, TYPEID_UNIT, 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
3008{
3010 return;
3011
3012 Unit* target = aurApp->GetTarget();
3013
3014 if (apply)
3016 else
3017 {
3018 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3019 if (target->HasAuraType(GetAuraType()))
3020 return;
3022 }
3023}
@ UNIT_FLAG2_FORCE_MOVEMENT
Definition: Unit.h:494

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
5549{
5551 return;
5552
5553 Unit* target = aurApp->GetTarget();
5554
5555 if (target->GetTypeId() != TYPEID_PLAYER)
5556 return;
5557
5558 Player* player = target->ToPlayer();
5559
5560 uint32 faction_id = GetMiscValue();
5561 ReputationRank faction_rank = ReputationRank(m_amount);
5562
5563 player->GetReputationMgr().ApplyForceReaction(faction_id, faction_rank, apply);
5565
5566 // stop fighting if at apply forced rank friendly or at remove real rank friendly
5567 if ((apply && faction_rank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(faction_id) >= REP_FRIENDLY))
5568 player->StopAttackFaction(faction_id);
5569}
ReputationRank
Definition: SharedDefines.h:151
@ REP_FRIENDLY
Definition: SharedDefines.h:156
ReputationRank GetReputationRank(uint32 faction_id) const
Definition: Player.cpp:5763
ReputationMgr & GetReputationMgr()
Definition: Player.h:2076
void StopAttackFaction(uint32 faction_id)
Definition: Unit.cpp:20336
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::GetTypeId(), m_amount, REP_FRIENDLY, ReputationMgr::SendForceReactions(), Unit::StopAttackFaction(), Object::ToPlayer(), and TYPEID_PLAYER.

◆ 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
4578{
4580 return;
4581
4582 Unit* target = aurApp->GetTarget();
4583
4584 // Xinef: Do not apply such auras in normal way
4585 if (GetAmount() >= 1000)
4586 {
4587 target->SetInstantCast(apply);
4588 return;
4589 }
4590
4591 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
4592}
void SetInstantCast(bool set)
Definition: Unit.h:2436
void ApplyCastTimePercentMod(float val, bool apply)
Definition: Unit.cpp:17241

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
3216{
3217 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3218 return;
3219
3220 Unit* target = aurApp->GetTarget();
3221
3222 Unit* caster = GetCaster();
3223
3224 if (apply)
3225 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3226 else
3227 target->RemoveCharmedBy(caster);
3228}
@ CHARM_TYPE_CHARM
Definition: Unit.h:1075

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
3083{
3084 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3085 return;
3086
3087 Unit* target = aurApp->GetTarget();
3088
3089 target->SetControlled(apply, UNIT_STATE_CONFUSED);
3090}
@ UNIT_STATE_CONFUSED
Definition: Unit.h:336

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
4783{
4785 return;
4786
4787 Unit* target = aurApp->GetTarget();
4788
4789 // apply item specific bonuses for already equipped weapon
4790 if (target->GetTypeId() == TYPEID_PLAYER)
4791 {
4792 for (int i = 0; i < MAX_ATTACK; ++i)
4793 if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
4794 target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply);
4795 }
4796
4797 // GetMiscValue() is bitmask of spell schools
4798 // 1 (0-bit) - normal school damage (SPELL_SCHOOL_MASK_NORMAL)
4799 // 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wands
4800 // 127 - full bitmask any damages
4801 //
4802 // mods must be applied base at equipped weapon class and subclass comparison
4803 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
4804 // GetMiscValue() comparison with item generated damage types
4805
4806 if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0 && sScriptMgr->CanModAuraEffectDamageDone(this, target, aurApp, mode, apply))
4807 {
4808 // apply generic physical damage bonuses including wand case
4809 if (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER)
4810 {
4814
4815 if (target->GetTypeId() == TYPEID_PLAYER)
4816 {
4817 if (GetAmount() > 0)
4819 else
4821 }
4822 }
4823 else
4824 {
4825 // done in Player::_ApplyWeaponDependentAuraMods
4826 }
4827 }
4828
4829 // Skip non magic case for Speedup
4831 return;
4832
4833 if (GetSpellInfo()->EquippedItemClass != -1 || GetSpellInfo()->EquippedItemInventoryTypeMask != 0)
4834 {
4835 // wand magic case (skip generic to all item spell bonuses)
4836 // done in Player::_ApplyWeaponDependentAuraMods
4837
4838 // Skip item specific requirements for not wand magic damage
4839 return;
4840 }
4841
4842 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4843 // This information for client side use only
4844 if (target->GetTypeId() == TYPEID_PLAYER)
4845 {
4846 if (GetAmount() > 0)
4847 {
4848 for (uint32 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
4849 {
4850 if ((GetMiscValue() & (1 << i)) != 0)
4852 }
4853 }
4854 else
4855 {
4856 for (uint32 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
4857 {
4858 if ((GetMiscValue() & (1 << i)) != 0)
4860 }
4861 }
4862 if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
4863 pet->UpdateAttackPowerAndDamage();
4864 }
4865}
@ PLAYER_FIELD_MOD_DAMAGE_DONE_POS
Definition: UpdateFields.h:360
@ PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
Definition: UpdateFields.h:361
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:285
@ UNIT_MOD_DAMAGE_RANGED
Definition: Unit.h:286
@ UNIT_MOD_DAMAGE_MAINHAND
Definition: Unit.h:284
@ SPELL_SCHOOL_HOLY
Definition: SharedDefines.h:256
@ SPELL_SCHOOL_MASK_MAGIC
Definition: SharedDefines.h:284
Definition: TemporarySummon.h:95
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition: Object.cpp:815
void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
Definition: Player.cpp:6935

References Player::_ApplyWeaponDependentAuraDamageMod(), Object::ApplyModInt32Value(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), Unit::GetGuardianPet(), GetMiscValue(), GetSpellInfo(), AuraApplication::GetTarget(), Object::GetTypeId(), Player::GetWeaponForAttack(), Unit::HandleStatModifier(), 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, TYPEID_PLAYER, 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
4868{
4870 return;
4871
4872 Unit* target = aurApp->GetTarget();
4873 if (!target)
4874 return;
4875
4876 if (!sScriptMgr->CanModAuraEffectModDamagePercentDone(this, target, aurApp, mode, apply))
4877 return;
4878
4879 if (target->GetTypeId() == TYPEID_PLAYER)
4880 {
4881 for (int i = 0; i < MAX_ATTACK; ++i)
4882 if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), false))
4883 target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply);
4884 }
4885
4886 if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) && (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER))
4887 {
4891
4892 if (target->GetTypeId() == TYPEID_PLAYER)
4894 }
4895 else
4896 {
4897 // done in Player::_ApplyWeaponDependentAuraMods for SPELL_SCHOOL_MASK_NORMAL && EquippedItemClass != -1 and also for wand case
4898 }
4899}
@ 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(), Object::GetTypeId(), Player::GetWeaponForAttack(), Unit::HandleStatModifier(), MAX_ATTACK, PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, SPELL_SCHOOL_MASK_NORMAL, sScriptMgr, Object::ToPlayer(), TOTAL_PCT, TYPEID_PLAYER, 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
3093{
3094 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3095 return;
3096
3097 Unit* target = aurApp->GetTarget();
3098
3099 target->SetControlled(apply, UNIT_STATE_FLEEING, GetCaster(), true);
3100}
@ UNIT_STATE_FLEEING
Definition: Unit.h:332

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
4143{
4145 return;
4146
4147 Unit* target = aurApp->GetTarget();
4148
4149 if (target->GetTypeId() != TYPEID_PLAYER)
4150 return;
4151 // implemented in Unit::SpellHealingBonus
4152 // this information is for client side only
4154}
void UpdateSpellDamageAndHealingBonus()
Definition: StatSystem.cpp:177

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::GetTypeId(), Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateSpellDamageAndHealingBonus().

◆ HandleModHitChance()

void AuraEffect::HandleModHitChance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4493{
4495 return;
4496
4497 Unit* target = aurApp->GetTarget();
4498
4499 if (target->GetTypeId() == TYPEID_PLAYER)
4500 {
4501 target->ToPlayer()->UpdateMeleeHitChances();
4502 target->ToPlayer()->UpdateRangedHitChances();
4503 }
4504 else
4505 {
4506 target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
4507 target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
4508 }
4509}
void UpdateMeleeHitChances()
Definition: StatSystem.cpp:860
void UpdateRangedHitChances()
Definition: StatSystem.cpp:866
float m_modRangedHitChance
Definition: Unit.h:2086
float m_modMeleeHitChance
Definition: Unit.h:2085

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::m_modMeleeHitChance, Unit::m_modRangedHitChance, Object::ToPlayer(), TYPEID_PLAYER, Player::UpdateMeleeHitChances(), and Player::UpdateRangedHitChances().

◆ HandleModInvisibility()

void AuraEffect::HandleModInvisibility ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1530{
1532 return;
1533
1534 Unit* target = aurApp->GetTarget();
1536
1537 if (apply)
1538 {
1539 // apply glow vision
1540 if (target->GetTypeId() == TYPEID_PLAYER && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10))
1542
1543 target->m_invisibility.AddFlag(type);
1544 target->m_invisibility.AddValue(type, GetAmount());
1545 }
1546 else
1547 {
1549 {
1550 // if not have different invisibility auras.
1551 // always remove glow vision
1552 if (target->GetTypeId() == TYPEID_PLAYER)
1554
1555 target->m_invisibility.DelFlag(type);
1556 }
1557 else
1558 {
1559 bool found = false;
1561 for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i)
1562 {
1563 if (GetMiscValue() == (*i)->GetMiscValue())
1564 {
1565 found = true;
1566 break;
1567 }
1568 }
1569 if (!found)
1570 {
1571 target->m_invisibility.DelFlag(type);
1572
1573 // if not have invisibility auras of type INVISIBILITY_GENERAL
1574 // remove glow vision
1576 {
1578 }
1579 }
1580 }
1581
1582 target->m_invisibility.AddValue(type, -GetAmount());
1583 }
1584
1585 // call functions which may have additional effects after chainging state of unit
1586 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1587 {
1588 // drop flag at invisibiliy in bg
1590 }
1591
1592 target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1593 target->bRequestForcedVisibilityUpdate = false;
1594}
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition: Player.h:570
@ PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION
Definition: Player.h:547
@ SPELL_AURA_MOD_INVISIBILITY
Definition: SpellAuraDefines.h:81
InvisibilityType
Definition: SharedDefines.h:1226
@ INVISIBILITY_UNK10
Definition: SharedDefines.h:1237
@ INVISIBILITY_GENERAL
Definition: SharedDefines.h:1227
bool HasFlag(FLAG_TYPE flag) const
Definition: Object.h:355
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition: Object.h:506
bool IsPlayer() const
Definition: ObjectGuid.h:170
bool bRequestForcedVisibilityUpdate
Definition: Unit.h:2413
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1814
bool Instanceable() const
Definition: Map.h:446

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(), Object::GetTypeId(), Unit::HasAuraType(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::HasFlag(), Map::Instanceable(), INVISIBILITY_GENERAL, INVISIBILITY_UNK10, 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, TYPEID_PLAYER, and Unit::UpdateObjectVisibility().

◆ HandleModInvisibilityDetect()

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

◆ HandleModManaRegen()

void AuraEffect::HandleModManaRegen ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4276{
4278 return;
4279
4280 Unit* target = aurApp->GetTarget();
4281
4282 if (target->GetTypeId() != TYPEID_PLAYER)
4283 return;
4284
4285 //Note: an increase in regen does NOT cause threat.
4286 target->ToPlayer()->UpdateManaRegen();
4287}
void UpdateManaRegen()
Definition: StatSystem.cpp:931

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::GetTypeId(), Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateManaRegen().

Referenced by HandleAuraModRegenInterrupt().

◆ HandleModMechanicImmunity()

void AuraEffect::HandleModMechanicImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3729{
3730 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3731 return;
3732
3733 Unit* target = aurApp->GetTarget();
3734 uint32 mechanic = 0;
3735
3736 switch (GetId())
3737 {
3738 case 46924: // BladeStorm
3740 break;
3741 case 34471: // The Beast Within
3742 case 19574: // Bestial Wrath
3760 break;
3761 case 42292: // PvP trinket
3762 case 59752: // Every Man for Himself
3763 case 65547: // PvP trinket for Faction Champions (ToC 25)
3764 case 53490: // Bullheaded
3765 case 46227: // Medalion of Immunity
3767 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.
3768 // Actually we should apply immunities here, too, but the aura has only 100 ms duration, so there is practically no point
3769 break;
3770 case 54508: // Demonic Empowerment
3771 mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
3776 break;
3777 default:
3778 if (GetMiscValue() < 1)
3779 return;
3780 mechanic = 1 << GetMiscValue();
3782 break;
3783 }
3784
3785 if (apply && GetSpellInfo()->HasAttribute(SPELL_ATTR1_IMMUNITY_PURGES_EFFECT))
3786 {
3787 // Xinef: exception for purely snare mechanic (eg. hands of freedom)!
3788 if (mechanic == (1 << MECHANIC_SNARE))
3789 target->RemoveMovementImpairingAuras(false);
3790 else
3792 }
3793}
@ SPELL_AURA_PREVENTS_FLEEING
Definition: SpellAuraDefines.h:155
@ AURA_REMOVE_BY_DEFAULT
Definition: SpellAuraDefines.h:392
@ MECHANIC_FEAR
Definition: SharedDefines.h:1302
@ MECHANIC_DISORIENTED
Definition: SharedDefines.h:1299
@ MECHANIC_KNOCKOUT
Definition: SharedDefines.h:1311
@ MECHANIC_CHARM
Definition: SharedDefines.h:1298
@ MECHANIC_TURN
Definition: SharedDefines.h:1320
@ MECHANIC_STUN
Definition: SharedDefines.h:1309
@ MECHANIC_FREEZE
Definition: SharedDefines.h:1310
@ MECHANIC_ROOT
Definition: SharedDefines.h:1304
@ MECHANIC_SLEEP
Definition: SharedDefines.h:1307
@ MECHANIC_DAZE
Definition: SharedDefines.h:1324
@ MECHANIC_SNARE
Definition: SharedDefines.h:1308
@ MECHANIC_SHACKLE
Definition: SharedDefines.h:1317
@ MECHANIC_SAPPED
Definition: SharedDefines.h:1327
@ MECHANIC_HORROR
Definition: SharedDefines.h:1321
#define IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK
Definition: SharedDefines.h:1333
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition: Unit.cpp:5173
void RemoveMovementImpairingAuras(bool withRoot)
Definition: Unit.cpp:5149

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
4059{
4061 return;
4062
4063 Unit* target = aurApp->GetTarget();
4064
4065 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4066 {
4067 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4068 return;
4069 }
4070
4071 // only players have base stats
4072 if (target->GetTypeId() != TYPEID_PLAYER)
4073 return;
4074
4075 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
4076 {
4077 if (GetMiscValue() == i || GetMiscValue() == -1)
4078 target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_amount), apply);
4079 }
4080}

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

◆ HandleModPossess()

void AuraEffect::HandleModPossess ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3141{
3142 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3143 return;
3144
3145 Unit* target = aurApp->GetTarget();
3146
3147 Unit* caster = GetCaster();
3148
3149 // no support for posession AI yet
3150 if (caster && caster->GetTypeId() == TYPEID_UNIT)
3151 {
3152 HandleModCharm(aurApp, mode, apply);
3153 return;
3154 }
3155
3156 if (apply)
3157 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3158 else
3159 target->RemoveCharmedBy(caster);
3160}
@ CHARM_TYPE_POSSESS
Definition: Unit.h:1076
void HandleModCharm(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3215

References AURA_EFFECT_HANDLE_REAL, CHARM_TYPE_POSSESS, GetCaster(), AuraApplication::GetTarget(), Object::GetTypeId(), HandleModCharm(), Unit::RemoveCharmedBy(), Unit::SetCharmedBy(), and TYPEID_UNIT.

◆ HandleModPossessPet()

void AuraEffect::HandleModPossessPet ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3163{
3164 // Used by spell "Eyes of the Beast"
3165
3166 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3167 return;
3168
3169 Unit* caster = GetCaster();
3170 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
3171 return;
3172
3173 //seems it may happen that when removing it is no longer owner's pet
3174 //if (caster->ToPlayer()->GetPet() != target)
3175 // return;
3176
3177 Unit* target = aurApp->GetTarget();
3178 if (target->GetTypeId() != TYPEID_UNIT || !target->IsPet())
3179 return;
3180
3181 Pet* pet = target->ToPet();
3182
3183 if (apply)
3184 {
3185 if (caster->ToPlayer()->GetPet() != pet)
3186 return;
3187
3188 // Must clear current motion or pet leashes back to owner after a few yards
3189 // when under spell 'Eyes of the Beast'
3190 pet->GetMotionMaster()->Clear();
3191 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3192 }
3193 else
3194 {
3195 pet->RemoveCharmedBy(caster);
3196
3197 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
3198 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
3199 else
3200 {
3201 // Reinitialize the pet bar or it will appear greyed out
3202 caster->ToPlayer()->PetSpellInitialize();
3203
3204 // Follow owner only if not fighting or owner didn't click "stay" at new location
3205 // This may be confusing because pet bar shows "stay" when under the spell but it retains
3206 // the "follow" flag. Player MUST click "stay" while under the spell.
3207 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3208 {
3210 }
3211 }
3212 }
3213}
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:45
#define PET_FOLLOW_DIST
Definition: PetDefines.h:193
@ COMMAND_STAY
Definition: Unit.h:1030
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:872
void PetSpellInitialize()
Definition: Player.cpp:9366
bool HasCommandState(CommandStates state) const
Definition: Unit.h:1104
Pet * ToPet()
Definition: Unit.h:2398
CharmInfo * GetCharmInfo()
Definition: Unit.h:1883
Unit * GetVictim() const
Definition: Unit.h:1386
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
Definition: MotionMaster.cpp:367
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(), Object::GetTypeId(), Unit::GetVictim(), Map::GetVisibilityRange(), CharmInfo::HasCommandState(), Unit::IsPet(), WorldObject::IsWithinDistInMap(), MotionMaster::MoveFollow(), PET_FOLLOW_DIST, PET_SAVE_NOT_IN_SLOT, Player::PetSpellInitialize(), Pet::Remove(), Unit::RemoveCharmedBy(), Unit::SetCharmedBy(), Unit::ToPet(), Object::ToPlayer(), TYPEID_PLAYER, and TYPEID_UNIT.

◆ HandleModPowerCost()

void AuraEffect::HandleModPowerCost ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4944{
4946 return;
4947
4948 Unit* target = aurApp->GetTarget();
4949
4950 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
4951 if (GetMiscValue() & (1 << i))
4953}
@ 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
4931{
4933 return;
4934
4935 Unit* target = aurApp->GetTarget();
4936
4937 float amount = CalculatePct(1.0f, GetAmount());
4938 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
4939 if (GetMiscValue() & (1 << i))
4941}
@ 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
4253{
4255 return;
4256
4257 Unit* target = aurApp->GetTarget();
4258
4259 if (target->GetTypeId() != TYPEID_PLAYER)
4260 return;
4261
4262 // Update manaregen value
4263 if (GetMiscValue() == POWER_MANA)
4264 target->ToPlayer()->UpdateManaRegen();
4265 else if (GetMiscValue() == POWER_RUNE)
4267 // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
4268}
@ POWER_RUNE
Definition: SharedDefines.h:246
void UpdateRuneRegen(RuneType rune)
Definition: StatSystem.cpp:965

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

Referenced by HandleModPowerRegenPCT().

◆ HandleModPowerRegenPCT()

void AuraEffect::HandleModPowerRegenPCT ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4271{
4272 HandleModPowerRegen(aurApp, mode, apply);
4273}
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:4252

References HandleModPowerRegen().

◆ HandleModRating()

void AuraEffect::HandleModRating ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4669{
4671 return;
4672
4673 Unit* target = aurApp->GetTarget();
4674
4675 if (target->GetTypeId() != TYPEID_PLAYER)
4676 return;
4677
4678 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4679 if (GetMiscValue() & (1 << rating))
4680 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
4681}
#define MAX_COMBAT_RATING
Definition: Unit.h:431
CombatRating
Definition: Unit.h:403
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition: Player.cpp:5161

References Player::ApplyRatingMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), MAX_COMBAT_RATING, Object::ToPlayer(), and TYPEID_PLAYER.

◆ HandleModRatingFromStat()

void AuraEffect::HandleModRatingFromStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4684{
4686 return;
4687
4688 Unit* target = aurApp->GetTarget();
4689
4690 if (target->GetTypeId() != TYPEID_PLAYER)
4691 return;
4692
4693 // Just recalculate ratings
4694 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4695 if (GetMiscValue() & (1 << rating))
4696 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
4697}

References Player::ApplyRatingMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), MAX_COMBAT_RATING, Object::ToPlayer(), and TYPEID_PLAYER.

◆ HandleModResistancePercent()

void AuraEffect::HandleModResistancePercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3975{
3977 return;
3978
3979 Unit* target = aurApp->GetTarget();
3980
3981 for (int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
3982 {
3983 if (GetMiscValue() & int32(1 << i))
3984 {
3986 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3987 {
3988 target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)GetAmount(), apply);
3989 target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)GetAmount(), apply);
3990 }
3991 }
3992 }
3993}
void ApplyResistanceBuffModsPercentMod(SpellSchools school, bool positive, float val, bool apply)
Definition: Unit.h:2028

References Unit::ApplyResistanceBuffModsPercentMod(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::HandleStatModifier(), Unit::IsPet(), MAX_SPELL_SCHOOL, SPELL_SCHOOL_NORMAL, TOTAL_PCT, TYPEID_PLAYER, 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
4538{
4540 return;
4541
4542 Unit* target = aurApp->GetTarget();
4543
4544 if (target->GetTypeId() != TYPEID_PLAYER)
4545 return;
4546
4547 for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
4548 if (GetMiscValue() & (1 << school))
4549 target->ToPlayer()->UpdateSpellCritChance(school);
4550}
void UpdateSpellCritChance(uint32 school)
Definition: StatSystem.cpp:829

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), MAX_SPELL_SCHOOL, SPELL_SCHOOL_NORMAL, Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateSpellCritChance().

◆ HandleModSpellDamagePercentFromAttackPower()

void AuraEffect::HandleModSpellDamagePercentFromAttackPower ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4113{
4115 return;
4116
4117 Unit* target = aurApp->GetTarget();
4118
4119 if (target->GetTypeId() != TYPEID_PLAYER)
4120 return;
4121
4122 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4123 // This information for client side use only
4124 // Recalculate bonus
4126}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::GetTypeId(), Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateSpellDamageAndHealingBonus().

◆ HandleModSpellDamagePercentFromStat()

void AuraEffect::HandleModSpellDamagePercentFromStat ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4083{
4085 return;
4086
4087 Unit* target = aurApp->GetTarget();
4088
4089 if (target->GetTypeId() != TYPEID_PLAYER)
4090 return;
4091
4092 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4093 // This information for client side use only
4094 // Recalculate bonus
4096}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, AuraApplication::GetTarget(), Object::GetTypeId(), Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateSpellDamageAndHealingBonus().

◆ HandleModSpellHealingPercentFromAttackPower()

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

◆ HandleModSpellHealingPercentFromStat()

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

◆ HandleModSpellHitChance()

void AuraEffect::HandleModSpellHitChance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4512{
4514 return;
4515
4516 Unit* target = aurApp->GetTarget();
4517
4518 if (target->GetTypeId() == TYPEID_PLAYER)
4519 target->ToPlayer()->UpdateSpellHitChances();
4520 else
4521 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
4522}
void UpdateSpellHitChances()
Definition: StatSystem.cpp:872
float m_modSpellHitChance
Definition: Unit.h:2087

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::m_modSpellHitChance, Object::ToPlayer(), TYPEID_PLAYER, and Player::UpdateSpellHitChances().

◆ HandleModStateImmunityMask()

void AuraEffect::HandleModStateImmunityMask ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3409{
3410 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3411 return;
3412
3413 Unit* target = aurApp->GetTarget();
3414 std::list <AuraType> aura_immunity_list;
3415 uint32 mechanic_immunity_list = 0;
3416 int32 miscVal = GetMiscValue();
3417
3418 switch (miscVal)
3419 {
3420 case 96:
3421 case 1615:
3422 {
3423 if (!GetAmount())
3424 {
3425 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3426 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3427 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3428 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3430 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3431
3444 aura_immunity_list.push_back(SPELL_AURA_MOD_CHARM);
3445 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3446 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3447 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3448 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3449 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3450 }
3451 break;
3452 }
3453 case 679:
3454 {
3455 if (GetId() == 57742)
3456 {
3457 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3458 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3459 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3460 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3462 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3463
3476 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3477 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3478 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3479 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3480 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3481 }
3482 break;
3483 }
3484 case 1557:
3485 {
3486 if (GetId() == 64187)
3487 {
3488 mechanic_immunity_list = (1 << MECHANIC_STUN);
3490 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3491 }
3492 else
3493 {
3494 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3495 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3496 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3497 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3499 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3500
3513 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3514 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3515 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3516 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3517 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3518 }
3519 break;
3520 }
3521 case 1614:
3522 case 1694:
3523 {
3525 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3526 break;
3527 }
3528 case 1630:
3529 {
3530 if (!GetAmount())
3531 {
3533 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3534 }
3535 else
3536 {
3537 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3538 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3539 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3540 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3542 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3543
3556 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3557 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3558 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3559 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3560 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3561 }
3562 break;
3563 }
3564 case 477:
3565 case 1733:
3566 case 1632:
3567 {
3568 if (!GetAmount())
3569 {
3570 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3571 | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3572 | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3573 | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3575 | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN) | (1 << MECHANIC_BANISH);
3576
3592 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3593
3594 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3595 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3596 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3597 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3598 }
3599 break;
3600 }
3601 case 878:
3602 {
3603 if (GetAmount() == 1)
3604 {
3605 mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN)
3606 | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE);
3607
3612 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3613 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3614 }
3615 break;
3616 }
3617 default:
3618 break;
3619 }
3620
3621 if (aura_immunity_list.empty())
3622 {
3623 // Roots, OK
3624 if (GetMiscValue() & (1 << 0))
3625 {
3626 mechanic_immunity_list = (1 << MECHANIC_SNARE);
3627
3629 aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3630 }
3631 // Taunt, OK
3632 if (GetMiscValue() & (1 << 1))
3633 {
3634 aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3635 }
3636 // Crowd-Control auras?
3637 if (GetMiscValue() & (1 << 2))
3638 {
3639 mechanic_immunity_list = (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED);
3640
3643 aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3644 }
3645 // Interrupt, OK
3646 if (GetMiscValue() & (1 << 3))
3647 {
3648 mechanic_immunity_list = (1 << MECHANIC_INTERRUPT);
3649
3651 }
3652 // Transform?
3653 if (GetMiscValue() & (1 << 4))
3654 {
3655 aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
3656 }
3657 // Stun auras breakable by damage (Incapacitate effects), OK
3658 if (GetMiscValue() & (1 << 5))
3659 {
3660 mechanic_immunity_list = (1 << MECHANIC_KNOCKOUT);
3661
3663 }
3664 // // Slowing effects
3665 if (GetMiscValue() & (1 << 6))
3666 {
3667 mechanic_immunity_list = (1 << MECHANIC_SNARE);
3668
3670 aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3671 }
3672 // Charm auras?, 90%
3673 if ((GetMiscValue() & (1 << 7)))
3674 {
3675 mechanic_immunity_list = (1 << MECHANIC_CHARM);
3676
3678 aura_immunity_list.push_back(SPELL_AURA_MOD_CHARM);
3679 aura_immunity_list.push_back(SPELL_AURA_MOD_POSSESS);
3680 }
3681 // UNK
3682 // if ((GetMiscValue() & (1 << 8)))
3683 // {
3684 // }
3685 // Fear, OK
3686 if (GetMiscValue() & (1 << 9))
3687 {
3688 mechanic_immunity_list = (1 << MECHANIC_FEAR);
3689
3691 aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3692 }
3693 // Stuns, OK
3694 if (GetMiscValue() & (1 << 10))
3695 {
3696 mechanic_immunity_list = (1 << MECHANIC_STUN);
3697
3699 aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3700 }
3701 }
3702
3703 // apply immunities
3704 for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
3705 target->ApplySpellImmune(GetId(), IMMUNITY_STATE, *iter, apply);
3706
3707 // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated.
3708 if (GetId() == 46924)
3709 {
3710 if (apply)
3711 {
3712 target->resetAttackTimer();
3714 }
3715
3716 // Knockback and hex
3718 }
3719
3721 {
3722 target->RemoveAurasWithMechanic(mechanic_immunity_list, AURA_REMOVE_BY_DEFAULT, GetId());
3723 for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
3724 target->RemoveAurasByType(*iter);
3725 }
3726}
@ 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:864
@ SPELL_EFFECT_KNOCK_BACK_DEST
Definition: SharedDefines.h:894
@ SPELL_EFFECT_KNOCK_BACK
Definition: SharedDefines.h:848
@ MECHANIC_INTERRUPT
Definition: SharedDefines.h:1323
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition: Unit.cpp:661

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, OFF_ATTACK, Unit::RemoveAurasByType(), Unit::RemoveAurasWithMechanic(), Unit::resetAttackTimer(), 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
1622{
1624 return;
1625
1626 Unit* target = aurApp->GetTarget();
1628
1629 if (apply)
1630 {
1631 target->m_stealth.AddFlag(type);
1632 target->m_stealth.AddValue(type, GetAmount());
1633
1635 if (target->GetTypeId() == TYPEID_PLAYER)
1637
1638 // interrupt autoshot
1640 {
1642 target->ToPlayer()->SendAutoRepeatCancel(target);
1643 }
1644 }
1645 else
1646 {
1647 target->m_stealth.AddValue(type, -GetAmount());
1648
1649 if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
1650 {
1651 target->m_stealth.DelFlag(type);
1652
1654 if (target->GetTypeId() == TYPEID_PLAYER)
1656 }
1657 }
1658
1659 // call functions which may have additional effects after chainging state of unit
1660 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1661 {
1662 // drop flag at stealth in bg
1664 }
1665
1666 target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
1667 target->bRequestForcedVisibilityUpdate = false;
1668}
@ PLAYER_FIELD_BYTE2_STEALTH
Definition: Player.h:569
@ UNIT_STAND_FLAGS_CREEP
Definition: Unit.h:69
@ SPELL_AURA_MOD_STEALTH
Definition: SpellAuraDefines.h:79
StealthType
Definition: SharedDefines.h:1218
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:503
void RemoveStandFlags(uint8 flags)
Definition: Unit.h:1540
void SetStandFlags(uint8 flags)
Definition: Unit.h:1539

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(), Object::GetTypeId(), Unit::HasAuraType(), Map::Instanceable(), 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(), TYPEID_PLAYER, UNIT_STAND_FLAGS_CREEP, and Unit::UpdateObjectVisibility().

◆ HandleModStealthDetect()

void AuraEffect::HandleModStealthDetect ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1597{
1599 return;
1600
1601 Unit* target = aurApp->GetTarget();
1603
1604 if (apply)
1605 {
1606 target->m_stealthDetect.AddFlag(type);
1607 target->m_stealthDetect.AddValue(type, GetAmount());
1608 }
1609 else
1610 {
1612 target->m_stealthDetect.DelFlag(type);
1613
1614 target->m_stealthDetect.AddValue(type, -GetAmount());
1615 }
1616
1617 // call functions which may have additional effects after chainging state of unit
1618 target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer());
1619}
@ SPELL_AURA_MOD_STEALTH_DETECT
Definition: SpellAuraDefines.h:80
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition: Object.h:504

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

◆ HandleModStealthLevel()

void AuraEffect::HandleModStealthLevel ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1671{
1673 return;
1674
1675 Unit* target = aurApp->GetTarget();
1677
1678 if (apply)
1679 target->m_stealth.AddValue(type, GetAmount());
1680 else
1681 target->m_stealth.AddValue(type, -GetAmount());
1682
1683 // call functions which may have additional effects after chainging state of unit
1684 target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer());
1685}

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddValue(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, GetAmount(), GetMiscValue(), Unit::GetOwnerGUID(), AuraApplication::GetTarget(), Object::GetTypeId(), ObjectGuid::IsPlayer(), WorldObject::m_stealth, TYPEID_PLAYER, and Unit::UpdateObjectVisibility().

◆ HandleModTargetResistance()

void AuraEffect::HandleModTargetResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4011{
4013 return;
4014
4015 Unit* target = aurApp->GetTarget();
4016
4017 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
4018
4019 // show armor penetration
4022
4023 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
4026}
@ 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:280

References Object::ApplyModInt32Value(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Object::GetTypeId(), PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE, PLAYER_FIELD_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL, SPELL_SCHOOL_MASK_SPELL, and TYPEID_PLAYER.

◆ HandleModTaunt()

void AuraEffect::HandleModTaunt ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3056{
3057 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3058 return;
3059
3060 Unit* target = aurApp->GetTarget();
3061
3062 if (!target->IsAlive() || !target->CanHaveThreatList())
3063 return;
3064
3065 Unit* caster = GetCaster();
3066 if (!caster || !caster->IsAlive())
3067 return;
3068
3069 if (apply)
3070 target->TauntApply(caster);
3071 else
3072 {
3073 // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat
3074 target->TauntFadeOut(caster);
3075 }
3076}
void TauntApply(Unit *victim)
Definition: Unit.cpp:14559
void TauntFadeOut(Unit *taunter)
Definition: Unit.cpp:14587

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
3030{
3032 return;
3033
3034 Unit* target = aurApp->GetTarget();
3035 for (int8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
3036 if (GetMiscValue() & (1 << i))
3037 ApplyPercentModFloatVar(target->m_threatModifier[i], float(GetAmount()), apply);
3038}
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition: Util.h:50
float m_threatModifier[MAX_SPELL_SCHOOL]
Definition: Unit.h:2090

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
4157{
4159 return;
4160
4161 Unit* target = aurApp->GetTarget();
4162
4163 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4164 {
4165 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4166 return;
4167 }
4168
4169 // save current health state
4170 float healthPct = target->GetHealthPct();
4171 bool alive = target->IsAlive();
4172 float value = GetAmount();
4173
4174 if (GetId() == 67480) // xinef: hack fix for blessing of sanctuary stats stack with blessing of kings...
4175 {
4176 if (value) // not turned off
4177 value = 10.0f;
4178 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4179 {
4180 if (i == STAT_STRENGTH || i == STAT_STAMINA)
4181 {
4182 if (apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet()))
4183 target->ApplyStatPercentBuffMod(Stats(i), value, apply);
4184
4185 target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply);
4186
4187 if (!apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet()))
4188 target->ApplyStatPercentBuffMod(Stats(i), value, apply);
4189 }
4190 }
4191 return;
4192 }
4193
4194 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4195 {
4196 if (GetMiscValue() == i || GetMiscValue() == -1)
4197 {
4198 if (apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet()))
4199 target->ApplyStatPercentBuffMod(Stats(i), value, apply);
4200
4201 target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply);
4202
4203 if (!apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet()))
4204 target->ApplyStatPercentBuffMod(Stats(i), value, apply);
4205 }
4206 }
4207
4208 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_UNK4 0x00000010 flag)
4210 target->SetHealth(std::max<uint32>(uint32(healthPct * target->GetMaxHealth() * 0.01f), (alive ? 1 : 0)));
4211}
@ SPELL_ATTR0_IS_ABILITY
Definition: SharedDefines.h:358
@ STAT_STAMINA
Definition: SharedDefines.h:232
void ApplyStatPercentBuffMod(Stats stat, float val, bool apply)
Definition: Unit.cpp:15229

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

◆ HandleModUnattackable()

void AuraEffect::HandleModUnattackable ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2523{
2525 return;
2526
2527 Unit* target = aurApp->GetTarget();
2528
2529 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2530 if (!apply && target->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
2531 return;
2532
2534
2535 // call functions which may have additional effects after chainging state of unit
2536 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
2537 {
2538 // xinef: this aura should not stop combat (movie with sindragosa proves that)
2539 //target->CombatStop();
2541 }
2542}
@ UNIT_FLAG_NON_ATTACKABLE
Definition: Unit.h:449
@ 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
161 {
162 // aura type not have immediate effect at add/remove and handled by ID in other code place
163 }

◆ HandleNoReagentUseAura()

void AuraEffect::HandleNoReagentUseAura ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4974{
4975 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4976 return;
4977
4978 Unit* target = aurApp->GetTarget();
4979
4980 if (target->GetTypeId() != TYPEID_PLAYER)
4981 return;
4982
4983 flag96 mask;
4985 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
4986 mask |= (*i)->m_spellInfo->Effects[(*i)->m_effIndex].SpellClassMask;
4987
4988 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1, mask[0]);
4989 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 1, mask[1]);
4990 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2, mask[2]);
4991}
@ PLAYER_NO_REAGENT_COST_1
Definition: UpdateFields.h:387
@ SPELL_AURA_NO_REAGENT_USE
Definition: SpellAuraDefines.h:319
Definition: Util.h:446

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

◆ HandleNULL()

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

◆ HandleObsModPowerAuraTick()

void AuraEffect::HandleObsModPowerAuraTick ( Unit target,
Unit caster 
) const
6741{
6743 if (GetMiscValue() == POWER_ALL)
6744 PowerType = target->getPowerType();
6745 else
6747
6748 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
6749 return;
6750
6751 if (target->HasUnitState(UNIT_STATE_ISOLATED))
6752 {
6753 SendTickImmune(target, caster);
6754 return;
6755 }
6756
6757 // don't regen when permanent aura target has full power
6758 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
6759 return;
6760
6761 // ignore negative values (can be result apply spellmods to aura damage
6762 uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(PowerType) / 100;
6763 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
6764 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
6765 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
6766 target->SendPeriodicAuraLog(&pInfo);
6767
6768 int32 gain = target->ModifyPower(PowerType, amount);
6769
6770 if (caster)
6771 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
6772}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
@ POWER_ALL
Definition: SharedDefines.h:249
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:931
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:14051
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1462
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1398
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition: Unit.cpp:6301
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1090

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
6252{
6253 if (!target->IsAlive())
6254 return;
6255
6256 if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamageOrSchool(GetSpellInfo()) || target->IsTotem())
6257 {
6258 SendTickImmune(target, caster);
6259 return;
6260 }
6261
6262 // Consecrate ticks can miss and will not show up in the combat log
6263 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6264 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6265 return;
6266
6267 // some auras remove at specific health level or more
6269 {
6270 switch (GetSpellInfo()->Id)
6271 {
6272 case 43093:
6273 case 31956:
6274 case 38801: // Grievous Wound
6275 case 35321:
6276 case 38363:
6277 case 39215: // Gushing Wound
6278 if (target->IsFullHealth())
6279 {
6280 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6281 return;
6282 }
6283 break;
6284 case 38772: // Grievous Wound
6285 {
6286 uint32 percent = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster);
6287 if (!target->HealthBelowPct(percent))
6288 {
6289 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6290 return;
6291 }
6292 break;
6293 }
6294 }
6295 }
6296
6298
6299 // ignore non positive values (can be result apply spellmods to aura damage
6300 uint32 damage = std::max(GetAmount(), 0);
6301
6302 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6303 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6304
6306 {
6307 // xinef: leave only target depending bonuses, rest is handled in calculate amount
6308 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE && caster)
6309 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6310 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6311
6312 // Calculate armor mitigation
6314 {
6315 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6316 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6317 damage = damageReductedArmor;
6318 }
6319
6320 // Curse of Agony damage-per-tick calculation
6321 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x400) && GetSpellInfo()->SpellIconID == 544)
6322 {
6323 uint32 totalTick = GetTotalTicks();
6324 // 1..4 ticks, 1/2 from normal tick damage
6325 if (m_tickNumber <= totalTick / 3)
6326 damage = damage / 2;
6327 // 9..12 ticks, 3/2 from normal tick damage
6328 else if (m_tickNumber > totalTick * 2 / 3)
6329 damage += (damage + 1) / 2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
6330 // 5..8 ticks have normal tick damage
6331 }
6332 }
6333 else // xinef: ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
6334 damage = uint32(std::ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
6335
6336 // calculate crit chance
6337 bool crit = false;
6338 if ((crit = roll_chance_f(GetCritChance())))
6339 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6340
6341 // Auras reducing damage from AOE spells
6342 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
6343 {
6344 damage = target->CalculateAOEDamageReduction(damage, GetSpellInfo()->SchoolMask, caster);
6345 }
6346
6347 int32 dmg = damage;
6348 int32 mitigatedDamage = cleanDamage.mitigated_damage;
6349 if (CanApplyResilience())
6350 {
6351 int32 resilienceReduction = dmg;
6352 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6353
6354 resilienceReduction = dmg - resilienceReduction;
6355 dmg -= resilienceReduction;
6356 mitigatedDamage += resilienceReduction;
6357 }
6358
6359 damage = std::max(0, dmg);
6360 cleanDamage.mitigated_damage = std::max(0, mitigatedDamage);
6361
6362 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6363 Unit::CalcAbsorbResist(dmgInfo);
6364
6365 uint32 absorb = dmgInfo.GetAbsorb();
6366 uint32 resist = dmgInfo.GetResist();
6367 damage = dmgInfo.GetDamage();
6368
6369 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} attacked {} for {} dmg inflicted by {} abs is {}",
6370 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6371 Unit::DealDamageMods(target, damage, &absorb);
6372
6373 // Set trigger flag
6374 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6375 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6377 if (absorb > 0)
6378 procEx |= PROC_EX_ABSORB;
6379
6380 if (damage)
6381 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6382
6383 int32 overkill = damage - target->GetHealth();
6384 if (overkill < 0)
6385 overkill = 0;
6386
6387 SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
6388 target->SendPeriodicAuraLog(&pInfo);
6389
6390 Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
6391
6392 Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6393}
bool roll_chance_f(float chance)
Definition: Random.h:53
@ CR_CRIT_TAKEN_SPELL
Definition: Unit.h:420
@ MELEE_HIT_NORMAL
Definition: Unit.h:717
@ 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:31
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
Definition: SharedDefines.h:777
@ SPELLFAMILY_WARLOCK
Definition: SharedDefines.h:3505
@ SPELL_MISS_NONE
Definition: SharedDefines.h:1491
Definition: Unit.h:746
uint32 mitigated_damage
Definition: Unit.h:751
Definition: Unit.h:761
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:2001
int32 CalculateAOEDamageReduction(int32 damage, uint32 schoolMask, Unit *caster) const
Definition: Unit.cpp:20639
bool IsFullHealth() const
Definition: Unit.h:1443
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition: Unit.cpp:3424
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition: Unit.cpp:12199
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:1444
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition: Unit.cpp:11709
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition: Unit.cpp:19095
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:6290
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition: Unit.cpp:1978
bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:12812
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false)
Definition: Unit.cpp:2117
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition: Unit.cpp:805
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:815
bool CanApplyResilience() const
Definition: SpellAuraEffects.h:110
float GetCritChance() const
Definition: SpellAuraEffects.h:107
int32 GetTotalTicks() const
Definition: SpellAuraEffects.cpp:7006
uint8 GetCasterLevel() const
Definition: SpellAuraEffects.h:109

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(), 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, 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(), Unit::SendPeriodicAuraLog(), SendTickImmune(), SPELL_AURA_PERIODIC_DAMAGE, 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
5834{
5835 switch (GetSpellInfo()->SpellFamilyName)
5836 {
5837 case SPELLFAMILY_DRUID:
5838 {
5839 switch (GetSpellInfo()->Id)
5840 {
5841 // Frenzied Regeneration
5842 case 22842:
5843 {
5844 // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health.
5845 // Should be manauser
5846 if (target->getPowerType() != POWER_RAGE)
5847 break;
5848 uint32 rage = target->GetPower(POWER_RAGE);
5849 // Nothing todo
5850 if (rage == 0)
5851 break;
5852 int32 mod = (rage < 100) ? rage : 100;
5853 int32 points = target->CalculateSpellDamage(target, GetSpellInfo(), 1);
5854 int32 regen = target->GetMaxHealth() * (mod * points / 10) / 1000;
5855 target->CastCustomSpell(target, 22845, &regen, 0, 0, true, 0, this);
5856 target->SetPower(POWER_RAGE, rage - mod);
5857 break;
5858 }
5859 }
5860 break;
5861 }
5862 case SPELLFAMILY_HUNTER:
5863 {
5864 // Explosive Shot
5865 if (GetSpellInfo()->SpellFamilyFlags[1] & 0x80000000)
5866 {
5867 if (caster)
5868 caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, target, true, nullptr, this);
5869 break;
5870 }
5871 switch (GetSpellInfo()->Id)
5872 {
5873 // Feeding Frenzy Rank 1
5874 case 53511:
5875 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
5876 target->CastSpell(target, 60096, true, 0, this);
5877 return;
5878 // Feeding Frenzy Rank 2
5879 case 53512:
5880 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
5881 target->CastSpell(target, 60097, true, 0, this);
5882 return;
5883 default:
5884 break;
5885 }
5886 break;
5887 }
5888 case SPELLFAMILY_SHAMAN:
5889 if (GetId() == 52179) // Astral Shift
5890 {
5891 // Periodic need for remove visual on stun/fear/silence lost
5893 target->RemoveAurasDueToSpell(52179);
5894 break;
5895 }
5896 break;
5898 switch (GetId())
5899 {
5900 case 49016: // Hysteria
5901 uint32 damage = uint32(target->CountPctFromMaxHealth(1));
5902 Unit::DealDamage(target, target, damage, nullptr, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
5903 break;
5904 }
5905 // Blood of the North
5906 // Reaping
5907 // Death Rune Mastery
5908 if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
5909 {
5910 if (target->GetTypeId() != TYPEID_PLAYER)
5911 return;
5912 if (target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
5913 return;
5914
5915 // timer expired - remove death runes
5916 target->ToPlayer()->RemoveRunesByAuraEffect(this);
5917 }
5918 break;
5919 default:
5920 break;
5921 }
5922}
@ NODAMAGE
Definition: Unit.h:439
@ UNIT_FLAG_STUNNED
Definition: Unit.h:466
@ UNIT_FLAG_FLEEING
Definition: Unit.h:471
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:114
@ SPELLFAMILY_HUNTER
Definition: SharedDefines.h:3509
@ SPELLFAMILY_DEATHKNIGHT
Definition: SharedDefines.h:3515
UnitFlags GetUnitFlags() const
Definition: Unit.h:1479
uint32 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:1449
flag96 SpellFamilyFlags
Definition: SpellInfo.h:386

References Unit::CalculateSpellDamage(), Unit::CastCustomSpell(), Unit::CastSpell(), CLASS_DEATH_KNIGHT, Unit::CountPctFromMaxHealth(), Unit::DealDamage(), Unit::getClass(), GetId(), Unit::GetMaxHealth(), Unit::GetPower(), Unit::getPowerType(), GetSpellInfo(), Object::GetTypeId(), Unit::GetUnitFlags(), Unit::GetVictim(), Unit::HealthBelowPct(), SpellInfo::Id, 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(), TYPEID_PLAYER, UNIT_FLAG_FLEEING, UNIT_FLAG_SILENCED, and UNIT_FLAG_STUNNED.

Referenced by PeriodicTick().

◆ HandlePeriodicEnergizeAuraTick()

void AuraEffect::HandlePeriodicEnergizeAuraTick ( Unit target,
Unit caster 
) const
6775{
6777
6779 return;
6780
6781 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
6782 return;
6783
6784 if (target->HasUnitState(UNIT_STATE_ISOLATED))
6785 {
6786 SendTickImmune(target, caster);
6787 return;
6788 }
6789
6790 // don't regen when permanent aura target has full power
6791 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
6792 return;
6793
6794 // ignore negative values (can be result apply spellmods to aura damage
6795 int32 amount = std::max(m_amount, 0);
6796
6797 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
6798 target->SendPeriodicAuraLog(&pInfo);
6799
6800 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
6801 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
6802 int32 gain = target->ModifyPower(PowerType, amount);
6803
6804 if (caster)
6805 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
6806}
@ SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED
Definition: SharedDefines.h:629

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

Referenced by PeriodicTick().

◆ HandlePeriodicHealAurasTick()

void AuraEffect::HandlePeriodicHealAurasTick ( Unit target,
Unit caster 
) const
6526{
6527 if (!target->IsAlive())
6528 return;
6529
6530 if (target->HasUnitState(UNIT_STATE_ISOLATED))
6531 {
6532 SendTickImmune(target, caster);
6533 return;
6534 }
6535
6536 // heal for caster damage (must be alive)
6537 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST) && (!caster || !caster->IsAlive()))
6538 return;
6539
6540 // don't regen when permanent aura target has full power
6541 if (GetBase()->IsPermanent() && target->IsFullHealth())
6542 return;
6543
6544 // ignore negative values (can be result apply spellmods to aura damage
6545 int32 damage = std::max(m_amount, 0);
6546
6548 {
6549 // Taken mods
6550 float TakenTotalMod = 1.0f;
6551
6552 // Tenacity increase healing % taken
6553 if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0))
6554 AddPct(TakenTotalMod, Tenacity->GetAmount());
6555
6556 // Healing taken percent
6557 float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6558 if (minval)
6559 AddPct(TakenTotalMod, minval);
6560
6561 float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6562 if (maxval)
6563 AddPct(TakenTotalMod, maxval);
6564
6565 // Healing over time taken percent
6566 float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
6567 if (minval_hot)
6568 AddPct(TakenTotalMod, minval_hot);
6569
6570 float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
6571 if (maxval_hot)
6572 AddPct(TakenTotalMod, maxval_hot);
6573
6574 // Arena / BG Dampening
6575 float minval_pct = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
6576 if (minval_pct)
6577 AddPct(TakenTotalMod, minval_pct);
6578
6579 TakenTotalMod = std::max(TakenTotalMod, 0.0f);
6580
6581 // the most ugly hack i made :P the other option is to change all spellvalues to float...
6582 // demonic aegis
6583 if (caster && GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[1] & 0x20000000))
6585 AddPct(TakenTotalMod, aurEff->GetAmount());
6586
6587 damage = uint32(target->CountPctFromMaxHealth(damage));
6588 damage = uint32(damage * TakenTotalMod);
6589 }
6590 else
6591 {
6592 // Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100
6593 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellInfo()->SpellIconID == 2864)
6594 {
6595 uint32 tickNumber = GetTickNumber() - 1;
6596 int32 tempAmount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, nullptr);
6597
6598 float drop = 2.0f;
6599
6600 // Item - Druid T10 Restoration 2P Bonus
6601 if (caster)
6602 if (AuraEffect* aurEff = caster->GetAuraEffect(70658, 0))
6603 AddPct(drop, -aurEff->GetAmount());
6604
6605 damage += GetTotalTicks() * tempAmount * (6 - (drop * tickNumber)) * 0.01f;
6606 }
6607
6608 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
6609 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6610 damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6611 }
6612
6613 bool crit = false;
6614 if ((crit = roll_chance_f(GetCritChance())))
6615 damage = Unit::SpellCriticalHealingBonus(caster, GetSpellInfo(), damage, target);
6616
6617 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} heal of {} for {} health inflicted by {}",
6618 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId());
6619
6620 uint32 heal = uint32(damage);
6621
6622 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6623 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, heal, GetSpellInfo());
6624 sScriptMgr->ModifyHealReceived(target, caster, heal, GetSpellInfo());
6625
6626 HealInfo healInfo(caster, target, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6627 Unit::CalcHealAbsorb(healInfo);
6628 int32 gain = Unit::DealHeal(caster, target, healInfo.GetHeal());
6629
6630 SpellPeriodicAuraLogInfo pInfo(this, healInfo.GetHeal(), healInfo.GetHeal() - gain, healInfo.GetAbsorb(), 0, 0.0f, crit);
6631 target->SendPeriodicAuraLog(&pInfo);
6632
6633 if (caster)
6634 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
6635
6636 bool haveCastItem = GetBase()->GetCastItemGUID();
6637
6638 // Health Funnel
6639 // damage caster for heal amount
6640 // xinef: caster is available, checked earlier
6641 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST))
6642 {
6643 uint32 manaPerSecond = GetSpellInfo()->ManaPerSecond;
6644 if ((int32)manaPerSecond > gain && gain > 0)
6645 {
6646 manaPerSecond = gain;
6647 }
6648
6649 uint32 absorb2 = 0;
6650 Unit::DealDamageMods(caster, manaPerSecond, &absorb2);
6651
6653 Unit::DealDamage(caster, caster, manaPerSecond, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
6654 }
6655
6656 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6657 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6659 if (healInfo.GetAbsorb() > 0)
6660 procEx |= PROC_EX_ABSORB;
6661
6662 // ignore item heals
6663 if (!haveCastItem && GetAuraType() != SPELL_AURA_OBS_MOD_HEALTH) // xinef: dont allow obs_mod_health to proc spells, this is passive regeneration and not hot
6664 Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, heal, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, nullptr, &healInfo);
6665}
@ SELF_DAMAGE
Definition: Unit.h:440
@ 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:439
Definition: Unit.h:804
static void CalcHealAbsorb(HealInfo &healInfo)
Definition: Unit.cpp:2464
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition: Unit.cpp:10906
int32 GetMaxPositiveAuraModifier(AuraType auratype)
Definition: Unit.cpp:5847
static uint32 SpellCriticalHealingBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition: Unit.cpp:12239
int32 GetMaxNegativeAuraModifier(AuraType auratype) const
Definition: Unit.cpp:5861
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition: Unit.cpp:12481
uint32 GetTickNumber() const
Definition: SpellAuraEffects.h:86
AuraObjectType GetType() const
Definition: SpellAuras.cpp:481
ObjectGuid GetCastItemGUID() const
Definition: SpellAuras.h:103
uint32 ManaPerSecond
Definition: SpellInfo.h:363

References AddPct(), BASE_ATTACK, Unit::CalcHealAbsorb(), Unit::CountPctFromMaxHealth(), Unit::DealDamage(), Unit::DealDamageMods(), Unit::DealHeal(), DOT, DYNOBJ_AURA_TYPE, SpellInfo::Effects, HealInfo::GetAbsorb(), Unit::GetAuraEffect(), GetAuraType(), GetBase(), GetCasterGUID(), Aura::GetCastItemGUID(), GetCritChance(), 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, 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(), 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
6497{
6498 if (!caster || !caster->IsAlive() || !target->IsAlive())
6499 return;
6500
6501 if (target->HasUnitState(UNIT_STATE_ISOLATED))
6502 {
6503 SendTickImmune(target, caster);
6504 return;
6505 }
6506
6507 uint32 damage = std::max(GetAmount(), 0);
6508 // do not kill health donator
6509 if (caster->GetHealth() < damage)
6510 damage = caster->GetHealth() - 1;
6511 if (!damage)
6512 return;
6513
6514 caster->ModifyHealth(-(int32)damage);
6515 LOG_DEBUG("spells.aura", "PeriodicTick: donator {} target {} damage {}.", caster->GetEntry(), target->GetEntry(), damage);
6516
6517 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6518
6519 damage = int32(damage * gainMultiplier);
6520
6521 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6522 caster->HealBySpell(healInfo);
6523}
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition: Unit.cpp:11197

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
6396{
6397 if (!target->IsAlive())
6398 return;
6399
6401 {
6402 SendTickImmune(target, caster);
6403 return;
6404 }
6405
6406 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6407 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6408 return;
6409
6411
6412 uint32 damage = std::max(GetAmount(), 0);
6413
6414 // Script Hook For HandlePeriodicHealthLeechAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6415 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6416
6417 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
6418 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6419 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6420
6421 bool crit = false;
6422 if ((crit = roll_chance_f(GetCritChance())))
6423 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6424
6425 // Calculate armor mitigation
6427 {
6428 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6429 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6430 damage = damageReductedArmor;
6431 }
6432
6433 int32 dmg = damage;
6434 int32 cleanDamageAmount = cleanDamage.mitigated_damage;
6435 if (CanApplyResilience())
6436 {
6437 int32 resilienceReduction = dmg;
6438 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6439
6440 resilienceReduction = dmg - resilienceReduction;
6441 dmg -= resilienceReduction;
6442 cleanDamageAmount += resilienceReduction;
6443 }
6444
6445 damage = std::max(0, dmg);
6446 cleanDamage.mitigated_damage = std::max(0, cleanDamageAmount);
6447
6448 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6449 Unit::CalcAbsorbResist(dmgInfo);
6450
6451 uint32 absorb = dmgInfo.GetAbsorb();
6452 uint32 resist = dmgInfo.GetResist();
6453 damage = dmgInfo.GetDamage();
6454
6455 // Set trigger flag
6456 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6457 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6459 if (absorb > 0)
6460 procEx |= PROC_EX_ABSORB;
6461
6462 if (dmgInfo.GetDamage())
6463 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6464
6465 if (target->GetHealth() < dmgInfo.GetDamage())
6466 {
6467 dmgInfo.ModifyDamage(dmgInfo.GetDamage() - target->GetHealth());
6468 }
6469
6470 damage = dmgInfo.GetDamage();
6471
6472 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} health leech of {} for {} dmg inflicted by {} abs is {}",
6473 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6474 if (caster)
6475 caster->SendSpellNonMeleeDamageLog(target, GetSpellInfo(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit);
6476
6477 int32 new_damage;
6478
6479 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
6480
6481 Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6482
6483 if (!caster || !caster->IsAlive())
6484 return;
6485
6486 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6487
6488 uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount()));
6489 heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount()));
6490
6491 HealInfo healInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6492 int32 gain = caster->HealBySpell(healInfo);
6493 caster->getHostileRefMgr().threatAssist(caster, gain * 0.5f, GetSpellInfo());
6494}
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition: Unit.cpp:6222

References Unit::ApplyResilience(), BASE_ATTACK, Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), CanApplyResilience(), CR_CRIT_TAKEN_SPELL, Unit::DealDamage(), DOT, DYNOBJ_AURA_TYPE, SpellInfo::Effects, DamageInfo::GetAbsorb(), 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(), 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
6668{
6670
6671 if (!caster || !caster->IsAlive() || !target->IsAlive() || target->getPowerType() != PowerType)
6672 return;
6673
6675 {
6676 SendTickImmune(target, caster);
6677 return;
6678 }
6679
6680 if (GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6681 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6682 return;
6683
6684 // ignore negative values (can be result apply spellmods to aura damage
6685 int32 drainAmount = std::max(m_amount, 0);
6686
6687 // Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
6688 // It's mana percent cost spells, m_amount is percent drain from target
6690 {
6691 // max value
6692 int32 maxmana = CalculatePct(caster->GetMaxPower(PowerType), drainAmount * 2.0f);
6693 ApplyPct(drainAmount, target->GetMaxPower(PowerType));
6694 if (drainAmount > maxmana)
6695 drainAmount = maxmana;
6696 }
6697
6698 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} power leech of {} for {} dmg inflicted by {}",
6699 GetCasterGUID().ToString(), target->GetGUID().ToString(), drainAmount, GetId());
6700 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6701 if (PowerType == POWER_MANA)
6702 drainAmount -= target->GetSpellCritDamageReduction(drainAmount);
6703
6704 int32 drainedAmount = -target->ModifyPower(PowerType, -drainAmount);
6705
6706 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6707
6708 SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, gainMultiplier, false);
6709 target->SendPeriodicAuraLog(&pInfo);
6710
6711 int32 gainAmount = int32(drainedAmount * gainMultiplier);
6712 int32 gainedAmount = 0;
6713 if (gainAmount)
6714 {
6715 gainedAmount = caster->ModifyPower(PowerType, gainAmount);
6716 target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
6717 }
6718
6719 target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
6720
6721 // remove CC auras
6723
6724 // Drain Mana
6726 && m_spellInfo->SpellFamilyFlags[0] & 0x00000010)
6727 {
6728 int32 manaFeedVal = 0;
6729 if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
6730 manaFeedVal = aurEff->GetAmount();
6731 // Mana Feed - Drain Mana
6732 if (manaFeedVal > 0)
6733 {
6734 int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
6735 caster->CastCustomSpell(caster, 32554, &feedAmount, nullptr, nullptr, true, nullptr, this);
6736 }
6737 }
6738}
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:1586
uint32 ManaCostPercentage
Definition: SpellInfo.h:365

References Unit::AddThreat(), ApplyPct(), AURA_INTERRUPT_FLAG_TAKE_DAMAGE, CalculatePct(), Unit::CastCustomSpell(), SpellInfo::Effects, GetBase(), GetCasterGUID(), GetEffIndex(), Object::GetGUID(), GetId(), Unit::GetMaxPower(), GetMiscValue(), Unit::getPowerType(), Unit::GetSpellCritDamageReduction(), GetSpellInfo(), 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
6809{
6811
6812 if (!caster || !target->IsAlive() || target->getPowerType() != PowerType)
6813 return;
6814
6816 {
6817 SendTickImmune(target, caster);
6818 return;
6819 }
6820
6821 // ignore negative values (can be result apply spellmods to aura damage
6822 int32 damage = std::max(m_amount, 0);
6823
6824 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6825 if (PowerType == POWER_MANA)
6826 damage -= target->GetSpellCritDamageReduction(damage);
6827
6828 uint32 gain = uint32(-target->ModifyPower(PowerType, -damage));
6829
6830 float dmgMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6831
6832 SpellInfo const* spellProto = GetSpellInfo();
6833 // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
6834 SpellNonMeleeDamage damageInfo(caster, target, spellProto, spellProto->SchoolMask);
6835 // no SpellDamageBonus for burn mana
6836 caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
6837
6838 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6839
6840 caster->SendSpellNonMeleeDamageLog(&damageInfo);
6841
6842 // Set trigger flag
6843 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6844 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6846 if (damageInfo.damage)
6847 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6848
6849 caster->DealSpellDamage(&damageInfo, true);
6850
6851 DamageInfo dmgInfo(damageInfo, DOT);
6852 Unit::ProcDamageAndSpell(caster, damageInfo.target, procAttacker, procVictim, procEx, damageInfo.damage, BASE_ATTACK, spellProto, nullptr, GetEffIndex(), nullptr, &dmgInfo);
6853}
uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition)
Definition: Unit.cpp:16168
Definition: Unit.h:908
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
Definition: Unit.cpp:1435
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
Definition: Unit.cpp:1297
uint32 SchoolMask
Definition: SpellInfo.h:390

References SpellNonMeleeDamage::absorb, BASE_ATTACK, Unit::CalculateSpellDamageTaken(), createProcExtendMask(), SpellNonMeleeDamage::damage, Unit::DealDamageMods(), Unit::DealSpellDamage(), DOT, SpellInfo::Effects, GetEffIndex(), GetMiscValue(), Unit::getPowerType(), Unit::GetSpellCritDamageReduction(), GetSpellInfo(), 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
5925{
5926 // generic casting code with custom spells and target/caster customs
5927 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
5928
5929 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
5930 SpellInfo const* auraSpellInfo = GetSpellInfo();
5931 uint32 auraId = auraSpellInfo->Id;
5932
5933 // specific code for cases with no trigger spell provided in field
5934 if (!triggeredSpellInfo)
5935 {
5936 switch (auraSpellInfo->SpellFamilyName)
5937 {
5939 {
5940 switch (auraId)
5941 {
5942 // Thaumaturgy Channel
5943 case 9712:
5944 triggerSpellId = 21029;
5945 if (caster)
5946 caster->CastSpell(caster, triggerSpellId, true);
5947 return;
5948 // Brood Affliction: Bronze
5949 case 23170:
5950 // Only 10% chance of triggering spell
5951 if (roll_chance_f(10.f))
5952 {
5953 triggerSpellId = 23171;
5954 }
5955 break;
5956 // Restoration
5957 case 24379:
5958 case 23493:
5959 {
5960 if (caster)
5961 {
5962 int32 heal = caster->CountPctFromMaxHealth(10);
5963 HealInfo healInfo(caster, target, heal, auraSpellInfo, auraSpellInfo->GetSchoolMask());
5964 caster->HealBySpell(healInfo);
5965
5966 if (int32 mana = caster->GetMaxPower(POWER_MANA))
5967 {
5968 mana /= 10;
5969 caster->EnergizeBySpell(caster, 23493, mana, POWER_MANA);
5970 }
5971 }
5972 return;
5973 }
5974 // Nitrous Boost
5975 case 27746:
5976 if (caster && target->GetPower(POWER_MANA) >= 10)
5977 {
5978 target->ModifyPower(POWER_MANA, -10);
5979 target->SendEnergizeSpellLog(caster, 27746, 10, POWER_MANA);
5980 }
5981 else
5982 target->RemoveAurasDueToSpell(27746);
5983 return;
5984 // Frost Blast
5985 case 27808:
5986 if (caster)
5987 {
5988 caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, nullptr, this);
5989 if (GetTickNumber() == 1)
5990 caster->CastSpell(target, 27808, true);
5991 }
5992 return;
5993 // Inoculate Nestlewood Owlkin
5994 case 29528:
5995 if (target->GetTypeId() != TYPEID_UNIT) // prevent error reports in case ignored player target
5996 return;
5997 break;
5998 // Feed Captured Animal
5999 case 29917:
6000 triggerSpellId = 29916;
6001 break;
6002 // Extract Gas
6003 case 30427:
6004 {
6005 // move loot to player inventory and despawn target
6006 if (caster && caster->GetTypeId() == TYPEID_PLAYER &&
6007 target->GetTypeId() == TYPEID_UNIT &&
6009 {
6010 Player* player = caster->ToPlayer();
6011 Creature* creature = target->ToCreature();
6012 // missing lootid has been reported on startup - just return
6013 if (!creature->GetCreatureTemplate()->SkinLootId)
6014 return;
6015
6017
6018 creature->DespawnOrUnsummon();
6019 }
6020 return;
6021 }
6022 // Quake
6023 case 30576:
6024 triggerSpellId = 30571;
6025 break;
6026 // Doom
6028 // so instakill will be naturally done before trigger spell
6029 case 31347:
6030 {
6031 target->CastSpell(target, 31350, true, nullptr, this);
6032 Unit::Kill(target, target);
6033 return;
6034 }
6035 // Eye of Grillok
6036 case 38495:
6037 triggerSpellId = 38530;
6038 break;
6039 // Absorb Eye of Grillok (Zezzak's Shard)
6040 case 38554:
6041 {
6042 if (!caster || target->GetTypeId() != TYPEID_UNIT)
6043 return;
6044
6045 caster->CastSpell(caster, 38495, true, nullptr, this);
6046
6047 Creature* creatureTarget = target->ToCreature();
6048
6049 creatureTarget->DespawnOrUnsummon();
6050 return;
6051 }
6052 // Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam
6053 case 39857:
6054 triggerSpellId = 39856;
6055 break;
6056 // Personalized Weather
6057 case 46736:
6058 triggerSpellId = 46737;
6059 break;
6060 // Shield Level 1
6061 case 63130:
6062 // Shield Level 2
6063 case 63131:
6064 // Shield Level 3
6065 case 63132:
6066 // Ball of Flames Visual
6067 case 71706:
6068 return;
6069 // Oculus, Mage-Lord Urom, Time Bomb
6070 case 51121:
6071 case 59376:
6072 {
6073 const int32 dmg = target->GetMaxHealth() - target->GetHealth();
6074 target->CastCustomSpell(target, 51132, &dmg, 0, 0, true);
6075 return;
6076 }
6077 }
6078 break;
6079 }
6080 case SPELLFAMILY_SHAMAN:
6081 {
6082 switch (auraId)
6083 {
6084 // Lightning Shield (The Earthshatterer set trigger after cast Lighting Shield)
6085 case 28820:
6086 {
6087 // Need remove self if Lightning Shield not active
6089 target->RemoveAurasDueToSpell(28820);
6090 return;
6091 }
6092 }
6093 break;
6094 }
6095 default:
6096 break;
6097 }
6098 }
6099 else
6100 {
6101 // Spell exist but require custom code
6102 switch (auraId)
6103 {
6104 // Mana Tide
6105 case 16191:
6106 target->CastCustomSpell(target, triggerSpellId, &m_amount, nullptr, nullptr, true, nullptr, this);
6107 return;
6108 // Poison (Grobbulus)
6109 case 28158:
6110 case 54362:
6111 // Slime Pool (Dreadscale & Acidmaw)
6112 case 66882:
6113 target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000 * 2 / 3), nullptr, true, nullptr, this);
6114 return;
6115 // Eye of Eternity, Malygos, Arcane Overload
6116 case 56432:
6117 if (triggerSpellId == 56438)
6118 {
6119 target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)(10000 * (1.0f - 0.02f * (m_tickNumber + 1))), nullptr, true, nullptr, this);
6120 return;
6121 }
6122 break;
6123 // Beacon of Light
6124 case 53563:
6125 {
6126 // area aura owner casts the spell
6127 GetBase()->GetUnitOwner()->CastSpell(target, triggeredSpellInfo, true, 0, this, GetBase()->GetUnitOwner()->GetGUID());
6128 return;
6129 }
6130 // Slime Spray - temporary here until preventing default effect works again
6131 // added on 9.10.2010
6132 case 69508:
6133 {
6134 if (caster)
6135 caster->CastSpell(target, triggerSpellId, true, nullptr, nullptr, caster->GetGUID());
6136 return;
6137 }
6138 // Trial of the Crusader, Jaraxxus, Spinning Pain Spike
6139 case 66283:
6140 {
6141 const int32 dmg = target->GetMaxHealth() / 2;
6142 target->CastCustomSpell(target, 66316, &dmg, nullptr, nullptr, true);
6143 return;
6144 }
6145 // Violet Hold, Moragg, Ray of Suffering, Ray of Pain
6146 case 54442:
6147 case 59524:
6148 case 54438:
6149 case 59523:
6150 {
6151 if (caster)
6152 if (Unit* victim = caster->GetVictim())
6153 if(victim->GetDistance(caster) < 45.0f)
6154 {
6155 target = victim;
6156 break;
6157 }
6158 return;
6159 }
6160 case 24745: // Summon Templar, Trigger
6161 case 24747: // Summon Templar Fire, Trigger
6162 case 24757: // Summon Templar Air, Trigger
6163 case 24759: // Summon Templar Earth, Trigger
6164 case 24761: // Summon Templar Water, Trigger
6165 case 24762: // Summon Duke, Trigger
6166 case 24766: // Summon Duke Fire, Trigger
6167 case 24769: // Summon Duke Air, Trigger
6168 case 24771: // Summon Duke Earth, Trigger
6169 case 24773: // Summon Duke Water, Trigger
6170 case 24785: // Summon Royal, Trigger
6171 case 24787: // Summon Royal Fire, Trigger
6172 case 24791: // Summon Royal Air, Trigger
6173 case 24792: // Summon Royal Earth, Trigger
6174 case 24793: // Summon Royal Water, Trigger
6175 {
6176 // All this spells trigger a spell that requires reagents; if the
6177 // triggered spell is cast as "triggered", reagents are not consumed
6178 if (caster)
6179 caster->CastSpell(target, triggerSpellId, false);
6180 return;
6181 }
6182 // Hunter - Rapid Recuperation
6183 case 56654:
6184 case 58882:
6185 int32 amount = int32(target->GetMaxPower(POWER_MANA) * GetAmount() / 100.0f);
6186 target->CastCustomSpell(target, triggerSpellId, &amount, nullptr, nullptr, true, nullptr, this);
6187 return;
6188 }
6189 }
6190
6191 // Reget trigger spell proto
6192 triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
6193
6194 if (triggeredSpellInfo)
6195 {
6196 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6197 {
6198 SpellCastTargets targets;
6199 targets.SetUnitTarget(target);
6200 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6201 {
6204 }
6205
6206 // Xinef: do not skip reagent cost for entry casts
6208 if (GetSpellInfo()->Effects[GetEffIndex()].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || GetSpellInfo()->Effects[GetEffIndex()].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)
6210
6211 triggerCaster->CastSpell(targets, triggeredSpellInfo, nullptr, triggerFlags, nullptr, this);
6212 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6213 }
6214 }
6215}
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:2612
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2108
uint32 type
Definition: CreatureData.h:215
uint32 SkinLootId
Definition: CreatureData.h:219
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, bool broadcast=false)
Definition: Player.cpp:13380
void EnergizeBySpell(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition: Unit.cpp:11222
void SendEnergizeSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition: Unit.cpp:11211
Unit * GetUnitOwner() const
Definition: SpellAuras.h:108
Definition: Spell.h:109
void SetUnitTarget(Unit *target)
Definition: Spell.cpp:233
void SetObjectTargetChannel(ObjectGuid targetGUID)
Definition: Spell.cpp:448
void SetDstChannel(SpellDestination const &spellDest)
Definition: Spell.cpp:453
SpellDestination spellDst
Definition: Spell.h:249
ObjectGuid channelGUID
Definition: Spell.h:248
bool IsChannelCategorySpell() const
Definition: SpellInfo.cpp:1067

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(), Object::GetGUID(), Unit::GetHealth(), GetId(), Unit::GetMaxHealth(), Unit::GetMaxPower(), Unit::GetPower(), SpellInfo::GetSchoolMask(), GetSpellInfo(), GetTickNumber(), Object::GetTypeId(), Aura::GetUnitOwner(), Unit::GetVictim(), Unit::HealBySpell(), SpellInfo::Id, SpellInfo::IsChannelCategorySpell(), 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, CreatureTemplate::type, TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by PeriodicTick().

◆ HandlePeriodicTriggerSpellWithValueAuraTick()

void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick ( Unit target,
Unit caster 
) const
6218{
6219 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
6220 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6221 {
6222 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6223 {
6224 SpellCastTargets targets;
6225 targets.SetUnitTarget(target);
6226 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6227 {
6230 }
6231
6232 CustomSpellValues values;
6234
6235 triggerCaster->CastSpell(targets, triggeredSpellInfo, &values, TRIGGERED_FULL_MASK, nullptr, this);
6236 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6237 }
6238 }
6239 else
6240 {
6241 Creature* c = target->ToCreature();
6242 if (c && caster)
6243 {
6244 sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature());
6245 }
6246
6247 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
6248 }
6249}
SpellEffIndex
Definition: SharedDefines.h:29
Definition: SpellDefines.h:162
void AddSpellMod(SpellValueMod mod, int32 value)
Definition: SpellDefines.h:164

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
1783{
1784 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1785 return;
1786
1787 Unit* target = aurApp->GetTarget();
1788
1789 // no-phase is also phase state so same code for apply and remove
1790 uint32 newPhase = target->GetPhaseByAuras();
1791
1792 if (Player* player = target->ToPlayer())
1793 {
1794 if (!newPhase)
1795 newPhase = PHASEMASK_NORMAL;
1796
1797 // do not change phase to GM with all phases enabled
1798 if (player->IsGameMaster())
1799 newPhase = PHASEMASK_ANYWHERE;
1800
1801 player->SetPhaseMask(newPhase, false);
1802 player->GetSession()->SendSetPhaseShift(newPhase);
1803 }
1804 else
1805 {
1806 if (!newPhase)
1807 {
1808 newPhase = PHASEMASK_NORMAL;
1809 if (Creature* creature = target->ToCreature())
1810 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
1811 newPhase = data->phaseMask;
1812 }
1813
1814 target->SetPhaseMask(newPhase, false);
1815 }
1816
1817 // call functions which may have additional effects after chainging state of unit
1818 // phase auras normally not expected at BG but anyway better check
1819 if (apply)
1820 {
1821 // drop flag at invisibiliy in bg
1823 }
1824
1825 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1826 if (target->IsVisible())
1827 {
1828 if (!target->GetMap()->Instanceable())
1829 {
1830 target->UpdateObjectVisibility(false);
1831 target->m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f);
1832 }
1833 else
1834 target->UpdateObjectVisibility();
1835 }
1836}
@ PHASEMASK_ANYWHERE
Definition: Object.h:57
@ PHASEMASK_NORMAL
Definition: Object.h:56
Definition: CreatureData.h:359
void Relocate(float x, float y)
Definition: Position.h:73
uint32 GetPhaseByAuras() const
Definition: Unit.cpp:19206
bool IsVisible() const
Definition: Unit.h:2127
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:19217
Position m_last_notify_position
Definition: Unit.h:2409

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.
3123{
3124 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3125 return;
3126
3127 Unit* target = aurApp->GetTarget();
3128 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
3129 if (target->GetTypeId() == TYPEID_PLAYER || !apply || target->HasAuraType(SPELL_AURA_MOD_FEAR))
3130 return;
3133 target->SetControlled(false, UNIT_STATE_FLEEING);
3134}

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

◆ HandlePreventResurrection()

void AuraEffect::HandlePreventResurrection ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5820{
5821 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5822 return;
5823
5824 if (aurApp->GetTarget()->GetTypeId() != TYPEID_PLAYER)
5825 return;
5826
5827 if (apply)
5828 aurApp->GetTarget()->RemoveByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
5829 else if (!aurApp->GetTarget()->GetMap()->Instanceable())
5830 aurApp->GetTarget()->SetByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
5831}
@ PLAYER_FIELD_BYTE_RELEASE_TIMER
Definition: Player.h:561

References AURA_EFFECT_HANDLE_REAL, WorldObject::GetMap(), AuraApplication::GetTarget(), Object::GetTypeId(), Map::Instanceable(), PLAYER_FIELD_BYTE_RELEASE_TIMER, PLAYER_FIELD_BYTES, Object::RemoveByteFlag(), Object::SetByteFlag(), and TYPEID_PLAYER.

◆ HandleProc()

void AuraEffect::HandleProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
1150{
1151 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1152 if (prevented)
1153 return;
1154
1155 switch (GetAuraType())
1156 {
1158 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1159 break;
1161 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1162 break;
1164 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1165 break;
1167 HandleRaidProcFromChargeAuraProc(aurApp, eventInfo);
1168 break;
1171 break;
1172 default:
1173 break;
1174 }
1175
1176 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1177}
@ 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:6913
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6872
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6893
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6961
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6855
bool CallScriptEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuras.cpp:2718
void CallScriptAfterEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuras.cpp:2737

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 
)
6894{
6895 Unit* target = aurApp->GetTarget();
6896 Unit* triggerTarget = eventInfo.GetProcTarget();
6897 if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamageOrSchool(GetSpellInfo()))
6898 {
6899 SendTickImmune(triggerTarget, target);
6900 return;
6901 }
6902
6903 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetSpellInfo(), GetSpellInfo()->SchoolMask);
6904 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetEffIndex());
6905 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
6906 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
6907 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6908 target->SendSpellNonMeleeDamageLog(&damageInfo);
6909 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
6910 target->DealSpellDamage(&damageInfo, true);
6911}
Unit * GetProcTarget() const
Definition: Unit.h:860

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 
)
6856{
6857 Unit* triggerCaster = aurApp->GetTarget();
6858 Unit* triggerTarget = eventInfo.GetProcTarget();
6859
6860 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
6861 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6862 {
6863 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
6864 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this);
6865 }
6866 else
6867 {
6868 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());
6869 }
6870}

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 
)
6873{
6874 Unit* triggerCaster = aurApp->GetTarget();
6875 Unit* triggerTarget = eventInfo.GetProcTarget();
6876
6877 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
6878 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6879 {
6880 // used only with EXTRA_LOGS
6881 (void)triggeredSpellInfo;
6882
6883 int32 basepoints0 = GetAmount();
6884 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell {} with value {} from aura {} proc", triggeredSpellInfo->Id, basepoints0, GetId());
6885 triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, nullptr, nullptr, true, nullptr, this);
6886 }
6887 else
6888 {
6889 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());
6890 }
6891}

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 
)
6914{
6915 Unit* target = aurApp->GetTarget();
6916
6917 uint32 triggerSpellId;
6918 switch (GetId())
6919 {
6920 case 57949: // Shiver
6921 triggerSpellId = 57952;
6922 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
6923 break;
6924 case 59978: // Shiver
6925 triggerSpellId = 59979;
6926 break;
6927 case 43593: // Cold Stare
6928 triggerSpellId = 43594;
6929 break;
6930 default:
6931 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: {}", GetId());
6932 return;
6933 }
6934
6935 int32 jumps = GetBase()->GetCharges();
6936
6937 // current aura expire on proc finish
6938 GetBase()->SetCharges(0);
6939 GetBase()->SetUsingCharges(true);
6940
6941 // next target selection
6942 if (jumps > 0)
6943 {
6944 if (Unit* caster = GetCaster())
6945 {
6946 float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
6947
6948 if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
6949 {
6950 target->CastSpell(triggerTarget, GetSpellInfo(), true, nullptr, this, GetCasterGUID());
6951 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
6952 aura->SetCharges(jumps);
6953 }
6954 }
6955 }
6956
6957 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
6958 target->CastSpell(target, triggerSpellId, true, nullptr, this, GetCasterGUID());
6959}
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition: Unit.cpp:11069
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 
)
6962{
6963 Unit* target = aurApp->GetTarget();
6964
6965 // Currently only Prayer of Mending
6966 if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20))
6967 {
6968 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: {}", GetId());
6969 return;
6970 }
6971 uint32 triggerSpellId = 33110;
6972
6973 int32 value = GetAmount();
6974
6975 int32 jumps = GetBase()->GetCharges();
6976
6977 // current aura expire on proc finish
6978 GetBase()->SetCharges(0);
6979 GetBase()->SetUsingCharges(true);
6980
6981 // next target selection
6982 if (jumps > 0)
6983 {
6984 if (Unit* caster = GetCaster())
6985 {
6986 float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
6987
6988 Unit* triggerTarget = nullptr;
6989 Acore::MostHPMissingGroupInRange u_check(target, radius, 0);
6990 Acore::UnitLastSearcher<Acore::MostHPMissingGroupInRange> searcher(target, triggerTarget, u_check);
6991 Cell::VisitAllObjects(target, searcher, radius);
6992
6993 if (triggerTarget)
6994 {
6995 target->CastCustomSpell(triggerTarget, GetId(), &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
6996 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
6997 aura->SetCharges(jumps);
6998 }
6999 }
7000 }
7001
7002 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
7003 target->CastCustomSpell(target, triggerSpellId, &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
7004}
Definition: GridNotifiers.h:403
Definition: GridNotifiers.h:1475

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

◆ HandleShapeshiftBoosts()

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

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
4912{
4914 return;
4915
4916 Unit* target = aurApp->GetTarget();
4917
4918 BaseModType modType = FLAT_MOD;
4920 modType = PCT_MOD;
4921
4922 if (target->GetTypeId() == TYPEID_PLAYER)
4923 target->ToPlayer()->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply);
4924}
BaseModType
Definition: Unit.h:307
@ PCT_MOD
Definition: Unit.h:309
@ SHIELD_BLOCK_VALUE
Definition: Unit.h:302
@ 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(), Object::GetTypeId(), Player::HandleBaseModValue(), PCT_MOD, SHIELD_BLOCK_VALUE, SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT, Object::ToPlayer(), and TYPEID_PLAYER.

◆ HandleSpiritOfRedemption()

void AuraEffect::HandleSpiritOfRedemption ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
1721{
1722 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1723 return;
1724
1725 Unit* target = aurApp->GetTarget();
1726
1727 if (target->GetTypeId() != TYPEID_PLAYER)
1728 return;
1729
1730 // prepare spirit state
1731 if (apply)
1732 {
1733 // disable breath/etc timers
1734 target->ToPlayer()->StopMirrorTimers();
1735
1736 // set stand state (expected in this form)
1737 if (!target->IsStandState())
1739
1740 target->SetHealth(1);
1741 }
1742 // die at aura end
1743 else if (target->IsAlive())
1744 // call functions which may have additional effects after chainging state of unit
1745 target->setDeathState(JUST_DIED);
1746
1747 // xinef: damage immunity spell, not needed because of 93 aura (adds non_attackable state)
1748 // xinef: probably blizzard added it just in case in wotlk (id > 46000)
1749 if (apply)
1750 target->CastSpell(target, 62371, true);
1751 else
1752 target->RemoveAurasDueToSpell(62371);
1753}
@ JUST_DIED
Definition: Unit.h:317
@ UNIT_STAND_STATE_STAND
Definition: Unit.h:53
void StopMirrorTimers()
Definition: Player.h:2006
virtual void setDeathState(DeathState s, bool despawn=false)
Definition: Unit.cpp:14447
bool IsStandState() const
Definition: Unit.cpp:16894
void SetStandState(uint8 state)
Definition: Unit.cpp:16900

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

◆ HandleUnused()

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

◆ HandleWaterBreathing()

void AuraEffect::HandleWaterBreathing ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2996{
2998 return;
2999
3000 Unit* target = aurApp->GetTarget();
3001
3002 // update timers in client
3003 if (target->GetTypeId() == TYPEID_PLAYER)
3004 target->ToPlayer()->UpdateMirrorTimers();
3005}
void UpdateMirrorTimers()
Definition: PlayerUpdates.cpp:425

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

◆ HasSpellClassMask()

bool AuraEffect::HasSpellClassMask ( ) const
1086{
1087 return m_spellInfo->Effects[m_effIndex].SpellClassMask;
1088}

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

◆ IsAffectedOnSpell()

bool AuraEffect::IsAffectedOnSpell ( SpellInfo const *  spell) const
1072{
1073 if (!spell)
1074 return false;
1075 // Check family name
1076 if (spell->SpellFamilyName != m_spellInfo->SpellFamilyName)
1077 return false;
1078
1079 // Check EffectClassMask
1080 if (m_spellInfo->Effects[m_effIndex].SpellClassMask & spell->SpellFamilyFlags)
1081 return true;
1082 return false;
1083}

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

◆ IsPeriodic()

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

References m_isPeriodic.

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

◆ PeriodicTick()

void AuraEffect::PeriodicTick ( AuraApplication aurApp,
Unit caster 
) const
1097{
1098 bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
1099 if (prevented)
1100 return;
1101
1102 Unit* target = aurApp->GetTarget();
1103
1104 switch (GetAuraType())
1105 {
1107 HandlePeriodicDummyAuraTick(target, caster);
1108 break;
1110 HandlePeriodicTriggerSpellAuraTick(target, caster);
1111 break;
1113 // Don't actually do anything - client will trigger casts of these spells by itself
1114 break;
1117 break;
1120 HandlePeriodicDamageAurasTick(target, caster);
1121 break;
1123 HandlePeriodicHealthLeechAuraTick(target, caster);
1124 break;
1126 HandlePeriodicHealthFunnelAuraTick(target, caster);
1127 break;
1130 HandlePeriodicHealAurasTick(target, caster);
1131 break;
1133 HandlePeriodicManaLeechAuraTick(target, caster);
1134 break;
1136 HandleObsModPowerAuraTick(target, caster);
1137 break;
1139 HandlePeriodicEnergizeAuraTick(target, caster);
1140 break;
1142 HandlePeriodicPowerBurnAuraTick(target, caster);
1143 break;
1144 default:
1145 break;
1146 }
1147}
void HandlePeriodicPowerBurnAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6808
void HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6667
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6740
void HandlePeriodicHealthFunnelAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6496
void HandlePeriodicHealAurasTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6525
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6774
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:5924
void HandlePeriodicDummyAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:5833
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6395
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6251
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6217
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
Definition: SpellAuras.cpp:2487

References Aura::CallScriptEffectPeriodicHandlers(), GetAuraType(), GetBase(), AuraApplication::GetTarget(), HandleObsModPowerAuraTick(), HandlePeriodicDamageAurasTick(), HandlePeriodicDummyAuraTick(), HandlePeriodicEnergizeAuraTick(), HandlePeriodicHealAurasTick(), HandlePeriodicHealthFunnelAuraTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicManaLeechAuraTick(), HandlePeriodicPowerBurnAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandlePeriodicTriggerSpellWithValueAuraTick(), 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, and SPELL_AURA_POWER_BURN.

Referenced by Update().

◆ RecalculateAmount() [1/2]

◆ RecalculateAmount() [2/2]

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

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

◆ ResetPeriodic()

void AuraEffect::ResetPeriodic ( bool  resetPeriodicTimer = false)
inline
88{ 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
89{ m_tickNumber = 0; }

References m_tickNumber.

◆ SendTickImmune()

◆ SetAmount()

◆ SetCanBeRecalculated()

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

References m_canBeRecalculated.

Referenced by Aura::SetLoadedState().

◆ SetCritChance()

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

References m_critChance.

Referenced by CalculatePeriodicData().

◆ SetEnabled()

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

References m_isAuraEnabled.

Referenced by AuraApplication::_HandleEffect().

◆ SetOldAmount()

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

References m_oldAmount.

Referenced by CalculateAmount().

◆ SetPeriodic()

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

References m_isPeriodic.

◆ SetPeriodicTimer()

◆ Update()

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

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

References Aura::CallScriptEffectUpdatePeriodicHandlers(), GetAmount(), GetAuraType(), GetBase(), GetId(), GetSpellInfo(), Object::GetTypeId(), Player::InArena(), LOG_ERROR, m_isPeriodic, m_tickNumber, Aura::RefreshDuration(), SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_GENERIC, Object::ToPlayer(), and TYPEID_PLAYER.

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