mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
AI: danger hitmap using visible enemy heroes
This commit is contained in:
committed by
Andrii Danylchenko
parent
04bf6f536d
commit
4bf653f596
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#include "StdInc.h"
|
||||
#include "../VCAI.h"
|
||||
#include "../Engine/Nullkiller.h"
|
||||
#include "../AIhelper.h"
|
||||
#include "../Goals/ExecuteHeroChain.h"
|
||||
#include "CaptureObjectsBehavior.h"
|
||||
@@ -47,6 +48,7 @@ Goals::TGoalVec CaptureObjectsBehavior::getTasks()
|
||||
continue;
|
||||
|
||||
const int3 pos = objToVisit->visitablePos();
|
||||
|
||||
auto paths = ai->ah->getPathsToTile(pos);
|
||||
std::vector<std::shared_ptr<ExecuteHeroChain>> waysToVisitObj;
|
||||
std::shared_ptr<ExecuteHeroChain> closestWay;
|
||||
@@ -61,6 +63,14 @@ Goals::TGoalVec CaptureObjectsBehavior::getTasks()
|
||||
logAi->trace("Path found %s", path.toString());
|
||||
#endif
|
||||
|
||||
if(ai->nullkiller->dangerHitMap->enemyCanKillOurHeroesAlongThePath(path))
|
||||
{
|
||||
#ifdef VCMI_TRACE_PATHFINDER
|
||||
logAi->trace("Ignore path. Target hero can be killed by enemy");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!shouldVisit(path.targetHero, objToVisit))
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user