mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
fix: Crash (#13230)
This commit is contained in:
@@ -3247,33 +3247,23 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask)
|
|||||||
{
|
{
|
||||||
if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance))
|
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);
|
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
|
// SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
|
||||||
// set duration of current aura to the triggered spell
|
// set duration of current aura to the triggered spell
|
||||||
if (i->triggeredSpell->GetDuration() == -1)
|
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()))
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user