added the maintainer and changed some naming.
This commit is contained in:
22
douwco_hivemind/include/Creeps/Builder.hpp
Normal file
22
douwco_hivemind/include/Creeps/Builder.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef DOUWCO_HIVEMIND_BUILDER_HPP
|
||||
#define DOUWCO_HIVEMIND_BUILDER_HPP
|
||||
|
||||
#include "Creeps/Worker.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class Builder : public Worker
|
||||
{
|
||||
public:
|
||||
Builder(Screeps::Creep creep) : Worker(creep) {}
|
||||
|
||||
protected:
|
||||
void depositEnergy() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Screeps::ConstructionSite> getConstructionSiteTarget();
|
||||
void searchConstructionSite();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_BUILDER_HPP
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef DOUWCO_HIVEMIND_CREEP_HPP
|
||||
#define DOUWCO_HIVEMIND_CREEP_HPP
|
||||
#ifndef DOUWCO_HIVEMIND_CREEPBASE_HPP
|
||||
#define DOUWCO_HIVEMIND_CREEPBASE_HPP
|
||||
|
||||
#include <Screeps/Creep.hpp>
|
||||
|
||||
@@ -14,12 +14,13 @@ namespace DouwcoHivemind
|
||||
enum CreepRole
|
||||
{
|
||||
UNEMPLOYED,
|
||||
HARVESTER_SUPPLIER,
|
||||
HARVESTER_UPGRADER,
|
||||
HARVESTER_BUILDER
|
||||
SUPPLIER,
|
||||
UPGRADER,
|
||||
BUILDER,
|
||||
MAINTAINER
|
||||
};
|
||||
|
||||
class Creep
|
||||
class CreepBase
|
||||
{
|
||||
public:
|
||||
CreepRole role;
|
||||
@@ -30,15 +31,19 @@ namespace DouwcoHivemind
|
||||
JSON memory;
|
||||
|
||||
public:
|
||||
Creep(Screeps::Creep crp);
|
||||
virtual ~Creep();
|
||||
CreepBase(Screeps::Creep crp);
|
||||
virtual ~CreepBase();
|
||||
virtual void loop() {}
|
||||
|
||||
|
||||
|
||||
bool isNearTo(const Screeps::RoomPosition &pos, int dist);
|
||||
|
||||
|
||||
protected:
|
||||
void moveToTarget(int dist = 1);
|
||||
std::unique_ptr<Screeps::RoomObject> getRoomObjectTarget();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_CREEP_HPP
|
||||
#endif // DOUWCO_HIVEMIND_CREEPBASE_HPP
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef DOUWCO_HIVEMIND_HARVESTER_BUILDER_HPP
|
||||
#define DOUWCO_HIVEMIND_HARVESTER_BUILDER_HPP
|
||||
|
||||
#include "Creeps/Harvester.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class HarvesterBuilder : public Harvester
|
||||
{
|
||||
public:
|
||||
HarvesterBuilder(Screeps::Creep creep) : Harvester(creep) {}
|
||||
|
||||
protected:
|
||||
void depositEnergy() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Screeps::ConstructionSite> getConstructionSiteTarget();
|
||||
void searchConstructionSite();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_HARVESTER_BUILDER_HPP
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef DOUWCO_HIVEMIND_HARVESTER_SUPPLIER_HPP
|
||||
#define DOUWCO_HIVEMIND_HARVESTER_SUPPLIER_HPP
|
||||
|
||||
#include "Creeps/Harvester.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class HarvesterSupplier : public Harvester
|
||||
{
|
||||
public:
|
||||
HarvesterSupplier(Screeps::Creep creep) : Harvester(creep) {}
|
||||
|
||||
protected:
|
||||
void depositEnergy() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Screeps::Structure> getEnergyStructureTarget();
|
||||
void searchEnergyStructure();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_HARVESTER_SUPPLIER_HPP
|
||||
22
douwco_hivemind/include/Creeps/Maintainer.hpp
Normal file
22
douwco_hivemind/include/Creeps/Maintainer.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef DOUWCO_HIVEMIND_MAINTAINER_HPP
|
||||
#define DOUWCO_HIVEMIND_MAINTAINER_HPP
|
||||
|
||||
#include "Creeps/Worker.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class Maintainer : public Worker
|
||||
{
|
||||
public:
|
||||
Maintainer(Screeps::Creep creep) : Worker(creep) {}
|
||||
|
||||
protected:
|
||||
void depositEnergy() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Screeps::Structure> getDamagedStructureTarget();
|
||||
void searchDamagedStructure();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_MAINTAINER_HPP
|
||||
22
douwco_hivemind/include/Creeps/Supplier.hpp
Normal file
22
douwco_hivemind/include/Creeps/Supplier.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef DOUWCO_HIVEMIND_SUPPLIER_HPP
|
||||
#define DOUWCO_HIVEMIND_SUPPLIER_HPP
|
||||
|
||||
#include "Creeps/Worker.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class Supplier : public Worker
|
||||
{
|
||||
public:
|
||||
Supplier(Screeps::Creep creep) : Worker(creep) {}
|
||||
|
||||
protected:
|
||||
void depositEnergy() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Screeps::Structure> getEnergyStructureTarget();
|
||||
void searchEnergyStructure();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_SUPPLIER_HPP
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef DOUWCO_HIVEMIND_HARVESTER_UPGRADER_HPP
|
||||
#define DOUWCO_HIVEMIND_HARVESTER_UPGRADER_HPP
|
||||
|
||||
#include "Creeps/Harvester.hpp"
|
||||
#include "Creeps/Worker.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class HarvesterUpgrader : public Harvester
|
||||
class Upgrader : public Worker
|
||||
{
|
||||
public:
|
||||
HarvesterUpgrader(Screeps::Creep creep) : Harvester(creep) {}
|
||||
Upgrader(Screeps::Creep creep) : Worker(creep) {}
|
||||
|
||||
protected:
|
||||
void depositEnergy() override;
|
||||
@@ -1,18 +1,18 @@
|
||||
#ifndef DOUWCO_HIVEMIND_HARVESTER_HPP
|
||||
#define DOUWCO_HIVEMIND_HARVESTER_HPP
|
||||
|
||||
#include "Creeps/Creep.hpp"
|
||||
#include "Creeps/CreepBase.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class Harvester : public Creep
|
||||
class Worker : public CreepBase
|
||||
{
|
||||
private:
|
||||
bool harvesting;
|
||||
|
||||
public:
|
||||
Harvester(Screeps::Creep crp);
|
||||
~Harvester() override;
|
||||
Worker(Screeps::Creep crp);
|
||||
~Worker() override;
|
||||
|
||||
void loop() override;
|
||||
|
||||
Reference in New Issue
Block a user