# HG changeset patch # User unc0rr # Date 1301333226 -14400 # Node ID e2d38329b84ac4e9613119654886a8118167f5ae # Parent 7d0f6e5b1c1ce9571081444159649e02be0f465f Colin Rice *Give correct credit for damage diff -r 7d0f6e5b1c1c -r e2d38329b84a hedgewars/uGears.pas --- 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; diff -r 7d0f6e5b1c1c -r e2d38329b84a hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Mon Mar 28 20:31:01 2011 +0400 +++ b/hedgewars/uTypes.pas Mon Mar 28 21:27:06 2011 +0400 @@ -235,7 +235,8 @@ ImpactSound: TSound; // first sound, others have to be after it in the sounds def. nImpactSounds: Word; // count of ImpactSounds SoundChannel: LongInt; - PortalCounter: LongWord // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion. + PortalCounter: LongWord; // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion. + LastDamage: PHedgehog; end; TPGearArray = Array of PGear;