AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
AuraEffect Class Reference

#include "SpellAuraEffects.h"

Public Member Functions

UnitGetCaster () const
 
ObjectGuid GetCasterGUID () const
 
AuraGetBase () const
 
void GetTargetList (std::list< Unit * > &targetList) const
 
void GetApplicationList (std::list< AuraApplication * > &applicationList) const
 
SpellModifierGetSpellModifier () const
 
SpellInfo const * GetSpellInfo () const
 
uint32 GetId () const
 
uint32 GetEffIndex () const
 
int32 GetBaseAmount () const
 
int32 GetDieSides () const
 
int32 GetAmplitude () const
 
int32 GetMiscValueB () const
 
int32 GetMiscValue () const
 
AuraType GetAuraType () const
 
int32 GetAmount () const
 
int32 GetForcedAmount () const
 
void SetAmount (int32 amount)
 
int32 GetPeriodicTimer () const
 
void SetPeriodicTimer (int32 periodicTimer)
 
int32 CalculateAmount (Unit *caster)
 
void CalculatePeriodic (Unit *caster, bool create=false, bool load=false)
 
void CalculatePeriodicData ()
 
void CalculateSpellMod ()
 
void ChangeAmount (int32 newAmount, bool mark=true, bool onStackOrReapply=false)
 
void RecalculateAmount ()
 
void RecalculateAmount (Unit *caster)
 
bool CanBeRecalculated () const
 
void SetCanBeRecalculated (bool val)
 
void HandleEffect (AuraApplication *aurApp, uint8 mode, bool apply)
 
void HandleEffect (Unit *target, uint8 mode, bool apply)
 
void ApplySpellMod (Unit *target, bool apply)
 
void Update (uint32 diff, Unit *caster)
 
void UpdatePeriodic (Unit *caster)
 
uint32 GetTickNumber () const
 
int32 GetTotalTicks () const
 
void ResetPeriodic (bool resetPeriodicTimer=false)
 
void ResetTicks ()
 
bool IsPeriodic () const
 
void SetPeriodic (bool isPeriodic)
 
bool IsAffectedOnSpell (SpellInfo const *spell) const
 
bool HasSpellClassMask () const
 
void SendTickImmune (Unit *target, Unit *caster) const
 
void PeriodicTick (AuraApplication *aurApp, Unit *caster) const
 
void HandleProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void CleanupTriggeredSpells (Unit *target)
 
void HandleShapeshiftBoosts (Unit *target, bool apply) const
 
float GetCritChance () const
 
void SetCritChance (float crit)
 
uint8 GetCasterLevel () const
 
bool CanApplyResilience () const
 
float GetPctMods () const
 
uint32 GetAuraGroup () const
 
int32 GetOldAmount () const
 
void SetOldAmount (int32 amount)
 
void SetEnabled (bool enabled)
 
void HandleNULL (AuraApplication const *, uint8, bool) const
 
void HandleUnused (AuraApplication const *, uint8, bool) const
 
void HandleNoImmediateEffect (AuraApplication const *, uint8, bool) const
 
