1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-08 00:39:47 +02:00

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.
This commit is contained in:
Xilmi 2024-12-13 21:50:45 +01:00
parent d0c99423a3
commit 33f5b473b3

View File

@ -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()))