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();