mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-14 10:12:59 +02:00
Prune paths involving enemy heroes
Capture objects and gather army will now skip paths that involve foreign heroes.
This commit is contained in:
parent
ddfeab8748
commit
68e264d990
@ -79,6 +79,9 @@ Goals::TGoalVec CaptureObjectsBehavior::getVisitGoals(
|
|||||||
auto hero = path.targetHero;
|
auto hero = path.targetHero;
|
||||||
auto danger = path.getTotalDanger();
|
auto danger = path.getTotalDanger();
|
||||||
|
|
||||||
|
if (hero->getOwner() != nullkiller->playerID)
|
||||||
|
continue;
|
||||||
|
|
||||||
if(nullkiller->heroManager->getHeroRole(hero) == HeroRole::SCOUT
|
if(nullkiller->heroManager->getHeroRole(hero) == HeroRole::SCOUT
|
||||||
&& (path.getTotalDanger() == 0 || path.turn() > 0)
|
&& (path.getTotalDanger() == 0 || path.turn() > 0)
|
||||||
&& path.exchangeCount > 1)
|
&& path.exchangeCount > 1)
|
||||||
|
@ -81,6 +81,9 @@ Goals::TGoalVec GatherArmyBehavior::deliverArmyToHero(const Nullkiller * ai, con
|
|||||||
logAi->trace("Path found %s, %s, %lld", path.toString(), path.targetHero->getObjectName(), path.heroArmy->getArmyStrength());
|
logAi->trace("Path found %s, %s, %lld", path.toString(), path.targetHero->getObjectName(), path.heroArmy->getArmyStrength());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (path.targetHero->getOwner() != ai->playerID)
|
||||||
|
continue;
|
||||||
|
|
||||||
if(path.containsHero(hero))
|
if(path.containsHero(hero))
|
||||||
{
|
{
|
||||||
#if NKAI_TRACE_LEVEL >= 2
|
#if NKAI_TRACE_LEVEL >= 2
|
||||||
|
Loading…
Reference in New Issue
Block a user