hedgewars/uStats.pas
changeset 871 f1bf00b7fd5a
parent 870 dd418d9c18c5
child 873 9bec5af9b23c
equal deleted inserted replaced
870:dd418d9c18c5 871:f1bf00b7fd5a
    32                    FinishedTurns: Longword;
    32                    FinishedTurns: Longword;
    33                    end;
    33                    end;
    34 
    34 
    35 procedure AmmoUsed(am: TAmmoType);
    35 procedure AmmoUsed(am: TAmmoType);
    36 procedure HedgehogDamaged(Gear: PGear);
    36 procedure HedgehogDamaged(Gear: PGear);
       
    37 procedure Skipped;
    37 procedure TurnReaction;
    38 procedure TurnReaction;
    38 procedure SendStats;
    39 procedure SendStats;
    39 
    40 
    40 implementation
    41 implementation
    41 uses uTeams, uSound, uMisc;
    42 uses uTeams, uSound, uMisc;
    46     Kills       : LongWord = 0;
    47     Kills       : LongWord = 0;
    47     KillsTotal  : LongWord = 0;
    48     KillsTotal  : LongWord = 0;
    48     AmmoUsedCount : Longword = 0;
    49     AmmoUsedCount : Longword = 0;
    49     AmmoDamagingUsed : boolean = false;
    50     AmmoDamagingUsed : boolean = false;
    50     FinishedTurnsTotal: LongInt = -1;
    51     FinishedTurnsTotal: LongInt = -1;
       
    52     SkippedTurns: LongWord = 0;
       
    53     isTurnSkipped: boolean = false;
    51 
    54 
    52 procedure HedgehogDamaged(Gear: PGear);
    55 procedure HedgehogDamaged(Gear: PGear);
    53 begin
    56 begin
    54 if Gear <> CurrentHedgehog^.Gear then
    57 if Gear <> CurrentHedgehog^.Gear then
    55 	inc(CurrentHedgehog^.stats.StepDamageGiven, Gear^.Damage);
    58 	inc(CurrentHedgehog^.stats.StepDamageGiven, Gear^.Damage);
    65 	end;
    68 	end;
    66 
    69 
    67 inc(PHedgehog(Gear^.Hedgehog)^.stats.StepDamageRecv, Gear^.Damage);
    70 inc(PHedgehog(Gear^.Hedgehog)^.stats.StepDamageRecv, Gear^.Damage);
    68 inc(DamageGiven, Gear^.Damage);
    71 inc(DamageGiven, Gear^.Damage);
    69 inc(DamageTotal, Gear^.Damage)
    72 inc(DamageTotal, Gear^.Damage)
       
    73 end;
       
    74 
       
    75 procedure Skipped;
       
    76 begin
       
    77 inc(SkippedTurns);
       
    78 isTurnSkipped:= true
    70 end;
    79 end;
    71 
    80 
    72 procedure TurnReaction;
    81 procedure TurnReaction;
    73 var Gear: PGear;
    82 var Gear: PGear;
    74     i, t: LongInt;
    83     i, t: LongInt;
   101 
   110 
   102 else if AmmoDamagingUsed then
   111 else if AmmoDamagingUsed then
   103 	PlaySound(sndMissed, false)
   112 	PlaySound(sndMissed, false)
   104 else if AmmoUsedCount > 0 then
   113 else if AmmoUsedCount > 0 then
   105 	// nothing ?
   114 	// nothing ?
       
   115 else if isTurnSkipped then
       
   116 	PlaySound(sndBoring, false)
   106 else
   117 else
   107 	PlaySound(sndCoward, false);
   118 	PlaySound(sndCoward, false);
   108 
   119 
   109 
   120 
   110 for t:= 0 to Pred(TeamsCount) do
   121 for t:= 0 to Pred(TeamsCount) do
   115 				inc(DamageRecv, StepDamageRecv);
   126 				inc(DamageRecv, StepDamageRecv);
   116 				inc(DamageGiven, StepDamageGiven);
   127 				inc(DamageGiven, StepDamageGiven);
   117 				if StepDamageRecv > MaxStepDamageRecv then MaxStepDamageRecv:= StepDamageRecv;
   128 				if StepDamageRecv > MaxStepDamageRecv then MaxStepDamageRecv:= StepDamageRecv;
   118 				if StepDamageGiven > MaxStepDamageGiven then MaxStepDamageGiven:= StepDamageGiven;
   129 				if StepDamageGiven > MaxStepDamageGiven then MaxStepDamageGiven:= StepDamageGiven;
   119 				if StepKills > MaxStepKills then MaxStepKills:= StepKills;
   130 				if StepKills > MaxStepKills then MaxStepKills:= StepKills;
       
   131 				StepKills:= 0;
   120 				StepDamageRecv:= 0;
   132 				StepDamageRecv:= 0;
   121 				StepDamageGiven:= 0
   133 				StepDamageGiven:= 0
   122 				end;
   134 				end;
   123 
   135 
   124 Kills:= 0;
   136 Kills:= 0;
   125 KillsClan:= 0;
   137 KillsClan:= 0;
   126 DamageGiven:= 0;
   138 DamageGiven:= 0;
   127 DamageClan:= 0;
   139 DamageClan:= 0;
   128 AmmoUsedCount:= 0;
   140 AmmoUsedCount:= 0;
   129 AmmoDamagingUsed:= false
   141 AmmoDamagingUsed:= false;
       
   142 isTurnSkipped:= false
   130 end;
   143 end;
   131 
   144 
   132 procedure AmmoUsed(am: TAmmoType);
   145 procedure AmmoUsed(am: TAmmoType);
   133 begin
   146 begin
   134 inc(AmmoUsedCount);
   147 inc(AmmoUsedCount);