Selaa lähdekoodia

Made hiring heroes a bit more conditional to spam fewer of them

Xilmi 9 kuukautta sitten
vanhempi
sitoutus
97111328a8
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp

+ 3 - 1
AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp

@@ -58,6 +58,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
 
 	ai->dangerHitMap->updateHitMap();
 	int treasureSourcesCount = 0;
+	int bestClosestThreat = UINT8_MAX;
 	
 	for(auto town : towns)
 	{
@@ -118,6 +119,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
 					bestScore = score;
 					bestHeroToHire = hero;
 					bestTownToHireFrom = town;
+					bestClosestThreat = closestThreat;
 				}
 			}
 		}
@@ -128,7 +130,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
 	{
 		if (ai->cb->getHeroesInfo().size() == 0
 			|| treasureSourcesCount > ai->cb->getHeroesInfo().size() * 5
-			|| bestHeroToHire->getArmyCost() > GameConstants::HERO_GOLD_COST / 2.0
+			|| (bestHeroToHire->getArmyCost() > GameConstants::HERO_GOLD_COST / 2.0 && (bestClosestThreat < 1 || !ai->buildAnalyzer->isGoldPressureHigh()))
 			|| (ai->getFreeResources()[EGameResID::GOLD] > 10000 && !ai->buildAnalyzer->isGoldPressureHigh() && haveCapitol)
 			|| (ai->getFreeResources()[EGameResID::GOLD] > 30000 && !ai->buildAnalyzer->isGoldPressureHigh()))
 		{