Refactor Creature::SelectNearestTarget(float dist)
This function is used in many scripts to find the nearest enemy within the given distance. However, it had an implicit limit to the ATTACK_DISTANCE. so in many case the "dist" was in fact just ignored. In other case, the ATTACK_DISTANCE is required. So 2 functions are necessary to avoid ambiguities. The refactoring is the split of the function in 2: SelectNearestTarget and SelectNearestTargetInAttackDistance. --HG-- branch : trunk
This commit is contained in:
1 parent
b466819333
commit
eccf5bf547
10 files changed
+76
-20
No files matched your search
+1
-1
@@ -12200,7 +12200,7 @@ Unit* Creature::SelectVictim()
|
||||
// search nearby enemy before enter evade mode
|
||||
if (HasReactState(REACT_AGGRESSIVE))
|
||||
{
|
||||
target = SelectNearestTarget();
|
||||
target = SelectNearestTargetInAttackDistance();
|
||||
if (target && _IsTargetAcceptable(target))
|
||||
return target;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user