1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +02:00

Upgrade priority

New priority to upgrade existing armies to make it less likely to fight the AI with only part of its army.
This commit is contained in:
Xilmi 2024-10-31 00:42:33 +01:00
parent 9d2fc1b1c9
commit 5979f53a26
2 changed files with 15 additions and 0 deletions

View File

@ -1423,6 +1423,20 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
score /= evaluationContext.movementCost;
break;
}
case PriorityTier::UPGRADE:
{
if (!evaluationContext.isArmyUpgrade)
return 0;
if (evaluationContext.enemyHeroDangerRatio > 1)
return 0;
if (maxWillingToLose - evaluationContext.armyLossPersentage < 0)
return 0;
score = 1000;
score *= evaluationContext.closestWayRatio;
if (evaluationContext.movementCost > 0)
score /= evaluationContext.movementCost;
break;
}
case PriorityTier::HIGH_PRIO_EXPLORE:
{
if (evaluationContext.enemyHeroDangerRatio > 1)

View File

@ -114,6 +114,7 @@ public:
INSTAKILL,
INSTADEFEND,
KILL,
UPGRADE,
HIGH_PRIO_EXPLORE,
HUNTER_GATHER,
LOW_PRIO_EXPLORE,