298 elseif score == 8 then |
298 elseif score == 8 then |
299 spawnTarget(3040,1160) |
299 spawnTarget(3040,1160) |
300 elseif score == 9 then |
300 elseif score == 9 then |
301 spawnTarget(2930,1500) |
301 spawnTarget(2930,1500) |
302 elseif score == 10 then |
302 elseif score == 10 then |
|
303 -- The "tricky" target. |
|
304 -- It spawns behind a wall |
|
305 -- and needs at least 2 shots. |
303 AddCaption(loc("This one's tricky.")); |
306 AddCaption(loc("This one's tricky.")); |
304 spawnTarget(700,720) |
307 spawnTarget(700,720) |
305 elseif score == 11 then |
308 elseif score == 11 then |
306 AddCaption(loc("Well done.")); |
309 AddCaption(loc("Well done.")); |
307 blowUp(914,1222) |
310 blowUp(914,1222) |
381 elseif not game_lost then |
384 elseif not game_lost then |
382 -- Victory! |
385 -- Victory! |
383 SaveMissionVar("Won", "true") |
386 SaveMissionVar("Won", "true") |
384 AddCaption(loc("Victory!"), capcolDefault, capgrpGameState) |
387 AddCaption(loc("Victory!"), capcolDefault, capgrpGameState) |
385 ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0) |
388 ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0) |
386 -- Also let the hogs shout "victory!" |
389 -- Play voice |
387 PlaySound(sndVictory, CurrentHedgehog) |
390 if shots-1 <= score then |
|
391 -- Flawless victory condition: Only 1 shot more than targets |
|
392 -- (1 shot per "normal" target + 2 shots for the "tricky" target) |
|
393 PlaySound(sndFlawless, CurrentHedgehog) |
|
394 else |
|
395 -- "Normal" victory |
|
396 PlaySound(sndVictory, CurrentHedgehog) |
|
397 end |
|
398 |
388 FollowGear(CurrentHedgehog) |
399 FollowGear(CurrentHedgehog) |
389 |
400 |
390 -- Unselect sniper rifle and disable hog controls |
401 -- Unselect sniper rifle and disable hog controls |
391 SetInputMask(0) |
402 SetInputMask(0) |
392 SetWeapon(amNothing) |
403 SetWeapon(amNothing) |
406 -- data for the final stats screen |
417 -- data for the final stats screen |
407 function generateStats() |
418 function generateStats() |
408 local accuracy |
419 local accuracy |
409 local accuracy_int |
420 local accuracy_int |
410 if shots > 0 then |
421 if shots > 0 then |
|
422 -- NOTE: 100% accuracy is not possible due to the "tricky" target. |
411 accuracy = (score/shots)*100 |
423 accuracy = (score/shots)*100 |
412 accuracy_int = div(score*100, shots) |
424 accuracy_int = div(score*100, shots) |
413 end |
425 end |
414 local end_score_targets = getTargetScore() |
426 local end_score_targets = getTargetScore() |
415 local end_score_overall |
427 local end_score_overall |