hedgewars/uGears.pas
changeset 2057 cf0d84479251
parent 2053 9a8a4add3eff
child 2067 7524a783bd8c
--- a/hedgewars/uGears.pas	Fri May 15 00:38:49 2009 +0000
+++ b/hedgewars/uGears.pas	Fri May 15 00:51:37 2009 +0000
@@ -665,11 +665,10 @@
 var s: shortstring;
     vampDmg: Longword;
 begin
-	inc(Gear^.Damage, Damage);
 	if Gear^.Kind = gtHedgehog then
     begin
 	AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color);
-    Damage:= min(Damage, Gear^.Health);
+    Damage:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
     if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (Damage >= 1) then
         begin
         if cVampiric then
@@ -704,6 +703,7 @@
            end;
         end;
     end;
+	inc(Gear^.Damage, Damage);
 end;
 
 procedure SetAllToActive;