share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua
changeset 12364 5857936921ec
parent 12361 05fe955e2763
child 12512 b1c2b0a8a43e
equal deleted inserted replaced
12363:6ad1f86e0c81 12364:5857936921ec
   579   SpawnPlatformCrates()
   579   SpawnPlatformCrates()
   580   SetGearMessage(CurrentHedgehog, 0)
   580   SetGearMessage(CurrentHedgehog, 0)
   581   AddEvent(CheckTurnsOver, {}, DoTurnsOver, {3}, 0)
   581   AddEvent(CheckTurnsOver, {}, DoTurnsOver, {3}, 0)
   582   AddEvent(CheckWaveDead, {3}, DoWaveDead, {3}, 0)
   582   AddEvent(CheckWaveDead, {3}, DoWaveDead, {3}, 0)
   583   AddEvent(CheckDeployedDead, {}, DoDeployedDead, {}, 0)
   583   AddEvent(CheckDeployedDead, {}, DoDeployedDead, {}, 0)
   584   TurnTimeLeft = 0
   584   EndTurn(true)
   585   ShowMission(loc("Backstab"), loc("Drills"), loc("You have 7 turns until the next wave arrives.|Make sure the arriving cannibals are greeted appropriately!|If the hog dies, the cause is lost.|Hint: you might want to use some mines..."), 1, 12000)
   585   ShowMission(loc("Backstab"), loc("Drills"), loc("You have 7 turns until the next wave arrives.|Make sure the arriving cannibals are greeted appropriately!|If the hog dies, the cause is lost.|Hint: you might want to use some mines..."), 1, 12000)
   586 end
   586 end
   587 
   587 
   588 function DoTurnsOver()
   588 function DoTurnsOver()
   589   stage = wave3Stage
   589   stage = wave3Stage
   608   SetHealth(spyHog, 26)
   608   SetHealth(spyHog, 26)
   609 end
   609 end
   610 
   610 
   611 function AfterStartAnim()
   611 function AfterStartAnim()
   612   AnimSwitchHog(natives[leaksNum])
   612   AnimSwitchHog(natives[leaksNum])
   613   TurnTimeLeft = 0
   613   EndTurn(true)
   614   stage = spyKillStage
   614   stage = spyKillStage
   615   AddEvent(CheckChoice, {}, DoChoice, {}, 0)
   615   AddEvent(CheckChoice, {}, DoChoice, {}, 0)
   616   AddEvent(CheckKilledOther, {}, DoKilledOther, {}, 0)
   616   AddEvent(CheckKilledOther, {}, DoKilledOther, {}, 0)
   617   AddEvent(CheckChoiceRefuse, {}, DoChoiceRefuse, {}, 0)
   617   AddEvent(CheckChoiceRefuse, {}, DoChoiceRefuse, {}, 0)
   618   ShowMission(loc("Backstab"), loc("Judas"), loc("Kill the traitor...or spare his life!|Kill him or press [Precise]!"), 1, 8000)
   618   ShowMission(loc("Backstab"), loc("Judas"), loc("Kill the traitor...or spare his life!|Kill him or press [Precise]!"), 1, 8000)
   630 function DoDeployedDead()
   630 function DoDeployedDead()
   631   ShowMission(loc("Backstab"), loc("Brutus"), loc("You have failed to save the tribe!"), 0, 6000)
   631   ShowMission(loc("Backstab"), loc("Brutus"), loc("You have failed to save the tribe!"), 0, 6000)
   632   DismissTeam(loc("Natives"))
   632   DismissTeam(loc("Natives"))
   633   DismissTeam(loc("Tribe"))
   633   DismissTeam(loc("Tribe"))
   634   DismissTeam(loc("011101001"))
   634   DismissTeam(loc("011101001"))
   635   TurnTimeLeft = 0
   635   EndTurn(true)
   636 end
   636 end
   637 
   637 
   638 function CheckChoice()
   638 function CheckChoice()
   639   return choice ~= 0 and tmpVar == 0
   639   return choice ~= 0 and tmpVar == 0
   640 end
   640 end
   674 
   674 
   675 function DoKilledOther()
   675 function DoKilledOther()
   676   ShowMission(loc("Backstab"), loc("Brutus"), loc("You have killed an innocent hedgehog!"), 0, 6000)
   676   ShowMission(loc("Backstab"), loc("Brutus"), loc("You have killed an innocent hedgehog!"), 0, 6000)
   677   DismissTeam(loc("Natives"))
   677   DismissTeam(loc("Natives"))
   678   DismissTeam(loc("Tribe"))
   678   DismissTeam(loc("Tribe"))
   679   TurnTimeLeft = 0
   679   EndTurn(true)
   680 end
   680 end
   681 
   681 
   682 function CheckWaveDead(index)
   682 function CheckWaveDead(index)
   683   for i = (index - 1) * 3 + 1, index * 3 do
   683   for i = (index - 1) * 3 + 1, index * 3 do
   684     if cannibalDead[i] ~= true or CurrentHedgehog == cannibals[i] then
   684     if cannibalDead[i] ~= true or CurrentHedgehog == cannibals[i] then
   687   end
   687   end
   688   return true
   688   return true
   689 end
   689 end
   690 
   690 
   691 function DoWaveDead(index)
   691 function DoWaveDead(index)
   692   TurnTimeLeft = 0
   692   EndTurn(true)
   693   needToAct = index
   693   needToAct = index
   694 end
   694 end
   695 
   695 
   696 function AddWave3DeadAnim()
   696 function AddWave3DeadAnim()
   697   AnimSwitchHog(deployedHog)
   697   AnimSwitchHog(deployedHog)
   784 
   784 
   785   DismissTeam(loc("Tribe"))
   785   DismissTeam(loc("Tribe"))
   786   DismissTeam(loc("Assault Team"))
   786   DismissTeam(loc("Assault Team"))
   787   DismissTeam(loc("Reinforcements"))
   787   DismissTeam(loc("Reinforcements"))
   788   DismissTeam(loc("011101001"))
   788   DismissTeam(loc("011101001"))
   789   TurnTimeLeft = 0
   789   EndTurn(true)
   790 end
   790 end
   791 
   791 
   792 -----------------------------Misc--------------------------------------
   792 -----------------------------Misc--------------------------------------
   793 
   793 
   794 function SpawnCrates()
   794 function SpawnCrates()
  1057     TurnTimeLeft = -1
  1057     TurnTimeLeft = -1
  1058     return
  1058     return
  1059   end
  1059   end
  1060 
  1060 
  1061   if GetHogTeamName(CurrentHedgehog) == loc("Tribe") then
  1061   if GetHogTeamName(CurrentHedgehog) == loc("Tribe") then
  1062     TurnTimeLeft = 0
  1062     EndTurn(true)
  1063     return
  1063     return
  1064   end
  1064   end
  1065   TurnsLeft = TurnsLeft - 1
  1065   TurnsLeft = TurnsLeft - 1
  1066   
  1066   
  1067   if stage == platformStage then
  1067   if stage == platformStage then
  1068     AddCaption(string.format(loc("Turns until arrival: %d"), TurnsLeft))
  1068     AddCaption(string.format(loc("Turns until arrival: %d"), TurnsLeft))
  1069   end
  1069   end
  1070 
  1070 
  1071   if stage == spyKillStage then
  1071   if stage == spyKillStage then
  1072     if CurrentHedgehog == spyHog or GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then
  1072     if CurrentHedgehog == spyHog or GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then
  1073       TurnTimeLeft = 0
  1073       EndTurn(true)
  1074     else
  1074     else
  1075       SetGearMessage(CurrentHedgehog, 0)
  1075       SetGearMessage(CurrentHedgehog, 0)
  1076       --AnimSwitchHog(natives[leaksNum])
  1076       --AnimSwitchHog(natives[leaksNum])
  1077       TurnTimeLeft = -1
  1077       TurnTimeLeft = -1
  1078     end
  1078     end