share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua
branchios-revival
changeset 11242 1e55e4c5dda0
parent 11015 7a905f0070ce
child 12049 030464f34d47
equal deleted inserted replaced
11241:e7bae160b73b 11242:1e55e4c5dda0
   139 
   139 
   140 	if band(GetState(player), gstDrowning) == gstDrowning and game_lost == false and score < score_goal then
   140 	if band(GetState(player), gstDrowning) == gstDrowning and game_lost == false and score < score_goal then
   141 		game_lost = true
   141 		game_lost = true
   142 		time_goal = 1
   142 		time_goal = 1
   143 		AddCaption(loc("You lose!"), 0xFFFFFFFF, capgrpGameState)
   143 		AddCaption(loc("You lose!"), 0xFFFFFFFF, capgrpGameState)
   144 		ShowMission(loc("Bazooka Training"), loc("Aiming practice"), loc("Oh no! You failed! Just try again."), -amSkip, 0)
   144 		ShowMission(loc("Bazooka Training"), loc("Aiming Practice"), loc("Oh no! You failed! Just try again."), -amSkip, 0)
   145 	end
   145 	end
   146 
   146 
   147 	-- If the goal is reached or we've lost ...
   147 	-- If the goal is reached or we've lost ...
   148 	if score == score_goal or game_lost then
   148 	if score == score_goal or game_lost then
   149 		-- ... check to see if the time we'd like to
   149 		-- ... check to see if the time we'd like to
   160 			-- We must avoid a division by zero
   160 			-- We must avoid a division by zero
   161 			if(shots > 0) then
   161 			if(shots > 0) then
   162 				SendStat(siCustomAchievement, string.format(loc("Your accuracy was %.1f%%."), (score/shots)*100))
   162 				SendStat(siCustomAchievement, string.format(loc("Your accuracy was %.1f%%."), (score/shots)*100))
   163 			end
   163 			end
   164 			if score == score_goal then
   164 			if score == score_goal then
   165 				SendStat(siGameResult, "You have finished the bazooka training!")
   165 				SendStat(siGameResult, loc("You have finished the bazooka training!"))
   166 				SendStat(siCustomAchievement, string.format(loc("%.1f seconds were remaining."), (time_goal/1000), math.ceil(time_goal/12)))
   166 				SendStat(siCustomAchievement, string.format(loc("%.1f seconds were remaining."), (time_goal/1000), math.ceil(time_goal/12)))
   167 			end
   167 			end
   168 			if game_lost then
   168 			if game_lost then
   169 				SendStat(siGameResult, "You lose!")
   169 				SendStat(siGameResult, loc("You lose!"))
   170 			end
   170 			end
   171 
   171 
   172 			-- Finally we end the game ...
   172 			-- Finally we end the game ...
   173 			EndGame()
   173 			EndGame()
   174 		else
   174 		else
   222 function onGearDamage(gear, damage)
   222 function onGearDamage(gear, damage)
   223 	if GetGearType(gear) == gtHedgehog then
   223 	if GetGearType(gear) == gtHedgehog then
   224 		if not game_lost then
   224 		if not game_lost then
   225 			game_lost = true
   225 			game_lost = true
   226 			AddCaption(loc("You lose!", 0xFFFFFFFF, capgrpGameState))
   226 			AddCaption(loc("You lose!", 0xFFFFFFFF, capgrpGameState))
   227 			ShowMission(loc("Bazooka Training") , loc("Aiming practice"), loc("Oh no! You failed! Just try again."), -amSkip, 0)
   227 			ShowMission(loc("Bazooka Training") , loc("Aiming Practice"), loc("Oh no! You failed! Just try again."), -amSkip, 0)
   228 
   228 
   229 			time_goal = 1
   229 			time_goal = 1
   230 		end
   230 		end
   231 	end
   231 	end
   232 end
   232 end