1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00

disable prospector, rework lumberjack

This commit is contained in:
danielmartin0 2022-06-02 13:19:55 +01:00
parent 2ffbcb2038
commit 3a51bb85cd
3 changed files with 57 additions and 43 deletions

View File

@ -646,9 +646,9 @@ end
local function event_pre_player_mined_item(event)
-- figure out which crew this is about:
local crew_id = nil
if event.player_index and game.players[event.player_index].valid then crew_id = tonumber(string.sub(game.players[event.player_index].force.name, -3, -1)) or nil end
Memory.set_working_id(crew_id)
-- local crew_id = nil
-- if event.player_index and game.players[event.player_index].valid then crew_id = tonumber(string.sub(game.players[event.player_index].force.name, -3, -1)) or nil end
-- Memory.set_working_id(crew_id)
-- local memory = Memory.get_crew_memory()
-- if memory.planet[1].type.id == 11 then --rocky planet
@ -660,6 +660,10 @@ local function event_pre_player_mined_item(event)
-- end
end
Public.every_nth_tree_gives_coins = 6
local function event_on_player_mined_entity(event)
if not event.player_index then return end
local player = game.players[event.player_index]
@ -677,8 +681,6 @@ local function event_on_player_mined_entity(event)
return
end
local every_nth_tree_gives_coins = 6
if entity.type == 'tree' then
if not event.buffer then return end
local available = destination.dynamic_data.wood_remaining
@ -695,22 +697,18 @@ local function event_on_player_mined_entity(event)
local give = {}
if memory.classes_table and memory.classes_table[event.player_index] then
if memory.classes_table[event.player_index] == Classes.enum.LUMBERJACK then
give[#give + 1] = {name = 'wood', count = 4}
if Math.random(every_nth_tree_gives_coins) == 1 then
local a = 20
give[#give + 1] = {name = 'coin', count = a}
memory.playtesting_stats.coins_gained_by_trees_and_rocks = memory.playtesting_stats.coins_gained_by_trees_and_rocks + a
end
elseif memory.classes_table[event.player_index] == Classes.enum.WOOD_LORD then
give[#give + 1] = {name = 'wood', count = 1}
give[#give + 1] = {name = 'iron-ore', count = 1}
give[#give + 1] = {name = 'copper-ore', count = 1}
give[#give + 1] = {name = 'coal', count = 1}
if Math.random(every_nth_tree_gives_coins) == 1 then
local a = 12
give[#give + 1] = {name = 'coin', count = a}
memory.playtesting_stats.coins_gained_by_trees_and_rocks = memory.playtesting_stats.coins_gained_by_trees_and_rocks + a
end
Classes.lumberjack_bonus_items(give)
-- elseif memory.classes_table[event.player_index] == Classes.enum.WOOD_LORD then
-- give[#give + 1] = {name = 'wood', count = 1}
-- give[#give + 1] = {name = 'iron-ore', count = 1}
-- give[#give + 1] = {name = 'copper-ore', count = 1}
-- give[#give + 1] = {name = 'coal', count = 1}
-- if Math.random(every_nth_tree_gives_coins) == 1 then
-- local a = 12
-- give[#give + 1] = {name = 'coin', count = a}
-- memory.playtesting_stats.coins_gained_by_trees_and_rocks = memory.playtesting_stats.coins_gained_by_trees_and_rocks + a
-- end
end
end
@ -727,25 +725,21 @@ local function event_on_player_mined_entity(event)
destination.dynamic_data.wood_remaining = destination.dynamic_data.wood_remaining - amount
if memory.classes_table and memory.classes_table[event.player_index] and memory.classes_table[event.player_index] == Classes.enum.LUMBERJACK then
give[#give + 1] = {name = 'wood', count = amount + 3}
if Math.random(every_nth_tree_gives_coins) == 1 then
local a = 12
give[#give + 1] = {name = 'coin', count = a}
memory.playtesting_stats.coins_gained_by_trees_and_rocks = memory.playtesting_stats.coins_gained_by_trees_and_rocks + a
end
elseif memory.classes_table and memory.classes_table[event.player_index] and memory.classes_table[event.player_index] == Classes.enum.WOOD_LORD then
give[#give + 1] = {name = 'wood', count = amount + 3}
give[#give + 1] = {name = 'iron-ore', count = 1}
give[#give + 1] = {name = 'copper-ore', count = 1}
give[#give + 1] = {name = 'coal', count = 1}
if Math.random(every_nth_tree_gives_coins) == 1 then
local a = 12
give[#give + 1] = {name = 'coin', count = a}
memory.playtesting_stats.coins_gained_by_trees_and_rocks = memory.playtesting_stats.coins_gained_by_trees_and_rocks + a
end
give[#give + 1] = {name = 'wood', count = amount}
Classes.lumberjack_bonus_items(give)
-- elseif memory.classes_table and memory.classes_table[event.player_index] and memory.classes_table[event.player_index] == Classes.enum.WOOD_LORD then
-- give[#give + 1] = {name = 'wood', count = amount + 3}
-- give[#give + 1] = {name = 'iron-ore', count = 1}
-- give[#give + 1] = {name = 'copper-ore', count = 1}
-- give[#give + 1] = {name = 'coal', count = 1}
-- if Math.random(every_nth_tree_gives_coins) == 1 then
-- local a = 12
-- give[#give + 1] = {name = 'coin', count = a}
-- memory.playtesting_stats.coins_gained_by_trees_and_rocks = memory.playtesting_stats.coins_gained_by_trees_and_rocks + a
-- end
else
give[#give + 1] = {name = 'wood', count = amount}
if Math.random(every_nth_tree_gives_coins) == 1 then --tuned
if Math.random(Public.every_nth_tree_gives_coins) == 1 then --tuned
local a = 5
give[#give + 1] = {name = 'coin', count = a}
memory.playtesting_stats.coins_gained_by_trees_and_rocks = memory.playtesting_stats.coins_gained_by_trees_and_rocks + a
@ -778,7 +772,7 @@ local function event_on_player_mined_entity(event)
local give = {}
if memory.overworldx > 0 then
if memory.overworldx > 0 then --no coins on first map, else the optimal strategy is to handmine everything there
if memory.classes_table and memory.classes_table[event.player_index] and memory.classes_table[event.player_index] == Classes.enum.PROSPECTOR then
local a = 3
give[#give + 1] = {name = 'coin', count = a}

View File

@ -91,7 +91,7 @@ Public.class_unlocks = {
Public.class_purchase_requirement = {
[enum.MASTER_ANGLER] = enum.FISHERMAN,
[enum.WOOD_LORD] = enum.LUMBERJACK,
-- [enum.CHIEF_EXCAVATOR] = enum.PROSPECTOR,
[enum.CHIEF_EXCAVATOR] = enum.PROSPECTOR,
[enum.HATAMOTO] = enum.SAMURAI,
[enum.DREDGER] = enum.MASTER_ANGLER,
}
@ -108,10 +108,10 @@ function Public.initial_class_pool()
enum.SAMURAI,
-- enum.MERCHANT, --not interesting, breaks coin economy
enum.BOATSWAIN,
enum.PROSPECTOR,
-- enum.PROSPECTOR, --lumberjack is just more fun
enum.LUMBERJACK,
enum.IRON_LEG,
-- enum.SMOLDERING,
-- enum.SMOLDERING, --tedious
enum.GOURMET,
}
end
@ -269,6 +269,24 @@ local function class_on_player_used_capsule(event)
end
end
function Public.lumberjack_bonus_items(give_table)
local memory = Memory.get_crew_memory()
if Math.random(Public.every_nth_tree_gives_coins) == 1 then
local a = 12
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(2) == 1 then
if Math.random(5) == 1 then
give_table[#give_table + 1] = {name = 'copper-ore', count = 1}
else
give_table[#give_table + 1] = {name = 'iron-ore', count = 1}
end
end
end
local event = require 'utils.event'
event.add(defines.events.on_player_used_capsule, class_on_player_used_capsule)

View File

@ -48,11 +48,13 @@ Public.offers_default = {
{price = {{'coin', 720}}, offer = {type = 'give-item', item = 'gate', count = 10}},
{price = {{'coin', 120}}, offer = {type = 'give-item', item = 'storage-tank', count = 4}},
{price = {{'coin', 240}}, offer = {type = 'give-item', item = 'big-electric-pole', count = 8}},
{price = {{'coin', 240}}, offer = {type = 'give-item', item = 'steel-furnace', count = 4}},
{price = {{'coin', 360}}, offer = {type = 'give-item', item = 'stack-inserter', count = 3}},
{price = {{'coin', 900}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell', count = 9}},
{price = {{'coin', 960}}, offer = {type = 'give-item', item = 'flamethrower', count = 1}},
{price = {{'coin', 1800}}, offer = {type = 'give-item', item = 'flamethrower-ammo', count = 5}},
{price = {{'coin', 960}}, offer = {type = 'give-item', item = 'flamethrower', count = 1}},
{price = {{'coin', 1800}}, offer = {type = 'give-item', item = 'flamethrower-ammo', count = 6}},
{price = {{'coin', 1800}}, offer = {type = 'give-item', item = 'flamethrower-ammo', count = 6}},
{price = {{'coin', 1800}}, offer = {type = 'give-item', item = 'flamethrower-ammo', count = 6}},
{price = {{'coin', 1800}}, offer = {type = 'give-item', item = 'flying-robot-frame', count = 1}},
}