]> git.localhorst.tv Git - blobs.git/commitdiff
only show death message when damage is max
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 4 Dec 2017 14:26:37 +0000 (15:26 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 4 Dec 2017 14:26:37 +0000 (15:26 +0100)
and I was wondering why they all randomly died, lol

src/creature/creature.cpp

index 8c7d23569ac42b039f4ffe604b0cd2d9e177969d..911d9d024f4ce7c58d4b69e4960ec42575e67ba4 100644 (file)
@@ -216,22 +216,24 @@ void Creature::Hurt(double amount) noexcept {
 void Creature::Die() noexcept {
        if (Dead()) return;
 
-       std::ostream &log = sim.Log() << name << " ";
-       if (stats.Exhaustion().Full()) {
-               log << "died of exhaustion";
-       } else if (stats.Breath().Full()) {
-               log << "suffocated";
-       } else if (stats.Thirst().Full()) {
-               log << "died of thirst";
-       } else if (stats.Hunger().Full()) {
-               log << "starved to death";
-       } else {
-               log << "succumed to wounds";
+       if (stats.Damage().Full()) {
+               std::ostream &log = sim.Log() << name << " ";
+               if (stats.Exhaustion().Full()) {
+                       log << "died of exhaustion";
+               } else if (stats.Breath().Full()) {
+                       log << "suffocated";
+               } else if (stats.Thirst().Full()) {
+                       log << "died of thirst";
+               } else if (stats.Hunger().Full()) {
+                       log << "starved to death";
+               } else {
+                       log << "succumed to wounds";
+               }
+               log << " at an age of " << ui::TimeString(Age())
+                       << " (" << ui::PercentageString(Age() / properties.Lifetime())
+                       << " of life expectancy of " << ui::TimeString(properties.Lifetime())
+                       << ")" << std::endl;
        }
-       log << " at an age of " << ui::TimeString(Age())
-               << " (" << ui::PercentageString(Age() / properties.Lifetime())
-               << " of life expectancy of " << ui::TimeString(properties.Lifetime())
-               << ")" << std::endl;
 
        sim.SetDead(this);
        death = sim.Time();