From 7635b313aa9786bd6d7a18933c97e98f35b7cf4c Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Tue, 1 Apr 2025 02:13:21 +0200 Subject: Also prefer mobs in plain attack list, that are close to player. --- src/actormanager.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') 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; } } -- cgit v1.2.3-70-g09d2