浏览代码

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;
 			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)
 	for(auto town : towns)
 	{
 	{
@@ -55,8 +58,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
 			for(auto hero : availableHeroes)
 			for(auto hero : availableHeroes)
 			{
 			{
 				auto score = ai->heroManager->evaluateHero(hero);
 				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)));
 					tasks.push_back(Goals::sptr(Goals::RecruitHero(town, hero).setpriority(200)));
 					break;
 					break;