1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-18 03:21:36 +02:00

Chronotrain updates, tiny balance changes

This commit is contained in:
hanakocz 2021-03-24 17:19:47 +01:00
parent a691e2defb
commit 2c8a585c38
10 changed files with 79 additions and 8 deletions

View File

@ -398,7 +398,7 @@ end
function Public.perform_rogue_attack()
local objective = Chrono_table.get_table()
local surface = game.surfaces[objective.active_surface_index]
local group = create_attack_group(surface, 0.2)
local group = create_attack_group(surface, 0.15)
if not group or not group.valid then return end
local target = generate_side_attack_target(surface, group.position)
if not target or not target.valid then return end

View File

@ -33,6 +33,10 @@ end
---- CHRONO/POLLUTION BALANCE ----
function Public.factory_level(difficulty)
return math.floor(1000 * difficulty_sloped(difficulty, 1 / 3))
end
function Public.pollution_filter_upgrade_factor(upgrades2)
return 1 / (1 + upgrades2 / 4)
end
@ -124,7 +128,9 @@ Public.wagon_starting_items = {
{name = 'firearm-magazine', count = 16},
{name = 'iron-plate', count = 16},
{name = 'wood', count = 16},
{name = 'burner-mining-drill', count = 8}
{name = 'burner-mining-drill', count = 8},
{name = 'grenade', count = 10},
{name = 'gun-turret', count = 2}
}
function Public.jumps_until_overstay_is_on(difficulty) --both overstay penalties, and evoramp
@ -151,7 +157,7 @@ function Public.coin_reward_per_second_jumped_early(seconds, difficulty)
end
function Public.upgrades_coin_cost_difficulty_scaling(difficulty)
return difficulty_sloped(difficulty, 3 / 5)
return difficulty_sloped(difficulty, 4 / 5)
end
function Public.flamers_nerfs_size(jumps, difficulty)

View File

@ -151,7 +151,7 @@ function Public.restart_settings()
game.forces.player.technologies["power-armor-mk2"].enabled = false
game.forces.player.technologies["railway"].researched = true
game.forces.player.recipes["pistol"].enabled = false
game.forces.player.ghost_time_to_live = 5 * 60 * 60
game.forces.player.ghost_time_to_live = 15 * 60 * 60
end
function Public.set_difficulty_settings()
@ -371,7 +371,11 @@ end
function Public.setup_world(surface)
local objective = Chrono_table.get_table()
local world = objective.world
surface.min_brightness = 0
if objective.chronojumps <= 2 then
surface.min_brightness = 0.5
else
surface.min_brightness = 0
end
surface.brightness_visual_weights = {1, 1, 1}
objective.surface = surface
surface.daytime = world.daytime

View File

@ -7,6 +7,7 @@ local math_max = math.max
local math_min = math.min
local Upgrades = require "maps.chronosphere.upgrade_list"
local Production = require 'maps.chronosphere.production_list'
local ProdFunctions = require 'maps.chronosphere.production'
local Balance = require "maps.chronosphere.balance"
local Difficulty = require 'modules.difficulty_vote'
local Minimap = require "maps.chronosphere.minimap"
@ -127,8 +128,8 @@ end
local function calculate_xp(key)
local production_table = Chrono_table.get_production_table()
local level = math.floor((production_table.experience[key] / 1000)^(1 / 2))
return (production_table.experience[key] / 1000)^(1 / 2) - level
local level = ProdFunctions.calculate_factory_level(production_table.experience[key], false)
return level - math.floor(level)
end
local function update_upgrades_gui(player)

View File

@ -266,6 +266,7 @@ Event.add(defines.events.on_player_changed_position, On_Event.on_player_changed_
Event.add(defines.events.on_technology_effects_reset, Event_functions.on_technology_effects_reset)
Event.add(defines.events.on_gui_click, Gui.on_gui_click)
Event.add(defines.events.on_pre_player_died, On_Event.on_pre_player_died)
Event.add(defines.events.script_raised_revive, On_Event.script_raised_revive)
if _DEBUG then
local Session = require 'utils.datastore.session_data'

View File

@ -231,4 +231,27 @@ function Public.on_pre_player_died(event)
end
end
function Public.script_raised_revive(event)
local entity = event.entity
if not entity or not entity.valid then return end
if entity.force.name == "player" then return end
if entity.force.name == "scrapyard" then
if entity.name == "gun-turret" then
entity.insert({name = "uranium-rounds-magazine", count = 128})
elseif entity.name == "artillery-turret" then
entity.insert({name = "artillery-shell", count = 30})
elseif entity.name == "accumulator" then
entity.energy = 5000000
elseif entity.name == "storage-tank" then
entity.insert_fluid({name = "light-oil", amount = 15000})
end
end
if entity.force.name == "neutral" then
if entity.is_entity_with_health then
entity.health = math.random(-10, entity.prototype.max_health)
if entity.health <= 0 then entity.die(entity.force) end
end
end
end
return Public

View File

@ -1,5 +1,7 @@
local Chrono_table = require 'maps.chronosphere.table'
local Rand = require 'maps.chronosphere.random'
local Balance = require 'maps.chronosphere.balance'
local Difficulty = require 'modules.difficulty_vote'
local Public = {}
local List = require 'maps.chronosphere.production_list'
@ -16,6 +18,15 @@ local function roll_assembler()
return Rand.raffle(choices.types, choices.weights)
end
function Public.calculate_factory_level(xp, whole_level)
local base = Balance.factory_level(Difficulty.get().difficulty_vote_value) -- 750 -> 1000 -> 2333
local level = (xp / base)^(1 / 2)
if whole_level then
return math.floor(level)
end
return level
end
local function total_avg_level()
local production = Chrono_table.get_production_table()
local levels = 0
@ -69,7 +80,7 @@ end
local function levelup_train_factory(id)
local production = Chrono_table.get_production_table()
local xp = production.experience[id]
local level = math.floor((xp / 1000)^(1 / 2))
local level = Public.calculate_factory_level(xp, true)
production.train_assemblers[id].tier = level
end

View File

@ -2,6 +2,7 @@ local Treasure = require 'maps.chronosphere.treasure'
local Simplex_noise = require "utils.simplex_noise".d2
local Raffle = require "maps.chronosphere.raffles"
local Chrono_table = require 'maps.chronosphere.table'
local Blueprints = require 'maps.chronosphere.worlds.blueprints'
local abs = math.abs
local random = math.random
local sqrt = math.sqrt
@ -194,4 +195,16 @@ function Public.process_labyrinth_cell(pos, seed)
return true
end
function Public.build_blueprint(surface, position, id, force)
local item = surface.create_entity{name = "item-on-ground", position = position, stack = {name = "blueprint", count = 1}}
local success = item.stack.import_stack(Blueprints[id])
if success <= 0 then
local ghosts = item.stack.build_blueprint{surface = surface, force = force, position = position, force_build = true}
for _, ghost in pairs(ghosts) do
ghost.silent_revive({raise_revive = true})
end
end
if item.valid then item.destroy() end
end
return Public

View File

@ -78,6 +78,9 @@ local function normal_chunk(surface, left_top)
end
end
surface.set_tiles(tiles, true)
if random(1, 60) == 1 then
Functions.build_blueprint(surface, left_top, random(4, 6), "neutral")
end
Functions.spawn_treasures(surface, treasure)
Functions.spawn_entities(surface, entities)
for _, pos in pairs(factories) do

View File

@ -0,0 +1,9 @@
local Public = {}
--[[red research]]
Public[4] = '0eNqdnNtu4zgMht/F187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