From f1eb73001cdd1b1a94109e89ad0c6b84a1aabc3c Mon Sep 17 00:00:00 2001 From: ariel- Date: Sat, 27 May 2017 03:14:25 -0300 Subject: Core/Spell: fixed some problems with per caster aura states - Update clients whenever target has more than one application of an aura that applies such aurastate - Update again when one application gets removed - Fixed Fire and Brimstone computing damage if any warlock applied the Immolate (should only count for own) Closes #19790 (cherry picked from commit e27c385b48fce359a168d602dabae8c55fa85563) --- src/server/game/Entities/Unit/Unit.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 2c9ce8d7d17..02469f0ed86 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3391,7 +3391,14 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint32 effMask) // Update target aura state flag if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState()) - ModifyAuraState(aState, true); + { + uint32 aStateMask = (1 << (aState - 1)); + // force update so the new caster registers it + if ((aStateMask & PER_CASTER_AURA_STATE_MASK) && *m_unitData->AuraState & aStateMask) + ForceUpdateFieldChange(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::AuraState)); + else + ModifyAuraState(aState, true); + } if (aurApp->GetRemoveMode()) return; @@ -3484,9 +3491,19 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo ToTotem()->setDeathState(JUST_DIED); } - // Remove aurastates only if were not found - if (!auraStateFound) - ModifyAuraState(auraState, false); + // Remove aurastates only if needed and were not found + if (auraState) + { + if (!auraStateFound) + ModifyAuraState(auraState, false); + else + { + // update for casters, some shouldn't 'see' the aura state + uint32 aStateMask = (1 << (auraState - 1)); + if ((aStateMask & PER_CASTER_AURA_STATE_MASK) != 0) + ForceUpdateFieldChange(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::AuraState)); + } + } aura->HandleAuraSpecificMods(aurApp, caster, false, false); -- cgit v1.2.3