1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-18 03:21:27 +02:00

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.
This commit is contained in:
Xilmi 2024-07-15 17:50:30 +02:00
parent ce4905ac4c
commit 95ba57dfe2
2 changed files with 6 additions and 5 deletions

View File

@ -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)

View File

@ -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;