1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Update RecruitHeroBehavior.cpp

Modified how to score what hero to hire to make it more likely to rehire fled heroes with high levels when the army-gain from the hero would be rather insignificant.
This commit is contained in:
Xilmi
2024-09-09 23:38:28 +02:00
parent faa5a02659
commit 37f9f93948

View File

@@ -32,9 +32,11 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
auto ourHeroes = ai->heroManager->getHeroRoles();
auto minScoreToHireMain = std::numeric_limits<float>::max();
int currentArmyValue = 0;
for(auto hero : ourHeroes)
{
currentArmyValue += hero.first->getArmyCost();
if(hero.second != HeroRole::MAIN)
continue;
@@ -84,7 +86,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
{
score *= score / minScoreToHireMain;
}
score *= hero->getArmyCost();
score *= (hero->getArmyCost() + currentArmyValue);
if (hero->type->heroClass->faction == town->getFaction())
score *= 1.5;
if (vstd::isAlmostZero(visitability))