From aff73b6e65f5808cebba7ce7f5d6518c1030c94b Mon Sep 17 00:00:00 2001 From: Xilmi Date: Tue, 17 Dec 2024 12:02:58 +0100 Subject: [PATCH] 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. --- AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp index fd87347a6..ef4811ab7 100644 --- a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp +++ b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp @@ -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) {