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

Update PriorityEvaluator.cpp

Allow defending in priority 2.
This commit is contained in:
Xilmi 2024-07-25 21:49:17 +02:00
parent 183ce82b99
commit 07108ce03d

View File

@ -1408,6 +1408,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
} }
case 2: //Collect guarded stuff case 2: //Collect guarded stuff
{ {
if (evaluationContext.enemyHeroDangerRatio > 0.5 && !evaluationContext.isDefend)
return 0;
if (evaluationContext.buildingCost.marketValue() > 0) if (evaluationContext.buildingCost.marketValue() > 0)
return 0; return 0;
score += evaluationContext.strategicalValue * 1000; score += evaluationContext.strategicalValue * 1000;
@ -1430,6 +1432,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
} }
case 3: //For buildings and buying army case 3: //For buildings and buying army
{ {
if (maxWillingToLose - evaluationContext.armyLossPersentage < 0)
return 0;
score += evaluationContext.conquestValue * 1000; score += evaluationContext.conquestValue * 1000;
score += evaluationContext.strategicalValue * 1000; score += evaluationContext.strategicalValue * 1000;
score += evaluationContext.goldReward; score += evaluationContext.goldReward;