share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/queen.lua
changeset 7454 ce7d7138b436
parent 7451 d2dce3b530f8
child 7475 7b18314bed2b
equal deleted inserted replaced
7451:d2dce3b530f8 7454:ce7d7138b436
   149     SetupPrincessAnim()
   149     SetupPrincessAnim()
   150   else
   150   else
   151     SetupCyborgAnim()
   151     SetupCyborgAnim()
   152   end
   152   end
   153 
   153 
   154   AddSkipFunction(startAnim, SkipAnim, {})
   154   AddSkipFunction(startAnim, SkipAnim, {startAnim})
   155   AddSkipFunction(fleeAnim, SkipAnim, {})
   155   AddSkipFunction(fleeAnim, SkipAnim, {fleeAnim})
   156   AddSkipFunction(leaderDeadAnim, SkipAnim, {})
   156   AddSkipFunction(leaderDeadAnim, SkipAnim, {leaderDeadAnim})
   157 end
   157 end
   158 
   158 
   159 function SetupLeaderDeadAnim()
   159 function SetupLeaderDeadAnim()
   160   local gear = nil
   160   local gear = nil
   161   if CheckCyborgsDead() then
   161   if CheckCyborgsDead() then
   428       gears[found] = natives[i]
   428       gears[found] = natives[i]
   429     end
   429     end
   430   end
   430   end
   431   if found == 0 then
   431   if found == 0 then
   432     return
   432     return
   433   end
   433   else
   434   if found == 1 then
   434     for i = 1, found do
   435     table.insert(finalAnim, {func = AnimTurn, args = {gears[1], "Right"}})
   435       table.insert(finalAnim, {func = AnimCustomFunction, args = {gears[1], CondNeedToTurn, {cyborg, gears[i]}}})
   436     table.insert(finalAnim, {func = AnimSay, args = {gears[1], "Pfew...that was close!", SAY_SAY, 0}})
   436     end
   437   elseif found == 1 then
   437     table.insert(finalAnim, {func = AnimSay, args = {cyborg, "Nice work, blood needers!", SAY_SAY, 3000}})
   438     table.insert(finalAnim, {func = AnimCustomFunction, args = {gears[1], CondNeedToTurn, {gears[1], gears[2]}}})
   438     table.insert(finalAnim, {func = AnimSay, args = {cyborg, "You're on your way to freeing your tribe!", SAY_SAY, 5500}})
   439     table.insert(finalAnim, {func = AnimSay, args = {gears[1], "Pfew...that was close!", SAY_SAY, 0}})
   439     table.insert(finalAnim, {func = AnimSay, args = {gears[1], "Do you know where they are?", SAY_SAY, 4000}})
   440     table.insert(finalAnim, {func = AnimSay, args = {gears[2], "Come, we need to hurry!", SAY_SAY, 0}})
   440     table.insert(finalAnim, {func = AnimSay, args = {gears[found], "We need to hurry!", SAY_SAY, 3000}})
       
   441     table.insert(finalAnim, {func = AnimSay, args = {cyborg, "Haha! Come!", SAY_SAY, 2000}})
       
   442     table.insert(finalAnim, {func = AnimJump, args = {cyborg, "high"}})
       
   443     table.insert(finalAnim, {func = AnimDisappear, args = {cyborg, GetGearPosition(cyborg)}})
       
   444     for i = 1, found do
       
   445       table.insert(finalAnim, {func = HideHedge, swh = false, args = {gears[i]}})
       
   446     end
       
   447     table.insert(finalAnim, {func = SetState, swh = false, args = {cyborg, gstInvisible}})
   441   end
   448   end
   442 end
   449 end
   443 
   450 
   444 
   451 
   445 --------------------------Anim skip functions--------------------------
   452 --------------------------Anim skip functions--------------------------
   451   SetHealth(SpawnHealthCrate(826, 895), 25)
   458   SetHealth(SpawnHealthCrate(826, 895), 25)
   452   SpawnUtilityCrate(701, 1046, amGirder, 3)
   459   SpawnUtilityCrate(701, 1046, amGirder, 3)
   453   TurnTimeLeft = TurnTime
   460   TurnTimeLeft = TurnTime
   454 end
   461 end
   455 
   462 
   456 function SkipAnim()
   463 function SkipAnim(anim)
       
   464   if anim == startAnim then
       
   465     SetGearPosition(enemy, unpack(enemyPos))
       
   466   end
   457   if GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then
   467   if GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then
   458     TurnTimeLeft = 0
   468     TurnTimeLeft = 0
   459   end
   469   end
   460   AnimWait(enemy, 1)
   470   AnimWait(enemy, 1)
   461 end
   471 end
   503   AddCaption("...and the cyborgs took over the island.")
   513   AddCaption("...and the cyborgs took over the island.")
   504   TurnTimeLeft = 0
   514   TurnTimeLeft = 0
   505 end
   515 end
   506 
   516 
   507 function CheckCyborgsDead()
   517 function CheckCyborgsDead()
   508   return cyborgsLeft == 0
   518   return (cyborgsLeft == 0 and (gearDead[enemy] == true or enemyFled == "1"))
       
   519 end
       
   520 
       
   521 function KillEnemy()
       
   522   if enemyFled == "1" then
       
   523     ParseCommand("teamgone " .. loc("Leaderbot"))
       
   524   end
       
   525   ParseCommand("teamgone " .. loc("011101001"))
       
   526   TurnTimeLeft = 0
   509 end
   527 end
   510 
   528 
   511 function DoCyborgsDead()
   529 function DoCyborgsDead()
   512   SaveCampaignVariables()
   530   SaveCampaignVariables()
       
   531   RestoreHedge(cyborg)
       
   532   PlaceGirder(3292, 922, 4)
       
   533   SetGearPosition(cyborg, 3290, 902)
   513   SetupFinalAnim()
   534   SetupFinalAnim()
   514   AddAnim(finalAnim)
   535   AddAnim(finalAnim)
   515   if enemyFled == "1" then
   536   AddFunction({func = KillEnemy, args = {}})
   516     ParseCommand("teamgone " .. loc("Leaderbot"))
       
   517   end
       
   518 end
   537 end
   519 
   538 
   520 function DoLeaderDead()
   539 function DoLeaderDead()
   521   leaderDead = true
   540   leaderDead = true
   522   SetGearMessage(CurrentHedgehog, 0)
   541   SetGearMessage(CurrentHedgehog, 0)
   588   SaveCampaignVar("M8Scene", "" .. scene)
   607   SaveCampaignVar("M8Scene", "" .. scene)
   589   SaveCampaignVar("Progress", "8")
   608   SaveCampaignVar("Progress", "8")
   590 end
   609 end
   591 
   610 
   592 function SetupPlace()
   611 function SetupPlace()
       
   612   HideHedge(cyborg)
   593   SetHogHat(natives[1], nativeHats[m5DeployedNum])
   613   SetHogHat(natives[1], nativeHats[m5DeployedNum])
   594   SetHogName(natives[1], nativeNames[m5DeployedNum])
   614   SetHogName(natives[1], nativeNames[m5DeployedNum])
   595 
   615 
   596   if m5DeployedNum == denseNum then
   616   if m5DeployedNum == denseNum then
   597     dense = natives[1]
   617     dense = natives[1]
   677   cyborgsLeft = cyborgsTeamNum[1] + cyborgsTeamNum[2]
   697   cyborgsLeft = cyborgsTeamNum[1] + cyborgsTeamNum[2]
   678 
   698 
   679   AddTeam(loc("Leaderbot"), 14483456, "ring", "UFO", "Robot", "cm_star")
   699   AddTeam(loc("Leaderbot"), 14483456, "ring", "UFO", "Robot", "cm_star")
   680   enemy = AddHog(loc("Name"), 2, 200, "cyborg1")
   700   enemy = AddHog(loc("Name"), 2, 200, "cyborg1")
   681 
   701 
       
   702   AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
       
   703   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
       
   704 
       
   705   SetGearPosition(cyborg, 0, 0)
       
   706 
   682   for i = 1, nativesNum do
   707   for i = 1, nativesNum do
   683     AnimSetGearPosition(natives[i], unpack(nativePos[i]))
   708     AnimSetGearPosition(natives[i], unpack(nativePos[i]))
   684   end
   709   end
   685 
   710 
   686   AnimSetGearPosition(enemy, unpack(enemyPos))
   711   AnimSetGearPosition(enemy, unpack(enemyPos))
   793 end
   818 end
   794 
   819 
   795 function onPrecise()
   820 function onPrecise()
   796   if GameTime > 2500 and AnimInProgress() then
   821   if GameTime > 2500 and AnimInProgress() then
   797     SetAnimSkip(true)
   822     SetAnimSkip(true)
   798   end
   823 --  else
   799 end
   824 --    DeleteGear(cyborgs[1])
       
   825 --    table.remove(cyborgs, 1)
       
   826 --    if cyborgsLeft == 0 then
       
   827 --      DeleteGear(enemy)
       
   828 --    end
       
   829   end
       
   830 end