void HandleModInvisibilityDetect (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModInvisibility (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStealth (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStealthLevel (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStealthDetect (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleDetectAmore (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleSpiritOfRedemption (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraGhost (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePhase (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModShapeshift (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTransform (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModScale (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraCloneCaster (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleFeignDeath (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModUnattackable (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDisarm (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModSilence (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModPacify (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModPacifyAndSilence (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraAllowOnlyAbility (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTrackResources (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTrackCreatures (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTrackStealthed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStalked (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraUntrackable (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModPetTalentsPoints (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModSkill (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraMounted (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraAllowFlight (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraWaterWalk (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraFeatherFall (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraHover (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleWaterBreathing (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleForceMoveForward (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModThreat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModTotalThreat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModTaunt (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModConfuse (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModFear (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStun (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRoot (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePreventFleeing (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPossess (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPossessPet (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModCharm (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleCharmConvert (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraControlVehicle (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseMountedSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseFlightSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseSwimSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDecreaseSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModUseNormalSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStateImmunityMask (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModMechanicImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModEffectImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStateImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModSchoolImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDmgImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDispelImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModResistanceExclusive (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModResistance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModBaseResistancePCT (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModResistancePercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModBaseResistance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModTargetResistance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPercentStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellDamagePercentFromStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellHealingPercentFromStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellDamagePercentFromAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellHealingPercentFromAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModHealingDone (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModTotalPercentStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModResistenceOfStatPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModExpertise (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerRegen (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerRegenPCT (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModManaRegen (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseHealth (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseMaxHealth (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseEnergy (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseEnergyPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseHealthPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraIncreaseBaseHealthPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModParryPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDodgePercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModBlockPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRegenInterrupt (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModWeaponCritPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModHitChance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellHitChance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellCritChance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellCritChanceShool (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModCritPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModCastingSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModMeleeRangedSpeedPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModCombatSpeedPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModAttackSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModMeleeSpeedPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedHaste (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleRangedAmmoHaste (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModRating (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModRatingFromStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPowerPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedAttackPowerPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedAttackPowerOfStatPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPowerOfStatPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPowerOfArmor (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModDamageDone (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModDamagePercentDone (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModOffhandDamagePercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleShieldBlockValue (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerCostPCT (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerCost (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleArenaPreparation (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleNoReagentUseAura (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraRetainComboPoints (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraDummy (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleChannelDeathItem (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleBindSight (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleFarSight (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleForceReaction (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraEmpathy (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModFaction (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleComprehendLanguage (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraConvertRune (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraLinked (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraOpenStable (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModFakeInebriation (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraOverrideSpells (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraSetVehicle (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePreventResurrection (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePeriodicDummyAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicTriggerSpellAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicTriggerSpellWithValueAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicDamageAurasTick (Unit *target, Unit *caster) const
 
void HandlePeriodicHealthLeechAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicHealthFunnelAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicHealAurasTick (Unit *target, Unit *caster) const
 
void HandlePeriodicManaLeechAuraTick (Unit *target, Unit *caster) const
 
void HandleObsModPowerAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicEnergizeAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicPowerBurnAuraTick (Unit *target, Unit *caster) const
 
void HandleProcTriggerSpellAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleProcTriggerSpellWithValueAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleProcTriggerDamageAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleRaidProcFromChargeAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleRaidProcFromChargeWithValueAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 

Private Member Functions

friend Aura::~Aura ()
 
 ~AuraEffect ()
 
 AuraEffect (Aura *base, uint8 effIndex, int32 *baseAmount, Unit *caster)
 
float CalcPeriodicCritChance (Unit const *caster, Unit const *target) const
 

Private Attributes

Aura *const m_base
 
SpellInfo const *const m_spellInfo
 
int32 const m_baseAmount
 
int32 const m_dieSides
 
bool m_applyResilience
 
uint8 m_casterLevel
 
int32 m_amount
 
float m_critChance
 
float m_pctMods
 
uint32 m_auraGroup
 
int32 m_oldAmount
 
bool m_isAuraEnabled
 
ChannelTargetDatam_channelData
 
SpellModifierm_spellmod
 
int32 m_periodicTimer
 
int32 m_amplitude
 
uint32 m_tickNumber
 
uint8 const m_effIndex
 
bool m_canBeRecalculated
 
bool m_isPeriodic
 

Friends

void Aura::_InitEffects (uint8 effMask, Unit *caster, int32 *baseAmount)
 
AuraUnit::_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, bool noPeriodicReset)
 

Detailed Description

Constructor & Destructor Documentation

◆ Aura::~Aura()

AuraEffect::Aura::~Aura ( )
private

◆ ~AuraEffect()

AuraEffect::~AuraEffect ( )
private
406{
407 delete m_spellmod;
408 delete m_channelData;
409}
ChannelTargetData * m_channelData
Definition: SpellAuraEffects.h:138
SpellModifier * m_spellmod
Definition: SpellAuraEffects.h:140

References m_channelData, and m_spellmod.

◆ AuraEffect()

AuraEffect::AuraEffect ( Aura base,
uint8  effIndex,
int32 baseAmount,
Unit caster 
)
explicitprivate
383 :
384 m_base(base), m_spellInfo(base->GetSpellInfo()),
385 m_baseAmount(baseAmount ? * baseAmount : m_spellInfo->Effects[effIndex].BasePoints), m_dieSides(m_spellInfo->Effects[effIndex].DieSides),
386 m_critChance(0), m_oldAmount(0), m_isAuraEnabled(true), m_channelData(nullptr), m_spellmod(nullptr), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex),
388{
389 CalculatePeriodic(caster, true, false);
391
392 m_amount = CalculateAmount(caster);
393 m_casterLevel = caster ? caster->GetLevel() : 0;
394 m_applyResilience = caster && caster->CanApplyResilience();
395 m_auraGroup = sSpellMgr->GetSpellGroup(GetId());
396
398
399 // Xinef: channel data structure
400 if (caster)
401 if (Spell* spell = caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
402 m_channelData = new ChannelTargetData(caster->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT), spell->m_targets.HasDst() ? spell->m_targets.GetDst() : nullptr);
403}
@ UNIT_FIELD_CHANNEL_OBJECT
Definition: UpdateFields.h:93
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:992
#define sSpellMgr
Definition: SpellMgr.h:825
ObjectGuid GetGuidValue(uint16 index) const
Definition: Object.cpp:337
bool CanApplyResilience() const
Definition: Unit.h:2441
uint8 GetLevel() const
Definition: Unit.h:1432
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:2075
int32 m_periodicTimer
Definition: SpellAuraEffects.h:142
bool m_canBeRecalculated
Definition: SpellAuraEffects.h:147
uint8 const m_effIndex
Definition: SpellAuraEffects.h:146
uint8 m_casterLevel
Definition: SpellAuraEffects.h:128
bool m_applyResilience
Definition: SpellAuraEffects.h:127
void CalculatePeriodic(Unit *caster, bool create=false, bool load=false)
Definition: SpellAuraEffects.cpp:593
void CalculateSpellMod()
Definition: SpellAuraEffects.cpp:684
int32 m_oldAmount
Definition: SpellAuraEffects.h:135
uint32 GetId() const
Definition: SpellAuraEffects.cpp:432
int32 CalculateAmount(Unit *caster)
Definition: SpellAuraEffects.cpp:452
int32 m_amount
Definition: SpellAuraEffects.h:129
void CalculatePeriodicData()
Definition: SpellAuraEffects.cpp:578
uint32 m_tickNumber
Definition: SpellAuraEffects.h:144
int32 const m_baseAmount
Definition: SpellAuraEffects.h:124
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:123
bool m_isAuraEnabled
Definition: SpellAuraEffects.h:136
bool m_isPeriodic
Definition: SpellAuraEffects.h:148
uint32 m_auraGroup
Definition: SpellAuraEffects.h:134
int32 const m_dieSides
Definition: SpellAuraEffects.h:125
float m_critChance
Definition: SpellAuraEffects.h:130
Aura *const m_base
Definition: SpellAuraEffects.h:121
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:100
Definition: Spell.h:241
Definition: Spell.h:284
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h: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 
)
800{
801 if (!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
802 return;
803
804 target->ToPlayer()->AddSpellMod(m_spellmod, apply);
805
806 // Auras with charges do not mod amount of passive auras
807 if (GetBase()->IsUsingCharges())
808 return;
809 // reapply some passive spells after add/remove related spellmods
810 // Warning: it is a dead loop if 2 auras each other amount-shouldn't happen
811 switch (GetMiscValue())
812 {
814 case SPELLMOD_EFFECT1:
815 case SPELLMOD_EFFECT2:
816 case SPELLMOD_EFFECT3:
817 {
818 ObjectGuid guid = target->GetGUID();
819 Unit::AuraApplicationMap& auras = target->GetAppliedAuras();
820 for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
821 {
822 Aura* aura = iter->second->GetBase();
823 // only passive and permament auras-active auras should have amount set on spellcast and not be affected
824 // if aura is casted by others, it will not be affected
825 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == guid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
826 {
828 {
829 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
830 {
831 if (AuraEffect* aurEff = aura->GetEffect(i))
832 aurEff->RecalculateAmount();
833 }
834 }
835 else if (GetMiscValue() == SPELLMOD_EFFECT1)
836 {
837 if (AuraEffect* aurEff = aura->GetEffect(0))
838 aurEff->RecalculateAmount();
839 }
840 else if (GetMiscValue() == SPELLMOD_EFFECT2)
841 {
842 if (AuraEffect* aurEff = aura->GetEffect(1))
843 aurEff->RecalculateAmount();
844 }
845 else //if (modOp == SPELLMOD_EFFECT3)
846 {
847 if (AuraEffect* aurEff = aura->GetEffect(2))
848 aurEff->RecalculateAmount();
849 }
850 }
851 }
852
853 Pet* pet = target->ToPlayer()->GetPet();
854 if (!pet)
855 break;
856
857 ObjectGuid petguid = pet->GetGUID();
858 Unit::AuraApplicationMap& petauras = pet->GetAppliedAuras();
859 for (Unit::AuraApplicationMap::iterator iter = petauras.begin(); iter != petauras.end(); ++iter)
860 {
861 Aura* aura = iter->second->GetBase();
862 // only passive auras-active auras should have amount set on spellcast and not be affected
863 // if aura is casted by others, it will not be affected
864 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == petguid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
865 {
867 {
868 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
869 {
870 if (AuraEffect* aurEff = aura->GetEffect(i))
871 aurEff->RecalculateAmount();
872 }
873 }
874 else if (GetMiscValue() == SPELLMOD_EFFECT1)
875 {
876 if (AuraEffect* aurEff = aura->GetEffect(0))
877 aurEff->RecalculateAmount();
878 }
879 else if (GetMiscValue() == SPELLMOD_EFFECT2)
880 {
881 if (AuraEffect* aurEff = aura->GetEffect(1))
882 aurEff->RecalculateAmount();
883 }
884 else //if (modOp == SPELLMOD_EFFECT3)
885 {
886 if (AuraEffect* aurEff = aura->GetEffect(2))
887 aurEff->RecalculateAmount();
888 }
889 }
890 }
891 }
892 default:
893 break;
894 }
895}
std::uint8_t uint8
Definition: Define.h: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:1635
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:8819
void AddSpellMod(SpellModifier *mod, bool apply)
Definition: Player.cpp:9806
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:1311
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1938
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:1280

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

References BASE_ATTACK, GetSpellInfo(), Unit::GetSpellModOwner(), RANGED_ATTACK, SPELL_AURA_ABILITY_PERIODIC_CRIT, SPELL_DAMAGE_CLASS_RANGED, SPELLFAMILY_ROGUE, and Unit::SpellTakenCritChance().

Referenced by CalculatePeriodicData().

◆ CalculateAmount()

int32 AuraEffect::CalculateAmount ( Unit caster)
453{
454 int32 amount;
455 // default amount calculation
456 amount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, nullptr);
457
458 // check item enchant aura cast
459 if (!amount && caster)
460 if (ObjectGuid itemGUID = GetBase()->GetCastItemGUID())
461 if (Player* playerCaster = caster->ToPlayer())
462 if (Item* castItem = playerCaster->GetItemByGuid(itemGUID))
463 if (castItem->GetItemSuffixFactor())
464 {
465 ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(std::abs(castItem->GetItemRandomPropertyId()));
466 if (item_rand_suffix)
467 {
468 for (uint8 k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; k++)
469 {
470 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->Enchantment[k]);
471 if (pEnchant)
472 {
473 for (uint8 t = 0; t < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; t++)
474 if (pEnchant->spellid[t] == m_spellInfo->Id)
475 {
476 amount = uint32((item_rand_suffix->AllocationPct[k] * castItem->GetItemSuffixFactor()) / 10000);
477 break;
478 }
479 }
480
481 if (amount)
482 break;
483 }
484 }
485 }
486
487 // custom amount calculations go here
488 // xinef: normal auras
489 switch (GetAuraType())
490 {
491 // crowd control auras
497 m_canBeRecalculated = false;
498 if (!m_spellInfo->ProcFlags || m_spellInfo->HasAura(SPELL_AURA_PROC_TRIGGER_SPELL)) // xinef: skip auras with proctriggerspell, they must have procflags...
499 break;
500 amount = int32(GetBase()->GetUnitOwner()->CountPctFromMaxHealth(10));
501 if (caster)
502 {
503 // Glyphs increasing damage cap
505 for (Unit::AuraEffectList::const_iterator itr = overrideClassScripts.begin(); itr != overrideClassScripts.end(); ++itr)
506 {
507 if ((*itr)->IsAffectedOnSpell(m_spellInfo))
508 {
509 // Glyph of Fear, Glyph of Frost nova and similar auras
510 if ((*itr)->GetMiscValue() == 7801)
511 {
512 AddPct(amount, (*itr)->GetAmount());
513 break;
514 }
515 }
516 }
517 }
518 break;
521 m_canBeRecalculated = false;
522 break;
524 // Titan's Grip
525 if (!caster)
526 break;
527 if (GetId() == 49152 && caster->ToPlayer())
528 {
529 Item* item1 = caster->ToPlayer()->GetWeaponForAttack(BASE_ATTACK);
530 Item* item2 = caster->ToPlayer()->GetWeaponForAttack(OFF_ATTACK);
531
532 if (!item2)
533 item2 = caster->ToPlayer()->GetShield();
534
535 if (item1 && item2
537 {
538 amount = -10;
539 }
540 else
541 amount = 0;
542 }
543 break;
544 default:
545 break;
546 }
547
548 // xinef: save base amount, before calculating sp etc. Used for Unit::CastDelayedSpellWithPeriodicAmount
549 SetOldAmount(amount * GetBase()->GetStackAmount());
551
552 // Xinef: Periodic auras
553 if (caster)
554 switch (GetAuraType())
555 {
558 // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value!
559 if (GetBase()->GetType() == UNIT_AURA_TYPE)
560 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex(), GetPctMods(), 1);
561 break;
563 if (GetBase()->GetType() == UNIT_AURA_TYPE)
564 amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex(), GetPctMods(), 1);
565 break;
567 if (GetBase()->GetType() == UNIT_AURA_TYPE)
568 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE, 0.0f, 1);
569 break;
570 default:
571 break;
572 }
573
574 amount *= GetBase()->GetStackAmount();
575 return amount;
576}
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:1839
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition: DBCStructure.h:1195
Definition: Item.h:214
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:545
uint32 InventoryType
Definition: ItemTemplate.h:641
Item * GetShield(bool useable=false) const
Definition: PlayerStorage.cpp:551
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition: PlayerStorage.cpp:516
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1981
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition: Unit.cpp:12446
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition: Unit.cpp:11609
void SetOldAmount(int32 amount)
Definition: SpellAuraEffects.h:117
AuraType GetAuraType() const
Definition: SpellAuraEffects.cpp:447
float GetPctMods() const
Definition: SpellAuraEffects.h:112
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:56
void CallScriptEffectCalcAmountHandlers(AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
Definition: SpellAuras.cpp:2531
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:880
Definition: DBCStructure.h:1208
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > AllocationPct
Definition: DBCStructure.h:1215
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
Definition: DBCStructure.h:1213
Definition: DBCStructure.h:1842
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1848

References AddPct(), ItemRandomSuffixEntry::AllocationPct, BASE_ATTACK, Aura::CallScriptEffectCalcAmountHandlers(), DOT, SpellInfo::Effects, ItemRandomSuffixEntry::Enchantment, Unit::GetAuraEffectsByType(), GetAuraType(), GetBase(), GetEffIndex(), GetId(), GetPctMods(), Player::GetShield(), GetSpellInfo(), Aura::GetStackAmount(), Item::GetTemplate(), Player::GetWeaponForAttack(), SpellInfo::HasAura(), SpellInfo::Id, ItemTemplate::InventoryType, INVTYPE_2HWEAPON, m_baseAmount, m_canBeRecalculated, m_effIndex, m_spellInfo, MAX_ITEM_ENCHANTMENT_EFFECTS, MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS, OFF_ATTACK, SpellInfo::ProcFlags, SetOldAmount(), sItemRandomSuffixStore, SPELL_AURA_DAMAGE_SHIELD, SPELL_AURA_MANA_SHIELD, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_AURA_SCHOOL_ABSORB, SPELL_AURA_TRANSFORM, SPELL_DIRECT_DAMAGE, Unit::SpellDamageBonusDone(), Unit::SpellHealingBonusDone(), SpellItemEnchantmentEntry::spellid, sSpellItemEnchantmentStore, Object::ToPlayer(), and UNIT_AURA_TYPE.

Referenced by AuraEffect(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), and RecalculateAmount().

◆ CalculatePeriodic()

void AuraEffect::CalculatePeriodic ( Unit caster,
bool  create = false,
bool  load = false 
)
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
594{
596
597 // prepare periodics
598 switch (GetAuraType())
599 {
601 // 3 spells have no amplitude set
602 if (!m_amplitude)
604 [[fallthrough]];
618 m_isPeriodic = true;
619 break;
620 default:
621 break;
622 }
623
625
626 if (!m_isPeriodic)
627 return;
628
629 // Xinef: fix broken data in dbc
630 if (m_amplitude <= 0)
631 m_amplitude = 1000;
632
633 Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr;
634
635 // Apply casting time mods
636 if (m_amplitude)
637 {
638 // Apply periodic time mod
639 if (modOwner)
641
642 if (caster)
643 {
646 }
647 }
648
649 if (load) // aura loaded from db
650 {
654 ++m_tickNumber;
655 }
656 else // aura just created or reapplied
657 {
658 m_tickNumber = 0;
659 // reset periodic timer on aura create or on reapply when aura isn't dot
660 // possibly we should not reset periodic timers only when aura is triggered by proc
661 // or maybe there's a spell attribute somewhere
662 bool resetPeriodicTimer = create
664
665 if (resetPeriodicTimer)
666 {
667 m_periodicTimer = 0;
668 // Start periodic on next tick or at aura apply
669 if (m_amplitude)
670 {
673 else if (caster && caster->IsTotem()) // for totems only ;d
674 {
675 m_periodicTimer = 100; // make it ALMOST instant
676 if (!GetBase()->IsPassive())
677 GetBase()->SetDuration(GetBase()->GetDuration() + 100);
678 }
679 }
680 }
681 }
682}
constexpr auto IN_MILLISECONDS
Definition: Common.h:55
@ UNIT_MOD_CAST_SPEED
Definition: UpdateFields.h:137
@ SPELL_AURA_PERIODIC_HASTE
Definition: SpellAuraDefines.h:379
@ SPELL_AURA_OBS_MOD_HEALTH
Definition: SpellAuraDefines.h:83
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
Definition: SpellAuraDefines.h:125
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition: SpellAuraDefines.h:127
@ SPELL_AURA_OBS_MOD_POWER
Definition: SpellAuraDefines.h:84
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition: SpellAuraDefines.h:152
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
Definition: SpellAuraDefines.h:290
@ SPELL_AURA_PERIODIC_ENERGIZE
Definition: SpellAuraDefines.h:87
@ SPELL_AURA_POWER_BURN
Definition: SpellAuraDefines.h:225
@ SPELL_AURA_PERIODIC_DUMMY
Definition: SpellAuraDefines.h:289
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT
Definition: SpellAuraDefines.h:111
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
Definition: SpellAuraDefines.h:86
@ SPELLMOD_ACTIVATION_TIME
Definition: SpellDefines.h:96
@ SPELL_ATTR5_EXTRA_INITIAL_PERIOD
Definition: SharedDefines.h:576
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition: SharedDefines.h:580
float GetFloatValue(uint16 index) const
Definition: Object.cpp:317
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
Definition: Player.cpp:9648
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition: Unit.cpp:5676
bool IsTotem() const
Definition: Unit.h:1427
int32 m_amplitude
Definition: SpellAuraEffects.h:143
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:2545
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 ( )
579{
580 // xinef: save caster depending auras with pct mods
581 if (GetBase()->GetType() == UNIT_AURA_TYPE && GetCaster())
582 {
587 }
588
589 if (GetCaster())
590 SetCritChance(CalcPeriodicCritChance(GetCaster(), (GetBase()->GetType() == UNIT_AURA_TYPE ? GetBase()->GetUnitOwner() : nullptr)));
591}
float SpellPctHealingModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition: Unit.cpp:12354
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition: Unit.cpp:11278
float CalcPeriodicCritChance(Unit const *caster, Unit const *target) const
Definition: SpellAuraEffects.cpp:1044
float m_pctMods
Definition: SpellAuraEffects.h:131
Unit * GetCaster() const
Definition: SpellAuraEffects.h:47
void SetCritChance(float crit)
Definition: SpellAuraEffects.h:109

References CalcPeriodicCritChance(), DOT, GetBase(), GetCaster(), GetSpellInfo(), SpellInfo::HasAura(), m_pctMods, m_spellInfo, SetCritChance(), SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, Unit::SpellPctDamageModsDone(), Unit::SpellPctHealingModsDone(), and UNIT_AURA_TYPE.

Referenced by AuraEffect().

◆ CalculateSpellMod()

void AuraEffect::CalculateSpellMod ( )
685{
686 switch (GetAuraType())
687 {
690 if (!m_spellmod)
691 {
694
695 m_spellmod->type = SpellModType(GetAuraType()); // SpellModType value == spell aura types
697 m_spellmod->mask = GetSpellInfo()->Effects[GetEffIndex()].SpellClassMask;
699 }
701 break;
702 default:
703 break;
704 }
706}
SpellModType
Definition: Player.h: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:64
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
Definition: SpellAuras.cpp:2559
uint8 GetCharges() const
Definition: SpellAuras.h:141

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

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

◆ CanApplyResilience()

bool AuraEffect::CanApplyResilience ( ) const
inline

◆ CanBeRecalculated()

bool AuraEffect::CanBeRecalculated ( ) const
inline

◆ ChangeAmount()

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

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT, AURA_EFFECT_HANDLE_REAPPLY, CalculateSpellMod(), GetAmount(), GetApplicationList(), GetEffIndex(), HandleEffect(), m_amount, and SetAmount().

Referenced by spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), RecalculateAmount(), 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?
1200{
1201 uint32 tSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
1202 if (!tSpellId)
1203 return;
1204
1205 SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
1206 if (!tProto)
1207 return;
1208
1209 if (tProto->GetDuration() != -1)
1210 return;
1211
1212 // needed for spell 43680, maybe others
1216 return;
1217
1218 target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
1219}
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4855
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:48
Definition: SpellInfo.h:314
int32 GetDuration() const
Definition: SpellInfo.cpp:2324

References SpellInfo::Effects, GetCasterGUID(), SpellInfo::GetDuration(), GetEffIndex(), m_spellInfo, Unit::RemoveAurasDueToSpell(), SPELL_AURA_PERIODIC_TRIGGER_SPELL, and sSpellMgr.

Referenced by AuraApplication::_HandleEffect().

◆ GetAmount()

int32 AuraEffect::GetAmount ( ) const
inline
64{ return m_isAuraEnabled ? m_amount : 0; }

References m_amount, and m_isAuraEnabled.

Referenced by Player::_ApplyWeaponDependentAuraCritMod(), Player::_ApplyWeaponDependentAuraDamageMod(), AuraApplication::_HandleEffect(), Pet::_SaveAuras(), spell_dru_survival_instincts_aura::AfterApply(), spell_the_lich_king_necrotic_plague_jump::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_warl_glyph_of_voidwalker::HandleApply(), spell_pri_renew::HandleApplyEffect(), HandleAuraDummy(), HandleAuraIncreaseBaseHealthPercent(), HandleAuraLinked(), HandleAuraModAttackPower(), HandleAuraModAttackPowerPercent(), HandleAuraModBaseResistancePCT(), HandleAuraModCritPct(), HandleAuraModFakeInebriation(), HandleAuraModIncreaseEnergy(), HandleAuraModIncreaseEnergyPercent(), HandleAuraModIncreaseHealth(), HandleAuraModIncreaseHealthPercent(), HandleAuraModIncreaseMaxHealth(), HandleAuraModRangedAttackPower(), HandleAuraModRangedAttackPowerPercent(), HandleAuraModRangedHaste(), HandleAuraModResistance(), HandleAuraModResistanceExclusive(), HandleAuraModSkill(), HandleAuraModStat(), HandleAuraModTotalThreat(), HandleAuraModWeaponCritPercent(), Unit::HandleAuraRaidProcFromChargeWithValue(), HandleAuraRetainComboPoints(), Aura::HandleAuraSpecificMods(), HandleChannelDeathItem(), spell_dk_raise_ally::HandleDummy(), Unit::HandleDummyAuraProc(), spell_shadowfang_keep_haunting_spirits::spell_shadowfang_keep_haunting_spirits_AuraScript::HandleDummyTick(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_dru_idol_lifebloom::HandleEffectCalcSpellMod(), spell_pal_exorcism_and_holy_wrath_damage::HandleEffectCalcSpellMod(), spell_warl_improved_demonic_tactics::HandleEffectCalcSpellMod(), spell_warr_glyph_of_sunder_armor::HandleEffectCalcSpellMod(), spell_gen_leeching_swarm::spell_gen_leeching_swarm_AuraScript::HandleEffectPeriodic(), spell_hallows_end_base_fire::HandleEffectPeriodicUpdate(), spell_gen_burn_brutallus::HandleEffectPeriodicUpdate(), spell_sha_item_t10_elemental_2p_bonus::HandleEffectProc(), spell_serpentshrine_cavern_infection::HandleEffectRemove(), HandleModAttackSpeed(), HandleModBaseResistance(), HandleModCastingSpeed(), HandleModCombatSpeedPct(), HandleModDamageDone(), HandleModDamagePercentDone(), HandleModHitChance(), HandleModInvisibility(), HandleModInvisibilityDetect(), HandleModMeleeRangedSpeedPct(), HandleModMeleeSpeedPct(), HandleModOffhandDamagePercent(), HandleModPowerCost(), HandleModPowerCostPCT(), HandleModRating(), HandleModResistancePercent(), HandleModSpellCritChance(), HandleModSpellHitChance(), HandleModStateImmunityMask(), HandleModStealth(), HandleModStealthDetect(), HandleModStealthLevel(), HandleModTargetResistance(), HandleModThreat(), HandleModTotalPercentStat(), Unit::HandleOverrideClassScriptAuraProc(), spell_dk_chains_of_ice_aura::HandlePeriodic(), spell_ragin_flames_inferno::HandlePeriodic(), spell_dk_death_and_decay_aura::HandlePeriodic(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_hun_sniper_training::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), HandlePeriodicDamageAurasTick(), HandlePeriodicHealthFunnelAuraTick(), HandlePeriodicHealthLeechAuraTick(), HandlePeriodicTriggerSpellAuraTick(), HandlePeriodicTriggerSpellWithValueAuraTick(), spell_dru_living_seed_proc::HandleProc(), spell_sha_earth_shield::HandleProc(), spell_oculus_temporal_rift::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_sha_t8_electrified::HandleProc(), spell_hun_lock_and_load::HandleProcs(), HandleProcTriggerDamageAuraProc(), Unit::HandleProcTriggerSpell(), HandleProcTriggerSpellWithValueAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), HandleRangedAmmoHaste(), spell_warl_haunt_aura::HandleRemove(), spell_warl_glyph_of_felguard::HandleRemove(), spell_warl_glyph_of_voidwalker::HandleRemove(), HandleShieldBlockValue(), spell_hun_sniper_training::HandleUpdatePeriodic(), Aura::IsAuraStronger(), spell_valanar_kinetic_bomb_absorb::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::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(), 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
115{ return m_auraGroup; }

References m_auraGroup.

Referenced by AuraApplication::_HandleEffect().

◆ GetAuraType()

AuraType AuraEffect::GetAuraType ( ) const
448{
449 return (AuraType)m_spellInfo->Effects[m_effIndex].ApplyAuraName;
450}
AuraType
Definition: SpellAuraDefines.h:62

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

Referenced by Player::_ApplyWeaponDependentAuraDamageMod(), AuraApplication::_HandleEffect(), Unit::_RegisterAuraEffect(), CalculateAmount(), CalculatePeriodic(), CalculateSpellMod(), HandleArenaPreparation(), HandleAuraAllowFlight(), HandleAuraEmpathy(), HandleAuraFeatherFall(), HandleAuraHover(), HandleAuraModDisarm(), HandleAuraModIncreaseFlightSpeed(), HandleAuraModSchoolImmunity(), HandleAuraModSkill(), HandleAuraModStalked(), HandleAuraTrackStealthed(), HandleAuraUntrackable(), HandleAuraWaterWalk(), HandleComprehendLanguage(), HandleEffect(), spell_dk_pet_scaling::HandleEffectApply(), spell_dru_treant_scaling::HandleEffectApply(), spell_pet_hit_expertise_scalling::HandleEffectApply(), spell_mage_pet_scaling::HandleEffectApply(), spell_pri_shadowfiend_scaling::HandleEffectApply(), spell_sha_feral_spirit_scaling::HandleEffectApply(), spell_sha_fire_elemental_scaling::HandleEffectApply(), spell_warl_infernal_scaling::HandleEffectApply(), HandleForceMoveForward(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), HandlePeriodicDamageAurasTick(), HandlePeriodicHealAurasTick(), HandleProc(), Unit::HandleProcTriggerSpell(), HandleShieldBlockValue(), Aura::IsAuraStronger(), PeriodicTick(), Unit::ProcDamageAndSpellFor(), Player::RestoreBaseRune(), Unit::SendPeriodicAuraLog(), ArenaSpectator::ShouldSendAura(), and UpdatePeriodic().

◆ GetBase()

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

References m_base.

Referenced by AuraApplication::_HandleEffect(), ApplySpellMod(), Unit::CalcAbsorbResist(), Unit::CalcHealAbsorb(), CalculateAmount(), CalculatePeriodic(), CalculatePeriodicData(), CalculateSpellMod(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), spell_festergut_blighted_spores::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

◆ GetDieSides()

int32 AuraEffect::GetDieSides ( ) const
inline
58{ return m_dieSides; }

References m_dieSides.

Referenced by spell_warl_demonic_knowledge::CalculateAmount().

◆ GetEffIndex()

uint32 AuraEffect::GetEffIndex ( ) const
inline
56{ return m_effIndex; }

References m_effIndex.

Referenced by AuraApplication::_HandleEffect(), spell_dru_lifebloom::AfterRemove(), Unit::CalcAbsorbResist(), spell_pal_sacred_shield_base::CalculateAmount(), spell_sha_earth_shield::CalculateAmount(), spell_warl_improved_demonic_tactics::CalculateAmount(), spell_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_karazhan_temptation::HandleProc(), spell_gen_proc_not_self::HandleProc(), spell_item_unsated_craving::HandleProc(), spell_pal_sacred_shield_base::HandleProc(), HandleProcTriggerDamageAuraProc(), Unit::HandleProcTriggerSpell(), HandleProcTriggerSpellAuraProc(), HandleRaidProcFromChargeAuraProc(), HandleRaidProcFromChargeWithValueAuraProc(), spell_putricide_mutated_plague::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_tidalvess::OnPeriodic(), spell_karathress_power_of_caribdis::OnPeriodic(), spell_leotheras_demon_link::OnPeriodic(), spell_gen_periodic_knock_away::OnPeriodic(), spell_broggok_poison_cloud::PeriodicTick(), spell_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
65{ return m_amount; }

References m_amount.

◆ GetId()

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

References SpellInfo::Id, and m_spellInfo.

Referenced by AuraEffect(), CalculateAmount(), CalculatePeriodic(), CalculateSpellMod(), Unit::CastDelayedSpellWithPeriodicAmount(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), HandleAuraControlVehicle(), HandleAuraDummy(), HandleAuraModDmgImmunity(), HandleAuraModEffectImmunity(), HandleAuraModIncreaseFlightSpeed(), HandleAuraModSchoolImmunity(), HandleAuraModShapeshift(), HandleAuraModStat(), HandleAuraModStateImmunity(), Aura::HandleAuraSpecificMods(), HandleAuraTransform(), 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
116{ return m_oldAmount; }

References m_oldAmount.

Referenced by Unit::CastDelayedSpellWithPeriodicAmount().

◆ GetPctMods()

float AuraEffect::GetPctMods ( ) const
inline
112{ 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(), spell_dru_idol_lifebloom::HandleEffectCalcSpellMod(), 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
87{ 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
5362{
5363 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5364 return;
5365
5366 Unit* target = aurApp->GetTarget();
5367
5368 if (apply)
5370 else
5371 {
5372 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5373 if (target->HasAuraType(GetAuraType()))
5374 return;
5376 }
5377}
@ UNIT_FLAG_PREPARATION
Definition: Unit.h:453
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
Definition: Unit.h:1302
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:5643
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:1495
ObjectGuid GetTarget() const
Definition: Unit.h:2447
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:1496

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
3312{
3314 return;
3315
3316 Unit* target = aurApp->GetTarget();
3317
3318 if (!apply)
3319 {
3320 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3322 return;
3323 }
3324
3325 target->SetCanFly(apply);
3326
3327 if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
3328 target->GetMotionMaster()->MoveFall();
3329}
@ 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:2276
bool IsLevitating() const
Definition: Unit.h:2392
virtual bool SetCanFly(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20958
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
Definition: MotionMaster.cpp:587

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
3084{
3086 return;
3087
3088 Unit* target = aurApp->GetTarget();
3089
3090 if (target->GetTypeId() == TYPEID_PLAYER)
3091 {
3092 if (apply)
3094 else
3095 {
3096 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3098 return;
3100 }
3101 }
3102}
@ PLAYER_ALLOW_ONLY_ABILITY
Definition: Player.h:498
@ SPELL_AURA_ALLOW_ONLY_ABILITY
Definition: SpellAuraDefines.h:326
void SetPlayerFlag(PlayerFlags flags)
Definition: Player.h:1101
void RemovePlayerFlag(PlayerFlags flags)
Definition: Player.h:1102

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
2780{
2782 return;
2783
2784 Unit* target = aurApp->GetTarget();
2785
2786 if (apply)
2787 {
2788 Unit* caster = GetCaster();
2789 if (!caster || caster == target)
2790 return;
2791
2792 // What must be cloned? at least display and scale
2793 target->SetDisplayId(caster->GetDisplayId());
2795 }
2796 else
2797 {
2798 target->SetDisplayId(target->GetNativeDisplayId());
2800 }
2801}
@ UNIT_FLAG2_MIRROR_IMAGE
Definition: Unit.h:492
void SetUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:1501
uint32 GetDisplayId() const
Definition: Unit.h:2182
uint32 GetNativeDisplayId() const
Definition: Unit.h:2184
void RemoveUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:1502
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:17030

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

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

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

References Unit::AddAura(), Unit::AddPetAura(), Unit::AddThreat(), Unit::ApplySpellImmune(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_REAPPLY, AURA_REMOVE_BY_CANCEL, AURA_REMOVE_BY_EXPIRE, BREWFEST_KODO, Unit::CanHaveThreatList(), Unit::CastSpell(), ObjectMgr::ChooseDisplayId(), 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
5973{
5974 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5975 return;
5976
5977 Unit* target = aurApp->GetTarget();
5978
5979 if (!apply)
5980 {
5981 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5982 if (target->HasAuraType(GetAuraType()))
5983 return;
5984 }
5985
5986 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
5988}
@ UNIT_DYNAMIC_FLAGS
Definition: UpdateFields.h:136
@ CREATURE_TYPE_BEAST
Definition: SharedDefines.h:2628
@ UNIT_DYNFLAG_SPECIALINFO
Definition: SharedDefines.h:3125
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition: Object.cpp:806
uint32 GetCreatureType() const
Definition: Unit.cpp:15168

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

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
1776{
1778 return;
1779
1780 Unit* target = aurApp->GetTarget();
1781
1782 if (target->GetTypeId() != TYPEID_PLAYER)
1783 return;
1784
1785 if (apply)
1786 {
1790 }
1791 else
1792 {
1793 if (target->HasAuraType(SPELL_AURA_GHOST))
1794 return;
1795
1799 }
1800}
@ PLAYER_FLAGS_GHOST
Definition: Player.h:479
@ SPELL_AURA_GHOST
Definition: SpellAuraDefines.h:158
@ SERVERSIDE_VISIBILITY_GHOST
Definition: SharedDefines.h:1274
@ GHOST_VISIBILITY_ALIVE
Definition: SharedDefines.h:1281
@ GHOST_VISIBILITY_GHOST
Definition: SharedDefines.h:1282
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h: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

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

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
4808{
4810 return;
4811
4812 Unit* target = aurApp->GetTarget();
4813
4814 target->HandleStatModifier(UNIT_MOD_HEALTH, BASE_PCT, float(GetAmount()), apply);
4815}
@ 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:15189

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

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
5110{
5112 return;
5113
5114 Unit* target = aurApp->GetTarget();
5115
5117}
@ 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
5175{
5177 return;
5178
5179 Unit* target = aurApp->GetTarget();
5180
5181 // Recalculate bonus
5182 if (target->GetTypeId() == TYPEID_PLAYER)
5183 target->ToPlayer()->UpdateAttackPowerAndDamage(false);
5184}
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
5170{
5171 HandleAuraModAttackPowerOfArmor(aurApp, mode, apply);
5172}
void HandleAuraModAttackPowerOfArmor(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:5174

References HandleAuraModAttackPowerOfArmor().

◆ HandleAuraModAttackPowerPercent()

void AuraEffect::HandleAuraModAttackPowerPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5133{
5135 return;
5136
5137 Unit* target = aurApp->GetTarget();
5138
5139 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
5141}
@ 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
4366{
4368 return;
4369
4370 Unit* target = aurApp->GetTarget();
4371 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4372 {
4373 if (GetMiscValue() & int32(1 << x))
4374 {
4376 }
4377 }
4378}
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:283
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:292

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

◆ HandleAuraModBlockPercent()

void AuraEffect::HandleAuraModBlockPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4851{
4853 return;
4854
4855 Unit* target = aurApp->GetTarget();
4856
4857 if (target->GetTypeId() != TYPEID_PLAYER)
4858 return;
4859
4860 target->ToPlayer()->UpdateBlockPercentage();
4861}
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
4959{
4961 return;
4962
4963 Unit* target = aurApp->GetTarget();
4964
4965 if (target->GetTypeId() != TYPEID_PLAYER)
4966 {
4967 target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
4968 return;
4969 }
4970
4971 target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4974
4975 // included in Player::UpdateSpellCritChance calculation
4977}
@ 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:4933
int32 m_baseSpellCritChance
Definition: Unit.h:2102

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
3773{
3775 return;
3776
3777 Unit* target = aurApp->GetTarget();
3778
3779 target->UpdateSpeed(MOVE_WALK, true);
3780 target->UpdateSpeed(MOVE_RUN, true);
3781 target->UpdateSpeed(MOVE_SWIM, true);
3782 target->UpdateSpeed(MOVE_FLIGHT, true);
3783 target->UpdateSpeed(MOVE_RUN_BACK, true);
3784 target->UpdateSpeed(MOVE_SWIM_BACK, true);
3785 target->UpdateSpeed(MOVE_FLIGHT_BACK, true);
3786
3787 if (Player* targetPlayer = target->ToPlayer())
3788 {
3789 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3790 }
3791}
@ 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:14238

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AuraApplication::GetTarget(), MOVE_FLIGHT, MOVE_FLIGHT_BACK, MOVE_RUN, MOVE_RUN_BACK, MOVE_SWIM, MOVE_SWIM_BACK, MOVE_WALK, sScriptMgr, Object::ToPlayer(), and Unit::UpdateSpeed().

◆ HandleAuraModDisarm()

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

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
4307{
4308 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4309 return;
4310
4311 Unit* target = aurApp->GetTarget();
4312
4314}
DispelType
Definition: SharedDefines.h:1371
void ApplySpellDispelImmunity(SpellInfo const *spellProto, DispelType type, bool apply)
Definition: Unit.cpp:13410

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

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

◆ HandleAuraModDodgePercent()

void AuraEffect::HandleAuraModDodgePercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4838{
4840 return;
4841
4842 Unit* target = aurApp->GetTarget();
4843
4844 if (target->GetTypeId() != TYPEID_PLAYER)
4845 return;
4846
4847 target->ToPlayer()->UpdateDodgePercentage();
4848}
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
4202{
4203 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4204 return;
4205
4206 Unit* target = aurApp->GetTarget();
4207
4208 target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
4209
4210 // when removing flag aura, handle flag drop
4211 Player* player = target->ToPlayer();
4212 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
4213 {
4214 if (player->InBattleground())
4215 {
4216 if (Battleground* bg = player->GetBattleground())
4217 bg->EventPlayerDroppedFlag(player);
4218 }
4219 else
4220 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
4221 }
4222}
#define sOutdoorPvPMgr
Definition: OutdoorPvPMgr.h:103
@ AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
Definition: SpellDefines.h:64
@ IMMUNITY_EFFECT
Definition: SharedDefines.h:1394
bool InBattleground() const
Definition: Player.h:2214

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
4642{
4644 return;
4645
4646 Unit* target = aurApp->GetTarget();
4647
4648 if (target->GetTypeId() != TYPEID_PLAYER)
4649 return;
4650
4653}
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
5991{
5992 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5993 return;
5994
5995 Unit* target = aurApp->GetTarget();
5996
5997 if (apply)
5998 {
5999 target->SetFaction(GetMiscValue());
6000 if (target->GetTypeId() == TYPEID_PLAYER)
6002 }
6003 else
6004 {
6005 target->RestoreFaction();
6006 if (target->GetTypeId() == TYPEID_PLAYER)
6008 }
6009}
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition: Unit.h:451
void SetFaction(uint32 faction)
Definition: Unit.cpp:10064
void RestoreFaction()
Definition: Unit.cpp:18959

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
6118{
6120 return;
6121
6122 Unit* target = aurApp->GetTarget();
6123
6124 if (apply)
6125 {
6128
6129 if (target->GetTypeId() == TYPEID_PLAYER)
6130 {
6133 }
6134 }
6135 else
6136 {
6137 bool removeDetect = !target->HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE);
6138
6140
6141 if (target->GetTypeId() == TYPEID_PLAYER)
6142 {
6145
6146 if (removeDetect)
6147 removeDetect = !target->ToPlayer()->GetDrunkValue();
6148 }
6149
6150 if (removeDetect)
6152 }
6153
6154 // call functions which may have additional effects after chainging state of unit
6155 target->UpdateObjectVisibility(false);
6156}
@ PLAYER_FAKE_INEBRIATION
Definition: UpdateFields.h:325
@ SPELL_AURA_MOD_FAKE_INEBRIATE
Definition: SpellAuraDefines.h:367
@ INVISIBILITY_DRUNK
Definition: SharedDefines.h:1261
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:2135
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: Unit.cpp:19394

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
4741{
4743 return;
4744
4745 Unit* target = aurApp->GetTarget();
4746
4748 // do not check power type, we can always modify the maximum
4749 // as the client will not see any difference
4750 // also, placing conditions that may change during the aura duration
4751 // inside effect handlers is not a good idea
4752 //if (int32(PowerType) != GetMiscValue())
4753 // return;
4754
4755 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + PowerType);
4756
4757 target->HandleStatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
4758}
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:268

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

◆ HandleAuraModIncreaseEnergyPercent()

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

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.

3718{
3720 return;
3721
3722 Unit* target = aurApp->GetTarget();
3724 target->UpdateSpeed(MOVE_FLIGHT, true);
3725
3728 {
3729 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3731 {
3732 target->SetCanFly(apply);
3733
3734 if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
3735 target->GetMotionMaster()->MoveFall();
3736 }
3737
3739 if (mode & AURA_EFFECT_HANDLE_REAL)
3740 {
3741 //Players on flying mounts must be immune to polymorph
3742 if (target->GetTypeId() == TYPEID_PLAYER)
3744
3745 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3746 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountID())
3748 }
3749 }
3750
3751 if (Player* targetPlayer = target->ToPlayer())
3752 {
3753 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3754 }
3755}
@ SPELL_AURA_FLY
Definition: SpellAuraDefines.h:264
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK
Definition: SpellAuraDefines.h:50
@ MECHANIC_POLYMORPH
Definition: SharedDefines.h:1342
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition: Unit.cpp:5606
uint32 GetMountID() const
Definition: Unit.h:1557

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
4696{
4698 return;
4699
4700 Unit* target = aurApp->GetTarget();
4701
4702 if (apply)
4703 {
4704 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
4705 target->ModifyHealth(GetAmount());
4706 }
4707 else
4708 {
4709 if (int32(target->GetHealth()) > GetAmount())
4710 target->ModifyHealth(-GetAmount());
4711 else
4712 target->SetHealth(1);
4713 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
4714 }
4715}
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:14079
void SetHealth(uint32 val)
Definition: Unit.cpp:15464
uint32 GetHealth() const
Definition: Unit.h:1454

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
4791{
4793 return;
4794
4795 Unit* target = aurApp->GetTarget();
4796
4797 // Unit will keep hp% after MaxHealth being modified if unit is alive.
4798 float percent = target->GetHealthPct();
4799 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(GetAmount()), apply);
4800
4801 // Xinef: pct was rounded down and could "kill" creature by setting its health to 0 making npc zombie
4802 if (target->IsAlive())
4803 if (uint32 healthAmount = CalculatePct(target->GetMaxHealth(), percent))
4804 target->SetHealth(healthAmount);
4805}
T CalculatePct(T base, U pct)
Definition: Util.h:61
float GetHealthPct() const
Definition: Unit.h:1462
uint32 GetMaxHealth() const
Definition: Unit.h:1455

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
4718{
4720 return;
4721
4722 Unit* target = aurApp->GetTarget();
4723
4724 uint32 oldhealth = target->GetHealth();
4725 double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth();
4726
4728
4729 // refresh percentage
4730 if (oldhealth > 0)
4731 {
4732 uint32 newhealth = uint32(std::ceil((double)target->GetMaxHealth() * healthPercentage));
4733 if (newhealth == 0)
4734 newhealth = 1;
4735
4736 target->SetHealth(newhealth);
4737 }
4738}

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
3713{
3714 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3715}
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3697

References HandleAuraModIncreaseSpeed().

◆ HandleAuraModIncreaseSpeed()

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

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

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AuraApplication::GetTarget(), MOVE_SWIM, sScriptMgr, Object::ToPlayer(), and Unit::UpdateSpeed().

◆ HandleAuraModPacify()

void AuraEffect::HandleAuraModPacify ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3046{
3048 return;
3049
3050 Unit* target = aurApp->GetTarget();
3051
3052 if (apply)
3053 {
3055 //target->AttackStop(); // pussywizard: why having this flag prevents from being in combat? it should just prevent melee attack
3056 }
3057 else
3058 {
3059 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3061 return;
3063 }
3064}
@ UNIT_FLAG_PACIFIED
Definition: 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
3067{
3069 return;
3070
3071 Unit* target = aurApp->GetTarget();
3072
3073 if (!(apply))
3074 {
3075 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3077 return;
3078 }
3079 HandleAuraModPacify(aurApp, mode, apply);
3080 HandleAuraModSilence(aurApp, mode, apply);
3081}
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3016
void HandleAuraModPacify(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3045

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

◆ HandleAuraModParryPercent()

void AuraEffect::HandleAuraModParryPercent ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4822{
4824 return;
4825
4826 Unit* target = aurApp->GetTarget();
4827
4828 if (target->GetTypeId() != TYPEID_PLAYER)
4829 return;
4830
4831 if (!target->ToPlayer()->CanParry())
4832 target->ToPlayer()->SetCanParry(true);
4833 else
4834 target->ToPlayer()->UpdateParryPercentage();
4835}
void UpdateParryPercentage()
Definition: StatSystem.cpp:742
bool CanParry() const
Definition: Player.h:2145
void SetCanParry(bool value)
Definition: Player.cpp:13041

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

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

◆ HandleAuraModRangedAttackPower()

void AuraEffect::HandleAuraModRangedAttackPower ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5120{
5122 return;
5123
5124 Unit* target = aurApp->GetTarget();
5125
5126 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
5127 return;
5128
5130}
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition: Unit.h:283
#define CLASSMASK_WAND_USERS
Definition: SharedDefines.h:174
uint32 getClassMask() const
Definition: Unit.h:1439

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
5144{
5146 return;
5147
5148 Unit* target = aurApp->GetTarget();
5149
5150 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
5151 return;
5152
5153 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
5155}

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
5048{
5050 return;
5051
5052 Unit* target = aurApp->GetTarget();
5053
5054 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
5055}
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition: Unit.cpp:17319

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
4864{
4865 HandleModManaRegen(aurApp, mode, apply);
4866}
void HandleModManaRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:4681

References HandleModManaRegen().

◆ HandleAuraModResistance()

void AuraEffect::HandleAuraModResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4348{
4350 return;
4351
4352 Unit* target = aurApp->GetTarget();
4353
4354 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4355 {
4356 if (GetMiscValue() & int32(1 << x))
4357 {
4359 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
4360 target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply);
4361 }
4362 }
4363}
SpellSchools
Definition: SharedDefines.h:282
bool IsPet() const
Definition: Unit.h:1425
void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply)
Definition: Unit.h:2041

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
4325{
4327 return;
4328
4329 Unit* target = aurApp->GetTarget();
4330
4331 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
4332 {
4333 if (GetMiscValue() & int32(1 << x))
4334 {
4336 if (amount < GetAmount())
4337 {
4338 float value = float(GetAmount() - amount);
4340 if (target->GetTypeId() == TYPEID_PLAYER)
4341 target->ApplyResistanceBuffModsMod(SpellSchools(x), aurApp->IsPositive(), value, apply);
4342 }
4343 }
4344 }
4345}
@ 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:5924

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
4620{
4622 return;
4623
4624 Unit* target = aurApp->GetTarget();
4625
4626 if (target->GetTypeId() != TYPEID_PLAYER)
4627 return;
4628
4630 {
4631 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
4632 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
4633 LOG_ERROR("spells.aura.effect", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
4634 return;
4635 }
4636
4637 // Recalculate Armor
4638 target->UpdateArmor();
4639}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:297
virtual void UpdateArmor()=0

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

◆ HandleAuraModRoot()

void AuraEffect::HandleAuraModRoot ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3519{
3520 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3521 return;
3522
3523 Unit* target = aurApp->GetTarget();
3524
3525 target->SetControlled(apply, UNIT_STATE_ROOT);
3526}
@ UNIT_STATE_ROOT
Definition: Unit.h:335
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18288

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

◆ HandleAuraModScale()

void AuraEffect::HandleAuraModScale ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
2772{
2774 return;
2775
2776 aurApp->GetTarget()->RecalculateObjectScale();
2777}

References AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK, AuraApplication::GetTarget(), and Unit::RecalculateObjectScale().

◆ HandleAuraModSchoolImmunity()

void AuraEffect::HandleAuraModSchoolImmunity ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
Todo:
: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else
4238{
4239 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4240 return;
4241
4242 Unit* target = aurApp->GetTarget();
4243
4244 target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, GetMiscValue(), (apply));
4245
4246 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4247 {
4248 if (apply)
4250 else
4251 {
4252 bool banishFound = false;
4253 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
4254 for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
4255 if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
4256 {
4257 banishFound = true;
4258 break;
4259 }
4260 if (!banishFound)
4262 }
4263 }
4264
4265 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
4267
4268 // remove all flag auras (they are positive, but they must be removed when you are immune)
4272
4274 if ((apply)
4276 && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
4277 {
4278 uint32 school_mask = GetMiscValue();
4279 Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
4280 for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
4281 {
4282 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
4283 if ((spell->GetSchoolMask() & school_mask)//Check for school mask
4284 && GetSpellInfo()->CanDispelAura(spell)
4285 && !iter->second->IsPositive() //Don't remove positive spells
4286 && spell->Id != GetId()) //Don't remove self
4287 {
4288 target->RemoveAura(iter);
4289 }
4290 else
4291 ++iter;
4292 }
4293 }
4294}
@ UNIT_STATE_ISOLATED
Definition: Unit.h:338
@ SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE
Definition: SharedDefines.h:477
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
Definition: SharedDefines.h:434
@ MECHANIC_BANISH
Definition: SharedDefines.h:1343
@ IMMUNITY_SCHOOL
Definition: SharedDefines.h:1396
void ClearUnitState(uint32 f)
Definition: Unit.h:1411
void AddUnitState(uint32 f)
Definition: Unit.h:1409
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition: Unit.cpp:5116
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1974
bool IsPositive() const
Definition: SpellInfo.cpp:1224

References Unit::AddUnitState(), Unit::ApplySpellImmune(), AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, Unit::ClearUnitState(), Unit::GetAppliedAuras(), Unit::GetAuraEffectsByType(), GetAuraType(), GetId(), GetMiscValue(), SpellInfo::GetSchoolMask(), GetSpellInfo(), AuraApplication::GetTarget(), SpellInfo::Id, IMMUNITY_SCHOOL, SpellInfo::IsPositive(), MECHANIC_BANISH, Unit::RemoveAura(), Unit::RemoveAurasWithInterruptFlags(), SPELL_ATTR1_IMMUNITY_PURGES_EFFECT, SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE, SPELL_SCHOOL_MASK_NORMAL, and UNIT_STATE_ISOLATED.

◆ HandleAuraModShapeshift()

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

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
3017{
3018 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3019 return;
3020
3021 Unit* target = aurApp->GetTarget();
3022
3023 if (apply)
3024 {
3026
3027 // call functions which may have additional effects after chainging state of unit
3028 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
3029 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
3030 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
3031 if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
3032 // Stop spells on prepare or casting state
3033 target->InterruptSpell(CurrentSpellTypes(i), false);
3034 }
3035 else
3036 {
3037 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3039 return;
3040
3042 }
3043}
#define CURRENT_MAX_SPELL
Definition: Unit.h:997
CurrentSpellTypes
Definition: Unit.h:989
@ CURRENT_MELEE_SPELL
Definition: Unit.h:990
@ UNIT_FLAG_SILENCED
Definition: Unit.h:461
@ SPELL_AURA_MOD_SILENCE
Definition: SpellAuraDefines.h:90
@ SPELL_PREVENTION_TYPE_SILENCE
Definition: SharedDefines.h:1554
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4014

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

Referenced by HandleAuraModPacifyAndSilence().

◆ HandleAuraModSkill()

void AuraEffect::HandleAuraModSkill ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3218{
3220 return;
3221 Unit* target = aurApp->GetTarget();
3222
3223 if (target->GetTypeId() != TYPEID_PLAYER)
3224 return;
3225
3226 uint32 prot = GetMiscValue();
3227 int32 points = GetAmount();
3228
3229 target->ToPlayer()->ModifySkillBonus(prot, ((apply) ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
3230 if (prot == SKILL_DEFENSE)
3231 target->ToPlayer()->UpdateDefenseBonusesMod();
3232}
@ SPELL_AURA_MOD_SKILL_TALENT
Definition: SpellAuraDefines.h:161
@ AURA_EFFECT_HANDLE_SKILL
Definition: SpellAuraDefines.h:47
@ SKILL_DEFENSE
Definition: SharedDefines.h:2881
void ModifySkillBonus(uint32 skillid, int32 val, bool talent)
Definition: Player.cpp:5224
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
3160{
3162 return;
3163
3164 Unit* target = aurApp->GetTarget();
3165
3166 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
3167 if (apply)
3169 else
3170 {
3171 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3172 if (!target->HasAuraType(GetAuraType()))
3174 }
3175
3176 // call functions which may have additional effects after chainging state of unit
3177 target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER);
3178}
@ UNIT_DYNFLAG_TRACK_UNIT
Definition: SharedDefines.h:3122
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
4439{
4441 return;
4442
4443 Unit* target = aurApp->GetTarget();
4444
4445 if (GetMiscValue() < -2 || GetMiscValue() > 4)
4446 {
4447 LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
4448 return;
4449 }
4450
4451 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
4452 {
4453 // -1 or -2 is all stats (misc < -2 checked in function beginning)
4454 if (GetMiscValue() < 0 || GetMiscValue() == i)
4455 {
4456 //target->ApplyStatMod(Stats(i), m_amount, apply);
4458 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
4459 target->ApplyStatBuffMod(Stats(i), (float)GetAmount(), apply);
4460 }
4461 }
4462}
@ UNIT_MOD_STAT_START
Definition: Unit.h:289
#define MAX_STATS
Definition: SharedDefines.h:265
Stats
Definition: SharedDefines.h:257
@ STAT_STRENGTH
Definition: SharedDefines.h:258
void ApplyStatBuffMod(Stats stat, float val, bool apply)
Definition: Unit.h:2048

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

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

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

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

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
6102{
6103 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6104 return;
6105
6106 Unit* target = aurApp->GetTarget();
6107
6108 if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
6109 return;
6110
6111 if (apply)
6112 target->ToPlayer()->GetSession()->SendStablePet(target->GetGUID());
6113
6114 // client auto close stable dialog at !apply aura
6115}
bool IsInWorld() const
Definition: Object.h:101
WorldSession * GetSession() const
Definition: Player.h:1961
void SendStablePet(ObjectGuid guid)
Definition: NPCHandler.cpp:480

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
6159{
6160 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6161 return;
6162
6163 Player* target = aurApp->GetTarget()->ToPlayer();
6164
6165 if (!target || !target->IsInWorld())
6166 return;
6167
6168 uint32 overrideId = uint32(GetMiscValue());
6169
6170 if (apply)
6171 {
6173 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
6174 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
6175 if (uint32 spellId = overrideSpells->spellId[i])
6176 target->_addSpell(spellId, SPEC_MASK_ALL, true);
6177 }
6178 else
6179 {
6181 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
6182 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
6183 if (uint32 spellId = overrideSpells->spellId[i])
6184 target->removeSpell(spellId, SPEC_MASK_ALL, true);
6185 }
6186}
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:1409
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition: Object.cpp:770
Definition: DBCStructure.h:1412

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

◆ HandleAuraRetainComboPoints()

void AuraEffect::HandleAuraRetainComboPoints ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5400{
5401 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5402 return;
5403
5404 Unit* target = aurApp->GetTarget();
5405
5406 if (target->GetTypeId() != TYPEID_PLAYER)
5407 return;
5408
5409 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
5410 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
5411 if (!(apply) && GetBase()->GetDuration() == 0)
5412 target->AddComboPoints(-GetAmount());
5413}
void AddComboPoints(Unit *target, int8 count)
Definition: Unit.cpp:17103

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
6189{
6190 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6191 return;
6192
6193 Unit* target = aurApp->GetTarget();
6194
6195 if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
6196 return;
6197
6198 uint32 vehicleId = GetMiscValue();
6199
6200 if (apply)
6201 {
6202 if (!target->CreateVehicleKit(vehicleId, 0))
6203 return;
6204 }
6205 else if (target->GetVehicleKit())
6206 target->RemoveVehicleKit();
6207
6209 data << target->GetPackGUID();
6210 data << uint32(apply ? vehicleId : 0);
6211 target->SendMessageToSet(&data, true);
6212
6213 if (apply)
6214 {
6216 target->ToPlayer()->GetSession()->SendPacket(&data);
6217 }
6218}
@ 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:18991
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Definition: Unit.cpp:18979
Definition: WorldPacket.h:27
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:212

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
3109{
3111 return;
3112
3113 Unit* target = aurApp->GetTarget();
3114
3115 if (target->GetTypeId() != TYPEID_PLAYER)
3116 return;
3117
3118 if (apply)
3119 target->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
3120 else
3121 target->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
3122}
@ PLAYER_TRACK_CREATURES
Definition: UpdateFields.h:344

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

◆ HandleAuraTrackResources()

void AuraEffect::HandleAuraTrackResources ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3125{
3127 return;
3128
3129 Unit* target = aurApp->GetTarget();
3130
3131 if (target->GetTypeId() != TYPEID_PLAYER)
3132 return;
3133
3134 if (apply)
3135 target->SetFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
3136 else
3137 target->RemoveFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
3138}
@ PLAYER_TRACK_RESOURCES
Definition: UpdateFields.h:345

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

◆ HandleAuraTrackStealthed()

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

References AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK, ObjectMgr::ChooseDisplayId(), GENDER_MALE, Unit::GetAuraEffectsByType(), GetCaster(), GetCasterGUID(), Unit::GetDisplayRace(), 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::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, UNIT_FIELD_MOUNTDISPLAYID, UNIT_VIRTUAL_ITEM_SLOT_ID, and urand().

◆ HandleAuraUntrackable()

void AuraEffect::HandleAuraUntrackable ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3181{
3183 return;
3184
3185 Unit* target = aurApp->GetTarget();
3186
3187 if (apply)
3189 else
3190 {
3191 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3192 if (target->HasAuraType(GetAuraType()))
3193 return;
3195 }
3196}
@ UNIT_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
3332{
3334 return;
3335
3336 Unit* target = aurApp->GetTarget();
3337
3338 if (Player* targetPlayer = target->ToPlayer())
3339 {
3340 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
3341 }
3342
3343 if (!apply)
3344 {
3345 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3346 if (target->HasAuraType(GetAuraType()))
3347 return;
3348 }
3349
3350 target->SetWaterWalking(apply);
3351}
virtual bool SetWaterWalking(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20976

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
5909{
5910 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5911 return;
5912
5913 Unit* target = aurApp->GetTarget();
5914
5915 Unit* caster = GetCaster();
5916
5917 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5918 return;
5919
5920 caster->ToPlayer()->SetViewpoint(target, apply);
5921}
void SetViewpoint(WorldObject *target, bool apply)
Definition: Player.cpp:13085

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

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

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

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

References Unit::_RegisterAuraEffect(), ApplySpellMod(), ASSERT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_REAL, AURA_EFFECT_HANDLE_REAPPLY, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, AURA_EFFECT_HANDLE_SKILL, AURA_EFFECT_HANDLE_STAT, AuraEffectHandler, Aura::CallScriptAfterEffectApplyHandlers(), Aura::CallScriptAfterEffectRemoveHandlers(), Aura::CallScriptEffectApplyHandlers(), Aura::CallScriptEffectRemoveHandlers(), GetAuraType(), GetBase(), GetEffIndex(), AuraApplication::GetRemoveMode(), AuraApplication::GetTarget(), and AuraApplication::IsActive().

Referenced by AuraApplication::_HandleEffect(), ChangeAmount(), Aura::HandleAllEffects(), HandleEffect(), and Unit::RestoreDisplayId().

◆ HandleEffect() [2/2]

void AuraEffect::HandleEffect ( Unit target,
uint8  mode,
bool  apply 
)
793{
795 ASSERT(aurApp);
796 HandleEffect(aurApp, mode, apply);
797}
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition: SpellAuras.h:183

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

◆ HandleFarSight()

void AuraEffect::HandleFarSight ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5924{
5925 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5926 {
5927 return;
5928 }
5929
5930 Unit* caster = GetCaster();
5931 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5932 {
5933 return;
5934 }
5935
5936 Player* player = caster->ToPlayer();
5937 if (apply)
5938 {
5940 }
5941 else
5942 {
5943 player->ResetFarSightDistance();
5944 }
5945
5946 caster->UpdateObjectVisibility(!apply);
5947}
void SetFarSightDistance(float radius)
Definition: Player.cpp:16188
void ResetFarSightDistance()
Definition: Player.cpp:16193
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2309

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
2808{
2809 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2810 return;
2811
2812 Unit* target = aurApp->GetTarget();
2813
2814 if (target->GetTypeId() != TYPEID_PLAYER)
2815 return;
2816
2817 if (Player* targetPlayer = target->ToPlayer())
2818 {
2819 sScriptMgr->AnticheatSetUnderACKmount(targetPlayer);
2820 }
2821
2822 if (apply)
2823 {
2824 /*
2825 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2826 data<<target->GetGUID();
2827 data<<uint8(0);
2828 target->SendMessageToSet(&data, true);
2829 */
2830
2831 UnitList targets;
2832 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
2834 Cell::VisitAllObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2835 for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2836 {
2837 if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2838 continue;
2839
2841 {
2842 if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2843 {
2844 SpellInfo const* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo();
2845 if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->GetTypeId() == TYPEID_UNIT)
2846 {
2847 Creature* c = (*iter)->ToCreature();
2848 if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
2849 continue;
2850 }
2851 bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY)
2852 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
2853 if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST))
2854 {
2855 // at least one effect truly targets an unit, interrupt the spell
2856 interrupt = true;
2857 break;
2858 }
2859 if (interrupt)
2860 (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
2861 }
2862 }
2863 }
2864
2865 if (target->GetInstanceScript() && target->GetInstanceScript()->IsEncounterInProgress())
2866 {
2867 // Xinef: replaced with CombatStop(false)
2868 target->AttackStop();
2869 target->RemoveAllAttackers();
2870 target->getHostileRefMgr().addThreatPercent(-100);
2871 target->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
2872 }
2873 else
2874 {
2875 target->CombatStop();
2877 }
2878
2880
2881 // prevent interrupt message
2882 if (GetCasterGUID() == target->GetGUID())
2883 {
2885 target->FinishSpell(CURRENT_GENERIC_SPELL, true);
2886
2887 // interrupt autoshot
2889 {
2891 target->ToPlayer()->SendAutoRepeatCancel(target);
2892 }
2893 }
2894
2895 target->InterruptNonMeleeSpells(true);
2896
2897 // stop handling the effect if it was removed by linked event
2898 if (aurApp->GetRemoveMode())
2899 return;
2900 // blizz like 2.0.x
2902 // blizz like 2.0.x
2904 // blizz like 2.0.x
2906
2908 }
2909 else
2910 {
2911 /*
2912 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2913 data<<target->GetGUID();
2914 data<<uint8(1);
2915 target->SendMessageToSet(&data, true);
2916 */
2917 // blizz like 2.0.x
2919 // blizz like 2.0.x
2921 // blizz like 2.0.x
2923
2925 }
2926}
@ UNIT_FLAG2_FEIGN_DEATH
Definition: Unit.h:488
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition: Unit.h:996
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:991
@ CURRENT_AUTOREPEAT_SPELL
Definition: Unit.h:993
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:3126
@ CREATURE_ELITE_WORLDBOSS
Definition: SharedDefines.h:2734
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition: SharedDefines.h:617
void deleteReferences(bool removeFromMap=false)
Definition: HostileRefMgr.cpp:125
void addThreatPercent(int32 percent)
Definition: HostileRefMgr.cpp:85
Definition: Creature.h:46
bool IsDungeonBoss() const
Definition: Creature.cpp:3080
bool isWorldBoss() const
Definition: Creature.h:116
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:199
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:10440
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4081
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition: Unit.cpp:4039
void RemoveAllAttackers()
Definition: Unit.cpp:10483
bool AttackStop()
Definition: Unit.cpp:10407
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:351

References HostileRefMgr::addThreatPercent(), Unit::AddUnitState(), Unit::AttackStop(), AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, Unit::ClearUnitState(), Unit::CombatStop(), CREATURE_ELITE_WORLDBOSS, CURRENT_AUTOREPEAT_SPELL, CURRENT_FIRST_NON_MELEE_SPELL, CURRENT_GENERIC_SPELL, CURRENT_MAX_SPELL, HostileRefMgr::deleteReferences(), SpellInfo::Effects, Unit::FinishSpell(), GetCasterGUID(), Creature::GetCreatureTemplate(), Unit::GetCurrentSpell(), Object::GetGUID(), Unit::getHostileRefMgr(), WorldObject::GetInstanceScript(), WorldObject::GetMap(), AuraApplication::GetRemoveMode(), AuraApplication::GetTarget(), 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
3414{
3416 return;
3417
3418 Unit* target = aurApp->GetTarget();
3419
3420 if (apply)
3422 else
3423 {
3424 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3425 if (target->HasAuraType(GetAuraType()))
3426 return;
3428 }
3429}
@ 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
5950{
5952 return;
5953
5954 Unit* target = aurApp->GetTarget();
5955
5956 if (target->GetTypeId() != TYPEID_PLAYER)
5957 return;
5958
5959 Player* player = target->ToPlayer();
5960
5961 uint32 faction_id = GetMiscValue();
5962 ReputationRank faction_rank = ReputationRank(m_amount);
5963
5964 player->GetReputationMgr().ApplyForceReaction(faction_id, faction_rank, apply);
5966
5967 // stop fighting if at apply forced rank friendly or at remove real rank friendly
5968 if ((apply && faction_rank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(faction_id) >= REP_FRIENDLY))
5969 player->StopAttackFaction(faction_id);
5970}
ReputationRank
Definition: SharedDefines.h:179
@ REP_FRIENDLY
Definition: SharedDefines.h:184
ReputationRank GetReputationRank(uint32 faction_id) const
Definition: Player.cpp:5777
ReputationMgr & GetReputationMgr()
Definition: Player.h:2089
void StopAttackFaction(uint32 faction_id)
Definition: Unit.cpp:20438
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
4984{
4986 return;
4987
4988 Unit* target = aurApp->GetTarget();
4989
4990 // Xinef: Do not apply such auras in normal way
4991 if (GetAmount() >= 1000)
4992 {
4993 target->SetInstantCast(apply);
4994 return;
4995 }
4996
4997 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
4998}
void SetInstantCast(bool set)
Definition: Unit.h:2450
void ApplyCastTimePercentMod(float val, bool apply)
Definition: Unit.cpp:17335

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
3622{
3623 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3624 return;
3625
3626 Unit* target = aurApp->GetTarget();
3627
3628 Unit* caster = GetCaster();
3629
3630 if (apply)
3631 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3632 else
3633 target->RemoveCharmedBy(caster);
3634}
@ CHARM_TYPE_CHARM
Definition: Unit.h:1087

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

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
5274{
5276 return;
5277
5278 Unit* target = aurApp->GetTarget();
5279 if (!target)
5280 return;
5281
5282 if (!sScriptMgr->CanModAuraEffectModDamagePercentDone(this, target, aurApp, mode, apply))
5283 return;
5284
5285 if (target->GetTypeId() == TYPEID_PLAYER)
5286 {
5287 for (int i = 0; i < MAX_ATTACK; ++i)
5288 if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), false))
5289 target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply);
5290 }
5291
5292 if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) && (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER))
5293 {
5297
5298 if (target->GetTypeId() == TYPEID_PLAYER)
5300 }
5301 else
5302 {
5303 // done in Player::_ApplyWeaponDependentAuraMods for SPELL_SCHOOL_MASK_NORMAL && EquippedItemClass != -1 and also for wand case
5304 }
5305}
@ 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
3499{
3500 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3501 return;
3502
3503 Unit* target = aurApp->GetTarget();
3504
3505 target->SetControlled(apply, UNIT_STATE_FLEEING, GetCaster(), true);
3506}
@ 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
4549{
4551 return;
4552
4553 Unit* target = aurApp->GetTarget();
4554
4555 if (target->GetTypeId() != TYPEID_PLAYER)
4556 return;
4557 // implemented in Unit::SpellHealingBonus
4558 // this information is for client side only
4560}
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
4899{
4901 return;
4902
4903 Unit* target = aurApp->GetTarget();
4904
4905 if (target->GetTypeId() == TYPEID_PLAYER)
4906 {
4907 target->ToPlayer()->UpdateMeleeHitChances();
4908 target->ToPlayer()->UpdateRangedHitChances();
4909 }
4910 else
4911 {
4912 target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
4913 target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
4914 }
4915}
void UpdateMeleeHitChances()
Definition: StatSystem.cpp:860
void UpdateRangedHitChances()
Definition: StatSystem.cpp:866
float m_modRangedHitChance
Definition: Unit.h:2100
float m_modMeleeHitChance
Definition: Unit.h:2099

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

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddFlag(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddValue(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK, AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION, Unit::bRequestForcedVisibilityUpdate, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::DelFlag(), GetAmount(), Unit::GetAuraEffectsByType(), WorldObject::GetMap(), GetMiscValue(), Unit::GetOwnerGUID(), AuraApplication::GetTarget(), 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
4682{
4684 return;
4685
4686 Unit* target = aurApp->GetTarget();
4687
4688 if (target->GetTypeId() != TYPEID_PLAYER)
4689 return;
4690
4691 //Note: an increase in regen does NOT cause threat.
4692 target->ToPlayer()->UpdateManaRegen();
4693}
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
4135{
4136 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4137 return;
4138
4139 Unit* target = aurApp->GetTarget();
4140 uint32 mechanic = 0;
4141
4142 switch (GetId())
4143 {
4144 case 46924: // BladeStorm
4146 break;
4147 case 34471: // The Beast Within
4148 case 19574: // Bestial Wrath
4166 break;
4167 case 42292: // PvP trinket
4168 case 59752: // Every Man for Himself
4169 case 65547: // PvP trinket for Faction Champions (ToC 25)
4170 case 53490: // Bullheaded
4171 case 46227: // Medalion of Immunity
4173 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.
4174 // Actually we should apply immunities here, too, but the aura has only 100 ms duration, so there is practically no point
4175 break;
4176 case 54508: // Demonic Empowerment
4177 mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
4182 break;
4183 default:
4184 if (GetMiscValue() < 1)
4185 return;
4186 mechanic = 1 << GetMiscValue();
4188 break;
4189 }
4190
4191 if (apply && GetSpellInfo()->HasAttribute(SPELL_ATTR1_IMMUNITY_PURGES_EFFECT))
4192 {
4193 // Xinef: exception for purely snare mechanic (eg. hands of freedom)!
4194 if (mechanic == (1 << MECHANIC_SNARE))
4195 target->RemoveMovementImpairingAuras(false);
4196 else
4198 }
4199}
@ SPELL_AURA_PREVENTS_FLEEING
Definition: SpellAuraDefines.h:155
@ AURA_REMOVE_BY_DEFAULT
Definition: SpellAuraDefines.h:392
@ MECHANIC_FEAR
Definition: SharedDefines.h:1330
@ MECHANIC_DISORIENTED
Definition: SharedDefines.h:1327
@ MECHANIC_KNOCKOUT
Definition: SharedDefines.h:1339
@ MECHANIC_CHARM
Definition: SharedDefines.h:1326
@ MECHANIC_TURN
Definition: SharedDefines.h:1348
@ MECHANIC_STUN
Definition: SharedDefines.h:1337
@ MECHANIC_FREEZE
Definition: SharedDefines.h:1338
@ MECHANIC_ROOT
Definition: SharedDefines.h:1332
@ MECHANIC_SLEEP
Definition: SharedDefines.h:1335
@ MECHANIC_DAZE
Definition: SharedDefines.h:1352
@ MECHANIC_SNARE
Definition: SharedDefines.h:1336
@ MECHANIC_SHACKLE
Definition: SharedDefines.h:1345
@ MECHANIC_SAPPED
Definition: SharedDefines.h:1355
@ MECHANIC_HORROR
Definition: SharedDefines.h:1349
#define IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK
Definition: SharedDefines.h:1361
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition: Unit.cpp:5193
void RemoveMovementImpairingAuras(bool withRoot)
Definition: Unit.cpp:5169

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
4465{
4467 return;
4468
4469 Unit* target = aurApp->GetTarget();
4470
4471 if (GetMiscValue() < -1 || GetMiscValue() > 4)
4472 {
4473 LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4474 return;
4475 }
4476
4477 // only players have base stats
4478 if (target->GetTypeId() != TYPEID_PLAYER)
4479 return;
4480
4481 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
4482 {
4483 if (GetMiscValue() == i || GetMiscValue() == -1)
4484 target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_amount), apply);
4485 }
4486}

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
3547{
3548 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3549 return;
3550
3551 Unit* target = aurApp->GetTarget();
3552
3553 Unit* caster = GetCaster();
3554
3555 // no support for posession AI yet
3556 if (caster && caster->GetTypeId() == TYPEID_UNIT)
3557 {
3558 HandleModCharm(aurApp, mode, apply);
3559 return;
3560 }
3561
3562 if (apply)
3563 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3564 else
3565 target->RemoveCharmedBy(caster);
3566}
@ CHARM_TYPE_POSSESS
Definition: Unit.h:1088
void HandleModCharm(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3621

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
3569{
3570 // Used by spell "Eyes of the Beast"
3571
3572 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3573 return;
3574
3575 Unit* caster = GetCaster();
3576 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
3577 return;
3578
3579 //seems it may happen that when removing it is no longer owner's pet
3580 //if (caster->ToPlayer()->GetPet() != target)
3581 // return;
3582
3583 Unit* target = aurApp->GetTarget();
3584 if (target->GetTypeId() != TYPEID_UNIT || !target->IsPet())
3585 return;
3586
3587 Pet* pet = target->ToPet();
3588
3589 if (apply)
3590 {
3591 if (caster->ToPlayer()->GetPet() != pet)
3592 return;
3593
3594 // Must clear current motion or pet leashes back to owner after a few yards
3595 // when under spell 'Eyes of the Beast'
3596 pet->GetMotionMaster()->Clear();
3597 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3598 }
3599 else
3600 {
3601 pet->RemoveCharmedBy(caster);
3602
3603 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
3604 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
3605 else
3606 {
3607 // Reinitialize the pet bar or it will appear greyed out
3608 caster->ToPlayer()->PetSpellInitialize();
3609
3610 // Follow owner only if not fighting or owner didn't click "stay" at new location
3611 // This may be confusing because pet bar shows "stay" when under the spell but it retains
3612 // the "follow" flag. Player MUST click "stay" while under the spell.
3613 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3614 {
3616 }
3617 }
3618 }
3619}
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:45
#define PET_FOLLOW_DIST
Definition: PetDefines.h:198
@ COMMAND_STAY
Definition: Unit.h:1042
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:875
void PetSpellInitialize()
Definition: Player.cpp:9387
bool HasCommandState(CommandStates state) const
Definition: Unit.h:1116
Pet * ToPet()
Definition: Unit.h:2412
CharmInfo * GetCharmInfo()
Definition: Unit.h:1897
Unit * GetVictim() const
Definition: Unit.h:1398
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
Definition: MotionMaster.cpp:394
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
5350{
5352 return;
5353
5354 Unit* target = aurApp->GetTarget();
5355
5356 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5357 if (GetMiscValue() & (1 << i))
5359}
@ 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
5337{
5339 return;
5340
5341 Unit* target = aurApp->GetTarget();
5342
5343 float amount = CalculatePct(1.0f, GetAmount());
5344 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
5345 if (GetMiscValue() & (1 << i))
5347}
@ 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
4659{
4661 return;
4662
4663 Unit* target = aurApp->GetTarget();
4664
4665 if (target->GetTypeId() != TYPEID_PLAYER)
4666 return;
4667
4668 // Update manaregen value
4669 if (GetMiscValue() == POWER_MANA)
4670 target->ToPlayer()->UpdateManaRegen();
4671 else if (GetMiscValue() == POWER_RUNE)
4673 // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
4674}
@ POWER_RUNE
Definition: SharedDefines.h:274
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
4677{
4678 HandleModPowerRegen(aurApp, mode, apply);
4679}
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:4658

References HandleModPowerRegen().

◆ HandleModRating()

void AuraEffect::HandleModRating ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
5075{
5077 return;
5078
5079 Unit* target = aurApp->GetTarget();
5080
5081 if (target->GetTypeId() != TYPEID_PLAYER)
5082 return;
5083
5084 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
5085 if (GetMiscValue() & (1 << rating))
5086 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
5087}
#define MAX_COMBAT_RATING
Definition: Unit.h:431
CombatRating
Definition: Unit.h:403
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition: Player.cpp:5174

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
5090{
5092 return;
5093
5094 Unit* target = aurApp->GetTarget();
5095
5096 if (target->GetTypeId() != TYPEID_PLAYER)
5097 return;
5098
5099 // Just recalculate ratings
5100 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
5101 if (GetMiscValue() & (1 << rating))
5102 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
5103}

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
4381{
4383 return;
4384
4385 Unit* target = aurApp->GetTarget();
4386
4387 for (int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
4388 {
4389 if (GetMiscValue() & int32(1 << i))
4390 {
4392 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
4393 {
4394 target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)GetAmount(), apply);
4395 target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)GetAmount(), apply);
4396 }
4397 }
4398 }
4399}
void ApplyResistanceBuffModsPercentMod(SpellSchools school, bool positive, float val, bool apply)
Definition: Unit.h:2042

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
4944{
4946 return;
4947
4948 Unit* target = aurApp->GetTarget();
4949
4950 if (target->GetTypeId() != TYPEID_PLAYER)
4951 return;
4952
4953 for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
4954 if (GetMiscValue() & (1 << school))
4955 target->ToPlayer()->UpdateSpellCritChance(school);
4956}
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
4519{
4521 return;
4522
4523 Unit* target = aurApp->GetTarget();
4524
4525 if (target->GetTypeId() != TYPEID_PLAYER)
4526 return;
4527
4528 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4529 // This information for client side use only
4530 // Recalculate bonus
4532}

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
4489{
4491 return;
4492
4493 Unit* target = aurApp->GetTarget();
4494
4495 if (target->GetTypeId() != TYPEID_PLAYER)
4496 return;
4497
4498 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4499 // This information for client side use only
4500 // Recalculate bonus
4502}

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
4918{
4920 return;
4921
4922 Unit* target = aurApp->GetTarget();
4923
4924 if (target->GetTypeId() == TYPEID_PLAYER)
4925 target->ToPlayer()->UpdateSpellHitChances();
4926 else
4927 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
4928}
void UpdateSpellHitChances()
Definition: StatSystem.cpp:872
float m_modSpellHitChance
Definition: Unit.h:2101

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

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
1617{
1619 return;
1620
1621 Unit* target = aurApp->GetTarget();
1623
1624 if (apply)
1625 {
1626 target->m_stealthDetect.AddFlag(type);
1627 target->m_stealthDetect.AddValue(type, GetAmount());
1628 }
1629 else
1630 {
1632 target->m_stealthDetect.DelFlag(type);
1633
1634 target->m_stealthDetect.AddValue(type, -GetAmount());
1635 }
1636
1637 // call functions which may have additional effects after chainging state of unit
1638 target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer());
1639}
@ SPELL_AURA_MOD_STEALTH_DETECT
Definition: SpellAuraDefines.h:80
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition: Object.h: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
1691{
1693 return;
1694
1695 Unit* target = aurApp->GetTarget();
1697
1698 if (apply)
1699 target->m_stealth.AddValue(type, GetAmount());
1700 else
1701 target->m_stealth.AddValue(type, -GetAmount());
1702
1703 // call functions which may have additional effects after chainging state of unit
1704 target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer());
1705}

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

◆ HandleModTargetResistance()

void AuraEffect::HandleModTargetResistance ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
4417{
4419 return;
4420
4421 Unit* target = aurApp->GetTarget();
4422
4423 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
4424
4425 // show armor penetration
4428
4429 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
4432}
@ PLAYER_FIELD_MOD_TARGET_RESISTANCE
Definition: UpdateFields.h:366
@ PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
Definition: UpdateFields.h:367
@ SPELL_SCHOOL_MASK_SPELL
Definition: SharedDefines.h:308

References Object::ApplyModInt32Value(), AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK, AURA_EFFECT_HANDLE_STAT, GetAmount(), GetMiscValue(), AuraApplication::GetTarget(), Object::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
3462{
3463 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3464 return;
3465
3466 Unit* target = aurApp->GetTarget();
3467
3468 if (!target->IsAlive() || !target->CanHaveThreatList())
3469 return;
3470
3471 Unit* caster = GetCaster();
3472 if (!caster || !caster->IsAlive())
3473 return;
3474
3475 if (apply)
3476 target->TauntApply(caster);
3477 else
3478 {
3479 // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat
3480 target->TauntFadeOut(caster);
3481 }
3482}
void TauntApply(Unit *victim)
Definition: Unit.cpp:14650
void TauntFadeOut(Unit *taunter)
Definition: Unit.cpp:14680

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

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

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
2929{
2931 return;
2932
2933 Unit* target = aurApp->GetTarget();
2934
2935 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2936 if (!apply && target->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
2937 return;
2938
2940
2941 // call functions which may have additional effects after chainging state of unit
2942 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
2943 {
2944 // xinef: this aura should not stop combat (movie with sindragosa proves that)
2945 //target->CombatStop();
2947 }
2948}
@ UNIT_FLAG_NON_ATTACKABLE
Definition: 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
163 {
164 // aura type not have immediate effect at add/remove and handled by ID in other code place
165 }

◆ HandleNoReagentUseAura()

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

References AURA_EFFECT_HANDLE_REAL, Unit::GetAuraEffectsByType(), AuraApplication::GetTarget(), Object::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
155 {
156 // not implemented
157 }

◆ HandleObsModPowerAuraTick()

void AuraEffect::HandleObsModPowerAuraTick ( Unit target,
Unit caster 
) const
7155{
7157 if (GetMiscValue() == POWER_ALL)
7158 PowerType = target->getPowerType();
7159 else
7161
7162 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
7163 return;
7164
7165 if (target->HasUnitState(UNIT_STATE_ISOLATED))
7166 {
7167 SendTickImmune(target, caster);
7168 return;
7169 }
7170
7171 // don't regen when permanent aura target has full power
7172 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
7173 return;
7174
7175 // ignore negative values (can be result apply spellmods to aura damage
7176 uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(PowerType) / 100;
7177 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
7178 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
7179 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
7180 target->SendPeriodicAuraLog(&pInfo);
7181
7182 int32 gain = target->ModifyPower(PowerType, amount);
7183
7184 if (caster)
7185 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
7186}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:169
@ POWER_ALL
Definition: SharedDefines.h:277
std::string ToString(Type &&val, Params &&... params)
Definition: StringConvert.h:250
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=nullptr)
Definition: HostileRefMgr.cpp:35
std::string ToString() const
Definition: ObjectGuid.cpp:47
Definition: Unit.h:943
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:14137
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1476
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1410
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition: Unit.cpp:6327
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1096

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

Referenced by PeriodicTick().

◆ HandlePeriodicDamageAurasTick()

void AuraEffect::HandlePeriodicDamageAurasTick ( Unit target,
Unit caster 
) const
6645{
6646 if (!target->IsAlive())
6647 return;
6648
6649 if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamageOrSchool(GetSpellInfo()) || target->IsTotem())
6650 {
6651 SendTickImmune(target, caster);
6652 return;
6653 }
6654
6655 // Consecrate ticks can miss and will not show up in the combat log
6656 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6657 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6658 return;
6659
6660 // some auras remove at specific health level or more
6662 {
6663 switch (GetSpellInfo()->Id)
6664 {
6665 case 43093:
6666 case 31956:
6667 case 38801: // Grievous Wound
6668 case 35321:
6669 case 38363:
6670 case 39215: // Gushing Wound
6671 if (target->IsFullHealth())
6672 {
6673 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6674 return;
6675 }
6676 break;
6677 case 38772: // Grievous Wound
6678 {
6679 uint32 percent = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster);
6680 if (!target->HealthBelowPct(percent))
6681 {
6682 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
6683 return;
6684 }
6685 break;
6686 }
6687 }
6688 }
6689
6691
6692 // ignore non positive values (can be result apply spellmods to aura damage
6693 uint32 damage = std::max(GetAmount(), 0);
6694
6695 // If the damage is percent-max-health based, calculate damage before the Modify hook
6697 {
6698 // xinef: ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
6699 damage = uint32(std::ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
6700 }
6701
6702 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6703 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6704
6705 if (target->GetAI())
6706 {
6707 target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
6708 }
6709
6711 {
6712 // xinef: leave only target depending bonuses, rest is handled in calculate amount
6713 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE && caster)
6714 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6715 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6716
6717 // Calculate armor mitigation
6719 {
6720 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6721 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6722 damage = damageReductedArmor;
6723 }
6724
6725 // Curse of Agony damage-per-tick calculation
6726 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x400) && GetSpellInfo()->SpellIconID == 544)
6727 {
6728 uint32 totalTick = GetTotalTicks();
6729 // 1..4 ticks, 1/2 from normal tick damage
6730 if (m_tickNumber <= totalTick / 3)
6731 damage = damage / 2;
6732 // 9..12 ticks, 3/2 from normal tick damage
6733 else if (m_tickNumber > totalTick * 2 / 3)
6734 damage += (damage + 1) / 2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
6735 // 5..8 ticks have normal tick damage
6736 }
6737 }
6738
6739 // calculate crit chance
6740 bool crit = false;
6741 if ((crit = roll_chance_f(GetCritChance())))
6742 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6743
6744 // Auras reducing damage from AOE spells
6745 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
6746 {
6747 damage = target->CalculateAOEDamageReduction(damage, GetSpellInfo()->SchoolMask, caster);
6748 }
6749
6750 int32 dmg = damage;
6751 int32 mitigatedDamage = cleanDamage.mitigated_damage;
6752 if (CanApplyResilience())
6753 {
6754 int32 resilienceReduction = dmg;
6755 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6756
6757 resilienceReduction = dmg - resilienceReduction;
6758 dmg -= resilienceReduction;
6759 mitigatedDamage += resilienceReduction;
6760 }
6761
6762 damage = std::max(0, dmg);
6763 cleanDamage.mitigated_damage = std::max(0, mitigatedDamage);
6764
6765 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6766 Unit::CalcAbsorbResist(dmgInfo);
6767
6768 uint32 absorb = dmgInfo.GetAbsorb();
6769 uint32 resist = dmgInfo.GetResist();
6770 damage = dmgInfo.GetDamage();
6771
6772 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} attacked {} for {} dmg inflicted by {} abs is {}",
6773 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6774 Unit::DealDamageMods(target, damage, &absorb);
6775
6776 // Set trigger flag
6777 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6778 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6780 if (absorb > 0)
6781 procEx |= PROC_EX_ABSORB;
6782
6783 if (damage)
6784 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6785
6786 int32 overkill = damage - target->GetHealth();
6787 if (overkill < 0)
6788 overkill = 0;
6789
6790 SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
6791 target->SendPeriodicAuraLog(&pInfo);
6792
6793 Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
6794
6795 Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6796}
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:32
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
Definition: SharedDefines.h:805
@ SPELLFAMILY_WARLOCK
Definition: SharedDefines.h:3533
@ SPELL_MISS_NONE
Definition: SharedDefines.h:1519
virtual void OnCalculatePeriodicTickReceived(uint32 &, Unit *)
Definition: UnitAI.h:372
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:2011
int32 CalculateAOEDamageReduction(int32 damage, uint32 schoolMask, Unit *caster) const
Definition: Unit.cpp:20741
bool IsFullHealth() const
Definition: Unit.h:1457
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition: Unit.cpp:3434
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition: Unit.cpp:12275
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:1458
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition: Unit.cpp:11785
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition: Unit.cpp:19191
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:6316
UnitAI * GetAI()
Definition: Unit.h:1328
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition: Unit.cpp:1988
bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:12895
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false)
Definition: Unit.cpp:2127
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:111
float GetCritChance() const
Definition: SpellAuraEffects.h:108
int32 GetTotalTicks() const
Definition: SpellAuraEffects.cpp:7420
uint8 GetCasterLevel() const
Definition: SpellAuraEffects.h:110
uint32 SchoolMask
Definition: SpellInfo.h:390

References Unit::ApplyResilience(), BASE_ATTACK, Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), Unit::CalculateAOEDamageReduction(), CanApplyResilience(), CR_CRIT_TAKEN_SPELL, Unit::DealDamage(), Unit::DealDamageMods(), DOT, DYNOBJ_AURA_TYPE, EFFECT_1, SpellInfo::Effects, DamageInfo::GetAbsorb(), Unit::GetAI(), GetAmount(), GetAuraType(), GetBase(), GetCasterGUID(), GetCasterLevel(), GetCritChance(), DamageInfo::GetDamage(), GetEffIndex(), Object::GetGUID(), Unit::GetHealth(), GetId(), Unit::GetMaxHealth(), DamageInfo::GetResist(), GetSpellInfo(), GetTotalTicks(), Unit::HasUnitState(), Unit::HealthBelowPct(), Unit::IsAlive(), Unit::IsDamageReducedByArmor(), Unit::IsFullHealth(), Unit::IsImmunedToDamageOrSchool(), Unit::IsTotem(), LOG_DEBUG, m_spellInfo, m_tickNumber, MELEE_HIT_NORMAL, CleanDamage::mitigated_damage, UnitAI::OnCalculatePeriodicTickReceived(), PROC_EX_ABSORB, PROC_EX_CRITICAL_HIT, PROC_EX_INTERNAL_DOT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_PERIODIC, PROC_FLAG_TAKEN_DAMAGE, PROC_FLAG_TAKEN_PERIODIC, Unit::ProcDamageAndSpell(), Unit::RemoveAurasDueToSpell(), roll_chance_f(), SpellInfo::SchoolMask, Unit::SendPeriodicAuraLog(), SendTickImmune(), SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_EFFECT_PERSISTENT_AREA_AURA, SPELL_MISS_NONE, Unit::SpellCriticalDamageBonus(), Unit::SpellDamageBonusDone(), Unit::SpellDamageBonusTaken(), SPELLFAMILY_WARLOCK, Unit::SpellHitResult(), sScriptMgr, ObjectGuid::ToString(), and UNIT_STATE_ISOLATED.

Referenced by PeriodicTick().

◆ HandlePeriodicDummyAuraTick()

void AuraEffect::HandlePeriodicDummyAuraTick ( Unit target,
Unit caster 
) const
6235{
6236 switch (GetSpellInfo()->SpellFamilyName)
6237 {
6238 case SPELLFAMILY_DRUID:
6239 {
6240 switch (GetSpellInfo()->Id)
6241 {
6242 // Frenzied Regeneration
6243 case 22842:
6244 {
6245 // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health.
6246 // Should be manauser
6247 if (target->getPowerType() != POWER_RAGE)
6248 break;
6249 uint32 rage = target->GetPower(POWER_RAGE);
6250 // Nothing todo
6251 if (rage == 0)
6252 break;
6253 int32 mod = (rage < 100) ? rage : 100;
6254 int32 points = target->CalculateSpellDamage(target, GetSpellInfo(), 1);
6255 int32 regen = target->GetMaxHealth() * (mod * points / 10) / 1000;
6256 target->CastCustomSpell(target, 22845, &regen, 0, 0, true, 0, this);
6257 target->SetPower(POWER_RAGE, rage - mod);
6258 break;
6259 }
6260 }
6261 break;
6262 }
6263 case SPELLFAMILY_HUNTER:
6264 {
6265 // Explosive Shot
6266 if (GetSpellInfo()->SpellFamilyFlags[1] & 0x80000000)
6267 {
6268 if (caster)
6269 caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, target, true, nullptr, this);
6270 break;
6271 }
6272 switch (GetSpellInfo()->Id)
6273 {
6274 // Feeding Frenzy Rank 1
6275 case 53511:
6276 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
6277 target->CastSpell(target, 60096, true, 0, this);
6278 return;
6279 // Feeding Frenzy Rank 2
6280 case 53512:
6281 if (target->GetVictim() && target->GetVictim()->HealthBelowPct(35))
6282 target->CastSpell(target, 60097, true, 0, this);
6283 return;
6284 default:
6285 break;
6286 }
6287 break;
6288 }
6289 case SPELLFAMILY_SHAMAN:
6290 if (GetId() == 52179) // Astral Shift
6291 {
6292 // Periodic need for remove visual on stun/fear/silence lost
6294 target->RemoveAurasDueToSpell(52179);
6295 break;
6296 }
6297 break;
6299 switch (GetId())
6300 {
6301 case 49016: // Hysteria
6302 uint32 damage = uint32(target->CountPctFromMaxHealth(1));
6303 Unit::DealDamage(target, target, damage, nullptr, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
6304 break;
6305 }
6306 // Blood of the North
6307 // Reaping
6308 // Death Rune Mastery
6309 if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
6310 {
6311 if (target->GetTypeId() != TYPEID_PLAYER)
6312 return;
6313 if (target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
6314 return;
6315
6316 // timer expired - remove death runes
6317 target->ToPlayer()->RemoveRunesByAuraEffect(this);
6318 }
6319 break;
6320 default:
6321 break;
6322 }
6323}
@ 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:3537
@ SPELLFAMILY_DEATHKNIGHT
Definition: SharedDefines.h:3543
UnitFlags GetUnitFlags() const
Definition: Unit.h:1493
uint32 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:1463
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
7189{
7191
7193 return;
7194
7195 if (!target->IsAlive() || !target->GetMaxPower(PowerType))
7196 return;
7197
7198 if (target->HasUnitState(UNIT_STATE_ISOLATED))
7199 {
7200 SendTickImmune(target, caster);
7201 return;
7202 }
7203
7204 // don't regen when permanent aura target has full power
7205 if (GetBase()->IsPermanent() && target->GetPower(PowerType) == target->GetMaxPower(PowerType))
7206 return;
7207
7208 // ignore negative values (can be result apply spellmods to aura damage
7209 int32 amount = std::max(m_amount, 0);
7210
7211 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
7212 target->SendPeriodicAuraLog(&pInfo);
7213
7214 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
7215 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
7216 int32 gain = target->ModifyPower(PowerType, amount);
7217
7218 if (caster)
7219 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
7220}
@ SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED
Definition: SharedDefines.h:657

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
6934{
6935 if (!target->IsAlive())
6936 return;
6937
6938 if (target->HasUnitState(UNIT_STATE_ISOLATED))
6939 {
6940 SendTickImmune(target, caster);
6941 return;
6942 }
6943
6944 // heal for caster damage (must be alive)
6945 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST) && (!caster || !caster->IsAlive()))
6946 return;
6947
6948 // don't regen when permanent aura target has full power
6949 if (GetBase()->IsPermanent() && target->IsFullHealth())
6950 return;
6951
6952 // ignore negative values (can be result apply spellmods to aura damage
6953 int32 damage = std::max(m_amount, 0);
6954
6956 {
6957 // Taken mods
6958 float TakenTotalMod = 1.0f;
6959
6960 // Tenacity increase healing % taken
6961 if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0))
6962 AddPct(TakenTotalMod, Tenacity->GetAmount());
6963
6964 // Healing taken percent
6965 float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6966 if (minval)
6967 AddPct(TakenTotalMod, minval);
6968
6969 float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6970 if (maxval)
6971 AddPct(TakenTotalMod, maxval);
6972
6973 // Healing over time taken percent
6974 float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
6975 if (minval_hot)
6976 AddPct(TakenTotalMod, minval_hot);
6977
6978 float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
6979 if (maxval_hot)
6980 AddPct(TakenTotalMod, maxval_hot);
6981
6982 // Arena / BG Dampening
6983 float minval_pct = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
6984 if (minval_pct)
6985 AddPct(TakenTotalMod, minval_pct);
6986
6987 TakenTotalMod = std::max(TakenTotalMod, 0.0f);
6988
6989 // the most ugly hack i made :P the other option is to change all spellvalues to float...
6990 // demonic aegis
6991 if (caster && GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[1] & 0x20000000))
6993 AddPct(TakenTotalMod, aurEff->GetAmount());
6994
6995 damage = uint32(target->CountPctFromMaxHealth(damage));
6996 damage = uint32(damage * TakenTotalMod);
6997 }
6998 else
6999 {
7000 // Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100
7001 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellInfo()->SpellIconID == 2864)
7002 {
7003 uint32 tickNumber = GetTickNumber() - 1;
7004 int32 tempAmount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, nullptr);
7005
7006 float drop = 2.0f;
7007
7008 // Item - Druid T10 Restoration 2P Bonus
7009 if (caster)
7010 if (AuraEffect* aurEff = caster->GetAuraEffect(70658, 0))
7011 AddPct(drop, -aurEff->GetAmount());
7012
7013 damage += GetTotalTicks() * tempAmount * (6 - (drop * tickNumber)) * 0.01f;
7014 }
7015
7016 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
7017 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
7018 damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
7019 }
7020
7021 bool crit = false;
7022 if ((crit = roll_chance_f(GetCritChance())))
7023 damage = Unit::SpellCriticalHealingBonus(caster, GetSpellInfo(), damage, target);
7024
7025 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} heal of {} for {} health inflicted by {}",
7026 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId());
7027
7028 uint32 heal = uint32(damage);
7029
7030 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
7031 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, heal, GetSpellInfo());
7032 sScriptMgr->ModifyHealReceived(target, caster, heal, GetSpellInfo());
7033
7034 if (target->GetAI())
7035 {
7036 target->GetAI()->OnCalculatePeriodicTickReceived(heal, caster);
7037 }
7038
7039 HealInfo healInfo(caster, target, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
7040 Unit::CalcHealAbsorb(healInfo);
7041 int32 gain = Unit::DealHeal(caster, target, healInfo.GetHeal());
7042 healInfo.SetEffectiveHeal(gain);
7043
7044 SpellPeriodicAuraLogInfo pInfo(this, healInfo.GetHeal(), healInfo.GetHeal() - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
7045 target->SendPeriodicAuraLog(&pInfo);
7046
7047 if (caster)
7048 target->getHostileRefMgr().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
7049
7050 bool haveCastItem = GetBase()->GetCastItemGUID();
7051
7052 // Health Funnel
7053 // damage caster for heal amount
7054 // xinef: caster is available, checked earlier
7055 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST))
7056 {
7057 uint32 manaPerSecond = GetSpellInfo()->ManaPerSecond;
7058 if ((int32)manaPerSecond > gain && gain > 0)
7059 {
7060 manaPerSecond = gain;
7061 }
7062
7063 uint32 absorb2 = 0;
7064 Unit::DealDamageMods(caster, manaPerSecond, &absorb2);
7065
7067 Unit::DealDamage(caster, caster, manaPerSecond, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
7068 }
7069
7070 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
7071 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
7073 if (healInfo.GetAbsorb() > 0)
7074 procEx |= PROC_EX_ABSORB;
7075
7076 // ignore item heals
7077 if (!haveCastItem && GetAuraType() != SPELL_AURA_OBS_MOD_HEALTH) // xinef: dont allow obs_mod_health to proc spells, this is passive regeneration and not hot
7078 Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, heal, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, nullptr, &healInfo);
7079}
@ 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:467
Definition: Unit.h:804
static void CalcHealAbsorb(HealInfo &healInfo)
Definition: Unit.cpp:2474
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition: Unit.cpp:10945
int32 GetMaxPositiveAuraModifier(AuraType auratype)
Definition: Unit.cpp:5873
static uint32 SpellCriticalHealingBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition: Unit.cpp:12315
int32 GetMaxNegativeAuraModifier(AuraType auratype) const
Definition: Unit.cpp:5887
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition: Unit.cpp:12564
uint32 GetTickNumber() const
Definition: SpellAuraEffects.h:87
AuraObjectType GetType() const
Definition: SpellAuras.cpp:481
ObjectGuid GetCastItemGUID() const
Definition: SpellAuras.h:103
uint32 ManaPerSecond
Definition: SpellInfo.h:363

References AddPct(), BASE_ATTACK, Unit::CalcHealAbsorb(), Unit::CountPctFromMaxHealth(), Unit::DealDamage(), Unit::DealDamageMods(), Unit::DealHeal(), DOT, DYNOBJ_AURA_TYPE, SpellInfo::Effects, HealInfo::GetAbsorb(), Unit::GetAI(), Unit::GetAuraEffect(), GetAuraType(), GetBase(), GetCasterGUID(), Aura::GetCastItemGUID(), GetCritChance(), HealInfo::GetEffectiveHeal(), GetEffIndex(), Object::GetGUID(), HealInfo::GetHeal(), Unit::getHostileRefMgr(), GetId(), Unit::GetMaxNegativeAuraModifier(), Unit::GetMaxPositiveAuraModifier(), GetSpellInfo(), Aura::GetStackAmount(), GetTickNumber(), GetTotalTicks(), Aura::GetType(), Unit::HasUnitState(), Unit::IsAlive(), Unit::IsFullHealth(), LOG_DEBUG, m_amount, m_baseAmount, m_effIndex, m_spellInfo, SpellInfo::ManaPerSecond, MELEE_HIT_NORMAL, UnitAI::OnCalculatePeriodicTickReceived(), PROC_EX_ABSORB, PROC_EX_CRITICAL_HIT, PROC_EX_INTERNAL_HOT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_PERIODIC, PROC_FLAG_TAKEN_PERIODIC, Unit::ProcDamageAndSpell(), roll_chance_f(), SELF_DAMAGE, Unit::SendPeriodicAuraLog(), SendTickImmune(), HealInfo::SetEffectiveHeal(), SPELL_ATTR2_NO_TARGET_PER_SECOND_COST, SPELL_AURA_ADD_PCT_MODIFIER, SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELL_AURA_MOD_HEALING_PCT, SPELL_AURA_MOD_HOT_PCT, SPELL_AURA_OBS_MOD_HEALTH, Unit::SpellCriticalHealingBonus(), SPELLFAMILY_DRUID, SPELLFAMILY_WARLOCK, Unit::SpellHealingBonusDone(), Unit::SpellHealingBonusTaken(), sScriptMgr, HostileRefMgr::threatAssist(), ObjectGuid::ToString(), and UNIT_STATE_ISOLATED.

Referenced by PeriodicTick().

◆ HandlePeriodicHealthFunnelAuraTick()

void AuraEffect::HandlePeriodicHealthFunnelAuraTick ( Unit target,
Unit caster 
) const
6905{
6906 if (!caster || !caster->IsAlive() || !target->IsAlive())
6907 return;
6908
6909 if (target->HasUnitState(UNIT_STATE_ISOLATED))
6910 {
6911 SendTickImmune(target, caster);
6912 return;
6913 }
6914
6915 uint32 damage = std::max(GetAmount(), 0);
6916 // do not kill health donator
6917 if (caster->GetHealth() < damage)
6918 damage = caster->GetHealth() - 1;
6919 if (!damage)
6920 return;
6921
6922 caster->ModifyHealth(-(int32)damage);
6923 LOG_DEBUG("spells.aura", "PeriodicTick: donator {} target {} damage {}.", caster->GetEntry(), target->GetEntry(), damage);
6924
6925 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6926
6927 damage = int32(damage * gainMultiplier);
6928
6929 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6930 caster->HealBySpell(healInfo);
6931}
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition: Unit.cpp:11238

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
6799{
6800 if (!target->IsAlive())
6801 return;
6802
6804 {
6805 SendTickImmune(target, caster);
6806 return;
6807 }
6808
6809 if (caster && GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
6810 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6811 return;
6812
6814
6815 uint32 damage = std::max(GetAmount(), 0);
6816
6817 // Script Hook For HandlePeriodicHealthLeechAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6818 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
6819
6820 if (target->GetAI())
6821 {
6822 target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
6823 }
6824
6825 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
6826 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
6827 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
6828
6829 bool crit = false;
6830 if ((crit = roll_chance_f(GetCritChance())))
6831 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
6832
6833 // Calculate armor mitigation
6835 {
6836 uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel());
6837 cleanDamage.mitigated_damage += damage - damageReductedArmor;
6838 damage = damageReductedArmor;
6839 }
6840
6841 int32 dmg = damage;
6842 int32 cleanDamageAmount = cleanDamage.mitigated_damage;
6843 if (CanApplyResilience())
6844 {
6845 int32 resilienceReduction = dmg;
6846 Unit::ApplyResilience(target, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
6847
6848 resilienceReduction = dmg - resilienceReduction;
6849 dmg -= resilienceReduction;
6850 cleanDamageAmount += resilienceReduction;
6851 }
6852
6853 damage = std::max(0, dmg);
6854 cleanDamage.mitigated_damage = std::max(0, cleanDamageAmount);
6855
6856 DamageInfo dmgInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, cleanDamage.mitigated_damage);
6857 Unit::CalcAbsorbResist(dmgInfo);
6858
6859 uint32 absorb = dmgInfo.GetAbsorb();
6860 uint32 resist = dmgInfo.GetResist();
6861 damage = dmgInfo.GetDamage();
6862
6863 // Set trigger flag
6864 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6865 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6867 if (absorb > 0)
6868 procEx |= PROC_EX_ABSORB;
6869
6870 if (dmgInfo.GetDamage())
6871 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6872
6873 if (target->GetHealth() < dmgInfo.GetDamage())
6874 {
6875 dmgInfo.ModifyDamage(dmgInfo.GetDamage() - target->GetHealth());
6876 }
6877
6878 damage = dmgInfo.GetDamage();
6879
6880 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} health leech of {} for {} dmg inflicted by {} abs is {}",
6881 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
6882 if (caster)
6883 caster->SendSpellNonMeleeDamageLog(target, GetSpellInfo(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit);
6884
6885 int32 new_damage;
6886
6887 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
6888
6889 Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
6890
6891 if (!caster || !caster->IsAlive())
6892 return;
6893
6894 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
6895
6896 uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount()));
6897 heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount()));
6898
6899 HealInfo healInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6900 int32 gain = caster->HealBySpell(healInfo);
6901 caster->getHostileRefMgr().threatAssist(caster, gain * 0.5f, GetSpellInfo());
6902}
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition: Unit.cpp:6248

References Unit::ApplyResilience(), BASE_ATTACK, Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), CanApplyResilience(), CR_CRIT_TAKEN_SPELL, Unit::DealDamage(), DOT, DYNOBJ_AURA_TYPE, SpellInfo::Effects, DamageInfo::GetAbsorb(), Unit::GetAI(), GetAmount(), GetBase(), GetCasterGUID(), GetCasterLevel(), GetCritChance(), DamageInfo::GetDamage(), GetEffIndex(), Object::GetGUID(), Unit::GetHealth(), Unit::getHostileRefMgr(), GetId(), DamageInfo::GetResist(), GetSpellInfo(), Unit::HasUnitState(), Unit::HealBySpell(), Unit::IsAlive(), Unit::IsDamageReducedByArmor(), Unit::IsImmunedToDamageOrSchool(), LOG_DEBUG, m_effIndex, m_spellInfo, MELEE_HIT_NORMAL, CleanDamage::mitigated_damage, DamageInfo::ModifyDamage(), UnitAI::OnCalculatePeriodicTickReceived(), PROC_EX_ABSORB, PROC_EX_CRITICAL_HIT, PROC_EX_INTERNAL_DOT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_PERIODIC, PROC_FLAG_TAKEN_DAMAGE, PROC_FLAG_TAKEN_PERIODIC, Unit::ProcDamageAndSpell(), roll_chance_f(), Unit::SendSpellNonMeleeDamageLog(), SendTickImmune(), SPELL_EFFECT_PERSISTENT_AREA_AURA, SPELL_MISS_NONE, Unit::SpellCriticalDamageBonus(), Unit::SpellDamageBonusDone(), Unit::SpellDamageBonusTaken(), Unit::SpellHealingBonusDone(), Unit::SpellHealingBonusTaken(), Unit::SpellHitResult(), sScriptMgr, HostileRefMgr::threatAssist(), ObjectGuid::ToString(), and UNIT_STATE_ISOLATED.

Referenced by PeriodicTick().

◆ HandlePeriodicManaLeechAuraTick()

void AuraEffect::HandlePeriodicManaLeechAuraTick ( Unit target,
Unit caster 
) const
7082{
7084
7085 if (!caster || !caster->IsAlive() || !target->IsAlive() || target->getPowerType() != PowerType)
7086 return;
7087
7089 {
7090 SendTickImmune(target, caster);
7091 return;
7092 }
7093
7094 if (GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
7095 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
7096 return;
7097
7098 // ignore negative values (can be result apply spellmods to aura damage
7099 int32 drainAmount = std::max(m_amount, 0);
7100
7101 // Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
7102 // It's mana percent cost spells, m_amount is percent drain from target
7104 {
7105 // max value
7106 int32 maxmana = CalculatePct(caster->GetMaxPower(PowerType), drainAmount * 2.0f);
7107 ApplyPct(drainAmount, target->GetMaxPower(PowerType));
7108 if (drainAmount > maxmana)
7109 drainAmount = maxmana;
7110 }
7111
7112 LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} power leech of {} for {} dmg inflicted by {}",
7113 GetCasterGUID().ToString(), target->GetGUID().ToString(), drainAmount, GetId());
7114 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
7115 if (PowerType == POWER_MANA)
7116 drainAmount -= target->GetSpellCritDamageReduction(drainAmount);
7117
7118 int32 drainedAmount = -target->ModifyPower(PowerType, -drainAmount);
7119
7120 float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
7121
7122 SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, gainMultiplier, false);
7123 target->SendPeriodicAuraLog(&pInfo);
7124
7125 int32 gainAmount = int32(drainedAmount * gainMultiplier);
7126 int32 gainedAmount = 0;
7127 if (gainAmount)
7128 {
7129 gainedAmount = caster->ModifyPower(PowerType, gainAmount);
7130 target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
7131 }
7132
7133 target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
7134
7135 // remove CC auras
7137
7138 // Drain Mana
7140 && m_spellInfo->SpellFamilyFlags[0] & 0x00000010)
7141 {
7142 int32 manaFeedVal = 0;
7143 if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
7144 manaFeedVal = aurEff->GetAmount();
7145 // Mana Feed - Drain Mana
7146 if (manaFeedVal > 0)
7147 {
7148 int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
7149 caster->CastCustomSpell(caster, 32554, &feedAmount, nullptr, nullptr, true, nullptr, this);
7150 }
7151 }
7152}
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:1600
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
7223{
7225
7226 if (!caster || !target->IsAlive() || target->getPowerType() != PowerType)
7227 return;
7228
7230 {
7231 SendTickImmune(target, caster);
7232 return;
7233 }
7234
7235 // ignore negative values (can be result apply spellmods to aura damage
7236 int32 damage = std::max(m_amount, 0);
7237
7238 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
7239 if (PowerType == POWER_MANA)
7240 damage -= target->GetSpellCritDamageReduction(damage);
7241
7242 uint32 gain = uint32(-target->ModifyPower(PowerType, -damage));
7243
7244 float dmgMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
7245
7246 SpellInfo const* spellProto = GetSpellInfo();
7247 // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
7248 SpellNonMeleeDamage damageInfo(caster, target, spellProto, spellProto->SchoolMask);
7249 // no SpellDamageBonus for burn mana
7250 caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
7251
7252 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
7253
7254 caster->SendSpellNonMeleeDamageLog(&damageInfo);
7255
7256 // Set trigger flag
7257 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
7258 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
7260 if (damageInfo.damage)
7261 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
7262
7263 caster->DealSpellDamage(&damageInfo, true);
7264
7265 DamageInfo dmgInfo(damageInfo, DOT);
7266 Unit::ProcDamageAndSpell(caster, damageInfo.target, procAttacker, procVictim, procEx, damageInfo.damage, BASE_ATTACK, spellProto, nullptr, GetEffIndex(), nullptr, &dmgInfo);
7267}
uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition)
Definition: Unit.cpp:16262
Definition: Unit.h:920
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
Definition: Unit.cpp:1440
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
Definition: Unit.cpp:1297

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

References Player::AutoStoreLoot(), Unit::CastCustomSpell(), Unit::CastSpell(), ChannelTargetData::channelGUID, Unit::CountPctFromMaxHealth(), CREATURE_TYPE_GAS_CLOUD, Creature::DespawnOrUnsummon(), SpellInfo::Effects, Unit::EnergizeBySpell(), GetAmount(), Unit::GetAuraEffect(), GetBase(), Creature::GetCreatureTemplate(), GetEffIndex(), Unit::GetHealth(), GetId(), Unit::GetMaxHealth(), Unit::GetMaxPower(), Unit::GetPower(), SpellInfo::GetSchoolMask(), GetSpellInfo(), GetTickNumber(), 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
6611{
6612 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
6613 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6614 {
6615 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target)
6616 {
6617 SpellCastTargets targets;
6618 targets.SetUnitTarget(target);
6619 if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData)
6620 {
6623 }
6624
6625 CustomSpellValues values;
6627
6628 triggerCaster->CastSpell(targets, triggeredSpellInfo, &values, TRIGGERED_FULL_MASK, nullptr, this);
6629 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
6630 }
6631 }
6632 else
6633 {
6634 Creature* c = target->ToCreature();
6635 if (c && caster)
6636 {
6637 sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature());
6638 }
6639
6640 LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
6641 }
6642}
SpellEffIndex
Definition: SharedDefines.h:30
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
1803{
1804 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1805 return;
1806
1807 Unit* target = aurApp->GetTarget();
1808
1809 // no-phase is also phase state so same code for apply and remove
1810 uint32 newPhase = target->GetPhaseByAuras();
1811
1812 if (Player* player = target->ToPlayer())
1813 {
1814 if (!newPhase)
1815 newPhase = PHASEMASK_NORMAL;
1816
1817 // do not change phase to GM with all phases enabled
1818 if (player->IsGameMaster())
1819 newPhase = PHASEMASK_ANYWHERE;
1820
1821 player->SetPhaseMask(newPhase, false);
1822 player->GetSession()->SendSetPhaseShift(newPhase);
1823 }
1824 else
1825 {
1826 if (!newPhase)
1827 {
1828 newPhase = PHASEMASK_NORMAL;
1829 if (Creature* creature = target->ToCreature())
1830 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
1831 newPhase = data->phaseMask;
1832 }
1833
1834 target->SetPhaseMask(newPhase, false);
1835 }
1836
1837 // call functions which may have additional effects after chainging state of unit
1838 // phase auras normally not expected at BG but anyway better check
1839 if (apply)
1840 {
1841 // drop flag at invisibiliy in bg
1843 }
1844
1845 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1846 if (target->IsVisible())
1847 {
1848 if (!target->GetMap()->Instanceable())
1849 {
1850 target->UpdateObjectVisibility(false);
1851 target->m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f);
1852 }
1853 else
1854 target->UpdateObjectVisibility();
1855 }
1856}
@ PHASEMASK_ANYWHERE
Definition: Object.h: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:19302
bool IsVisible() const
Definition: Unit.h:2141
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:19313
Position m_last_notify_position
Definition: Unit.h:2423

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.
3529{
3530 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3531 return;
3532
3533 Unit* target = aurApp->GetTarget();
3534 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
3535 if (target->GetTypeId() == TYPEID_PLAYER || !apply || target->HasAuraType(SPELL_AURA_MOD_FEAR))
3536 return;
3539 target->SetControlled(false, UNIT_STATE_FLEEING);
3540}

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
6221{
6222 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6223 return;
6224
6225 if (aurApp->GetTarget()->GetTypeId() != TYPEID_PLAYER)
6226 return;
6227
6228 if (apply)
6229 aurApp->GetTarget()->RemoveByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
6230 else if (!aurApp->GetTarget()->GetMap()->Instanceable())
6231 aurApp->GetTarget()->SetByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
6232}
@ 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 
)
1170{
1171 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1172 if (prevented)
1173 return;
1174
1175 switch (GetAuraType())
1176 {
1178 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1179 break;
1181 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1182 break;
1184 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1185 break;
1187 HandleRaidProcFromChargeAuraProc(aurApp, eventInfo);
1188 break;
1191 break;
1192 default:
1193 break;
1194 }
1195
1196 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1197}
@ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
Definition: SpellAuraDefines.h:288
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
Definition: SpellAuraDefines.h:294
@ SPELL_AURA_RAID_PROC_FROM_CHARGE
Definition: SpellAuraDefines.h:286
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
Definition: SpellAuraDefines.h:106
void HandleRaidProcFromChargeAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:7327
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:7286
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:7307
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:7375
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:7269
bool CallScriptEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuras.cpp:2728
void CallScriptAfterEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuras.cpp:2747

References Aura::CallScriptAfterEffectProcHandlers(), Aura::CallScriptEffectProcHandlers(), GetAuraType(), GetBase(), 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 
)
7308{
7309 Unit* target = aurApp->GetTarget();
7310 Unit* triggerTarget = eventInfo.GetProcTarget();
7311 if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamageOrSchool(GetSpellInfo()))
7312 {
7313 SendTickImmune(triggerTarget, target);
7314 return;
7315 }
7316
7317 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetSpellInfo(), GetSpellInfo()->SchoolMask);
7318 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetEffIndex());
7319 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
7320 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
7321 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
7322 target->SendSpellNonMeleeDamageLog(&damageInfo);
7323 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
7324 target->DealSpellDamage(&damageInfo, true);
7325}
Unit * GetProcTarget() const
Definition: Unit.h:872

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 
)
7270{
7271 Unit* triggerCaster = aurApp->GetTarget();
7272 Unit* triggerTarget = eventInfo.GetProcTarget();
7273
7274 uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
7275 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
7276 {
7277 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
7278 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this);
7279 }
7280 else
7281 {
7282 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());
7283 }
7284}

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 
)
7287{
7288 Unit* triggerCaster = aurApp->GetTarget();
7289 Unit* triggerTarget = eventInfo.GetProcTarget();
7290
7291 uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
7292 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
7293 {
7294 // used only with EXTRA_LOGS
7295 (void)triggeredSpellInfo;
7296
7297 int32 basepoints0 = GetAmount();
7298 LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell {} with value {} from aura {} proc", triggeredSpellInfo->Id, basepoints0, GetId());
7299 triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, nullptr, nullptr, true, nullptr, this);
7300 }
7301 else
7302 {
7303 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());
7304 }
7305}

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 
)
7328{
7329 Unit* target = aurApp->GetTarget();
7330
7331 uint32 triggerSpellId;
7332 switch (GetId())
7333 {
7334 case 57949: // Shiver
7335 triggerSpellId = 57952;
7336 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
7337 break;
7338 case 59978: // Shiver
7339 triggerSpellId = 59979;
7340 break;
7341 case 43593: // Cold Stare
7342 triggerSpellId = 43594;
7343 break;
7344 default:
7345 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: {}", GetId());
7346 return;
7347 }
7348
7349 int32 jumps = GetBase()->GetCharges();
7350
7351 // current aura expire on proc finish
7352 GetBase()->SetCharges(0);
7353 GetBase()->SetUsingCharges(true);
7354
7355 // next target selection
7356 if (jumps > 0)
7357 {
7358 if (Unit* caster = GetCaster())
7359 {
7360 float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
7361
7362 if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
7363 {
7364 target->CastSpell(triggerTarget, GetSpellInfo(), true, nullptr, this, GetCasterGUID());
7365 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
7366 aura->SetCharges(jumps);
7367 }
7368 }
7369 }
7370
7371 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
7372 target->CastSpell(target, triggerSpellId, true, nullptr, this, GetCasterGUID());
7373}
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition: Unit.cpp:11108
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 
)
7376{
7377 Unit* target = aurApp->GetTarget();
7378
7379 // Currently only Prayer of Mending
7380 if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20))
7381 {
7382 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: {}", GetId());
7383 return;
7384 }
7385 uint32 triggerSpellId = 33110;
7386
7387 int32 value = GetAmount();
7388
7389 int32 jumps = GetBase()->GetCharges();
7390
7391 // current aura expire on proc finish
7392 GetBase()->SetCharges(0);
7393 GetBase()->SetUsingCharges(true);
7394
7395 // next target selection
7396 if (jumps > 0)
7397 {
7398 if (Unit* caster = GetCaster())
7399 {
7400 float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
7401
7402 Unit* triggerTarget = nullptr;
7403 Acore::MostHPMissingGroupInRange u_check(target, radius, 0);
7404 Acore::UnitLastSearcher<Acore::MostHPMissingGroupInRange> searcher(target, triggerTarget, u_check);
7405 Cell::VisitAllObjects(target, searcher, radius);
7406
7407 if (triggerTarget)
7408 {
7409 target->CastCustomSpell(triggerTarget, GetId(), &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
7410 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
7411 aura->SetCharges(jumps);
7412 }
7413 }
7414 }
7415
7416 LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
7417 target->CastCustomSpell(target, triggerSpellId, &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
7418}
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
1222{
1223 uint32 spellId = 0;
1224 uint32 spellId2 = 0;
1225 //uint32 spellId3 = 0;
1226 uint32 HotWSpellId = 0;
1227
1228 switch (GetMiscValue())
1229 {
1230 case FORM_CAT:
1231 spellId = 3025;
1232 HotWSpellId = 24900;
1233 break;
1234 case FORM_TREE:
1235 spellId = 34123;
1236 break;
1237 case FORM_TRAVEL:
1238 spellId = 5419;
1239 break;
1240 case FORM_AQUA:
1241 spellId = 5421;
1242 break;
1243 case FORM_BEAR:
1244 spellId = 1178;
1245 spellId2 = 21178;
1246 HotWSpellId = 24899;
1247 break;
1248 case FORM_DIREBEAR:
1249 spellId = 9635;
1250 spellId2 = 21178;
1251 HotWSpellId = 24899;
1252 break;
1253 case FORM_BATTLESTANCE:
1254 spellId = 21156;
1255 break;
1257 spellId = 7376;
1258 break;
1260 spellId = 7381;
1261 break;
1262 case FORM_MOONKIN:
1263 spellId = 24905;
1264 spellId2 = 69366;
1265 break;
1266 case FORM_FLIGHT:
1267 spellId = 33948;
1268 spellId2 = 34764;
1269 break;
1270 case FORM_FLIGHT_EPIC:
1271 spellId = 40122;
1272 spellId2 = 40121;
1273 break;
1274 case FORM_METAMORPHOSIS:
1275 spellId = 54817;
1276 spellId2 = 54879;
1277 break;
1279 spellId = 27792;
1280 spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
1281 break;
1282 case FORM_SHADOW:
1283 spellId = 49868;
1284 spellId2 = 71167;
1285 break;
1286 case FORM_GHOSTWOLF:
1287 spellId = 67116;
1288 break;
1289 case FORM_GHOUL:
1290 case FORM_AMBIENT:
1291 case FORM_STEALTH:
1292 case FORM_CREATURECAT:
1293 case FORM_CREATUREBEAR:
1294 break;
1295 default:
1296 break;
1297 }
1298
1299 Player* player = target->ToPlayer();
1300 if (apply)
1301 {
1302 // Remove cooldown of spells triggered on stance change - they may share cooldown with stance spell
1303 if (spellId)
1304 {
1305 if (player)
1306 player->RemoveSpellCooldown(spellId);
1307 target->CastSpell(target, spellId, true, nullptr, this, target->GetGUID());
1308 }
1309
1310 if (spellId2)
1311 {
1312 if (player)
1313 player->RemoveSpellCooldown(spellId2);
1314 target->CastSpell(target, spellId2, true, nullptr, this, target->GetGUID());
1315 }
1316
1317 if (player)
1318 {
1319 const PlayerSpellMap& sp_list = player->GetSpellMap();
1320 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
1321 {
1322 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(player->GetActiveSpec()))
1323 continue;
1324
1325 if (itr->first == spellId || itr->first == spellId2)
1326 continue;
1327
1328 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1330 continue;
1331
1332 if (spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1333 target->CastSpell(target, itr->first, true, nullptr, this, target->GetGUID());
1334 }
1335
1336 // xinef: talent stance auras are not on m_spells map, so iterate talents
1337 const PlayerTalentMap& tl_list = player->GetTalentMap();
1338 for (PlayerTalentMap::const_iterator itr = tl_list.begin(); itr != tl_list.end(); ++itr)
1339 {
1340 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(player->GetActiveSpec()))
1341 continue;
1342
1343 if (itr->first == spellId || itr->first == spellId2)
1344 continue;
1345
1346 // Xinef: skip talents with effect learn spell
1347 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1349 continue;
1350
1351 if (spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1352 target->CastSpell(target, itr->first, true, nullptr, this, target->GetGUID());
1353 }
1354
1355 // Also do it for Glyphs
1356 for (uint32 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
1357 {
1358 if (uint32 glyphId = player->GetGlyph(i))
1359 {
1360 if (GlyphPropertiesEntry const* glyph = sGlyphPropertiesStore.LookupEntry(glyphId))
1361 {
1362 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(glyph->SpellId);
1364 continue;
1365 if (spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1366 target->CastSpell(target, glyph->SpellId, TriggerCastFlags(TRIGGERED_FULL_MASK & ~(TRIGGERED_IGNORE_SHAPESHIFT | TRIGGERED_IGNORE_CASTER_AURASTATE)), nullptr, this, target->GetGUID());
1367 }
1368 }
1369 }
1370
1371 // Leader of the Pack
1372 if (player->HasTalent(17007, player->GetActiveSpec()))
1373 {
1374 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(24932);
1375 if (spellInfo && spellInfo->Stances & (1 << (GetMiscValue() - 1)))
1376 target->CastSpell(target, 24932, true, nullptr, this, target->GetGUID());
1377 }
1378 // Improved Barkskin - apply/remove armor bonus due to shapeshift
1379 if (player->HasTalent(63410, player->GetActiveSpec()) || player->HasTalent(63411, player->GetActiveSpec()))
1380 {
1381 target->RemoveAurasDueToSpell(66530);
1382 if (GetMiscValue() == FORM_TRAVEL || GetMiscValue() == FORM_NONE) // "while in Travel Form or while not shapeshifted"
1383 target->CastSpell(target, 66530, true);
1384 }
1385 // Heart of the Wild
1386 if (HotWSpellId)
1387 {
1388 // hacky, but the only way as spell family is not SPELLFAMILY_DRUID
1390 for (Unit::AuraEffectList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i)
1391 {
1392 // Heart of the Wild
1393 if ((*i)->GetSpellInfo()->SpellIconID == 240 && (*i)->GetMiscValue() == STAT_INTELLECT)
1394 {
1395 int32 HotWMod = (*i)->GetAmount() / 2; // For each 2% Intelligence, you get 1% stamina and 1% attack power.
1396
1397 target->CastCustomSpell(target, HotWSpellId, &HotWMod, nullptr, nullptr, true, nullptr, this, target->GetGUID());
1398 break;
1399 }
1400 }
1401 }
1402 switch (GetMiscValue())
1403 {
1404 case FORM_CAT:
1405 // Savage Roar
1406 if (target->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, 0, 0x10000000, 0))
1407 target->CastSpell(target, 62071, true);
1408 // Nurturing Instinct
1410 {
1411 uint32 spellId3 = 0;
1412 switch (aurEff->GetId())
1413 {
1414 case 33872:
1415 spellId3 = 47179;
1416 break;
1417 case 33873:
1418 spellId3 = 47180;
1419 break;
1420 }
1421 target->CastSpell(target, spellId3, true, nullptr, this, target->GetGUID());
1422 }
1423 // Master Shapeshifter - Cat
1424 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1425 {
1426 int32 bp = aurEff->GetAmount();
1427 target->CastCustomSpell(target, 48420, &bp, nullptr, nullptr, true);
1428 }
1429 break;
1430 case FORM_DIREBEAR:
1431 case FORM_BEAR:
1432 // Master Shapeshifter - Bear
1433 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1434 {
1435 int32 bp = aurEff->GetAmount();
1436 target->CastCustomSpell(target, 48418, &bp, nullptr, nullptr, true);
1437 }
1438 // Survival of the Fittest
1440 {
1441 int32 bp = aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue();
1442 target->CastCustomSpell(target, 62069, &bp, nullptr, nullptr, true, 0, this, target->GetGUID());
1443 }
1444 break;
1445 case FORM_MOONKIN:
1446 // Master Shapeshifter - Moonkin
1447 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1448 {
1449 int32 bp = aurEff->GetAmount();
1450 target->CastCustomSpell(target, 48421, &bp, nullptr, nullptr, true);
1451 }
1452 // Always cast Moonkin Aura
1453 target->CastSpell(target, 24907, true, nullptr, this, target->GetGUID());
1454 break;
1455 // Master Shapeshifter - Tree of Life
1456 case FORM_TREE:
1457 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1458 {
1459 int32 bp = aurEff->GetAmount();
1460 target->CastCustomSpell(target, 48422, &bp, nullptr, nullptr, true);
1461 }
1462 break;
1463 }
1464 }
1465 }
1466 else
1467 {
1468 if (spellId)
1469 target->RemoveOwnedAura(spellId);
1470 if (spellId2)
1471 target->RemoveOwnedAura(spellId2);
1472
1473 // Improved Barkskin - apply/remove armor bonus due to shapeshift
1474 if (player)
1475 {
1476 if (player->HasTalent(63410, player->GetActiveSpec()) || player->HasTalent(63411, player->GetActiveSpec()))
1477 {
1478 target->RemoveAurasDueToSpell(66530);
1479 target->CastSpell(target, 66530, true);
1480 }
1481 }
1482
1484 AuraEffect* newAura = nullptr;
1485 // Iterate through all the shapeshift auras that the target has, if there is another aura with SPELL_AURA_MOD_SHAPESHIFT, then this aura is being removed due to that one being applied
1486 for (Unit::AuraEffectList::const_iterator itr = shapeshifts.begin(); itr != shapeshifts.end(); ++itr)
1487 {
1488 if ((*itr) != this)
1489 {
1490 newAura = *itr;
1491 break;
1492 }
1493 }
1494
1495 // Use the new aura to see on what stance the target will be
1496 uint32 newStance = (1 << ((newAura ? newAura->GetMiscValue() : 0) - 1));
1497
1498 Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
1499 for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
1500 {
1501 // If the stances are not compatible with the spell, remove it
1502 // Xinef: Remove all passive auras, they will be added if needed
1503 if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && (!(itr->second->GetBase()->GetSpellInfo()->Stances & newStance) || itr->second->GetBase()->IsPassive()))
1504 target->RemoveAura(itr);
1505 else
1506 ++itr;
1507 }
1508
1509 // Xinef: Remove autoattack spells
1510 if (Spell* spell = target->GetCurrentSpell(CURRENT_MELEE_SPELL))
1511 if (spell->GetSpellInfo()->CheckShapeshift(newAura ? newAura->GetMiscValue() : 0) != SPELL_CAST_OK)
1512 spell->cancel(true);
1513 }
1514}
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
@ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
Definition: SpellAuraDefines.h:200
@ SPELL_AURA_DUMMY
Definition: SpellAuraDefines.h:67
@ SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
Definition: SpellAuraDefines.h:238
@ TRIGGERED_IGNORE_CASTER_AURASTATE
Will ignore shapeshift checks.
Definition: SpellDefines.h:143
@ TRIGGERED_IGNORE_SHAPESHIFT
Will not adjust facing to target (if any)
Definition: SpellDefines.h:142
@ EFFECT_2
Definition: SharedDefines.h:33
@ SPELL_EFFECT_LEARN_SPELL
Definition: SharedDefines.h:814
#define MAX_GLYPH_SLOT_INDEX
Definition: SharedDefines.h:676
SpellAttr0
Definition: SharedDefines.h:381
@ SPELL_ATTR0_PASSIVE
Definition: SharedDefines.h:388
@ SPELL_ATTR0_DO_NOT_DISPLAY
Definition: SharedDefines.h:389
@ STAT_INTELLECT
Definition: SharedDefines.h:261
@ SPELL_CAST_OK
Definition: SharedDefines.h:1138
uint32 GetGlyph(uint8 slot) const
Definition: Player.h:1733
bool HasTalent(uint32 spell_id, uint8 spec) const
Definition: Player.cpp:3837
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition: Player.cpp:3475
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4651
uint32 Stances
Definition: SpellInfo.h:331
bool HasEffect(SpellEffects effect) const
Definition: SpellInfo.cpp:872
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
5318{
5320 return;
5321
5322 Unit* target = aurApp->GetTarget();
5323
5324 BaseModType modType = FLAT_MOD;
5326 modType = PCT_MOD;
5327
5328 if (target->GetTypeId() == TYPEID_PLAYER)
5329 target->ToPlayer()->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply);
5330}
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
1741{
1742 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1743 return;
1744
1745 Unit* target = aurApp->GetTarget();
1746
1747 if (target->GetTypeId() != TYPEID_PLAYER)
1748 return;
1749
1750 // prepare spirit state
1751 if (apply)
1752 {
1753 // disable breath/etc timers
1754 target->ToPlayer()->StopMirrorTimers();
1755
1756 // set stand state (expected in this form)
1757 if (!target->IsStandState())
1759
1760 target->SetHealth(1);
1761 }
1762 // die at aura end
1763 else if (target->IsAlive())
1764 // call functions which may have additional effects after chainging state of unit
1765 target->setDeathState(DeathState::JustDied);
1766
1767 // xinef: damage immunity spell, not needed because of 93 aura (adds non_attackable state)
1768 // xinef: probably blizzard added it just in case in wotlk (id > 46000)
1769 if (apply)
1770 target->CastSpell(target, 62371, true);
1771 else
1772 target->RemoveAurasDueToSpell(62371);
1773}
@ UNIT_STAND_STATE_STAND
Definition: Unit.h:53
void StopMirrorTimers()
Definition: Player.h:2019
virtual void setDeathState(DeathState s, bool despawn=false)
Definition: Unit.cpp:14538
bool IsStandState() const
Definition: Unit.cpp:16988
void SetStandState(uint8 state)
Definition: Unit.cpp:16994

References AURA_EFFECT_HANDLE_REAL, Unit::CastSpell(), AuraApplication::GetTarget(), Object::GetTypeId(), Unit::IsAlive(), Unit::IsStandState(), 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
159 {
160 // useless
161 }

◆ HandleWaterBreathing()

void AuraEffect::HandleWaterBreathing ( AuraApplication const *  aurApp,
uint8  mode,
bool  apply 
) const
3402{
3404 return;
3405
3406 Unit* target = aurApp->GetTarget();
3407
3408 // update timers in client
3409 if (target->GetTypeId() == TYPEID_PLAYER)
3410 target->ToPlayer()->UpdateMirrorTimers();
3411}
void UpdateMirrorTimers()
Definition: PlayerUpdates.cpp:427

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

◆ HasSpellClassMask()

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

References SpellInfo::Effects, m_effIndex, and m_spellInfo.

◆ IsAffectedOnSpell()

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

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

◆ IsPeriodic()

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

References m_isPeriodic.

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

◆ PeriodicTick()

void AuraEffect::PeriodicTick ( AuraApplication aurApp,
Unit caster 
) const
1103{
1104 bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
1105 if (prevented)
1106 return;
1107
1108 Unit* target = aurApp->GetTarget();
1109
1110 // Update serverside orientation of tracking channeled auras on periodic update ticks
1111 // exclude players because can turn during channeling and shouldn't desync orientation client/server
1113 {
1114 ObjectGuid const channelGuid = caster->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT);
1115 if (!channelGuid.IsEmpty() && channelGuid != caster->GetGUID())
1116 {
1117 if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*caster, channelGuid))
1118 {
1119 caster->SetInFront(objectTarget);
1120 }
1121 }
1122 }
1123
1124 switch (GetAuraType())
1125 {
1127 HandlePeriodicDummyAuraTick(target, caster);
1128 break;
1130 HandlePeriodicTriggerSpellAuraTick(target, caster);
1131 break;
1133 // Don't actually do anything - client will trigger casts of these spells by itself
1134 break;
1137 break;
1140 HandlePeriodicDamageAurasTick(target, caster);
1141 break;
1143 HandlePeriodicHealthLeechAuraTick(target, caster);
1144 break;
1146 HandlePeriodicHealthFunnelAuraTick(target, caster);
1147 break;
1150 HandlePeriodicHealAurasTick(target, caster);
1151 break;
1153 HandlePeriodicManaLeechAuraTick(target, caster);
1154 break;
1156 HandleObsModPowerAuraTick(target, caster);
1157 break;
1159 HandlePeriodicEnergizeAuraTick(target, caster);
1160 break;
1162 HandlePeriodicPowerBurnAuraTick(target, caster);
1163 break;
1164 default:
1165 break;
1166 }
1167}
@ SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL
Definition: SharedDefines.h:433
WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:118
bool IsPlayer() const
Definition: Object.h:194
Definition: Object.h:393
bool IsEmpty() const
Definition: ObjectGuid.h:163
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20878
void HandlePeriodicPowerBurnAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:7222
void HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:7081
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:7154
void HandlePeriodicHealthFunnelAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6904
void HandlePeriodicHealAurasTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6933
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:7188
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6325
void HandlePeriodicDummyAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6234
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6798
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6644
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6610
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
Definition: SpellAuras.cpp:2497
bool IsChanneled() const
Definition: SpellInfo.cpp:1243

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

Referenced by Update().

◆ RecalculateAmount() [1/2]

◆ RecalculateAmount() [2/2]

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

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

◆ ResetPeriodic()

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

References m_amplitude, m_periodicTimer, and m_tickNumber.

Referenced by Unit::HandleAuraProc().

◆ ResetTicks()

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

References m_tickNumber.

◆ SendTickImmune()

◆ SetAmount()

◆ SetCanBeRecalculated()

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

References m_canBeRecalculated.

Referenced by Aura::SetLoadedState().

◆ SetCritChance()

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

References m_critChance.

Referenced by CalculatePeriodicData().

◆ SetEnabled()

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

References m_isAuraEnabled.

Referenced by AuraApplication::_HandleEffect().

◆ SetOldAmount()

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

References m_oldAmount.

Referenced by CalculateAmount().

◆ SetPeriodic()

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

References m_isPeriodic.

◆ SetPeriodicTimer()

◆ Update()

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

References GetApplicationList(), GetBase(), GetEffIndex(), GetTotalTicks(), m_amplitude, m_isPeriodic, m_periodicTimer, m_tickNumber, PeriodicTick(), and UpdatePeriodic().

Referenced by Aura::UpdateOwner().

◆ UpdatePeriodic()

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

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_dieSides

int32 const AuraEffect::m_dieSides
private

Referenced by GetDieSides().

◆ m_effIndex

◆ m_isAuraEnabled

bool AuraEffect::m_isAuraEnabled
private

Referenced by GetAmount(), and SetEnabled().

◆ m_isPeriodic

bool AuraEffect::m_isPeriodic
private

◆ m_oldAmount

int32 AuraEffect::m_oldAmount
private

Referenced by GetOldAmount(), and SetOldAmount().

◆ m_pctMods

float AuraEffect::m_pctMods
private

◆ m_periodicTimer

int32 AuraEffect::m_periodicTimer
private

◆ m_spellInfo

◆ m_spellmod

SpellModifier* AuraEffect::m_spellmod
private

◆ m_tickNumber