Core/PlayerAI: perform cast checks on auto ranged attack

Closes #19928
This commit is contained in:
ariel-
2018-01-22 14:02:01 -03:00
parent 514c847881
commit 590d251882

View File

@@ -729,7 +729,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);
}