Fix Traitor taunt being played when hog w/ heResurrectable drowns w/o damage
authorWuzzy <almikes@aol.com>
Wed, 26 Apr 2017 22:31:29 +0200
changeset 12343 6ff01dc1ffe2
parent 12342 ad09d733fdb0
child 12344 877f55c77a3f
Fix Traitor taunt being played when hog w/ heResurrectable drowns w/o damage
hedgewars/uStats.pas
hedgewars/uTypes.pas
--- a/hedgewars/uStats.pas	Wed Apr 26 19:38:34 2017 +0200
+++ b/hedgewars/uStats.pas	Wed Apr 26 22:31:29 2017 +0200
@@ -101,6 +101,7 @@
 
 if killed then
     begin
+    Gear^.Hedgehog^.stats.StepDied:= true;
     inc(Attacker^.stats.StepKills);
     inc(Kills);
     inc(KillsTotal);
@@ -144,12 +145,13 @@
     else
         killsCheck:= 0;
 
+    system.writeln(inttostr(CurrentHedgehog^.stats.StepDamageRecv));
     // First blood (first damage, poison or kill)
     if ((DamageTotal > 0) or (KillsTotal > 0) or (PoisonTotal > 0)) and ((CurrentHedgehog^.stats.DamageGiven = DamageTotal) and (CurrentHedgehog^.stats.StepKills = KillsTotal) and (PoisonTotal = PoisonTurn + PoisonClan)) then
         AddVoice(sndFirstBlood, CurrentTeam^.voicepack)
 
     // Hog hurts, poisons or kills itself (except sacrifice)
-    else if (CurrentHedgehog^.stats.Sacrificed = false) and ((CurrentHedgehog^.stats.StepDamageRecv > 0) or (CurrentHedgehog^.stats.StepPoisoned) or (CurrentHedgehog^.Gear = nil)) then
+    else if (CurrentHedgehog^.stats.Sacrificed = false) and ((CurrentHedgehog^.stats.StepDamageRecv > 0) or (CurrentHedgehog^.stats.StepPoisoned) or (CurrentHedgehog^.stats.StepDied)) then
         begin
         AddVoice(sndStupid, PreviousTeam^.voicepack);
         // Message for hurting itself only (not drowning)
@@ -218,6 +220,7 @@
                 StepDamageRecv:= 0;
                 StepDamageGiven:= 0;
                 StepPoisoned:= false;
+                StepDied:= false;
                 end;
 
 if SendHealthStatsOn then
--- a/hedgewars/uTypes.pas	Wed Apr 26 19:38:34 2017 +0200
+++ b/hedgewars/uTypes.pas	Wed Apr 26 22:31:29 2017 +0200
@@ -330,6 +330,7 @@
         StepDamageGiven,
         StepKills: Longword;
         StepPoisoned,
+        StepDied,
         Sacrificed: boolean;
         MaxStepDamageRecv,
         MaxStepDamageGiven,