hedgewars/uGears.pas
changeset 4885 bf7f2c1cc235
parent 4883 7cddc9201a1d
child 4895 481dfbe69cd2
equal deleted inserted replaced
4884:b2006a9f0fbc 4885:bf7f2c1cc235
  1002 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
  1002 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
  1003 var s: shortstring;
  1003 var s: shortstring;
  1004     vampDmg, tmpDmg, i: Longword;
  1004     vampDmg, tmpDmg, i: Longword;
  1005     vg: PVisualGear;
  1005     vg: PVisualGear;
  1006 begin
  1006 begin
  1007     if (Gear^.Kind = gtHedgehog) and (Damage>=1) then
  1007   if Damage = 0 then exit; // nothing to apply
       
  1008 
       
  1009     if (Gear^.Kind = gtHedgehog) then
  1008     begin
  1010     begin
  1009     uStats.HedgehogDamaged(Gear, AttackerHog);
  1011     uStats.HedgehogDamaged(Gear, AttackerHog);
  1010     HHHurt(Gear^.Hedgehog, Source);
  1012     HHHurt(Gear^.Hedgehog, Source);
  1011     AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
  1013     AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
  1012     tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
  1014     tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));