hedgewars/uStats.pas
changeset 14891 3054b85963ef
parent 14890 0ec83cc2365e
child 14968 2d5f1dc637da
equal deleted inserted replaced
14890:0ec83cc2365e 14891:3054b85963ef
    53 
    53 
    54 implementation
    54 implementation
    55 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uMisc, uConsole, uScript;
    55 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uMisc, uConsole, uScript;
    56 
    56 
    57 var DamageClan  : Longword = 0;         // Damage of own clan in turn
    57 var DamageClan  : Longword = 0;         // Damage of own clan in turn
    58     DamageTeam  : Longword = 0;         // Damage of own team tin turn
    58     DamageTeam  : Longword = 0;         // Damage of own team in turn
    59     DamageTotal : Longword = 0;         // Total damage dealt in game
    59     DamageTotal : Longword = 0;         // Total damage dealt in game
    60     DamageTurn  : Longword = 0;         // Damage in turn
    60     DamageTurn  : Longword = 0;         // Damage in turn
    61     PoisonTurn  : Longword = 0;         // Poisoned enemies in turn
    61     PoisonTurn  : Longword = 0;         // Poisoned enemies in turn
    62     PoisonClan  : Longword = 0;         // Poisoned own clan members in turn
    62     PoisonClan  : Longword = 0;         // Poisoned own clan members in turn
    63     PoisonTeam  : Longword = 0;         // Poisoned own team members in turn
    63     PoisonTeam  : Longword = 0;         // Poisoned own team members in turn
    69     KillsTotal  : LongWord = 0;         // Total killed hedgehogs in game
    69     KillsTotal  : LongWord = 0;         // Total killed hedgehogs in game
    70     HitTargets  : LongWord = 0;         // Target (gtTarget) hits in turn
    70     HitTargets  : LongWord = 0;         // Target (gtTarget) hits in turn
    71     AmmoUsedCount : Longword = 0;       // Number of times an ammo has been used this turn
    71     AmmoUsedCount : Longword = 0;       // Number of times an ammo has been used this turn
    72     AmmoDamagingUsed : boolean = false; // true if damaging ammo was used in turn
    72     AmmoDamagingUsed : boolean = false; // true if damaging ammo was used in turn
    73     FirstBlood  : boolean = false;      // true if the “First blood” taunt has been used in this game
    73     FirstBlood  : boolean = false;      // true if the “First blood” taunt has been used in this game
       
    74     StepFirstBlood : boolean = false;   // true if the “First blood” taunt is to be used this turn
    74     LeaveMeAlone : boolean = false;     // true if the “Leave me alone” taunt is to be used this turn
    75     LeaveMeAlone : boolean = false;     // true if the “Leave me alone” taunt is to be used this turn
    75     SkippedTurns: LongWord = 0;         // number of skipped turns in game
    76     SkippedTurns: LongWord = 0;         // number of skipped turns in game
    76     isTurnSkipped: boolean = false;     // true if this turn was skipped
    77     isTurnSkipped: boolean = false;     // true if this turn was skipped
    77     vpHurtSameClan: PVoicepack = nil;   // voicepack of current clan (used for taunts)
    78     vpHurtSameClan: PVoicepack = nil;   // voicepack of current clan (used for taunts)
    78     vpHurtEnemy: PVoicepack = nil;      // voicepack of enemy (used for taunts)
    79     vpHurtEnemy: PVoicepack = nil;      // voicepack of enemy (used for taunts)
    86         if Attacker^.Team = Gear^.Hedgehog^.Team then
    87         if Attacker^.Team = Gear^.Hedgehog^.Team then
    87             inc(PoisonTeam);
    88             inc(PoisonTeam);
    88         end
    89         end
    89     else
    90     else
    90         begin
    91         begin
       
    92         if not FirstBlood then
       
    93             StepFirstBlood:= true;
    91         vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
    94         vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
    92         inc(PoisonTurn)
    95         inc(PoisonTurn)
    93         end;
    96         end;
    94     Gear^.Hedgehog^.stats.StepPoisoned:= true;
    97     Gear^.Hedgehog^.stats.StepPoisoned:= true;
    95     inc(PoisonTotal)
    98     inc(PoisonTotal)
   104 begin
   107 begin
   105 if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then
   108 if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then
   106     vpHurtSameClan:= Gear^.Hedgehog^.Team^.voicepack
   109     vpHurtSameClan:= Gear^.Hedgehog^.Team^.voicepack
   107 else
   110 else
   108     begin
   111     begin
       
   112     if not FirstBlood then
       
   113         StepFirstBlood:= true;
   109     vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
   114     vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
   110     if (not killed) and (not bDuringWaterRise) then
   115     if (not killed) and (not bDuringWaterRise) then
   111         begin
   116         begin
   112         // Check if victim got attacked by RevengeHog again
   117         // Check if victim got attacked by RevengeHog again
   113         if (Gear^.Hedgehog^.RevengeHog <> nil) and (Gear^.Hedgehog^.RevengeHog = Attacker) and (Gear^.Hedgehog^.stats.StepRevenge = false) then
   118         if (Gear^.Hedgehog^.RevengeHog <> nil) and (Gear^.Hedgehog^.RevengeHog = Attacker) and (Gear^.Hedgehog^.stats.StepRevenge = false) then
   272     killsCheck:= KillsSD;
   277     killsCheck:= KillsSD;
   273     // If the hog sacrificed (=kamikaze/piano) itself, this needs to be taken into account for the reactions later
   278     // If the hog sacrificed (=kamikaze/piano) itself, this needs to be taken into account for the reactions later
   274     if (CurrentHedgehog^.stats.Sacrificed) then
   279     if (CurrentHedgehog^.stats.Sacrificed) then
   275         inc(killsCheck);
   280         inc(killsCheck);
   276 
   281 
   277     // First blood (first damage, poison or kill)
   282     // First blood (first damage, poison or kill of enemy)
   278     if (not FirstBlood) and (ClansCount > 1) and ((DamageTotal > 0) or (KillsTotal > 0) or (PoisonTotal > 0)) and ((CurrentHedgehog^.stats.DamageGiven = DamageTotal) and (CurrentHedgehog^.stats.StepKills = KillsTotal) and (PoisonTotal = PoisonTurn + PoisonClan)) then
   283     if (StepFirstBlood) and (not FirstBlood) and (ClansCount > 1) and ((DamageTotal > 0) or (KillsTotal > 0) or (PoisonTotal > 0)) then
   279         begin
   284         begin
   280         FirstBlood:= true;
   285         FirstBlood:= true;
   281         AddVoice(sndFirstBlood, CurrentTeam^.voicepack);
   286         AddVoice(sndFirstBlood, CurrentTeam^.voicepack);
   282         end
   287         end
   283 
   288 
   416 PoisonTurn:= 0;
   421 PoisonTurn:= 0;
   417 AmmoUsedCount:= 0;
   422 AmmoUsedCount:= 0;
   418 LeaveMeAlone:= false;
   423 LeaveMeAlone:= false;
   419 AmmoDamagingUsed:= false;
   424 AmmoDamagingUsed:= false;
   420 isTurnSkipped:= false;
   425 isTurnSkipped:= false;
       
   426 StepFirstBlood:= false;
   421 end;
   427 end;
   422 
   428 
   423 procedure AmmoUsed(am: TAmmoType);
   429 procedure AmmoUsed(am: TAmmoType);
   424 begin
   430 begin
   425 inc(AmmoUsedCount);
   431 inc(AmmoUsedCount);
   628     KillsTotal  := 0;
   634     KillsTotal  := 0;
   629     HitTargets  := 0;
   635     HitTargets  := 0;
   630     AmmoUsedCount := 0;
   636     AmmoUsedCount := 0;
   631     AmmoDamagingUsed := false;
   637     AmmoDamagingUsed := false;
   632     FirstBlood:= false;
   638     FirstBlood:= false;
       
   639     StepFirstblood:= false;
   633     LeaveMeAlone := false;
   640     LeaveMeAlone := false;
   634     SkippedTurns:= 0;
   641     SkippedTurns:= 0;
   635     isTurnSkipped:= false;
   642     isTurnSkipped:= false;
   636     vpHurtSameClan:= nil;
   643     vpHurtSameClan:= nil;
   637     vpHurtEnemy:= nil;
   644     vpHurtEnemy:= nil;