mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[8435] More work in repally passives at spelmod apply/remove.
* Fixed infinity recursion at reapply spell mod aura by self triggering. * Reapply pet/totems passives.
This commit is contained in:
parent
d3fec0355c
commit
a33ba233c7
3 changed files with 33 additions and 11 deletions
|
|
@ -1249,6 +1249,26 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Aura::ReapplyAffectedPassiveAuras( Unit* target )
|
||||||
|
{
|
||||||
|
std::set<uint32> affectedPassives;
|
||||||
|
|
||||||
|
for(Unit::AuraMap::const_iterator itr = target->GetAuras().begin(); itr != target->GetAuras().end(); ++itr)
|
||||||
|
// permanent passive
|
||||||
|
if (itr->second->IsPassive() && itr->second->IsPermanent() &&
|
||||||
|
// 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()))
|
||||||
|
affectedPassives.insert(itr->second->GetId());
|
||||||
|
|
||||||
|
for(std::set<uint32>::const_iterator set_itr = affectedPassives.begin(); set_itr != affectedPassives.end(); ++set_itr)
|
||||||
|
{
|
||||||
|
target->RemoveAurasDueToSpell(*set_itr);
|
||||||
|
target->CastSpell(m_target, *set_itr, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** BASIC AURA FUNCTION ***/
|
/*** BASIC AURA FUNCTION ***/
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
|
@ -1305,18 +1325,19 @@ void Aura::HandleAddModifier(bool apply, bool Real)
|
||||||
|
|
||||||
((Player*)m_target)->AddSpellMod(m_spellmod, apply);
|
((Player*)m_target)->AddSpellMod(m_spellmod, apply);
|
||||||
|
|
||||||
// reaplly talents to own passive persistent auras
|
// reapply talents to own passive persistent auras
|
||||||
std::set<uint32> affectedPassives;
|
ReapplyAffectedPassiveAuras(m_target);
|
||||||
|
|
||||||
for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().begin(); itr != m_target->GetAuras().end(); ++itr)
|
// re-aplly talents and passives applied to pet (it affected by player spellmods)
|
||||||
if (itr->second->IsPassive() && itr->second->IsPermanent() &&
|
if (m_target->GetTypeId() == TYPEID_PLAYER)
|
||||||
itr->second->GetCasterGUID() == m_target->GetGUID() && isAffectedOnSpell(itr->second->GetSpellProto()))
|
|
||||||
affectedPassives.insert(itr->second->GetId());
|
|
||||||
|
|
||||||
for(std::set<uint32>::const_iterator set_itr = affectedPassives.begin(); set_itr != affectedPassives.end(); ++set_itr)
|
|
||||||
{
|
{
|
||||||
m_target->RemoveAurasDueToSpell(*set_itr);
|
if(Pet* pet = m_target->GetPet())
|
||||||
m_target->CastSpell(m_target, *set_itr, true);
|
ReapplyAffectedPassiveAuras(pet);
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/)
|
void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/)
|
||||||
|
|
|
||||||
|
|
@ -341,6 +341,7 @@ class MANGOS_DLL_SPEC Aura
|
||||||
void PeriodicDummyTick();
|
void PeriodicDummyTick();
|
||||||
|
|
||||||
bool IsCritFromAbilityAura(Unit* caster, uint32& damage);
|
bool IsCritFromAbilityAura(Unit* caster, uint32& damage);
|
||||||
|
void ReapplyAffectedPassiveAuras(Unit* target);
|
||||||
|
|
||||||
Modifier m_modifier;
|
Modifier m_modifier;
|
||||||
SpellModifier *m_spellmod;
|
SpellModifier *m_spellmod;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8434"
|
#define REVISION_NR "8435"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue