# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1578399664 -3600
# Node ID bbb98e22a30368c083eb3c000a116847160f2b96
# Parent  a798e6441a369070c430efe3ba2d0bdfa2dfae9e
Fix impossible to become mutant after mutant gear got deleted (bug 804)

diff -r a798e6441a36 -r bbb98e22a303 ChangeLog.txt
--- a/ChangeLog.txt	Sat Jan 04 01:39:13 2020 +0300
+++ b/ChangeLog.txt	Tue Jan 07 13:21:04 2020 +0100
@@ -7,6 +7,7 @@
  + Racer: Reset mines, air mines and sticky mines every turn
  + A Space Adventure: Spacetrip: Meteorite appears blown-up after victory
  * Racer: Resize waypoints in custom-sized drawn maps
+ * Mutant: Fix impossible to become mutant after mutant is gone
  * A Space Adventure: The First Stop: Fix broken victory condition when eliminating minions
  * A Space Adventure: Killing the Specialists: Don't award player health if enemy hurts itself
  * Fix hog getting stuck when opening parachute right after a shoryuken digging through land
diff -r a798e6441a36 -r bbb98e22a303 share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Sat Jan 04 01:39:13 2020 +0300
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Tue Jan 07 13:21:04 2020 +0100
@@ -816,6 +816,11 @@
     if GetGearType(gear) == gtHedgehog then
         numhhs = numhhs - 1
 
+        if (not gameOver) and (gear == mutant) then
+            mutant = nil
+            mt_hurt = false
+        end
+
         local found
         for i=0, #hhs do
             if hhs[i] == gear then