mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
Made hiring heroes a bit more conditional to spam fewer of them
This commit is contained in:
@@ -58,6 +58,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
|
|||||||
|
|
||||||
ai->dangerHitMap->updateHitMap();
|
ai->dangerHitMap->updateHitMap();
|
||||||
int treasureSourcesCount = 0;
|
int treasureSourcesCount = 0;
|
||||||
|
int bestClosestThreat = UINT8_MAX;
|
||||||
|
|
||||||
for(auto town : towns)
|
for(auto town : towns)
|
||||||
{
|
{
|
||||||
@@ -118,6 +119,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
|
|||||||
bestScore = score;
|
bestScore = score;
|
||||||
bestHeroToHire = hero;
|
bestHeroToHire = hero;
|
||||||
bestTownToHireFrom = town;
|
bestTownToHireFrom = town;
|
||||||
|
bestClosestThreat = closestThreat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,7 +130,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
|
|||||||
{
|
{
|
||||||
if (ai->cb->getHeroesInfo().size() == 0
|
if (ai->cb->getHeroesInfo().size() == 0
|
||||||
|| treasureSourcesCount > ai->cb->getHeroesInfo().size() * 5
|
|| treasureSourcesCount > ai->cb->getHeroesInfo().size() * 5
|
||||||
|| bestHeroToHire->getArmyCost() > GameConstants::HERO_GOLD_COST / 2.0
|
|| (bestHeroToHire->getArmyCost() > GameConstants::HERO_GOLD_COST / 2.0 && (bestClosestThreat < 1 || !ai->buildAnalyzer->isGoldPressureHigh()))
|
||||||
|| (ai->getFreeResources()[EGameResID::GOLD] > 10000 && !ai->buildAnalyzer->isGoldPressureHigh() && haveCapitol)
|
|| (ai->getFreeResources()[EGameResID::GOLD] > 10000 && !ai->buildAnalyzer->isGoldPressureHigh() && haveCapitol)
|
||||||
|| (ai->getFreeResources()[EGameResID::GOLD] > 30000 && !ai->buildAnalyzer->isGoldPressureHigh()))
|
|| (ai->getFreeResources()[EGameResID::GOLD] > 30000 && !ai->buildAnalyzer->isGoldPressureHigh()))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user