|
@@ -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)
|