diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 2fa35e122..0b9cd98d9 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1374,16 +1374,50 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode ) } } -/*********************************************************/ -/*** BASIC AURA FUNCTION ***/ -/*********************************************************/ -struct AuraHandleAddModifierHelper +struct ReapplyAffectedPassiveAurasHelper { - explicit AuraHandleAddModifierHelper(Aura* _aura) : aura(_aura) {} + explicit ReapplyAffectedPassiveAurasHelper(Aura* _aura) : aura(_aura) {} void operator()(Unit* unit) const { aura->ReapplyAffectedPassiveAuras(unit, true); } Aura* aura; }; +void Aura::ReapplyAffectedPassiveAuras() +{ + // not reapply spell mods with charges (use original value because processed and at remove) + if (m_spellProto->procCharges) + return; + + // not reapply some spell mods ops (mostly speedup case) + switch (m_modifier.m_miscvalue) + { + case SPELLMOD_DURATION: + case SPELLMOD_CHARGES: + case SPELLMOD_NOT_LOSE_CASTING_TIME: + case SPELLMOD_CASTING_TIME: + case SPELLMOD_COOLDOWN: + case SPELLMOD_COST: + case SPELLMOD_ACTIVATION_TIME: + case SPELLMOD_CASTING_TIME_OLD: + return; + } + + // reapply talents to own passive persistent auras + ReapplyAffectedPassiveAuras(m_target, true); + + // re-apply talents/passives/area auras applied to pet/totems (it affected by player spellmods) + m_target->CallForAllControlledUnits(ReapplyAffectedPassiveAurasHelper(this),true,false,false); + + // re-apply talents/passives/area auras applied to group members (it affected by player spellmods) + if (Group* group = ((Player*)m_target)->GetGroup()) + for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Player* member = itr->getSource()) + if (member != m_target && member->IsInMap(m_target)) + ReapplyAffectedPassiveAuras(member, false); +} + +/*********************************************************/ +/*** BASIC AURA FUNCTION ***/ +/*********************************************************/ void Aura::HandleAddModifier(bool apply, bool Real) { if(m_target->GetTypeId() != TYPEID_PLAYER || !Real) @@ -1424,36 +1458,7 @@ void Aura::HandleAddModifier(bool apply, bool Real) ((Player*)m_target)->AddSpellMod(m_spellmod, apply); - // not reapply spell mods with charges (use original value because processed and at remove) - if (m_spellProto->procCharges) - return; - - // not reapply some spell mods ops (mostly speedup case) - switch (m_modifier.m_miscvalue) - { - case SPELLMOD_DURATION: - case SPELLMOD_CHARGES: - case SPELLMOD_NOT_LOSE_CASTING_TIME: - case SPELLMOD_CASTING_TIME: - case SPELLMOD_COOLDOWN: - case SPELLMOD_COST: - case SPELLMOD_ACTIVATION_TIME: - case SPELLMOD_CASTING_TIME_OLD: - return; - } - - // reapply talents to own passive persistent auras - ReapplyAffectedPassiveAuras(m_target, true); - - // re-apply talents/passives/area auras applied to pet/totems (it affected by player spellmods) - m_target->CallForAllControlledUnits(AuraHandleAddModifierHelper(this),true,false,false); - - // re-apply talents/passives/area auras applied to group members (it affected by player spellmods) - if (Group* group = ((Player*)m_target)->GetGroup()) - for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - if (Player* member = itr->getSource()) - if (member != m_target && member->IsInMap(m_target)) - ReapplyAffectedPassiveAuras(member, false); + ReapplyAffectedPassiveAuras(); } void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/) diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index b11fa5c57..8f913eb30 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -37,7 +37,7 @@ struct ProcTriggerSpell; class Aura; // internal helper -struct AuraHandleAddModifierHelper; +struct ReapplyAffectedPassiveAurasHelper; typedef void(Aura::*pAuraHandler)(bool Apply, bool Real); // Real == true at aura add/remove @@ -55,7 +55,7 @@ typedef void(Aura::*pAuraHandler)(bool Apply, bool Real); class MANGOS_DLL_SPEC Aura { - friend struct AuraHandleAddModifierHelper; + friend struct ReapplyAffectedPassiveAurasHelper; friend Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem); public: @@ -93,6 +93,7 @@ class MANGOS_DLL_SPEC Aura void HandleAuraFeatherFall(bool Apply, bool Real); void HandleAuraHover(bool Apply, bool Real); void HandleAddModifier(bool Apply, bool Real); + void HandleAddTargetTrigger(bool Apply, bool Real); void HandleAuraModStun(bool Apply, bool Real); void HandleModDamageDone(bool Apply, bool Real); @@ -361,7 +362,7 @@ class MANGOS_DLL_SPEC Aura void PeriodicDummyTick(); bool IsCritFromAbilityAura(Unit* caster, uint32& damage); - void ReapplyAffectedPassiveAuras(Unit* target, bool owner_mode); + void ReapplyAffectedPassiveAuras(); Modifier m_modifier; SpellModifier *m_spellmod; @@ -404,6 +405,7 @@ class MANGOS_DLL_SPEC Aura private: void CleanupTriggeredSpells(); bool IsNeedVisibleSlot(Unit const* caster) const; // helper for check req. visibility slot + void ReapplyAffectedPassiveAuras(Unit* target, bool owner_mode); }; class MANGOS_DLL_SPEC AreaAura : public Aura diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c4f65741d..f32282361 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9278" + #define REVISION_NR "9279" #endif // __REVISION_NR_H__