Add taunts: Leavemealone, Cutitout (when attacked many times)
authorWuzzy <Wuzzy2@mail.ru>
Sun, 28 Oct 2018 04:21:13 +0100
changeset 14056 ecfd13128100
parent 14055 f9281c294a4c
child 14057 bf14c7c1be02
Add taunts: Leavemealone, Cutitout (when attacked many times)
ChangeLog.txt
hedgewars/uSound.pas
hedgewars/uStats.pas
hedgewars/uTypes.pas
share/hedgewars/Data/Sounds/voices/British/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Classic/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Default/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Default_uk/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Mobster/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Pirate/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Robot/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Russian/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Singer/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Surfer/CMakeLists.txt
--- a/ChangeLog.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/ChangeLog.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -7,7 +7,7 @@
  + Rework team rankings
  + Tied teams now rank equally
  + Help button in main menu
- + 15 new hedgehog taunts
+ + 17 new hedgehog taunts
  + Many new Lua API features
  * Functionality of controllers restored
  * Fix at least 2 crashes
@@ -54,7 +54,8 @@
  + New default brown clan color for better contrast
  + Allow to change volume during pause
  + Add sounds: flamethrower, landspray, idle freezer, shorykuen hit
- + Add taunts: Amazing, Brilliant, Bugger, Drat, Excellent, Fire, Gonnagetyou, Grenade, Ohdear, Revenge, Runaway, Solong, Thisoneismine, Whatthe, Watchthis
+ + Add taunts: Amazing, Brilliant, Bugger, Cutitout, Drat, Excellent, Fire, Gonnagetyou, Grenade,
+               Leavemealone, Ohdear, Revenge, Runaway, Solong, Thisoneismine, Whatthe, Watchthis
  * Fix extreme amounts of droplets when shooting with minigun into ocean world edge
  * Fix some flakes disappearing in world wrap worlds while moving camera
  * Fix invisible projectile timer, attack bar, target on other side of wrap world edge
--- a/hedgewars/uSound.pas	Sun Oct 28 02:24:06 2018 +0200
+++ b/hedgewars/uSound.pas	Sun Oct 28 04:21:13 2018 +0100
@@ -320,7 +320,9 @@
             (FileName:                 'Fire.ogg'; Path: ptVoices; AltPath: ptNone),// sndFire
             (FileName:            'Watchthis.ogg'; Path: ptVoices; AltPath: ptNone),// sndWatchThis
             (FileName:              'Runaway.ogg'; Path: ptVoices; AltPath: ptNone),// sndRunAway
-            (FileName:              'Revenge.ogg'; Path: ptVoices; AltPath: ptNone) // sndRevenge
+            (FileName:              'Revenge.ogg'; Path: ptVoices; AltPath: ptNone),// sndRevenge
+            (FileName:             'Cutitout.ogg'; Path: ptVoices; AltPath: ptNone),// sndCutItOut
+            (FileName:         'Leavemealone.ogg'; Path: ptVoices; AltPath: ptNone) // sndLeaveMeAlone
             );
 
 
@@ -534,7 +536,7 @@
                         snd := sndUhOh
                 else if (snd in [sndDrat, sndBugger]) then
                     snd := sndStupid
-                else if (snd = sndGonnaGetYou) then
+                else if (snd in [sndGonnaGetYou, sndCutItOut, sndLeaveMeAlone]) then
                     snd := sndRegret
                 else if (snd in [sndOhDear, sndSoLong]) then
                     snd := sndByeBye
--- a/hedgewars/uStats.pas	Sun Oct 28 02:24:06 2018 +0200
+++ b/hedgewars/uStats.pas	Sun Oct 28 04:21:13 2018 +0100
@@ -64,6 +64,7 @@
     HitTargets  : LongWord = 0; // Target (gtTarget) hits per turn
     AmmoUsedCount : Longword = 0;
     AmmoDamagingUsed : boolean = false;
+    LeaveMeAlone : boolean = false;
     SkippedTurns: LongWord = 0;
     isTurnSkipped: boolean = false;
     vpHurtSameClan: PVoicepack = nil;
