aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorPolarCookie <sei009@post.uit.no>2019-03-08 08:34:16 +0100
committerGiacomo Pozzoni <giacomopoz@gmail.com>2019-03-08 08:34:16 +0100
commitec3cb05d7fbc5cef60d000af910dc39dd3af92bf (patch)
treef0b35878eb73b046aca3964ae5d0d790cec03171 /src/server/game/Spells/Spell.cpp
parent3eecadcebf11f7418b6cdcf5d3602cea5e4e60f7 (diff)
Core/Spell: SpellAura Redux (#22794)
* typo and correction * spell aura no longer shared between targets _spellAura isolated * SPELL_AURA_CONTROL_VEHICLE is not strictly single target spell Steam Tank Control and Wyrmrest Commander units can reseat themselves again * Rename 9999_99_99_99_world.sql to 2019_03_08_00_world.sql
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index a9418ed28f2..05ab4296d9e 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -2577,7 +2577,9 @@ void Spell::TargetInfo::DoDamageAndTriggers(Spell* spell)
spell->m_caster->ToPlayer()->UpdatePvP(true);
}
+ spell->_spellAura = HitAura;
spell->CallScriptAfterHitHandlers();
+ spell->_spellAura = nullptr;
}
void Spell::GOTargetInfo::DoTargetSpellHit(Spell* spell, uint8 effIndex)
@@ -2762,8 +2764,7 @@ void Spell::DoSpellEffectHit(Unit* unit, uint8 effIndex, TargetInfo& hitInfo)
{
bool refresh = false;
- // delayed spells with multiple targets need to create a new aura object, otherwise we'll access a deleted aura
- if (!_spellAura || (m_spellInfo->Speed > 0.0f && !m_spellInfo->IsChanneled()))
+ if (!hitInfo.HitAura)
{
bool const resetPeriodicTimer = !(_triggeredCastFlags & TRIGGERED_DONT_RESET_PERIODIC_TIMER);
uint8 const allAuraEffectMask = Aura::BuildEffectMaskForOwner(hitInfo.AuraSpellInfo, MAX_EFFECT_MASK, unit);
@@ -2782,20 +2783,20 @@ void Spell::DoSpellEffectHit(Unit* unit, uint8 effIndex, TargetInfo& hitInfo)
if (Aura* aura = Aura::TryRefreshStackOrCreate(createInfo))
{
- _spellAura = aura->ToUnitAura();
+ hitInfo.HitAura = aura->ToUnitAura();
// Set aura stack amount to desired value
if (m_spellValue->AuraStackAmount > 1)
{
if (!refresh)
- _spellAura->SetStackAmount(m_spellValue->AuraStackAmount);
+ hitInfo.HitAura->SetStackAmount(m_spellValue->AuraStackAmount);
else
- _spellAura->ModStackAmount(m_spellValue->AuraStackAmount);
+ hitInfo.HitAura->ModStackAmount(m_spellValue->AuraStackAmount);
}
- _spellAura->SetDiminishGroup(hitInfo.DRGroup);
+ hitInfo.HitAura->SetDiminishGroup(hitInfo.DRGroup);
- hitInfo.AuraDuration = caster->ModSpellDuration(hitInfo.AuraSpellInfo, unit, hitInfo.AuraDuration, hitInfo.Positive, _spellAura->GetEffectMask());
+ hitInfo.AuraDuration = caster->ModSpellDuration(hitInfo.AuraSpellInfo, unit, hitInfo.AuraDuration, hitInfo.Positive, hitInfo.HitAura->GetEffectMask());
// Haste modifies duration of channeled spells
if (m_spellInfo->IsChanneled())
@@ -2804,21 +2805,21 @@ void Spell::DoSpellEffectHit(Unit* unit, uint8 effIndex, TargetInfo& hitInfo)
else if (m_originalCaster && (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, hitInfo.AuraSpellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)))
hitInfo.AuraDuration = int32(hitInfo.AuraDuration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED));
- if (hitInfo.AuraDuration != _spellAura->GetMaxDuration())
+ if (hitInfo.AuraDuration != hitInfo.HitAura->GetMaxDuration())
{
- _spellAura->SetMaxDuration(hitInfo.AuraDuration);
- _spellAura->SetDuration(hitInfo.AuraDuration);
+ hitInfo.HitAura->SetMaxDuration(hitInfo.AuraDuration);
+ hitInfo.HitAura->SetDuration(hitInfo.AuraDuration);
}
}
}
else
- _spellAura->AddStaticApplication(unit, aura_effmask);
-
- hitInfo.HitAura = _spellAura;
+ hitInfo.HitAura->AddStaticApplication(unit, aura_effmask);
}
}
+ _spellAura = hitInfo.HitAura;
HandleEffects(unit, nullptr, nullptr, effIndex, SPELL_EFFECT_HANDLE_HIT_TARGET);
+ _spellAura = nullptr;
}
void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask)