share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua
changeset 12364 5857936921ec
parent 12263 2c8e7e73ef58
child 12512 b1c2b0a8a43e
equal deleted inserted replaced
12363:6ad1f86e0c81 12364:5857936921ec
    98 midAnim = {}
    98 midAnim = {}
    99 
    99 
   100 freshDead = nil
   100 freshDead = nil
   101 crates = {}
   101 crates = {}
   102 cratesNum = 0
   102 cratesNum = 0
       
   103 
       
   104 princessFreed = false
   103 -----------------------------Animations--------------------------------
   105 -----------------------------Animations--------------------------------
   104 function EmitDenseClouds(dir)
   106 function EmitDenseClouds(dir)
   105   local dif
   107   local dif
   106   if dir == "Left" then
   108   if dir == "Left" then
   107     dif = 10
   109     dif = 10
   183 function AfterMidAnim()
   185 function AfterMidAnim()
   184   HideHedge(cyborg)
   186   HideHedge(cyborg)
   185   SetupPlace3()
   187   SetupPlace3()
   186   SetGearMessage(natives[1], 0)
   188   SetGearMessage(natives[1], 0)
   187   AddNewEvent(CheckPrincessFreed, {}, DoPrincessFreed, {}, 0)
   189   AddNewEvent(CheckPrincessFreed, {}, DoPrincessFreed, {}, 0)
   188   TurnTimeLeft = 0
   190   EndTurn(true)
   189   ShowMission(loc("Family Reunion"), loc("Salvation"), loc("Get your teammates out of their natural prison and save the princess!|Hint: Drilling holes should solve everything.|Hint: It might be a good idea to place a girder before starting to drill. Just saying.|Hint: All your hedgehogs need to be above the marked height!|Hint: Leaks A Lot needs to get really close to the princess!"), 1, 7000)
   191   ShowMission(loc("Family Reunion"), loc("Salvation"), loc("Get your teammates out of their natural prison and save the princess!|Hint: Drilling holes should solve everything.|Hint: It might be a good idea to place a girder before starting to drill. Just saying.|Hint: All your hedgehogs need to be above the marked height!|Hint: Leaks A Lot needs to get really close to the princess!"), 1, 7000)
   190   vCirc = AddVisualGear(0,0,vgtCircle,0,true)
   192   vCirc = AddVisualGear(0,0,vgtCircle,0,true)
   191   SetVisualGearValues(vCirc, 2625, 1500, 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
   193   SetVisualGearValues(vCirc, 2625, 1500, 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
   192 end
   194 end
   193   
   195   
   285 function DoPrincessFreed()
   287 function DoPrincessFreed()
   286   AnimSay(princess, loc("Thank you, my hero!"), SAY_SAY, 0)
   288   AnimSay(princess, loc("Thank you, my hero!"), SAY_SAY, 0)
   287   if progress and progress<7 then
   289   if progress and progress<7 then
   288     SaveCampaignVar("Progress", "7")
   290     SaveCampaignVar("Progress", "7")
   289   end
   291   end
       
   292   princessFreed = true
   290   DismissTeam(loc("011101001"))
   293   DismissTeam(loc("011101001"))
   291   TurnTimeLeft = 0
   294   EndTurn(true)
   292 end
   295 end
   293 
   296 
   294 function CheckCyborgsDead()
   297 function CheckCyborgsDead()
   295   return cyborgsLeft == 0
   298   return cyborgsLeft == 0
   296 end
   299 end
   335 function CheckGearDead(gear)
   338 function CheckGearDead(gear)
   336   return gearDead[gear]
   339   return gearDead[gear]
   337 end
   340 end
   338 
   341 
   339 function EndMission()
   342 function EndMission()
   340   RemoveEventFunc(CheckPrincessFreed)
   343   if not princessFreed then
   341   AddCaption(loc("So the princess was never heard of again ..."))
   344     RemoveEventFunc(CheckPrincessFreed)
   342   DismissTeam(loc("Natives"))
   345     AddCaption(loc("So the princess was never heard of again ..."))
   343   DismissTeam(loc("011101001"))
   346     DismissTeam(loc("Natives"))
   344   TurnTimeLeft = 0
   347     DismissTeam(loc("011101001"))
       
   348     EndTurn(true)
       
   349   end
   345 end
   350 end
   346 
   351 
   347 function CheckOutOfCluster()
   352 function CheckOutOfCluster()
   348   return CheckGearDead(clusterCrate) and GetAmmoCount(natives[1], amClusterBomb) == 0
   353   return CheckGearDead(clusterCrate) and GetAmmoCount(natives[1], amClusterBomb) == 0
   349 end
   354 end
   544         if gearDead[natives[i]] ~= true then
   549         if gearDead[natives[i]] ~= true then
   545           HideHedge(natives[i])
   550           HideHedge(natives[i])
   546         end
   551         end
   547       end
   552       end
   548     end
   553     end
   549     TurnTimeLeft = 0
   554     EndTurn(true)
   550   else
   555   else
   551     for i = 1, 3 do
   556     for i = 1, 3 do
   552       if gearDead[natives[i]] ~= true then
   557       if gearDead[natives[i]] ~= true then
   553         RestoreHedge(natives[i])
   558         RestoreHedge(natives[i])
   554       end
   559       end