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
+7 -17
View File
@@ -43,27 +43,17 @@ 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 me->AttackerStateUpdate(victim);
if (me->IsWithinMeleeRange(victim)) me->resetAttackTimer();
{
me->AttackerStateUpdate(victim);
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 me->AttackerStateUpdate(victim, OFF_ATTACK);
if (me->IsWithinMeleeRange(victim)) me->resetAttackTimer(OFF_ATTACK);
{
me->AttackerStateUpdate(victim, OFF_ATTACK);
me->resetAttackTimer(OFF_ATTACK);
}
} }
} }