1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-08 22:26:51 +02:00

Be less wasteful with hiring heroes

When an enemy is near our city that currently has a hero hiding in it, we don't buy a hero without army as that one would be forced to wait outside and likely be killed.
This commit is contained in:
Xilmi
2024-12-17 12:02:58 +01:00
parent 99fcf136ec
commit aff73b6e65

View File

@ -97,6 +97,10 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
for(auto hero : availableHeroes)
{
if ((town->visitingHero || town->garrisonHero)
&& closestThreat < 0
&& hero->getArmyCost() < GameConstants::HERO_GOLD_COST / 3.0)
continue;
auto score = ai->heroManager->evaluateHero(hero);
if(score > minScoreToHireMain)
{