share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua
changeset 12272 2c884bb73975
parent 12271 bb44fd4d8809
child 12273 1d2fe83709d1
equal deleted inserted replaced
12271:bb44fd4d8809 12272:2c884bb73975
   169 
   169 
   170 freshDead = nil
   170 freshDead = nil
   171 crates = {}
   171 crates = {}
   172 cratesNum = 0
   172 cratesNum = 0
   173 jetCrate = nil
   173 jetCrate = nil
       
   174 
       
   175 cyborgsKilledBeforeCrates = false
       
   176 cratesTaken = false
       
   177 doneCyborgsDead = false
   174 -----------------------------Animations--------------------------------
   178 -----------------------------Animations--------------------------------
   175 function EmitDenseClouds(dir)
   179 function EmitDenseClouds(dir)
   176   local dif
   180   local dif
   177   if dir == "Left" then
   181   if dir == "Left" then
   178     dif = 10
   182     dif = 10
   256   table.insert(killAnim, {func = AnimSay, args = {native, loc("Well, that was a waste of time."), SAY_THINK, 5000}})
   260   table.insert(killAnim, {func = AnimSay, args = {native, loc("Well, that was a waste of time."), SAY_THINK, 5000}})
   257   table.insert(killAnim, {func = AnimCustomFunction, args = {native, RestoreHedge, {cyborg, unpack(cyborgPos)}}})
   261   table.insert(killAnim, {func = AnimCustomFunction, args = {native, RestoreHedge, {cyborg, unpack(cyborgPos)}}})
   258   table.insert(killAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(cyborgPos)}})
   262   table.insert(killAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(cyborgPos)}})
   259   table.insert(killAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
   263   table.insert(killAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
   260   table.insert(killAnim, {func = AnimSay, args = {cyborg, string.format(loc("You bear impressive skills, %s!"), nativeUnNames[m5DeployedNum]), SAY_SHOUT, 4000}})
   264   table.insert(killAnim, {func = AnimSay, args = {cyborg, string.format(loc("You bear impressive skills, %s!"), nativeUnNames[m5DeployedNum]), SAY_SHOUT, 4000}})
   261   table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("However, my mates don't agree with me on letting you go..."), SAY_SHOUT, 7000}})
   265   if CheckCyborgsDead() then
   262   table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("I guess you'll have to kill them."), SAY_SHOUT, 4000}})
   266     table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("I see you already took care of your enemies."), SAY_SHOUT, 7000}})
       
   267     table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("Those were scheduled for disposal anyway."), SAY_SHOUT, 4000}})
       
   268     table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("So you basically did the dirty work for us."), SAY_SHOUT, 4000}})
       
   269     cyborgsKilledBeforeCrates = true
       
   270   else
       
   271     table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("However, my mates don't agree with me on letting you go..."), SAY_SHOUT, 7000}})
       
   272     table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("I guess you'll have to kill them."), SAY_SHOUT, 4000}})
       
   273   end
   263   table.insert(killAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
   274   table.insert(killAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
   264   table.insert(killAnim, {func = AnimSwitchHog, args = {native}})
   275   table.insert(killAnim, {func = AnimSwitchHog, args = {native}})
   265   table.insert(killAnim, {func = AnimWait, args = {native, 1}})
   276   table.insert(killAnim, {func = AnimWait, args = {native, 1}})
   266   table.insert(killAnim, {func = AnimCustomFunction, args = {native, HideHedge, {cyborg}}})
   277   table.insert(killAnim, {func = AnimCustomFunction, args = {native, HideHedge, {cyborg}}})
       
   278 
       
   279   local function checkCyborgsAgain()
       
   280      if CheckCyborgsDead() then
       
   281         DoCyborgsDead()
       
   282      end
       
   283   end
       
   284   table.insert(killAnim, {func = AnimCustomFunction, args = {native, checkCyborgsAgain, {}}})
       
   285 
   267   AddSkipFunction(killAnim, SkipKillAnim, {})
   286   AddSkipFunction(killAnim, SkipKillAnim, {})
   268 end
   287 end
   269 
   288 
   270 function SetupKilledAnim()
   289 function SetupKilledAnim()
   271   table.insert(killedAnim, {func = AnimWait, args = {cyborg, 500}})
   290   table.insert(killedAnim, {func = AnimWait, args = {cyborg, 500}})
   272   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(secondPos[2])}})
   291   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(secondPos[2])}})
   273   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {native, unpack(secondPos[1])}})
   292   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {native, unpack(secondPos[1])}})
   274   table.insert(killedAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
   293   table.insert(killedAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
   275   table.insert(killedAnim, {func = AnimSay, args = {cyborg, string.format(loc("Nice work, %s!"), nativeUnNames[m5DeployedNum]), SAY_SHOUT, 4000}})
   294   if not cyborgsKilledBeforeCrates then
       
   295     table.insert(killedAnim, {func = AnimSay, args = {cyborg, string.format(loc("Nice work, %s!"), nativeUnNames[m5DeployedNum]), SAY_SHOUT, 4000}})
       
   296   end
   276   table.insert(killedAnim, {func = AnimSay, args = {cyborg, loc("As a reward for your performance, here's some new technology!"), SAY_SHOUT, 8000}})
   297   table.insert(killedAnim, {func = AnimSay, args = {cyborg, loc("As a reward for your performance, here's some new technology!"), SAY_SHOUT, 8000}})
   277   table.insert(killedAnim, {func = AnimSay, args = {cyborg, loc("Use it wisely!"), SAY_SHOUT, 3000}})
   298   table.insert(killedAnim, {func = AnimSay, args = {cyborg, loc("Use it wisely!"), SAY_SHOUT, 3000}})
   278   table.insert(killedAnim, {func = AnimDisappear, args = {cyborg, unpack(secondPos[2])}})
   299   table.insert(killedAnim, {func = AnimDisappear, args = {cyborg, unpack(secondPos[2])}})
   279   table.insert(killedAnim, {func = AnimSwitchHog, args = {native}})
   300   table.insert(killedAnim, {func = AnimSwitchHog, args = {native}})
   280   AddSkipFunction(killedAnim, SkipKilledAnim, {})
   301   AddSkipFunction(killedAnim, SkipKilledAnim, {})
   353   AddAmmo(native, amSnowball, 0)
   374   AddAmmo(native, amSnowball, 0)
   354   AddAmmo(native, amShotgun, 0)
   375   AddAmmo(native, amShotgun, 0)
   355 end
   376 end
   356 
   377 
   357 function DoCyborgsDead()
   378 function DoCyborgsDead()
   358   NullifyAmmo()
   379   if cratesTaken and not doneCyborgsDead then
   359   RestoreHedge(cyborg)
   380     NullifyAmmo()
   360   SetupKilledAnim()
   381     RestoreHedge(cyborg)
   361   SetGearMessage(CurrentHedgehog, 0)
   382     SetupKilledAnim()
   362   AddAnim(killedAnim)
   383     SetGearMessage(CurrentHedgehog, 0)
   363   AddFunction({func = AfterKilledAnim, args = {}})
   384     AddAnim(killedAnim)
       
   385     AddFunction({func = AfterKilledAnim, args = {}})
       
   386     doneCyborgsDead = true
       
   387   end
   364 end
   388 end
   365 
   389 
   366 
   390 
   367 function PutWeaponCrates()
   391 function PutWeaponCrates()
   368   for i = 1, 8 do
   392   for i = 1, 8 do
   371   end
   395   end
   372   FollowGear(native)
   396   FollowGear(native)
   373 end
   397 end
   374 
   398 
   375 function DoCratesTaken()
   399 function DoCratesTaken()
       
   400   cratesTaken = true
   376   SetupKillAnim()
   401   SetupKillAnim()
   377   SetGearMessage(CurrentHedgehog, 0)
   402   SetGearMessage(CurrentHedgehog, 0)
   378   AddAnim(killAnim)
   403   AddAnim(killAnim)
   379   AddFunction({func = AfterKillAnim, args = {}})
   404   AddFunction({func = AfterKillAnim, args = {}})
   380 end
   405 end
   432 end
   457 end
   433 
   458 
   434 function CyborgDeadReact()
   459 function CyborgDeadReact()
   435   freshDead = nil
   460   freshDead = nil
   436   if cyborgsLeft == 0 then
   461   if cyborgsLeft == 0 then
       
   462     if not cratesTaken then
       
   463        AnimSay(native, loc("I still have to collect the crates."), SAY_THINK, 8000)
       
   464     end
   437     return
   465     return
   438   end
   466   end
   439   AnimSay(native, reactions[cyborgsLeft])
   467   AnimSay(native, reactions[cyborgsLeft])
   440 end
   468 end
   441 -----------------------------Misc--------------------------------------
   469 -----------------------------Misc--------------------------------------