hedgewars/uScript.pas
changeset 13617 a6abc2c1fc1a
parent 13604 73b096e1d895
child 13618 edffc9b7ad58
equal deleted inserted replaced
13616:5fdb18e892c5 13617:a6abc2c1fc1a
  1815         begin
  1815         begin
  1816         gear:= GearByUID(Trunc(lua_tonumber(L, 1)));
  1816         gear:= GearByUID(Trunc(lua_tonumber(L, 1)));
  1817         healthBoost:= Trunc(lua_tonumber(L, 2));
  1817         healthBoost:= Trunc(lua_tonumber(L, 2));
  1818         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) and (healthBoost >= 1) then
  1818         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) and (healthBoost >= 1) then
  1819             begin
  1819             begin
  1820             inc(gear^.Health, healthBoost);
  1820             healthBoost:= IncHogHealth(gear^.Hedgehog, healthBoost);
  1821             // Prevent overflow
       
  1822             if (gear^.Health < 0) or (gear^.Health > cMaxHogHealth) then
       
  1823                 gear^.Health:= cMaxHogHealth;
       
  1824 
       
  1825             RenderHealth(gear^.Hedgehog^);
  1821             RenderHealth(gear^.Hedgehog^);
  1826             RecountTeamHealth(gear^.Hedgehog^.Team);
  1822             RecountTeamHealth(gear^.Hedgehog^.Team);
  1827             if n = 4 then
  1823             if n = 4 then
  1828                 HHHeal(gear^.Hedgehog, healthBoost, lua_toboolean(L, 3), Trunc(lua_tonumber(L, 4)))
  1824                 HHHeal(gear^.Hedgehog, healthBoost, lua_toboolean(L, 3), Trunc(lua_tonumber(L, 4)))
  1829             else if n = 3 then
  1825             else if n = 3 then