share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua
changeset 9810 54c0fdec4600
parent 9758 3b8058b251b8
child 9831 afa4e3e04cc5
equal deleted inserted replaced
9809:1e32628eb167 9810:54c0fdec4600
   118 		elseif deadHog.weapon == amBazooka then
   118 		elseif deadHog.weapon == amBazooka then
   119 			hero.bazookaAmmo = 0
   119 			hero.bazookaAmmo = 0
   120 		elseif deadHog.weapon == amGrenade then
   120 		elseif deadHog.weapon == amGrenade then
   121 			hero.grenadeAmmo = 0
   121 			hero.grenadeAmmo = 0
   122 		end
   122 		end
   123 		local randomHog = math.random(1,table.getn(enemies))
   123 		local randomHog = GetRandom(table.getn(enemies))+1
   124 		while not GetHealth(enemies[randomHog].gear) do
   124 		while not GetHealth(enemies[randomHog].gear) do
   125 			randomHog = math.random(1,table.getn(enemies))
   125 			randomHog = GetRandom(table.getn(enemies))+1
   126 		end
   126 		end
   127 		table.insert(enemies[randomHog].additionalWeapons, deadHog.weapon)
   127 		table.insert(enemies[randomHog].additionalWeapons, deadHog.weapon)
   128 		for i=1,table.getn(deadHog.additionalWeapons) do
   128 		for i=1,table.getn(deadHog.additionalWeapons) do
   129 			table.insert(enemies[randomHog].additionalWeapons, deadHog.additionalWeapons[i])
   129 			table.insert(enemies[randomHog].additionalWeapons, deadHog.additionalWeapons[i])
   130 		end
   130 		end
   227 end
   227 end
   228 
   228 
   229 function shuffleHogs(hogs)
   229 function shuffleHogs(hogs)
   230     local hogsNumber = table.getn(hogs)
   230     local hogsNumber = table.getn(hogs)
   231     for i=1,hogsNumber do
   231     for i=1,hogsNumber do
   232 		local randomHog = math.random(hogsNumber)
   232 		local randomHog = GetRandom(hogsNumber) + 1
   233 		hogs[i], hogs[randomHog] = hogs[randomHog], hogs[i]
   233 		hogs[i], hogs[randomHog] = hogs[randomHog], hogs[i]
   234     end
   234     end
   235 end
   235 end
   236 
   236 
   237 function refreshHeroAmmo()
   237 function refreshHeroAmmo()