share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/backstab.lua
changeset 7518 70babd9073a2
parent 7512 cc3f036121fe
child 7827 353d90ddc188
equal deleted inserted replaced
7516:d167af4ab5a0 7518:70babd9073a2
   276   AnimInsertStepNext({func = AnimSay, args = {natives[girlNum], loc("We made sure noone followed us!"), SAY_SAY, 4000}})
   276   AnimInsertStepNext({func = AnimSay, args = {natives[girlNum], loc("We made sure noone followed us!"), SAY_SAY, 4000}})
   277   AnimInsertStepNext({func = AnimSay, args = {natives[leaksNum], loc("What? Here? How did they find us?!"), SAY_SAY, 5000}})
   277   AnimInsertStepNext({func = AnimSay, args = {natives[leaksNum], loc("What? Here? How did they find us?!"), SAY_SAY, 5000}})
   278 end
   278 end
   279 
   279 
   280 function AnimationSetup()
   280 function AnimationSetup()
   281   table.insert(startAnim, {func = AnimWait, args = {natives[leaksNum], 3000}})
   281   table.insert(startAnim, {func = AnimWait, swh = false, args = {natives[leaksNum], 3000}})
   282   table.insert(startAnim, {func = AnimCustomFunction, swh = false, args = {natives[leaksNum], SaySafe, {}}})
   282   table.insert(startAnim, {func = AnimCustomFunction, swh = false, args = {natives[leaksNum], SaySafe, {}}})
   283   if needRevival == true then
   283   if needRevival == true then
   284     table.insert(startAnim, {func = AnimCustomFunction, swh = false, args = {cyborg, ReviveNatives, {}}})
   284     table.insert(startAnim, {func = AnimCustomFunction, swh = false, args = {cyborg, ReviveNatives, {}}})
   285     table.insert(startAnim, {func = AnimCustomFunction, swh = false, args = {natives[leaksNum], WonderAlive, {}}})
   285     table.insert(startAnim, {func = AnimCustomFunction, swh = false, args = {natives[leaksNum], WonderAlive, {}}})
   286     table.insert(startAnim, {func = AnimCustomFunction, swh = false, args = {cyborg, ExplainAlive, {}}})
   286     table.insert(startAnim, {func = AnimCustomFunction, swh = false, args = {cyborg, ExplainAlive, {}}})
   596   SetHealth(spyHog, 26)
   596   SetHealth(spyHog, 26)
   597 end
   597 end
   598 
   598 
   599 function AfterStartAnim()
   599 function AfterStartAnim()
   600   AnimSwitchHog(natives[leaksNum])
   600   AnimSwitchHog(natives[leaksNum])
   601   TurnTimeLeft = -1
   601   TurnTimeLeft = 0
   602   stage = spyKillStage
   602   stage = spyKillStage
   603   AddEvent(CheckChoice, {}, DoChoice, {}, 0)
   603   AddEvent(CheckChoice, {}, DoChoice, {}, 0)
   604   AddEvent(CheckKilledOther, {}, DoKilledOther, {}, 0)
   604   AddEvent(CheckKilledOther, {}, DoKilledOther, {}, 0)
   605   AddEvent(CheckChoiceRefuse, {}, DoChoiceRefuse, {}, 0)
   605   AddEvent(CheckChoiceRefuse, {}, DoChoiceRefuse, {}, 0)
   606   ShowMission(loc("Backstab"), loc("Judas"), loc("Kill the traitor...or spare his life!|Kill him or press [Precise]!"), 1, 8000)
   606   ShowMission(loc("Backstab"), loc("Judas"), loc("Kill the traitor...or spare his life!|Kill him or press [Precise]!"), 1, 8000)
   836     cyborgHidden = false
   836     cyborgHidden = false
   837   end
   837   end
   838 end
   838 end
   839 
   839 
   840 function SetupPlace()
   840 function SetupPlace()
   841   startElimination = 1
   841   startNativesNum = nativesNum
   842   HideHog(cyborg)
   842   HideHog(cyborg)
   843   cyborgHidden = true
   843   cyborgHidden = true
   844   for i = 1, 9 do
   844   for i = 1, 9 do
   845     HideHog(cannibals[i])
   845     HideHog(cannibals[i])
   846     cannibalHidden[i] = true
   846     cannibalHidden[i] = true
   851     needRevival = true
   851     needRevival = true
   852   end
   852   end
   853   if m4DenseDead == 1 then
   853   if m4DenseDead == 1 then
   854     if m2Choice ~= choiceAccepted then
   854     if m2Choice ~= choiceAccepted then
   855       DeleteGear(natives[denseNum])
   855       DeleteGear(natives[denseNum])
       
   856       startNativesNum = startNativesNum - 1
       
   857       nativeDead[denseNum] = true
   856     else
   858     else
   857       HideHog(natives[denseNum])
   859       HideHog(natives[denseNum])
   858       nativeHidden[denseNum] = true
   860       nativeHidden[denseNum] = true
   859       needRevival = true
   861       needRevival = true
   860     end
   862     end
   864     nativeHidden[waterNum] = true
   866     nativeHidden[waterNum] = true
   865     needRevival = true
   867     needRevival = true
   866   end
   868   end
   867   if m4ChiefDead == 1 then
   869   if m4ChiefDead == 1 then
   868     DeleteGear(natives[chiefNum])
   870     DeleteGear(natives[chiefNum])
       
   871     startNativesNum = startNativesNum - 1
       
   872     nativeDead[chiefNum] = true
   869     AnimSetGearPosition(natives[girlNum], unpack(nativePos[buffaloNum]))
   873     AnimSetGearPosition(natives[girlNum], unpack(nativePos[buffaloNum]))
   870     nativePos[girlNum] = nativePos[buffaloNum]
   874     nativePos[girlNum] = nativePos[buffaloNum]
   871   end
   875   end
   872   if m4BuffaloDead == 1 then
   876   if m4BuffaloDead == 1 then
       
   877     startNativesNum = startNativesNum - 1
       
   878     nativeDead[buffaloNum] = true
   873     DeleteGear(natives[buffaloNum])
   879     DeleteGear(natives[buffaloNum])
   874   end
   880   end
   875   startElimination = 0
       
   876   PlaceGirder(3568, 1461, 1)
   881   PlaceGirder(3568, 1461, 1)
   877   PlaceGirder(440, 523, 5)
   882   PlaceGirder(440, 523, 5)
   878   PlaceGirder(350, 441, 1)
   883   PlaceGirder(350, 441, 1)
   879   PlaceGirder(405, 553, 5)
   884   PlaceGirder(405, 553, 5)
   880   PlaceGirder(316, 468, 1)
   885   PlaceGirder(316, 468, 1)
   881   PlaceGirder(1319, 168, 0)
   886   PlaceGirder(1319, 168, 0)
   882   startNativesNum = nativesNum
       
   883 end
   887 end
   884 
   888 
   885 function SetupAmmo()
   889 function SetupAmmo()
   886   AddAmmo(natives[girlNum], amSwitch, 0)
   890   AddAmmo(natives[girlNum], amSwitch, 0)
   887 end
   891 end
   974 end
   978 end
   975 
   979 
   976 function onGearDelete(gear)
   980 function onGearDelete(gear)
   977   for i = 1, 7 do
   981   for i = 1, 7 do
   978     if gear == natives[i] then
   982     if gear == natives[i] then
       
   983       if nativeDead[i] ~= true then
       
   984         freshDead = nativeNames[i]
       
   985       end
   979       nativeDead[i] = true
   986       nativeDead[i] = true
   980       nativesNum = nativesNum - 1
   987       nativesNum = nativesNum - 1
   981       if startElimination == 0 then
       
   982         freshDead = nativeNames[i]
       
   983       end
       
   984     end
   988     end
   985   end
   989   end
   986 
   990 
   987   for i = 1, 9 do
   991   for i = 1, 9 do
   988     if gear == cannibals[i] then
   992     if gear == cannibals[i] then
  1053   if stage == spyKillStage then
  1057   if stage == spyKillStage then
  1054     if CurrentHedgehog == spyHog or GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then
  1058     if CurrentHedgehog == spyHog or GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then
  1055       TurnTimeLeft = 0
  1059       TurnTimeLeft = 0
  1056     else
  1060     else
  1057       SetGearMessage(CurrentHedgehog, 0)
  1061       SetGearMessage(CurrentHedgehog, 0)
       
  1062       --AnimSwitchHog(natives[leaksNum])
  1058       TurnTimeLeft = -1
  1063       TurnTimeLeft = -1
  1059     end
  1064     end
  1060   else
  1065   else
  1061     if freshDead ~= nil and GetHogTeamName(CurrentHedgehog) == loc("Natives") then
  1066     if freshDead ~= nil and GetHogTeamName(CurrentHedgehog) == loc("Natives") then
  1062       SetupHogDeadAnim(freshDead)
  1067       SetupHogDeadAnim(freshDead)