hedgewars/uStats.pas
changeset 5202 45a16280d68d
parent 5142 cb822f8d52ff
child 5203 b77f28facca6
equal deleted inserted replaced
5201:7b9aa7aac336 5202:45a16280d68d
    27 
    27 
    28 procedure initModule;
    28 procedure initModule;
    29 procedure freeModule;
    29 procedure freeModule;
    30 
    30 
    31 procedure AmmoUsed(am: TAmmoType);
    31 procedure AmmoUsed(am: TAmmoType);
    32 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog);
    32 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean);
    33 procedure Skipped;
    33 procedure Skipped;
    34 procedure TurnReaction;
    34 procedure TurnReaction;
    35 procedure SendStats;
    35 procedure SendStats;
    36 
    36 
    37 implementation
    37 implementation
    48     SkippedTurns: LongWord = 0;
    48     SkippedTurns: LongWord = 0;
    49     isTurnSkipped: boolean = false;
    49     isTurnSkipped: boolean = false;
    50     vpHurtSameClan: PVoicepack = nil;
    50     vpHurtSameClan: PVoicepack = nil;
    51     vpHurtEnemy: PVoicepack = nil;
    51     vpHurtEnemy: PVoicepack = nil;
    52 
    52 
    53 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog);
    53 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean);
    54 begin
    54 begin
    55 if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then
    55 if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then
    56     vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack
    56     vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack
    57 else
    57 else
    58     vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
    58     vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
    59 
    59 
    60 //////////////////////////
    60 //////////////////////////
    61 
    61 
    62 if Gear <> Attacker^.Gear then
    62 if Gear <> Attacker^.Gear then
    63     inc(Attacker^.stats.StepDamageGiven, Gear^.Damage);
    63     inc(Attacker^.stats.StepDamageGiven, Damage);
    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, Damage);
    66 
    66 
    67 if Gear^.Health <= Gear^.Damage then
    67 if killed then
    68     begin
    68     begin
    69     inc(Attacker^.stats.StepKills);
    69     inc(Attacker^.stats.StepKills);
    70     inc(Kills);
    70     inc(Kills);
    71     inc(KillsTotal);
    71     inc(KillsTotal);
    72     inc(Attacker^.Team^.stats.Kills);
    72     inc(Attacker^.Team^.stats.Kills);
    73     if (Attacker^.Team^.TeamName =
    73     if (Attacker^.Team^.TeamName =
    74             Gear^.Hedgehog^.Team^.TeamName) then begin
    74             Gear^.Hedgehog^.Team^.TeamName) then begin
    75         inc(Attacker^.Team^.stats.TeamKills);
    75         inc(Attacker^.Team^.stats.TeamKills);
    76         inc(Attacker^.Team^.stats.TeamDamage, Gear^.Damage);
    76         inc(Attacker^.Team^.stats.TeamDamage, Gear^.Damage);
    77     end;
    77     end;
       
    78     if Gear = Attacker^.Gear then inc(Attacker^.Team^.stats.Suicides);
    78     if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(KillsClan);
    79     if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(KillsClan);
    79     end;
    80     end;
    80 
    81 
    81 inc(Gear^.Hedgehog^.stats.StepDamageRecv, Gear^.Damage);
    82 inc(Gear^.Hedgehog^.stats.StepDamageRecv, Damage);
    82 inc(DamageGiven, Gear^.Damage);
    83 inc(DamageGiven, Damage);
    83 inc(DamageTotal, Gear^.Damage)
    84 inc(DamageTotal, Damage)
    84 end;
    85 end;
    85 
    86 
    86 procedure Skipped;
    87 procedure Skipped;
    87 begin
    88 begin
    88 inc(SkippedTurns);
    89 inc(SkippedTurns);