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

Nullkiller - rough stabilisation

This commit is contained in:
Andrii Danylchenko 2021-05-15 19:23:42 +03:00 committed by Andrii Danylchenko
parent cd0f479d7e
commit fa39279c82
3 changed files with 8 additions and 1 deletions

View File

@ -62,6 +62,8 @@ Goals::TGoalVec CaptureObjectsBehavior::getTasks() {
way->evaluationContext.closestWayRatio way->evaluationContext.closestWayRatio
= way->evaluationContext.movementCost / closestWay->evaluationContext.movementCost; = way->evaluationContext.movementCost / closestWay->evaluationContext.movementCost;
logAi->trace("Behavior %s found %s(%s), danger %d", toString(), way->name(), way->tile.toString(), way->evaluationContext.danger);
tasks.push_back(way); tasks.push_back(way);
} }
} }

View File

@ -1,6 +1,7 @@
#include "StdInc.h" #include "StdInc.h"
#include "Nullkiller.h" #include "Nullkiller.h"
#include "../VCAI.h" #include "../VCAI.h"
#include "../AIHelper.h"
#include "../Behaviors/CaptureObjectsBehavior.h" #include "../Behaviors/CaptureObjectsBehavior.h"
#include "../Behaviors/RecruitHeroBehavior.h" #include "../Behaviors/RecruitHeroBehavior.h"
#include "../Goals/Invalid.h" #include "../Goals/Invalid.h"
@ -41,7 +42,7 @@ Goals::TSubgoal Nullkiller::choseBestTask(Behavior & behavior)
auto task = choseBestTask(tasks); auto task = choseBestTask(tasks);
logAi->trace("Behavior %s found %s, priority %f", behavior.toString(), task->name(), task->priority); logAi->debug("Behavior %s returns %s(%s), priority %f", behavior.toString(), task->name(), task->tile.toString(), task->priority);
return task; return task;
} }
@ -50,6 +51,8 @@ void Nullkiller::makeTurn()
{ {
while(true) while(true)
{ {
ai->ah->updatePaths(ai->getMyHeroes());
Goals::TGoalVec bestTasks = { Goals::TGoalVec bestTasks = {
choseBestTask(CaptureObjectsBehavior()), choseBestTask(CaptureObjectsBehavior()),
choseBestTask(RecruitHeroBehavior()) choseBestTask(RecruitHeroBehavior())

View File

@ -18,6 +18,8 @@
#include "Actions/ISpecialAction.h" #include "Actions/ISpecialAction.h"
#include "Actors.h" #include "Actors.h"
#define VCMI_TRACE_PATHFINDER
struct AIPathNode : public CGPathNode struct AIPathNode : public CGPathNode
{ {
uint64_t danger; uint64_t danger;