[11109] Move DoMeleeAttackIfReady to CreatureAI and reuse more wide.

This commit is contained in:
VladimirMangos 2011-02-05 21:09:47 +03:00
parent d1007e49ca
commit caf9f0cae2
8 changed files with 28 additions and 45 deletions

View file

@ -1364,24 +1364,6 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
}
}
void CreatureEventAI::DoMeleeAttackIfReady()
{
// Check target
if (!m_creature->getVictim())
return;
// Make sure our attack is ready before checking distance
if (!m_creature->isAttackReady())
return;
// If we are within range melee the target
if (!m_creature->CanReachWithMeleeAttack(m_creature->getVictim()))
return;
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
}
bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
{
//No target so we can't cast