mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-09 07:13:54 +02:00
New priorities
Added more priority-tiers
This commit is contained in:
parent
1d494f049d
commit
b92862c04d
@ -408,7 +408,7 @@ void Nullkiller::makeTurn()
|
||||
|
||||
TTaskVec selectedTasks;
|
||||
int prioOfTask = 0;
|
||||
for (int prio = 0; prio <= 2; ++prio)
|
||||
for (int prio = 1; prio <= 5; ++prio)
|
||||
{
|
||||
prioOfTask = prio;
|
||||
selectedTasks = buildPlan(bestTasks, prio);
|
||||
|
@ -1384,10 +1384,19 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
|
||||
|
||||
switch (priorityTier)
|
||||
{
|
||||
case 0: //Take towns
|
||||
case 1: //Defend immediately threatened towns
|
||||
{
|
||||
if (evaluationContext.isDefend && evaluationContext.threatTurns == 0 && evaluationContext.turn == 0)
|
||||
score = evaluationContext.armyInvolvement;
|
||||
score *= evaluationContext.closestWayRatio;
|
||||
if (evaluationContext.movementCost > 0)
|
||||
score /= evaluationContext.movementCost;
|
||||
break;
|
||||
}
|
||||
case 2: //Take towns
|
||||
{
|
||||
//score += evaluationContext.conquestValue * 1000;
|
||||
if(evaluationContext.conquestValue > 0 || (evaluationContext.defenseValue >= CGTownInstance::EFortLevel::CITADEL && evaluationContext.turn <= 1 && evaluationContext.threat > evaluationContext.armyInvolvement && evaluationContext.threatTurns <= 1))
|
||||
if(evaluationContext.conquestValue > 0)
|
||||
score = 1000;
|
||||
if (score == 0 || (evaluationContext.enemyHeroDangerRatio > 1 && evaluationContext.turn > 0 && !ai->cb->getTownsInfo().empty()))
|
||||
return 0;
|
||||
@ -1398,7 +1407,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
|
||||
score /= evaluationContext.movementCost;
|
||||
break;
|
||||
}
|
||||
case 1: //Collect unguarded stuff
|
||||
case 3: //Collect unguarded stuff
|
||||
{
|
||||
if (evaluationContext.enemyHeroDangerRatio > 1)
|
||||
return 0;
|
||||
@ -1428,7 +1437,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
|
||||
score /= evaluationContext.movementCost;
|
||||
break;
|
||||
}
|
||||
case 2: //Collect guarded stuff
|
||||
case 4: //Collect guarded stuff
|
||||
{
|
||||
if (evaluationContext.enemyHeroDangerRatio > 1 && !evaluationContext.isDefend)
|
||||
return 0;
|
||||
@ -1454,7 +1463,16 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: //For buildings and buying army
|
||||
case 5: //Defend whatever if nothing else is to do
|
||||
{
|
||||
if (evaluationContext.isDefend)
|
||||
score = evaluationContext.armyInvolvement;
|
||||
score *= evaluationContext.closestWayRatio;
|
||||
if (evaluationContext.movementCost > 0)
|
||||
score /= evaluationContext.movementCost;
|
||||
break;
|
||||
}
|
||||
case 0: //For buildings and buying army
|
||||
{
|
||||
if (maxWillingToLose - evaluationContext.armyLossPersentage < 0)
|
||||
return 0;
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
~PriorityEvaluator();
|
||||
void initVisitTile();
|
||||
|
||||
float evaluate(Goals::TSubgoal task, int priorityTier = 3);
|
||||
float evaluate(Goals::TSubgoal task, int priorityTier = 0);
|
||||
|
||||
private:
|
||||
const Nullkiller * ai;
|
||||
|
Loading…
x
Reference in New Issue
Block a user