From 6a8878fb5da29c4ff0deac8e8819489089731704 Mon Sep 17 00:00:00 2001 From: megamage Date: Mon, 3 Nov 2008 14:11:09 -0600 Subject: [PATCH] [svn] Use IsWithinCombatDist for all AI. This should fix the bug that pet and guard does not attack target. (Note: some scriptedAI may need to update) --HG-- branch : trunk --- src/game/AggressorAI.cpp | 2 +- src/game/GuardAI.cpp | 2 +- src/game/PetAI.cpp | 2 +- src/game/ReactorAI.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/AggressorAI.cpp b/src/game/AggressorAI.cpp index 0c639d3359..7b1c9d7ad4 100644 --- a/src/game/AggressorAI.cpp +++ b/src/game/AggressorAI.cpp @@ -124,7 +124,7 @@ AggressorAI::UpdateAI(const uint32 /*diff*/) if( i_creature.isAttackReady() ) { - if( i_creature.IsWithinDistInMap(i_creature.getVictim(), ATTACK_DISTANCE)) + if( i_creature.IsWithinCombatDist(i_creature.getVictim(), ATTACK_DISTANCE)) { i_creature.AttackerStateUpdate(i_creature.getVictim()); i_creature.resetAttackTimer(); diff --git a/src/game/GuardAI.cpp b/src/game/GuardAI.cpp index 0537a61441..17d62efe44 100644 --- a/src/game/GuardAI.cpp +++ b/src/game/GuardAI.cpp @@ -117,7 +117,7 @@ void GuardAI::UpdateAI(const uint32 /*diff*/) if( i_creature.isAttackReady() ) { - if( i_creature.IsWithinDistInMap(i_creature.getVictim(), ATTACK_DISTANCE)) + if( i_creature.IsWithinCombatDist(i_creature.getVictim(), ATTACK_DISTANCE)) { i_creature.AttackerStateUpdate(i_creature.getVictim()); i_creature.resetAttackTimer(); diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index 91d42af234..d8f7725687 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -164,7 +164,7 @@ void PetAI::UpdateAI(const uint32 diff) return; } // not required to be stopped case - else if( i_pet.isAttackReady() && i_pet.canReachWithAttack(i_pet.getVictim()) ) + else if( i_pet.isAttackReady() && i_pet.IsWithinCombatDist(i_pet.getVictim(), ATTACK_DISTANCE) ) { i_pet.AttackerStateUpdate(i_pet.getVictim()); diff --git a/src/game/ReactorAI.cpp b/src/game/ReactorAI.cpp index 9ce3d9ad55..41e5fb51f1 100644 --- a/src/game/ReactorAI.cpp +++ b/src/game/ReactorAI.cpp @@ -76,7 +76,7 @@ ReactorAI::UpdateAI(const uint32 /*time_diff*/) if( i_creature.isAttackReady() ) { - if( i_creature.IsWithinDistInMap(i_creature.getVictim(), ATTACK_DISTANCE)) + if( i_creature.IsWithinCombatDist(i_creature.getVictim(), ATTACK_DISTANCE)) { i_creature.AttackerStateUpdate(i_creature.getVictim()); i_creature.resetAttackTimer();