share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua
changeset 12982 ba577e0b8c27
parent 12981 4c7472d3d483
child 12983 7c3454083489
equal deleted inserted replaced
12981:4c7472d3d483 12982:ba577e0b8c27
   240 
   240 
   241 local LastHog = nil -- Last Hedgehog
   241 local LastHog = nil -- Last Hedgehog
   242 local CurHog = nil -- Current Hedgehog
   242 local CurHog = nil -- Current Hedgehog
   243 local LastTeam = nil -- Last Team
   243 local LastTeam = nil -- Last Team
   244 local CurTeam = nil -- Current Team
   244 local CurTeam = nil -- Current Team
   245 local TurnEnded = true -- Boolean whether current turn ended or not
       
   246 
   245 
   247 local mode = 'default' -- Which game type to play
   246 local mode = 'default' -- Which game type to play
   248 local luck = 100 -- Multiplier for bonuses like crates
   247 local luck = 100 -- Multiplier for bonuses like crates
   249 local strength = 1 -- Multiplier for more weapons
   248 local strength = 1 -- Multiplier for more weapons
   250 local mutate = false -- Whether or not to mutate the hogs
   249 local mutate = false -- Whether or not to mutate the hogs
  1291 function setupHogTurn(hog)
  1290 function setupHogTurn(hog)
  1292   clearHogAmmo(hog)
  1291   clearHogAmmo(hog)
  1293   addTurnAmmo(hog)
  1292   addTurnAmmo(hog)
  1294 end
  1293 end
  1295 
  1294 
  1296 function onTurnEnd()
  1295 function onEndTurn()
  1297   local anyHog = nil
  1296   local anyHog = nil
  1298   for team, val in pairs(teamNames) do
  1297   for team, val in pairs(teamNames) do
  1299     -- Count amount of alive hogs in team
  1298     -- Count amount of alive hogs in team
  1300     local c = 0
  1299     local c = 0
  1301     for idx, hog in pairs(teamHogs[team]) do
  1300     for idx, hog in pairs(teamHogs[team]) do
  1413 function onNewTurn()
  1412 function onNewTurn()
  1414   LastHog = CurHog
  1413   LastHog = CurHog
  1415   LastTeam = CurTeam
  1414   LastTeam = CurTeam
  1416   CurHog = CurrentHedgehog
  1415   CurHog = CurrentHedgehog
  1417   CurTeam = getHogInfo(CurHog, 'team')
  1416   CurTeam = getHogInfo(CurHog, 'team')
  1418   TurnEnded = false
       
  1419 
  1417 
  1420   if suddenDeath == true then
  1418   if suddenDeath == true then
  1421     onSuddenDeathTurn()
  1419     onSuddenDeathTurn()
  1422   elseif (TotalRounds + 1 >= 1) then
  1420   elseif (TotalRounds + 1 >= 1) then
  1423     AddCaption(string.format(loc("Round %d (Sudden Death in round %d)"), (TotalRounds +1), (SuddenDeathTurns +2)), 0xFFFFFFFF,  capgrpGameState)
  1421     AddCaption(string.format(loc("Round %d (Sudden Death in round %d)"), (TotalRounds +1), (SuddenDeathTurns +2)), 0xFFFFFFFF,  capgrpGameState)
  1444     highHasBonusHelp = false
  1442     highHasBonusHelp = false
  1445   end
  1443   end
  1446 
  1444 
  1447   -- Set LastWaterLine to the current water line
  1445   -- Set LastWaterLine to the current water line
  1448   LastWaterLine = WaterLine
  1446   LastWaterLine = WaterLine
  1449 end
       
  1450 
       
  1451 function onGameTick20()
       
  1452   if TurnEnded == false and TurnTimeLeft <= 0 then
       
  1453     TurnEnded = true
       
  1454     onTurnEnd()
       
  1455   end
       
  1456 end
  1447 end
  1457 
  1448 
  1458 --[[
  1449 --[[
  1459   ##############################################################################
  1450   ##############################################################################
  1460   ### GAME START FUNCTIONS                                                   ###
  1451   ### GAME START FUNCTIONS                                                   ###