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

NKAI: replace hardcoded pandora with more flexible solution

This commit is contained in:
Andrii Danylchenko
2024-09-20 15:57:02 +03:00
parent ec6c84b0e0
commit ce0f51672a
8 changed files with 23 additions and 18 deletions

View File

@@ -141,12 +141,18 @@ std::optional<const CGObjectInstance *> ObjectClusterizer::getBlocker(const AIPa
|| blocker->ID == Obj::BORDERGUARD
|| blocker->ID == Obj::BORDER_GATE
|| blocker->ID == Obj::SHIPYARD
|| blocker->ID == Obj::PANDORAS_BOX
|| (blocker->ID == Obj::QUEST_GUARD && node.actionIsBlocked))
{
return blocker;
}
auto danger = ai->dangerEvaluator->evaluateDanger(blocker);
if(danger > 0 && blocker->isBlockedVisitable() && isObjectRemovable(blocker))
{
return blocker;
}
return std::optional< const CGObjectInstance *>();
}