share/hedgewars/Data/Missions/Training/Basic_Training_-_Sniper_Rifle.lua
changeset 11017 16c47a5573e4
parent 11015 7a905f0070ce
child 11528 8826ee0afe01
equal deleted inserted replaced
11016:93b3870a538d 11017:16c47a5573e4
    83 	-- The delay between each round
    83 	-- The delay between each round
    84 	Delay = 0
    84 	Delay = 0
    85 	-- The map to be played
    85 	-- The map to be played
    86 	Map = "Ropes"
    86 	Map = "Ropes"
    87 	-- The theme to be used
    87 	-- The theme to be used
    88 	Theme = "City"
    88 	Theme = "Golf"
    89 
    89 
    90 	-- Create the player team
    90 	-- Create the player team
    91 	AddTeam(loc("Sniperz"), 14483456, "Simple", "Island", "Default")
    91 	AddTeam(loc("Sniperz"), 14483456, "Simple", "Island", "Default")
    92 	-- And add a hog to it
    92 	-- And add a hog to it
    93 	player = AddHog(loc("Hunter"), 0, 1, "Sniper")
    93 	player = AddHog(loc("Hunter"), 0, 1, "Sniper")
   100 function onGameStart()
   100 function onGameStart()
   101 	-- Disable graph in stats screen
   101 	-- Disable graph in stats screen
   102 	SendHealthStatsOff()
   102 	SendHealthStatsOff()
   103 	-- Spawn the first target.
   103 	-- Spawn the first target.
   104 	spawnTarget(860,1020)
   104 	spawnTarget(860,1020)
   105 	
   105 
   106 	-- Show some nice mission goals.
   106 	-- Show some nice mission goals.
   107 	-- Parameters are: caption, sub caption, description,
   107 	-- Parameters are: caption, sub caption, description,
   108 	-- extra text, icon and time to show.
   108 	-- extra text, icon and time to show.
   109 	-- A negative icon parameter (-n) represents the n-th weapon icon
   109 	-- A negative icon parameter (-n) represents the n-th weapon icon
   110 	-- A positive icon paramter (n) represents the (n+1)-th mission icon
   110 	-- A positive icon paramter (n) represents the (n+1)-th mission icon
   176 end
   176 end
   177 
   177 
   178 -- This function is called before a gear is destroyed.
   178 -- This function is called before a gear is destroyed.
   179 -- We use it to count the number of targets destroyed.
   179 -- We use it to count the number of targets destroyed.
   180 function onGearDelete(gear)
   180 function onGearDelete(gear)
   181     
   181 
   182 	if GetGearType(gear) == gtCase then
   182 	if GetGearType(gear) == gtCase then
   183 		game_lost = true
   183 		game_lost = true
   184 		return
   184 		return
   185 	end
   185 	end
   186 	
   186 
   187 	if (GetGearType(gear) == gtTarget) then
   187 	if (GetGearType(gear) == gtTarget) then
   188 		-- remember when the target was hit for adjusting the camera
   188 		-- remember when the target was hit for adjusting the camera
   189 		last_hit_time = TurnTimeLeft
   189 		last_hit_time = TurnTimeLeft
   190 		-- Add one point to our score/counter
   190 		-- Add one point to our score/counter
   191 		score = score + 1
   191 		score = score + 1
   337 		SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots))
   337 		SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots))
   338 		SendStat(siCustomAchievement, string.format(loc("Accuracy bonus: +%d points"), end_score_accuracy))
   338 		SendStat(siCustomAchievement, string.format(loc("Accuracy bonus: +%d points"), end_score_accuracy))
   339 		SendStat(siCustomAchievement, string.format(loc("You had %.2fs remaining on the clock (+%d points)."), (time_goal/1000), end_score_time))
   339 		SendStat(siCustomAchievement, string.format(loc("You had %.2fs remaining on the clock (+%d points)."), (time_goal/1000), end_score_time))
   340 	else
   340 	else
   341 		SendStat(siGameResult, loc("You lose!"))
   341 		SendStat(siGameResult, loc("You lose!"))
   342 	
   342 
   343 		SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets (+%d points)."), score, score_goal, end_score_targets))
   343 		SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets (+%d points)."), score, score_goal, end_score_targets))
   344 		SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots))
   344 		SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots))
   345 		end_score_overall = end_score_targets
   345 		end_score_overall = end_score_targets
   346 	end
   346 	end
   347 	SendStat(siPlayerKills, tostring(end_score_overall), loc("Sniperz"))
   347 	SendStat(siPlayerKills, tostring(end_score_overall), loc("Sniperz"))