share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua
changeset 13184 3966ef529313
parent 13165 89a6b862e692
child 13190 f9c787f58459
equal deleted inserted replaced
13183:fde354aaf978 13184:3966ef529313
    18 local gamePhase = 0		-- Used to track progress
    18 local gamePhase = 0		-- Used to track progress
    19 local targetsLeft = 0		-- # of targets left in this round
    19 local targetsLeft = 0		-- # of targets left in this round
    20 local targetGears = {}		-- list of target gears
    20 local targetGears = {}		-- list of target gears
    21 local bazookasInGame = 0	-- # of bazookas currently flying
    21 local bazookasInGame = 0	-- # of bazookas currently flying
    22 local bazookaGears = {}		-- list of bazooka gears
    22 local bazookaGears = {}		-- list of bazooka gears
    23 local limitedAmmo = 5		-- amount of ammo for the limited ammo challenge
    23 local limitedAmmo = 10		-- amount of ammo for the limited ammo challenge
    24 local limitedAmmoReset = -1	-- Timer for resetting ammo if player fails in
    24 local limitedAmmoReset = -1	-- Timer for resetting ammo if player fails in
    25 				-- limited ammo challenge. -1 = no-op
    25 				-- limited ammo challenge. -1 = no-op
    26 local gameOver = false		-- If true, game has ended
    26 local gameOver = false		-- If true, game has ended
    27 local shotsFired = 0		-- Total # of bazookas fired
    27 local shotsFired = 0		-- Total # of bazookas fired
    28 local maxTargets = 0		-- Target counter, used together with flawless
    28 local maxTargets = 0		-- Target counter, used together with flawless
    87 	PlaceGirder(1818, 1703, 0)
    87 	PlaceGirder(1818, 1703, 0)
    88 	PlaceGirder(1939, 1703, 4)
    88 	PlaceGirder(1939, 1703, 4)
    89 	PlaceGirder(2805, 1781, 3)
    89 	PlaceGirder(2805, 1781, 3)
    90 	PlaceGirder(2905, 1621, 3)
    90 	PlaceGirder(2905, 1621, 3)
    91 	PlaceGirder(3005, 1441, 3)
    91 	PlaceGirder(3005, 1441, 3)
       
    92 	PlaceGirder(945, 1340, 5)
    92 end
    93 end
    93 
    94 
    94 function spawnTargets(phase)
    95 function spawnTargets(phase)
    95 	if not phase then
    96 	if not phase then
    96 		phase = gamePhase
    97 		phase = gamePhase
   108 		AddGear(1345, 1971, gtTarget, 0, 0, 0, 0)
   109 		AddGear(1345, 1971, gtTarget, 0, 0, 0, 0)
   109 		AddGear(1892, 1680, gtTarget, 0, 0, 0, 0)
   110 		AddGear(1892, 1680, gtTarget, 0, 0, 0, 0)
   110 	elseif phase == 4 then
   111 	elseif phase == 4 then
   111 		AddGear(2584, 2010, gtTarget, 0, 0, 0, 0)
   112 		AddGear(2584, 2010, gtTarget, 0, 0, 0, 0)
   112 	elseif phase == 5 then
   113 	elseif phase == 5 then
       
   114 		AddGear(955, 1320, gtTarget, 0, 0, 0, 0)
       
   115 	elseif phase == 6 then
   113 		AddGear(2794, 1759, gtTarget, 0, 0, 0, 0)
   116 		AddGear(2794, 1759, gtTarget, 0, 0, 0, 0)
   114 		AddGear(2894, 1599, gtTarget, 0, 0, 0, 0)
   117 		AddGear(2894, 1599, gtTarget, 0, 0, 0, 0)
   115 		AddGear(2994, 1419, gtTarget, 0, 0, 0, 0)
   118 		AddGear(2994, 1419, gtTarget, 0, 0, 0, 0)
   116 	end
   119 	end
   117 end
   120 end
   149 			AddVisualGear(GetX(gear), GetY(gear), vgtSteam, 0, false)
   152 			AddVisualGear(GetX(gear), GetY(gear), vgtSteam, 0, false)
   150 			DeleteGear(gear)
   153 			DeleteGear(gear)
   151 			PlaySound(sndVaporize)
   154 			PlaySound(sndVaporize)
   152 		end
   155 		end
   153 		ShowMission(loc("Basic Bazooka Training"), loc("Limited Ammo"), loc("Your ammo is limited this time.").."|"..
   156 		ShowMission(loc("Basic Bazooka Training"), loc("Limited Ammo"), loc("Your ammo is limited this time.").."|"..
   154 		loc("Destroy all targets with no more than 5 bazookas."),
   157 		loc("Destroy all targets with no more than 10 bazookas."),
   155 		2, 8000)
   158 		2, 8000)
   156 		SetWind(-20)
   159 		SetWind(-20)
   157 		AddAmmo(hog, amBazooka, limitedAmmo)
   160 		AddAmmo(hog, amBazooka, limitedAmmo)
   158 		spawnTargets()
   161 		spawnTargets()
   159 	elseif gamePhase == 4 then
   162 	elseif gamePhase == 4 then
   165 		AddAmmo(hog, amBazooka, 100)
   168 		AddAmmo(hog, amBazooka, 100)
   166 		if GetCurAmmoType() ~= amBazooka then
   169 		if GetCurAmmoType() ~= amBazooka then
   167 			SetWeapon(amBazooka)
   170 			SetWeapon(amBazooka)
   168 		end
   171 		end
   169 	elseif gamePhase == 5 then
   172 	elseif gamePhase == 5 then
   170 		ShowMission(loc("Basic Bazooka Training"), loc("Final Targets"), loc("The final targets are quite tricky. You need to aim well.").."|"..
   173 		ShowMission(loc("Basic Bazooka Training"), loc("High Target"),
   171 		loc("Precise Aim: [Left Shift] + [Up]/[Down]"),
   174 		loc("By the way, not only bazookas will bounce on water, but also greandes and many other things.").."|"..
       
   175 		loc("The next target is high in the sky."),
   172 		2, 8000)
   176 		2, 8000)
       
   177 		SetWind(-33)
       
   178 		spawnTargets()
       
   179 	elseif gamePhase == 6 then
       
   180 		ShowMission(loc("Basic Bazooka Training"), loc("Final Targets"),
       
   181 		loc("The final targets are quite tricky. You need to aim well.").."|"..
       
   182 		loc("Precise Aim: [Left Shift] + [Up]/[Down]").."|"..
       
   183 		loc("Hint: It might be easier if you vary the angle only slightly"),
       
   184 		2, 12000)
   173 		SetWind(75)
   185 		SetWind(75)
   174 		spawnTargets()
   186 		spawnTargets()
   175 	elseif gamePhase == 6 then
   187 	elseif gamePhase == 7 then
   176 		ShowMission(loc("Basic Bazooka Training"), loc("Training complete!"), loc("Congratulations!"), 0, 0)
   188 		ShowMission(loc("Basic Bazooka Training"), loc("Training complete!"), loc("Congratulations!"), 0, 0)
   177 		SetInputMask(0)
   189 		SetInputMask(0)
   178 		AddAmmo(CurrentHedgehog, amBazooka, 0)
   190 		AddAmmo(CurrentHedgehog, amBazooka, 0)
   179 		if shotsFired > maxTargets then
   191 		if shotsFired > maxTargets then
   180 			flawless = false
   192 			flawless = false