share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua
changeset 12608 5976d1119534
parent 12607 9bdcd73a4021
child 12609 12d4886de2b1
equal deleted inserted replaced
12607:9bdcd73a4021 12608:5976d1119534
    37 	[dialog01] = {missionName, loc("Ready for Battle?"),
    37 	[dialog01] = {missionName, loc("Ready for Battle?"),
    38 		loc("Captain Lime offered his help if you assist him in battle.").."|"..
    38 		loc("Captain Lime offered his help if you assist him in battle.").."|"..
    39 		loc("What do you want to do?").."| |"..
    39 		loc("What do you want to do?").."| |"..
    40 		loc("Fight: Press [Left]").."|"..
    40 		loc("Fight: Press [Left]").."|"..
    41 		loc("Flee: Press [Right]"), 1, 9999000},
    41 		loc("Flee: Press [Right]"), 1, 9999000},
    42 	[dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have chosen to fight!").."|"..loc("Lead the Green Bananas to battle and eliminate all the enemies!"), 1, 7000},
    42 	[dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have chosen to fight!").."|"..loc("Lead the Green Bananas to battle and eliminate all the enemies!"), 1, 5000},
    43 	[dialog03] = {missionName, loc("Time to run!"), loc("You have chosen to flee.").."|"..loc("You have to reach the left-most place on the map."), 1, 7000},
    43 	[dialog03] = {missionName, loc("Time to run!"), loc("You have chosen to flee.").."|"..loc("You have to reach the left-most place on the map."), 1, 5000},
    44 	["fight"] = {missionName, loc("Ready for Battle?"), loc("You have chosen to fight!"), 1, 1500},
    44 	["fight"] = {missionName, loc("Ready for Battle?"), loc("You have chosen to fight!"), 1, 2000},
    45 	["flee"] = {missionName, loc("Ready for Battle?"), loc("You have chosen to flee."), 1, 1500},
    45 	["flee"] = {missionName, loc("Ready for Battle?"), loc("You have chosen to flee."), 1, 2000},
       
    46 	["flee_final"] = {missionName, loc("Time to run!"), loc("Knock off the enemies from the left-most place of the map!") .. "|" .. loc("Stay there to flee!"), 1, 6000},
    46 }
    47 }
    47 -- crates
    48 -- crates
    48 local crateWMX = 2170
    49 local crateWMX = 2170
    49 local crateWMY = 1950
    50 local crateWMY = 1950
    50 local health1X = 2680
    51 local health1X = 2680
   300 		win = false
   301 		win = false
   301 	end
   302 	end
   302 	return win
   303 	return win
   303 end
   304 end
   304 
   305 
       
   306 function isHeroOnLaunchPad()
       
   307 	if not hero.dead and GetX(hero.gear) < 170 and GetY(hero.gear) > 1980 and StoppedGear(hero.gear) then
       
   308 		return true
       
   309 	end
       
   310 	return false
       
   311 end
       
   312 
       
   313 function isLaunchPadEmpty(gear)
       
   314 	local yellowTeam = { yellow1, unpack(yellowArmy) }
       
   315 	for i=1, #yellowArmy+1 do
       
   316 		if not yellowTeam[i].hidden and GetHealth(yellowTeam[i].gear) and GetX(yellowTeam[i].gear) < 170 then
       
   317 			return false
       
   318 		end
       
   319 	end
       
   320 	return true
       
   321 end
       
   322 
       
   323 function onHeroOnLaunchPadWithEnemies()
       
   324 	return isHeroOnLaunchPad() and not isLaunchPadEmpty()
       
   325 end
       
   326 
       
   327 function heroOnLaunchPadWithEnemies()
       
   328 	ShowMission(unpack(goals["flee_final"]))
       
   329 end
       
   330 
   305 function onEscapeWin(gear)
   331 function onEscapeWin(gear)
   306 	local escape = false
   332 	local escape = false
   307 	if not hero.dead and GetX(hero.gear) < 170 and GetY(hero.gear) > 1980 and StoppedGear(hero.gear) then
   333 	if isHeroOnLaunchPad() then
   308 		escape = true
   334 		escape = isLaunchPadEmpty()
   309 		local yellowTeam = { yellow1, unpack(yellowArmy) }
       
   310 		for i=1,8 do
       
   311 			if not yellowTeam[i].hidden and GetHealth(yellowTeam[i].gear) and GetX(yellowTeam[i].gear) < 170 then
       
   312 				escape = false
       
   313 				break
       
   314 			end
       
   315 		end
       
   316 	end
   335 	end
   317 	return escape
   336 	return escape
   318 end
   337 end
   319 
   338 
   320 -------------- ACTIONS ------------------
   339 -------------- ACTIONS ------------------
   335 	sendSimpleTeamRankings({teamA.name, teamD.name, teamB.name, teamC.name})
   354 	sendSimpleTeamRankings({teamA.name, teamD.name, teamB.name, teamC.name})
   336 	EndGame()
   355 	EndGame()
   337 end
   356 end
   338 
   357 
   339 function escapeWin(gear)
   358 function escapeWin(gear)
       
   359 	RemoveEventFunc(heroOnLaunchPadWithEnemies)
   340 	-- add stats
   360 	-- add stats
   341 	saveVariables()
   361 	saveVariables()
   342 	SendStat(siGameResult, loc("Hog Solo escaped successfully!"))
   362 	SendStat(siGameResult, loc("Hog Solo escaped successfully!"))
   343 	SendStat(siCustomAchievement, loc("You have reached the take-off area successfully!"))
   363 	SendStat(siCustomAchievement, loc("You have reached the take-off area successfully!"))
   344 	sendSimpleTeamRankings({teamA.name, teamD.name, teamB.name, teamC.name})
   364 	sendSimpleTeamRankings({teamA.name, teamD.name, teamB.name, teamC.name})
   355 		AddEvent(onBattleWin, {hero.gear}, battleWin, {hero.gear}, 0)
   375 		AddEvent(onBattleWin, {hero.gear}, battleWin, {hero.gear}, 0)
   356 		AddAnim(dialog02)
   376 		AddAnim(dialog02)
   357 	else
   377 	else
   358 		ShowMission(unpack(goals["flee"]))
   378 		ShowMission(unpack(goals["flee"]))
   359 		AddAmmo(green1.gear, amSwitch, 100)
   379 		AddAmmo(green1.gear, amSwitch, 100)
       
   380 		AddEvent(onHeroOnLaunchPadWithEnemies, {hero.gear}, heroOnLaunchPadWithEnemies, {hero.gear}, 0)
   360 		AddEvent(onEscapeWin, {hero.gear}, escapeWin, {hero.gear}, 0)
   381 		AddEvent(onEscapeWin, {hero.gear}, escapeWin, {hero.gear}, 0)
   361 		local greenTeam = { green2, green3, green4, green5 }
   382 		local greenTeam = { green2, green3, green4, green5 }
   362 		for i=1,4 do
   383 		for i=1,4 do
   363 			SetHogLevel(greenTeam[i].gear, 1)
   384 			SetHogLevel(greenTeam[i].gear, 1)
   364 		end
   385 		end
   401 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   422 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   402 	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
   423 	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
   403 	table.insert(dialog01, {func = AfterDialog01, args = {}})
   424 	table.insert(dialog01, {func = AfterDialog01, args = {}})
   404 	-- DIALOG 02 - Hero selects to fight
   425 	-- DIALOG 02 - Hero selects to fight
   405 	AddSkipFunction(dialog02, Skipanim, {dialog02})
   426 	AddSkipFunction(dialog02, Skipanim, {dialog02})
   406 	table.insert(dialog02, {func = AnimWait, args = {green1.gear, 400}})
       
   407 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You choose well, Hog Solo!"), SAY_SAY, 3000}})
   427 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You choose well, Hog Solo!"), SAY_SAY, 3000}})
   408 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I have only 3 hogs available and they are all cadets."), SAY_SAY, 4000}})
   428 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I have only 3 hogs available and they are all cadets."), SAY_SAY, 4000}})
   409 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("As you are more experienced, I want you to lead them to battle."), SAY_SAY, 4000}})
   429 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("As you are more experienced, I want you to lead them to battle."), SAY_SAY, 4000}})
   410 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Of course, I will observe the battle and intervene if necessary."), SAY_SAY, 5000}})
   430 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Of course, I will observe the battle and intervene if necessary."), SAY_SAY, 5000}})
   411 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 4500}})
   431 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 4500}})
   417 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
   437 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
   418 	table.insert(dialog02, {func = ShowMission, args = goals[dialog02]})
   438 	table.insert(dialog02, {func = ShowMission, args = goals[dialog02]})
   419 	table.insert(dialog02, {func = startBattle, args = {hero.gear}})
   439 	table.insert(dialog02, {func = startBattle, args = {hero.gear}})
   420 	-- DIALOG 03 - Hero selects to flee
   440 	-- DIALOG 03 - Hero selects to flee
   421 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   441 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   422 	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 400}})
       
   423 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Too bad! Then you should really leave!"), SAY_SAY, 3000}})
   442 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Too bad! Then you should really leave!"), SAY_SAY, 3000}})
   424 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Things are going to get messy around here."), SAY_SAY, 3000}})
   443 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Things are going to get messy around here."), SAY_SAY, 3000}})
   425 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Also, you should know that the only place where you can fly is the left-most part of this area."), SAY_SAY, 5000}})
   444 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Also, you should know that the only place where you can fly is the left-most part of this area."), SAY_SAY, 5000}})
   426 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("All the other places are protected by our flight-inhibiting weapons."), SAY_SAY, 4000}})
   445 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("All the other places are protected by our flight-inhibiting weapons."), SAY_SAY, 4000}})
   427 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Now go and don't waste more of my time, you coward!"), SAY_SAY, 4000}})
   446 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Now go and don't waste more of my time, you coward!"), SAY_SAY, 4000}})