hedgewars/uGearsUtils.pas
changeset 7627 e1e112687fd6
parent 7625 5c0ad64afc8d
child 7719 eeae1cb6b6bf
equal deleted inserted replaced
7626:73b9a385f898 7627:e1e112687fd6
   140                         end;
   140                         end;
   141                 gtGrave: begin
   141                 gtGrave: begin
   142 // Run the calcs only once we know we have a type that will need damage
   142 // Run the calcs only once we know we have a type that will need damage
   143                         tdX:= Gear^.X-fX;
   143                         tdX:= Gear^.X-fX;
   144                         tdY:= Gear^.Y-fY;
   144                         tdY:= Gear^.Y-fY;
   145                         if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then
   145                         if (tdX.Round + tdY.Round + 2) < dmgBase then
   146                             dmg:= dmgBase - hwRound(Distance(tdX, tdY));
   146                             dmg:= dmgBase - hwRound(Distance(tdX, tdY));
   147                         if dmg > 1 then
   147                         if dmg > 1 then
   148                             begin
   148                             begin
   149                             dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
   149                             dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
   150                             Gear^.dY:= - _0_004 * dmg;
   150                             Gear^.dY:= - _0_004 * dmg;
   239             end;
   239             end;
   240         uStats.HedgehogDamaged(Gear, AttackerHog, Damage, false);    
   240         uStats.HedgehogDamaged(Gear, AttackerHog, Damage, false);    
   241         end;
   241         end;
   242     end
   242     end
   243     else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
   243     else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
   244         begin
       
   245         Gear^.Hedgehog:= AttackerHog;
   244         Gear^.Hedgehog:= AttackerHog;
   246         end;
       
   247     inc(Gear^.Damage, Damage);
   245     inc(Gear^.Damage, Damage);
   248     
   246     
   249     ScriptCall('onGearDamage', Gear^.UID, Damage);
   247     ScriptCall('onGearDamage', Gear^.UID, Damage);
   250 end;
   248 end;
   251 
   249