Don't play "LeaveMeAlone" taunt if attacker hits same hog multiple times in same turn
authorWuzzy <Wuzzy2@mail.ru>
Sun, 05 May 2019 16:57:37 +0200
changeset 14890 0ec83cc2365e
parent 14889 1f0e8a144bad
child 14891 3054b85963ef
Don't play "LeaveMeAlone" taunt if attacker hits same hog multiple times in same turn Because weapons like cluster bomb could trigger it in a single turn otherwise. The idea is the same hog must be hit across multiple turns.
hedgewars/uStats.pas
hedgewars/uTypes.pas
--- a/hedgewars/uStats.pas	Sun May 05 15:24:19 2019 +0200
+++ b/hedgewars/uStats.pas	Sun May 05 16:57:37 2019 +0200
@@ -110,7 +110,7 @@
     if (not killed) and (not bDuringWaterRise) then
         begin
         // Check if victim got attacked by RevengeHog again
-        if (Gear^.Hedgehog^.RevengeHog <> nil) and (Gear^.Hedgehog^.RevengeHog = Attacker) then
+        if (Gear^.Hedgehog^.RevengeHog <> nil) and (Gear^.Hedgehog^.RevengeHog = Attacker) and (Gear^.Hedgehog^.stats.StepRevenge = false) then
             LeaveMeAlone:= true;
         // Check if attacker got revenge
         if (Attacker^.RevengeHog <> nil) and (Attacker^.RevengeHog = Gear^.Hedgehog) then
@@ -122,7 +122,12 @@
             end
         // If not, victim remembers their attacker to plan *their* revenge
         else
+            begin
             Gear^.Hedgehog^.RevengeHog:= Attacker;
+            // To prevent "LeaveMeAlone" being activated if same hog is hit by attacker
+            // multiple times in the same turn.
+            Gear^.Hedgehog^.stats.StepRevenge:= true;
+            end;
         end
     end;
 
@@ -395,6 +400,7 @@
                 StepPoisoned:= false;
                 StepDied:= false;
                 GotRevenge:= false;
+                StepRevenge:= false;
                 end;
 
 Kills:= 0;
--- a/hedgewars/uTypes.pas	Sun May 05 15:24:19 2019 +0200
+++ b/hedgewars/uTypes.pas	Sun May 05 16:57:37 2019 +0200
@@ -345,6 +345,7 @@
         StepDied,                // whether hog died this turn
         Sacrificed,              // whether hog was sacrificed in suicide attack (kamikaze, piano)
         GotRevenge: boolean;     // whether hog got revenge in this turn
+        StepRevenge: boolean;    // whether hog's revenge mode was activated in this turn
         MaxStepDamageRecv,       // most damage received in one turn
         MaxStepDamageGiven,      // most damage dealt in one turn
         MaxStepKills: Longword;  // most kills in one turn