hedgewars/uStats.pas
changeset 5142 cb822f8d52ff
parent 4976 088d40d8aba2
child 5202 45a16280d68d
equal deleted inserted replaced
5141:2fb6555011d3 5142:cb822f8d52ff
    64 
    64 
    65 if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(DamageClan, Gear^.Damage);
    65 if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(DamageClan, Gear^.Damage);
    66 
    66 
    67 if Gear^.Health <= Gear^.Damage then
    67 if Gear^.Health <= Gear^.Damage then
    68     begin
    68     begin
    69     inc(CurrentHedgehog^.stats.StepKills);
    69     inc(Attacker^.stats.StepKills);
    70     inc(Kills);
    70     inc(Kills);
    71     inc(KillsTotal);
    71     inc(KillsTotal);
    72     inc(CurrentHedgehog^.Team^.stats.Kills);
    72     inc(Attacker^.Team^.stats.Kills);
    73     if (CurrentHedgehog^.Team^.TeamName =
    73     if (Attacker^.Team^.TeamName =
    74             Gear^.Hedgehog^.Team^.TeamName) then begin
    74             Gear^.Hedgehog^.Team^.TeamName) then begin
    75         inc(CurrentHedgehog^.Team^.stats.TeamKills);
    75         inc(Attacker^.Team^.stats.TeamKills);
    76         inc(CurrentHedgehog^.Team^.stats.TeamDamage, Gear^.Damage);
    76         inc(Attacker^.Team^.stats.TeamDamage, Gear^.Damage);
    77     end;
    77     end;
    78     if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(KillsClan);
    78     if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(KillsClan);
    79     end;
    79     end;
    80 
    80 
    81 inc(Gear^.Hedgehog^.stats.StepDamageRecv, Gear^.Damage);
    81 inc(Gear^.Hedgehog^.stats.StepDamageRecv, Gear^.Damage);
    82 inc(DamageGiven, Gear^.Damage);
    82 inc(DamageGiven, Gear^.Damage);
    83 inc(DamageTotal, Gear^.Damage)
    83 inc(DamageTotal, Gear^.Damage)
   182     maxTeamKillsName : shortstring;
   182     maxTeamKillsName : shortstring;
   183     maxTurnSkips : Longword;
   183     maxTurnSkips : Longword;
   184     maxTurnSkipsName : shortstring;
   184     maxTurnSkipsName : shortstring;
   185     maxTeamDamage : Longword;
   185     maxTeamDamage : Longword;
   186     maxTeamDamageName : shortstring;
   186     maxTeamDamageName : shortstring;
       
   187     winnersClan : PClan;
   187 begin
   188 begin
   188 msd:= 0; msdhh:= nil;
   189 msd:= 0; msdhh:= nil;
   189 msk:= 0; mskhh:= nil;
   190 msk:= 0; mskhh:= nil;
   190 mskcnt:= 0;
   191 mskcnt:= 0;
   191 maxTeamKills := 0;
   192 maxTeamKills := 0;
   192 maxTurnSkips := 0;
   193 maxTurnSkips := 0;
   193 maxTeamDamage := 0;
   194 maxTeamDamage := 0;
       
   195 winnersClan:= nil;
   194 
   196 
   195 for t:= 0 to Pred(TeamsCount) do
   197 for t:= 0 to Pred(TeamsCount) do
   196     with TeamsArray[t]^ do
   198     with TeamsArray[t]^ do
   197     begin
   199     begin
   198         if not ExtDriven then
   200         if not ExtDriven then
   214                     end;
   216                     end;
   215         end;
   217         end;
   216 
   218 
   217         { send player stats for winner teams }
   219         { send player stats for winner teams }
   218         if Clan^.ClanHealth > 0 then begin
   220         if Clan^.ClanHealth > 0 then begin
       
   221             winnersClan:= Clan;
   219             SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' +
   222             SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' +
   220                 IntToStr(stats.Kills) + ' ' + TeamName);
   223                 IntToStr(stats.Kills) + ' ' + TeamName);
   221         end;
   224         end;
   222 
   225 
   223         { determine maximum values of TeamKills, TurnSkips, TeamDamage }
   226         { determine maximum values of TeamKills, TurnSkips, TeamDamage }
   257     SendStat(siMaxTurnSkips, IntToStr(maxTurnSkips) + ' ' + maxTurnSkipsName);
   260     SendStat(siMaxTurnSkips, IntToStr(maxTurnSkips) + ' ' + maxTurnSkipsName);
   258 if maxTeamDamage > 30 then
   261 if maxTeamDamage > 30 then
   259     SendStat(siMaxTeamDamage, IntToStr(maxTeamDamage) + ' ' + maxTeamDamageName);
   262     SendStat(siMaxTeamDamage, IntToStr(maxTeamDamage) + ' ' + maxTeamDamageName);
   260 
   263 
   261 if KilledHHs > 0 then SendStat(siKilledHHs, IntToStr(KilledHHs));
   264 if KilledHHs > 0 then SendStat(siKilledHHs, IntToStr(KilledHHs));
       
   265 
       
   266 // now to console
       
   267 if winnersClan <> nil then 
       
   268     begin
       
   269     writeln('WINNERS');
       
   270     for t:= 0 to winnersClan^.TeamsNumber - 1 do
       
   271         writeln(winnersClan^.Teams[t]^.TeamName);
       
   272     writeln;
       
   273     end else
       
   274     writeln('DRAW');
   262 end;
   275 end;
   263 
   276 
   264 procedure initModule;
   277 procedure initModule;
   265 begin
   278 begin
   266     TotalRounds:= -1;
   279     TotalRounds:= -1;