Core/PlayerAI: perform cast checks on auto ranged attack
Port From (https://github.com/TrinityCore/TrinityCore/commit/b46d899ef16ce15e1f8403be076993545035cddc)
This commit is contained in:
@@ -602,7 +602,18 @@ namespace Game.AI
|
||||
if (rangedAttackSpell == 0)
|
||||
return;
|
||||
|
||||
me.CastSpell(victim, rangedAttackSpell, new CastSpellExtraArgs(TriggerCastFlags.CastDirectly));
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(rangedAttackSpell, me.GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
Spell spell = new Spell(me, spellInfo, TriggerCastFlags.CastDirectly);
|
||||
if (spell.CheckPetCast(victim) != SpellCastResult.SpellCastOk)
|
||||
return;
|
||||
|
||||
SpellCastTargets targets = new();
|
||||
targets.SetUnitTarget(victim);
|
||||
spell.Prepare(targets);
|
||||
|
||||
me.ResetAttackTimer(WeaponAttackType.RangedAttack);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user