share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon02.lua
branchspacecampaign
changeset 9613 142ba1d08205
parent 9612 825856c67563
child 9614 7fa70d381c75
equal deleted inserted replaced
9612:825856c67563 9613:142ba1d08205
    15 local currentPosition = 1
    15 local currentPosition = 1
    16 local previousTimeLeft = 0
    16 local previousTimeLeft = 0
    17 local startChallenge = false
    17 local startChallenge = false
    18 -- dialogs
    18 -- dialogs
    19 local dialog01 = {}
    19 local dialog01 = {}
       
    20 local dialog02 = {}
    20 -- mission objectives
    21 -- mission objectives
    21 local goals = {
    22 local goals = {
    22 	[dialog01] = {missionName, loc("Challenge Objectives"), challengeObjectives, 1, 4500},
    23 	[dialog01] = {missionName, loc("Challenge Objectives"), challengeObjectives, 1, 4500},
    23 }
    24 }
    24 -- hogs
    25 -- hogs
    82 	
    83 	
    83 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
    84 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
    84 	
    85 	
    85 	AddAmmo(hero.gear, amRope, 1)
    86 	AddAmmo(hero.gear, amRope, 1)
    86 	AddAmmo(hero.gear, amSkip, 1)
    87 	AddAmmo(hero.gear, amSkip, 1)
    87 	AddAmmo(hero.gear, amTeleport, 100)
       
    88 	
    88 	
    89 	SendHealthStatsOff()
    89 	SendHealthStatsOff()
    90 	hogTurn = runner.gear
    90 	hogTurn = runner.gear
    91 	AddAnim(dialog01)
    91 	AddAnim(dialog01)
    92 end
    92 end
    93 
    93 
    94 function onNewTurn()
    94 function onNewTurn()
    95 	WriteLnToConsole("NEW TURN "..CurrentHedgehog)
       
    96 	if startChallenge then
    95 	if startChallenge then
    97 		if CurrentHedgehog ~= hero.gear then
    96 		if CurrentHedgehog ~= hero.gear then
    98 			TurnTimeLeft = 0
    97 			TurnTimeLeft = 0
    99 		else
    98 		else
   100 			if GetAmmoCount(hero.gear, amRope) == 0  then
    99 			if GetAmmoCount(hero.gear, amRope) == 0  then
   138 
   137 
   139 -------------- ACTIONS ------------------
   138 -------------- ACTIONS ------------------
   140 
   139 
   141 function heroDeath(gear)
   140 function heroDeath(gear)
   142 	-- game over
   141 	-- game over
   143 	WriteLnToConsole("END GAME 1")
       
   144 	EndGame()
   142 	EndGame()
   145 end
   143 end
   146 
   144 
   147 -------------- ANIMATIONS ------------------
   145 -------------- ANIMATIONS ------------------
   148 
   146 
   162 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the other side of the moon..."), 5000}})
   160 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the other side of the moon..."), 5000}})
   163 	table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("So you are interested in Pr. Hogevil"), SAY_SAY, 3000}})
   161 	table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("So you are interested in Pr. Hogevil"), SAY_SAY, 3000}})
   164 	table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("We'll play a game first"), SAY_SAY, 3000}})
   162 	table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("We'll play a game first"), SAY_SAY, 3000}})
   165 	table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("I'll let you know whatever I know about him if you manage to catch me 3 times"), SAY_SAY, 4000}})
   163 	table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("I'll let you know whatever I know about him if you manage to catch me 3 times"), SAY_SAY, 4000}})
   166 	table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("Let's go!"), SAY_SAY, 2000}})	
   164 	table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("Let's go!"), SAY_SAY, 2000}})	
   167 	table.insert(dialog01, {func = moveRunner, args = {}})	
   165 	table.insert(dialog01, {func = moveRunner, args = {}})
       
   166 	-- DIALOG 02 - Hog Solo story    
       
   167 	AddSkipFunction(dialog02, Skipanim, {dialog02})
       
   168 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3200}})
       
   169 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("The truth about Pr. Hogevil"), 5000}})
       
   170 	table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("Amazing! I was never beaten in running before!"), SAY_SAY, 4000}})
       
   171 	table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("So, let me tell you what I know about Pr. Hogevil..."), SAY_SAY, 4000}})
       
   172 	table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("Pr. Hogevil, then known as James Hogus, worked for PAotH back in my time"), SAY_SAY, 4000}})
       
   173 	table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("He was the lab assistant of Dr. Goodhogan, the inventor of the anti-gravity device"), SAY_SAY, 5000}})
       
   174 	table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("In one of the last tests during the construction of the device an accident happpened"), SAY_SAY, 5000}})
       
   175 	table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("In this accident Pr. Hogevil lost all his nails from his head!"), SAY_SAY, 5000}})
       
   176 	table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("That's why he always wears a hat since then"), SAY_SAY, 4000}})
       
   177 	table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("After that incident he got underground and start working his plan to steal the device"), SAY_SAY, 5000}})
       
   178 	table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("He is a very taugh and very determined hedgehog. I would be extremely careful if I were you"), SAY_SAY, 5000}})
       
   179 	table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("I should go now, goodbye!"), SAY_SAY, 3000}})
       
   180 	table.insert(dialog02, {func = win, args = {}})
   168 end
   181 end
   169 
   182 
   170 ------------- other functions ---------------
   183 ------------- other functions ---------------
   171 
   184 
   172 function isHeroNextToRunner()
   185 function isHeroNextToRunner()
   176 	end
   189 	end
   177 	return false
   190 	return false
   178 end
   191 end
   179 
   192 
   180 function moveRunner()
   193 function moveRunner()
   181 	if not startChallenge then
   194 	if currentPosition > 3 then
   182 		startChallenge = true
   195 		if GetX(hero.gear) > GetX(runner.gear) then
   183 	end
   196 			HogTurnLeft(runner.gear, false)
   184 	AddAmmo(hero.gear, amRope, 1)
   197 		end
   185 	-- add anim dialogs here
       
   186 	if currentPosition ~= 1 then
       
   187 		PlaySound(sndVictory)
       
   188 		AnimSay(runner.gear, loc("You got me"), SAY_SAY, 3000)
       
   189 		previousTimeLeft = TurnTimeLeft
       
   190 	end
       
   191 	currentPosition = currentPosition + 1
       
   192 	SetGearPosition(runner.gear, runner.places[currentPosition].x, runner.places[currentPosition].y)
       
   193 	WriteLnToConsole("HERE 1")
       
   194 		WriteLnToConsole("HERE A")
       
   195 		TurnTimeLeft = 0
   198 		TurnTimeLeft = 0
   196 	WriteLnToConsole("HERE 2")
   199 		AddAnim(dialog02)
       
   200 	else
       
   201 		if not startChallenge then
       
   202 			startChallenge = true
       
   203 		end
       
   204 		AddAmmo(hero.gear, amRope, 1)
       
   205 		if currentPosition ~= 1 then
       
   206 			PlaySound(sndVictory)
       
   207 			if currentPosition > 1 and currentPosition < 4 then
       
   208 				AnimCaption(hero.gear, loc("Go get him again"), 3000)
       
   209 				AnimSay(runner.gear, loc("You got me"), SAY_SAY, 3000)
       
   210 			end
       
   211 			previousTimeLeft = TurnTimeLeft
       
   212 		end
       
   213 		currentPosition = currentPosition + 1
       
   214 		SetGearPosition(runner.gear, runner.places[currentPosition].x, runner.places[currentPosition].y)
       
   215 		TurnTimeLeft = 0
       
   216 	end
   197 end
   217 end
   198 
   218 
   199 function lose()
   219 function lose()
   200 	-- game over
       
   201 	WriteLnToConsole("ROPE "..GetAmmoCount(hero.gear, amRope))
       
   202 	WriteLnToConsole("PREVIOUS TIME "..previousTimeLeft)
       
   203 	WriteLnToConsole("HOG "..CurrentHedgehog)
       
   204 	WriteLnToConsole("TurnTimeLeft "..TurnTimeLeft)
       
   205 	WriteLnToConsole("END GAME 2")
       
   206 	EndGame()
   220 	EndGame()
   207 end
   221 end
   208 
   222 
   209 function heroOutOfRope()
   223 function win()
   210 	if GetAmmoCount(hero.gear, amRope) == 0  then
   224 	EndGame()
   211 		return true
   225 end
   212 	end
       
   213 	return false
       
   214 end