share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua
changeset 12985 add647b0036e
parent 12984 353603f5cec3
child 12986 1c38d4370943
equal deleted inserted replaced
12984:353603f5cec3 12985:add647b0036e
   331 local pointsToWep = {} -- List of [points] = {ammo1, ammo2}
   331 local pointsToWep = {} -- List of [points] = {ammo1, ammo2}
   332 local pointsToHlp = {} -- List of [points] = {ammo1, ammo2}
   332 local pointsToHlp = {} -- List of [points] = {ammo1, ammo2}
   333 local wepPoints = {}
   333 local wepPoints = {}
   334 local hlpPoints = {}
   334 local hlpPoints = {}
   335 
   335 
       
   336 local firstTurnOver = false
   336 local suddenDeath = false
   337 local suddenDeath = false
   337 
   338 
   338 local healthCrateChance = 7
   339 local healthCrateChance = 7
   339 local utilCrateChance = 9
   340 local utilCrateChance = 9
   340 local weaponCrateChance = 12
   341 local weaponCrateChance = 12
  1292   clearHogAmmo(hog)
  1293   clearHogAmmo(hog)
  1293   addTurnAmmo(hog)
  1294   addTurnAmmo(hog)
  1294 end
  1295 end
  1295 
  1296 
  1296 function onEndTurn()
  1297 function onEndTurn()
       
  1298   if not firstTurnOver then
       
  1299     firstTurnOver = true
       
  1300   end
  1297   local anyHog = nil
  1301   local anyHog = nil
  1298   for team, val in pairs(teamNames) do
  1302   for team, val in pairs(teamNames) do
  1299     -- Count amount of alive hogs in team
  1303     -- Count amount of alive hogs in team
  1300     local c = 0
  1304     local c = 0
  1301     for idx, hog in pairs(teamHogs[team]) do
  1305     for idx, hog in pairs(teamHogs[team]) do
  1416   CurHog = CurrentHedgehog
  1420   CurHog = CurrentHedgehog
  1417   CurTeam = getHogInfo(CurHog, 'team')
  1421   CurTeam = getHogInfo(CurHog, 'team')
  1418 
  1422 
  1419   if suddenDeath == true then
  1423   if suddenDeath == true then
  1420     onSuddenDeathTurn()
  1424     onSuddenDeathTurn()
  1421   elseif (TotalRounds + 1 >= 1) then
  1425   else
  1422     AddCaption(string.format(loc("Round %d (Sudden Death in round %d)"), (TotalRounds +1), (SuddenDeathTurns +2)), 0xFFFFFFFF,  capgrpGameState)
  1426     local RoundsTillSD = (SuddenDeathTurns+2) - (TotalRounds+1)
       
  1427     -- Show SD reminder every couple of turns, and in the first turn
       
  1428     if (not firstTurnOver) or (RoundsTillSD <= 6) or (RoundsTillSD <= 25 and RoundsTillSD % 5 == 0) or (RoundsTillSD % 10 == 0) then
       
  1429         AddCaption(string.format(loc("Rounds until Sudden Death: %d"), RoundsTillSD), 0xFFFFFFFF, capgrpGameState)
       
  1430     end
  1423   end
  1431   end
  1424 
  1432 
  1425   -- Generate new weapons for last hog if it's still alive
  1433   -- Generate new weapons for last hog if it's still alive
  1426   if LastHog ~= nil and LastHog ~= CurHog then
  1434   if LastHog ~= nil and LastHog ~= CurHog then
  1427     if mode == 'points' then
  1435     if mode == 'points' then