Fix Killing the Specialists giving you a free turn after killing Desert Eagle with a desert eagle with shot 1-3
authorWuzzy <almikes@aol.com>
Sun, 27 Nov 2016 03:18:20 +0100
changeset 12094 0183b4c448bf
parent 12093 1da37e2ba6fd
child 12095 fac17dd2bc2f
Fix Killing the Specialists giving you a free turn after killing Desert Eagle with a desert eagle with shot 1-3
ChangeLog.txt
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua
--- a/ChangeLog.txt	Sun Nov 27 01:30:41 2016 +0100
+++ b/ChangeLog.txt	Sun Nov 27 03:18:20 2016 +0100
@@ -164,6 +164,7 @@
  * Fixed mistakes and bad wording of strings in several missions, scripts and campaigns
  * Fixed Lua error message in A Classic Fairytale mission 8
  * Fixed Lua error messages and broken stats screen in Climb Home singleplayer mission
+ * Fixed Killing the Specialists giving you another free turn after killing Desert Eagle with a desert eagle with shot #1-3
 
 Frontend:
  + Campaign screen shows which campaigns and missions you've completed so far
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua	Sun Nov 27 01:30:41 2016 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua	Sun Nov 27 03:18:20 2016 +0100
@@ -16,7 +16,7 @@
 	loc("A random hedgehog will inherit the weapons of his deceased team-mates.").."|"..
 	loc("If you kill a hedgehog with the respective weapon your health points will be set to 100.").."|"..
 	loc("If you injure a hedgehog you'll get 35% of the damage dealt.").."|"..
-	loc("Every time you kill an enemy hog your ammo will get reset.").."|"..
+	loc("Every time you kill an enemy hog your ammo will get reset next turn.").."|"..
 	loc("The rope won't get reset.")
 -- dialogs
 local dialog01 = {}
@@ -51,6 +51,8 @@
 	name = loc("5 Deadly Hogs"),
 	color = tonumber("FF0000",16) -- red
 }
+-- After hero killed an enemy, his weapons will be reset in the next round
+local heroWeaponResetPending = false
 
 -------------- LuaAPI EVENT HANDLERS ------------------
 
@@ -102,6 +104,8 @@
 function onNewTurn()
 	if CurrentHedgehog ~= hero.gear then
 		enemyWeapons()
+	elseif heroWeaponResetPending then
+		refreshHeroAmmo()
 	end
 end
 
@@ -128,7 +132,7 @@
 		for i=1,table.getn(deadHog.additionalWeapons) do
 			table.insert(enemies[randomHog].additionalWeapons, deadHog.additionalWeapons[i])
 		end
-		refreshHeroAmmo()
+		heroWeaponResetPending = true
 	end
 end
 
@@ -225,7 +229,7 @@
 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("A random hedgehog will inherit the weapons of his deceased team-mates"), 5000}})
 	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}})
 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you injure a hedgehog you'll get 35% of the damage dealt"), 5000}})
-	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Every time you kill an enemy hog your ammo will get reset"), 5000}})
+	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Every time you kill an enemy hog your ammo will get reset next turn"), 5000}})
 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Rope won't get reset"), 2000}})
 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
 	table.insert(dialog01, {func = startBattle, args = {hero.gear}})
@@ -256,6 +260,7 @@
 	AddAmmo(hero.gear, amDEagle, hero.deagleAmmo + extraAmmo)
 	AddAmmo(hero.gear, amBazooka, hero.bazookaAmmo + extraAmmo)
 	AddAmmo(hero.gear, amGrenade, hero.grenadeAmmo + extraAmmo)
+	heroWeaponResetPending = false
 end
 
 function enemyWeapons()