share/hedgewars/Data/Maps/TrophyRace/map.lua
changeset 13010 d92c364f004d
parent 13009 67cc3cac4c8e
child 13011 c819675d4f4f
equal deleted inserted replaced
13009:67cc3cac4c8e 13010:d92c364f004d
   155             local fastestStr
   155             local fastestStr
   156             if ttime < besttime then
   156             if ttime < besttime then
   157                 besttime = ttime
   157                 besttime = ttime
   158                 besthog = CurrentHedgehog
   158                 besthog = CurrentHedgehog
   159                 besthogname = GetHogName(besthog)
   159                 besthogname = GetHogName(besthog)
   160                 fastestStr = loc("NEW fastest lap: %.3fs by %s")
       
   161             else
   160             else
   162                 fastestStr = loc("Fastest lap: %.3fs by %s")
   161             end
   163             end
   162             fastestStr = loc("Fastest lap: %.3fs by %s")
   164             if ttime > worsttime then
   163             if ttime > worsttime then
   165                 worsttime = ttime
   164                 worsttime = ttime
   166                 worsthog = CurrentHedgehog
   165                 worsthog = CurrentHedgehog
   167             end
   166             end
   168             hscore = hscore .. string.format(fastestStr, (besttime / 1000), besthogname)
   167 
       
   168             if worsthog then
       
   169                 hscore = hscore ..  string.format(loc("Round's slowest lap: %.3fs by %s"), (worsttime / 1000), GetHogName(worsthog))
       
   170             end
       
   171 
       
   172             hscore = hscore .. " |" .. string.format(fastestStr, (besttime / 1000), besthogname)
   169             
   173             
   170             if clan == ClansCount -1 then
   174             if clan == ClansCount -1 then
   171                 -- Time for elimination - worst hog is out and the worst hog vars are reset.
   175                 -- Time for elimination - worst hog is out and the worst hog vars are reset.
   172                 if worsthog ~= nil then
   176                 if worsthog ~= nil then
   173                     SetHealth(worsthog, 0)
   177                     SetHealth(worsthog, 0)
   177                 end
   181                 end
   178                 worsttime = 0
   182                 worsttime = 0
   179                 worsthog = nil
   183                 worsthog = nil
   180             end
   184             end
   181 
   185 
   182             -- print list of best team times
   186             ShowMission(loc("TrophyRace"), loc("Status update"),
   183             hscore = hscore .. "| |" .. loc("Best laps per team: ") .. "|"
   187                 string.format(loc("Time: %.3fs by %s"), (ttime/1000), GetHogName(CurrentHedgehog))
   184             for teamName, teamTime in pairs(bestTimes) do
   188                 .. hscore,
   185                 if teamTime ~= 0 and teamTime ~= nil then
   189                 0, 0)
   186                     -- <Team name>: <best team time in seconds>
   190             AddCaption(string.format(loc("Time: %.3fs"), (ttime/1000)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2)
   187                     hscore = hscore .. "|" .. string.format(loc("%s: %.3fs"), teamName, (teamTime / 1000))
       
   188                 end
       
   189             end
       
   190 
       
   191             local strtime = string.format(loc("Time: %.3fs"), (ttime/1000))
       
   192             ShowMission(loc("TrophyRace"), loc("Status update"), strtime .. hscore, 0, 0)
       
   193             AddCaption(strtime, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2)
       
   194             AddCaption(loc("Track completed!"), 0xFFFFFFFF, capgrpGameState)
   191             AddCaption(loc("Track completed!"), 0xFFFFFFFF, capgrpGameState)
   195             EndTurn(true)
   192             EndTurn(true)
   196         else
   193         else
   197             if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and CurrentHedgehog ~= nil and GetHealth(CurrentHedgehog) > 0 and (not reached) and GameTime%100 == 0 then
   194             if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and CurrentHedgehog ~= nil and GetHealth(CurrentHedgehog) > 0 and (not reached) and GameTime%100 == 0 then
   198                 local ttime = GameTime-startTime
   195                 local ttime = GameTime-startTime