share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua
changeset 13643 690cc84e9fd6
parent 13630 fe7d2bbf5f3f
child 13664 85506d95977d
equal deleted inserted replaced
13642:3d14950641a4 13643:690cc84e9fd6
   182 	loc("Collect or destroy the final crate to finish the training."),
   182 	loc("Collect or destroy the final crate to finish the training."),
   183 	Ammo = { [amJetpack] = 100, [amGrenade] = 100, [amBazooka] = 100 },
   183 	Ammo = { [amJetpack] = 100, [amGrenade] = 100, [amBazooka] = 100 },
   184 	InfFuel = true, }
   184 	InfFuel = true, }
   185 TargetPos[12] = { Modifier = true, Func = function()
   185 TargetPos[12] = { Modifier = true, Func = function()
   186 	Objective = true
   186 	Objective = true
   187 	AddCaption(loc("Training complete!"), 0xFFFFFFFF, capgrpGameState)
   187 	AddCaption(loc("Training complete!"), capcolDefault, capgrpGameState)
   188 	Info(loc("Training complete!"), loc("Good bye!"), 4, 5000)
   188 	Info(loc("Training complete!"), loc("Good bye!"), 4, 5000)
   189 
   189 
   190 	if SaucerGear ~= nil then
   190 	if SaucerGear ~= nil then
   191 		DeleteGear(SaucerGear)
   191 		DeleteGear(SaucerGear)
   192 	end
   192 	end
   290 
   290 
   291 	-- Spawn targets on the next position
   291 	-- Spawn targets on the next position
   292 	SpawnTargets()
   292 	SpawnTargets()
   293 
   293 
   294 	if TargetNumber > 1 then
   294 	if TargetNumber > 1 then
   295 		AddCaption(loc("Next target is ready!"), 0xFFFFFFFF, capgrpMessage2)
   295 		AddCaption(loc("Next target is ready!"), capcolDefault, capgrpMessage2)
   296 	end
   296 	end
   297 end
   297 end
   298 
   298 
   299 -- Returns true if the hedgehog has safely "landed" (alive, no flying saucer gear and not moving)
   299 -- Returns true if the hedgehog has safely "landed" (alive, no flying saucer gear and not moving)
   300 -- This is to ensure the training only continues when the player didn't screw up and to restart the current target
   300 -- This is to ensure the training only continues when the player didn't screw up and to restart the current target
   458 			end
   458 			end
   459 		end
   459 		end
   460 		if TargetsRemaining <= 0 then
   460 		if TargetsRemaining <= 0 then
   461 			if TargetNumber == BoomTarget or not HasHedgehogLandedYet() then
   461 			if TargetNumber == BoomTarget or not HasHedgehogLandedYet() then
   462 				if SaucerGear then
   462 				if SaucerGear then
   463 					AddCaption(loc("Objective completed! Now land safely."), 0xFFFFFFFF, capgrpMessage2)
   463 					AddCaption(loc("Objective completed! Now land safely."), capcolDefault, capgrpMessage2)
   464 				end
   464 				end
   465 				Check = true
   465 				Check = true
   466 				CheckTimer = 500
   466 				CheckTimer = 500
   467 			else
   467 			else
   468 				AutoSpawn()
   468 				AutoSpawn()
   488 	if Gear == Barrels[1] then
   488 	if Gear == Barrels[1] then
   489 		Barrels[1] = nil
   489 		Barrels[1] = nil
   490 	end
   490 	end
   491 	if Gear == Barrels[2] then
   491 	if Gear == Barrels[2] then
   492 		Barrels[2] = nil
   492 		Barrels[2] = nil
   493 		AddCaption(loc("Kaboom!"), 0xFFFFFFFF, capgrpMessage)
   493 		AddCaption(loc("Kaboom!"), capcolDefault, capgrpMessage)
   494 	end
   494 	end
   495 end
   495 end
   496 
   496 
   497 
   497 
   498 
   498 
   514 				Check = false
   514 				Check = false
   515 				GrenadeThrown = false
   515 				GrenadeThrown = false
   516 			end
   516 			end
   517 		end
   517 		end
   518 	end
   518 	end
   519 	if GrenadeExploded and TargetNumber == BoomTarget then
   519 	if GrenadeExploded and TargetNumber == BoomTarget and GetHealth(Player) then
   520 		GrenadeTimer = GrenadeTimer + 20
   520 		GrenadeTimer = GrenadeTimer + 20
   521 		if GrenadeTimer > 1500 then
   521 		if GrenadeTimer > 1500 then
   522 			GrenadeTimer = 0
   522 			GrenadeTimer = 0
   523 			GrenadeThrown = false
   523 			GrenadeThrown = false
   524 			GrenadeExploded = false
   524 			GrenadeExploded = false
   525 			if SaucerGear and TargetNumber == BoomTarget and TargetsRemaining > 0 then
   525 			if SaucerGear and TargetNumber == BoomTarget and TargetsRemaining > 0 then
   526 				PlaySound(sndShotgunReload)
   526 				PlaySound(sndShotgunReload)
   527 				AddCaption(loc("+1 Grenade"), 0xDDDD00FF, capgrpAmmoinfo)
   527 				AddCaption(loc("+1 Grenade"), GetClanColor(GetHogClan(Player)), capgrpAmmoinfo)
   528 				AddAmmo(Player, amGrenade, 1)
   528 				AddAmmo(Player, amGrenade, 1)
   529 			end
   529 			end
   530 		end
   530 		end
   531 	end
   531 	end
   532 end
   532 end
   549 	end
   549 	end
   550 end
   550 end
   551 
   551 
   552 function onGearResurrect(Gear, VGear)
   552 function onGearResurrect(Gear, VGear)
   553 	if Gear == Player then
   553 	if Gear == Player then
   554 		AddCaption(loc("Oh no! You have died. Try again!"), 0xFFFFFFFF, capgrpMessage2)
   554 		AddCaption(loc("Oh no! You have died. Try again!"), capcolDefault, capgrpMessage2)
   555 		ResetCurrentTarget()
   555 		ResetCurrentTarget()
   556 		if VGear then
   556 		if VGear then
   557 			SetVisualGearValues(VGear, GetX(Gear), GetY(Gear))
   557 			SetVisualGearValues(VGear, GetX(Gear), GetY(Gear))
   558 		end
   558 		end
   559 	end
   559 	end
   560 end
   560 end
   561 
   561 
   562 function onSkipTurn()
   562 function onSkipTurn()
   563 	AddCaption(loc("Try again!"), 0xFFFFFFFF, capgrpMessage2)
   563 	AddCaption(loc("Try again!"), capcolDefault, capgrpMessage2)
   564 	ResetCurrentTarget()
   564 	ResetCurrentTarget()
   565 end
   565 end