1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Nullkiller: add engine and activate it for blue AI only. Engine does nothing

This commit is contained in:
Andrii Danylchenko
2021-05-15 19:23:05 +03:00
committed by Andrii Danylchenko
parent a88181acd7
commit 9c85e26d3c
7 changed files with 59 additions and 7 deletions

View File

View File

@@ -0,0 +1,13 @@
#pragma once
#include "../VCAI.h"
class Behavior
{
};
class CaptureObjectBehavior : public Behavior
{
};

View File

@@ -52,6 +52,8 @@ set(VCAI_SRCS
Goals/GetArtOfType.cpp Goals/GetArtOfType.cpp
Goals/FindObj.cpp Goals/FindObj.cpp
Goals/CompleteQuest.cpp Goals/CompleteQuest.cpp
Engine/Nullkiller.cpp
Behaviors/Behavior.cpp
main.cpp main.cpp
VCAI.cpp VCAI.cpp
) )
@@ -107,6 +109,8 @@ set(VCAI_HEADERS
Goals/FindObj.h Goals/FindObj.h
Goals/CompleteQuest.h Goals/CompleteQuest.h
Goals/Goals.h Goals/Goals.h
Engine/Nullkiller.h
Behaviors/Behavior.h
VCAI.h VCAI.h
) )

View File

@@ -0,0 +1,8 @@
#include "StdInc.h"
#include "Nullkiller.h"
#include "../VCAI.h"
void Nullkiller::makeTurn()
{
}

View File

@@ -0,0 +1,7 @@
#pragma once
class Nullkiller
{
public:
void makeTurn();
};

View File

@@ -26,6 +26,7 @@
#include "../../lib/serializer/BinaryDeserializer.h" #include "../../lib/serializer/BinaryDeserializer.h"
#include "AIhelper.h" #include "AIhelper.h"
#include "Engine/Nullkiller.h"
extern FuzzyHelper * fh; extern FuzzyHelper * fh;
@@ -595,6 +596,11 @@ void VCAI::init(std::shared_ptr<CCallback> CB)
if(!fh) if(!fh)
fh = new FuzzyHelper(); fh = new FuzzyHelper();
if(playerID.getStr(false) == "blue")
{
nullkiller.reset(new Nullkiller());
}
retrieveVisitableObjs(); retrieveVisitableObjs();
} }
@@ -791,7 +797,18 @@ void VCAI::makeTurn()
markHeroAbleToExplore(primaryHero()); markHeroAbleToExplore(primaryHero());
visitedHeroes.clear(); visitedHeroes.clear();
if(cb->getDate(Date::DAY) == 1)
{
retrieveVisitableObjs();
}
try try
{
if(nullkiller)
{
nullkiller->makeTurn();
}
else
{ {
//it looks messy here, but it's better to have armed heroes before attempting realizing goals //it looks messy here, but it's better to have armed heroes before attempting realizing goals
for(const CGTownInstance * t : cb->getTownsInfo()) for(const CGTownInstance * t : cb->getTownsInfo())
@@ -802,6 +819,7 @@ void VCAI::makeTurn()
/*Below function is also responsible for hero movement via internal wander function. By design it is separate logic for heroes that have nothing to do. /*Below function is also responsible for hero movement via internal wander function. By design it is separate logic for heroes that have nothing to do.
Heroes that were not picked by striveToGoal(sptr(Goals::Win())); recently (so they do not have new goals and cannot continue/reevaluate previously locked goals) will do logic in wander().*/ Heroes that were not picked by striveToGoal(sptr(Goals::Win())); recently (so they do not have new goals and cannot continue/reevaluate previously locked goals) will do logic in wander().*/
performTypicalActions(); performTypicalActions();
}
//for debug purpose //for debug purpose
for (auto h : cb->getHeroesInfo()) for (auto h : cb->getHeroesInfo())

View File

@@ -29,6 +29,7 @@
struct QuestInfo; struct QuestInfo;
class AIhelper; class AIhelper;
class Nullkiller;
class AIStatus class AIStatus
{ {
@@ -115,6 +116,7 @@ public:
ObjectInstanceID selectedObject; ObjectInstanceID selectedObject;
AIhelper * ah; AIhelper * ah;
std::unique_ptr<Nullkiller> nullkiller;
VCAI(); VCAI();
virtual ~VCAI(); virtual ~VCAI();