share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/first_blood.lua
changeset 12545 9c3ff4ffd4f3
parent 12544 77b05be26a6e
child 12554 194b00c4ba07
equal deleted inserted replaced
12544:77b05be26a6e 12545:9c3ff4ffd4f3
    29 targXdif1 = {2749, 2909, 2770, 2836, 1558, 1305}
    29 targXdif1 = {2749, 2909, 2770, 2836, 1558, 1305}
    30 targYdif1 = {1179, 1313, 1734, 1441, 1152, 1259}
    30 targYdif1 = {1179, 1313, 1734, 1441, 1152, 1259}
    31 targetPosX = {{821, 866, 789}, {614, 656, 638}, {1238, 1237, 1200}}
    31 targetPosX = {{821, 866, 789}, {614, 656, 638}, {1238, 1237, 1200}}
    32 targetPosY = {{1342, 1347, 1326}, {1112, 1121, 1061}, {1152, 1111, 1111}}
    32 targetPosY = {{1342, 1347, 1326}, {1112, 1121, 1061}, {1152, 1111, 1111}}
    33 crateNum = {6, 8}
    33 crateNum = {6, 8}
    34 
    34 rope2GirderX = 3245
       
    35 rope2GirderY = 1190
    35 
    36 
    36 stage = 1
    37 stage = 1
    37 cratesCollected = 0
    38 cratesCollected = 0
    38 chalTries = 0
    39 chalTries = 0
    39 targetsDestroyed = 0
    40 targetsDestroyed = 0
    50 elderKilled = false
    51 elderKilled = false
    51 princessKilled = false
    52 princessKilled = false
    52 rope1Taken = false
    53 rope1Taken = false
    53 paraTaken = false
    54 paraTaken = false
    54 rope2Taken = false
    55 rope2Taken = false
       
    56 rope2InProgress = false
    55 punchTaken = false
    57 punchTaken = false
    56 canKilled = false
    58 canKilled = false
    57 desertTaken = false
    59 desertTaken = false
    58 challengeFailed = false
    60 challengeFailed = false
    59 deleteCrate = false
    61 deleteCrate = false
   268   return youngdamaged and StoppedGear(youngh)
   270   return youngdamaged and StoppedGear(youngh)
   269 end
   271 end
   270 
   272 
   271 function DoOnDamage()
   273 function DoOnDamage()
   272   AddAnim(damageAnim)
   274   AddAnim(damageAnim)
       
   275   if rope2InProgress and not rope2Taken then
       
   276     AnimSetGearPosition(youngh, 3040, 1221)
       
   277   end
   273   youngdamaged = false
   278   youngdamaged = false
   274   AddFunction({func = ResetTurnTime, args = {}})
   279   AddFunction({func = ResetTurnTime, args = {}})
   275 end
   280 end
   276 
   281 
   277 function CheckDeath()
   282 function CheckDeath()
   365   y = GetY(youngh)
   370   y = GetY(youngh)
   366   return x < 3005 and y > 1500 and StoppedGear(youngh)
   371   return x < 3005 and y > 1500 and StoppedGear(youngh)
   367 end
   372 end
   368 
   373 
   369 function DoPastMoleHead()
   374 function DoPastMoleHead()
       
   375   -- Initiate parachute challenge
   370   RemoveEventFunc(CheckOnMoleHead)
   376   RemoveEventFunc(CheckOnMoleHead)
   371   ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope, 100)
   377   ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope, 100)
       
   378   rope2InProgress = true
   372   AddAmmo(youngh, amRope, 0)
   379   AddAmmo(youngh, amRope, 0)
   373   SetGearMessage(CurrentHedgehog, 0)
   380   SetGearMessage(CurrentHedgehog, 0)
       
   381   -- Block the way to the hole to the right, since the player loses the rope for this section
       
   382   PlaceGirder(rope2GirderX, rope2GirderY, 6)
   374   AddAnim(pastMoleHeadAnim)
   383   AddAnim(pastMoleHeadAnim)
   375   AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0)
   384   AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0)
   376 end
   385 end
   377 
   386 
   378 function DoOnMoleHead()
   387 function DoOnMoleHead()
       
   388   -- Initiate parachute challenge
   379   RemoveEventFunc(CheckPastMoleHead)
   389   RemoveEventFunc(CheckPastMoleHead)
   380   ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope, 100)
   390   ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope, 100)
       
   391   rope2InProgress = true
   381   AddAmmo(youngh, amRope, 0)
   392   AddAmmo(youngh, amRope, 0)
   382   SetGearMessage(CurrentHedgehog, 0)
   393   SetGearMessage(CurrentHedgehog, 0)
       
   394   -- Block the way to the hole to the right, since the player loses the rope for this section
       
   395   PlaceGirder(rope2GirderX, rope2GirderY, 6)
   383   AddAnim(onMoleHeadAnim)
   396   AddAnim(onMoleHeadAnim)
   384   AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0)
   397   AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0)
   385 end
   398 end
   386 
   399 
   387 function CheckTookRope2()
   400 function CheckTookRope2()
   426   ropeCrate3 = SpawnUtilityCrate(2000, 1200, amRope, 100)
   439   ropeCrate3 = SpawnUtilityCrate(2000, 1200, amRope, 100)
   427   AddEvent(CheckTookRope3, {}, AddAmmo, {youngh, amRope, 100}, 0)
   440   AddEvent(CheckTookRope3, {}, AddAmmo, {youngh, amRope, 100}, 0)
   428   AddEvent(CheckCratesColled, {}, DoCratesColled, {}, 0)
   441   AddEvent(CheckCratesColled, {}, DoCratesColled, {}, 0)
   429   AddEvent(CheckChallengeWon, {}, DoChallengeWon, {}, 0)
   442   AddEvent(CheckChallengeWon, {}, DoChallengeWon, {}, 0)
   430   AddEvent(CheckTimesUp, {}, DoTimesUp, {}, 1)
   443   AddEvent(CheckTimesUp, {}, DoTimesUp, {}, 1)
       
   444   -- Remove up the old mole blockade from the parachute challenge
       
   445   EraseSprite(rope2GirderX, rope2GirderY, sprAmGirder, 6)
   431 end
   446 end
   432 
   447 
   433 function CheckChoice()
   448 function CheckChoice()
   434   return difficulty ~= 0
   449   return difficulty ~= 0
   435 end
   450 end
   667     rope1Taken = true
   682     rope1Taken = true
   668   elseif gear == paraCrate then
   683   elseif gear == paraCrate then
   669     paraTaken = true
   684     paraTaken = true
   670   elseif gear == ropeCrate2 then
   685   elseif gear == ropeCrate2 then
   671     rope2Taken = true
   686     rope2Taken = true
       
   687     rope2InProgress = false
   672   elseif gear == ropeCrate3 then
   688   elseif gear == ropeCrate3 then
   673     rope3Taken = true
   689     rope3Taken = true
   674   elseif gear == crates[1] then
   690   elseif gear == crates[1] then
   675     -- Play sound if challenge crate (fake crate) collected
   691     -- Play sound if challenge crate (fake crate) collected
   676     if band(GetGearMessage(gear), gmDestroy) ~= 0 then
   692     if band(GetGearMessage(gear), gmDestroy) ~= 0 then