1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-18 03:21:27 +02:00

lowered aggression

Being less willing to rush across half the map to attack an enemy town only to find it too well defended when arriving there.
This commit is contained in:
Xilmi 2024-08-15 18:16:23 +02:00
parent a79f76f32b
commit 8ad6d712c0
2 changed files with 10 additions and 1 deletions

View File

@ -62,7 +62,8 @@ EvaluationContext::EvaluationContext(const Nullkiller* ai)
threatTurns(INT_MAX),
involvesSailing(false),
isTradeBuilding(false),
isChain(false)
isChain(false),
isEnemy(false)
{
}
@ -1068,6 +1069,8 @@ public:
evaluationContext.conquestValue += evaluationContext.evaluator.getConquestValue(target);
evaluationContext.goldCost += evaluationContext.evaluator.getGoldCost(target, hero, army);
evaluationContext.armyInvolvement += army->getArmyCost();
if (target->tempOwner != PlayerColor::NEUTRAL)
evaluationContext.isEnemy = true;
}
vstd::amax(evaluationContext.armyLossPersentage, path.getTotalArmyLoss() / (double)path.getHeroStrength());
@ -1116,6 +1119,9 @@ public:
evaluationContext.movementCostByRole[role] += objInfo.second.movementCost / boost;
evaluationContext.movementCost += objInfo.second.movementCost / boost;
if (target->tempOwner != PlayerColor::NEUTRAL)
evaluationContext.isEnemy = true;
vstd::amax(evaluationContext.turn, objInfo.second.turn / boost);
boost <<= 1;
@ -1385,6 +1391,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
//score += evaluationContext.conquestValue * 1000;
if(evaluationContext.conquestValue > 0 || (evaluationContext.defenseValue >= CGTownInstance::EFortLevel::CITADEL && evaluationContext.turn <= 1 && evaluationContext.threat > evaluationContext.armyInvolvement && evaluationContext.threatTurns == 0))
score = 1000;
if (evaluationContext.isEnemy && evaluationContext.turn > 0 && !ai->cb->getTownsInfo().empty())
return 0;
if (score == 0 || (evaluationContext.enemyHeroDangerRatio > 1 && evaluationContext.turn > 0 && !ai->cb->getTownsInfo().empty()))
return 0;
if (maxWillingToLose - evaluationContext.armyLossPersentage < 0)

View File

@ -80,6 +80,7 @@ struct DLL_EXPORT EvaluationContext
bool involvesSailing;
bool isTradeBuilding;
bool isChain;
bool isEnemy;
EvaluationContext(const Nullkiller * ai);