Browse Source

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.
Xilmi 11 months ago
parent
commit
33f5b473b3
1 changed files with 2 additions and 0 deletions
  1. 2 0
      AI/Nullkiller/Engine/PriorityEvaluator.cpp

+ 2 - 0
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()))