Don't let hedgehogs moan if they take 0 Sudden Death damage
authorWuzzy <Wuzzy2@mail.ru>
Thu, 12 Apr 2018 14:52:47 +0200
changeset 13324 78f097923bcb
parent 13323 9071600f7b22
child 13325 b024cf25bde1
Don't let hedgehogs moan if they take 0 Sudden Death damage
ChangeLog.txt
hedgewars/uGears.pas
--- a/ChangeLog.txt	Thu Apr 12 01:51:38 2018 +0200
+++ b/ChangeLog.txt	Thu Apr 12 14:52:47 2018 +0200
@@ -13,7 +13,7 @@
  + Hedgehog tag translucency is now changed with [Switch] + [Change hedgehog tags]
  + When using flying saucer shortly after a jump, stay in-mid air
  + No longer cut off team/hedgehog names when not playing online
- * Fix possible network desyncronization and crash when players rejoin an active game
+ * Fix possible network desynchronization and crash when players rejoin an active game
  * Fix time box being usable in Sudden Death with 0 health decrease
  * Fix chat input key being sometimes registered twice
  * Fix not displaying current volume status after pressing mute key
--- a/hedgewars/uGears.pas	Thu Apr 12 01:51:38 2018 +0200
+++ b/hedgewars/uGears.pas	Thu Apr 12 14:52:47 2018 +0200
@@ -158,8 +158,12 @@
                 end;
             if tmp > 0 then
                 begin
-                inc(Gear^.Damage, min(tmp, max(0,Gear^.Health - 1 - Gear^.Damage)));
-                HHHurt(Gear^.Hedgehog, dsPoison);
+                // SD damage never reduces health below 1
+                tmp:= min(tmp, max(0, Gear^.Health - 1 - Gear^.Damage));
+                inc(Gear^.Damage, tmp);
+                if tmp > 0 then
+                    // Make hedgehog moan on damage
+                    HHHurt(Gear^.Hedgehog, dsPoison);
                 end
             end;