Ver código fonte

VCAI: do not buy heroes with single creatures for GatherArmy

DjWarmonger 9 anos atrás
pai
commit
169334f877
1 arquivos alterados com 14 adições e 1 exclusões
  1. 14 1
      AI/VCAI/Goals.cpp

+ 14 - 1
AI/VCAI/Goals.cpp

@@ -1112,8 +1112,21 @@ TGoalVec GatherArmy::getAllPossibleSubgoals()
 				ret.push_back (sptr (Goals::VisitTile(pos).sethero(h)));
 		}
 	}
+
 	if (ai->canRecruitAnyHero()) //this is not stupid in early phase of game
-		ret.push_back (sptr(Goals::RecruitHero()));
+	{
+		if (auto t = ai->findTownWithTavern())
+		{
+			for (auto h : cb->getAvailableHeroes(t)) //we assume that all towns have same set of heroes
+			{
+				if (h && h->getTotalStrength() > 500) //do not buy heroes with single creatures for GatherArmy
+				{
+					ret.push_back(sptr(Goals::RecruitHero()));
+					break;
+				}
+			}
+		}
+	}
 
 	if (ret.empty())
 	{