1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Introduced new priority-tiers for handling attacking and gathering near enemies that are really far away

So that the AI won't become too passive on giant maps.
This commit is contained in:
Xilmi
2024-12-11 14:47:08 +01:00
parent 650db73300
commit 347efa98a0
2 changed files with 7 additions and 1 deletions

View File

@@ -1364,7 +1364,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
const float maxWillingToLose = amIInDanger ? 1 : ai->settings->getMaxArmyLossTarget();
bool arriveNextWeek = false;
if (ai->cb->getDate(Date::DAY_OF_WEEK) + evaluationContext.turn > 7)
if (ai->cb->getDate(Date::DAY_OF_WEEK) + evaluationContext.turn > 7 && priorityTier < PriorityTier::FAR_KILL)
arriveNextWeek = true;
#if NKAI_TRACE_LEVEL >= 2
@@ -1417,6 +1417,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
break;
}
case PriorityTier::KILL: //Take towns / kill heroes that are further away
//FALL_THROUGH
case PriorityTier::FAR_KILL:
{
if (evaluationContext.turn > 0 && evaluationContext.isHero)
return 0;
@@ -1464,6 +1466,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
break;
}
case PriorityTier::HUNTER_GATHER: //Collect guarded stuff
//FALL_THROUGH
case PriorityTier::FAR_HUNTER_GATHER:
{
if (evaluationContext.enemyHeroDangerRatio > 1 && !evaluationContext.isDefend)
return 0;

View File

@@ -118,6 +118,8 @@ public:
HIGH_PRIO_EXPLORE,
HUNTER_GATHER,
LOW_PRIO_EXPLORE,
FAR_KILL,
FAR_HUNTER_GATHER,
DEFEND
};