hedgewars/uGears.pas
changeset 4143 eb7981f34800
parent 4120 0aba28eb8e34
child 4148 eaff5615f976
equal deleted inserted replaced
4142:980ec01b98e1 4143:eb7981f34800
  1655 
  1655 
  1656     if (content > ord(High(TAmmoType))) then content := ord(High(TAmmoType));
  1656     if (content > ord(High(TAmmoType))) then content := ord(High(TAmmoType));
  1657 
  1657 
  1658     case crate of
  1658     case crate of
  1659         HealthCrate: begin
  1659         HealthCrate: begin
  1660             FollowGear^.Health := 25;
  1660             FollowGear^.Health := cHealthCaseAmount;
  1661             FollowGear^.Pos := posCaseHealth;
  1661             FollowGear^.Pos := posCaseHealth;
  1662             AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo);
  1662             AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo);
  1663             end;
  1663             end;
  1664         AmmoCrate: begin
  1664         AmmoCrate: begin
  1665             FollowGear^.Pos := posCaseAmmo;
  1665             FollowGear^.Pos := posCaseAmmo;
  1697         inc(uTot, Ammoz[i].Probability);
  1697         inc(uTot, Ammoz[i].Probability);
  1698 
  1698 
  1699 t:=0;
  1699 t:=0;
  1700 a:=aTot;
  1700 a:=aTot;
  1701 h:= 1;
  1701 h:= 1;
  1702 // FIXME - shoppa is TEMPORARY REMOVE WHEN CRATE PROBABILITY ALLOWS DISABLING OF HEALTH CRATES
  1702 
  1703 // Preserving health crate distribution of 35% until that happens
       
  1704 if (aTot+uTot) <> 0 then
  1703 if (aTot+uTot) <> 0 then
  1705     if not shoppa and ((GameFlags and gfInvulnerable) = 0) then
  1704     if ((GameFlags and gfInvulnerable) = 0) then
  1706         begin
  1705         begin
  1707         h:= 3500;
  1706         h:= cHealthCaseProb * 100;
  1708         t:= GetRandom(10000);
  1707         t:= GetRandom(10000);
  1709         a:= 6500*aTot div (aTot+uTot)
  1708         a:= (10000-h)*aTot div (aTot+uTot)
  1710         end
  1709         end
  1711     else
  1710     else
  1712         begin
  1711         begin
  1713         t:= GetRandom(aTot+uTot);
  1712         t:= GetRandom(aTot+uTot);
  1714         h:= 0
  1713         h:= 0
  1716 
  1715 
  1717 
  1716 
  1718 if t<h then
  1717 if t<h then
  1719     begin
  1718     begin
  1720     FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0);
  1719     FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0);
  1721     FollowGear^.Health:= 25;
  1720     FollowGear^.Health:= cHealthCaseAmount;
  1722     FollowGear^.Pos:= posCaseHealth;
  1721     FollowGear^.Pos:= posCaseHealth;
  1723     AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo);
  1722     AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo);
  1724     end
  1723     end
  1725 else if (t<a+h) then
  1724 else if (t<a+h) then
  1726     begin
  1725     begin