mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-14 02:33:51 +02:00
commit
23fd47ae63
@ -64,6 +64,18 @@ std::vector<BattleHex> BattleEvaluator::getBrokenWallMoatHexes() const
|
|||||||
auto moatHex = wallHex.cloneInDirection(BattleHex::LEFT);
|
auto moatHex = wallHex.cloneInDirection(BattleHex::LEFT);
|
||||||
|
|
||||||
result.push_back(moatHex);
|
result.push_back(moatHex);
|
||||||
|
|
||||||
|
moatHex = moatHex.cloneInDirection(BattleHex::LEFT);
|
||||||
|
auto obstaclesSecondRow = cb->getBattle(battleID)->battleGetAllObstaclesOnPos(moatHex, false);
|
||||||
|
|
||||||
|
for(auto obstacle : obstaclesSecondRow)
|
||||||
|
{
|
||||||
|
if(obstacle->obstacleType == CObstacleInstance::EObstacleType::MOAT)
|
||||||
|
{
|
||||||
|
result.push_back(moatHex);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -27,7 +27,7 @@ namespace NKAI
|
|||||||
mainHeroTurnDistanceLimit(10),
|
mainHeroTurnDistanceLimit(10),
|
||||||
scoutHeroTurnDistanceLimit(5),
|
scoutHeroTurnDistanceLimit(5),
|
||||||
maxGoldPressure(0.3f),
|
maxGoldPressure(0.3f),
|
||||||
maxpass(30),
|
maxpass(10),
|
||||||
allowObjectGraph(false)
|
allowObjectGraph(false)
|
||||||
{
|
{
|
||||||
ResourcePath resource("config/ai/nkai/nkai-settings", EResType::JSON);
|
ResourcePath resource("config/ai/nkai/nkai-settings", EResType::JSON);
|
||||||
|
@ -112,7 +112,9 @@ public:
|
|||||||
|
|
||||||
void addMinimalDistanceJunctions()
|
void addMinimalDistanceJunctions()
|
||||||
{
|
{
|
||||||
pforeachTilePaths(ai->cb->getMapSize(), ai, [this](const int3 & pos, std::vector<AIPath> & paths)
|
tbb::concurrent_unordered_set<int3, std::hash<int3>> junctions;
|
||||||
|
|
||||||
|
pforeachTilePaths(ai->cb->getMapSize(), ai, [this, &junctions](const int3 & pos, std::vector<AIPath> & paths)
|
||||||
{
|
{
|
||||||
if(target->hasNodeAt(pos))
|
if(target->hasNodeAt(pos))
|
||||||
return;
|
return;
|
||||||
@ -129,9 +131,14 @@ public:
|
|||||||
|
|
||||||
if(currentCost.avg < neighborCost)
|
if(currentCost.avg < neighborCost)
|
||||||
{
|
{
|
||||||
addJunctionActor(pos);
|
junctions.insert(pos);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for(auto pos : junctions)
|
||||||
|
{
|
||||||
|
addJunctionActor(pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -709,7 +709,8 @@ void CGWhirlpool::teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer
|
|||||||
bool CGWhirlpool::isProtected(const CGHeroInstance * h)
|
bool CGWhirlpool::isProtected(const CGHeroInstance * h)
|
||||||
{
|
{
|
||||||
return h->hasBonusOfType(BonusType::WHIRLPOOL_PROTECTION)
|
return h->hasBonusOfType(BonusType::WHIRLPOOL_PROTECTION)
|
||||||
|| (h->stacksCount() == 1 && h->Slots().begin()->second->count == 1);
|
|| (h->stacksCount() == 1 && h->Slots().begin()->second->count == 1)
|
||||||
|
|| (h->stacksCount() == 0 && h->commander && h->commander->alive);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArtifactID CGArtifact::getArtifact() const
|
ArtifactID CGArtifact::getArtifact() const
|
||||||
|
Loading…
Reference in New Issue
Block a user