@@ -99,10 +100,15 @@
     vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack;
     if (not killed) then
         begin
+        // Check if victim got attacked by RevengeHog again
+        if (Gear^.Hedgehog^.RevengeHog <> nil) and (Gear^.Hedgehog^.RevengeHog = Attacker) then
+            LeaveMeAlone:= true;
         // Check if attacker got revenge
         if (Attacker^.RevengeHog <> nil) and (Attacker^.RevengeHog = Gear^.Hedgehog) then
             begin
             Attacker^.stats.GotRevenge:= true;
+            // Also reset the "in-row" counter to restore LeaveMeAlone/CutItOut taunts
+            Attacker^.stats.StepDamageRecvInRow:= 0;
             Attacker^.RevengeHog:= nil;
             end
         // If not, victim remembers their attacker to plan *their* revenge
@@ -161,6 +167,7 @@
 for t:= 0 to Pred(TeamsCount) do // send even on zero turn
     with TeamsArray[t]^ do
         for i:= 0 to cMaxHHIndex do
+            begin
             with Hedgehogs[i].stats do
                 begin
                 inc(DamageRecv, StepDamageRecv);
@@ -171,7 +178,18 @@
                     MaxStepDamageGiven:= StepDamageGiven;
                 if StepKills > MaxStepKills then
                     MaxStepKills:= StepKills;
+                if (Hedgehogs[i].Team <> nil) and (Hedgehogs[i].Team^.Clan^.ClanIndex <> CurrentHedgehog^.Team^.Clan^.ClanIndex) then
+                    begin
+                    if StepDamageRecv > 0 then
+                        inc(StepDamageRecvInRow)
+                    else
+                        StepDamageRecvInRow:= 0;
+                    if StepDamageRecvInRow >= 3 then
+                        LeaveMeAlone:= true;
+                    end;
                 end;
+            end;
+
 
 // Write into the death log which clans died in this turn,
 // important for final rankings.
@@ -276,15 +294,23 @@
             AddVoice(sndEnemyDown, CurrentTeam^.voicepack)
         // 0 kills, only damage or poison
         else
+            // possible reactions of victim, in the order of preference:
+            // 1. claiming revenge
+            // 2. complaining about getting attacked too often
+            // 3. threatening enemy with retaliation
             if CurrentHedgehog^.stats.GotRevenge then
                 AddVoice(sndRevenge, CurrentHedgehog^.Team^.voicepack)
             else
-                // TODO: Maybe play sndExcellent for a high damage shot.
-                // Not done yet because the fallback is sndEnemyDown.
-                if random(2) = 0 then
-                    AddVoice(sndRegret, vpHurtEnemy)
+                if LeaveMeAlone then
+                    if random(2) = 0 then
+                        AddVoice(sndCutItOut, vpHurtEnemy)
+                    else
+                        AddVoice(sndLeaveMeAlone, vpHurtEnemy)
                 else
-                    AddVoice(sndGonnaGetYou, vpHurtEnemy)
+                    if random(2) = 0 then
+                        AddVoice(sndRegret, vpHurtEnemy)
+                    else
+                        AddVoice(sndGonnaGetYou, vpHurtEnemy)
 
     // Missed shot
     // A miss is defined as a shot with a damaging weapon with 0 kills, 0 damage, 0 hogs poisoned and 0 targets hit
@@ -336,6 +362,7 @@
 PoisonClan:= 0;
 PoisonTurn:= 0;
 AmmoUsedCount:= 0;
+LeaveMeAlone:= false;
 AmmoDamagingUsed:= false;
 isTurnSkipped:= false;
 end;
@@ -541,6 +568,7 @@
     HitTargets  := 0;
     AmmoUsedCount := 0;
     AmmoDamagingUsed := false;
+    LeaveMeAlone := false;
     SkippedTurns:= 0;
     isTurnSkipped:= false;
     vpHurtSameClan:= nil;
