# HG changeset patch # User Wuzzy # Date 1479310543 -3600 # Node ID 0526a26ddd6ecbfa5823371a81f562117cdbd4a8 # Parent d79621bcb709e424c9cc47ad39222dad4c2c2af6 Save fastest rounds in Killing the specialists and Precise shooting missions diff -r d79621bcb709 -r 0526a26ddd6e share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua Wed Nov 16 16:35:09 2016 +0100 +++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua Wed Nov 16 16:35:43 2016 +0100 @@ -188,6 +188,16 @@ saveBonus(3, 4) SendStat(siGameResult, loc("Congratulations, you won!")) SendStat(siCustomAchievement, string.format(loc("You completed the mission in %d rounds."), TotalRounds)) + local record = tonumber(GetCampaignVar("FastestSpecialistsKill")) + if record ~= nil and TotalRounds >= record then + SendStat(siCustomAchievement, string.format(loc("Your fastest victory so far: %d rounds"), record)) + end + if record == nil or TotalRounds < record then + SaveCampaignVar("FastestSpecialistsKill", tostring(TotalRounds)) + if record ~= nil then + SendStat(siCustomAchievement, loc("This is a new personal best, congratulations!")) + end + end SendStat(siCustomAchievement, loc("The next 4 times you play the \"The last encounter\" mission you'll get 20 more hit points and a laser sight.")) SendStat(siPlayerKills,'1',teamA.name) EndGame() diff -r d79621bcb709 -r 0526a26ddd6e share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua Wed Nov 16 16:35:09 2016 +0100 +++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua Wed Nov 16 16:35:43 2016 +0100 @@ -214,6 +214,16 @@ saveBonus(2, 1) SendStat(siGameResult, loc("Congratulations, you won!")) SendStat(siCustomAchievement, string.format(loc("You completed the mission in %d rounds."), TotalRounds)) + local record = tonumber(GetCampaignVar("FastestPreciseShooting")) + if record ~= nil and TotalRounds >= record then + SendStat(siCustomAchievement, string.format(loc("Your fastest victory so far: %d rounds"), record)) + end + if record == nil or TotalRounds < record then + SaveCampaignVar("FastestPreciseShooting", tostring(TotalRounds)) + if record ~= nil then + SendStat(siCustomAchievement, loc("This is a new personal best, congratulations!")) + end + end SendStat(siCustomAchievement, loc("You will gain some extra ammo from the crates the next time you play the \"Getting to the device\" mission.")) SendStat(siPlayerKills,'1',teamA.name) EndGame()