174 -- If time's up, set the game to be lost. |
174 -- If time's up, set the game to be lost. |
175 -- We actually check the time to be "1 ms" as it |
175 -- We actually check the time to be "1 ms" as it |
176 -- will be at "0 ms" right at the start of the game. |
176 -- will be at "0 ms" right at the start of the game. |
177 if TurnTimeLeft < 40 and TurnTimeLeft > 0 and score < score_goal and game_lost == false then |
177 if TurnTimeLeft < 40 and TurnTimeLeft > 0 and score < score_goal and game_lost == false then |
178 game_lost = true |
178 game_lost = true |
179 -- ... and show a short message. |
|
180 AddCaption(loc("Time's up!")) |
|
181 ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0) |
|
182 -- and generate the stats and go to the stats screen |
179 -- and generate the stats and go to the stats screen |
183 generateStats() |
180 generateStats() |
184 EndGame() |
181 EndGame() |
185 -- Just to be sure set the goal time to 1 ms |
182 -- Just to be sure set the goal time to 1 ms |
186 time_goal = 1 |
183 time_goal = 1 |
424 SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets (+%d points)."), score, score_goal, end_score_targets)) |
421 SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets (+%d points)."), score, score_goal, end_score_targets)) |
425 SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots)) |
422 SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots)) |
426 SendStat(siCustomAchievement, string.format(loc("Accuracy bonus: +%d points"), end_score_accuracy)) |
423 SendStat(siCustomAchievement, string.format(loc("Accuracy bonus: +%d points"), end_score_accuracy)) |
427 SendStat(siCustomAchievement, string.format(loc("You had %.2fs remaining on the clock (+%d points)."), (time_goal/1000), end_score_time)) |
424 SendStat(siCustomAchievement, string.format(loc("You had %.2fs remaining on the clock (+%d points)."), (time_goal/1000), end_score_time)) |
428 else |
425 else |
429 SendStat(siGameResult, loc("You lose!")) |
426 SendStat(siGameResult, loc("Challenge over!")) |
430 |
427 |
431 SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets (+%d points)."), score, score_goal, end_score_targets)) |
428 SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets (+%d points)."), score, score_goal, end_score_targets)) |
432 SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots)) |
429 SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots)) |
433 end_score_overall = end_score_targets |
430 end_score_overall = end_score_targets |
434 end |
431 end |