Преглед на файлове

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 година
родител
ревизия
fdaac9d3c3
променени са 1 файла, в които са добавени 4 реда и са изтрити 2 реда
  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;