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

difficulty tweaks

This commit is contained in:
MewMew 2019-11-28 03:53:19 +01:00
parent 5f7adbc511
commit 8d60989526
4 changed files with 49 additions and 96 deletions

View File

@ -8,8 +8,8 @@ local difficulties = {
[3] = {name = "Easy", str = "75%", value = 0.75, color = {r=0.00, g=0.25, b=0.00}, print_color = {r=0.00, g=0.5, b=0.00}},
[4] = {name = "Normal", str = "100%", value = 1, color = {r=0.00, g=0.00, b=0.25}, print_color = {r=0.0, g=0.0, b=0.7}},
[5] = {name = "Hard", str = "150%", value = 1.5, color = {r=0.25, g=0.00, b=0.00}, print_color = {r=0.5, g=0.0, b=0.00}},
[6] = {name = "Nightmare", str = "200%", value = 2, color = {r=0.35, g=0.00, b=0.00}, print_color = {r=0.7, g=0.0, b=0.00}},
[7] = {name = "Insane", str = "300%", value = 3, color = {r=0.45, g=0.00, b=0.00}, print_color = {r=0.9, g=0.0, b=0.00}}
[6] = {name = "Nightmare", str = "250%", value = 2.5, color = {r=0.35, g=0.00, b=0.00}, print_color = {r=0.7, g=0.0, b=0.00}},
[7] = {name = "Insane", str = "500%", value = 5, color = {r=0.45, g=0.00, b=0.00}, print_color = {r=0.9, g=0.0, b=0.00}}
}
local timeout = 18000

View File

@ -17,6 +17,7 @@ local level_depth = require "maps.mountain_fortress_v2.terrain"
local Collapse = require "maps.mountain_fortress_v2.collapse"
require "maps.mountain_fortress_v2.flamethrower_nerf"
local BiterRolls = require "modules.wave_defense.biter_rolls"
local BiterHealthBooster = require "modules.biter_health_booster"
local Reset = require "functions.soft_reset"
local Pets = require "modules.biter_pets"
local Map = require "modules.map_info"
@ -41,8 +42,8 @@ local function set_difficulty()
-- threat gain / wave
wave_defense_table.threat_gain_multiplier = 2 + player_count * 0.1
--1 additional map collapse tile / 10 players in game
global.map_collapse.speed = math.floor(player_count * 0.1) + 1
--1 additional map collapse tile / 8 players in game
global.map_collapse.speed = math.floor(player_count * 0.125) + 1
--20 Players for fastest wave_interval
wave_defense_table.wave_interval = 3600 - player_count * 90
@ -140,11 +141,24 @@ local function biters_chew_rocks_faster(event)
end
local function hidden_biter(entity)
BiterRolls.wave_defense_set_unit_raffle(math.sqrt(entity.position.x ^ 2 + entity.position.y ^ 2) * 0.25)
local d = math.sqrt(entity.position.x ^ 2 + entity.position.y ^ 2)
BiterRolls.wave_defense_set_unit_raffle(d * 0.25)
local unit
if math_random(1,3) == 1 then
entity.surface.create_entity({name = BiterRolls.wave_defense_roll_spitter_name(), position = entity.position})
unit = entity.surface.create_entity({name = BiterRolls.wave_defense_roll_spitter_name(), position = entity.position})
else
entity.surface.create_entity({name = BiterRolls.wave_defense_roll_biter_name(), position = entity.position})
unit = entity.surface.create_entity({name = BiterRolls.wave_defense_roll_biter_name(), position = entity.position})
end
local m = 1 / level_depth
m = m * d
if math_random(1, 256) == 1 then
BiterHealthBooster.add_boss_unit(unit, m * 15 + 1, 0.38)
else
BiterHealthBooster.add_unit(unit, m * 2.5 + 1)
end
end

View File

