Explorar o código

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 hai 1 ano
pai
achega
3b7834495d
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  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;
 			}