1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-09 13:37:02 +02:00

threat scaling with connected player amount

This commit is contained in:
MewMew 2019-04-26 05:25:47 +02:00
parent b5ba156a20
commit ad118c50b2
3 changed files with 17 additions and 4 deletions

View File

@ -18,6 +18,17 @@ local enemy_team_of = {
["south"] = "north"
}
function get_instant_threat_player_count_modifier()
local current_player_count = #game.forces.north.connected_players + #game.forces.south.connected_players
local minimum_modifier = 50
local maximum_modifier = 250
local player_amount_for_maximum_threat_gain = 20
local gain_per_player = (maximum_modifier - minimum_modifier) / player_amount_for_maximum_threat_gain
local m = minimum_modifier + gain_per_player * current_player_count
if m > maximum_modifier then m = maximum_modifier end
return m
end
local function set_biter_endgame_modifiers(force)
if force.evolution_factor ~= 1 then return end
local damage_mod = (global.bb_evolution[force.name] - 1) * 2
@ -60,6 +71,8 @@ local function feed_biters(player, food)
local decimals = 12
local math_round = math.round
local instant_threat_player_count_modifier = get_instant_threat_player_count_modifier()
for a = 1, flask_amount, 1 do
--SET THREAT INCOME
local e = (global.bb_evolution[biter_force_name] * 100) + 1
@ -81,7 +94,7 @@ local function feed_biters(player, food)
--ADD INSTANT THREAT
local diminishing_modifier = 1 / (0.2 + (e2 * 0.018))
global.bb_threat[biter_force_name] = global.bb_threat[biter_force_name] + (food_values[food].value * 200 * diminishing_modifier)
global.bb_threat[biter_force_name] = global.bb_threat[biter_force_name] + (food_values[food].value * instant_threat_player_count_modifier * diminishing_modifier)
global.bb_threat[biter_force_name] = math_round(global.bb_threat[biter_force_name], decimals)
end

View File

@ -30,7 +30,7 @@ local function clear_corpses()
end
local function restart_idle_map()
if game.tick < 216000 then return end
if game.tick < 432000 then return end
if #game.connected_players ~= 0 then global.restart_idle_map_countdown = 2 return end
if not global.restart_idle_map_countdown then global.restart_idle_map_countdown = 2 end
global.restart_idle_map_countdown = global.restart_idle_map_countdown - 1

View File

@ -80,8 +80,8 @@ end
local function generate_horizontal_river(surface, pos)
if pos.y < -32 then return false end
if pos.y > -5 and pos.x > -5 and pos.x < 5 then return false end
if -11 < pos.y + (get_noise(1, pos) * 5) then return true end
--if -13 < pos.y + (get_noise(1, pos) * 5) then return true end
--if -11 < pos.y + (get_noise(1, pos) * 5) then return true end
if -14 < pos.y + (get_noise(1, pos) * 5) then return true end
return false
end