hedgewars/uGearsUtils.pas
changeset 14041 44f20c9e6861
parent 14040 128fbd36eee4
child 14196 ab5e710d353d
equal deleted inserted replaced
14040:128fbd36eee4 14041:44f20c9e6861
    29 procedure AddBounceEffectForGear(Gear: PGear);
    29 procedure AddBounceEffectForGear(Gear: PGear);
    30 
    30 
    31 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
    31 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
    32 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
    32 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
    33 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
    33 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
    34 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
    34 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource; Damage: Longword);
    35 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: LongInt; showMessage: boolean; vgTint: Longword);
    35 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: LongInt; showMessage: boolean; vgTint: Longword);
    36 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: LongInt; showMessage: boolean);
    36 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: LongInt; showMessage: boolean);
    37 function IncHogHealth(Hedgehog: PHedgehog; healthBoost: LongInt): LongInt;
    37 function IncHogHealth(Hedgehog: PHedgehog; healthBoost: LongInt): LongInt;
    38 procedure CheckHHDamage(Gear: PGear);
    38 procedure CheckHHDamage(Gear: PGear);
    39 procedure CalcRotationDirAngle(Gear: PGear);
    39 procedure CalcRotationDirAngle(Gear: PGear);
   278     if (Gear^.Kind = gtHedgehog) then
   278     if (Gear^.Kind = gtHedgehog) then
   279         begin
   279         begin
   280         Gear^.LastDamage := AttackerHog;
   280         Gear^.LastDamage := AttackerHog;
   281 
   281 
   282         Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
   282         Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
   283         HHHurt(Gear^.Hedgehog, Source);
   283         HHHurt(Gear^.Hedgehog, Source, Damage);
   284         AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
   284         AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
   285         tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
   285         tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
   286         if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then
   286         if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then
   287             begin
   287             begin
   288             if cVampiric then
   288             if cVampiric then
   346 AllInactive:= false;
   346 AllInactive:= false;
   347 HHGear^.Active:= true;
   347 HHGear^.Active:= true;
   348 end;
   348 end;
   349 
   349 
   350 // Play effects for hurt hedgehog
   350 // Play effects for hurt hedgehog
   351 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
   351 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource; Damage: Longword);
   352 begin
   352 begin
   353 if Hedgehog^.Effects[heFrozen] <> 0 then exit;
   353 if Hedgehog^.Effects[heFrozen] <> 0 then exit;
   354 
   354 
   355 if (Source = dsFall) or (Source = dsExplosion) then
   355 if (Damage >= ouchDmg) and (OuchTauntTimer = 0) and ((Source = dsFall) or (Source = dsBullet) or (Source = dsShove) or (Source = dsHammer)) then
       
   356     begin
       
   357     PlaySoundV(sndOuch, Hedgehog^.Team^.voicepack);
       
   358     // Prevent sndOuch from being played too often in short time
       
   359     OuchTauntTimer:= 1250;
       
   360     end
       
   361 else if (Source = dsFall) or (Source = dsExplosion) then
   356     case random(3) of
   362     case random(3) of
   357         0: PlaySoundV(sndOoff1, Hedgehog^.Team^.voicepack);
   363         0: PlaySoundV(sndOoff1, Hedgehog^.Team^.voicepack);
   358         1: PlaySoundV(sndOoff2, Hedgehog^.Team^.voicepack);
   364         1: PlaySoundV(sndOoff2, Hedgehog^.Team^.voicepack);
   359         2: PlaySoundV(sndOoff3, Hedgehog^.Team^.voicepack);
   365         2: PlaySoundV(sndOoff3, Hedgehog^.Team^.voicepack);
   360     end
   366     end