@ -6,6 +6,7 @@ local math_floor = math.floor
local math_abs = math.abs
local simplex_noise = require "utils.simplex_noise".d2
local rock_raffle = {"sand-rock-big","sand-rock-big", "rock-big","rock-big","rock-big","rock-big","rock-big","rock-big","rock-big","rock-huge"}
local size_of_rock_raffle = #rock_raffle
local spawner_raffle = {"biter-spawner", "biter-spawner", "biter-spawner", "spitter-spawner"}
local noises = {
["no_rocks"] = {{modifier = 0.0033, weight = 1}, {modifier = 0.01, weight = 0.22}, {modifier = 0.05, weight = 0.05}, {modifier = 0.1, weight = 0.04}},
@ -67,11 +68,13 @@ local function process_level_10_position(p, seed, tiles, entities, markets, trea
return
end
if noise_1 > -0.25 and noise_1 < 0.25 then
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if noise_1 > -0.20 and noise_1 < 0.20 then
if math_random(1,10) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if noise_1 > -0.30 and noise_1 < 0.30 then
if noise_1 > -0.14 and noise_1 < 0.14 then
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,10) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
if math_random(1,256) == 1 then treasure[#treasure + 1] = p end
else
tiles[#tiles + 1] = {name = "out-of-map", position = p}
end
return
end
@ -90,7 +93,7 @@ local function process_level_9_position(p, seed, tiles, entities, markets, treas
if maze_noise > -0.35 and maze_noise < 0.35 then
tiles[#tiles + 1] = {name = "dirt-7", position = p}
local no_rocks_2 = get_noise("no_rocks_2", p, seed)
if math_random(1,4) > 1 and no_rocks_2 > -0.5 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,4) > 1 and no_rocks_2 > -0.5 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
if math_random(1,1024) == 1 then treasure[#treasure + 1] = p end
if math_random(1,256) == 1 then
Biters.wave_defense_set_worm_raffle(math_abs(p.y) * worm_level_modifier)
@ -145,7 +148,7 @@ local function process_level_8_position(p, seed, tiles, entities, markets, treas
end
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if scrapyard < -0.55 or scrapyard > 0.55 then
if math_random(1,5) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,5) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
return
end
if scrapyard < -0.28 or scrapyard > 0.28 then
@ -171,7 +174,7 @@ local function process_level_8_position(p, seed, tiles, entities, markets, treas
if scrapyard > -0.15 and scrapyard < 0.15 then
if math_floor(large_caves * 10) % 4 < 3 then
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,3) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,3) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
return
end
end
@ -247,7 +250,7 @@ local function process_level_7_position(p, seed, tiles, entities, markets, treas
end
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,5) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,5) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
if math_random(1,256) == 1 then treasure[#treasure + 1] = p end
end
@ -283,7 +286,7 @@ local function process_level_6_position(p, seed, tiles, entities, markets, treas
end
else
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,8) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,8) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
if math_random(1,512) == 1 then treasure[#treasure + 1] = p end
if math_random(1,4096) == 1 then entities[#entities + 1] = {name = "crude-oil", position = p, amount = get_oil_amount(p)} end
if math_random(1,8096) == 1 then markets[#markets + 1] = p end
@ -297,7 +300,7 @@ local function process_level_5_position(p, seed, tiles, entities, markets, treas
if small_caves > -0.14 and small_caves < 0.14 then
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,768) == 1 then treasure[#treasure + 1] = p end
if math_random(1,3) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,3) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
return
end
@ -321,7 +324,7 @@ local function process_level_5_position(p, seed, tiles, entities, markets, treas
if noise_cave_ponds > 0.25 then
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,512) == 1 then treasure[#treasure + 1] = p end
if math_random(1,2) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,2) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
return
end
end
@ -355,7 +358,7 @@ local function process_level_4_position(p, seed, tiles, entities, markets, treas
end
if math_abs(noise_large_caves) > 0.475 then
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,3) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,3) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
if math_random(1,2048) == 1 then treasure[#treasure + 1] = p end
return
end
@ -374,7 +377,7 @@ local function process_level_4_position(p, seed, tiles, entities, markets, treas
if small_caves > -0.15 and small_caves < 0.15 then
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,5) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,5) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
if math_random(1, 1024) == 1 then treasure[#treasure + 1] = p end
return
end
@ -391,7 +394,7 @@ local function process_level_4_position(p, seed, tiles, entities, markets, treas
if math_random(1,2048) == 1 then treasure[#treasure + 1] = p end
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,100) > 30 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,100) > 30 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
return
end
@ -408,7 +411,7 @@ local function process_level_3_position(p, seed, tiles, entities, markets, treas
if noise_cave_ponds < -0.77 then
if noise_cave_ponds > -0.79 then
tiles[#tiles + 1] = {name = "dirt-7", position = p}
entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p}
entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p}
else
tiles[#tiles + 1] = {name = "grass-" .. math_floor(noise_cave_ponds * 32) % 3 + 1, position = p}
if math_random(1,32) == 1 then markets[#markets + 1] = p end
@ -486,7 +489,7 @@ local function process_level_3_position(p, seed, tiles, entities, markets, treas
if math_random(1,2048) == 1 then treasure[#treasure + 1] = p end
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,100) > 30 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,100) > 30 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
return
end
@ -570,7 +573,7 @@ local function process_level_2_position(p, seed, tiles, entities, markets, treas
if math_random(1,2048) == 1 then treasure[#treasure + 1] = p end
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,100) > 30 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,100) > 30 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
return
end
@ -654,7 +657,7 @@ local function process_level_1_position(p, seed, tiles, entities, markets, treas
if math_random(1,2048) == 1 then treasure[#treasure + 1] = p end
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if math_random(1,100) > 30 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
if math_random(1,100) > 30 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
end
local levels = {
@ -688,8 +691,10 @@ local function rock_chunk(surface, left_top)
local markets = {}
local treasure = {}
local seed = surface.map_gen_settings.seed
local process_level = levels[math_floor(math_abs(left_top.y) / level_depth) + 1]
if not process_level then process_level = levels[#levels] end
local level_index = math_floor((math_abs(left_top.y / level_depth)) % 10) + 1
local process_level = levels[level_index]
for y = 0, 31, 1 do
for x = 0, 31, 1 do
local p = {x = left_top.x + x, y = left_top.y + y}
@ -762,7 +767,7 @@ local function border_chunk(surface, left_top)
}
end
if math_random(1, math.ceil(pos.y + pos.y) + 2) == 1 then
surface.create_entity({name = rock_raffle[math_random(1, #rock_raffle)], position = pos})
surface.create_entity({name = rock_raffle[math_random(1, size_of_rock_raffle)], position = pos})
end
end
end
@ -832,7 +837,7 @@ local function wall(surface, left_top, seed)
else
surface.set_tiles({{name = "dirt-7", position = p}})
if math_random(1, 5) ~= 1 then
surface.create_entity({name = rock_raffle[math_random(1, #rock_raffle)], position = p})
surface.create_entity({name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p})
end
end
else
@ -892,7 +897,7 @@ local function process_chunk(surface, left_top)
if left_top.x >= level_depth * 0.5 then return end
if left_top.x < level_depth * -0.5 then return end
if left_top.y % level_depth == 0 and left_top.y < 0 and left_top.y > level_depth * -10 then wall(surface, left_top, surface.map_gen_settings.seed) return end
if left_top.y % level_depth == 0 and left_top.y < 0 then wall(surface, left_top, surface.map_gen_settings.seed) return end
if left_top.y >= 0 then replace_water(surface, left_top) end
if left_top.y > 32 then game.forces.player.chart(surface, {{left_top.x, left_top.y},{left_top.x + 31, left_top.y + 31}}) end

View File

@ -1,66 +0,0 @@
local function move_unit_groups()
print("move_unit_groups 1")
local surface = game.surfaces[1]
local entities = surface.find_entities_filtered({type = "character", limit = 1})
if not entities[1] then return end
local character = entities[1]
--local character = game.connected_players[1].character
--if not character then return end
--if not character.valid then return end
print("move_unit_groups 2")
for key, group in pairs(global.unit_groups) do
if group.valid then
print("move_unit_groups 3")
group.set_command({
type = defines.command.compound,
structure_type = defines.compound_command.return_last,
commands = {
{
type = defines.command.attack,
target = character,
distraction = defines.distraction.by_enemy,
},
},
})
else
print("move_unit_groups 4")
global.unit_groups[key] = nil
end
end
end
local function spawn_unit_group()
print("spawn_unit_group 1")
local surface = game.surfaces[1]
if not global.unit_groups then global.unit_groups = {} end
print("spawn_unit_group 2")
local unit = surface.create_entity({name = "small-biter", position = {0,48}, force = "enemy"})
local unit_group = surface.create_unit_group({position = {0,48}, force = "enemy"})
print("spawn_unit_group 3")
unit_group.add_member(unit)
if global.table_insert then
table.insert(global.unit_groups, unit_group)
else
global.unit_groups[#global.unit_groups + 1] = unit_group
end
print("spawn_unit_group 4")
end
local function on_tick()
spawn_unit_group()
if game.tick % 120 == 0 then move_unit_groups() end
end
local function on_player_created(event)
local player = game.players[event.player_index]
player.insert({name = "grenade", count = 1000})
player.insert({name = "power-armor", count = 1})
end
local event = require 'utils.event'
event.on_nth_tick(30, on_tick)
event.add(defines.events.on_player_created, on_player_created)