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

Update PriorityEvaluator.cpp

Only if there is a high gold-pressure a buildings' cost will deter from its score.
This commit is contained in:
Xilmi 2024-09-12 22:53:45 +02:00
parent ab64edf7dd
commit af2df5763f

View File

@ -1441,7 +1441,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
score += 1000; score += 1000;
auto resourcesAvailable = evaluationContext.evaluator.ai->getFreeResources(); auto resourcesAvailable = evaluationContext.evaluator.ai->getFreeResources();
auto income = ai->buildAnalyzer->getDailyIncome(); auto income = ai->buildAnalyzer->getDailyIncome();
score /= evaluationContext.buildingCost.marketValue(); if(ai->buildAnalyzer->isGoldPressureHigh())
score /= evaluationContext.buildingCost.marketValue();
if (!resourcesAvailable.canAfford(evaluationContext.buildingCost)) if (!resourcesAvailable.canAfford(evaluationContext.buildingCost))
{ {
TResources needed = evaluationContext.buildingCost - resourcesAvailable; TResources needed = evaluationContext.buildingCost - resourcesAvailable;