From 73e7d3f5bb6ba09c6e3c8171f50175acacb6326c Mon Sep 17 00:00:00 2001 From: Xilmi Date: Mon, 30 Sep 2024 19:41:39 +0200 Subject: [PATCH] Another reason not to try to town-portal Even if the hero blocking a town is from the own faction, the town must not become a target if the city has stashed armies because in that case the hero ontop of it won't be able to go into garrison for the TP. --- AI/Nullkiller/Pathfinding/AINodeStorage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp index c22ef912f..45824c9ca 100644 --- a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp +++ b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp @@ -1198,7 +1198,8 @@ void AINodeStorage::calculateTownPortal( } if (targetTown->visitingHero - && targetTown->visitingHero.get()->getFaction() != actor->hero->getFaction()) + && (targetTown->visitingHero.get()->getFaction() != actor->hero->getFaction() + || targetTown->getUpperArmy()->stacksCount())) continue; auto nodeOptional = townPortalFinder.createTownPortalNode(targetTown);