hedgewars/uGearsUtils.pas
changeset 14052 9c817b2eedae
parent 14041 44f20c9e6861
child 14196 ab5e710d353d
equal deleted inserted replaced
14051:8a0d69c16cad 14052:9c817b2eedae
    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
  1392                 Gear^.State:= Gear^.State or gstWinner;
  1398                 Gear^.State:= Gear^.State or gstWinner;
  1393             if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then
  1399             if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then
  1394                 begin
  1400                 begin
  1395                 if (Ammo^.Hedgehog^.Gear <> nil) then
  1401                 if (Ammo^.Hedgehog^.Gear <> nil) then
  1396                     Ammo^.Hedgehog^.Gear^.State:= Ammo^.Hedgehog^.Gear^.State and (not gstNotKickable);
  1402                     Ammo^.Hedgehog^.Gear^.State:= Ammo^.Hedgehog^.Gear^.State and (not gstNotKickable);
  1397                 ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch
  1403                 ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg * 100, dsExplosion); // crank up damage for explosives + blowtorch
  1398                 end;
  1404                 end;
  1399 
  1405 
  1400             if (Gear^.Kind = gtHedgehog) and (Gear^.Hedgehog^.King or (Gear^.Hedgehog^.Effects[heFrozen] > 0)) then
  1406             if (Gear^.Kind = gtHedgehog) and (Gear^.Hedgehog^.King or (Gear^.Hedgehog^.Effects[heFrozen] > 0)) then
  1401                 begin
  1407                 begin
  1402                 Gear^.dX:= Ammo^.dX * Power * _0_005;
  1408                 Gear^.dX:= Ammo^.dX * Power * _0_005;