Browse Source

AI-adjustments

AI no longer thinks it can recharge their mana at towns without a mage-guild.
AI no longer treats neutral monsters as if  they were their enemies.
Upgrading armies no longer has it's own priority-tier. It is now handled at the same-priority as hunter-gather.
Xilmi 10 months ago
parent
commit
8d3970c6d5

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

@@ -890,7 +890,9 @@ public:
 
 		Goals::StayAtTown& stayAtTown = dynamic_cast<Goals::StayAtTown&>(*task);
 
-		evaluationContext.armyReward += evaluationContext.evaluator.getManaRecoveryArmyReward(stayAtTown.getHero());
+		if(stayAtTown.town->mageGuildLevel() > 0)
+			evaluationContext.armyReward += evaluationContext.evaluator.getManaRecoveryArmyReward(stayAtTown.getHero());
+
 		if (evaluationContext.armyReward == 0)
 			evaluationContext.isDefend = true;
 		else
@@ -1465,6 +1467,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
 				//FALL_THROUGH
 			case PriorityTier::FAR_KILL:
 			{
+				if (!evaluationContext.isEnemy)
+					return 0;
 				if (evaluationContext.turn > 0 && evaluationContext.isHero)
 					return 0;
 				if (arriveNextWeek && evaluationContext.isEnemy)
@@ -1480,21 +1484,6 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
 					score /= evaluationContext.movementCost;
 				break;
 			}
-			case PriorityTier::UPGRADE:
-			{
-				if (!evaluationContext.isArmyUpgrade)
-					return 0;
-				if (evaluationContext.enemyHeroDangerRatio > dangerThreshold)
-					return 0;
-				if (maxWillingToLose - evaluationContext.armyLossPersentage < 0)
-					return 0;
-				if (vstd::isAlmostZero(evaluationContext.armyLossPersentage) && evaluationContext.closestWayRatio < 1.0)
-					return 0;
-				score = 1000;
-				if (evaluationContext.movementCost > 0)
-					score /= evaluationContext.movementCost;
-				break;
-			}
 			case PriorityTier::HIGH_PRIO_EXPLORE:
 			{
 				if (evaluationContext.enemyHeroDangerRatio > dangerThreshold)
@@ -1522,8 +1511,6 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task, int priorityTier)
 					return 0;
 				if (evaluationContext.explorePriority == 3)
 					return 0;
-				if (evaluationContext.isArmyUpgrade)
-					return 0;
 				if ((evaluationContext.enemyHeroDangerRatio > 0 && arriveNextWeek) || evaluationContext.enemyHeroDangerRatio > dangerThreshold)
 					return 0;
 				if (maxWillingToLose - evaluationContext.armyLossPersentage < 0)

+ 0 - 1
AI/Nullkiller/Engine/PriorityEvaluator.h

@@ -115,7 +115,6 @@ public:
 		INSTAKILL,
 		INSTADEFEND,
 		KILL,
-		UPGRADE,
 		HIGH_PRIO_EXPLORE,
 		HUNTER_GATHER,
 		LOW_PRIO_EXPLORE,