share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
branchspacecampaign
changeset 9597 83fa1ba837b8
parent 9596 feb3d880852d
child 9598 5c378d7d2e4d
equal deleted inserted replaced
9596:feb3d880852d 9597:83fa1ba837b8
   106 	AnimWait(hero.gear, 3000)
   106 	AnimWait(hero.gear, 3000)
   107 	FollowGear(hero.gear)
   107 	FollowGear(hero.gear)
   108 	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
   108 	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
   109 	
   109 	
   110 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   110 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
       
   111 	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
   111 	
   112 	
   112 	--hero ammo
   113 	--hero ammo
   113 	AddAmmo(hero.gear, amTeleport, 2)
   114 	AddAmmo(hero.gear, amTeleport, 2)
   114 	AddAmmo(hero.gear, amSniperRifle, 2)
   115 	AddAmmo(hero.gear, amSniperRifle, 2)
   115 	AddAmmo(hero.gear, amWatermelon, 2)
   116 	AddAmmo(hero.gear, amWatermelon, 2)
   180 		return true
   181 		return true
   181 	end
   182 	end
   182 	return false
   183 	return false
   183 end
   184 end
   184 
   185 
       
   186 function onHeroWin(gear)
       
   187 	local enemies = enemiesOdd
       
   188 	for i=1,table.getn(enemiesEven) do
       
   189 		table.insert(enemies, enemiesEven[i])
       
   190 	end
       
   191 	local allDead = true
       
   192 	for i=1,table.getn(enemies) do
       
   193 		if GetHealth(enemies[i].gear) then
       
   194 			allDead = false
       
   195 			break
       
   196 		end
       
   197 	end
       
   198 	return allDead
       
   199 end
       
   200 
   185 -------------- ACTIONS ------------------
   201 -------------- ACTIONS ------------------
   186 
   202 
   187 -- game ends anyway but I want to sent custom stats probably...
   203 -- game ends anyway but I want to sent custom stats probably...
   188 function heroDeath(gear)
   204 function heroDeath(gear)
       
   205 	SendStat('siGameResult', loc("Hog Solo lost, try again!")) --1
       
   206 	SendStat('siCustomAchievement', loc("You have to eliminate all the enemies")) --11			
       
   207 	SendStat('siCustomAchievement', loc("Read the Challenge Objectives from within the mission for more details")) --11		
       
   208 	SendStat('siPlayerKills','1',teamB.name)
       
   209 	SendStat('siPlayerKills','0',teamA.name)
       
   210 	EndGame()
       
   211 end
       
   212 
       
   213 function heroWin(gear)
       
   214 	SendStat('siGameResult', loc("Congratulations, you won!")) --1
       
   215 	SendStat('siCustomAchievement', loc("You complete the mission in "..TotalRounds.." rounds")) --11			
       
   216 	-- TODO SendStat('siCustomAchievement', loc("You will gain some extra ammo the next time you play the Getting to the device mission")) --11		
       
   217 	SendStat('siPlayerKills','1',teamA.name)
   189 	EndGame()
   218 	EndGame()
   190 end
   219 end
   191 
   220 
   192 -------------- ANIMATIONS ------------------
   221 -------------- ANIMATIONS ------------------
   193 
   222