share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
branchspacecampaign
changeset 9600 7daf157d8b52
parent 9599 504a41e1a27a
child 9601 6af4ca27421a
equal deleted inserted replaced
9599:504a41e1a27a 9600:7daf157d8b52
    14 local timeLeft = 10000
    14 local timeLeft = 10000
    15 local lastWeaponUsed = amSniperRifle
    15 local lastWeaponUsed = amSniperRifle
    16 local challengeObjectives = loc("Use your available weapons in order to eliminate the enemies").."|"..
    16 local challengeObjectives = loc("Use your available weapons in order to eliminate the enemies").."|"..
    17 	loc("You can only use the Sniper Rifle or the Watermelon bomb").."|"..
    17 	loc("You can only use the Sniper Rifle or the Watermelon bomb").."|"..
    18 	loc("You'll have only 2 watermelon bombs during the game").."|"..
    18 	loc("You'll have only 2 watermelon bombs during the game").."|"..
    19 	loc("You'll get an extra Sniper Rifle every time you kill an enemy hog with a limit of max 3 rifles").."|"..
    19 	loc("You'll get an extra Sniper Rifle every time you kill an enemy hog with a limit of max 4 rifles").."|"..
    20 	loc("You'll get an extra Teleport every time you kill an enemy hog with a limit of max 2 teleports").."|"..
    20 	loc("You'll get an extra Teleport every time you kill an enemy hog with a limit of max 2 teleports").."|"..
    21 	loc("The first turn will last 25 sec and every other turn 15 sec").."|"..
    21 	loc("The first turn will last 25 sec and every other turn 15 sec").."|"..
    22 	loc("If you skip the game your time left will be added to your next turn").."|"..
    22 	loc("If you skip the game your time left will be added to your next turn").."|"..
    23 	loc("Some parts of the land are indestructible")
    23 	loc("Some parts of the land are indestructible")
    24 -- dialogs
    24 -- dialogs
   154 	if CurrentHedgehog == hero.gear and TurnTimeLeft ~= 0 then
   154 	if CurrentHedgehog == hero.gear and TurnTimeLeft ~= 0 then
   155 		timeLeft = TurnTimeLeft
   155 		timeLeft = TurnTimeLeft
   156 	end
   156 	end
   157 end
   157 end
   158 
   158 
   159 function onGearDelete(gear)	
   159 function onGearDelete(gear)
   160 	if (gear > hero.gear and gear <= enemiesOdd[table.getn(enemiesOdd)].gear) or 
   160 	if (isHog(gear)) then
   161 			(gear > hero.gear and gear <= enemiesEven[table.getn(enemiesEven)].gear) then
       
   162 		local availableTeleports = GetAmmoCount(hero.gear,amTeleport)
   161 		local availableTeleports = GetAmmoCount(hero.gear,amTeleport)
   163 		local availableSniper = GetAmmoCount(hero.gear,amSniperRifle)
   162 		local availableSniper = GetAmmoCount(hero.gear,amSniperRifle)
   164 		if availableTeleports < 2 then
   163 		if availableTeleports < 2 then
   165 			AddAmmo(hero.gear, amTeleport, availableTeleports + 1 )
   164 			AddAmmo(hero.gear, amTeleport, availableTeleports + 1 )
   166 		end
   165 		end
   167 		if availableSniper < 3 then
   166 		if availableSniper < 4 then
   168 			AddAmmo(hero.gear, amSniperRifle, availableSniper + 1 )
   167 			AddAmmo(hero.gear, amSniperRifle, availableSniper + 1 )
   169 		end
   168 		end
   170 	end
   169 	end
   171 end
   170 end
   172 
   171 
   236 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere in the Fruit Planet Hog Solo got lost..."), 5000}})
   235 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere in the Fruit Planet Hog Solo got lost..."), 5000}})
   237 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("...and got ambushed by the Red Strawberies"), 5000}})
   236 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("...and got ambushed by the Red Strawberies"), 5000}})
   238 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Use your available weapons in order to eliminate the enemies"), 5000}})
   237 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Use your available weapons in order to eliminate the enemies"), 5000}})
   239 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You can only use the Sniper Rifle or the Watermelon bomb"), 5000}})
   238 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You can only use the Sniper Rifle or the Watermelon bomb"), 5000}})
   240 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll have only 2 watermelon bombs during the game"), 5000}})
   239 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll have only 2 watermelon bombs during the game"), 5000}})
   241 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll get an extra Sniper Rifle every time you kill an enemy hog with a limit of max 3 rifles"), 5000}})
   240 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll get an extra Sniper Rifle every time you kill an enemy hog with a limit of max 4 rifles"), 5000}})
   242 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll get an extra Teleport every time you kill an enemy hog with a limit of max 2 teleports"), 5000}})
   241 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll get an extra Teleport every time you kill an enemy hog with a limit of max 2 teleports"), 5000}})
   243 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("The first turn will last 25 sec and every other turn 15 sec"), 5000}})
   242 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("The first turn will last 25 sec and every other turn 15 sec"), 5000}})
   244 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you skip the game your time left will be added to your next turn"), 5000}})
   243 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you skip the game your time left will be added to your next turn"), 5000}})
   245 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Some parts of the land are indestructible"), 5000}})
   244 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Some parts of the land are indestructible"), 5000}})
   246 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   245 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   277 	TurnTimeLeft = 0
   276 	TurnTimeLeft = 0
   278 	-- these 2 are needed in order hero has 10 sec more in the first turn
   277 	-- these 2 are needed in order hero has 10 sec more in the first turn
   279 	timeLeft = 10000
   278 	timeLeft = 10000
   280 	AddAmmo(hero.gear, amSkip, 0)
   279 	AddAmmo(hero.gear, amSkip, 0)
   281 end
   280 end
       
   281 
       
   282 function isHog(gear)
       
   283 	local hog = false
       
   284 	for i=1,table.getn(enemiesOdd) do
       
   285 		if gear == enemiesOdd[i].gear then
       
   286 			hog = true
       
   287 			break
       
   288 		end
       
   289 	end
       
   290 	if not hog then
       
   291 		for i=1,table.getn(enemiesEven) do
       
   292 			if gear == enemiesEven then
       
   293 				hog = true
       
   294 				break
       
   295 			end
       
   296 		end
       
   297 	end
       
   298 	return hog
       
   299 end