|
|
@@ -196,8 +196,13 @@ float HeroManager::evaluateHero(const CGHeroInstance * hero) const
|
|
|
bool HeroManager::heroCapReached(bool includeGarrisoned) const
|
|
|
{
|
|
|
int heroCount = cc->getHeroCount(aiNk->playerID, includeGarrisoned);
|
|
|
+ int maxAllowed = aiNk->settings->getMaxRoamingHeroes();
|
|
|
+ if (aiNk->settings->getMaxRoamingHeroesPerTown() > 0)
|
|
|
+ {
|
|
|
+ maxAllowed += cc->howManyTowns() * aiNk->settings->getMaxRoamingHeroesPerTown();
|
|
|
+ }
|
|
|
|
|
|
- return heroCount >= aiNk->settings->getMaxRoamingHeroes()
|
|
|
+ return heroCount >= maxAllowed
|
|
|
|| heroCount >= cc->getSettings().getInteger(EGameSettings::HEROES_PER_PLAYER_ON_MAP_CAP)
|
|
|
|| heroCount >= cc->getSettings().getInteger(EGameSettings::HEROES_PER_PLAYER_TOTAL_CAP);
|
|
|
}
|