hedgewars/uStats.pas
changeset 1054 80225c6af656
parent 874 964c0d5b3604
child 1058 c53c5c4e7b48
equal deleted inserted replaced
1053:5dae89b2872d 1054:80225c6af656
    36 procedure HedgehogDamaged(Gear: PGear);
    36 procedure HedgehogDamaged(Gear: PGear);
    37 procedure Skipped;
    37 procedure Skipped;
    38 procedure TurnReaction;
    38 procedure TurnReaction;
    39 procedure SendStats;
    39 procedure SendStats;
    40 
    40 
       
    41 var FinishedTurnsTotal: LongInt = -1;
       
    42 
    41 implementation
    43 implementation
    42 uses uTeams, uSound, uMisc;
    44 uses uTeams, uSound, uMisc;
    43 var DamageGiven : Longword = 0;
    45 var DamageGiven : Longword = 0;
    44     DamageClan  : Longword = 0;
    46     DamageClan  : Longword = 0;
    45     DamageTotal : Longword = 0;
    47     DamageTotal : Longword = 0;
    46     KillsClan   : LongWord = 0;
    48     KillsClan   : LongWord = 0;
    47     Kills       : LongWord = 0;
    49     Kills       : LongWord = 0;
    48     KillsTotal  : LongWord = 0;
    50     KillsTotal  : LongWord = 0;
    49     AmmoUsedCount : Longword = 0;
    51     AmmoUsedCount : Longword = 0;
    50     AmmoDamagingUsed : boolean = false;
    52     AmmoDamagingUsed : boolean = false;
    51     FinishedTurnsTotal: LongInt = -1;
       
    52     SkippedTurns: LongWord = 0;
    53     SkippedTurns: LongWord = 0;
    53     isTurnSkipped: boolean = false;
    54     isTurnSkipped: boolean = false;
    54 
    55 
    55 procedure HedgehogDamaged(Gear: PGear);
    56 procedure HedgehogDamaged(Gear: PGear);
    56 begin
    57 begin
       
    58 if bBetweenTurns then exit;
       
    59 
    57 if Gear <> CurrentHedgehog^.Gear then
    60 if Gear <> CurrentHedgehog^.Gear then
    58 	inc(CurrentHedgehog^.stats.StepDamageGiven, Gear^.Damage);
    61 	inc(CurrentHedgehog^.stats.StepDamageGiven, Gear^.Damage);
    59 
    62 
    60 if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(DamageClan, Gear^.Damage);
    63 if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(DamageClan, Gear^.Damage);
    61 
    64 
    79 end;
    82 end;
    80 
    83 
    81 procedure TurnReaction;
    84 procedure TurnReaction;
    82 var i, t: LongInt;
    85 var i, t: LongInt;
    83 begin
    86 begin
       
    87 TryDo(not bBetweenTurns, 'Engine bug: TurnReaction between turns', true);
       
    88 
    84 inc(FinishedTurnsTotal);
    89 inc(FinishedTurnsTotal);
    85 if FinishedTurnsTotal = 0 then exit;
    90 if FinishedTurnsTotal = 0 then exit;
    86 
    91 
    87 inc(CurrentHedgehog^.stats.FinishedTurns);
    92 inc(CurrentHedgehog^.stats.FinishedTurns);
    88 
    93 
   110 	else
   115 	else
   111 		PlaySound(sndRegret, false)
   116 		PlaySound(sndRegret, false)
   112 
   117 
   113 else if AmmoDamagingUsed then
   118 else if AmmoDamagingUsed then
   114 	PlaySound(sndMissed, false)
   119 	PlaySound(sndMissed, false)
   115 else if AmmoUsedCount > 0 then
   120 else if (AmmoUsedCount > 0) and not isTurnSkipped then
   116 	// nothing ?
   121 	// nothing ?
   117 else if isTurnSkipped then
   122 else if isTurnSkipped then
   118 	PlaySound(sndBoring, false)
   123 	PlaySound(sndBoring, false)
   119 else
   124 else
   120 	PlaySound(sndCoward, false);
   125 	PlaySound(sndCoward, false);