share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/first_blood.lua
changeset 13745 2bb7141496a9
parent 13588 141cdfe0f3ca
child 13755 110d6c1e817f
equal deleted inserted replaced
13744:b3b55b03d499 13745:2bb7141496a9
   544   return cratesCollected == crateNum[difficulty]
   544   return cratesCollected == crateNum[difficulty]
   545 end
   545 end
   546 
   546 
   547 function DoCratesColled()
   547 function DoCratesColled()
   548   RemoveEventFunc(CheckTimesUp)
   548   RemoveEventFunc(CheckTimesUp)
   549   TurnTimeLeft = -1
   549   SetTurnTimeLeft(cMaxTurnTime)
   550   AddCaption(loc("As the challenge was completed, Leaks A Lot set foot on the ground..."))
   550   AddCaption(loc("As the challenge was completed, Leaks A Lot set foot on the ground..."))
   551 end
   551 end
   552 
   552 
   553 function CheckChallengeWon()
   553 function CheckChallengeWon()
   554   return cratesCollected == crateNum[difficulty] and StoppedGear(youngh)
   554   return cratesCollected == crateNum[difficulty] and StoppedGear(youngh)
   571 
   571 
   572 function DoTimesUp()
   572 function DoTimesUp()
   573   challengeFailed = true
   573   challengeFailed = true
   574   deleteCrate = true
   574   deleteCrate = true
   575   DeleteGear(crates[1])
   575   DeleteGear(crates[1])
   576   TurnTimeLeft = -1
   576   SetTurnTimeLeft(cMaxTurnTime)
   577   AddCaption(loc("And so happened that Leaks A Lot failed to complete the challenge! He landed, pressured by shame ..."))
   577   AddCaption(loc("And so happened that Leaks A Lot failed to complete the challenge! He landed, pressured by shame ..."))
   578   AddEvent(CheckChallengeFailed, {}, DoChallengeFailed, {}, 0)
   578   AddEvent(CheckChallengeFailed, {}, DoChallengeFailed, {}, 0)
   579 end
   579 end
   580 
   580 
   581 function CheckChallengeFailed()
   581 function CheckChallengeFailed()
   656 
   656 
   657 -----------------------------Misc--------------------------------------
   657 -----------------------------Misc--------------------------------------
   658 function StartChallenge(time)
   658 function StartChallenge(time)
   659   cratesCollected = 0
   659   cratesCollected = 0
   660   PutCrate(1)
   660   PutCrate(1)
   661   TurnTimeLeft = time
   661   SetTurnTimeLeft(time)
   662   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)
   662   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)
   663 end
   663 end
   664 
   664 
   665 function ChoiceDialog()
   665 function ChoiceDialog()
   666   local dstr
   666   local dstr
   682   difficultyChoice = true
   682   difficultyChoice = true
   683   ChoiceDialog()
   683   ChoiceDialog()
   684 end
   684 end
   685 
   685 
   686 function SetTime(time)
   686 function SetTime(time)
   687   TurnTimeLeft = time
   687   SetTurnTimeLeft(time)
   688 end
   688 end
   689 
   689 
   690 function ResetTurnTime()
   690 function ResetTurnTime()
   691   TurnTimeLeft = tTime
   691   SetTurnTimeLeft(tTime)
   692   tTime = -1
   692   tTime = -1
   693 end
   693 end
   694 
   694 
   695 function PutCrate(i)
   695 function PutCrate(i)
   696   if i > crateNum[difficulty] then
   696   if i > crateNum[difficulty] then
   749   AnimationSetup()
   749   AnimationSetup()
   750 end
   750 end
   751 
   751 
   752 function onGameStart()
   752 function onGameStart()
   753   progress = tonumber(GetCampaignVar("Progress"))
   753   progress = tonumber(GetCampaignVar("Progress"))
   754   TurnTimeLeft = -1
   754   SetTurnTimeLeft(cMaxTurnTime)
   755   FollowGear(youngh)
   755   FollowGear(youngh)
   756 	ShowMission(loc("A Classic Fairytale"), loc("First Blood"), loc("Finish your training|Hint: Animations can be skipped with the [Precise] key."), -amSkip, 0)
   756 	ShowMission(loc("A Classic Fairytale"), loc("First Blood"), loc("Finish your training|Hint: Animations can be skipped with the [Precise] key."), -amSkip, 0)
   757   HideHog(cannibal)
   757   HideHog(cannibal)
   758 
   758 
   759   AddAnim(startDialogue)
   759   AddAnim(startDialogue)
   844   if CurrentHedgehog == cannibal and cannibalVisible == false then
   844   if CurrentHedgehog == cannibal and cannibalVisible == false then
   845     RestoreHog(cannibal)
   845     RestoreHog(cannibal)
   846   end
   846   end
   847   SwitchHog(youngh)
   847   SwitchHog(youngh)
   848   FollowGear(youngh)
   848   FollowGear(youngh)
   849   TurnTimeLeft = -1
   849   SetTurnTimeLeft(cMaxTurnTime)
   850 end
   850 end
   851 
   851 
   852 function onGearDamage(gear, damage)
   852 function onGearDamage(gear, damage)
   853   if gear == youngh then
   853   if gear == youngh then
   854     youngdamaged = true
   854     youngdamaged = true