1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Revert dynamic maxWillingToLose

Out maxWillingToLose back to a static 25%.
Dynamic could become too suicidal or too passive. 25% is a good sweetspot.
This commit is contained in:
Xilmi
2024-09-25 16:12:53 +02:00
parent 1d831022e8
commit e4ef95f8dd

View File

@@ -1342,26 +1342,14 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
else
{
float score = 0;
float myPower = 0;
float totalPower = 0;
for (auto heroInfo : ai->cb->getHeroesInfo(false))
{
if (heroInfo->getOwner() == ai->cb->getPlayerID())
myPower += heroInfo->getTotalStrength();
totalPower += heroInfo->getTotalStrength();
}
float powerRatio = 1;
if (totalPower > 0)
powerRatio = myPower / totalPower;
float maxWillingToLose = ai->cb->getTownsInfo().empty() ? 1 : 0.5 * powerRatio;
float maxWillingToLose = ai->cb->getTownsInfo().empty() ? 1 : 0.25;
bool arriveNextWeek = false;
if (ai->cb->getDate(Date::DAY_OF_WEEK) + evaluationContext.turn > 7)
arriveNextWeek = true;
#if NKAI_TRACE_LEVEL >= 2
logAi->trace("BEFORE: priorityTier %d, Evaluated %s, loss: %f, turn: %d, turns main: %f, scout: %f, gold: %f, cost: %d, army gain: %f, army growth: %f skill: %f danger: %d, threatTurns: %d, threat: %d, role: %s, strategical value: %f, conquest value: %f cwr: %f, fear: %f, explorePriority: %d isDefend: %d powerRatio: %d",
logAi->trace("BEFORE: priorityTier %d, Evaluated %s, loss: %f, turn: %d, turns main: %f, scout: %f, gold: %f, cost: %d, army gain: %f, army growth: %f skill: %f danger: %d, threatTurns: %d, threat: %d, role: %s, strategical value: %f, conquest value: %f cwr: %f, fear: %f, explorePriority: %d isDefend: %d",
priorityTier,
task->toString(),
evaluationContext.armyLossPersentage,
@@ -1382,8 +1370,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
evaluationContext.closestWayRatio,
evaluationContext.enemyHeroDangerRatio,
evaluationContext.explorePriority,
evaluationContext.isDefend,
powerRatio);
evaluationContext.isDefend);
#endif
switch (priorityTier)