1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

#3824 - fix empty army with only commander issues

This commit is contained in:
Andrii Danylchenko
2024-04-26 23:18:20 +03:00
parent 0fc17da164
commit 6e641dbdea
7 changed files with 41 additions and 5 deletions

View File

@@ -1354,7 +1354,12 @@ void AINodeStorage::calculateChainInfo(std::vector<AIPath> & paths, const int3 &
path.heroArmy = node.actor->creatureSet;
path.armyLoss = node.armyLoss;
path.targetObjectDanger = evaluateDanger(pos, path.targetHero, !node.actor->allowBattle);
path.targetObjectArmyLoss = evaluateArmyLoss(path.targetHero, path.heroArmy->getArmyStrength(), path.targetObjectDanger);
path.targetObjectArmyLoss = evaluateArmyLoss(
path.targetHero,
getHeroArmyStrengthWithCommander(path.targetHero, path.heroArmy),
path.targetObjectDanger);
path.chainMask = node.actor->chainMask;
path.exchangeCount = node.actor->actorExchangeCount;
@@ -1473,7 +1478,7 @@ uint8_t AIPath::turn() const
uint64_t AIPath::getHeroStrength() const
{
return targetHero->getFightingStrength() * heroArmy->getArmyStrength();
return targetHero->getFightingStrength() * getHeroArmyStrengthWithCommander(targetHero, heroArmy);
}
uint64_t AIPath::getTotalDanger() const