share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
changeset 11897 0526a26ddd6e
parent 11697 68eddcdc9f26
child 11957 63988f36debf
equal deleted inserted replaced
11896:d79621bcb709 11897:0526a26ddd6e
   212 
   212 
   213 function heroWin(gear)
   213 function heroWin(gear)
   214 	saveBonus(2, 1)
   214 	saveBonus(2, 1)
   215 	SendStat(siGameResult, loc("Congratulations, you won!"))
   215 	SendStat(siGameResult, loc("Congratulations, you won!"))
   216 	SendStat(siCustomAchievement, string.format(loc("You completed the mission in %d rounds."), TotalRounds))
   216 	SendStat(siCustomAchievement, string.format(loc("You completed the mission in %d rounds."), TotalRounds))
       
   217 	local record = tonumber(GetCampaignVar("FastestPreciseShooting"))
       
   218 	if record ~= nil and TotalRounds >= record then
       
   219 		SendStat(siCustomAchievement, string.format(loc("Your fastest victory so far: %d rounds"), record))
       
   220 	end
       
   221 	if record == nil or TotalRounds < record then
       
   222 		SaveCampaignVar("FastestPreciseShooting", tostring(TotalRounds))
       
   223 		if record ~= nil then
       
   224 			SendStat(siCustomAchievement, loc("This is a new personal best, congratulations!"))
       
   225 		end
       
   226 	end
   217 	SendStat(siCustomAchievement, loc("You will gain some extra ammo from the crates the next time you play the \"Getting to the device\" mission."))
   227 	SendStat(siCustomAchievement, loc("You will gain some extra ammo from the crates the next time you play the \"Getting to the device\" mission."))
   218 	SendStat(siPlayerKills,'1',teamA.name)
   228 	SendStat(siPlayerKills,'1',teamA.name)
   219 	EndGame()
   229 	EndGame()
   220 end
   230 end
   221 
   231