share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/epil.lua
changeset 14612 bd15c8551318
parent 14487 d72fb761aa59
child 14898 4596357d002d
equal deleted inserted replaced
14611:3cf7799e04b5 14612:bd15c8551318
   111 
   111 
   112 startAnim = {}
   112 startAnim = {}
   113 
   113 
   114 gearDead = {}
   114 gearDead = {}
   115 hogDead = {}
   115 hogDead = {}
       
   116 
       
   117 local traitorTeamName = loc("Traitors")
   116 --------------------------Anim skip functions--------------------------
   118 --------------------------Anim skip functions--------------------------
   117 function SkipStartAnim()
   119 function SkipStartAnim()
   118   SetGearMessage(CurrentHedgehog, 0)
   120   SetGearMessage(CurrentHedgehog, 0)
   119   AnimSwitchHog(natives[1])
   121   AnimSwitchHog(natives[1])
   120 end
   122 end
   326   for i = 1, 5 do
   328   for i = 1, 5 do
   327     cannibals[i] = AddHog(cannibalNames[i], 0, 100, cannibalHats[i])
   329     cannibals[i] = AddHog(cannibalNames[i], 0, 100, cannibalHats[i])
   328   end
   330   end
   329 
   331 
   330   if m8Scene == denseScene or m8Scene == waterScene then
   332   if m8Scene == denseScene or m8Scene == waterScene then
   331     AddTeam(loc("Traitors"), -2, grave, "Island", voice, "cm_bloodyblade")
   333     traitorTeamName = AddTeam(traitorTeamName, -2, grave, "Island", voice, "cm_bloodyblade")
       
   334     SetTeamPassive(traitorTeamName, true)
   332     if m8Scene == denseScene then
   335     if m8Scene == denseScene then
   333       DeleteGear(natives[2])
   336       DeleteGear(natives[2])
   334       natives[2] = AddHog(nativeNames[2], 0, 100, nativeHats[2])
   337       natives[2] = AddHog(nativeNames[2], 0, 100, nativeHats[2])
   335     else
   338     else
   336       DeleteGear(natives[3])
   339       DeleteGear(natives[3])
   431 
   434 
   432 function onGearDelete(gear)
   435 function onGearDelete(gear)
   433   gearDead[gear] = true
   436   gearDead[gear] = true
   434   if GetGearType(gear) == gtHedgehog then
   437   if GetGearType(gear) == gtHedgehog then
   435     hogDead[gear] = true
   438     hogDead[gear] = true
       
   439   end
       
   440   if IsEveryoneExceptTraitorDead() then
       
   441     SetTeamPassive(traitorTeamName, false)
   436   end
   442   end
   437 end
   443 end
   438 
   444 
   439 function onAmmoStoreInit()
   445 function onAmmoStoreInit()
   440   SetAmmo(amAirAttack, 9, 0, 0, 0)
   446   SetAmmo(amAirAttack, 9, 0, 0, 0)
   481   end
   487   end
   482   return true
   488   return true
   483 end
   489 end
   484 
   490 
   485 function onNewTurn()
   491 function onNewTurn()
   486   if AnimInProgress() then
   492   SetTurnTimeLeft(MAX_TURN_TIME)
   487     SetTurnTimeLeft(MAX_TURN_TIME)
       
   488     return
       
   489   end
       
   490   -- Don't allow player to play with traitor, except when it is the final hog left
       
   491   if CurrentHedgehog == traitor and not IsEveryoneExceptTraitorDead() then
       
   492     EndTurn(true)
       
   493   else
       
   494     SetTurnTimeLeft(MAX_TURN_TIME)
       
   495   end
       
   496 end
   493 end
   497 
   494 
   498 function onPrecise()
   495 function onPrecise()
   499   if GameTime > 2500 then
   496   if GameTime > 2500 then
   500     SetAnimSkip(true)
   497     SetAnimSkip(true)