share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua
changeset 13998 e340ce5500d7
parent 13756 5525f69bf76b
child 14422 6c21bd8547dd
equal deleted inserted replaced
13997:2828ec67c47c 13998:e340ce5500d7
     4 local missionWon = nil
     4 local missionWon = nil
     5 local endTimer = 1000
     5 local endTimer = 1000
     6 local hogsKilled = 0
     6 local hogsKilled = 0
     7 local finishTime
     7 local finishTime
     8 local ouchies = false
     8 local ouchies = false
       
     9 local valkyriesTimer = -1
     9 
    10 
    10 local HogData =	{
    11 local HogData =	{
    11 					{"amn",			"NinjaFull",false},
    12 					{"amn",			"NinjaFull",false},
    12 					{"alfadur",		"NoHat",false},
    13 					{"alfadur",		"NoHat",false},
    13 					{"Anachron",		"war_americanww2helmet",false},
    14 					{"Anachron",		"war_americanww2helmet",false},
    83 		end
    84 		end
    84 	end
    85 	end
    85 end
    86 end
    86 
    87 
    87 function GameOverMan()
    88 function GameOverMan()
       
    89 	StopMusicSound(sndRideOfTheValkyries)
       
    90 	valkyriesTimer = -1
    88 	missionWon = false
    91 	missionWon = false
    89 	ProtectEnemies()
    92 	ProtectEnemies()
    90 	ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0)
    93 	ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0)
    91 	SendStat(siGameResult, loc("Challenge over!"))
    94 	SendStat(siGameResult, loc("Challenge over!"))
    92 	local score = GetKillScore()
    95 	local score = GetKillScore()
   240 
   243 
   241 	end
   244 	end
   242 
   245 
   243 end
   246 end
   244 
   247 
       
   248 function onGameTick20()
       
   249 	if (valkyriesTimer > 0) then
       
   250 		valkyriesTimer = valkyriesTimer - 20
       
   251 		if valkyriesTimer <= 0 then
       
   252 			StopMusicSound(sndRideOfTheValkyries)
       
   253 		end
       
   254 	end
       
   255 end
       
   256 
   245 function onGearDamage(gear, damage)
   257 function onGearDamage(gear, damage)
   246 
   258 
   247 	if gear == hhs[0] then
   259 	if gear == hhs[0] then
   248 		ouchies = true
   260 		ouchies = true
       
   261 		StopMusicSound(sndRideOfTheValkyries)
       
   262 		valkyriesTimer = -1
   249 		ProtectEnemies()
   263 		ProtectEnemies()
   250 	end
   264 	end
   251 
   265 
   252 	if gear ~= hhs[0] and GetGearType(gear) == gtHedgehog and missionWon == nil and ouchies == false then
   266 	if gear ~= hhs[0] and GetGearType(gear) == gtHedgehog and missionWon == nil and ouchies == false then
   253 
   267 
   258 
   272 
   259 		hogsKilled = hogsKilled +1
   273 		hogsKilled = hogsKilled +1
   260 		SetTeamLabel(playerTeamName, tostring(GetKillScore()))
   274 		SetTeamLabel(playerTeamName, tostring(GetKillScore()))
   261 
   275 
   262 		if hogsKilled == 15 then
   276 		if hogsKilled == 15 then
   263 			PlaySound(sndRideOfTheValkyries)
   277 			PlayMusicSound(sndRideOfTheValkyries)
       
   278 			-- Time in ms after which to return to normal music
       
   279 			valkyriesTimer = 20000
   264 		elseif hogsKilled == 16 then
   280 		elseif hogsKilled == 16 then
   265 			finishTime = TurnTimeLeft
   281 			finishTime = TurnTimeLeft
   266 			GG()
   282 			GG()
   267 		end
   283 		end
   268 
   284