hedgewars/uGearsHandlersMess.pas
changeset 9685 7d925e82e572
parent 9565 7f786eb439aa
child 9698 fc849dd48ae6
equal deleted inserted replaced
9683:a342837fc875 9685:7d925e82e572
   206     while gi <> nil do
   206     while gi <> nil do
   207         begin
   207         begin
   208         if (gi^.Kind = gtHedgehog) then
   208         if (gi^.Kind = gtHedgehog) then
   209             begin
   209             begin
   210             d := r - hwRound(Distance(gi^.X - x, gi^.Y - y));
   210             d := r - hwRound(Distance(gi^.X - x, gi^.Y - y));
   211             if (d > 1) and (not gi^.Invulnerable) and (GetRandom(2) = 0) then
   211             if (d > 1) and ((gi^.Hedgehog^.Effects[heInvulnerable] = 0)) and (GetRandom(2) = 0) then
   212                 begin
   212                 begin
   213                 if (CurrentHedgehog^.Gear = gi) then
   213                 if (CurrentHedgehog^.Gear = gi) then
   214                     PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack)
   214                     PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack)
   215 
   215 
   216                 else
   216                 else
  2824                 tdY:= gi^.Y-fY;
  2824                 tdY:= gi^.Y-fY;
  2825                 if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then
  2825                 if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then
  2826                     dmg:= dmgBase - max(hwRound(Distance(tdX, tdY)),gi^.Radius);
  2826                     dmg:= dmgBase - max(hwRound(Distance(tdX, tdY)),gi^.Radius);
  2827                 if (dmg > 1) then dmg:= ModifyDamage(min(dmg div 2, cakeDmg), gi);
  2827                 if (dmg > 1) then dmg:= ModifyDamage(min(dmg div 2, cakeDmg), gi);
  2828                 if (dmg > 1) then
  2828                 if (dmg > 1) then
  2829                     if (CurrentHedgehog^.Gear = gi) and (not gi^.Invulnerable) then
  2829                     if (CurrentHedgehog^.Gear = gi) and ((gi^.Hedgehog^.Effects[heInvulnerable] = 0)) then
  2830                         gi^.State := gi^.State or gstLoser
  2830                         gi^.State := gi^.State or gstLoser
  2831                     else
  2831                     else
  2832                         gi^.State := gi^.State or gstWinner;
  2832                         gi^.State := gi^.State or gstWinner;
  2833                 end;
  2833                 end;
  2834             gi := gi^.NextGear
  2834             gi := gi^.NextGear
  4732     tmp:= t^.ar[i];
  4732     tmp:= t^.ar[i];
  4733     if (tmp^.State and gstNoDamage) = 0 then
  4733     if (tmp^.State and gstNoDamage) = 0 then
  4734         if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then
  4734         if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then
  4735             begin
  4735             begin
  4736             //tmp^.State:= tmp^.State or gstFlatened;
  4736             //tmp^.State:= tmp^.State or gstFlatened;
  4737             if not tmp^.Invulnerable then
  4737             if (tmp^.Hedgehog^.Effects[heInvulnerable] = 0) then
  4738                 ApplyDamage(tmp, CurrentHedgehog, tmp^.Health div 3, dsUnknown);
  4738                 ApplyDamage(tmp, CurrentHedgehog, tmp^.Health div 3, dsUnknown);
  4739             //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
  4739             //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
  4740             tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
  4740             tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
  4741             tmp2^.LinkedGear:= tmp;
  4741             tmp2^.LinkedGear:= tmp;
  4742             SetAllToActive
  4742             SetAllToActive
  5073             begin
  5073             begin
  5074             t:= GearsList;
  5074             t:= GearsList;
  5075             while t <> nil do
  5075             while t <> nil do
  5076                 begin
  5076                 begin
  5077                 if (t^.Kind = gtHedgehog) and (t^.Hedgehog^.Team^.Clan = HH^.Team^.Clan) then
  5077                 if (t^.Kind = gtHedgehog) and (t^.Hedgehog^.Team^.Clan = HH^.Team^.Clan) then
  5078                     t^.Invulnerable:= true;
  5078                     t^.Hedgehog^.Effects[heInvulnerable]:= 1;
  5079                 t:= t^.NextGear;
  5079                 t:= t^.NextGear;
  5080                 end;
  5080                 end;
  5081             end;
  5081             end;
  5082 
  5082 
  5083     if Gear^.Health <= 0 then
  5083     if Gear^.Health <= 0 then