diff options
| author | Spp- <spp@jorge.gr> | 2011-09-06 10:36:20 +0200 |
|---|---|---|
| committer | Spp- <spp@jorge.gr> | 2011-09-06 10:36:20 +0200 |
| commit | b7882e0fa811a20d6986ae1fd4dc4050d80d830d (patch) | |
| tree | 5e44645d9d0cf73c09d925c4ce56f58118374065 /src | |
| parent | ea14e096acad26c2f9398f31e9cb5f9397c3481c (diff) | |
Partial revert of fcf58e7 (both check performed inside IsInMeleeRange)
Diffstat (limited to 'src')
| -rwxr-xr-x | src/server/game/AI/CoreAI/UnitAI.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index b6517e3396b..39bdf219880 100755 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -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); } } |
