1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fixed AI trying to visit tavern over and over.

TODO: AI still can't use it, anyway.
This commit is contained in:
DJWarmonger 2017-11-04 22:45:19 +01:00
parent edc4c01805
commit 3eb5de9534

View File

@ -3308,13 +3308,19 @@ bool shouldVisit(HeroPtr h, const CGObjectInstance * obj)
case Obj::MAGIC_WELL:
return h->mana < h->manaLimit();
case Obj::PRISON:
return ai->myCb->getHeroesInfo().size() < VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER;// GameConstants::MAX_HEROES_PER_PLAYER;
return ai->myCb->getHeroesInfo().size() < VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER;
case Obj::TAVERN:
{//TODO: make AI actually recruit heroes
//TODO: only on request
return (ai->myCb->getHeroesInfo().size() < VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER) &&
(ai->myCb->getResourceAmount()[Res::GOLD] - GOLD_RESERVE >= GameConstants::HERO_GOLD_COST);
}
case Obj::BOAT:
return false;
//Boats are handled by pathfinder
case Obj::EYE_OF_MAGI:
return false; //this object is useless to visit, but could be visited indefinitely
}
if (obj->wasVisited(*h)) //it must pointer to hero instance, heroPtr calls function wasVisited(ui8 player);