Skip to content

Commit

Permalink
Partial revert of fcf58e7 (both check performed inside IsInMeleeRange)
Browse files Browse the repository at this point in the history
  • Loading branch information
xurxogr committed Sep 6, 2011
1 parent ea14e09 commit b7882e0
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions src/server/game/AI/CoreAI/UnitAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,17 @@ void UnitAI::DoMeleeAttackIfReady()
return;

Unit *victim = me->getVictim();
if (!victim || !victim->IsInWorld())
return;

//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->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
if (me->IsWithinMeleeRange(victim))
{
me->AttackerStateUpdate(victim, OFF_ATTACK);
me->resetAttackTimer(OFF_ATTACK);
}
me->AttackerStateUpdate(victim, OFF_ATTACK);
me->resetAttackTimer(OFF_ATTACK);
}
}

Expand Down

0 comments on commit b7882e0

Please sign in to comment.