1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Small adjustments to defensive behavior

AI will no longer leave the defense of a threatened town in order to bring the army to another hero.

AI will no longer send heroes to die outside of towns that already have a garrisioning hero inside, if there's a stronger enemy hero lurking around the town.
This commit is contained in:
Xilmi 2025-02-06 17:37:47 +01:00 committed by Ivan Savenko
parent 1b041fe09d
commit c7b875f671

View File

@ -1460,7 +1460,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
{
case PriorityTier::INSTAKILL: //Take towns / kill heroes in immediate reach
{
if (evaluationContext.turn > 0)
if (evaluationContext.turn > 0 || evaluationContext.isExchange)
return 0;
if (evaluationContext.movementCost >= 1)
return 0;
@ -1594,7 +1594,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
}
case PriorityTier::DEFEND: //Defend whatever if nothing else is to do
{
if (evaluationContext.enemyHeroDangerRatio > dangerThreshold && evaluationContext.isExchange)
if (evaluationContext.enemyHeroDangerRatio > dangerThreshold)
return 0;
if (evaluationContext.isDefend || evaluationContext.isArmyUpgrade)
score = evaluationContext.armyInvolvement;