Core/Spells: Aura refresh improvements (#25511)

(cherry picked from commit c13ccaab5c)
This commit is contained in:
Gildor
2020-10-08 20:36:50 +02:00
committed by Shauren
parent ad7ed08c07
commit 6cd16b0ca9
3 changed files with 9 additions and 5 deletions

View File

@@ -334,7 +334,7 @@ uint32 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint32 availab
return effMask & availableEffectMask;
}
Aura* Aura::TryRefreshStackOrCreate(AuraCreateInfo& createInfo)
Aura* Aura::TryRefreshStackOrCreate(AuraCreateInfo& createInfo, bool updateEffectMask)
{
ASSERT_NODEBUGINFO(createInfo.Caster || !createInfo.CasterGUID.IsEmpty());
@@ -365,8 +365,9 @@ Aura* Aura::TryRefreshStackOrCreate(AuraCreateInfo& createInfo)
Unit* unit = createInfo._owner->ToUnit();
// check effmask on owner application (if existing)
if (AuraApplication* aurApp = foundAura->GetApplicationOfTarget(unit->GetGUID()))
aurApp->UpdateApplyEffectMask(effMask);
if (updateEffectMask)
if (AuraApplication* aurApp = foundAura->GetApplicationOfTarget(unit->GetGUID()))
aurApp->UpdateApplyEffectMask(effMask);
return foundAura;
}
else

View File

@@ -126,7 +126,7 @@ class TC_GAME_API Aura
typedef std::unordered_map<ObjectGuid, AuraApplication*> ApplicationMap;
static uint32 BuildEffectMaskForOwner(SpellInfo const* spellProto, uint32 availableEffectMask, WorldObject* owner);
static Aura* TryRefreshStackOrCreate(AuraCreateInfo& createInfo);
static Aura* TryRefreshStackOrCreate(AuraCreateInfo& createInfo, bool updateEffectMask = true);
static Aura* TryCreate(AuraCreateInfo& createInfo);
static Aura* Create(AuraCreateInfo& createInfo);
explicit Aura(AuraCreateInfo const& createInfo);

View File

@@ -3006,7 +3006,7 @@ void Spell::DoSpellEffectHit(Unit* unit, SpellEffectInfo const& spellEffectInfo,
.SetOwnerEffectMask(aura_effmask)
.IsRefresh = &refresh;
if (Aura* aura = Aura::TryRefreshStackOrCreate(createInfo))
if (Aura* aura = Aura::TryRefreshStackOrCreate(createInfo, false))
{
hitInfo.HitAura = aura->ToUnitAura();
@@ -3055,6 +3055,9 @@ void Spell::DoSpellEffectHit(Unit* unit, SpellEffectInfo const& spellEffectInfo,
hitInfo.HitAura->SetMaxDuration(hitInfo.AuraDuration);
hitInfo.HitAura->SetDuration(hitInfo.AuraDuration);
}
if (refresh)
hitInfo.HitAura->AddStaticApplication(unit, aura_effmask);
}
}
else