1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00

Update PriorityEvaluator.cpp

Scores for all sorts of visitable and pickable objects are now unified in order to prevent AI from ignoring nearby valuables.
This commit is contained in:
Xilmi 2024-10-02 20:12:47 +02:00
parent f0802c0b3c
commit 0143a52755

View File

@ -1431,7 +1431,9 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
return 0;
if (evaluationContext.isArmyUpgrade)
return 0;
if (evaluationContext.enemyHeroDangerRatio > 0 && arriveNextWeek)
if ((evaluationContext.enemyHeroDangerRatio > 0 && arriveNextWeek) || evaluationContext.enemyHeroDangerRatio > 1)
return 0;
if (maxWillingToLose - evaluationContext.armyLossPersentage < 0)
return 0;
score += evaluationContext.strategicalValue * 1000;
score += evaluationContext.goldReward;
@ -1442,11 +1444,10 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
score -= evaluationContext.armyInvolvement * evaluationContext.armyLossPersentage;
if (score > 0)
{
score = 1000;
score *= evaluationContext.closestWayRatio;
score /= (1 + evaluationContext.enemyHeroDangerRatio);
if (evaluationContext.movementCost > 0)
score /= evaluationContext.movementCost;
score *= (maxWillingToLose - evaluationContext.armyLossPersentage);
}
break;
}