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:
committed by
Andrii Danylchenko
parent
a88181acd7
commit
9c85e26d3c
0
AI/Nullkiller/Behaviors/Behavior.cpp
Normal file
0
AI/Nullkiller/Behaviors/Behavior.cpp
Normal file
13
AI/Nullkiller/Behaviors/Behavior.h
Normal file
13
AI/Nullkiller/Behaviors/Behavior.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../VCAI.h"
|
||||||
|
|
||||||
|
class Behavior
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaptureObjectBehavior : public Behavior
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
@@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
8
AI/Nullkiller/Engine/Nullkiller.cpp
Normal file
8
AI/Nullkiller/Engine/Nullkiller.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "StdInc.h"
|
||||||
|
#include "Nullkiller.h"
|
||||||
|
#include "../VCAI.h"
|
||||||
|
|
||||||
|
void Nullkiller::makeTurn()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
7
AI/Nullkiller/Engine/Nullkiller.h
Normal file
7
AI/Nullkiller/Engine/Nullkiller.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class Nullkiller
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void makeTurn();
|
||||||
|
};
|
@@ -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())
|
||||||
|
@@ -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();
|
||||||
|
Reference in New Issue
Block a user