[11825] Implement creature offhand attack. based on patch from maxxx2021

also drop some archaic Unit's code
This commit is contained in:
SilverIce 2011-10-16 00:00:58 +03:00
parent 4bd3976e30
commit 70a6a1ce76
9 changed files with 104 additions and 102 deletions

View file

@ -120,20 +120,5 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
bool CreatureAI::DoMeleeAttackIfReady()
{
// Check target
if (!m_creature->getVictim())
return false;
// Make sure our attack is ready before checking distance
if (!m_creature->isAttackReady())
return false;
// If we are within range melee the target
if (!m_creature->CanReachWithMeleeAttack(m_creature->getVictim()))
return false;
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
return true;
return m_creature->UpdateMeleeAttackingState();
}