share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua
changeset 11890 712e20a3d895
parent 11692 68eddcdc9f26
child 11952 63988f36debf
equal deleted inserted replaced
11889:c8979eeb73fa 11890:712e20a3d895
   153 
   153 
   154 function heroSafe(gear)
   154 function heroSafe(gear)
   155 	SendStat(siGameResult, loc("Congratulations, you won!"))
   155 	SendStat(siGameResult, loc("Congratulations, you won!"))
   156 	SendStat(siCustomAchievement, loc("You have escaped successfully."))
   156 	SendStat(siCustomAchievement, loc("You have escaped successfully."))
   157 	SendStat(siCustomAchievement, string.format(loc("Your escape took you %d turns."), TotalRounds))
   157 	SendStat(siCustomAchievement, string.format(loc("Your escape took you %d turns."), TotalRounds))
   158 	SendStat(siPlayerKills,'1',teamA.name)
   158 	local record = tonumber(GetCampaignVar("FastestMineEscape"))
       
   159 	if record ~= nil and TotalRounds >= record then
       
   160 		SendStat(siCustomAchievement, string.format(loc("Your fastest escape so far: %d turns"), record))
       
   161 	end
       
   162 	if record == nil or TotalRounds < record then
       
   163 		SaveCampaignVar("FastestMineEscape", tostring(TotalRounds))
       
   164 		if record ~= nil then
       
   165 			SendStat(siCustomAchievement, loc("This is a new personal best, congratulations!"))
       
   166 		end
       
   167 	end
       
   168 	SendStat(siPlayerKills,'0',teamA.name)
   159 	EndGame()
   169 	EndGame()
   160 end
   170 end
   161 
   171 
   162 -------------- ANIMATIONS ------------------
   172 -------------- ANIMATIONS ------------------
   163 
   173