hedgewars/uGears.pas
changeset 5202 45a16280d68d
parent 5197 9fa96377a69c
child 5279 66969e7494c5
equal deleted inserted replaced
5201:7b9aa7aac336 5202:45a16280d68d
   591             begin
   591             begin
   592             t:= max(Gear^.Damage, Gear^.Health);
   592             t:= max(Gear^.Damage, Gear^.Health);
   593             Gear^.Damage:= t;
   593             Gear^.Damage:= t;
   594             if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF))) and (hwRound(Gear^.Y) < cWaterLine + 256) then
   594             if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF))) and (hwRound(Gear^.Y) < cWaterLine + 256) then
   595                 spawnHealthTagForHH(Gear, t);
   595                 spawnHealthTagForHH(Gear, t);
   596 
       
   597             // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog
       
   598             // same stand for CheckHHDamage
       
   599             if (Gear^.LastDamage <> nil) then
       
   600                 uStats.HedgehogDamaged(Gear, Gear^.LastDamage)
       
   601             else
       
   602                 uStats.HedgehogDamaged(Gear, CurrentHedgehog)
       
   603             end;
   596             end;
   604 
   597 
   605         team:= Gear^.Hedgehog^.Team;
   598         team:= Gear^.Hedgehog^.Team;
   606         if CurrentHedgehog^.Gear = Gear then
   599         if CurrentHedgehog^.Gear = Gear then
   607             begin
   600             begin
   621                     begin
   614                     begin
   622                     team^.Clan^.Teams[i]^.hasGone:= true;
   615                     team^.Clan^.Teams[i]^.hasGone:= true;
   623                     TeamGoneEffect(team^.Clan^.Teams[i]^)
   616                     TeamGoneEffect(team^.Clan^.Teams[i]^)
   624                     end
   617                     end
   625             end;
   618             end;
       
   619 
       
   620         // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog
       
   621         // same stand for CheckHHDamage
       
   622         if (Gear^.LastDamage <> nil) then
       
   623             uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true)
       
   624         else
       
   625             uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true);
       
   626 
   626         inc(KilledHHs);
   627         inc(KilledHHs);
   627         RecountTeamHealth(team);
   628         RecountTeamHealth(team);
   628         if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and not Gear^.Hedgehog^.Effects[heResurrectable] then
   629         if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and not Gear^.Hedgehog^.Effects[heResurrectable] then
   629             with CurrentHedgehog^ do 
   630             with CurrentHedgehog^ do 
   630                 begin
   631                 begin
  1076            begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
  1077            begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
  1077            inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
  1078            inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
  1078            CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
  1079            CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
  1079            spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
  1080            spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
  1080            end;
  1081            end;
       
  1082         uStats.HedgehogDamaged(Gear, AttackerHog, Damage, false);    
  1081         end;
  1083         end;
  1082     end else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
  1084     end else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
  1083         begin
  1085         begin
  1084         Gear^.Hedgehog:= AttackerHog;
  1086         Gear^.Hedgehog:= AttackerHog;
  1085         end;
  1087         end;
  1086     inc(Gear^.Damage, Damage);
  1088     inc(Gear^.Damage, Damage);
  1087     
  1089     
  1088     uStats.HedgehogDamaged(Gear, AttackerHog);    
       
  1089     ScriptCall('onGearDamage', Gear^.UID, Damage);
  1090     ScriptCall('onGearDamage', Gear^.UID, Damage);
  1090 end;
  1091 end;
  1091 
  1092 
  1092 procedure SetAllToActive;
  1093 procedure SetAllToActive;
  1093 var t: PGear;
  1094 var t: PGear;