2 #include "InhaleNeed.hpp"
3 #include "IngestNeed.hpp"
5 #include "Creature.hpp"
6 #include "../world/Planet.hpp"
15 void Need::Tick(double dt) noexcept {
16 value = std::min(1.0, value + gain * dt);
20 IngestNeed::IngestNeed(int resource, double speed, double damage)
26 IngestNeed::~IngestNeed() {
29 void IngestNeed::ApplyEffect(Creature &c, double dt) {
31 // TODO: find resource and start ingest task
39 InhaleNeed::InhaleNeed(int resource, double speed, double damage)
45 InhaleNeed::~InhaleNeed() {
48 void InhaleNeed::ApplyEffect(Creature &c, double dt) {
50 // TODO: make condition more natural with thresholds and stuff
51 if (c.GetSituation().OnPlanet() && c.GetSituation().GetPlanet().Atmosphere() == resource) {
52 value = std::max(0.0, value - (speed * dt));