-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCreature.hpp
151 lines (100 loc) · 4.16 KB
/
Creature.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#pragma once
#ifndef WORLDSIM_CREATURE_HPP
#define WORLDSIM_CREATURE_HPP
/* WorldSim: Creature
#include "Creature.hpp"
Creatures are non-civilised actors. They are no members of Tribes or Civilisations, and don't have a race.
For now they are randomly spawned in. In the future I'd like them to have realistic behaviour,
for example travelling in groups and looking for food.
Creatures may be herbivores or carnivores. Each creature type may have its own AI package.
Creatures are usually simulated using the abstract data layer.
Creature should refer to the base type. Creature_Implementation should refer to infividual Creature instances.
This also provides the opportunity to later divide Creature instances into Creature_Abstract and fully detailed
instances.
*/
#include <Game/Calendar/Calendar.hpp>
#include <Container/Table/TableInterface.hpp>
#include "WorldObject.hpp"
#include "Creature_Knowledge.hpp"
class World_Local;
#include "Creature_Attack.hpp"
#include "Creature_Species.hpp"
class Creature: public WorldObject, public TableInterface
{
public:
bool isMale;
int age; /* In ticks */
int daysCounter; /* 0-360 */
int secondsCounter; /* 0 - 86,400 */
bool isCarnivore; /* Creature can eat other animals. Otherwise the creature is a herbivore */
/* Herbivores are reliant on the grass and plants on their map */
// Home biome - Biome the creature is evolved for.
int actionPoints; /* Base: 100. Points are deducted for each action. */
bool isAlive;
int health;
// Creatures also need to eat and drink.
// However herbivores can eat grass.
int hunger;
int thirst;
short int fleeCounter; /* How many more turns the Creature should flee for. */
// All loaded creatures can get a link to their world.
World_Local* map;
//Creature's knowledge of the world (optional).
Creature_Knowledge* knowledge;
Creature_Species* species;
// INTERACTION
int nPelt; /* How many pelts you can harvest from the creature. */
int nMeat; /* How many meats you can harvest from the creature. */
// ATTACK
// Creatures might get a choice of attacks kinda like Pokemon.
// For example an elephant might gore you with its tusks, or stomp on you.
// A dragon might slash you with its claws or breathe fire.
// Creatures may pick these attacks randomly or intelligently, depending on the creature.
Vector <Creature_Attack*> vAttack;
Texture * baseTexture;
// short int baseAtkSlash;
// short int baseAtkStab;
// short int baseAtkBlunt;
// INITIALIZATION
Creature();
// Initialise, including roll for stats. 0 - Roll gender. 1 - Male. 2 - Female.
void init( int _sex = 0);
/* AI FUNCTIONS
*/
virtual void incrementTicks(int = 1);
virtual void wander() override;
Texture* currentTexture () override;
void die();
// KNOWLEDGE
//returns true if the Creature has seen this tile.
bool hasSeen( World_Local* /* _map */, int /* _x */, int /* _y */ );
/* TABLE INTERFACE */
std::string getColumn(std::string _column) override;
std::string getColumnType(std::string _column) override;
/* COMBAT FUNCTIONS */
//Attack a Creature once.
virtual void attack (Creature*, Creature_Attack*) {}
virtual void attack (Character*, Creature_Attack*) {}
//Update knowledge with current instance.
void updateKnowledge();
// Extra processing available
void updateKnowledgeIdle();
virtual std::string getName() override;
};
// Footprints indicate the type of creature that walked here, the direction they were walking, and a rough
// estimate of how long ago they were here. Footprints disappear over time. Footprints will generally last
// a few hours.
// Footprints probably won't stack, it is assumed one set of footprints will make the others illegible.
// Todo: This could be updated to provide more than just footprints. For example droppings or blood.
// Class could be renamed as Evidence.
class Creature_Footprint: public WorldObject
{
public:
Creature* owner;
int direction;
int age;
Texture* currentTexture () override;
};
#include "Creature_Generator.hpp"
#include "Creature_Manager.cpp"
#endif