From 730e574bef9fad9e4e3baba06ce42015c70c367b Mon Sep 17 00:00:00 2001 From: Xilmi Date: Sun, 11 Aug 2024 12:44:07 +0200 Subject: [PATCH] Fixed AI ignoring garrisioned heroes when it comes to danger-analysis. AI now considers garrisoned heros a potential threat for their heroes too. --- AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp index 17f69c2af..27bfe5dd0 100644 --- a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp +++ b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp @@ -89,6 +89,14 @@ void DangerHitMapAnalyzer::updateHitMap() heroes[hero->tempOwner][hero] = HeroRole::MAIN; } + if (obj->ID == Obj::TOWN) + { + auto town = dynamic_cast(obj); + auto hero = town->garrisonHero; + + if(hero) + heroes[hero->tempOwner][hero] = HeroRole::MAIN; + } } auto ourTowns = cb->getTownsInfo();