NKAI: fix capturing shipyards

This commit is contained in:
Andrii Danylchenko
2023-12-02 14:03:54 +02:00
parent be9c7f2099
commit 26b6d1cf74
2 changed files with 8 additions and 8 deletions
@@ -91,12 +91,12 @@ namespace AIPathfinding
for(const CGHeroInstance * hero : nodeStorage->getAllHeroes())
{
if(hero->canCastThisSpell(waterWalk.toSpell()))
if(hero->canCastThisSpell(waterWalk.toSpell()) && hero->mana >= hero->getSpellCost(waterWalk.toSpell()))
{
waterWalkingActions[hero] = std::make_shared<WaterWalkingAction>(hero);
}
if(hero->canCastThisSpell(airWalk.toSpell()))
if(hero->canCastThisSpell(airWalk.toSpell()) && hero->mana >= hero->getSpellCost(airWalk.toSpell()))
{
airWalkingActions[hero] = std::make_shared<AirWalkingAction>(hero);
}
@@ -179,11 +179,6 @@ namespace AIPathfinding
{
bool result = false;
if(!specialAction->canAct(nodeStorage->getAINode(source.node)))
{
return false;
}
nodeStorage->updateAINode(destination.node, [&](AIPathNode * node)
{
auto castNodeOptional = nodeStorage->getOrCreateNode(