mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-14 10:12:59 +02:00
Update PriorityEvaluator.cpp
AI is more careful when gathering stuff near enemies. The wasted movement-points are no longer considered when calculating which own city to fall back to when there's nothing better to do.
This commit is contained in:
parent
4a5ecdf25e
commit
f7a961793a
@ -919,8 +919,11 @@ public:
|
||||
evaluationContext.armyReward += evaluationContext.evaluator.getManaRecoveryArmyReward(stayAtTown.getHero());
|
||||
if (evaluationContext.armyReward == 0)
|
||||
evaluationContext.isDefend = true;
|
||||
evaluationContext.movementCostByRole[evaluationContext.heroRole] += stayAtTown.getMovementWasted();
|
||||
else
|
||||
{
|
||||
evaluationContext.movementCost += stayAtTown.getMovementWasted();
|
||||
evaluationContext.movementCostByRole[evaluationContext.heroRole] += stayAtTown.getMovementWasted();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -1428,6 +1431,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
|
||||
return 0;
|
||||
if (evaluationContext.isArmyUpgrade)
|
||||
return 0;
|
||||
if (evaluationContext.enemyHeroDangerRatio > 0 && arriveNextWeek)
|
||||
return 0;
|
||||
score += evaluationContext.strategicalValue * 1000;
|
||||
score += evaluationContext.goldReward;
|
||||
score += evaluationContext.skillReward * evaluationContext.armyInvolvement * (1 - evaluationContext.armyLossPersentage) * 0.05;
|
||||
@ -1438,8 +1443,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
|
||||
if (score > 0)
|
||||
{
|
||||
score *= evaluationContext.closestWayRatio;
|
||||
if (evaluationContext.enemyHeroDangerRatio > 1)
|
||||
score /= evaluationContext.enemyHeroDangerRatio;
|
||||
score /= (1 + evaluationContext.enemyHeroDangerRatio);
|
||||
if (evaluationContext.movementCost > 0)
|
||||
score /= evaluationContext.movementCost;
|
||||
score *= (maxWillingToLose - evaluationContext.armyLossPersentage);
|
||||
|
Loading…
Reference in New Issue
Block a user