Play sndFirstBlood after first damage/kill/poisoning of enemy (instead of ANY damage)
authorWuzzy <Wuzzy2@mail.ru>
Sun, 05 May 2019 17:23:59 +0200
changeset 14886 3054b85963ef
parent 14885 0ec83cc2365e
child 14887 a414d37278df
Play sndFirstBlood after first damage/kill/poisoning of enemy (instead of ANY damage) This avoids sndFirstBlood being played for self-harm, for which this taunt is a bit odd.
ChangeLog.txt
hedgewars/uStats.pas
--- a/ChangeLog.txt	Sun May 05 16:57:37 2019 +0200
+++ b/ChangeLog.txt	Sun May 05 17:23:59 2019 +0200
@@ -101,6 +101,7 @@
 Sounds and voicepacks:
  + sndYoohoo has been split to sndYoohoo and sndKiss
  + Voice files sndPoisonCough and sndPoisonMoan are now optional (fall back to Default voicepack)
+ + Tweak some taunts: sndFirstBlood, sndLeaveMeAlone, sndCutItOut
 
 Lua API:
  + New call: SaveMissionVar(varname, value): Save value to mission variable (variable for non-campaign mission)
--- a/hedgewars/uStats.pas	Sun May 05 16:57:37 2019 +0200
+++ b/hedgewars/uStats.pas	Sun May 05 17:23:59 2019 +0200
@@ -55,7 +55,7 @@
 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uMisc, uConsole, uScript;
 
 var DamageClan  : Longword = 0;         // Damage of own clan in turn
-    DamageTeam  : Longword = 0;         // Damage of own team tin turn
+    DamageTeam  : Longword = 0;         // Damage of own team in turn
     DamageTotal : Longword = 0;         // Total damage dealt in game
     DamageTurn  : Longword = 0;         // Damage in turn
     PoisonTurn  : Longword = 0;         // Poisoned enemies in turn
@@ -71,6 +71,7 @@
     AmmoUsedCount : Longword = 0;       // Number of times an ammo has been used this turn
     AmmoDamagingUsed : boolean = false; // true if damaging ammo was used in turn
     FirstBlood  : boolean = false;      // true if the “First blood” taunt has been used in this game
+    StepFirstBlood : boolean = false;   // true if the “First blood” taunt is to be used this turn
     LeaveMeAlone : boolean = false;     // true if the “Leave me alone” taunt is to be used this turn
     SkippedTurns: LongWord = 0;         // number of skipped turns in game
     isTurnSkipped: boolean = false;     // true if this turn was skipped
@@ -88,6 +89,8 @@
         end
     else
         begin
+        if not FirstBlood then
+            StepFirstBlood:= true;
         vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
         inc(PoisonTurn)
         end;
@@ -106,6 +109,8 @@
     vpHurtSameClan:= Gear^.Hedgehog^.Team^.voicepack
 else
     begin
+    if not FirstBlood then
+        StepFirstBlood:= true;
     vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
     if (not killed) and (not bDuringWaterRise) then
         begin
@@ -274,8 +279,8 @@
     if (CurrentHedgehog^.stats.Sacrificed) then
         inc(killsCheck);
 
-    // First blood (first damage, poison or kill)
-    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
+    // First blood (first damage, poison or kill of enemy)
+    if (StepFirstBlood) and (not FirstBlood) and (ClansCount > 1) and ((DamageTotal > 0) or (KillsTotal > 0) or (PoisonTotal > 0)) then
         begin
         FirstBlood:= true;
         AddVoice(sndFirstBlood, CurrentTeam^.voicepack);
@@ -418,6 +423,7 @@
 LeaveMeAlone:= false;
 AmmoDamagingUsed:= false;
 isTurnSkipped:= false;
+StepFirstBlood:= false;
 end;
 
 procedure AmmoUsed(am: TAmmoType);
@@ -630,6 +636,7 @@
     AmmoUsedCount := 0;
     AmmoDamagingUsed := false;
     FirstBlood:= false;
+    StepFirstblood:= false;
     LeaveMeAlone := false;
     SkippedTurns:= 0;
     isTurnSkipped:= false;