ACF5: Spawn final wave at end of 7th turn instead of beginning of 8th turn
authorWuzzy <Wuzzy2@mail.ru>
Sun, 26 May 2019 15:49:39 +0200
changeset 15055 3e79818e21b1
parent 15054 c59bdec25012
child 15056 c88201afcc7c
ACF5: Spawn final wave at end of 7th turn instead of beginning of 8th turn
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Sun May 26 15:37:49 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Sun May 26 15:49:39 2019 +0200
@@ -32,7 +32,7 @@
 - One hero is deployed near the circles
 - Player now only controls the hero, switch hog is removed
 - TBS
-- 3rd wave appears
+- 3rd wave appears at end of 7th turn
 - TBS
 - 3rd wave dead
 - Final cut scene
@@ -649,7 +649,6 @@
   stage = platformStage
   SpawnPlatformCrates()
   SetGearMessage(CurrentHedgehog, 0)
-  AddEvent(CheckTurnsOver, {}, DoTurnsOver, {3}, 0)
   AddEvent(CheckWaveDead, {3}, DoWaveDead, {3}, 0)
   AddEvent(CheckDeployedDead, {}, DoDeployedDead, {}, 0)
   HideCyborg()
@@ -695,10 +694,6 @@
 end
 
 -----------------------------Events------------------------------------
-function CheckTurnsOver()
-  return wave3TurnsLeft == 0
-end
-
 function CheckDeployedDead()
   return deployedDead
 end
@@ -1179,8 +1174,6 @@
   if stage == platformStage then
     if wave3TurnsLeft == nil then
       wave3TurnsLeft = 7
-    else
-      wave3TurnsLeft = wave3TurnsLeft - 1
     end
     if wave3TurnsLeft > 0 then
       AddCaption(string.format(loc("Turns until arrival: %d"), wave3TurnsLeft))
@@ -1230,6 +1223,15 @@
   end
 end
 
+function onEndTurn()
+  if stage == platformStage then
+    wave3TurnsLeft = wave3TurnsLeft - 1
+    if wave3TurnsLeft == 0 then
+      DoTurnsOver()
+    end
+  end
+end
+
 function onPrecise()
   if GameTime > 2500 and AnimInProgress() then
     SetAnimSkip(true)