--- a/hedgewars/uTypes.pas	Sun Oct 28 02:24:06 2018 +0200
+++ b/hedgewars/uTypes.pas	Sun Oct 28 04:21:13 2018 +0100
@@ -154,7 +154,8 @@
             sndCustom5, sndCustom6, sndCustom7, sndCustom8, sndMinigun, sndFlamethrower, sndIceBeamIdle,
             sndLandGun, sndCaseImpact, sndExtraDamage, sndFirePunchHit, sndGrenade, sndThisOneIsMine,
             sndWhatThe, sndSoLong, sndOhDear, sndGonnaGetYou, sndDrat, sndBugger, sndAmazing,
-            sndBrilliant, sndExcellent, sndFire, sndWatchThis, sndRunAway, sndRevenge);
+            sndBrilliant, sndExcellent, sndFire, sndWatchThis, sndRunAway, sndRevenge, sndCutItOut,
+            sndLeaveMeAlone);
 
     // Available ammo types to be used by hedgehogs
     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
@@ -330,19 +331,20 @@
         end;
 
     TStatistics = record
-        DamageRecv,
-        DamageGiven: Longword;
-        StepDamageRecv,
-        StepDamageGiven,
-        StepKills: Longword;
-        StepPoisoned,
-        StepDied,
-        Sacrificed: boolean;
-        MaxStepDamageRecv,
-        MaxStepDamageGiven,
-        MaxStepKills: Longword;
+        DamageRecv,              // total damage received
+        DamageGiven: Longword;   // total damage dealt
+        StepDamageRecvInRow,     // number of enemy turns in row this hog received any damage
+        StepDamageRecv,          // damage received in this turn
+        StepDamageGiven,         // damage dealt in this turn
+        StepKills: Longword;     // kills in this turn
+        StepPoisoned,            // whether hog got poisoned this turn
+        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
+        MaxStepDamageRecv,       // most damage received in one turn
+        MaxStepDamageGiven,      // most damage dealt in one turn
+        MaxStepKills: Longword;  // most kills in one turn
         FinishedTurns: Longword;
-        GotRevenge: boolean;     // True if hog got revenge in this turn
         end;
 
     TTeamStats = record
--- a/share/hedgewars/Data/Sounds/voices/British/CMakeLists.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/share/hedgewars/Data/Sounds/voices/British/CMakeLists.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -6,6 +6,7 @@
 Byebye.ogg
 Comeonthen.ogg
 Coward.ogg
+Cutitout.ogg
 Drat.ogg
 Enemydown.ogg
 Excellent.ogg
@@ -23,6 +24,7 @@
 Justyouwait.ogg
 Kamikaze.ogg
 Laugh.ogg
+Leavemealone.ogg
 Melon.ogg
 Missed.ogg
 Nooo.ogg
--- a/share/hedgewars/Data/Sounds/voices/Classic/CMakeLists.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/share/hedgewars/Data/Sounds/voices/Classic/CMakeLists.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -6,6 +6,7 @@
 Byebye.ogg
 Comeonthen.ogg
 Coward.ogg
+Cutitout.ogg
 Drat.ogg
 Enemydown.ogg
 Excellent.ogg
@@ -23,6 +24,7 @@
 Justyouwait.ogg
 Kamikaze.ogg
 Laugh.ogg
+Leavemealone.ogg
 Melon.ogg
 Missed.ogg
 Nooo.ogg
--- a/share/hedgewars/Data/Sounds/voices/Default/CMakeLists.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/share/hedgewars/Data/Sounds/voices/Default/CMakeLists.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -6,6 +6,7 @@
 Byebye.ogg
 Comeonthen.ogg
 Coward.ogg
+Cutitout.ogg
 Drat.ogg
 Enemydown.ogg
 Excellent.ogg
@@ -23,6 +24,7 @@
 Justyouwait.ogg
 Kamikaze.ogg
 Laugh.ogg
+Leavemealone.ogg
 Melon.ogg
 Missed.ogg
 Nooo.ogg
--- a/share/hedgewars/Data/Sounds/voices/Default_uk/CMakeLists.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/share/hedgewars/Data/Sounds/voices/Default_uk/CMakeLists.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -6,6 +6,7 @@
 Byebye.ogg
 Comeonthen.ogg
 Coward.ogg
