share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
changeset 14346 bd2bbd607f5e
parent 14290 47af42f7ca8b
child 14599 50f511588635
equal deleted inserted replaced
14345:5da99c43b96f 14346:bd2bbd607f5e
   311                 end
   311                 end
   312             end
   312             end
   313         end
   313         end
   314     end
   314     end
   315 
   315 
   316     if TurnTimeLeft==0 and mt_hurt then
   316     if (TurnTimeLeft==0 or band(GetState(mutant), gstHHDriven) == 0) and mt_hurt then
   317         mt_hurt = false
   317         mt_hurt = false
   318     end
   318     end
   319 
   319 
   320     if mt_hurt and mutant~=nil then
   320     -- Mutant's disease
       
   321     -- Hurt Mutant during its turn time
       
   322     -- Mutant's health is safe in ready phase
       
   323     if mt_hurt and mutant~=nil and ReadyTimeLeft == 0 then
   321         timer = timer + 1
   324         timer = timer + 1
   322             if timer > disease_timer then
   325         if timer > disease_timer then
   323                 timer = 0
   326             timer = 0
   324                 SetHealth(mutant, GetHealth(mutant)-disease )
   327             local h = GetHealth(mutant)-disease
   325                 AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true)
   328             SetHealth(mutant, h)
   326                     if GetHealth(mutant)<=0 then
   329             -- Low health warning
   327                         SetHealth(mutant,0)
   330             if h <= 75 then
   328                         mt_hurt= false
   331                 PlaySound(sndPoisonMoan, mutant)
   329                         setGearValue(mutant,"SelfDestruct",true)
   332             elseif h <= 150 then
   330                         EndTurn()
   333                 PlaySound(sndPoisonCough, mutant)
   331                     end
   334             end
   332             end
   335             local tag = AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true)
       
   336             SetVisualGearValues(tag, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(mutant)))
       
   337             if GetHealth(mutant)<=0 then
       
   338                 SetHealth(mutant,0)
       
   339                 mt_hurt= false
       
   340                 setGearValue(mutant,"SelfDestruct",true)
       
   341                 EndTurn()
       
   342             end
       
   343         end
   333     end
   344     end
   334 
   345 
   335 end
   346 end
   336 
   347 
   337 --[[
   348 --[[