ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
authorWuzzy <almikes@aol.com>
Tue, 26 Sep 2017 03:05:59 +0200
changeset 12532 3e6e7b258a33
parent 12531 e12e2dfda06f
child 12533 f8801c72a6c8
ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
ChangeLog.txt
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua
--- a/ChangeLog.txt	Tue Sep 26 02:31:01 2017 +0200
+++ b/ChangeLog.txt	Tue Sep 26 03:05:59 2017 +0200
@@ -197,7 +197,8 @@
  + A few campaign missions now save your personal best successes (e.g. fastest finish in Hard Flying) which get shown after you finish them agin
  + Add skip to a few missions where it doesn't hurt
  + Menu: Show 2 flowers over fully completed planets (with side missions)
- + Allow skipping in some missions
+ * A frozen adventure: Fix bazooka and excess freezers (>6) not retained over checkpoints
+ * A frozen adventure: Fix and improve poorly written messages
  * Getting to the device: Add real crate and correct message for collecting device part
  * Getting to the device: Remove checkpoints. There was a good chance for these missions to become unwinnable
  * Searching in the dust: Remove checkpoints. See above.
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua	Tue Sep 26 02:31:01 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua	Tue Sep 26 03:05:59 2017 +0200
@@ -217,12 +217,16 @@
 		AddEvent(onHeroAtIceGun, {hero.gear}, heroAtIceGun, {hero.gear}, 0)
 		AddAnim(dialog01)
 	elseif checkPointReached == 2 then
-		AddAmmo(hero.gear, amBazooka, 1)
+		local baz = tonumber(GetCampaignVar("HeroAmmoIce01Bazooka")) or 1
+		AddAmmo(hero.gear, amBazooka, baz)
 		AddAmmo(hero.gear, amIceGun, 8)
 		AnimCaption(hero.gear, goToThantaString, 5000)
 		ShowMission(unpack(goals["checkpoint"]))
 	elseif checkPointReached == 3 then
-		AddAmmo(hero.gear, amIceGun, 6)
+		local baz = tonumber(GetCampaignVar("HeroAmmoIce01Bazooka")) or 0
+		local ice = math.max(6, tonumber(GetCampaignVar("HeroAmmoIce01IceGun")) or 6)
+		AddAmmo(hero.gear, amBazooka, baz)
+		AddAmmo(hero.gear, amIceGun, ice)
 		AnimCaption(hero.gear, goToThantaString, 5000)
 		ShowMission(unpack(goals["checkpoint"]))
 	end
@@ -447,12 +451,17 @@
 	heroAtFinalStep = true
 	saveCheckpoint("3")
 	SaveCampaignVar("HeroHealth", GetHealth(hero.gear))
+	SaveCampaignVar("HeroAmmoIce01IceGun", GetAmmoCount(hero.gear, amIceGun))
+	SaveCampaignVar("HeroAmmoIce01Bazooka", GetAmmoCount(hero.gear, amBazooka))
+	AddCaption(loc("Checkpoint reached!"), 0xFFFFFFFF, capgrpMessage2)
 end
 
 function columnCheckPoint(gear)
 	saveCheckpoint("2")
 	SaveCampaignVar("HeroHealth", GetHealth(hero.gear))
-	AnimCaption(hero.gear, loc("Checkpoint reached!"), 5000)
+	AddCaption(loc("Checkpoint reached!"), 0xFFFFFFFF, capgrpMessage2)
+	SaveCampaignVar("HeroAmmoIce01IceGun", GetAmmoCount(hero.gear, amIceGun))
+	SaveCampaignVar("HeroAmmoIce01Bazooka", GetAmmoCount(hero.gear, amBazooka))
 end
 
 function heroAtIceGun(gear)