share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit02.lua
changeset 12528 7b32e83aaf48
parent 12520 22f2a586b9ca
child 12538 952afc3d2df2
equal deleted inserted replaced
12527:b0492168f1ad 12528:7b32e83aaf48
    26 	[dialog02] = {missionName, loc("Exploring the tunnel"), loc("Explore the tunnel with the other hedgehogs and search for the device").."|"..loc("Hog Solo has to reach the last crates") .. "|" .. minesTimeText, 1, 4000},
    26 	[dialog02] = {missionName, loc("Exploring the tunnel"), loc("Explore the tunnel with the other hedgehogs and search for the device").."|"..loc("Hog Solo has to reach the last crates") .. "|" .. minesTimeText, 1, 4000},
    27 	[dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back").."|"..minesTimeText, 1, 4000},
    27 	[dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back").."|"..minesTimeText, 1, 4000},
    28 	[dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assassins before they attack back").."|"..minesTimeText, 1, 4000},
    28 	[dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assassins before they attack back").."|"..minesTimeText, 1, 4000},
    29 }
    29 }
    30 -- crates
    30 -- crates
       
    31 local girderCrate = {name = amGirder, x = 1680, y = 1160}
       
    32 
    31 local eagleCrate = {name = amDEagle, x = 1680, y = 1650}
    33 local eagleCrate = {name = amDEagle, x = 1680, y = 1650}
    32 local girderCrate =	{name = amGirder, x = 1680, y = 1160}
    34 
       
    35 local weaponCrate = { x = 1320, y = 1870}
       
    36 local deviceCrate = { gear = nil, x = 1360, y = 1870}
    33 local ropeCrate = {name = amRope, x = 1400, y = 1870}
    37 local ropeCrate = {name = amRope, x = 1400, y = 1870}
    34 local weaponCrate = { x = 1360, y = 1870}
       
    35 -- hogs
    38 -- hogs
    36 local hero = {}
    39 local hero = {}
    37 local green1 = {}
    40 local green1 = {}
    38 local green2 = {}
    41 local green2 = {}
    39 local green3 = {}
    42 local green3 = {}
   123 	if GetCampaignVar("Fruit01JoinedBattle") and GetCampaignVar("Fruit01JoinedBattle") == "true" then
   126 	if GetCampaignVar("Fruit01JoinedBattle") and GetCampaignVar("Fruit01JoinedBattle") == "true" then
   124 		tookPartInBattle = true
   127 		tookPartInBattle = true
   125 	end
   128 	end
   126 
   129 
   127 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   130 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   128 	AddEvent(onDeviceCrates, {hero.gear}, deviceCrates, {hero.gear}, 0)
   131 	AddEvent(onDeviceCrates, {hero.gear}, deviceCrateEvent, {hero.gear}, 0)
   129 
   132 
   130 	-- Hog Solo and GB weapons
   133 	-- Hog Solo and GB weapons
   131 	AddAmmo(hero.gear, amSwitch, 100)
   134 	AddAmmo(hero.gear, amSwitch, 100)
   132 	-- Captain Lime weapons
   135 	-- Captain Lime weapons
   133 	AddAmmo(green1.bot, amBazooka, 6)
   136 	AddAmmo(green1.bot, amBazooka, 6)
   183 	end
   186 	end
   184 
   187 
   185 	-- place crates
   188 	-- place crates
   186 	SpawnUtilityCrate(girderCrate.x, girderCrate.y, girderCrate.name)
   189 	SpawnUtilityCrate(girderCrate.x, girderCrate.y, girderCrate.name)
   187 	SpawnAmmoCrate(eagleCrate.x, eagleCrate.y, eagleCrate.name)
   190 	SpawnAmmoCrate(eagleCrate.x, eagleCrate.y, eagleCrate.name)
   188 	SpawnUtilityCrate(ropeCrate.x, ropeCrate.y, ropeCrate.name)
   191 	deviceCrate.gear = SpawnFakeUtilityCrate(deviceCrate.x, deviceCrate.y, false, false) -- anti-gravity device
       
   192 	-- Rope crate is placed after device crate has been collected.
       
   193 	-- This is done so it is impossible the player can rope before getting
       
   194 	-- the device part.
   189 
   195 
   190 	if tookPartInBattle then
   196 	if tookPartInBattle then
   191 		SpawnAmmoCrate(weaponCrate.x, weaponCrate.y, amWatermelon)
   197 		SpawnAmmoCrate(weaponCrate.x, weaponCrate.y, amWatermelon)
   192 	else
   198 	else
   193 		SpawnAmmoCrate(weaponCrate.x, weaponCrate.y, amSniperRifle)
   199 		SpawnAmmoCrate(weaponCrate.x, weaponCrate.y, amSniperRifle)
   246 function onGearDelete(gear)
   252 function onGearDelete(gear)
   247 	if gear == hero.gear then
   253 	if gear == hero.gear then
   248 		hero.dead = true
   254 		hero.dead = true
   249 	elseif gear == green1.bot then
   255 	elseif gear == green1.bot then
   250 		green1.dead = true
   256 		green1.dead = true
       
   257 	elseif gear == deviceCrate.gear then
       
   258 		if band(GetGearMessage(gear), gmDestroy) ~= 0 then
       
   259 			PlaySound(sndShotgunReload)
       
   260 			AddCaption(loc("Anti-Gravity Device Part (+1)"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate)
       
   261 			deviceCrate.collected = true
       
   262 			-- Spawn rope crate
       
   263 			SpawnUtilityCrate(ropeCrate.x, ropeCrate.y, ropeCrate.name)
       
   264 		end
   251 	end
   265 	end
   252 end
   266 end
   253 
   267 
   254 function onGearDamage(gear, damage)
   268 function onGearDamage(gear, damage)
   255 	if GetGearType(gear) == gtCase then
   269 	if GetGearType(gear) == gtCase then
   287 	end
   301 	end
   288 	return false
   302 	return false
   289 end
   303 end
   290 
   304 
   291 function onDeviceCrates(gear)
   305 function onDeviceCrates(gear)
   292 	if not hero.dead and GetY(hero.gear)>1850 and GetX(hero.gear)>1340 and GetX(hero.gear)<1640 then
   306 	if not hero.dead and deviceCrate.collected and StoppedGear(hero.gear) then
   293 		return true
   307 		return true
   294 	end
   308 	end
   295 	return false
   309 	return false
   296 end
   310 end
   297 
   311 
   339 		EndGame()
   353 		EndGame()
   340 		ended = true
   354 		ended = true
   341 	end
   355 	end
   342 end
   356 end
   343 
   357 
   344 function deviceCrates(gear)
   358 function deviceCrateEvent(gear)
   345 	EndTurn(true)
   359 	SetGearMessage(hero.gear, 0)
   346 	if not tookPartInBattle then
   360 	if not tookPartInBattle then
   347 		AddAnim(dialog03)
   361 		AddAnim(dialog03)
   348 	else
   362 	else
   349 		for i=1,table.getn(redHedgehogs) do
   363 		for i=1,table.getn(redHedgehogs) do
   350 			RestoreHog(redHedgehogs[i].gear)
   364 			RestoreHog(redHedgehogs[i].gear)
   436 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 1800}})
   450 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 1800}})
   437 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Okay then!"), SAY_SAY, 2000}})
   451 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Okay then!"), SAY_SAY, 2000}})
   438 	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
   452 	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
   439 	-- DIALOG03 - At crates, hero learns that Captain Lime is bad
   453 	-- DIALOG03 - At crates, hero learns that Captain Lime is bad
   440 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   454 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   441 	table.insert(dialog03, {func = AnimWait, args = {hero.gear, 4000}})
   455 	table.insert(dialog03, {func = AnimWait, args = {hero.gear, 1250}})
   442 	table.insert(dialog03, {func = FollowGear, args = {hero.gear}})
   456 	table.insert(dialog03, {func = FollowGear, args = {hero.gear}})
   443 	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}})
   457 	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}})
   444 	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}})
   458 	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}})
   445 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("This Hog Solo is so naive! When he returns I'll shoot him and keep that device for myself!"), SAY_THINK, 4000}})
   459 	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("This Hog Solo is so naive! When he returns I'll shoot him and keep that device for myself!"), SAY_THINK, 4000}})
   446 	table.insert(dialog03, {func = goToThesurface, args = {hero.gear}})
   460 	table.insert(dialog03, {func = goToThesurface, args = {hero.gear}})