Browse Source

Hero-hiring

When we have no hero, we will definitely want to hire one.
We will also want to hire heroes who already pay for more than themselves by coming with an army that has more value than the hero costs.
Xilmi 1 year ago
parent
commit
fdaac9d3c3
1 changed files with 4 additions and 2 deletions
  1. 4 2
      AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp

+ 4 - 2
AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp

@@ -45,6 +45,9 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
 			minScoreToHireMain = newScore;
 		}
 	}
+	// If we don't have any heros we might want to lower our expectations.
+	if (ourHeroes.empty())
+		minScoreToHireMain = 0;
 
 	for(auto town : towns)
 	{
@@ -55,8 +58,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
 			for(auto hero : availableHeroes)
 			{
 				auto score = ai->heroManager->evaluateHero(hero);
-
-				if(score > minScoreToHireMain)
+				if(score > minScoreToHireMain || hero->getArmyCost() > GameConstants::HERO_GOLD_COST)
 				{
 					tasks.push_back(Goals::sptr(Goals::RecruitHero(town, hero).setpriority(200)));
 					break;