hedgewars/uStats.pas
changeset 5203 b77f28facca6
parent 5202 45a16280d68d
child 5638 e35ba2a400d8
equal deleted inserted replaced
5202:45a16280d68d 5203:b77f28facca6
    35 procedure SendStats;
    35 procedure SendStats;
    36 
    36 
    37 implementation
    37 implementation
    38 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uDebug, uMisc;
    38 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uDebug, uMisc;
    39 
    39 
    40 var DamageGiven : Longword = 0;
    40 var DamageClan  : Longword = 0;
    41     DamageClan  : Longword = 0;
       
    42     DamageTotal : Longword = 0;
    41     DamageTotal : Longword = 0;
    43     KillsClan   : LongWord = 0;
    42     KillsClan   : LongWord = 0;
    44     Kills       : LongWord = 0;
    43     Kills       : LongWord = 0;
    45     KillsTotal  : LongWord = 0;
    44     KillsTotal  : LongWord = 0;
    46     AmmoUsedCount : Longword = 0;
    45     AmmoUsedCount : Longword = 0;
    57 else
    56 else
    58     vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
    57     vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
    59 
    58 
    60 //////////////////////////
    59 //////////////////////////
    61 
    60 
    62 if Gear <> Attacker^.Gear then
    61 inc(Attacker^.stats.StepDamageGiven, Damage);
    63     inc(Attacker^.stats.StepDamageGiven, Damage);
    62 inc(Attacker^.stats.DamageGiven, Damage);
       
    63 inc(Gear^.Hedgehog^.stats.StepDamageRecv, Damage);
    64 
    64 
    65 if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(DamageClan, Damage);
    65 if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(DamageClan, Damage);
    66 
    66 
    67 if killed then
    67 if killed then
    68     begin
    68     begin
    77     end;
    77     end;
    78     if Gear = Attacker^.Gear then inc(Attacker^.Team^.stats.Suicides);
    78     if Gear = Attacker^.Gear then inc(Attacker^.Team^.stats.Suicides);
    79     if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(KillsClan);
    79     if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(KillsClan);
    80     end;
    80     end;
    81 
    81 
    82 inc(Gear^.Hedgehog^.stats.StepDamageRecv, Damage);
       
    83 inc(DamageGiven, Damage);
       
    84 inc(DamageTotal, Damage)
    82 inc(DamageTotal, Damage)
    85 end;
    83 end;
    86 
    84 
    87 procedure Skipped;
    85 procedure Skipped;
    88 begin
    86 begin
    98 inc(FinishedTurnsTotal);
    96 inc(FinishedTurnsTotal);
    99 if FinishedTurnsTotal <> 0 then
    97 if FinishedTurnsTotal <> 0 then
   100     begin
    98     begin
   101     inc(CurrentHedgehog^.stats.FinishedTurns);
    99     inc(CurrentHedgehog^.stats.FinishedTurns);
   102 
   100 
   103     if (DamageGiven = DamageTotal) and (DamageTotal > 0) then
   101     if (CurrentHedgehog^.stats.DamageGiven = DamageTotal) and (DamageTotal > 0) then
   104         PlaySound(sndFirstBlood, CurrentTeam^.voicepack)
   102         PlaySound(sndFirstBlood, CurrentTeam^.voicepack)
   105 
   103 
   106     else if CurrentHedgehog^.stats.StepDamageRecv > 0 then
   104     else if CurrentHedgehog^.stats.StepDamageRecv > 0 then
   107         begin
   105         begin
   108         PlaySound(sndStupid, PreviousTeam^.voicepack);
   106         PlaySound(sndStupid, PreviousTeam^.voicepack);
   109         if DamageGiven = CurrentHedgehog^.stats.StepDamageRecv then AddCaption(Format(GetEventString(eidHurtSelf), CurrentHedgehog^.Name), cWhiteColor, capgrpMessage);
   107         if CurrentHedgehog^.stats.DamageGiven = CurrentHedgehog^.stats.StepDamageRecv then 
       
   108             AddCaption(Format(GetEventString(eidHurtSelf), CurrentHedgehog^.Name), cWhiteColor, capgrpMessage);
   110         end
   109         end
       
   110 
   111     else if DamageClan <> 0 then
   111     else if DamageClan <> 0 then
   112         if DamageTotal > DamageClan then
   112         if DamageTotal > DamageClan then
   113             if random(2) = 0 then
   113             if random(2) = 0 then
   114                 PlaySound(sndNutter, CurrentTeam^.voicepack)
   114                 PlaySound(sndNutter, CurrentTeam^.voicepack)
   115             else
   115             else
   117         else
   117         else
   118             if random(2) = 0 then
   118             if random(2) = 0 then
   119                 PlaySound(sndSameTeam, vpHurtSameClan)
   119                 PlaySound(sndSameTeam, vpHurtSameClan)
   120             else
   120             else
   121                 PlaySound(sndTraitor, vpHurtSameClan)
   121                 PlaySound(sndTraitor, vpHurtSameClan)
   122     else if DamageGiven <> 0 then
   122 
       
   123     else if CurrentHedgehog^.stats.StepDamageGiven <> 0 then
   123         if Kills > 0 then
   124         if Kills > 0 then
   124             PlaySound(sndEnemyDown, CurrentTeam^.voicepack)
   125             PlaySound(sndEnemyDown, CurrentTeam^.voicepack)
   125         else
   126         else
   126             PlaySound(sndRegret, vpHurtEnemy)
   127             PlaySound(sndRegret, vpHurtEnemy)
   127 
   128 
   160         SendStat(siClanHealth, IntToStr(Color) + ' ' + IntToStr(ClanHealth));
   161         SendStat(siClanHealth, IntToStr(Color) + ' ' + IntToStr(ClanHealth));
   161         end;
   162         end;
   162 
   163 
   163 Kills:= 0;
   164 Kills:= 0;
   164 KillsClan:= 0;
   165 KillsClan:= 0;
   165 DamageGiven:= 0;
       
   166 DamageClan:= 0;
   166 DamageClan:= 0;
   167 AmmoUsedCount:= 0;
   167 AmmoUsedCount:= 0;
   168 AmmoDamagingUsed:= false;
   168 AmmoDamagingUsed:= false;
   169 isTurnSkipped:= false
   169 isTurnSkipped:= false
   170 end;
   170 end;