1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-17 20:58:07 +02:00

Ignore all ExceuteHeroChain-tasks with 0 movement-cost

These can happen when an enemy spawns ontop of an AI-hero. If the action would win, it wouldn't be executed anyways. So now AI does the next best thing instead, which likely what it wanted to do anyways.
This commit is contained in:
Xilmi 2024-12-11 13:05:51 +01:00
parent eab6de4686
commit 650db73300

View File

@ -1006,6 +1006,9 @@ public:
Goals::ExecuteHeroChain & chain = dynamic_cast<Goals::ExecuteHeroChain &>(*task);
const AIPath & path = chain.getPath();
if (path.movementCost() == 0)
return;
vstd::amax(evaluationContext.danger, path.getTotalDanger());
evaluationContext.movementCost += path.movementCost();
evaluationContext.closestWayRatio = chain.closestWayRatio;