]> git.localhorst.tv Git - blobs.git/blobdiff - src/creature/Need.hpp
abstract needs a little
[blobs.git] / src / creature / Need.hpp
index 93d46e84a5ed7dd15631087ccb43743b0d9a3c4d..2fd4898f3e40aa927b4f6fa9c9ac2c5770694059 100644 (file)
@@ -1,24 +1,37 @@
 #ifndef BLOBS_CREATURE_NEED_HPP_
 #define BLOBS_CREATURE_NEED_HPP_
 
+#include <string>
+
+
 namespace blobs {
 namespace creature {
 
+class Creature;
+class Effect;
+
 struct Need {
 
-       int resource = -1;
+       std::string name;
+
        double value = 0.0;
 
        // how fast value grows per second
        double gain = 0.0;
        // the value at which this need is no longer satisfied
+       double inconvenient = 0.0;
+       // the value at which this need starts to hurt
        double critical = 0.0;
-       // the price to pay for not satsfying the need
-       double penalty = 0.0;
+
+       virtual ~Need() noexcept;
 
        void Tick(double dt) noexcept;
 
-       bool IsSatisfied() const noexcept { return value < critical; }
+       bool IsSatisfied() const noexcept { return value < inconvenient; }
+       bool IsInconvenient() const noexcept { return value >= inconvenient && value < critical; }
+       bool IsCritical() const noexcept { return value >= critical; }
+
+       virtual void ApplyEffect(Creature &, double dt) = 0;
 
 };