summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actormanager.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 2e1079487..5c0ea8f80 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -1147,6 +1147,9 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing,
int defaultAttackIndex = 10000;
int defaultPriorityIndex = 10000;
const int attackRange = localPlayer->getAttackRange();
+ // with +1 for melee..
+ const int attackRange2 = localPlayer->getAttackRange2();
+ logger->log("Attack range: %d, real: %d", attackRange, attackRange2);
bool specialDistance = false;
if (settings.moveToTargetType == 11 // archer
@@ -1341,7 +1344,14 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing,
= priorityMobsMap.find(being->getName());
if (prioIter != priorityMobsMap.end())
+ {
priority = prioIter->second;
+ // prioritise priority mob that is within attack range
+ if (abs(dx) <= attackRange2 && abs(dy) <= attackRange2)
+ {
+ priority -= 10000; // but still respect their priorities.
+ }
+ }
// if (default) is in ignore list, then only attack
// those in priority or general attack list.