share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua
changeset 12529 89d3c3ebc925
parent 12522 228ebbc8656d
child 12530 00d3c280034b
equal deleted inserted replaced
12528:7b32e83aaf48 12529:89d3c3ebc925
    20 local heroDamageAtCurrentTurn = 0
    20 local heroDamageAtCurrentTurn = 0
    21 -- dialogs
    21 -- dialogs
    22 local dialog01 = {}
    22 local dialog01 = {}
    23 local dialog02 = {}
    23 local dialog02 = {}
    24 -- mission objectives
    24 -- mission objectives
       
    25 local goToThantaString = loc("Go to Thanta and get the device part!")
    25 local goals = {
    26 local goals = {
    26 	[dialog01] = {missionName, loc("Getting ready"), loc("Collect the icegun and get the device part from Thanta") .. "|" .. loc("Mines time: 0 seconds"), 1, 4500},
    27 	[dialog01] = {missionName, loc("Getting ready"), loc("Collect the freezer and get the device part from Thanta") .. "|" .. loc("Mines time: 0 seconds"), 1, 4500},
    27 	[dialog02] = {missionName, loc("Win"), loc("Congratulations, you collected the device part!"), 1, 3500},
    28 	["checkpoint"] = {missionName, loc("Objectives"), goToThantaString .. "|" .. loc("Mines time: 0 seconds"), 1, 4500},
    28 }
    29 }
    29 -- crates
    30 -- crates
    30 local icegunY = 1950
    31 local icegunY = 1950
    31 local icegunX = 260
    32 local icegunX = 260
    32 -- hogs
    33 -- hogs
   207 	AddAmmo(bandit3.gear, amMine, 2)
   208 	AddAmmo(bandit3.gear, amMine, 2)
   208 	AddAmmo(bandit3.gear, amGrenade, 3)
   209 	AddAmmo(bandit3.gear, amGrenade, 3)
   209 	AddAmmo(bandit4.gear, amBazooka, 5)
   210 	AddAmmo(bandit4.gear, amBazooka, 5)
   210 	AddAmmo(bandit5.gear, amBazooka, 5)
   211 	AddAmmo(bandit5.gear, amBazooka, 5)
   211 
   212 
   212 	goToThantaString = loc("Go to Thanta and get the device part!")
       
   213 
       
   214 	if checkPointReached == 1 then
   213 	if checkPointReached == 1 then
   215 		AddAmmo(hero.gear, amBazooka, 1)
   214 		AddAmmo(hero.gear, amBazooka, 1)
   216 		SpawnAmmoCrate(icegunX, icegunY, amIceGun)
   215 		SpawnAmmoCrate(icegunX, icegunY, amIceGun)
   217 		AddEvent(onColumnCheckPoint, {hero.gear}, columnCheckPoint, {hero.gear}, 0)
   216 		AddEvent(onColumnCheckPoint, {hero.gear}, columnCheckPoint, {hero.gear}, 0)
   218 		AddEvent(onHeroAtIceGun, {hero.gear}, heroAtIceGun, {hero.gear}, 0)
   217 		AddEvent(onHeroAtIceGun, {hero.gear}, heroAtIceGun, {hero.gear}, 0)
   219 		AddAnim(dialog01)
   218 		AddAnim(dialog01)
   220 	elseif checkPointReached == 2 then
   219 	elseif checkPointReached == 2 then
   221 		AddAmmo(hero.gear, amIceGun, 8)
   220 		AddAmmo(hero.gear, amIceGun, 8)
   222 		AnimCaption(hero.gear, goToThantaString, 5000)
   221 		AnimCaption(hero.gear, goToThantaString, 5000)
       
   222 		ShowMission(unpack(goals["checkpoint"]))
   223 	elseif checkPointReached == 3 then
   223 	elseif checkPointReached == 3 then
   224 		AddAmmo(hero.gear, amIceGun, 6)
   224 		AddAmmo(hero.gear, amIceGun, 6)
   225 		AnimCaption(hero.gear, goToThantaString, 5000)
   225 		AnimCaption(hero.gear, goToThantaString, 5000)
       
   226 		ShowMission(unpack(goals["checkpoint"]))
   226 	end
   227 	end
   227 
   228 
   228 	SendHealthStatsOff()
   229 	SendHealthStatsOff()
   229 end
   230 end
   230 
   231 
   432 end
   433 end
   433 
   434 
   434 function heroDeath(gear)
   435 function heroDeath(gear)
   435 	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
   436 	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
   436 	SendStat(siCustomAchievement, loc("To win the game you have to stand next to Thanta."))
   437 	SendStat(siCustomAchievement, loc("To win the game you have to stand next to Thanta."))
   437 	SendStat(siCustomAchievement, loc("Most of the time you'll be able to use the icegun only."))
   438 	SendStat(siCustomAchievement, loc("Most of the time you'll be able to use the freezer only."))
   438 	SendStat(siCustomAchievement, loc("Use the bazooka and the flying saucer to get the icegun."))
   439 	SendStat(siCustomAchievement, loc("Use the bazooka and the flying saucer to get the freezer."))
   439 	SendStat(siPlayerKills,'1',teamB.name)
   440 	SendStat(siPlayerKills,'1',teamB.name)
   440 	SendStat(siPlayerKills,'0',teamC.name)
   441 	SendStat(siPlayerKills,'0',teamC.name)
   441 	EndGame()
   442 	EndGame()
   442 end
   443 end
   443 
   444 
   459 
   460 
   460 function thantaDeath(gear)
   461 function thantaDeath(gear)
   461 	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
   462 	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
   462 	SendStat(siCustomAchievement, loc("Noo, Thanta has to stay alive!"))
   463 	SendStat(siCustomAchievement, loc("Noo, Thanta has to stay alive!"))
   463 	SendStat(siCustomAchievement, loc("To win the game you have to go next to Thanta."))
   464 	SendStat(siCustomAchievement, loc("To win the game you have to go next to Thanta."))
   464 	SendStat(siCustomAchievement, loc("Most of the time you'll be able to use the icegun only."))
   465 	SendStat(siCustomAchievement, loc("Most of the time you'll be able to use the freezer only."))
   465 	SendStat(siCustomAchievement, loc("Use the bazooka and the flying saucer to get the icegun."))
   466 	SendStat(siCustomAchievement, loc("Use the bazooka and the flying saucer to get the freezer."))
   466 	SendStat(siPlayerKills,'1',teamB.name)
   467 	SendStat(siPlayerKills,'1',teamB.name)
   467 	SendStat(siPlayerKills,'0',teamC.name)
   468 	SendStat(siPlayerKills,'0',teamC.name)
   468 	EndGame()
   469 	EndGame()
   469 end
   470 end
   470 
   471 
   471 function heroWin(gear)
   472 function heroWin(gear)
   472 	TurnTimeLeft=0
   473 	SetGearMessage(gear, 0)
   473 	if GetX(hero.gear) < GetX(bandit1.gear) then
   474 	if GetX(hero.gear) < GetX(bandit1.gear) then
   474 		HogTurnLeft(bandit1.gear, true)
   475 		HogTurnLeft(bandit1.gear, true)
   475 	else
   476 	else
   476 		HogTurnLeft(bandit1.gear, false)
   477 		HogTurnLeft(bandit1.gear, false)
   477 	end
   478 	end
   481 -------------- ANIMATIONS ------------------
   482 -------------- ANIMATIONS ------------------
   482 
   483 
   483 function Skipanim(anim)
   484 function Skipanim(anim)
   484 	if goals[anim] ~= nil then
   485 	if goals[anim] ~= nil then
   485 		ShowMission(unpack(goals[anim]))
   486 		ShowMission(unpack(goals[anim]))
   486     end
   487 	end
   487     if anim == dialog02 then
   488 	if anim == dialog02 then
   488 		actionsOnWin()
   489 		actionsOnWin()
   489 	else
   490 	else
   490 		AnimSwitchHog(hero.gear)
   491 		AnimSwitchHog(hero.gear)
   491 	end
   492 	end
   492 end
   493 end
   507 	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 4000}})
   508 	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 4000}})
   508 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Be careful, your gadgets won't work in the bandit area. You should get an ice gun."), SAY_SAY, 7000}})
   509 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Be careful, your gadgets won't work in the bandit area. You should get an ice gun."), SAY_SAY, 7000}})
   509 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("There is one below us!"), SAY_SAY, 4000}})
   510 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("There is one below us!"), SAY_SAY, 4000}})
   510 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   511 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   511 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   512 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   512 	-- DIALOG 02 - Hero got to Thant2
   513 	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
       
   514 	-- DIALOG 02 - Hero got to Thanta
   513 	AddSkipFunction(dialog02, Skipanim, {dialog02})
   515 	AddSkipFunction(dialog02, Skipanim, {dialog02})
   514 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}})
   516 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}})
   515 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Congratulations, now you can take Thanta's device part!"), 5000}})
       
   516 	table.insert(dialog02, {func = AnimSay, args = {bandit1.gear, loc("Oh! Please spare me. You can take all my treasures!"), SAY_SAY, 3000}})
   517 	table.insert(dialog02, {func = AnimSay, args = {bandit1.gear, loc("Oh! Please spare me. You can take all my treasures!"), SAY_SAY, 3000}})
   517 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
   518 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
   518 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I just want the strange device you found!"), SAY_SAY, 3000}})
   519 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I just want the strange device you found!"), SAY_SAY, 3000}})
   519 	table.insert(dialog02, {func = AnimWait, args = {bandit1.gear, 4000}})
   520 	table.insert(dialog02, {func = AnimWait, args = {bandit1.gear, 4000}})
   520 	table.insert(dialog02, {func = AnimSay, args = {bandit1.gear, loc("Here! Take it!"), SAY_SAY, 3000}})
   521 	table.insert(dialog02, {func = AnimSay, args = {bandit1.gear, loc("Here! Take it!"), SAY_SAY, 3000}})
   522 end
   523 end
   523 
   524 
   524 -------------- Other Functions -------------------
   525 -------------- Other Functions -------------------
   525 
   526 
   526 function actionsOnWin()
   527 function actionsOnWin()
       
   528 	AddCaption(loc("Anti-Gravity Device Part (+1)"), GetClanColor(GetHogClan(hero.gear)), capgrpAmmoinfo)
       
   529 	PlaySound(sndShotgunReload)
       
   530 
       
   531 	ShowMission(missionName, loc("Win"), loc("Congratulations, you collected the device part!"), 1, 3500)
       
   532 
   527 	saveCompletedStatus(4)
   533 	saveCompletedStatus(4)
   528 	SendStat(siGameResult, loc("Congratulations, you acquired the device part!"))
   534 	SendStat(siGameResult, loc("Congratulations, you acquired the device part!"))
   529 	SendStat(siCustomAchievement, string.format(loc("At the end of the game your health was %d."), GetHealth(hero.gear)))
   535 	SendStat(siCustomAchievement, string.format(loc("At the end of the game your health was %d."), GetHealth(hero.gear)))
   530 	-- maybe add number of tries for each part?
   536 	-- maybe add number of tries for each part?
   531 	SendStat(siPlayerKills,'1',teamC.name)
   537 	SendStat(siPlayerKills,'1',teamC.name)