mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Script: Use DoMeleeAttackIfReady in default ScriptedAI::UpdateAI method (fixes offhand attacks if not UpdateAI is overridden)
This commit is contained in:
@@ -604,6 +604,7 @@ inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered)
|
||||
|
||||
inline void UnitAI::DoCastVictim(uint32 spellId, bool triggered)
|
||||
{
|
||||
// Why don't we check for casting unit_state and existing target as we do in DoCast(.. ?
|
||||
me->CastSpell(me->getVictim(), spellId, triggered);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,15 +114,7 @@ void ScriptedAI::UpdateAI(uint32 const /*diff*/)
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (me->isAttackReady())
|
||||
{
|
||||
//If we are within range melee the target
|
||||
if (me->IsWithinMeleeRange(me->getVictim()))
|
||||
{
|
||||
me->AttackerStateUpdate(me->getVictim());
|
||||
me->resetAttackTimer();
|
||||
}
|
||||
}
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
void ScriptedAI::DoStartMovement(Unit* victim, float distance, float angle)
|
||||
|
||||
Reference in New Issue
Block a user