1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

AI should poke inaccessible Quest Guards less often.

This commit is contained in:
DjWarmonger 2015-10-25 08:39:03 +01:00
parent 520e42bcd7
commit 87f838f286
2 changed files with 5 additions and 3 deletions

View File

@ -518,10 +518,10 @@ TGoalVec ClearWayTo::getAllPossibleSubgoals()
{
//TODO: we should be able to return apriopriate quest here (VCAI::striveToQuest)
logAi->debugStream() << "Quest guard blocks the way to " + tile();
continue; //do not access quets guard if we can't complete the quest
}
}
}
if (isSafeToVisit(h, tileToHit)) //this makes sense only if tile is guarded, but there i no quest object
{
ret.push_back (sptr (Goals::VisitTile(tileToHit).sethero(h)));

View File

@ -2455,11 +2455,13 @@ void VCAI::buildArmyIn(const CGTownInstance * t)
int3 VCAI::explorationBestNeighbour(int3 hpos, int radius, HeroPtr h)
{
int3 ourPos = h->convertPosition(h->pos, false);
std::map<int3, int> dstToRevealedTiles;
for(crint3 dir : dirs)
if(cb->isInTheMap(hpos+dir))
if (isSafeToVisit(h, hpos + dir) && isAccessibleForHero (hpos + dir, h))
dstToRevealedTiles[hpos + dir] = howManyTilesWillBeDiscovered(radius, hpos, dir);
if (ourPos != dir) //don't stand in place
if (isSafeToVisit(h, hpos + dir) && isAccessibleForHero (hpos + dir, h))
dstToRevealedTiles[hpos + dir] = howManyTilesWillBeDiscovered(radius, hpos, dir);
if (dstToRevealedTiles.empty()) //yes, it DID happen!
throw cannotFulfillGoalException("No neighbour will bring new discoveries!");