share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/dragon.lua
changeset 7428 4cc8398384e6
parent 7422 aa8a4dfe78e3
child 7431 fee9ae17c007
equal deleted inserted replaced
7425:3495e70c6d14 7428:4cc8398384e6
   139 
   139 
   140 cratePos = {
   140 cratePos = {
   141             {788, 1919, amGirder, 2}, {412, 1615, amGirder, 1},
   141             {788, 1919, amGirder, 2}, {412, 1615, amGirder, 1},
   142             {209, 1474, amSniperRifle, 1}, {1178, 637, amDEagle, 1},
   142             {209, 1474, amSniperRifle, 1}, {1178, 637, amDEagle, 1},
   143             {633, 268, amDEagle, 1}, {3016, 1545, amDEagle, 1},
   143             {633, 268, amDEagle, 1}, {3016, 1545, amDEagle, 1},
   144             {249, 1377, amRope, 2}, {330, 1018, amGirder, 1},
   144             {249, 1377, amRope, 3}, {330, 1018, amGirder, 1},
   145             {888, 647, amRope, 2}, {2116, 337, amRope, 2},
   145             {888, 647, amRope, 3}, {2116, 337, amRope, 3},
   146             {1779, 948, amRope, 2}, {3090, 1066, amRope, 2},
   146             {1779, 948, amRope, 3}, {3090, 1066, amRope, 3},
   147             {947, 480, amBazooka, 3}, {1097, 480, amMortar, 3},
   147             {947, 480, amBazooka, 3}, {1097, 480, amMortar, 3},
   148             {1139, 451, amSnowball, 3}, {1207, 468, amShotgun, 3},
   148             {1139, 451, amSnowball, 3}, {1207, 468, amShotgun, 3},
   149             {1024, 393, amSniperRifle, 2}, {998, 391, amDynamite, 2}
   149             {1024, 393, amSniperRifle, 2}, {998, 391, amDynamite, 2}
       
   150             {1024, 343, amRope, 2}, {998, 341, amRope, 2}
   150            }
   151            }
   151 reactions = {loc("Yeah, take that!"), loc("Bullseye"), loc("Die, die, die!")}
   152 reactions = {loc("Yeah, take that!"), loc("Bullseye"), loc("Die, die, die!")}
   152 
   153 
   153 secondPos = {{1010, 510}, {1067, 510}}
   154 secondPos = {{1010, 510}, {1067, 510}}
   154 -----------------------------Variables---------------------------------
   155 -----------------------------Variables---------------------------------
   256   table.insert(killAnim, {func = AnimSay, args = {native, loc("Well, that was a waste of time."), SAY_THINK, 5000}})
   257   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)}}})
   258   table.insert(killAnim, {func = AnimCustomFunction, args = {native, RestoreHedge, {cyborg, unpack(cyborgPos)}}})
   258   table.insert(killAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(cyborgPos)}})
   259   table.insert(killAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(cyborgPos)}})
   259   table.insert(killAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
   260   table.insert(killAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
   260   table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("You bear impressive skills, ") .. nativeUnNames[m5DeployedNum] .. "!", SAY_SHOUT, 4000}})
   261   table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("You bear impressive skills, ") .. nativeUnNames[m5DeployedNum] .. "!", SAY_SHOUT, 4000}})
   261   table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("However, my mates don't agree with me on leting you go..."), SAY_SHOUT, 7000}})
   262   table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("However, my mates don't agree with me on letting you go..."), SAY_SHOUT, 7000}})
   262   table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("I guess you'll have to kill them."), SAY_SHOUT, 4000}})
   263   table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("I guess you'll have to kill them."), SAY_SHOUT, 4000}})
   263   table.insert(killAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
   264   table.insert(killAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
   264   table.insert(killAnim, {func = AnimSwitchHog, args = {native}})
   265   table.insert(killAnim, {func = AnimSwitchHog, args = {native}})
   265   table.insert(killAnim, {func = AnimWait, args = {native, 1}})
   266   table.insert(killAnim, {func = AnimWait, args = {native, 1}})
   266   table.insert(killAnim, {func = AnimCustomFunction, args = {native, HideHedge, {cyborg}}})
   267   table.insert(killAnim, {func = AnimCustomFunction, args = {native, HideHedge, {cyborg}}})
   267   AddSkipFunction(killAnim, SkipKillAnim, {})
   268   AddSkipFunction(killAnim, SkipKillAnim, {})
   268 end
   269 end
   269 
   270 
   270 function SetupKilledAnim()
   271 function SetupKilledAnim()
   271   table.insert(killedAnim, {func = AnimWait, args = {cyborg, 3000}})
   272   table.insert(killedAnim, {func = AnimWait, args = {cyborg, 500}})
   272   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(secondPos[2])}})
   273   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(secondPos[2])}})
   273   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {native, unpack(secondPos[1])}})
   274   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {native, unpack(secondPos[1])}})
   274   table.insert(killedAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
   275   table.insert(killedAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
   275   table.insert(killedAnim, {func = AnimSay, args = {cyborg, loc("Nice work, ") .. nativeUnNames[m5DeployedNum] .. "!", SAY_SHOUT, 4000}})
   276   table.insert(killedAnim, {func = AnimSay, args = {cyborg, loc("Nice work, ") .. nativeUnNames[m5DeployedNum] .. "!", SAY_SHOUT, 4000}})
   276   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("As a reward for your performance, here's some new technology!"), SAY_SHOUT, 8000}})
   298   TurnTimeLeft = TurnTime
   299   TurnTimeLeft = TurnTime
   299   ShowMission(loc("Dragon's Lair"), loc("Obstacle course"), loc("In order to get to the other side, you need to collect the crates first.|") ..
   300   ShowMission(loc("Dragon's Lair"), loc("Obstacle course"), loc("In order to get to the other side, you need to collect the crates first.|") ..
   300                                                   loc("As the ammo is sparse, you might want to reuse ropes while mid-air.|") ..
   301                                                   loc("As the ammo is sparse, you might want to reuse ropes while mid-air.|") ..
   301                                                   loc("If you wish to restart the course, press [Precise]!|") ..
   302                                                   loc("If you wish to restart the course, press [Precise]!|") ..
   302                                                   loc("The enemy can't move but it might be a good idea to stay out of sight!|") ..
   303                                                   loc("The enemy can't move but it might be a good idea to stay out of sight!|") ..
   303                                                   loc("You have ") .. SuddenDeathTurns .. loc(" turns until Sudden Death! Better hurry!"), 1, 20000)
   304                                                   loc("You have ") .. SuddenDeathTurns .. loc(" turns until Sudden Death! Better hurry!"), 1, 0)
   304 end
   305 end
   305 
   306 
   306 function SkipKillAnim()
   307 function SkipKillAnim()
   307   AnimSwitchHog(native)
   308   AnimSwitchHog(native)
   308   AnimWait(native, 1)
   309   AnimWait(native, 1)
   315   AddEvent(CheckCyborgsDead, {}, DoCyborgsDead, {}, 0)
   316   AddEvent(CheckCyborgsDead, {}, DoCyborgsDead, {}, 0)
   316   ShowMission(loc("Dragon's Lair"), loc("The Slaughter"), loc("Kill the aliens!"), 1, 2000)
   317   ShowMission(loc("Dragon's Lair"), loc("The Slaughter"), loc("Kill the aliens!"), 1, 2000)
   317 end
   318 end
   318 
   319 
   319 function SkipKilledAnim()
   320 function SkipKilledAnim()
       
   321   SetGearPosition(native, unpack(secondPos[1]))
   320   AnimSwitchHog(native)
   322   AnimSwitchHog(native)
   321   AnimWait(native, 1)
   323   AnimWait(native, 1)
   322 end
   324 end
   323 
   325 
   324 function AfterKilledAnim()
   326 function AfterKilledAnim()
   354 end
   356 end
   355 
   357 
   356 function DoCyborgsDead()
   358 function DoCyborgsDead()
   357   NullifyAmmo()
   359   NullifyAmmo()
   358   RestoreHedge(cyborg)
   360   RestoreHedge(cyborg)
   359   SetGearPosition(cyborg, unpack(secondPos[2]))
       
   360   SetGearPosition(native, unpack(secondPos[1]))
       
   361   SetupKilledAnim()
   361   SetupKilledAnim()
   362   AddAnim(killedAnim)
   362   AddAnim(killedAnim)
   363   AddFunction({func = AfterKilledAnim, args = {}})
   363   AddFunction({func = AfterKilledAnim, args = {}})
   364 end
   364 end
   365 
   365 
   366 
   366 
   367 function PutWeaponCrates()
   367 function PutWeaponCrates()
   368   for i = 1, 6 do
   368   for i = 1, 8 do
   369     cratesNum = cratesNum + 1
   369     cratesNum = cratesNum + 1
   370     crates[cratesNum] = SpawnAmmoCrate(unpack(cratePos[cratesNum]))
   370     crates[cratesNum] = SpawnAmmoCrate(unpack(cratePos[cratesNum]))
   371   end
   371   end
   372   FollowGear(native)
   372   FollowGear(native)
   373 end
   373 end
   493 end
   493 end
   494 
   494 
   495 function AddHogs()
   495 function AddHogs()
   496 	AddTeam(loc("Natives"), 29439, "Bone", "Island", "HillBilly", "cm_birdy")
   496 	AddTeam(loc("Natives"), 29439, "Bone", "Island", "HillBilly", "cm_birdy")
   497   for i = 1, 7 do
   497   for i = 1, 7 do
   498     natives[i] = AddHog(nativeNames[i], 0, 100, nativeHats[i])
   498     natives[i] = AddHog(nativeNames[i], 0, 200, nativeHats[i])
   499     gearDead[natives[i]] = false
   499     gearDead[natives[i]] = false
   500   end
   500   end
   501 
   501 
   502   AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
   502   AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
   503   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
   503   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")