Browse Source

Update PriorityEvaluator.cpp

Allow defending in priority 2.
Xilmi 1 year ago
parent
commit
07108ce03d
1 changed files with 4 additions and 0 deletions
  1. 4 0
      AI/Nullkiller/Engine/PriorityEvaluator.cpp

+ 4 - 0
AI/Nullkiller/Engine/PriorityEvaluator.cpp

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