Browse Source

No more Startup-behavior

Startup-behavior was messing with my intended logic. Mostly by getting excess heroes for no real purpose other than that it could.
This wasted a lot of money that could be better invested on subsequent turns.
I removed it and playing-strength actually went up.
Xilmi 1 year ago
parent
commit
95ba57dfe2
2 changed files with 6 additions and 5 deletions
  1. 5 4
      AI/Nullkiller/Engine/Nullkiller.cpp
  2. 1 1
      AI/Nullkiller/Engine/Nullkiller.h

+ 5 - 4
AI/Nullkiller/Engine/Nullkiller.cpp

@@ -371,6 +371,7 @@ void Nullkiller::makeTurn()
 	{
 		auto start = std::chrono::high_resolution_clock::now();
 		updateAiState(i);
+		//logAi->info("Gold: %d", cb->getResourceAmount(EGameResID::GOLD));
 
 		Goals::TTask bestTask = taskptr(Goals::Invalid());
 
@@ -385,6 +386,7 @@ void Nullkiller::makeTurn()
 
 			if(bestTask->priority >= FAST_TASK_MINIMAL_PRIORITY)
 			{
+				//logAi->info("Performing task %s with prio: %d", bestTask->toString(), bestTask->priority);
 				if(!executeTask(bestTask))
 					return;
 
@@ -406,13 +408,11 @@ void Nullkiller::makeTurn()
 		if(!isOpenMap())
 			decompose(bestTasks, sptr(ExplorationBehavior()), MAX_DEPTH);
 
-		if(cb->getDate(Date::DAY) == 1 || heroManager->getHeroRoles().empty())
-		{
-			decompose(bestTasks, sptr(StartupBehavior()), 1);
-		}
 		auto selectedTasks = buildPlan(bestTasks, 0);
 		if (selectedTasks.empty() && !settings->isUseFuzzy())
 			selectedTasks = buildPlan(bestTasks, 1);
+		if (selectedTasks.empty() && !settings->isUseFuzzy())
+			selectedTasks = buildPlan(bestTasks, 2);
 
 		std::sort(selectedTasks.begin(), selectedTasks.end(), [](const TTask& a, const TTask& b) 
 		{
@@ -483,6 +483,7 @@ void Nullkiller::makeTurn()
 
 				continue;
 			}
+			//logAi->info("Performing task %s with prio: %d", bestTask->toString(), bestTask->priority);
 			if(!executeTask(bestTask))
 			{
 				if(hasAnySuccess)

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

@@ -126,7 +126,7 @@ private:
 	void updateAiState(int pass, bool fast = false);
 	void decompose(Goals::TGoalVec & result, Goals::TSubgoal behavior, int decompositionMaxDepth) const;
 	Goals::TTask choseBestTask(Goals::TGoalVec & tasks) const;
-	Goals::TTaskVec buildPlan(Goals::TGoalVec & tasks, int priorityTier = 1) const;
+	Goals::TTaskVec buildPlan(Goals::TGoalVec & tasks, int priorityTier = 3) const;
 	bool executeTask(Goals::TTask task);
 	bool areAffectedObjectsPresent(Goals::TTask task) const;
 	HeroRole getTaskRole(Goals::TTask task) const;