share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/first_blood.lua
changeset 12604 a45f8eec6869
parent 12585 b28f09d70e73
child 12605 d05a159e7874
equal deleted inserted replaced
12603:1d33d66e40a7 12604:a45f8eec6869
    38 cratesCollected = 0
    38 cratesCollected = 0
    39 chalTries = 0
    39 chalTries = 0
    40 targetsDestroyed = 0
    40 targetsDestroyed = 0
    41 targsWave = 1
    41 targsWave = 1
    42 tTime = -1
    42 tTime = -1
    43 difficulty = 0
    43 difficulty = 1
    44 
    44 
    45 cannibalVisible = false
    45 cannibalVisible = false
    46 cannibalKilles = false
    46 cannibalKilles = false
    47 youngdamaged = false
    47 youngdamaged = false
    48 youngKilled = false
    48 youngKilled = false
    88   end
    88   end
    89 end
    89 end
    90 
    90 
    91 function SkipDamageAnim(anim)
    91 function SkipDamageAnim(anim)
    92   SwitchHog(youngh)
    92   SwitchHog(youngh)
    93   SetInputMask(0xFFFFFFFF)
    93   AnimSetInputMask(0xFFFFFFFF)
    94 end
    94 end
    95 
    95 
    96 function SkipOnShroom()
    96 function SkipOnShroom()
    97   Skipanim(onShroomAnim)
    97   Skipanim(onShroomAnim)
    98   AnimSetGearPosition(elderh, 2700, 1278)
    98   AnimSetGearPosition(elderh, 2700, 1278)
   444   AddEvent(CheckTimesUp, {}, DoTimesUp, {}, 1)
   444   AddEvent(CheckTimesUp, {}, DoTimesUp, {}, 1)
   445   -- Remove up the old mole blockade from the parachute challenge
   445   -- Remove up the old mole blockade from the parachute challenge
   446   EraseSprite(rope2GirderX, rope2GirderY, sprAmGirder, 6)
   446   EraseSprite(rope2GirderX, rope2GirderY, sprAmGirder, 6)
   447 end
   447 end
   448 
   448 
   449 function CheckChoice()
       
   450   return difficulty ~= 0
       
   451 end
       
   452 
       
   453 function DoChoice()
   449 function DoChoice()
       
   450   PlaySound(sndPlaced)
   454   difficultyChoice = false
   451   difficultyChoice = false
   455   SetInputMask(0xFFFFFFFF)
   452   AnimSetInputMask(0xFFFFFFFF)
   456   StartChallenge(120000 + chalTries * 20000)
   453   StartChallenge(120000 + chalTries * 20000)
   457 end
   454 end
   458 
   455 
   459 function CheckCratesColled()
   456 function CheckCratesColled()
   460   return cratesCollected == crateNum[difficulty]
   457   return cratesCollected == crateNum[difficulty]
   576   PutCrate(1)
   573   PutCrate(1)
   577   TurnTimeLeft = time
   574   TurnTimeLeft = time
   578   ShowMission(loc("First Blood"), loc("The Crate Frenzy"), loc("Collect the crates within the time limit!|If you fail, you'll have to try again."), 1, 5000)
   575   ShowMission(loc("First Blood"), loc("The Crate Frenzy"), loc("Collect the crates within the time limit!|If you fail, you'll have to try again."), 1, 5000)
   579 end
   576 end
   580 
   577 
       
   578 function ChoiceDialog()
       
   579   local dstr
       
   580   if difficulty == 2 then
       
   581     dstr = loc("Difficulty: Hard")
       
   582   else
       
   583     dstr = loc("Difficulty: Easy")
       
   584   end
       
   585   ShowMission(loc("First Blood"), loc("The Torment"),
       
   586     loc("Your next task is to collect some crates by using the rope!") .. "|" ..
       
   587     loc("Press [Left] and [Right] to change the difficulty.") .. "| |" ..
       
   588     dstr .. "| |" ..
       
   589     loc("Press [Jump] to begin."),
       
   590     0, 300000)
       
   591 end
       
   592 
   581 function SetChoice()
   593 function SetChoice()
   582   SetInputMask(band(0xFFFFFFFF, bnot(gmAnimate+gmAttack+gmDown+gmHJump+gmLJump+gmSlot+gmSwitch+gmTimer+gmUp+gmWeapon)))
   594   AnimSetInputMask(0)
   583   difficultyChoice = true
   595   difficultyChoice = true
   584   ShowMission(loc("First Blood"), loc("The Torment"), loc("Select difficulty: [Left] - easier or [Right] - harder"), 0, 300000)
   596   ChoiceDialog()
   585   AddEvent(CheckChoice, {}, DoChoice, {}, 0)
       
   586 end
   597 end
   587 
   598 
   588 function SetTime(time)
   599 function SetTime(time)
   589   TurnTimeLeft = time
   600   TurnTimeLeft = time
   590 end
   601 end
   762   end
   773   end
   763 end
   774 end
   764 
   775 
   765 function onLeft()
   776 function onLeft()
   766   if difficultyChoice == true then
   777   if difficultyChoice == true then
   767     difficulty = 1
   778     if difficulty ~= 1 then
   768   end
   779        difficulty = 1
   769 end
   780     else
   770 
   781        difficulty = 2
   771 function onRight()
   782     end
       
   783     PlaySound(sndSwitchHog)
       
   784     ChoiceDialog()
       
   785   end
       
   786 end
       
   787 onRight = onLeft
       
   788 
       
   789 function onLJump()
   772   if difficultyChoice == true then
   790   if difficultyChoice == true then
   773     difficulty = 2
   791     DoChoice()
   774   end
   792   end
   775 end
   793 end
   776 
   794 onHJump = onLJump