hedgewars/uGears.pas
changeset 5062 e2d38329b84a
parent 5033 46da78d7966b
child 5063 d0722d0b024d
--- a/hedgewars/uGears.pas	Mon Mar 28 20:31:01 2011 +0400
+++ b/hedgewars/uGears.pas	Mon Mar 28 21:27:06 2011 +0400
@@ -578,7 +578,10 @@
 
             // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog
             // same stand for CheckHHDamage
-            uStats.HedgehogDamaged(Gear, CurrentHedgehog)
+            if (Gear^.LastDamage <> nil) then
+                uStats.HedgehogDamaged(Gear, Gear^.LastDamage)
+            else
+                uStats.HedgehogDamaged(Gear, CurrentHedgehog)
             end;
 
         team:= Gear^.Hedgehog^.Team;
@@ -1019,6 +1022,9 @@
 
     if (Gear^.Kind = gtHedgehog) then
     begin
+
+    Gear^.LastDamage := AttackerHog;
+
     Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
     uStats.HedgehogDamaged(Gear, AttackerHog);
     HHHurt(Gear^.Hedgehog, Source);
@@ -1053,6 +1059,7 @@
            not CurrentHedgehog^.Gear^.Invulnerable then
            begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
            inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
+           CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
            spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
            end;
         end;