浏览代码

Workaround for previously masked issue

A recent fix made it so that towns that weren't supposed to be defended are now no longer defended.
This caused scouts with minimal army to also go after them in addition to the main-hero.
Problem is when two heroes go for the same town it's a massive waste of movement-points. So for the time being only main-heroes will go for faraway captures.
Better solution would be to memorize who was sent to attack what on the same turn and filter out tasks going for the same target.
Xilmi 1 年之前
父节点
当前提交
433c58f8b1
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      AI/Nullkiller/Engine/PriorityEvaluator.cpp

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

@@ -1412,6 +1412,9 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
 			}
 			}
 			case PriorityTier::KILL: //Take towns / kill heroes that are further away
 			case PriorityTier::KILL: //Take towns / kill heroes that are further away
 			{
 			{
+				//TODO: This is a workaround for duplicating the same capture town-task being given to several heroes. A better solution ought to be found.
+				if (evaluationContext.movementCostByRole[HeroRole::MAIN] == 0)
+					return 0;
 				if (evaluationContext.turn > 0 && evaluationContext.isHero)
 				if (evaluationContext.turn > 0 && evaluationContext.isHero)
 					return 0;
 					return 0;
 				if (arriveNextWeek && evaluationContext.isEnemy)
 				if (arriveNextWeek && evaluationContext.isEnemy)