share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua
changeset 12089 0183b4c448bf
parent 12088 1da37e2ba6fd
child 12468 d652c6f5d5f1
equal deleted inserted replaced
12088:1da37e2ba6fd 12089:0183b4c448bf
    14 	loc("Each time you play this missions enemy hogs will play in a random order.").."|"..
    14 	loc("Each time you play this missions enemy hogs will play in a random order.").."|"..
    15 	loc("At the start of the game each enemy hog has only the weapon that he is named after.").."|"..
    15 	loc("At the start of the game each enemy hog has only the weapon that he is named after.").."|"..
    16 	loc("A random hedgehog will inherit the weapons of his deceased team-mates.").."|"..
    16 	loc("A random hedgehog will inherit the weapons of his deceased team-mates.").."|"..
    17 	loc("If you kill a hedgehog with the respective weapon your health points will be set to 100.").."|"..
    17 	loc("If you kill a hedgehog with the respective weapon your health points will be set to 100.").."|"..
    18 	loc("If you injure a hedgehog you'll get 35% of the damage dealt.").."|"..
    18 	loc("If you injure a hedgehog you'll get 35% of the damage dealt.").."|"..
    19 	loc("Every time you kill an enemy hog your ammo will get reset.").."|"..
    19 	loc("Every time you kill an enemy hog your ammo will get reset next turn.").."|"..
    20 	loc("The rope won't get reset.")
    20 	loc("The rope won't get reset.")
    21 -- dialogs
    21 -- dialogs
    22 local dialog01 = {}
    22 local dialog01 = {}
    23 -- mission objectives
    23 -- mission objectives
    24 local goals = {
    24 local goals = {
    49 }
    49 }
    50 local teamB = {
    50 local teamB = {
    51 	name = loc("5 Deadly Hogs"),
    51 	name = loc("5 Deadly Hogs"),
    52 	color = tonumber("FF0000",16) -- red
    52 	color = tonumber("FF0000",16) -- red
    53 }
    53 }
       
    54 -- After hero killed an enemy, his weapons will be reset in the next round
       
    55 local heroWeaponResetPending = false
    54 
    56 
    55 -------------- LuaAPI EVENT HANDLERS ------------------
    57 -------------- LuaAPI EVENT HANDLERS ------------------
    56 
    58 
    57 function onGameInit()
    59 function onGameInit()
    58 	Seed = 1
    60 	Seed = 1
   100 end
   102 end
   101 
   103 
   102 function onNewTurn()
   104 function onNewTurn()
   103 	if CurrentHedgehog ~= hero.gear then
   105 	if CurrentHedgehog ~= hero.gear then
   104 		enemyWeapons()
   106 		enemyWeapons()
       
   107 	elseif heroWeaponResetPending then
       
   108 		refreshHeroAmmo()
   105 	end
   109 	end
   106 end
   110 end
   107 
   111 
   108 function onGearDelete(gear)
   112 function onGearDelete(gear)
   109 	if isHog(gear) then
   113 	if isHog(gear) then
   126 		end
   130 		end
   127 		table.insert(enemies[randomHog].additionalWeapons, deadHog.weapon)
   131 		table.insert(enemies[randomHog].additionalWeapons, deadHog.weapon)
   128 		for i=1,table.getn(deadHog.additionalWeapons) do
   132 		for i=1,table.getn(deadHog.additionalWeapons) do
   129 			table.insert(enemies[randomHog].additionalWeapons, deadHog.additionalWeapons[i])
   133 			table.insert(enemies[randomHog].additionalWeapons, deadHog.additionalWeapons[i])
   130 		end
   134 		end
   131 		refreshHeroAmmo()
   135 		heroWeaponResetPending = true
   132 	end
   136 	end
   133 end
   137 end
   134 
   138 
   135 function onGearDamage(gear, damage)
   139 function onGearDamage(gear, damage)
   136 	if isHog(gear) and GetHealth(hero.gear) then
   140 	if isHog(gear) and GetHealth(hero.gear) then
   223 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Each time you play this missions enemy hogs will play in a random order"), 5000}})
   227 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Each time you play this missions enemy hogs will play in a random order"), 5000}})
   224 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("At the start of the game each enemy hog has only the weapon that he is named after"), 5000}})
   228 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("At the start of the game each enemy hog has only the weapon that he is named after"), 5000}})
   225 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("A random hedgehog will inherit the weapons of his deceased team-mates"), 5000}})
   229 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("A random hedgehog will inherit the weapons of his deceased team-mates"), 5000}})
   226 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you kill a hedgehog with the respective weapon your health points will be set to 100"), 5000}})
   230 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you kill a hedgehog with the respective weapon your health points will be set to 100"), 5000}})
   227 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you injure a hedgehog you'll get 35% of the damage dealt"), 5000}})
   231 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you injure a hedgehog you'll get 35% of the damage dealt"), 5000}})
   228 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Every time you kill an enemy hog your ammo will get reset"), 5000}})
   232 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Every time you kill an enemy hog your ammo will get reset next turn"), 5000}})
   229 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Rope won't get reset"), 2000}})
   233 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Rope won't get reset"), 2000}})
   230 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   234 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   231 	table.insert(dialog01, {func = startBattle, args = {hero.gear}})
   235 	table.insert(dialog01, {func = startBattle, args = {hero.gear}})
   232 end
   236 end
   233 
   237 
   254 	AddAmmo(hero.gear, amMortar, hero.mortarAmmo + extraAmmo)
   258 	AddAmmo(hero.gear, amMortar, hero.mortarAmmo + extraAmmo)
   255 	AddAmmo(hero.gear, amFirePunch, hero.firepunchAmmo + extraAmmo)
   259 	AddAmmo(hero.gear, amFirePunch, hero.firepunchAmmo + extraAmmo)
   256 	AddAmmo(hero.gear, amDEagle, hero.deagleAmmo + extraAmmo)
   260 	AddAmmo(hero.gear, amDEagle, hero.deagleAmmo + extraAmmo)
   257 	AddAmmo(hero.gear, amBazooka, hero.bazookaAmmo + extraAmmo)
   261 	AddAmmo(hero.gear, amBazooka, hero.bazookaAmmo + extraAmmo)
   258 	AddAmmo(hero.gear, amGrenade, hero.grenadeAmmo + extraAmmo)
   262 	AddAmmo(hero.gear, amGrenade, hero.grenadeAmmo + extraAmmo)
       
   263 	heroWeaponResetPending = false
   259 end
   264 end
   260 
   265 
   261 function enemyWeapons()
   266 function enemyWeapons()
   262 	for i=1,table.getn(enemies) do
   267 	for i=1,table.getn(enemies) do
   263 		if GetHealth(enemies[i].gear) and enemies[i].gear == CurrentHedgehog then
   268 		if GetHealth(enemies[i].gear) and enemies[i].gear == CurrentHedgehog then