share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua
changeset 12798 fdb3730aa0e2
parent 12794 bca911f8e804
child 12901 bdf8e80a97b8
equal deleted inserted replaced
12797:981036f1bdef 12798:fdb3730aa0e2
    14 = FLOW CHART =
    14 = FLOW CHART =
    15 - Cut scene: Intro
    15 - Cut scene: Intro
    16 - TBS
    16 - TBS
    17 | Player accomplishes first sub-goal first:
    17 | Player accomplishes first sub-goal first:
    18     - Cut scene: Cyborg reveals second goal
    18     - Cut scene: Cyborg reveals second goal
       
    19     - A ton of weapon crates and some rope crates spawn on the long platform
    19 | Player accomplshed second sub-goal first:
    20 | Player accomplshed second sub-goal first:
    20     - Hero reminds player to collect/destroy remaining crates
    21     - Hero reminds player to collect/destroy remaining crates
    21 - Player accomplished both goals
    22 - Player accomplished both goals
    22 - Cut scene: Cyborg teleports hero and congrats hero and reveals portal gun
    23 - Cut scene: Cyborg teleports hero to the long platform and congrats hero
    23 - A teleporter crate appears, allowing the player to complete the mission
    24 - Hero's ammo is cleared, all crates, mines, sticky mines and barrels are removed from platform
       
    25 - Spawn a portal gun crate on the long platform and also a teleportation crate further to the right
       
    26 - (These utilities can be used to finish the mission)
    24 - Player takes final crate at the very right
    27 - Player takes final crate at the very right
    25 > Victory
    28 > Victory
    26 
    29 
    27 ]]
    30 ]]
    28 
    31 
   202 
   205 
   203 firstTurn = true
   206 firstTurn = true
   204 cyborgsKilledBeforeCrates = false
   207 cyborgsKilledBeforeCrates = false
   205 cratesTaken = false
   208 cratesTaken = false
   206 doneCyborgsDead = false
   209 doneCyborgsDead = false
       
   210 
       
   211 annoyingGearsForPortalScene = {}
   207 -----------------------------Animations--------------------------------
   212 -----------------------------Animations--------------------------------
   208 function EmitDenseClouds(dir)
   213 function EmitDenseClouds(dir)
   209   local dif
   214   local dif
   210   if dir == "Left" then
   215   if dir == "Left" then
   211     dif = 10
   216     dif = 10
   364 
   369 
   365 function SkipKillAnim()
   370 function SkipKillAnim()
   366   AnimSwitchHog(native)
   371   AnimSwitchHog(native)
   367   AnimWait(native, 1)
   372   AnimWait(native, 1)
   368   AddFunction({func = HideHedge, args = {cyborg}})
   373   AddFunction({func = HideHedge, args = {cyborg}})
       
   374   if CheckCyborgsDead() then
       
   375     DoCyborgsDead()
       
   376   end
   369 end
   377 end
   370 
   378 
   371 function AfterKillAnim()
   379 function AfterKillAnim()
   372   PutWeaponCrates()
   380   if not cyborgsKilledBeforeCrates then
   373   TurnTimeLeft = TurnTime
   381     PutWeaponCrates()
   374   AddEvent(CheckCyborgsDead, {}, DoCyborgsDead, {}, 0)
   382     TurnTimeLeft = TurnTime
   375   ShowMission(loc("Dragon's Lair"), loc("The Slaughter"), loc("Kill the aliens!").."|"..loc("Mines time: 5 seconds"), 1, 2000)
   383     AddEvent(CheckCyborgsDead, {}, DoCyborgsDead, {}, 0)
       
   384     ShowMission(loc("Dragon's Lair"), loc("The Slaughter"), loc("Kill the aliens!").."|"..loc("Mines time: 5 seconds"), 1, 2000)
       
   385   end
   376 end
   386 end
   377 
   387 
   378 function SkipKilledAnim()
   388 function SkipKilledAnim()
   379   AnimSetGearPosition(native, unpack(secondPos[1]))
   389   AnimSetGearPosition(native, unpack(secondPos[1]))
   380   AnimSwitchHog(native)
   390   AnimSwitchHog(native)
   381   AnimWait(native, 1)
   391   AnimWait(native, 1)
   382 end
   392 end
   383 
   393 
   384 function AfterKilledAnim()
   394 function AfterKilledAnim()
       
   395   -- Final mission segment with the portal gun
   385   HideHedge(cyborg)
   396   HideHedge(cyborg)
   386   TurnTimeLeft = TurnTime
   397   TurnTimeLeft = TurnTime
   387   SetGearMessage(native, 0)
   398   SetGearMessage(native, 0)
   388   AddAmmo(native, amPortalGun, 100)
   399   SpawnUtilityCrate(1184, 399, amPortalGun, 100)
   389   SpawnUtilityCrate(2259, 755, amTeleport, 2)
   400   SpawnUtilityCrate(2259, 755, amTeleport, 2)
   390   SpawnHealthCrate(secondPos[1][1] + 30, secondPos[1][2])
   401   SpawnHealthCrate(secondPos[1][1] + 50, secondPos[1][2] - 20)
   391   ShowMission(loc("Dragon's Lair"), loc("The what?!"), loc("Use the portal gun to get to the next crate, then use the new gun to get to the final destination!|")..
   402   ShowMission(loc("Dragon's Lair"), loc("The what?!"), loc("Use the portal gun to get to the next crate, then use the new gun to get to the final destination!|")..
   392                                              loc("Portal hint: one goes to the destination, and one is the entrance.|")..
   403                                              loc("Portal hint: one goes to the destination, and one is the entrance.|")..
   393                                              loc("Teleport hint: just use the mouse to select the destination!").."|"..
   404                                              loc("Teleport hint: just use the mouse to select the destination!").."|"..
   394                                              loc("Mines time: 5 seconds"), 1, 0)
   405                                              loc("Mines time: 5 seconds"), 1, 8000)
   395 end
   406 end
   396 -----------------------------Events------------------------------------
   407 -----------------------------Events------------------------------------
   397 
   408 
   398 function CheckCyborgsDead()
   409 function CheckCyborgsDead()
   399   return cyborgsLeft == 0
   410   return cyborgsLeft == 0
   400 end
   411 end
   401 
   412 
   402 function NullifyAmmo()
   413 function NullifyAmmo()
       
   414   -- Clear the ammo and delete all inappropirate gears on the long platform for the portal scene
   403   AddAmmo(native, amRope, 0)
   415   AddAmmo(native, amRope, 0)
   404   AddAmmo(native, amGirder, 0)
   416   AddAmmo(native, amGirder, 0)
   405   AddAmmo(native, amLowGravity, 0)
   417   AddAmmo(native, amLowGravity, 0)
   406   AddAmmo(native, amBazooka, 0)
   418   AddAmmo(native, amBazooka, 0)
   407   AddAmmo(native, amSniperRifle, 0)
   419   AddAmmo(native, amSniperRifle, 0)
   410   AddAmmo(native, amFirePunch, 0)
   422   AddAmmo(native, amFirePunch, 0)
   411   AddAmmo(native, amBaseballBat, 0)
   423   AddAmmo(native, amBaseballBat, 0)
   412   AddAmmo(native, amMortar, 0)
   424   AddAmmo(native, amMortar, 0)
   413   AddAmmo(native, amSnowball, 0)
   425   AddAmmo(native, amSnowball, 0)
   414   AddAmmo(native, amShotgun, 0)
   426   AddAmmo(native, amShotgun, 0)
       
   427 
       
   428   for i=1, #annoyingGearsForPortalScene do
       
   429     local gear = annoyingGearsForPortalScene[i]
       
   430     if not gearDead[gear] and GetY(gear) > 100 and GetY(gear) < 571 and GetX(gear) > 840 and GetX(gear) < 1550 then
       
   431       DeleteGear(annoyingGearsForPortalScene[i])
       
   432     end
       
   433   end
   415 end
   434 end
   416 
   435 
   417 function DoCyborgsDead()
   436 function DoCyborgsDead()
   418   if cratesTaken and not doneCyborgsDead then
   437   if cratesTaken and not doneCyborgsDead then
   419     NullifyAmmo()
   438     NullifyAmmo()
   680       cyborgsLeft = cyborgsLeft - 1
   699       cyborgsLeft = cyborgsLeft - 1
   681     end
   700     end
   682   end
   701   end
   683 end
   702 end
   684 
   703 
       
   704 function onGearAdd(gear)
       
   705   -- Track gears for removal when reaching the portal segment
       
   706   local gt = GetGearType(gear)
       
   707   if gt == gtMine or gt == gtSMine or gt == gtCase or gt == gtExplosives then
       
   708     table.insert(annoyingGearsForPortalScene, gear)
       
   709   end
       
   710 end
       
   711 
   685 function onAmmoStoreInit()
   712 function onAmmoStoreInit()
   686   SetAmmo(amFirePunch, 3, 0, 0, 0)
   713   SetAmmo(amFirePunch, 3, 0, 0, 0)
   687   SetAmmo(amBaseballBat, 2, 0, 0, 0)
   714   SetAmmo(amBaseballBat, 2, 0, 0, 0)
   688   SetAmmo(amGirder, 0, 0, 0, 2)
   715   SetAmmo(amGirder, 0, 0, 0, 2)
   689   SetAmmo(amLowGravity, 0, 0, 0, 1)
   716   SetAmmo(amLowGravity, 0, 0, 0, 1)
       
   717   SetAmmo(amJetpack, 0, 0, 0, 1)
   690   SetAmmo(amSkip, 9, 0, 0, 0)
   718   SetAmmo(amSkip, 9, 0, 0, 0)
   691 end
   719 end
   692 
   720 
   693 function onNewTurn()
   721 function onNewTurn()
   694   if firstTurn then
   722   if firstTurn then