+Cutitout.ogg
 Drat.ogg
 Enemydown.ogg
 Excellent.ogg
@@ -23,6 +24,7 @@
 Justyouwait.ogg
 Kamikaze.ogg
 Laugh.ogg
+Leavemealone.ogg
 Melon.ogg
 Missed.ogg
 Nooo.ogg
--- a/share/hedgewars/Data/Sounds/voices/Mobster/CMakeLists.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/share/hedgewars/Data/Sounds/voices/Mobster/CMakeLists.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -6,6 +6,7 @@
 Byebye.ogg
 Comeonthen.ogg
 Coward.ogg
+Cutitout.ogg
 Drat.ogg
 Enemydown.ogg
 Excellent.ogg
@@ -23,6 +24,7 @@
 Justyouwait.ogg
 Kamikaze.ogg
 Laugh.ogg
+Leavemealone.ogg
 Melon.ogg
 Missed.ogg
 Nooo.ogg
--- a/share/hedgewars/Data/Sounds/voices/Pirate/CMakeLists.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/share/hedgewars/Data/Sounds/voices/Pirate/CMakeLists.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -6,6 +6,7 @@
 Byebye.ogg
 Comeonthen.ogg
 Coward.ogg
+Cutitout.ogg
 Drat.ogg
 Enemydown.ogg
 Excellent.ogg
@@ -23,6 +24,7 @@
 Justyouwait.ogg
 Kamikaze.ogg
 Laugh.ogg
+Leavemealone.ogg
 Melon.ogg
 Missed.ogg
 Nooo.ogg
--- a/share/hedgewars/Data/Sounds/voices/Robot/CMakeLists.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/share/hedgewars/Data/Sounds/voices/Robot/CMakeLists.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -6,6 +6,7 @@
 Byebye.ogg
 Comeonthen.ogg
 Coward.ogg
+Cutitout.ogg
 Drat.ogg
 Enemydown.ogg
 Excellent.ogg
@@ -23,6 +24,7 @@
 Justyouwait.ogg
 Kamikaze.ogg
 Laugh.ogg
+Leavemealone.ogg
 Melon.ogg
 Missed.ogg
 Nooo.ogg
--- a/share/hedgewars/Data/Sounds/voices/Russian/CMakeLists.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/share/hedgewars/Data/Sounds/voices/Russian/CMakeLists.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -6,6 +6,7 @@
 Byebye.ogg
 Comeonthen.ogg
 Coward.ogg
+Cutitout.ogg
 Drat.ogg
 Enemydown.ogg
 Excellent.ogg
@@ -23,6 +24,7 @@
 Justyouwait.ogg
 Kamikaze.ogg
 Laugh.ogg
+Leavemealone.ogg
 Melon.ogg
 Missed.ogg
 Nooo.ogg
--- a/share/hedgewars/Data/Sounds/voices/Singer/CMakeLists.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/share/hedgewars/Data/Sounds/voices/Singer/CMakeLists.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -6,6 +6,7 @@
 Byebye.ogg
 Comeonthen.ogg
 Coward.ogg
+Cutitout.ogg
 Drat.ogg
 Enemydown.ogg
 Excellent.ogg
@@ -23,6 +24,7 @@
 Justyouwait.ogg
 Kamikaze.ogg
 Laugh.ogg
+Leavemealone.ogg
 Melon.ogg
 Missed.ogg
 Nooo.ogg
--- a/share/hedgewars/Data/Sounds/voices/Surfer/CMakeLists.txt	Sun Oct 28 02:24:06 2018 +0200
+++ b/share/hedgewars/Data/Sounds/voices/Surfer/CMakeLists.txt	Sun Oct 28 04:21:13 2018 +0100
@@ -6,6 +6,7 @@
 Byebye.ogg
 Comeonthen.ogg
 Coward.ogg
+Cutitout.ogg
 Drat.ogg
 Enemydown.ogg
 Excellent.ogg
@@ -23,6 +24,7 @@
 Justyouwait.ogg
 Kamikaze.ogg
 Laugh.ogg
+Leavemealone.ogg
 Melon.ogg
 Missed.ogg
 Nooo.ogg