Partial revert of fcf58e7 (both check performed inside IsInMeleeRange)

This commit is contained in:
Spp-
2011-09-06 10:36:20 +02:00
parent ea14e096ac
commit b7882e0fa8
+3 -13
View File
@@ -43,29 +43,19 @@ void UnitAI::DoMeleeAttackIfReady()
return; return;
Unit *victim = me->getVictim(); Unit *victim = me->getVictim();
if (!victim || !victim->IsInWorld())
return;
//Make sure our attack is ready and we aren't currently casting before checking distance //Make sure our attack is ready and we aren't currently casting before checking distance
if (me->isAttackReady()) if (me->isAttackReady() && me->IsWithinMeleeRange(victim))
{
//If we are within range melee the target
if (me->IsWithinMeleeRange(victim))
{ {
me->AttackerStateUpdate(victim); me->AttackerStateUpdate(victim);
me->resetAttackTimer(); me->resetAttackTimer();
} }
}
if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK)) if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK) && me->IsWithinMeleeRange(victim))
{
//If we are within range melee the target
if (me->IsWithinMeleeRange(victim))
{ {
me->AttackerStateUpdate(victim, OFF_ATTACK); me->AttackerStateUpdate(victim, OFF_ATTACK);
me->resetAttackTimer(OFF_ATTACK); me->resetAttackTimer(OFF_ATTACK);
} }
} }
}
bool UnitAI::DoSpellAttackIfReady(uint32 spell) bool UnitAI::DoSpellAttackIfReady(uint32 spell)
{ {