1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00

wave cycling

This commit is contained in:
MewMew 2019-07-25 05:49:27 +02:00
parent 4f7f4e1558
commit 867623d120
3 changed files with 13 additions and 10 deletions

View File

@ -107,7 +107,7 @@ local function select_units_around_spawner(spawner, force_name, biter_force_name
if not biters[1] then return false end if not biters[1] then return false end
local valid_biters = {} local valid_biters = {}
local threat = global.bb_threat[biter_force_name] * math_random(10,20) * 0.01 local threat = global.bb_threat[biter_force_name] * math_random(11,22) * 0.01
local unit_count = 0 local unit_count = 0
local max_unit_count = math.ceil(global.bb_threat[biter_force_name] * 0.25) + math_random(6,12) local max_unit_count = math.ceil(global.bb_threat[biter_force_name] * 0.25) + math_random(6,12)
@ -189,15 +189,16 @@ end
ai.main_attack = function() ai.main_attack = function()
local surface = game.surfaces["biter_battles"] local surface = game.surfaces["biter_battles"]
for c = 1, math.ceil(get_threat_ratio("north_biters") * 7), 1 do for c = 1, math.ceil(get_threat_ratio(global.next_attack .. "_biters") * 7), 1 do
create_attack_group(surface, "north", "north_biters") create_attack_group(surface, global.next_attack, global.next_attack .. "_biters")
end end
if global.bb_debug then game.print(math.ceil(get_threat_ratio("north_biters") * 7) .. " unit groups designated for north biters.") end if global.bb_debug then game.print(math.ceil(get_threat_ratio(global.next_attack .. "_biters") * 7) .. " unit groups designated for " .. global.next_attack .. " biters.") end
for c = 1, math.ceil(get_threat_ratio("south_biters") * 7), 1 do if global.next_attack == "north" then
create_attack_group(surface, "south", "south_biters") global.next_attack = "south"
else
global.next_attack = "north"
end end
if global.bb_debug then game.print(math.ceil(get_threat_ratio("south_biters") * 7) .. " unit groups designated for south biters.") end
end end
--Prevent Players from damaging Rocket Silos --Prevent Players from damaging Rocket Silos

View File

@ -138,6 +138,8 @@ local function init_forces()
global.spy_fish_timeout = {} global.spy_fish_timeout = {}
global.force_area = {} global.force_area = {}
global.active_biters = {} global.active_biters = {}
global.next_attack = "north"
if math.random(1,2) == 1 then global.next_attack = "south" end
global.bb_evolution = {} global.bb_evolution = {}
global.bb_evasion = {} global.bb_evasion = {}
global.bb_threat_income = {} global.bb_threat_income = {}

View File

@ -66,8 +66,8 @@ local function on_tick(event)
--if game.tick % 1800 ~= 0 then return end --if game.tick % 1800 ~= 0 then return end
--if game.tick % 3600 ~= 0 then return end if game.tick % 3600 ~= 0 then return end
if game.tick % 7200 ~= 0 then return end --if game.tick % 7200 ~= 0 then return end
ai.destroy_inactive_biters() ai.destroy_inactive_biters()
ai.main_attack() ai.main_attack()