share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit02.lua
changeset 14643 30d3e1d6aedf
parent 14500 dbf704b00762
child 14644 5fc5e4b79a5a
equal deleted inserted replaced
14642:bc4296649bbf 14643:30d3e1d6aedf
    65 	{ name = loc("Deadly Grape") }
    65 	{ name = loc("Deadly Grape") }
    66 }
    66 }
    67 -- Hog Solo and Green Bananas
    67 -- Hog Solo and Green Bananas
    68 teamA.name = loc("Hog Solo and GB")
    68 teamA.name = loc("Hog Solo and GB")
    69 teamA.color = -6
    69 teamA.color = -6
    70 -- Captain Lime will use a color which is almost the same as the color of teamA.
    70 -- Captain Lime can use one of 2 clan colors:
    71 -- It works, but it's a hack.
    71 -- One when being friendly (same as hero), and a different one when he turns evil.
    72 -- Technically, this makes Captain Lime an enemy team in the mission but for the player
    72 -- Captain Lime be in his own clan.
    73 -- it looks like an ally. This is because Camptain Lime starts friendly (story-wise),
       
    74 -- but might become your enemy during the course of this mission.
       
    75 -- TODO: For teamB, use same color of teamA when friendly, change color when evil
       
    76 teamB.name = loc("Captain Lime")
    73 teamB.name = loc("Captain Lime")
       
    74 teamB.colorNice = teamA.color
       
    75 teamB.colorEvil = -5
    77 teamC.name = loc("Fruit Assassins")
    76 teamC.name = loc("Fruit Assassins")
    78 teamC.color = -1
    77 teamC.color = -1
    79 
    78 
    80 function onGameInit()
    79 function onGameInit()
    81 	GameFlags = gfDisableWind
    80 	GameFlags = gfDisableWind
   130 	green3.gear = AddHog(green3.name, 0, 100, green3.hat)
   129 	green3.gear = AddHog(green3.name, 0, 100, green3.hat)
   131 	SetGearPosition(green3.gear, green3.x, green3.y)
   130 	SetGearPosition(green3.gear, green3.x, green3.y)
   132 	HogTurnLeft(green3.gear, true)
   131 	HogTurnLeft(green3.gear, true)
   133 
   132 
   134 	-- Captain Lime
   133 	-- Captain Lime
   135 	-- Returns a color that is as close as possible to the color argument
   134         -- Spawn with his "true" evil color so a new clan is created for Captain Lime ...
   136 	-- but does not equal color and otherCollision.
   135 	AddTeam(teamB.name, teamB.colorEvil, "Cherry", "Island", "Default", "congo-brazzaville")
   137 	local getSimilarColor = function(color, otherCollision)
   136 	green1.gear = AddHog(green1.name, 0, 100, green1.hat)
   138 		local goingUp = false
   137 	-- ... however, we immediately change the color to "nice mode".
   139 		local collision1 = color
   138 	-- Captain Lime starts as (seemingly) friendly in this mission.
   140 		while(color == collision1 or color == otherCollision) do
   139 	SetClanColor(GetHogClan(green1.gear), teamB.colorNice)
   141 			-- Try out colors by varying the blue color component until
       
   142 			-- we don't collide with any of the 2 colors.
       
   143 			if ((color % 0x100) > 0) and (not goingUp) then
       
   144 				color = color - 0x1
       
   145 			else
       
   146 				goingUp = true
       
   147 				color = color + 0x1
       
   148 			end
       
   149 		end
       
   150 		return color
       
   151 	end
       
   152 	-- Captain Lime gets a fake color clore to hero's clan color.
       
   153 	-- This is a hack, but it works. See explanation at top of file
       
   154 	local cptnColor = getSimilarColor(heroColor, assassinsColor)
       
   155 	AddTeam(teamB.name, cptnColor, "Cherry", "Island", "Default", "congo-brazzaville")
       
   156 	green1.gear= AddHog(green1.name, 0, 100, green1.hat)
       
   157 	SetGearPosition(green1.gear, green1.x, green1.y)
   140 	SetGearPosition(green1.gear, green1.x, green1.y)
   158 
   141 
   159 	-- Populate goals table
   142 	-- Populate goals table
   160 	goals = {
   143 	goals = {
   161 		[dialog01] = {missionName, loc("Exploring the tunnel"), loc("Search for the device with the help of the other hedgehogs.").."|"..string.format(loc("%s must collect the final crates."), hero.name) .. "|" .. minesTimeText, 1, 4000},
   144 		[dialog01] = {missionName, loc("Exploring the tunnel"), loc("Search for the device with the help of the other hedgehogs.").."|"..string.format(loc("%s must collect the final crates."), hero.name) .. "|" .. minesTimeText, 1, 4000},
   571 end
   554 end
   572 
   555 
   573 function makeCptLimeEvil()
   556 function makeCptLimeEvil()
   574 	-- Turn Captain Lime evil
   557 	-- Turn Captain Lime evil
   575 	SetHogLevel(green1.gear, 1)
   558 	SetHogLevel(green1.gear, 1)
       
   559 	-- ... and reveal his "true" evil color. Muhahaha!
       
   560 	SetClanColor(GetHogClan(green1.gear), teamB.colorEvil)
   576 	EndTurn(true)
   561 	EndTurn(true)
   577 end
   562 end
   578 
   563 
   579 function goToThesurface()
   564 function goToThesurface()
   580 	EndTurn(true)
   565 	EndTurn(true)