share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua
changeset 12731 2b0a4a4b1ba2
parent 12730 2c4a07eb2112
child 12913 20e627c1ac20
equal deleted inserted replaced
12730:2c4a07eb2112 12731:2b0a4a4b1ba2
   393 end
   393 end
   394 
   394 
   395 -- This function calculates the final score of the player and provides some texts and
   395 -- This function calculates the final score of the player and provides some texts and
   396 -- data for the final stats screen
   396 -- data for the final stats screen
   397 function generateStats()
   397 function generateStats()
   398 	local accuracy = (score/shots)*100
   398 	local accuracy = 0
       
   399 	if shots > 0 then
       
   400 		accuracy = (score/shots)*100
       
   401 	end
   399 	local end_score_targets = (score_bonus * 200)
   402 	local end_score_targets = (score_bonus * 200)
   400 	local end_score_overall
   403 	local end_score_overall
   401 	if not game_lost then
   404 	if not game_lost then
   402 		local end_score_time = math.ceil(time_goal/5)
   405 		local end_score_time = math.ceil(time_goal/5)
   403 		local end_score_accuracy = math.ceil(accuracy * 100)
   406 		local end_score_accuracy = math.ceil(accuracy * 100)