From 590525b86ce31ec2e8773bb62c95efc00d24b7c7 Mon Sep 17 00:00:00 2001 From: Angelo Venturini Date: Sun, 2 Oct 2022 22:35:45 -0300 Subject: [PATCH] fix: Crash (#13230) --- src/server/game/Spells/Spell.cpp | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 937663428..96c900e3a 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3247,33 +3247,23 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) { if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance)) { + m_caster->CastSpell(unit, i->triggeredSpell->Id, true); LOG_DEBUG("spells.aura", "Spell {} triggered spell {} by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id); // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration // set duration of current aura to the triggered spell if (i->triggeredSpell->GetDuration() == -1) { - // get duration from aura-only once - if (!_duration) - { - Aura* aur = unit->GetAura(m_spellInfo->Id, m_caster->GetGUID()); - _duration = aur ? aur->GetDuration() : -1; - } - if (Aura* triggeredAur = unit->GetAura(i->triggeredSpell->Id, m_caster->GetGUID())) { - triggeredAur->SetDuration(std::max(triggeredAur->GetDuration(), _duration)); + // get duration from aura-only once + if (!_duration) + { + Aura* aur = unit->GetAura(m_spellInfo->Id, m_caster->GetGUID()); + _duration = aur ? aur->GetDuration() : -1; + } + triggeredAur->SetDuration(_duration); } - else - { - AuraEffect const* triggeringAuraEffect = m_caster->GetAuraEffect(i->triggeredByAura->Id, i->triggeredByEffIdx); - m_caster->CastCustomSpell(i->triggeredSpell->Id, SPELLVALUE_AURA_DURATION, _duration, unit, true, nullptr, triggeringAuraEffect); - } - } - else - { - AuraEffect const* triggeringAuraEffect = m_caster->GetAuraEffect(i->triggeredByAura->Id, i->triggeredByEffIdx); - m_caster->CastSpell(unit, i->triggeredSpell, true, nullptr, triggeringAuraEffect); } } }