From 33f5b473b36ce78840a98893fcc8f6ced817694b Mon Sep 17 00:00:00 2001 From: Xilmi Date: Fri, 13 Dec 2024 21:50:45 +0100 Subject: [PATCH] Defender should not run off for troop-delivery Fixed a rare case in which a town-defender could become an indirect part of a troop-delivery-task by doing a sub-task like capturing a shipyard that takes less than 1 turn but leaves him out in the open. --- AI/Nullkiller/Engine/PriorityEvaluator.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AI/Nullkiller/Engine/PriorityEvaluator.cpp b/AI/Nullkiller/Engine/PriorityEvaluator.cpp index a0afaf7d2..fe08da693 100644 --- a/AI/Nullkiller/Engine/PriorityEvaluator.cpp +++ b/AI/Nullkiller/Engine/PriorityEvaluator.cpp @@ -1401,6 +1401,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier) { if (evaluationContext.turn > 0) return 0; + if (evaluationContext.movementCost >= 1) + return 0; if(evaluationContext.conquestValue > 0) score = evaluationContext.armyInvolvement; if (vstd::isAlmostZero(score) || (evaluationContext.enemyHeroDangerRatio > 1 && (evaluationContext.turn > 0 || evaluationContext.isExchange) && !ai->cb->getTownsInfo().empty()))