hedgewars/uStats.pas
changeset 12568 494d3e1c4810
parent 12359 81ab841a0da5
child 12918 6deb29364723
equal deleted inserted replaced
12567:459543ef9b1b 12568:494d3e1c4810
    34 
    34 
    35 procedure AmmoUsed(am: TAmmoType);
    35 procedure AmmoUsed(am: TAmmoType);
    36 procedure HedgehogPoisoned(Gear: PGear; Attacker: PHedgehog);
    36 procedure HedgehogPoisoned(Gear: PGear; Attacker: PHedgehog);
    37 procedure HedgehogSacrificed(Hedgehog: PHedgehog);
    37 procedure HedgehogSacrificed(Hedgehog: PHedgehog);
    38 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean);
    38 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean);
       
    39 procedure TargetHit;
    39 procedure Skipped;
    40 procedure Skipped;
    40 procedure TurnReaction;
    41 procedure TurnReaction;
    41 procedure SendStats;
    42 procedure SendStats;
    42 procedure hedgehogFlight(Gear: PGear; time: Longword);
    43 procedure hedgehogFlight(Gear: PGear; time: Longword);
    43 procedure declareAchievement(id, teamname, location: shortstring; value: LongInt);
    44 procedure declareAchievement(id, teamname, location: shortstring; value: LongInt);
    54     PoisonClan  : Longword = 0; // Poisoned own clan members in turn
    55     PoisonClan  : Longword = 0; // Poisoned own clan members in turn
    55     PoisonTotal : Longword = 0; // Poisoned hogs in whole round
    56     PoisonTotal : Longword = 0; // Poisoned hogs in whole round
    56     KillsClan   : LongWord = 0;
    57     KillsClan   : LongWord = 0;
    57     Kills       : LongWord = 0;
    58     Kills       : LongWord = 0;
    58     KillsTotal  : LongWord = 0;
    59     KillsTotal  : LongWord = 0;
       
    60     HitTargets  : LongWord = 0; // Target (gtTarget) hits per turn
    59     AmmoUsedCount : Longword = 0;
    61     AmmoUsedCount : Longword = 0;
    60     AmmoDamagingUsed : boolean = false;
    62     AmmoDamagingUsed : boolean = false;
    61     SkippedTurns: LongWord = 0;
    63     SkippedTurns: LongWord = 0;
    62     isTurnSkipped: boolean = false;
    64     isTurnSkipped: boolean = false;
    63     vpHurtSameClan: PVoicepack = nil;
    65     vpHurtSameClan: PVoicepack = nil;
   117         inc(KillsClan);
   119         inc(KillsClan);
   118     end;
   120     end;
   119 
   121 
   120 inc(DamageTotal, Damage);
   122 inc(DamageTotal, Damage);
   121 inc(DamageTurn, Damage)
   123 inc(DamageTurn, Damage)
       
   124 end;
       
   125 
       
   126 procedure TargetHit();
       
   127 begin
       
   128    inc(HitTargets)
   122 end;
   129 end;
   123 
   130 
   124 procedure Skipped;
   131 procedure Skipped;
   125 begin
   132 begin
   126 inc(SkippedTurns);
   133 inc(SkippedTurns);
   177             AddVoice(sndEnemyDown, CurrentTeam^.voicepack)
   184             AddVoice(sndEnemyDown, CurrentTeam^.voicepack)
   178         else
   185         else
   179             AddVoice(sndRegret, vpHurtEnemy)
   186             AddVoice(sndRegret, vpHurtEnemy)
   180 
   187 
   181     // Missed shot
   188     // Missed shot
   182     else if AmmoDamagingUsed and (Kills <= killsCheck) and (PoisonTurn = 0) and (PoisonClan = 0) and (DamageTurn = 0) then
   189     // A miss is defined as a shot with a damaging weapon with 0 kills, 0 damage, 0 hogs poisoned and 0 targets hit
       
   190     else if AmmoDamagingUsed and (Kills <= killsCheck) and (PoisonTurn = 0) and (PoisonClan = 0) and (DamageTurn = 0) and (HitTargets = 0) then
   183         // Chance to call hedgehog stupid if sacrificed for nothing
   191         // Chance to call hedgehog stupid if sacrificed for nothing
   184         if CurrentHedgehog^.stats.Sacrificed then
   192         if CurrentHedgehog^.stats.Sacrificed then
   185             if random(2) = 0 then
   193             if random(2) = 0 then
   186                 AddVoice(sndMissed, PreviousTeam^.voicepack)
   194                 AddVoice(sndMissed, PreviousTeam^.voicepack)
   187             else
   195             else
   231 
   239 
   232 Kills:= 0;
   240 Kills:= 0;
   233 KillsClan:= 0;
   241 KillsClan:= 0;
   234 DamageClan:= 0;
   242 DamageClan:= 0;
   235 DamageTurn:= 0;
   243 DamageTurn:= 0;
       
   244 HitTargets:= 0;
   236 PoisonClan:= 0;
   245 PoisonClan:= 0;
   237 PoisonTurn:= 0;
   246 PoisonTurn:= 0;
   238 AmmoUsedCount:= 0;
   247 AmmoUsedCount:= 0;
   239 AmmoDamagingUsed:= false;
   248 AmmoDamagingUsed:= false;
   240 isTurnSkipped:= false
   249 isTurnSkipped:= false
   406     PoisonClan  := 0;
   415     PoisonClan  := 0;
   407     PoisonTurn  := 0;
   416     PoisonTurn  := 0;
   408     KillsClan   := 0;
   417     KillsClan   := 0;
   409     Kills       := 0;
   418     Kills       := 0;
   410     KillsTotal  := 0;
   419     KillsTotal  := 0;
       
   420     HitTargets  := 0;
   411     AmmoUsedCount := 0;
   421     AmmoUsedCount := 0;
   412     AmmoDamagingUsed := false;
   422     AmmoDamagingUsed := false;
   413     SkippedTurns:= 0;
   423     SkippedTurns:= 0;
   414     isTurnSkipped:= false;
   424     isTurnSkipped:= false;
   415     vpHurtSameClan:= nil;
   425     vpHurtSameClan:= nil;