瀏覽代碼

Update PriorityEvaluator.cpp

Fix an issue that caused AI to take their hero's attributes into consideration twice when calculating how much army they think they'll lose.

Fixed an issue where offensive defending didn't take into consideration whether the hero would actually be strong enough to beat the enemy hero it was trying to dispatch.
Xilmi 1 年之前
父節點
當前提交
3b7834495d
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      AI/Nullkiller/Engine/PriorityEvaluator.cpp

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

@@ -1047,7 +1047,7 @@ public:
 			evaluationContext.armyInvolvement += army->getArmyCost();
 		}
 
-		vstd::amax(evaluationContext.armyLossPersentage, path.getTotalArmyLoss() / (double)path.getHeroStrength());
+		vstd::amax(evaluationContext.armyLossPersentage, (float)path.getTotalArmyLoss() / (float)army->getArmyStrength());
 		addTileDanger(evaluationContext, path.targetTile(), path.turn(), path.getHeroStrength());
 		vstd::amax(evaluationContext.turn, path.turn());
 	}
@@ -1394,6 +1394,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
 			{
 				if (evaluationContext.isDefend && evaluationContext.threatTurns == 0 && evaluationContext.turn == 0)
 					score = evaluationContext.armyInvolvement;
+				if (evaluationContext.isEnemy)
+					score *= (maxWillingToLose - evaluationContext.armyLossPersentage);
 				score *= evaluationContext.closestWayRatio;
 				break;
 			}