浏览代码

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

Andrii Danylchenko 4 年之前
父节点
当前提交
9c85e26d3c

+ 0 - 0
AI/Nullkiller/Behaviors/Behavior.cpp


+ 13 - 0
AI/Nullkiller/Behaviors/Behavior.h

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

+ 4 - 0
AI/Nullkiller/CMakeLists.txt

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

+ 8 - 0
AI/Nullkiller/Engine/Nullkiller.cpp

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

+ 7 - 0
AI/Nullkiller/Engine/Nullkiller.h

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

+ 25 - 7
AI/Nullkiller/VCAI.cpp

@@ -26,6 +26,7 @@
 #include "../../lib/serializer/BinaryDeserializer.h"
 
 #include "AIhelper.h"
+#include "Engine/Nullkiller.h"
 
 extern FuzzyHelper * fh;
 
@@ -595,6 +596,11 @@ void VCAI::init(std::shared_ptr<CCallback> CB)
 	if(!fh)
 		fh = new FuzzyHelper();
 
+	if(playerID.getStr(false) == "blue")
+	{
+		nullkiller.reset(new Nullkiller());
+	}
+
 	retrieveVisitableObjs();
 }
 
@@ -791,17 +797,29 @@ void VCAI::makeTurn()
 	markHeroAbleToExplore(primaryHero());
 	visitedHeroes.clear();
 
+	if(cb->getDate(Date::DAY) == 1)
+	{
+		retrieveVisitableObjs();
+	}
+
 	try
 	{
-		//it looks messy here, but it's better to have armed heroes before attempting realizing goals
-		for (const CGTownInstance * t : cb->getTownsInfo())
-			moveCreaturesToHero(t);
+		if(nullkiller)
+		{
+			nullkiller->makeTurn();
+		}
+		else
+		{
+			//it looks messy here, but it's better to have armed heroes before attempting realizing goals
+			for(const CGTownInstance * t : cb->getTownsInfo())
+				moveCreaturesToHero(t);
 
-		mainLoop();
+			mainLoop();
 
-		/*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().*/
-		performTypicalActions();
+			/*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().*/
+			performTypicalActions();
+		}
 
 		//for debug purpose
 		for (auto h : cb->getHeroesInfo())

+ 2 - 0
AI/Nullkiller/VCAI.h

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