hedgewars/uGearsHandlersMess.pas
changeset 15742 0b5aea8e5eab
parent 15741 8997e212be4c
child 15753 72f735c03fec
equal deleted inserted replaced
15741:8997e212be4c 15742:0b5aea8e5eab
  6085     tmp:= t^.ar[i];
  6085     tmp:= t^.ar[i];
  6086     if (tmp^.State and gstNoDamage) = 0 then
  6086     if (tmp^.State and gstNoDamage) = 0 then
  6087         if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then
  6087         if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then
  6088             begin
  6088             begin
  6089             dmg:= 0;
  6089             dmg:= 0;
  6090             if (tmp^.Kind <> gtHedgehog) or (tmp^.Hedgehog^.Effects[heInvulnerable] = 0) then
  6090             if (tmp^.Kind <> gtHedgehog) or
       
  6091                ((tmp^.Hedgehog^.Effects[heInvulnerable] = 0) and ((tmp^.State and gstHHDeath) = 0)) then
  6091                 begin
  6092                 begin
  6092                 // base damage on remaining health
  6093                 // base damage on remaining health
  6093                 dmg:= (tmp^.Health - tmp^.Damage);
  6094                 dmg:= (tmp^.Health - tmp^.Damage);
       
  6095                 // always rounding down
       
  6096                 dmg:= dmg div Gear^.Boom;
       
  6097 
  6094                 if dmg > 0 then
  6098                 if dmg > 0 then
  6095                     begin
  6099                     ApplyDamage(tmp, CurrentHedgehog, dmg, dsHammer);
  6096                     // always rounding down
  6100                 tmp^.dY:= _0_03 * Gear^.Boom
  6097                     dmg:= dmg div Gear^.Boom;
       
  6098 
       
  6099                     if dmg > 0 then
       
  6100                         ApplyDamage(tmp, CurrentHedgehog, dmg, dsHammer);
       
  6101                     end;
       
  6102         tmp^.dY:= _0_03 * Gear^.Boom
       
  6103                 end;
  6101                 end;
  6104 
  6102 
  6105             if (tmp^.Kind <> gtHedgehog) or (dmg > 0) or (tmp^.Health > tmp^.Damage) then
  6103             if ((tmp^.Kind = gtHedgehog) and ((tmp^.State and gstHHDeath) = 0)) or (tmp^.Health > tmp^.Damage) then
  6106                 begin
  6104                 begin
  6107                 tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
  6105                 tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
  6108                 tmp2^.LinkedGear:= tmp;
  6106                 tmp2^.LinkedGear:= tmp;
  6109                 SetAllToActive
  6107                 SetAllToActive
  6110                 end;
  6108                 end;