hedgewars/uTeams.pas
changeset 4101 c5967f360beb
parent 4099 af612377fcba
child 4102 96efb3bbf8e3
equal deleted inserted replaced
4100:a16295685c53 4101:c5967f360beb
    45             visStepPos: LongWord;
    45             visStepPos: LongWord;
    46             BotLevel  : Byte; // 0 - Human player
    46             BotLevel  : Byte; // 0 - Human player
    47             HatVisibility: GLfloat;
    47             HatVisibility: GLfloat;
    48             stats: TStatistics;
    48             stats: TStatistics;
    49             Hat: shortstring;
    49             Hat: shortstring;
    50             InitialHealth: Byte; // used for gfResetHealth
    50             InitialHealth: LongInt; // used for gfResetHealth
    51             King: boolean;  // Flag for a bunch of hedgehog attributes
    51             King: boolean;  // Flag for a bunch of hedgehog attributes
    52             Unplaced: boolean;  // Flag for hog placing mode
    52             Unplaced: boolean;  // Flag for hog placing mode
    53             Timer: Longword;
    53             Timer: Longword;
    54             Effects: Array[THogEffect] of boolean;
    54             Effects: Array[THogEffect] of boolean;
    55             end;
    55             end;
   369 var i, t: LongInt;
   369 var i, t: LongInt;
   370     th, h: LongInt;
   370     th, h: LongInt;
   371 begin
   371 begin
   372 
   372 
   373 for t:= 0 to Pred(TeamsCount) do
   373 for t:= 0 to Pred(TeamsCount) do
   374    with TeamsArray[t]^ do
   374     with TeamsArray[t]^ do
   375       begin
   375         begin
   376       if (not ExtDriven) and (Hedgehogs[0].BotLevel = 0) then
   376         if (not ExtDriven) and (Hedgehogs[0].BotLevel = 0) then
   377           begin
   377             begin
   378           LocalClan:= Clan^.ClanIndex;
   378             LocalClan:= Clan^.ClanIndex;
   379           LocalAmmo:= Hedgehogs[0].AmmoStore
   379             LocalAmmo:= Hedgehogs[0].AmmoStore
   380           end;
   380             end;
   381       th:= 0;
   381         th:= 0;
   382       for i:= 0 to cMaxHHIndex do
   382         for i:= 0 to cMaxHHIndex do
   383           if Hedgehogs[i].Gear <> nil then
   383             if Hedgehogs[i].Gear <> nil then
   384              inc(th, Hedgehogs[i].Gear^.Health);
   384                inc(th, Hedgehogs[i].Gear^.Health);
   385       if th > MaxTeamHealth then MaxTeamHealth:= th;
   385         if th > MaxTeamHealth then MaxTeamHealth:= th;
   386       // Some initial King buffs
   386         // Some initial King buffs
   387       if (GameFlags and gfKing) <> 0 then
   387         if (GameFlags and gfKing) <> 0 then
   388           begin
   388             begin
   389           Hedgehogs[0].King:= true;
   389             Hedgehogs[0].King:= true;
   390           Hedgehogs[0].Hat:= 'crown';
   390             Hedgehogs[0].Hat:= 'crown';
   391           Hedgehogs[0].Effects[hePoisoned] := false;
   391             Hedgehogs[0].Effects[hePoisoned] := false;
   392           h:= Hedgehogs[0].Gear^.Health;
   392             h:= Hedgehogs[0].Gear^.Health;
   393           Hedgehogs[0].Gear^.Health:= hwRound(int2hwFloat(th)*_0_375);
   393             Hedgehogs[0].Gear^.Health:= hwRound(int2hwFloat(th)*_0_375);
   394           if Hedgehogs[0].Gear^.Health > h then
   394             if Hedgehogs[0].Gear^.Health > h then
   395               begin
   395                 begin
   396               dec(th, h);
   396                 dec(th, h);
   397               inc(th, Hedgehogs[0].Gear^.Health);
   397                 inc(th, Hedgehogs[0].Gear^.Health);
   398               if th > MaxTeamHealth then MaxTeamHealth:= th
   398                 if th > MaxTeamHealth then MaxTeamHealth:= th
   399               end
   399                 end
   400           else Hedgehogs[0].Gear^.Health:= h
   400             else Hedgehogs[0].Gear^.Health:= h
   401           end;
   401             Hedgehogs[0].InitialHealth:= Hedgehogs[0].Gear^.Health;
   402       end;
   402             end;
       
   403         end;
   403 
   404 
   404 RecountAllTeamsHealth
   405 RecountAllTeamsHealth
   405 end;
   406 end;
   406 
   407 
   407 function  TeamSize(p: PTeam): Longword;
   408 function  TeamSize(p: PTeam): Longword;