hedgewars/uTeams.pas
changeset 2784 1a2e3c7c6a46
parent 2770 851313907bcb
child 2785 de6406cd6b25
equal deleted inserted replaced
2783:1532fde15179 2784:1a2e3c7c6a46
   338     RecountTeamHealth(TeamsArray[t])
   338     RecountTeamHealth(TeamsArray[t])
   339 end;
   339 end;
   340 
   340 
   341 procedure InitTeams;
   341 procedure InitTeams;
   342 var i, t: LongInt;
   342 var i, t: LongInt;
   343     th: LongInt;
   343     th, h: LongInt;
   344 begin
   344 begin
   345 
   345 
   346 for t:= 0 to Pred(TeamsCount) do
   346 for t:= 0 to Pred(TeamsCount) do
   347    with TeamsArray[t]^ do
   347    with TeamsArray[t]^ do
   348       begin
   348       begin
   349       if (not ExtDriven) and (Hedgehogs[0].BotLevel = 0) then
   349       if (not ExtDriven) and (Hedgehogs[0].BotLevel = 0) then
   350           LocalClan:= Clan^.ClanIndex + 1;
   350           LocalClan:= Clan^.ClanIndex + 1;
   351       th:= 0;
   351       th:= 0;
       
   352       for i:= 0 to cMaxHHIndex do
       
   353           if Hedgehogs[i].Gear <> nil then
       
   354              inc(th, Hedgehogs[i].Gear^.Health);
       
   355       if th > MaxTeamHealth then MaxTeamHealth:= th;
   352       // Some initial King buffs
   356       // Some initial King buffs
   353       if (GameFlags and gfKing) <> 0 then
   357       if (GameFlags and gfKing) <> 0 then
   354           begin
   358           begin
   355           Hedgehogs[0].King:= true;
   359           Hedgehogs[0].King:= true;
   356           Hedgehogs[0].Hat:= 'crown';
   360           Hedgehogs[0].Hat:= 'crown';
   357           inc(Hedgehogs[0].Gear^.Health, hwRound(int2hwFloat(Hedgehogs[0].Gear^.Health)*_0_5))
   361           h:= Hedgehogs[0].Gear^.Health;
       
   362           Hedgehogs[0].Gear^.Health:= hwRound(int2hwFloat(th)*_0_375);
       
   363           dec(th, h);
       
   364           inc(th, Hedgehogs[0].Gear^.Health);
       
   365           if th > MaxTeamHealth then MaxTeamHealth:= th
   358           end;
   366           end;
   359       for i:= 0 to cMaxHHIndex do
       
   360           if Hedgehogs[i].Gear <> nil then
       
   361              inc(th, Hedgehogs[i].Gear^.Health);
       
   362       if th > MaxTeamHealth then MaxTeamHealth:= th;
       
   363       end;
   367       end;
   364 
   368 
   365 RecountAllTeamsHealth
   369 RecountAllTeamsHealth
   366 end;
   370 end;
   367 
   371