Make health machine effects impact health reset
authornemo
Thu, 04 Nov 2010 14:46:49 -0400
changeset 4111 ceb58fa4cfcb
parent 4110 893018e0f129
child 4112 c5d350b619a5
Make health machine effects impact health reset
hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Thu Nov 04 01:07:14 2010 +0100
+++ b/hedgewars/uGears.pas	Thu Nov 04 14:46:49 2010 -0400
@@ -680,8 +680,12 @@
             begin
             tmp:= 0;
             if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then
+                begin
                 inc(tmp, ModifyDamage(5, Gear));
+                if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth)  // does not need a minimum check since <= 1 basically disables it
+                end;
             inc(tmp, cHealthDecrease);
+            if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth, cHealthDecrease);
             if PHedgehog(Gear^.Hedgehog)^.King then
                 begin
                 flag:= false;
@@ -691,7 +695,11 @@
                         (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, 5)
+                if not flag then
+                    begin
+                    inc(tmp, 5);
+                    if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth, 5)
+                    end
                 end;
             if tmp > 0 then 
                 begin