Untested fix of r3672 - should avoid hogs dying due to multiple health machine sources, and inappropriate application of karma/vampirism to these.
authornemo
Thu, 09 Sep 2010 14:16:44 -0400
changeset 3845 90034acb2e43
parent 3844 697c855bd48d
child 3846 c6b62c7f3668
Untested fix of r3672 - should avoid hogs dying due to multiple health machine sources, and inappropriate application of karma/vampirism to these.
hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Wed Sep 08 19:01:11 2010 -0400
+++ b/hedgewars/uGears.pas	Thu Sep 09 14:16:44 2010 -0400
@@ -670,8 +670,8 @@
             begin
             tmp:= 0;
             if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then
-                inc(tmp, min(ModifyDamage(5,Gear), max(0,Gear^.Health - 1 - Gear^.Damage)));
-            inc(tmp, min(cHealthDecrease, max(0,Gear^.Health - 1 - Gear^.Damage)));
+                inc(tmp, ModifyDamage(cHealthDecrease, Gear));
+            inc(tmp, cHealthDecrease);
             if PHedgehog(Gear^.Hedgehog)^.King then
                 begin
                 flag:= false;
@@ -681,9 +681,13 @@
                         (not team^.Hedgehogs[i].King) and
                         (team^.Hedgehogs[i].Gear^.Health > team^.Hedgehogs[i].Gear^.Damage)
                     then flag:= true;
-                if not flag then inc(tmp, min(5, max(0,Gear^.Health - 1 - Gear^.Damage)))
+                if not flag then inc(tmp, cHealthDecrease)
                 end;
-            if tmp > 0 then ApplyDamage(Gear, tmp, dsPoison);
+            if tmp > 0 then 
+                begin
+                inc(Gear^.Damage, min(tmp, max(0,Gear^.Health - 1 - Gear^.Damage)));
+                HHHurt(Gear^.Hedgehog, dsPoison);
+                end
             end;
 
         Gear:= Gear^.NextGear