share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua
changeset 12613 34685d3326a7
parent 12569 87326fec6ea2
child 12776 7260e9b37b62
equal deleted inserted replaced
12611:fb0734d5dd87 12613:34685d3326a7
    94 gearDead = {}
    94 gearDead = {}
    95 hedgeHidden = {}
    95 hedgeHidden = {}
    96 
    96 
    97 startAnim = {}
    97 startAnim = {}
    98 midAnim = {}
    98 midAnim = {}
       
    99 princessFreedAnim = {}
    99 
   100 
   100 freshDead = nil
   101 freshDead = nil
   101 crates = {}
   102 crates = {}
   102 cratesNum = 0
   103 cratesNum = 0
   103 
   104 
   177   table.insert(midAnim, {func = AnimSay, args = {cyborg, loc("Here, let me help you save her!"), SAY_SAY, 5000}})
   178   table.insert(midAnim, {func = AnimSay, args = {cyborg, loc("Here, let me help you save her!"), SAY_SAY, 5000}})
   178   table.insert(midAnim, {func = AnimSay, args = {natives[1], loc("Thanks!"), SAY_SAY, 2000}})
   179   table.insert(midAnim, {func = AnimSay, args = {natives[1], loc("Thanks!"), SAY_SAY, 2000}})
   179   table.insert(midAnim, {func = AnimTeleportGear, args = {natives[1], unpack(nativeMidPos2)}})
   180   table.insert(midAnim, {func = AnimTeleportGear, args = {natives[1], unpack(nativeMidPos2)}})
   180   table.insert(midAnim, {func = AnimSay, args = {natives[1], loc("Why can't he just let her go?!"), SAY_THINK, 5000}})
   181   table.insert(midAnim, {func = AnimSay, args = {natives[1], loc("Why can't he just let her go?!"), SAY_THINK, 5000}})
   181   AddSkipFunction(midAnim, SkipMidAnim, {})
   182   AddSkipFunction(midAnim, SkipMidAnim, {})
       
   183 
       
   184   table.insert(princessFreedAnim, {func = AnimSay, args = {princess, loc("Thank you, my hero!"), SAY_SAY, 4000}})
       
   185   table.insert(princessFreedAnim, {func = Victory, args = {}})
       
   186   AddSkipFunction(princessFreedAnim, SkipPrincessFreedAnim, {})
   182 end
   187 end
   183 
   188 
   184 --------------------------Anim skip functions--------------------------
   189 --------------------------Anim skip functions--------------------------
   185 function AfterMidAnim()
   190 function AfterMidAnim()
   186   HideHedge(cyborg)
   191   HideHedge(cyborg)
   190   EndTurn(true)
   195   EndTurn(true)
   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!") .. "|" .. loc("Mines time: 5 seconds"), 1, 7000)
   196   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!") .. "|" .. loc("Mines time: 5 seconds"), 1, 7000)
   192   vCirc = AddVisualGear(0,0,vgtCircle,0,true)
   197   vCirc = AddVisualGear(0,0,vgtCircle,0,true)
   193   SetVisualGearValues(vCirc, 2625, 1500, 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
   198   SetVisualGearValues(vCirc, 2625, 1500, 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
   194 end
   199 end
   195   
   200 
       
   201 function SkipPrincessFreedAnim()
       
   202   Victory()
       
   203 end
       
   204 
   196 function SkipMidAnim()
   205 function SkipMidAnim()
   197   AnimTeleportGear(natives[1], unpack(nativeMidPos2))
   206   AnimTeleportGear(natives[1], unpack(nativeMidPos2))
   198   SkipStartAnim()
   207   SkipStartAnim()
   199 end
   208 end
   200 
   209 
   283   return math.abs(GetX(natives[1]) - GetX(princess)) <= 15 and math.abs(GetY(natives[1]) - GetY(princess)) <= 15 and StoppedGear(natives[1]) 
   292   return math.abs(GetX(natives[1]) - GetX(princess)) <= 15 and math.abs(GetY(natives[1]) - GetY(princess)) <= 15 and StoppedGear(natives[1]) 
   284         and GetY(natives[2]) < 1500 and GetY(natives[3]) < 1500 and StoppedGear(natives[2]) and StoppedGear(natives[3])
   293         and GetY(natives[2]) < 1500 and GetY(natives[3]) < 1500 and StoppedGear(natives[2]) and StoppedGear(natives[3])
   285 end
   294 end
   286 
   295 
   287 function DoPrincessFreed()
   296 function DoPrincessFreed()
   288   AnimSay(princess, loc("Thank you, my hero!"), SAY_SAY, 0)
   297   AddAnim(princessFreedAnim)
   289   if progress and progress<7 then
   298 end
   290     SaveCampaignVar("Progress", "7")
   299 
   291   end
   300 function Victory()
   292   princessFreed = true
   301   if not princessFreed then
   293   DismissTeam(loc("011101001"))
   302     if progress and progress<7 then
   294   EndTurn(true)
   303       SaveCampaignVar("Progress", "7")
       
   304     end
       
   305     princessFreed = true
       
   306     DismissTeam(loc("011101001"))
       
   307     EndTurn(true)
       
   308   end
   295 end
   309 end
   296 
   310 
   297 function CheckCyborgsDead()
   311 function CheckCyborgsDead()
   298   return cyborgsLeft == 0
   312   return cyborgsLeft == 0
   299 end
   313 end