share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit02.lua
changeset 14644 5fc5e4b79a5a
parent 14643 30d3e1d6aedf
child 14898 4596357d002d
equal deleted inserted replaced
14643:30d3e1d6aedf 14644:5fc5e4b79a5a
    93 	local health = 100
    93 	local health = 100
    94 
    94 
    95 
    95 
    96 	-- Fruit Assassins
    96 	-- Fruit Assassins
    97 	local assasinsHats = { "NinjaFull", "NinjaStraight", "NinjaTriangle" }
    97 	local assasinsHats = { "NinjaFull", "NinjaStraight", "NinjaTriangle" }
    98 	AddTeam(teamC.name, teamC.color, "bp2", "Island", "Default", "cm_scout")
    98 	teamC.name = AddTeam(teamC.name, teamC.color, "bp2", "Island", "Default", "cm_scout")
    99 	for i=1,table.getn(redHedgehogs) do
    99 	for i=1,table.getn(redHedgehogs) do
   100 		redHedgehogs[i].gear =  AddHog(redHedgehogs[i].name, 1, 100, assasinsHats[GetRandom(3)+1])
   100 		redHedgehogs[i].gear =  AddHog(redHedgehogs[i].name, 1, 100, assasinsHats[GetRandom(3)+1])
   101 		SetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630)
   101 		SetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630)
   102 	end
   102 	end
   103 	local assassinsColor = div(GetClanColor(GetHogClan(redHedgehogs[1].gear)), 0x100)
   103 	local assassinsColor = div(GetClanColor(GetHogClan(redHedgehogs[1].gear)), 0x100)
   130 	SetGearPosition(green3.gear, green3.x, green3.y)
   130 	SetGearPosition(green3.gear, green3.x, green3.y)
   131 	HogTurnLeft(green3.gear, true)
   131 	HogTurnLeft(green3.gear, true)
   132 
   132 
   133 	-- Captain Lime
   133 	-- Captain Lime
   134         -- Spawn with his "true" evil color so a new clan is created for Captain Lime ...
   134         -- Spawn with his "true" evil color so a new clan is created for Captain Lime ...
   135 	AddTeam(teamB.name, teamB.colorEvil, "Cherry", "Island", "Default", "congo-brazzaville")
   135 	teamB.name = AddTeam(teamB.name, teamB.colorEvil, "Cherry", "Island", "Default", "congo-brazzaville")
       
   136 	SetTeamPassive(teamB.name, true)
   136 	green1.gear = AddHog(green1.name, 0, 100, green1.hat)
   137 	green1.gear = AddHog(green1.name, 0, 100, green1.hat)
   137 	-- ... however, we immediately change the color to "nice mode".
   138 	-- ... however, we immediately change the color to "nice mode".
   138 	-- Captain Lime starts as (seemingly) friendly in this mission.
   139 	-- Captain Lime starts as (seemingly) friendly in this mission.
   139 	SetClanColor(GetHogClan(green1.gear), teamB.colorNice)
   140 	SetClanColor(GetHogClan(green1.gear), teamB.colorNice)
   140 	SetGearPosition(green1.gear, green1.x, green1.y)
   141 	SetGearPosition(green1.gear, green1.x, green1.y)
   229 	SendHealthStatsOff()
   230 	SendHealthStatsOff()
   230 end
   231 end
   231 
   232 
   232 function onNewTurn()
   233 function onNewTurn()
   233 	if not inBattle and CurrentHedgehog == green1.gear then
   234 	if not inBattle and CurrentHedgehog == green1.gear then
   234 		EndTurn(true)
   235 		SkipTurn()
   235 	elseif (not inBattle) and GetHogTeamName(CurrentHedgehog) == teamA.name then
   236 	elseif (not inBattle) and GetHogTeamName(CurrentHedgehog) == teamA.name then
   236 		if CurrentHedgehog ~= hero.gear then
   237 		if CurrentHedgehog ~= hero.gear then
   237 			SwitchHog(hero.gear)
   238 			AnimSwitchHog(hero.gear)
   238 		end
   239 		end
   239 		SetTurnTimeLeft(MAX_TURN_TIME)
   240 		SetTurnTimeLeft(MAX_TURN_TIME)
   240 		wind()
   241 		wind()
   241 	elseif inBattle then
   242 	elseif inBattle then
   242 		if CurrentHedgehog == green1.gear and previousHog ~= hero.gear then
   243 		if CurrentHedgehog == green1.gear and previousHog ~= hero.gear then
   243 			EndTurn(true)
   244 			SkipTurn()
   244 			return
   245 			return
   245 		end
   246 		end
   246 		for i=1,table.getn(redHedgehogs) do
   247 		for i=1,table.getn(redHedgehogs) do
   247 			if CurrentHedgehog == redHedgehogs[i].gear and previousHog ~= hero.gear then
   248 			if CurrentHedgehog == redHedgehogs[i].gear and previousHog ~= hero.gear then
   248 				EndTurn(true)
   249 				SkipTurn()
   249 				return
   250 				return
   250 			end
   251 			end
   251 		end
   252 		end
   252 		SetTurnTimeLeft(20000)
   253 		SetTurnTimeLeft(20000)
   253 		wind()
   254 		wind()
   286 		if band(GetGearMessage(gear), gmDestroy) ~= 0 then
   287 		if band(GetGearMessage(gear), gmDestroy) ~= 0 then
   287 			PlaySound(sndShotgunReload)
   288 			PlaySound(sndShotgunReload)
   288 			AddCaption(loc("Anti-Gravity Device Part (+1)"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate)
   289 			AddCaption(loc("Anti-Gravity Device Part (+1)"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate)
   289 			deviceCrate.collected = true
   290 			deviceCrate.collected = true
   290 			deviceCrate.collector = CurrentHedgehog
   291 			deviceCrate.collector = CurrentHedgehog
   291 			-- Spawn rope crate
       
   292 			SpawnSupplyCrate(ropeCrate.x, ropeCrate.y, ropeCrate.name)
       
   293 		end
   292 		end
   294 	end
   293 	end
   295 end
   294 end
   296 
   295 
   297 function onGearDamage(gear, damage)
   296 function onGearDamage(gear, damage)
   465 -------------- ANIMATIONS ------------------
   464 -------------- ANIMATIONS ------------------
   466 
   465 
   467 function Skipanim(anim)
   466 function Skipanim(anim)
   468 	if goals[anim] ~= nil then
   467 	if goals[anim] ~= nil then
   469 		ShowMission(unpack(goals[anim]))
   468 		ShowMission(unpack(goals[anim]))
       
   469 	end
       
   470 	if anim == dialog03 or anim == dialog04 then
       
   471 		spawnRopeCrate()
   470 	end
   472 	end
   471 	if anim == dialog03 then
   473 	if anim == dialog03 then
   472 		makeCptLimeEvil()
   474 		makeCptLimeEvil()
   473 	elseif anim == dialog05 then
   475 	elseif anim == dialog05 then
   474 		heroIsAStupidFool()
   476 		heroIsAStupidFool()
   511 	table.insert(dialog03, {func = FollowGear, args = {hero.gear}})
   513 	table.insert(dialog03, {func = FollowGear, args = {hero.gear}})
   512 	table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}})
   514 	table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}})
   513 	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}})
   515 	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}})
   514 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, string.format(loc("This %s is so naive! I'm going to shoot this fool so I can keep that device for myself!"), hero.name), SAY_THINK, 4000}})
   516 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, string.format(loc("This %s is so naive! I'm going to shoot this fool so I can keep that device for myself!"), hero.name), SAY_THINK, 4000}})
   515 	table.insert(dialog03, {func = ShowMission, args = goals[dialog03]})
   517 	table.insert(dialog03, {func = ShowMission, args = goals[dialog03]})
       
   518 	table.insert(dialog03, {func = spawnRopeCrate, args = {hero.gear}})
   516 	table.insert(dialog03, {func = makeCptLimeEvil, args = {hero.gear}})
   519 	table.insert(dialog03, {func = makeCptLimeEvil, args = {hero.gear}})
   517 	-- DIALOG04 - At crates, hero learns about the Assassins ambush
   520 	-- DIALOG04 - At crates, hero learns about the Assassins ambush
   518 	AddSkipFunction(dialog04, Skipanim, {dialog04})
   521 	AddSkipFunction(dialog04, Skipanim, {dialog04})
   519 	table.insert(dialog04, {func = AnimWait, args = {hero.gear, 2000}})
   522 	table.insert(dialog04, {func = AnimWait, args = {hero.gear, 2000}})
   520 	table.insert(dialog04, {func = FollowGear, args = {hero.gear}})
   523 	table.insert(dialog04, {func = FollowGear, args = {hero.gear}})
   521 	table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}})
   524 	table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}})
   522 	table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}})
   525 	table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}})
   523 	table.insert(dialog04, {func = AnimSay, args = {redHedgehogs[1].gear, loc("We have spotted the enemy! We'll attack when the enemies start gathering!"), SAY_THINK, 4000}})
   526 	table.insert(dialog04, {func = AnimSay, args = {redHedgehogs[1].gear, loc("We have spotted the enemy! We'll attack when the enemies start gathering!"), SAY_THINK, 4000}})
   524 	table.insert(dialog04, {func = ShowMission, args = goals[dialog04]})
   527 	table.insert(dialog04, {func = ShowMission, args = goals[dialog04]})
       
   528 	table.insert(dialog04, {func = spawnRopeCrate, args = {hero.gear}})
   525 	table.insert(dialog04, {func = goToThesurface, args = {hero.gear}})
   529 	table.insert(dialog04, {func = goToThesurface, args = {hero.gear}})
   526 end
   530 end
   527 
   531 
   528 function AnimationSetup05(collector)
   532 function AnimationSetup05(collector)
   529 	-- DIALOG05 - A member or the green bananas collected the target crate and steals it. Player loses
   533 	-- DIALOG05 - A member or the green bananas collected the target crate and steals it. Player loses
   554 end
   558 end
   555 
   559 
   556 function makeCptLimeEvil()
   560 function makeCptLimeEvil()
   557 	-- Turn Captain Lime evil
   561 	-- Turn Captain Lime evil
   558 	SetHogLevel(green1.gear, 1)
   562 	SetHogLevel(green1.gear, 1)
       
   563 	SetTeamPassive(teamB.name, false)
   559 	-- ... and reveal his "true" evil color. Muhahaha!
   564 	-- ... and reveal his "true" evil color. Muhahaha!
   560 	SetClanColor(GetHogClan(green1.gear), teamB.colorEvil)
   565 	SetClanColor(GetHogClan(green1.gear), teamB.colorEvil)
   561 	EndTurn(true)
   566 	EndTurn(true)
       
   567 end
       
   568 
       
   569 function spawnRopeCrate()
       
   570 	-- should be spawned after the device part was gotten and the cut scene finished.
       
   571 	SpawnSupplyCrate(ropeCrate.x, ropeCrate.y, ropeCrate.name)
   562 end
   572 end
   563 
   573 
   564 function goToThesurface()
   574 function goToThesurface()
   565 	EndTurn(true)
   575 	EndTurn(true)
   566 end
   576 end