1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Nullkiller: fixes for partly visible objs

This commit is contained in:
Andrii Danylchenko 2021-05-15 22:03:58 +03:00 committed by Andrii Danylchenko
parent 28b77e0b79
commit 1d561b9882
2 changed files with 6 additions and 1 deletions

View File

@ -157,7 +157,10 @@ bool CaptureObjectsBehavior::shouldVisitObject(ObjectIdRef obj) const
//it may be hero visiting this obj
//we don't try visiting object on which allied or owned hero stands
// -> it will just trigger exchange windows and AI will be confused that obj behind doesn't get visited
const CGObjectInstance * topObj = cb->getTopObj(obj->visitablePos());
const CGObjectInstance * topObj = cb->getTopObj(pos);
if(!topObj)
return false; // partly visible obj but its visitable pos is not visible.
if(topObj->ID == Obj::HERO && cb->getPlayerRelations(ai->playerID, topObj->tempOwner) != PlayerRelations::ENEMIES)
return false;

View File

@ -61,6 +61,8 @@ void Nullkiller::resetAiState()
void Nullkiller::updateAiState()
{
ai->validateVisitableObjs();
// TODO: move to hero manager
auto activeHeroes = ai->getMyHeroes();