Parcourir la source

Ignore all ExceuteHeroChain-tasks with 0 movement-cost

These can happen when an enemy spawns ontop of an AI-hero. If the action would win, it wouldn't be executed anyways. So now AI does the next best thing instead, which likely what it wanted to do anyways.
Xilmi il y a 10 mois
Parent
commit
650db73300
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      AI/Nullkiller/Engine/PriorityEvaluator.cpp

+ 3 - 0
AI/Nullkiller/Engine/PriorityEvaluator.cpp

@@ -1006,6 +1006,9 @@ public:
 		Goals::ExecuteHeroChain & chain = dynamic_cast<Goals::ExecuteHeroChain &>(*task);
 		const AIPath & path = chain.getPath();
 
+		if (path.movementCost() == 0)
+			return;
+
 		vstd::amax(evaluationContext.danger, path.getTotalDanger());
 		evaluationContext.movementCost += path.movementCost();
 		evaluationContext.closestWayRatio = chain.closestWayRatio;