From 37f9f939485816a81624da03a13028b65adb7306 Mon Sep 17 00:00:00 2001 From: Xilmi Date: Mon, 9 Sep 2024 23:38:28 +0200 Subject: [PATCH] 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. --- AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp index 0be723a2a..e46483fca 100644 --- a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp +++ b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp @@ -32,9 +32,11 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const auto ourHeroes = ai->heroManager->getHeroRoles(); auto minScoreToHireMain = std::numeric_limits::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))