void Creature::Hurt(double amount) noexcept {
stats.Damage().Add(amount);
+ if (stats.Damage().Full()) {
+ Die();
+ }
+}
+
+void Creature::Die() noexcept {
+ if (Dead()) return;
+
if (stats.Damage().Full()) {
std::ostream &log = sim.Log() << name << " ";
if (stats.Exhaustion().Full()) {
<< " (" << ui::PercentageString(Age() / properties.Lifetime())
<< " of life expectancy of " << ui::TimeString(properties.Lifetime())
<< ")" << std::endl;
- Die();
}
-}
-
-void Creature::Die() noexcept {
- if (Dead()) return;
sim.SetDead(this);
death = sim.Time();
for (auto &s : stats.stat) {
s.Add(s.gain * dt);
}
- stats.Breath().Add(stats.Breath().gain * stats.Exhaustion().value * dt);
// TODO: damage values depending on properties
if (stats.Breath().Full()) {
constexpr double dps = 1.0 / 4.0;