From d87f195bc7a4157e03b558630eaab6b338c990dc Mon Sep 17 00:00:00 2001 From: Xilmi Date: Mon, 23 Sep 2024 18:39:18 +0200 Subject: [PATCH] Update AINodeStorage.cpp Nodes along the path are now also considered for how dangerous it is. --- AI/Nullkiller/Pathfinding/AINodeStorage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp index 360bcd5bd..247836768 100644 --- a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp +++ b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp @@ -1419,6 +1419,10 @@ void AINodeStorage::calculateChainInfo(std::vector & paths, const int3 & path.heroArmy = node.actor->creatureSet; path.armyLoss = node.armyLoss; path.targetObjectDanger = ai->dangerEvaluator->evaluateDanger(pos, path.targetHero, !node.actor->allowBattle); + for (auto pathNode : path.nodes) + { + path.targetObjectDanger = std::max(ai->dangerEvaluator->evaluateDanger(pathNode.coord, path.targetHero, !node.actor->allowBattle), path.targetObjectDanger); + } if(path.targetObjectDanger > 0) {