Core/PlayerAI: perform cast checks on auto ranged attack

This commit is contained in:
ariel-
2022-05-07 16:51:54 +02:00
committed by Ovahlord
parent c9e732b0bf
commit 0f69e644d2

View File

@@ -659,7 +659,21 @@ void PlayerAI::DoRangedAttackIfReady()
if (!rangedAttackSpell)
return;
me->CastSpell(victim, rangedAttackSpell, TRIGGERED_CAST_DIRECTLY);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(rangedAttackSpell);
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);
}