diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 155efcaac13..9311b42118c 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1333,26 +1333,42 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell) const void Aura::ReapplyAffectedPassiveAuras( Unit* target ) { - std::set affectedPassives; + std::set affectedSelf; + std::set affectedAuraCaster; for(Unit::AuraMap::const_iterator itr = target->GetAuras().begin(); itr != target->GetAuras().end(); ++itr) { - // permanent passive - if (itr->second->IsPassive() && itr->second->IsPermanent() && + // permanent passive or permanent area aura + if (itr->second->IsPermanent() && (itr->second->IsPassive() || itr->second->IsAreaAura()) && // non deleted and not same aura (any with same spell id) !itr->second->IsDeleted() && itr->second->GetId() != GetId() && - // only applied by self and affected by aura - itr->second->GetCasterGUID() == target->GetGUID() && isAffectedOnSpell(itr->second->GetSpellProto())) + // and affected by aura + isAffectedOnSpell(itr->second->GetSpellProto())) { - affectedPassives.insert(itr->second->GetId()); + // only applied by self or aura caster + if(itr->second->GetCasterGUID() == target->GetGUID()) + affectedSelf.insert(itr->second->GetId()); + else if(itr->second->GetCasterGUID() == GetCasterGUID()) + affectedAuraCaster.insert(itr->second->GetId()); } } - for(std::set::const_iterator set_itr = affectedPassives.begin(); set_itr != affectedPassives.end(); ++set_itr) + for(std::set::const_iterator set_itr = affectedSelf.begin(); set_itr != affectedSelf.end(); ++set_itr) { target->RemoveAurasDueToSpell(*set_itr); target->CastSpell(m_target, *set_itr, true); } + + if (!affectedAuraCaster.empty()) + { + Unit* caster = GetCaster(); + for(std::set::const_iterator set_itr = affectedAuraCaster.begin(); set_itr != affectedAuraCaster.end(); ++set_itr) + { + target->RemoveAurasDueToSpell(*set_itr); + if (caster) + caster->CastSpell(m_target, *set_itr, true); + } + } } /*********************************************************/ @@ -1412,14 +1428,22 @@ void Aura::HandleAddModifier(bool apply, bool Real) // reapply talents to own passive persistent auras ReapplyAffectedPassiveAuras(m_target); - // re-aplly talents and passives applied to pet (it affected by player spellmods) + // re-apply talents/passives/area auras applied to pet (it affected by player spellmods) if(Pet* pet = m_target->GetPet()) ReapplyAffectedPassiveAuras(pet); + // re-apply talents/passives/area auras applied to totems (it affected by player spellmods) for(int i = 0; i < MAX_TOTEM; ++i) if(m_target->m_TotemSlot[i]) if(Creature* totem = m_target->GetMap()->GetCreature(m_target->m_TotemSlot[i])) ReapplyAffectedPassiveAuras(totem); + + // 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) + ReapplyAffectedPassiveAuras(member); } void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 81b2993c193..abbdf127312 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 "8923" + #define REVISION_NR "8924" #endif // __REVISION_NR_H__