mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-03 14:52:11 +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:
parent
f0802c0b3c
commit
0143a52755
@ -1431,7 +1431,9 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
|
|||||||
return 0;
|
return 0;
|
||||||
if (evaluationContext.isArmyUpgrade)
|
if (evaluationContext.isArmyUpgrade)
|
||||||
return 0;
|
return 0;
|
||||||
if (evaluationContext.enemyHeroDangerRatio > 0 && arriveNextWeek)
|
if ((evaluationContext.enemyHeroDangerRatio > 0 && arriveNextWeek) || evaluationContext.enemyHeroDangerRatio > 1)
|
||||||
|
return 0;
|
||||||
|
if (maxWillingToLose - evaluationContext.armyLossPersentage < 0)
|
||||||
return 0;
|
return 0;
|
||||||
score += evaluationContext.strategicalValue * 1000;
|
score += evaluationContext.strategicalValue * 1000;
|
||||||
score += evaluationContext.goldReward;
|
score += evaluationContext.goldReward;
|
||||||
@ -1442,11 +1444,10 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
|
|||||||
score -= evaluationContext.armyInvolvement * evaluationContext.armyLossPersentage;
|
score -= evaluationContext.armyInvolvement * evaluationContext.armyLossPersentage;
|
||||||
if (score > 0)
|
if (score > 0)
|
||||||
{
|
{
|
||||||
|
score = 1000;
|
||||||
score *= evaluationContext.closestWayRatio;
|
score *= evaluationContext.closestWayRatio;
|
||||||
score /= (1 + evaluationContext.enemyHeroDangerRatio);
|
|
||||||
if (evaluationContext.movementCost > 0)
|
if (evaluationContext.movementCost > 0)
|
||||||
score /= evaluationContext.movementCost;
|
score /= evaluationContext.movementCost;
|
||||||
score *= (maxWillingToLose - evaluationContext.armyLossPersentage);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user