Fix hedgehogs/ticker ignoring kills without damage (#149)
authorWuzzy <almikes@aol.com>
Tue, 04 Apr 2017 21:17:02 +0200
changeset 12162 e837912ba85d
parent 12161 9755922396f5
child 12163 4d1250ca68ac
Fix hedgehogs/ticker ignoring kills without damage (#149)
hedgewars/uStats.pas
--- a/hedgewars/uStats.pas	Tue Apr 04 17:02:38 2017 +0200
+++ b/hedgewars/uStats.pas	Tue Apr 04 21:17:02 2017 +0200
@@ -109,9 +109,11 @@
     s:= ansistring(CurrentHedgehog^.Name);
     inc(CurrentHedgehog^.stats.FinishedTurns);
 
-    if (CurrentHedgehog^.stats.DamageGiven = DamageTotal) and (DamageTotal > 0) then
+    // First blood (first damage or kill)
+    if ((DamageTotal > 0) or (KillsTotal > 0)) and ((CurrentHedgehog^.stats.DamageGiven = DamageTotal) and (CurrentHedgehog^.stats.StepKills = KillsTotal)) then
         AddVoice(sndFirstBlood, CurrentTeam^.voicepack)
 
+    // Hog hurts itself only
     else if CurrentHedgehog^.stats.StepDamageRecv > 0 then
         begin
         AddVoice(sndStupid, PreviousTeam^.voicepack);
@@ -119,8 +121,9 @@
             AddCaption(FormatA(GetEventString(eidHurtSelf), s), cWhiteColor, capgrpMessage);
         end
 
-    else if DamageClan <> 0 then
-        if DamageTurn > DamageClan then
+    // Hog hurts own team/clan
+    else if (DamageClan <> 0) or (KillsClan <> 0) then
+        if (DamageTurn > DamageClan) or (Kills > KillsClan) then
             if random(2) = 0 then
                 AddVoice(sndNutter, CurrentTeam^.voicepack)
             else
@@ -131,16 +134,22 @@
             else
                 AddVoice(sndTraitor, vpHurtSameClan)
 
-    else if CurrentHedgehog^.stats.StepDamageGiven <> 0 then
+    // Hog hurts or kills enemy
+    else if (CurrentHedgehog^.stats.StepDamageGiven <> 0) or (CurrentHedgehog^.stats.StepKills <> 0) then
         if Kills > 0 then
             AddVoice(sndEnemyDown, CurrentTeam^.voicepack)
         else
             AddVoice(sndRegret, vpHurtEnemy)
 
-    else if AmmoDamagingUsed then
+    // Missed shot
+    else if AmmoDamagingUsed and (Kills = 0) then
         AddVoice(sndMissed, PreviousTeam^.voicepack)
+
+    // Timeout
     else if (AmmoUsedCount > 0) and (not isTurnSkipped) then
         begin end// nothing ?
+
+    // Turn skipped
     else if isTurnSkipped and (not PlacingHogs) then
         begin
         AddVoice(sndCoward, PreviousTeam^.voicepack);