]> git.localhorst.tv Git - blobs.git/blob - src/creature/Need.hpp
remove outdated TODOs
[blobs.git] / src / creature / Need.hpp
1 #ifndef BLOBS_CREATURE_NEED_HPP_
2 #define BLOBS_CREATURE_NEED_HPP_
3
4 #include <string>
5
6
7 namespace blobs {
8 namespace creature {
9
10 class Creature;
11 class Effect;
12
13 struct Need {
14
15         std::string name;
16
17         double value = 0.0;
18
19         // how fast value grows per second
20         double gain = 0.0;
21         // the value at which this need is no longer satisfied
22         double inconvenient = 0.0;
23         // the value at which this need starts to hurt
24         double critical = 0.0;
25         // factor of the intake that may stay in the body
26         double growth = 0.0;
27
28         virtual ~Need() noexcept;
29
30         void Tick(double dt) noexcept;
31         void Increase(double) noexcept;
32         void Decrease(double) noexcept;
33
34         bool IsSatisfied() const noexcept { return value < inconvenient; }
35         bool IsInconvenient() const noexcept { return value >= inconvenient && value < critical; }
36         bool IsCritical() const noexcept { return value >= critical; }
37
38         virtual void ApplyEffect(Creature &, double dt) = 0;
39
40 };
41
42 }
43 }
44
45 #endif