mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +02:00
Fixed AI trying to visit tavern over and over.
TODO: AI still can't use it, anyway.
This commit is contained in:
@ -3308,13 +3308,19 @@ bool shouldVisit(HeroPtr h, const CGObjectInstance * obj)
|
|||||||
case Obj::MAGIC_WELL:
|
case Obj::MAGIC_WELL:
|
||||||
return h->mana < h->manaLimit();
|
return h->mana < h->manaLimit();
|
||||||
case Obj::PRISON:
|
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:
|
case Obj::BOAT:
|
||||||
return false;
|
return false;
|
||||||
//Boats are handled by pathfinder
|
//Boats are handled by pathfinder
|
||||||
case Obj::EYE_OF_MAGI:
|
case Obj::EYE_OF_MAGI:
|
||||||
return false; //this object is useless to visit, but could be visited indefinitely
|
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);
|
if (obj->wasVisited(*h)) //it must pointer to hero instance, heroPtr calls function wasVisited(ui8 player);
|
||||||
|
Reference in New Issue
Block a user