share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua
changeset 14526 797e3f441c14
parent 14495 ff2c1f25fc03
child 14578 50f511588635
equal deleted inserted replaced
14525:029f40c609b4 14526:797e3f441c14
   191 		-- wait has passed and then ...
   191 		-- wait has passed and then ...
   192 		if end_timer == 0 then
   192 		if end_timer == 0 then
   193 			-- ... end the game ...
   193 			-- ... end the game ...
   194 			generateStats()
   194 			generateStats()
   195 			EndGame()
   195 			EndGame()
   196 		else
       
   197 			-- ... or just lower the timer by 1.
       
   198 			-- Reset the time left to stop the timer
       
   199 			SetTurnTimeLeft(time_goal)
       
   200 		end
   196 		end
   201         end_timer = end_timer - 20
   197         	end_timer = end_timer - 20
   202 	end
   198 	end
   203 end
   199 end
   204 
   200 
   205 -- This function is called when the game is initialized
   201 -- This function is called when the game is initialized
   206 -- to request the available ammo and probabilities
   202 -- to request the available ammo and probabilities
   383 				spawnTarget(3670,0)
   379 				spawnTarget(3670,0)
   384 			elseif score == 26 then
   380 			elseif score == 26 then
   385 				AddCaption(loc("Last Target!"));
   381 				AddCaption(loc("Last Target!"));
   386 				spawnTarget(3480,1200)
   382 				spawnTarget(3480,1200)
   387 			end
   383 			end
   388 		else
   384 		elseif not game_lost then
   389 			if not game_lost then
       
   390 			-- Victory!
   385 			-- Victory!
   391 			SaveMissionVar("Won", "true")
   386 			SaveMissionVar("Won", "true")
   392 			AddCaption(loc("Victory!"), capcolDefault, capgrpGameState)
   387 			AddCaption(loc("Victory!"), capcolDefault, capgrpGameState)
   393 			ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0)
   388 			ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0)
   394 			-- Also let the hogs shout "victory!"
   389 			-- Also let the hogs shout "victory!"
   400 			SetWeapon(amNothing)
   395 			SetWeapon(amNothing)
   401 			AddAmmo(CurrentHedgehog, amSniperRifle, 0)
   396 			AddAmmo(CurrentHedgehog, amSniperRifle, 0)
   402 
   397 
   403 			-- Save the time left so we may keep it.
   398 			-- Save the time left so we may keep it.
   404 			time_goal = TurnTimeLeft
   399 			time_goal = TurnTimeLeft
   405 			end
   400 
       
   401 			-- Freeze the clock because the challenge has been completed
       
   402 			SetTurnTimePaused(true)
   406 		end
   403 		end
   407 		SetTeamLabel(playerTeamName, getTargetScore())
   404 		SetTeamLabel(playerTeamName, getTargetScore())
   408 	end
   405 	end
   409 end
   406 end
   410 
   407