Ver Fonte

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 há 10 meses atrás
pai
commit
650db73300
1 ficheiros alterados com 3 adições e 0 exclusões
  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;