hedgewars/uGears.pas
changeset 5062 e2d38329b84a
parent 5033 46da78d7966b
child 5063 d0722d0b024d
equal deleted inserted replaced
5060:7d0f6e5b1c1c 5062:e2d38329b84a
   576             if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF))) and (hwRound(Gear^.Y) < cWaterLine + 256) then
   576             if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF))) and (hwRound(Gear^.Y) < cWaterLine + 256) then
   577                 spawnHealthTagForHH(Gear, t);
   577                 spawnHealthTagForHH(Gear, t);
   578 
   578 
   579             // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog
   579             // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog
   580             // same stand for CheckHHDamage
   580             // same stand for CheckHHDamage
   581             uStats.HedgehogDamaged(Gear, CurrentHedgehog)
   581             if (Gear^.LastDamage <> nil) then
       
   582                 uStats.HedgehogDamaged(Gear, Gear^.LastDamage)
       
   583             else
       
   584                 uStats.HedgehogDamaged(Gear, CurrentHedgehog)
   582             end;
   585             end;
   583 
   586 
   584         team:= Gear^.Hedgehog^.Team;
   587         team:= Gear^.Hedgehog^.Team;
   585         if CurrentHedgehog^.Gear = Gear then
   588         if CurrentHedgehog^.Gear = Gear then
   586             begin
   589             begin
  1017 begin
  1020 begin
  1018   if Damage = 0 then exit; // nothing to apply
  1021   if Damage = 0 then exit; // nothing to apply
  1019 
  1022 
  1020     if (Gear^.Kind = gtHedgehog) then
  1023     if (Gear^.Kind = gtHedgehog) then
  1021     begin
  1024     begin
       
  1025 
       
  1026     Gear^.LastDamage := AttackerHog;
       
  1027 
  1022     Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
  1028     Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
  1023     uStats.HedgehogDamaged(Gear, AttackerHog);
  1029     uStats.HedgehogDamaged(Gear, AttackerHog);
  1024     HHHurt(Gear^.Hedgehog, Source);
  1030     HHHurt(Gear^.Hedgehog, Source);
  1025     AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
  1031     AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
  1026     tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
  1032     tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
  1051         if ((GameFlags and gfKarma) <> 0) and
  1057         if ((GameFlags and gfKarma) <> 0) and
  1052            ((GameFlags and gfInvulnerable) = 0) and
  1058            ((GameFlags and gfInvulnerable) = 0) and
  1053            not CurrentHedgehog^.Gear^.Invulnerable then
  1059            not CurrentHedgehog^.Gear^.Invulnerable then
  1054            begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
  1060            begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
  1055            inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
  1061            inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
       
  1062            CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
  1056            spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
  1063            spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
  1057            end;
  1064            end;
  1058         end;
  1065         end;
  1059     end else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
  1066     end else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
  1060         begin
  1067         begin