summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2025-04-01 02:13:21 +0200
committerFedja Beader <fedja@protonmail.ch>2025-04-01 02:17:32 +0200
commit7635b313aa9786bd6d7a18933c97e98f35b7cf4c (patch)
tree01d47014ddb2efd65601f10517490883894d3a63
parent376ec19d40df1066805aad785cd039a77fcca24f (diff)
downloadmanaplus-7635b313aa9786bd6d7a18933c97e98f35b7cf4c.tar.gz
manaplus-7635b313aa9786bd6d7a18933c97e98f35b7cf4c.tar.bz2
manaplus-7635b313aa9786bd6d7a18933c97e98f35b7cf4c.tar.xz
manaplus-7635b313aa9786bd6d7a18933c97e98f35b7cf4c.zip
Also prefer mobs in plain attack list, that are close to player.
-rw-r--r--src/actormanager.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 5c0ea8f80..7e1d8c9a2 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -1352,13 +1352,19 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing,
priority -= 10000; // but still respect their priorities.
}
}
-
- // if (default) is in ignore list, then only attack
- // those in priority or general attack list.
- if (ignoreDefault
- && attackMobs.find(being->getName()) == attackMobs.end()
- && prioIter == priorityMobsMap.end())
+ else if (auto attackIter = attackMobs.find(being->getName());
+ attackIter != attackMobs.end())
+ {
+ // prioritise attack mobs that are within attack range
+ if (abs(dx) <= attackRange2 && abs(dy) <= attackRange2)
+ {
+ priority -= 9999; // but still prefer priority ones.
+ }
+ }
+ else if (ignoreDefault)
{
+ // if (default) is in ignore list, then only attack
+ // those in priority or general attack list.
continue;
}
}