Selaa lähdekoodia

New priority

1. Take / kill what is reachable in same turn
2. Defend
3. Take / kill what is further away
Xilmi 1 vuosi sitten
vanhempi
sitoutus
56988e054a

+ 1 - 1
AI/Nullkiller/Engine/Nullkiller.cpp

@@ -408,7 +408,7 @@ void Nullkiller::makeTurn()
 
 		TTaskVec selectedTasks;
 		int prioOfTask = 0;
-		for (int prio = 1; prio <= 5; ++prio)
+		for (int prio = 1; prio <= 6; ++prio)
 		{
 			prioOfTask = prio;
 			selectedTasks = buildPlan(bestTasks, prio);

+ 19 - 5
AI/Nullkiller/Engine/PriorityEvaluator.cpp

@@ -1398,9 +1398,10 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
 
 		switch (priorityTier)
 		{
-			case 1: //Take towns
+			case 1: //Take towns / kill heroes in immediate reach
 			{
-				//score += evaluationContext.conquestValue * 1000;
+				if (evaluationContext.turn > 0)
+					return 0;
 				if(evaluationContext.conquestValue > 0)
 					score = 1000;
 				if (score == 0 || (evaluationContext.enemyHeroDangerRatio > 1 && (evaluationContext.turn > 0 || evaluationContext.isExchange) && !ai->cb->getTownsInfo().empty()))
@@ -1419,7 +1420,20 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
 				score *= evaluationContext.closestWayRatio;
 				break;
 			}
-			case 3: //Collect unguarded stuff
+			case 3: //Take towns / kill heroes that are further away
+			{
+				if (evaluationContext.conquestValue > 0)
+					score = 1000;
+				if (score == 0 || (evaluationContext.enemyHeroDangerRatio > 1 && (evaluationContext.turn > 0 || evaluationContext.isExchange) && !ai->cb->getTownsInfo().empty()))
+					return 0;
+				if (maxWillingToLose - evaluationContext.armyLossPersentage < 0)
+					return 0;
+				score *= evaluationContext.closestWayRatio;
+				if (evaluationContext.movementCost > 0)
+					score /= evaluationContext.movementCost;
+				break;
+			}
+			case 4: //Collect unguarded stuff
 			{
 				if (evaluationContext.enemyHeroDangerRatio > 1)
 					return 0;
@@ -1449,7 +1463,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
 					score /= evaluationContext.movementCost;
 				break;
 			}
-			case 4: //Collect guarded stuff
+			case 5: //Collect guarded stuff
 			{
 				if (evaluationContext.enemyHeroDangerRatio > 1 && !evaluationContext.isDefend)
 					return 0;
@@ -1475,7 +1489,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
 				}
 				break;
 			}
-			case 5: //Defend whatever if nothing else is to do
+			case 6: //Defend whatever if nothing else is to do
 			{
 				if (evaluationContext.enemyHeroDangerRatio > 1 && evaluationContext.isExchange)
 					return 0;