hedgewars/uGearsHedgehog.pas
changeset 13617 a6abc2c1fc1a
parent 13611 65a10215ba43
child 13619 525686876f98
equal deleted inserted replaced
13616:5fdb18e892c5 13617:a6abc2c1fc1a
   781 end;
   781 end;
   782 
   782 
   783 ////////////////////////////////////////////////////////////////////////////////
   783 ////////////////////////////////////////////////////////////////////////////////
   784 procedure PickUp(HH, Gear: PGear);
   784 procedure PickUp(HH, Gear: PGear);
   785 var ag, gi: PGear;
   785 var ag, gi: PGear;
       
   786     healthBoost: LongInt;
   786 begin
   787 begin
   787 if Gear^.State and gstFrozen <> 0 then exit;
   788 if Gear^.State and gstFrozen <> 0 then exit;
   788 
   789 
   789 Gear^.Message:= gmDestroy;
   790 Gear^.Message:= gmDestroy;
   790 if (Gear^.Pos and posCaseExplode) <> 0 then
   791 if (Gear^.Pos and posCaseExplode) <> 0 then
   827                         ag^.Power:= Gear^.Power
   828                         ag^.Power:= Gear^.Power
   828                         end;
   829                         end;
   829                     end;
   830                     end;
   830      posCaseHealth: begin
   831      posCaseHealth: begin
   831                     PlaySound(sndShotgunReload);
   832                     PlaySound(sndShotgunReload);
   832                     inc(HH^.Health, Gear^.Health);
   833                     healthBoost:= IncHogHealth(HH^.Hedgehog, Gear^.Health);
   833                     // Prevent overflow
       
   834                     if (HH^.Health < 0) or (HH^.Health > cMaxHogHealth) then
       
   835                         HH^.Health:= cMaxHogHealth;
       
   836                     HH^.Hedgehog^.Effects[hePoisoned] := 0;
   834                     HH^.Hedgehog^.Effects[hePoisoned] := 0;
   837                     RenderHealth(HH^.Hedgehog^);
   835                     RenderHealth(HH^.Hedgehog^);
   838                     RecountTeamHealth(HH^.Hedgehog^.Team);
   836                     RecountTeamHealth(HH^.Hedgehog^.Team);
   839                     HHHeal(HH^.Hedgehog, Gear^.Health, true);
   837                     HHHeal(HH^.Hedgehog, healthBoost, true);
   840                     end;
   838                     end;
   841      end
   839      end
   842 end;
   840 end;
   843 
   841 
   844 procedure HedgehogStep(Gear: PGear);
   842 procedure HedgehogStep(Gear: PGear);