mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-30 04:40:54 +02:00
scale mining productivity over leagues
This commit is contained in:
parent
6a58e31167
commit
6a0316d96e
@ -828,7 +828,7 @@ local function player_mined_tree(event)
|
||||
|
||||
local baseamount = 5
|
||||
--minimum 1 wood
|
||||
local amount = Math.clamp(1, Math.max(1, Math.ceil(available)), Math.ceil(baseamount * Balance.island_richness_avg_multiplier() * available/starting))
|
||||
local amount = Math.clamp(1, Math.max(1, Math.ceil(available)), Math.ceil(baseamount * Balance.game_resources_scale() * available/starting))
|
||||
|
||||
destination.dynamic_data.wood_remaining = destination.dynamic_data.wood_remaining - amount
|
||||
|
||||
@ -1048,9 +1048,9 @@ local function player_mined_rock(event)
|
||||
|
||||
for k, v in pairs(c) do
|
||||
if k == 'coal' and #c2 <= 1 then --if oil, then no coal
|
||||
c2[#c2 + 1] = {name = k, count = Math.ceil(v * Balance.island_richness_avg_multiplier()), color = CoreData.colors.coal}
|
||||
c2[#c2 + 1] = {name = k, count = Math.ceil(v * (player.force.mining_drill_productivity_bonus + 1)), color = CoreData.colors.coal}
|
||||
elseif k == 'stone' then
|
||||
c2[#c2 + 1] = {name = k, count = Math.ceil(v * Balance.island_richness_avg_multiplier()), color = CoreData.colors.stone}
|
||||
c2[#c2 + 1] = {name = k, count = Math.ceil(v * (player.force.mining_drill_productivity_bonus + 1)), color = CoreData.colors.stone}
|
||||
end
|
||||
end
|
||||
Common.give(player, c2, entity.position)
|
||||
|
@ -417,38 +417,45 @@ end
|
||||
|
||||
|
||||
function Public.rocket_launch_fuel_reward()
|
||||
return Math.ceil(2000 * Public.island_richness_avg_multiplier())
|
||||
return Math.ceil(2000 * Public.game_resources_scale())
|
||||
-- return Math.ceil(1000 * (1 + 0.1 * (Common.overworldx()/40)^(8/10)) / Math.sloped(Common.difficulty_scale(), 1/4))
|
||||
end
|
||||
|
||||
function Public.rocket_launch_coin_reward()
|
||||
return Math.ceil(3000 * Public.island_richness_avg_multiplier())
|
||||
return Math.ceil(3000 * Public.game_resources_scale())
|
||||
end
|
||||
|
||||
function Public.quest_reward_multiplier()
|
||||
return 0.9 * Public.island_richness_avg_multiplier()
|
||||
return 0.9 * Public.game_resources_scale()
|
||||
end
|
||||
|
||||
function Public.island_richness_avg_multiplier(overworldx)
|
||||
function Public.game_resources_scale(overworldx)
|
||||
overworldx = overworldx or Common.overworldx()
|
||||
-- local base = 0.73
|
||||
-- local additional = 0.120 * Math.clamp(0, 10, (overworldx/40)^(65/100) * Math.sloped(Public.crew_scale(), 1/40)) --tuned tbh
|
||||
|
||||
local base = 0.5
|
||||
local additional = 0.032 * (overworldx/40)
|
||||
|
||||
-- now clamped, because it takes way too long to mine that many more resources
|
||||
|
||||
--we don't really have resources scaling by player count in this resource-constrained scenario, but we scale a little, to accommodate each player filling their inventory with useful tools. also, I would do higher than 1/40, but we go even slightly lower because we're applying this somewhat sooner than players actually get there.
|
||||
|
||||
return Math.clamp(base, 1.5, base + additional)
|
||||
return base + additional
|
||||
end
|
||||
|
||||
function Public.apply_crew_buffs_per_league(force, leagues_travelled)
|
||||
function Public.patch_size_multiplier(overworldx)
|
||||
local base = 0.5
|
||||
local additional = 0.032 * (overworldx/40)
|
||||
|
||||
return Math.clamp(base, 1, base + additional)
|
||||
end
|
||||
|
||||
function Public.builtin_mining_productivity_scale(overworldx)
|
||||
return 1 + 1 * (overworldx/600)
|
||||
end
|
||||
|
||||
function Public.apply_crew_buffs_from_leagues(force, current_x_league, new_x_league)
|
||||
-- The motivation for this effect is to slightly nerf the strategy of staying as long as possible on each island to research everything. However, given you can now wait at an island forever, it's less difficult to jump a lot and then research everything, so this is disabled for now. Note that enabling it might make the game harder to balance.
|
||||
-- force.laboratory_productivity_bonus = force.laboratory_productivity_bonus + Math.max(0, 3/100 * leagues_travelled/40)
|
||||
|
||||
-- force.mining_drill_productivity_bonus = force.mining_drill_productivity_bonus + Math.max(0, 3/100 * leagues_travelled/40)
|
||||
for i = current_x_league + 1, new_x_league do
|
||||
force.mining_drill_productivity_bonus = force.mining_drill_productivity_bonus + (Public.builtin_mining_productivity_scale(i) - Public.builtin_mining_productivity_scale(i - 1))
|
||||
end
|
||||
end
|
||||
|
||||
function Public.resource_quest_multiplier()
|
||||
@ -539,13 +546,13 @@ end
|
||||
|
||||
function Public.kraken_kill_reward_items()
|
||||
return {
|
||||
{name = 'coin', count = Math.ceil(800 * Public.island_richness_avg_multiplier())},
|
||||
{name = 'utility-science-pack', count = Math.ceil(8 * Public.island_richness_avg_multiplier())}
|
||||
{name = 'coin', count = Math.ceil(800 * Public.game_resources_scale())},
|
||||
{name = 'utility-science-pack', count = Math.ceil(8 * Public.game_resources_scale())}
|
||||
}
|
||||
end
|
||||
|
||||
function Public.kraken_kill_reward_fuel()
|
||||
return Math.ceil(150 * Public.island_richness_avg_multiplier())
|
||||
return Math.ceil(150 * Public.game_resources_scale())
|
||||
end
|
||||
|
||||
function Public.kraken_health()
|
||||
@ -611,10 +618,10 @@ end
|
||||
|
||||
Public.research_buffs = { --currently disabled anyway
|
||||
-- these already give .1 productivity so we're adding .1 to get to 20%
|
||||
['mining-productivity-1'] = {['mining_drill_productivity_bonus'] = .1},
|
||||
['mining-productivity-2'] = {['mining_drill_productivity_bonus'] = .1},
|
||||
['mining-productivity-3'] = {['mining_drill_productivity_bonus'] = .1},
|
||||
['mining-productivity-4'] = {['mining_drill_productivity_bonus'] = .1},
|
||||
['mining-productivity-1'] = {['mining_drill_productivity_bonus'] = .2},
|
||||
['mining-productivity-2'] = {['mining_drill_productivity_bonus'] = .2},
|
||||
['mining-productivity-3'] = {['mining_drill_productivity_bonus'] = .2},
|
||||
['mining-productivity-4'] = {['mining_drill_productivity_bonus'] = .2},
|
||||
-- -- these already give .1 productivity so we're adding .1 to get to 20%
|
||||
-- ['mining-productivity-1'] = {['mining-drill-productivity-bonus'] = .1, ['character-inventory-slots-bonus'] = 5},
|
||||
-- ['mining-productivity-2'] = {['mining-drill-productivity-bonus'] = .1, ['character-inventory-slots-bonus'] = 5},
|
||||
@ -743,13 +750,13 @@ end
|
||||
|
||||
|
||||
function Public.pick_drilling_ore_amount()
|
||||
return Math.ceil(100 * Public.island_richness_avg_multiplier() * Math.random_float_in_range(0.9, 1.1))
|
||||
return Math.ceil(100 * Public.game_resources_scale() * Math.random_float_in_range(0.9, 1.1))
|
||||
end
|
||||
|
||||
|
||||
-- Note: 3333 crude oil amount ~= 1% = 0.1/sec
|
||||
function Public.pick_default_oil_amount()
|
||||
return Math.ceil(30000 * Public.island_richness_avg_multiplier() * Math.random_float_in_range(0.9, 1.1))
|
||||
return Math.ceil(30000 * Public.game_resources_scale() * Math.random_float_in_range(0.9, 1.1))
|
||||
end
|
||||
|
||||
|
||||
@ -759,11 +766,11 @@ function Public.biter_boat_average_arrival_rate()
|
||||
end
|
||||
|
||||
function Public.coin_amount_from_tree()
|
||||
return Math.ceil(8 * Public.island_richness_avg_multiplier() * Math.random_float_in_range(0.7, 1.3))
|
||||
return Math.ceil(8 * Public.game_resources_scale() * Math.random_float_in_range(0.7, 1.3))
|
||||
end
|
||||
|
||||
function Public.coin_amount_from_rock()
|
||||
return Math.ceil(35 * Public.island_richness_avg_multiplier() * Math.random_float_in_range(0.8, 1.2))
|
||||
return Math.ceil(35 * Public.game_resources_scale() * Math.random_float_in_range(0.8, 1.2))
|
||||
end
|
||||
|
||||
return Public
|
@ -245,13 +245,13 @@ function Public.iron_chest_loot()
|
||||
Math.clamp(0, 1, 5/100 + Common.game_completion_progress())
|
||||
)
|
||||
|
||||
loot[#loot + 1] = {name = 'coin', count = Math.ceil(1000 * Balance.island_richness_avg_multiplier() * Math.random_float_in_range(0.8, 1.2))}
|
||||
loot[#loot + 1] = {name = 'coin', count = Math.ceil(1000 * Balance.game_resources_scale() * Math.random_float_in_range(0.8, 1.2))}
|
||||
|
||||
return loot
|
||||
end
|
||||
|
||||
function Public.quest_structure_coin_loot()
|
||||
return Math.ceil(2000 * Balance.island_richness_avg_multiplier() * Math.random_float_in_range(0.8, 1.2))
|
||||
return Math.ceil(2000 * Balance.game_resources_scale() * Math.random_float_in_range(0.8, 1.2))
|
||||
end
|
||||
|
||||
function Public.covered_wooden_chest_loot()
|
||||
@ -267,8 +267,8 @@ end
|
||||
function Public.covered_wooden_chest_loot_1()
|
||||
|
||||
return {
|
||||
{name = 'iron-plate', count = Math.ceil(600 * Balance.island_richness_avg_multiplier())},
|
||||
{name = 'copper-plate', count = Math.ceil(200 * Balance.island_richness_avg_multiplier())}
|
||||
{name = 'iron-plate', count = Math.ceil(600 * Balance.game_resources_scale())},
|
||||
{name = 'copper-plate', count = Math.ceil(200 * Balance.game_resources_scale())}
|
||||
}
|
||||
end
|
||||
|
||||
@ -337,20 +337,20 @@ end
|
||||
function Public.swamp_storage_tank_fluid_loot()
|
||||
local ret
|
||||
-- ret = {name = 'sulfuric-acid', amount = 100*Math.ceil(Math.random(5^2, 40^2)^(1/2))} -- don't know why this formula made best amount most common, but lowest amount least common (was this intentional?).
|
||||
ret = {name = 'sulfuric-acid', amount = Math.ceil(2000 * Math.random_float_in_range(0.8, 1.2) * Balance.island_richness_avg_multiplier())}
|
||||
ret = {name = 'sulfuric-acid', amount = Math.ceil(2000 * Math.random_float_in_range(0.8, 1.2) * Balance.game_resources_scale())}
|
||||
return ret
|
||||
end
|
||||
|
||||
function Public.roboport_bots_loot()
|
||||
return {
|
||||
{name = 'logistic-robot', count = Math.ceil((15 + Math.random(5)) * Balance.island_richness_avg_multiplier())},
|
||||
{name = 'construction-robot', count = Math.ceil((10 + Math.random(5)) * Balance.island_richness_avg_multiplier())},
|
||||
{name = 'logistic-robot', count = Math.ceil((15 + Math.random(5)) * Balance.game_resources_scale())},
|
||||
{name = 'construction-robot', count = Math.ceil((10 + Math.random(5)) * Balance.game_resources_scale())},
|
||||
}
|
||||
end
|
||||
|
||||
function Public.random_plates(multiplier)
|
||||
multiplier = multiplier or 1
|
||||
multiplier = multiplier * Balance.island_richness_avg_multiplier()
|
||||
multiplier = multiplier * Balance.game_resources_scale()
|
||||
multiplier = multiplier * Math.random_float_in_range(0.9, 1.1)
|
||||
|
||||
local platesrng = Math.random(5)
|
||||
|
@ -55,7 +55,7 @@ function Public.try_give_ore(player, realp, source_name)
|
||||
coin_amount = coin_amount * 2
|
||||
end
|
||||
|
||||
given_amount = Math.max(8 * Balance.island_richness_avg_multiplier(), given_amount)
|
||||
given_amount = Math.max(8 * Balance.game_resources_scale(), given_amount)
|
||||
|
||||
local to_give = {}
|
||||
to_give[#to_give+1] = {name = choice, count = Math.ceil(given_amount)}
|
||||
|
@ -297,7 +297,7 @@ function Public.generate_overworld_destination(p)
|
||||
|
||||
--scheduled raft raids moved to destination_on_arrival
|
||||
|
||||
local ores_multiplier = Balance.island_richness_avg_multiplier(p.x)
|
||||
local ores_multiplier = 2 * Balance.game_resources_scale(p.x) / (1 + Public.builtin_mining_productivity_scale(p.x))
|
||||
|
||||
local base_ores = scope.Data.base_ores()
|
||||
|
||||
@ -343,11 +343,11 @@ function Public.generate_overworld_destination(p)
|
||||
local rng = 0.5 + 1 * Math.random()
|
||||
static_params.starting_treasure_maps = Math.ceil((static_params.base_starting_treasure_maps or 0) * rng)
|
||||
static_params.starting_wood = static_params.base_starting_wood or 1000
|
||||
static_params.starting_wood = Math.ceil(static_params.starting_wood * Balance.island_richness_avg_multiplier(p.x))
|
||||
static_params.starting_rock_material = Math.ceil(static_params.base_starting_rock_material or 300) * Balance.island_richness_avg_multiplier(p.x)
|
||||
static_params.starting_wood = Math.ceil(static_params.starting_wood * Balance.game_resources_scale(p.x))
|
||||
static_params.starting_rock_material = Math.ceil(static_params.base_starting_rock_material or 300) * Balance.game_resources_scale(p.x)
|
||||
|
||||
rng = 0.5 + 1 * Math.random()
|
||||
static_params.starting_treasure = Math.ceil((static_params.base_starting_treasure or 1000) * Balance.island_richness_avg_multiplier(p.x) * rng)
|
||||
static_params.starting_treasure = Math.ceil((static_params.base_starting_treasure or 1000) * Balance.game_resources_scale(p.x) * rng)
|
||||
|
||||
static_params.name = scope.Data.display_names[Math.random(#scope.Data.display_names)]
|
||||
|
||||
@ -679,7 +679,7 @@ function Public.try_overworld_move_v2(vector) --islands stay, crowsnest moves
|
||||
-- Common.give_items_to_crew(Balance.periodic_free_resources_per_x())
|
||||
-- end
|
||||
|
||||
Balance.apply_crew_buffs_per_league(memory.force, vector.x)
|
||||
Balance.apply_crew_buffs_from_leagues(memory.force, memory.overworldx, memory.overworldx + vector.x)
|
||||
|
||||
-- add some evo: (this will get reset upon arriving at a destination anyway, so this is just relevant for sea monsters and the like:)
|
||||
local extra_evo = Balance.base_evolution_leagues(memory.overworldx) - Balance.base_evolution_leagues(memory.overworldx - vector.x)
|
||||
|
@ -87,6 +87,7 @@ end
|
||||
|
||||
function Public.explanation(class, add_is_class_obtainable)
|
||||
local explanation = 'pirates.class_' .. class .. '_explanation_advanced'
|
||||
---@type (string|table)[]
|
||||
local full_explanation
|
||||
|
||||
if class == enum.DECKHAND then
|
||||
@ -520,7 +521,7 @@ function Public.lumberjack_bonus_items(give_table)
|
||||
give_table[#give_table + 1] = {name = 'coin', count = a}
|
||||
memory.playtesting_stats.coins_gained_by_trees_and_rocks = memory.playtesting_stats.coins_gained_by_trees_and_rocks + a
|
||||
elseif Math.random(4) == 1 then
|
||||
local multiplier = Balance.island_richness_avg_multiplier() * Math.random_float_in_range(0.6, 1.4)
|
||||
local multiplier = Balance.game_resources_scale() * Math.random_float_in_range(0.6, 1.4)
|
||||
local amount = Math.ceil(Balance.lumberjack_ore_base_amount * multiplier)
|
||||
if Math.random(4) == 1 then
|
||||
give_table[#give_table + 1] = {name = 'copper-ore', count = amount}
|
||||
|
@ -100,21 +100,21 @@ function Public.terrain(args)
|
||||
|
||||
if noises.forest_abs_suppressed(p) < 0.8 and noises.height(p) > 0.35 then
|
||||
if noises.ore(p) > 1 then
|
||||
local amount = Math.ceil(400 * noises.height(p) * Balance.island_richness_avg_multiplier(args.overworldx))
|
||||
local amount = Math.ceil(800 * noises.height(p) * Balance.game_resources_scale(args.overworldx) / (1 + Public.builtin_mining_productivity_scale(args.overworldx)))
|
||||
args.entities[#args.entities + 1] = {name = 'uranium-ore', position = args.p, amount = amount}
|
||||
end
|
||||
end
|
||||
|
||||
if noises.forest_abs_suppressed(p) < 0.8 and noises.height(p) < 0.35 and noises.height(p) > 0.05 then
|
||||
if noises.ore(p) < -1.5 then
|
||||
local amount = Math.ceil(600 * noises.height(p) * Balance.island_richness_avg_multiplier(args.overworldx))
|
||||
local amount = Math.ceil(1200 * noises.height(p) * Balance.game_resources_scale(args.overworldx) / (1 + Public.builtin_mining_productivity_scale(args.overworldx)))
|
||||
args.entities[#args.entities + 1] = {name = 'stone', position = args.p, amount = amount}
|
||||
elseif noises.ore(p) < 0.005 and noises.ore(p) > -0.005 then
|
||||
if noises.ore(p) > 0 then
|
||||
local amount = Math.ceil(120 * noises.height(p) * Balance.island_richness_avg_multiplier(args.overworldx))
|
||||
local amount = Math.ceil(240 * noises.height(p) * Balance.game_resources_scale(args.overworldx) / (1 + Public.builtin_mining_productivity_scale(args.overworldx)))
|
||||
args.entities[#args.entities + 1] = {name = 'coal', position = args.p, amount = amount}
|
||||
else
|
||||
local amount = Math.ceil(240 * noises.height(p) * Balance.island_richness_avg_multiplier(args.overworldx))
|
||||
local amount = Math.ceil(480 * noises.height(p) * Balance.game_resources_scale(args.overworldx)/ (1 + Public.builtin_mining_productivity_scale(args.overworldx)))
|
||||
args.entities[#args.entities + 1] = {name = 'copper-ore', position = args.p, amount = amount}
|
||||
end
|
||||
end
|
||||
|
@ -118,7 +118,7 @@ function Public.terrain(args)
|
||||
end
|
||||
|
||||
if noises.forest_abs_suppressed(p) < 0.8 and noises.mood(p) > -0.3 then
|
||||
local amount = Math.ceil(80 * noises.height(p) * Balance.island_richness_avg_multiplier(args.overworldx) * Math.random_float_in_range(0.9, 1.1))
|
||||
local amount = Math.ceil(160 * noises.height(p) * Balance.game_resources_scale(args.overworldx) / (1 + Public.builtin_mining_productivity_scale(args.overworldx)) * Math.random_float_in_range(0.9, 1.1))
|
||||
if noises.height(p) > 0.27 then
|
||||
if noises.ore(p) > 1.5 then
|
||||
local name = 'iron-ore'
|
||||
|
@ -76,7 +76,7 @@ function Public.terrain(args)
|
||||
end
|
||||
|
||||
if noises.height(p) > 0.12 and noises.walkways(p) < 0.1 and noises.rock_abs(p) < 0.07 then
|
||||
local amount = Math.ceil(180 * Math.min(noises.height(p), 0.2) * Balance.island_richness_avg_multiplier(args.overworldx) * Math.random_float_in_range(0.8, 1.2))
|
||||
local amount = Math.ceil(360 * Math.min(noises.height(p), 0.2) * Balance.game_resources_scale(args.overworldx) / (1 + Public.builtin_mining_productivity_scale(args.overworldx)) * Math.random_float_in_range(0.8, 1.2))
|
||||
args.entities[#args.entities + 1] = {name = 'coal', position = args.p, amount = amount}
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user