hedgewars/uStats.pas
changeset 13761 6fd56a26e8b8
parent 13758 b1177e9c9ee9
child 13765 3d2a7c563d8e
equal deleted inserted replaced
13760:72a8c0d63d80 13761:6fd56a26e8b8
    40 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean);
    40 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean);
    41 procedure TargetHit;
    41 procedure TargetHit;
    42 procedure Skipped;
    42 procedure Skipped;
    43 procedure TurnStats;
    43 procedure TurnStats;
    44 procedure TurnReaction;
    44 procedure TurnReaction;
       
    45 procedure TurnStatsReset;
    45 procedure SendStats;
    46 procedure SendStats;
    46 procedure hedgehogFlight(Gear: PGear; time: Longword);
    47 procedure hedgehogFlight(Gear: PGear; time: Longword);
    47 procedure declareAchievement(id, teamname, location: shortstring; value: LongInt);
    48 procedure declareAchievement(id, teamname, location: shortstring; value: LongInt);
    48 procedure startGhostPoints(n: LongInt);
    49 procedure startGhostPoints(n: LongInt);
    49 procedure dumpPoint(x, y: LongInt);
    50 procedure dumpPoint(x, y: LongInt);
   155                     MaxStepDamageRecv:= StepDamageRecv;
   156                     MaxStepDamageRecv:= StepDamageRecv;
   156                 if StepDamageGiven > MaxStepDamageGiven then
   157                 if StepDamageGiven > MaxStepDamageGiven then
   157                     MaxStepDamageGiven:= StepDamageGiven;
   158                     MaxStepDamageGiven:= StepDamageGiven;
   158                 if StepKills > MaxStepKills then
   159                 if StepKills > MaxStepKills then
   159                     MaxStepKills:= StepKills;
   160                     MaxStepKills:= StepKills;
   160                 StepKills:= 0;
       
   161                 StepDamageRecv:= 0;
       
   162                 StepDamageGiven:= 0;
       
   163                 StepPoisoned:= false;
       
   164                 StepDied:= false;
       
   165                 end;
   161                 end;
   166 
   162 
   167 // Write into the death log which clans died in this turn,
   163 // Write into the death log which clans died in this turn,
   168 // important for final rankings.
   164 // important for final rankings.
   169 c:= 0;
   165 c:= 0;
   196         newEntry^.NextEntry:= ClanDeathLog;
   192         newEntry^.NextEntry:= ClanDeathLog;
   197         end;
   193         end;
   198     ClanDeathLog:= newEntry;
   194     ClanDeathLog:= newEntry;
   199     end;
   195     end;
   200 
   196 
   201 Kills:= 0;
       
   202 KillsClan:= 0;
       
   203 DamageClan:= 0;
       
   204 DamageTurn:= 0;
       
   205 HitTargets:= 0;
       
   206 PoisonClan:= 0;
       
   207 PoisonTurn:= 0;
       
   208 AmmoUsedCount:= 0;
       
   209 AmmoDamagingUsed:= false;
       
   210 isTurnSkipped:= false;
       
   211 end;
   197 end;
   212 
   198 
   213 procedure TurnReaction;
   199 procedure TurnReaction;
   214 var killsCheck: LongInt;
   200 var killsCheck: LongInt;
   215     s: ansistring;
   201     s: ansistring;
   280         begin
   266         begin
   281         AddVoice(sndCoward, PreviousTeam^.voicepack);
   267         AddVoice(sndCoward, PreviousTeam^.voicepack);
   282         AddCaption(FormatA(GetEventString(eidTurnSkipped), s), capcolDefault, capgrpMessage);
   268         AddCaption(FormatA(GetEventString(eidTurnSkipped), s), capcolDefault, capgrpMessage);
   283         end
   269         end
   284     end;
   270     end;
       
   271 end;
       
   272 
       
   273 procedure TurnStatsReset;
       
   274 var t, i: LongInt;
       
   275 begin
       
   276 for t:= 0 to Pred(TeamsCount) do // send even on zero turn
       
   277     with TeamsArray[t]^ do
       
   278         for i:= 0 to cMaxHHIndex do
       
   279             with Hedgehogs[i].stats do
       
   280                 begin
       
   281                 StepKills:= 0;
       
   282                 StepDamageRecv:= 0;
       
   283                 StepDamageGiven:= 0;
       
   284                 StepPoisoned:= false;
       
   285                 StepDied:= false;
       
   286                 end;
       
   287 
       
   288 Kills:= 0;
       
   289 KillsClan:= 0;
       
   290 DamageClan:= 0;
       
   291 DamageTurn:= 0;
       
   292 HitTargets:= 0;
       
   293 PoisonClan:= 0;
       
   294 PoisonTurn:= 0;
       
   295 AmmoUsedCount:= 0;
       
   296 AmmoDamagingUsed:= false;
       
   297 isTurnSkipped:= false;
   285 end;
   298 end;
   286 
   299 
   287 procedure AmmoUsed(am: TAmmoType);
   300 procedure AmmoUsed(am: TAmmoType);
   288 begin
   301 begin
   289 inc(AmmoUsedCount);
   302 inc(AmmoUsedCount);