Core/PlayerAI: perform cast checks on auto ranged attack

Closes #19928

(cherry picked from commit 590d2518820d45e54a4a31cc554af18c0695bcd0)
This commit is contained in:
ariel-
2021-06-16 19:49:57 +02:00
committed by Shauren
parent df585571f1
commit b46d899ef1
+15 -1
View File
@@ -614,7 +614,21 @@ void PlayerAI::DoRangedAttackIfReady()
if (!rangedAttackSpell)
return;
me->CastSpell(victim, rangedAttackSpell, TRIGGERED_CAST_DIRECTLY);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(rangedAttackSpell, me->GetMap()->GetDifficultyID());
if (!spellInfo)
return;
Spell* spell = new Spell(me, spellInfo, TRIGGERED_CAST_DIRECTLY);
if (spell->CheckPetCast(victim) != SPELL_CAST_OK)
{
delete spell;
return;
}
SpellCastTargets targets;
targets.SetUnitTarget(victim);
spell->prepare(targets);
me->resetAttackTimer(RANGED_ATTACK);
}