1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00
This commit is contained in:
danielmartin0 2022-03-14 12:44:30 +00:00
parent e6df3a60a4
commit 3406def506
33 changed files with 444 additions and 366 deletions

View File

@ -16,7 +16,7 @@ softmod_info_tips_1=Features of the game that are hard to work out alone
softmod_info_tips_2=• You can steer the boat from the crow's nest by placing 100 rail signals in one of the blue boxes.\n• Resources granted to the ship appear in the captain's cabin.\n• Charging a silo launches a rocket. This causes pollution and evo, but gives a reward of fuel and doubloons.\n• Charging a silo drains power from everything else on its network.\n• The quantity of ore available on an island is independent of the order in which you break rocks.\n• Passive pollution ramps up over time on each island.\n• The strength of attacks is proportional to the number of remaining nests. (The time-based rate of evolution is proportional to nests too, but destroying a nest will immediately jump evolution by the amount it 'would have' made had it survived.)\n• Covered markets give back any plates spent to unlock them.\n• Lab productivity increases with each league.\n• The player who spent the longest as captain between leagues 0 and 1000 (exclusive) is written into the highscores table.\n• Logged-out players keep their items with them for a while — except 'important' items that are returned to the crew immediately.\n• Commands: /ccolor gives you a fun color. To manage your class, use /classinfo {classname}, /take {classname}, or /giveup. Captains also have /undock, /req, /officer, /plank.
softmod_info_updates_1=Development
softmod_info_updates_2=Recent significant changes: Silo death is no longer a lose condition. Game made much easier for small crews. New islands and classes. The ship now shares power across each of its floors. Officers can now access red-chests in the captain's cabin directly.
softmod_info_updates_2=Recent significant changes: Silo death is no longer a lose condition. Game made much easier for small crews. New islands and classes. The ship now shares power across each of its floors. Officers can now access chests in the captain's cabin directly.
softmod_info_credits_1=Credits
softmod_info_credits_2=Pirate Ship designed and coded by thesixthroc. Comfy codebase and help from Gerkiz, Hanakocz and Mew @ Comfy Industries (https://getcomfy.eu). Some island structure blueprints contributed by Mattisso.\n\nContact us via Discord: https://getcomfy.eu/discord\n\n"Those white gloves. I'll never forget them 'till the day I die." - Dr. John
@ -39,10 +39,10 @@ mode_tooltip=Mode.
auto_undock_tooltip=The maximum time to stay at this location.\n\nOnce this time is reached, the boat undocks automatically. The captain can choose to leave earlier by pressing this button.
atsea_loading_tooltip=The next destination is loading.
leave_anytime_tooltip=The captain chooses when to undock the ship.\n\nThey can undock by pressing this button.
resources_needed_tooltip_1=At the next destination, these resources will be needed in order to undock early.
resources_needed_tooltip_2=The captain can undock early by clicking this button, but only if enough resources have been stored in the captain's cabin.
resources_needed_tooltip_1=At the next destination, resources will be needed in order to undock early.\n\nFewer resources will be needed the longer you stay, eventually dropping to zero.
resources_needed_tooltip_2=The captain can undock early by clicking this button, but only if enough resources have been stored in the captain's cabin.\n\nCost on arrival: __1__\n\nLeaving now will spend: __2__
resources_needed_tooltip_3=The captain can undock by clicking this button, but only if enough resources are stored in the captain's cabin.
resources_needed_tooltip_1_rocketvariant=At the next destination, these resources will be needed in order to undock early.\n\nThe silo represents a rocket launch.
resources_needed_tooltip_2_rocketvariant=The captain can undock early by clicking this button, but only if enough resources have been stored in the captain's cabin.\n\nThe silo represents a rocket launch.
resources_needed_tooltip_1_rocketvariant=At the next destination, these resources will be needed in order to undock early.\n\nFewer resources will be needed the longer you stay, eventually dropping to zero..\n\nThe silo represents a rocket launch.
resources_needed_tooltip_2_rocketvariant=The captain can undock early by clicking this button, but only if enough resources have been stored in the captain's cabin.\n\nThe silo represents a rocket launch.\n\nnCost on arrival: __1__\n\nLeaving now will spend: __2__
resources_needed_tooltip_3_rocketvariant=The captain can undock by clicking this button, but only if enough resources are stored in the captain's cabin.\n\nThe silo represents a rocket launch.
fuel_tooltip=__1__ stored fuel.\n\nTo store more, send it to the captain's cabin. If the ship runs out of fuel, the crew loses.\n\n*Click* to open the Captain's Store, which only the captain and their officers are authorised to use.

View File

@ -420,7 +420,7 @@ function Public.try_spawner_spend_fraction_of_available_pollution_on_biters(spaw
base_pollution_cost_multiplier = base_pollution_cost_multiplier * Balance.scripted_biters_pollution_cost_multiplier()
if destination.subtype and destination.subtype == IslandsCommon.enum.SWAMP then
base_pollution_cost_multiplier = base_pollution_cost_multiplier * 0.85 --biters 15% more aggressive
base_pollution_cost_multiplier = base_pollution_cost_multiplier * 0.9 --biters 10% more aggressive
end
if destination.subtype and destination.subtype == IslandsCommon.enum.MAZE then

View File

@ -33,7 +33,10 @@ end
function Public.cost_to_leave_multiplier()
-- return Math.sloped(Common.difficulty(), 7/10) --should scale with difficulty similar to, but slightly slower than, passive fuel depletion rate --Edit: not sure about this?
return Math.sloped(Common.difficulty(), 9/10)
-- return Math.sloped(Common.difficulty(), 9/10)
-- extra factor now that the cost scales with time:
return Math.sloped(Common.difficulty(), 9/10) * 1.5
end
Public.rocket_launch_coin_reward = 5000
@ -83,7 +86,7 @@ end
function Public.max_time_on_island_formula() --always >0 --tuned
return 60 * (
(32 + 2 * (Common.overworldx()/40)^(1/3))
(32 + 2.2 * (Common.overworldx()/40)^(1/3))
) * Public.game_slowness_scale()
end
@ -110,7 +113,7 @@ function Public.fuel_depletion_rate_static()
local rate
if Common.overworldx() > 0 then
rate = 570 * (0 + (Common.overworldx()/40)^(9/10)) * Public.crew_scale()^(1/6) * Math.sloped(Common.difficulty(), 4/5) / T --most of the crewsize dependence is through T, i.e. the coal cost per island stays the same... but the extra player dependency accounts for the fact that even in compressed time, more players seem to get more resources per island
rate = 550 * (0 + (Common.overworldx()/40)^(9/10)) * Public.crew_scale()^(1/7) * Math.sloped(Common.difficulty(), 65/100) / T --most of the crewsize dependence is through T, i.e. the coal cost per island stays the same... but the extra player dependency accounts for the fact that even in compressed time, more players seem to get more resources per island
else
rate = 0
end
@ -154,23 +157,24 @@ function Public.boat_passive_pollution_per_minute(time)
end
return boost * (
5.6 * Common.difficulty() * (Common.overworldx()/40)^(1.6) * (Public.crew_scale())^(55/100)
5.0 * Common.difficulty() * (Common.overworldx()/40)^(1.6) * (Public.crew_scale())^(55/100)
) -- There is no _explicit_ T dependence, but it depends almost the same way on the crew_scale as T does.
end
function Public.base_evolution()
local evo
local overworldx = Common.overworldx()
if Common.overworldx() == 0 then
if overworldx == 0 then
evo = 0
else
evo = (0.0201 * (Common.overworldx()/40)) * Math.sloped(Common.difficulty(), 1/5)
evo = (0.0201 * (overworldx/40)) * Math.sloped(Common.difficulty(), 1/5)
if Common.overworldx() > 600 and Common.overworldx() < 1000 then --extra slope from 600 to 1000
evo = evo + (0.0040 * (Common.overworldx() - 600)/40) * Math.sloped(Common.difficulty(), 1/5)
elseif Common.overworldx() > 1000 then
evo = evo + 0.0400 * Math.sloped(Common.difficulty(), 1/5)
if overworldx > 600 and overworldx < 1000 then --extra slope from 600 to 1000 adds 2.5% evo
evo = evo + (0.0025 * (overworldx - 600)/40)
elseif overworldx > 1000 then
evo = evo + 0.0025 * 10
end
end
@ -285,7 +289,8 @@ end
function Public.island_richness_avg_multiplier()
local ret
local base = 0.7 + 0.1 * (Common.overworldx()/40)^(7/10) --tuned tbh
-- local base = 0.7 + 0.1 * (Common.overworldx()/40)^(7/10) --tuned tbh
local base = 0.73 + 0.105 * (Common.overworldx()/40)^(7/10) --tuned tbh
ret = base * Math.sloped(Public.crew_scale(), 1/20) --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 1/14, but we go even slightly lower because we're applying this somewhat sooner than players actually get there.
@ -313,12 +318,12 @@ Public.starting_fuel = 4000
Public.silo_max_hp = 8000
function Public.pistol_damage_multiplier() return 2.05 end
function Public.pistol_damage_multiplier() return 2.5 end
Public.kraken_spawns_base_extra_evo = 0.35
function Public.kraken_evo_increase_per_shot()
return 1/100 * 0.08 --started off low, currently slowly upping to see
return 1/100 * 0.07
end
function Public.kraken_kill_reward()
@ -391,7 +396,7 @@ Public.research_buffs = { --currently disabled anyway
function Public.flamers_tech_multipliers()
return 1/2
return 0.75
end
function Public.flamers_base_nerf()

View File

@ -108,7 +108,7 @@ function(cmd)
local player = game.players[cmd.player_index]
if not Common.validate_player(player) then return end
if param and param == 'nil' then
Classes.try_renounce_class(player)
Classes.try_renounce_class(player, true)
else
Common.notify_player_error(player, 'Command error: parameter not needed.')
end
@ -139,7 +139,7 @@ function(cmd)
if not rgb then return end
player.color = rgb
player.chat_color = rgb
local message = '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']' .. player.name .. '\'s color randomly became ' .. color .. '[/color] (via /ccolor).'
local message = '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']' .. player.name .. '\'s color randomized to ' .. color .. '[/color] (via /ccolor).' --'randomly became' was amusing, but let's not
Common.notify_game(message)
-- disabled due to lag:
-- GUIcolor.toggle_window(player)
@ -332,18 +332,14 @@ function(cmd)
if memory.boat.state == Boats.enum_state.DOCKED then
Progression.undock_from_dock(true)
elseif memory.boat.state == Boats.enum_state.LANDED then
if Common.query_can_pay_cost_to_leave() then
Progression.try_retreat_from_island(true)
else
Common.notify_force_error(player.force, 'Undock error: Not enough stored resources.')
end
Progression.try_retreat_from_island(player, true)
end
end
end)
commands.add_command(
'req',
'is a captain command to requisition items from the crew.',
'is a captain command to take \'important\' items from the crew into your inventory.',
function(cmd)
local param = tostring(cmd.parameter)
if check_captain(cmd) then

View File

@ -45,8 +45,8 @@ Public.maze_minimap_jam_start_league = 920
Public.ban_from_rejoining_crew_ticks = 45 * 60 --to prevent observing map and rejoining
Public.afk_time = 60 * 60 * 5.5
Public.afk_warning_time = 60 * 60 * 5
Public.afk_time = 60 * 60 * 5
Public.afk_warning_time = 60 * 60 * 4.5
Public.logged_off_items_preserved_minutes = 5
Public.important_items = {'coin', 'uranium-235', 'uranium-238', 'fluid-wagon', 'coal', 'electric-engine-unit', 'flying-robot-frame', 'advanced-circuit', 'beacon', 'speed-module-3', 'speed-module-2', 'roboport', 'construction-robot'} --internal inventories of these will not be preserved
@ -430,17 +430,93 @@ function Public.current_destination()
end
function Public.time_adjusted_departure_cost(cost)
local memory = Memory.get_crew_memory()
local ret = cost
-- 1.5s memoization since the gui update will call this function:
if (not memory.time_adjusted_departure_cost_memoized) or (memory.time_adjusted_departure_cost_memoized.tick < game.tick - 90) then
local destination = Public.current_destination()
local dynamic_data = destination.dynamic_data
local timer = dynamic_data.timer
local time_remaining = dynamic_data.time_remaining
if timer and time_remaining and timer >= 0 and time_remaining >= 0 then
local total_time = timer + time_remaining
local elapsed_fraction = timer / total_time
local cost_fraction = 1 - elapsed_fraction
local new_cost = {}
for name, count in pairs(cost) do
if type(count) == "number" then
new_cost[name] = Math.ceil(count * cost_fraction)
else
new_cost[name] = count
end
end
ret = new_cost
end
local resources_strings1 = ''
local j = 1
for name, count in pairs(cost) do
if name ~= 'launch_rocket' then
if j > 1 then
resources_strings1 = resources_strings1 .. ', '
end
resources_strings1 = resources_strings1 .. count .. ' [item=' .. name .. ']'
j = j + 1
end
end
local resources_strings2 = ''
j = 1
for name, count in pairs(ret) do
if name ~= 'launch_rocket' then
if j > 1 then
resources_strings2 = resources_strings2 .. ', '
end
resources_strings2 = resources_strings2 .. count .. ' [item=' .. name .. ']'
j = j + 1
end
end
memory.time_adjusted_departure_cost_memoized = {
tick = game.tick,
cost = ret,
resources_strings = {resources_strings1, resources_strings2}
}
else
ret = memory.time_adjusted_departure_cost_memoized.cost
end
return ret
end
function Public.time_adjusted_departure_cost_resources_strings(memory)
-- written to be efficient... only called in the gui after Public.time_adjusted_departure_cost()
return memory.time_adjusted_departure_cost_memoized.resources_strings
end
function Public.query_can_pay_cost_to_leave()
local memory = Memory.get_crew_memory()
local boat = memory.boat
local destination = Public.current_destination()
if not (boat and destination) then return end
local cost = destination.static_params.cost_to_leave
local cost = destination.static_params.base_cost_to_undock
if not cost then return true end
local adjusted_cost = Public.time_adjusted_departure_cost(cost)
local can_leave = true
for name, count in pairs(cost) do
for name, count in pairs(adjusted_cost) do
if name == 'launch_rocket' then
if not destination.dynamic_data.rocketlaunched then
can_leave = false

View File

@ -5,8 +5,8 @@ local inspect = require 'utils.inspect'.inspect
local Public = {}
Public.scenario_id_name = 'pirates'
Public.version_string = '1.1.1.0'
Public.version_float = 1.110
Public.version_string = '1.1.1.1'
Public.version_float = 1.111
Public.blueprint_library_allowed = true
Public.blueprint_importing_allowed = true

View File

@ -375,6 +375,8 @@ function Public.join_crew(player, crewid, rejoin)
end
end
Roles.confirm_captain_exists(player)
if #Common.crew_get_crew_members() == 1 and memory.crew_disband_tick then
memory.crew_disband_tick = nil --to prevent disbanding the crew after saving the game (booting everyone) and loading it again (joining the crew as the only member)
end
@ -828,7 +830,7 @@ function Public.reset_crew_and_enemy_force(id)
crew_force.technologies['advanced-material-processing'].researched = true
crew_force.technologies['advanced-material-processing-2'].researched = true
crew_force.technologies['solar-energy'].researched = true
-- crew_force.technologies['inserter-capacity-bonus-1'].researched = true
crew_force.technologies['inserter-capacity-bonus-1'].researched = true --needed to make stack inserters different to fast inserters
-- crew_force.technologies['inserter-capacity-bonus-2'].researched = true
--@TRYING this out:

View File

@ -566,18 +566,6 @@ function Public.click(event)
end
-- if eventname == 'capn_undock_normal' then
-- --double check:
-- if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
-- if memory.boat.state == Boats.enum_state.DOCKED then
-- Progression.undock_from_dock()
-- else
-- Progression.try_retreat_from_island()
-- end
-- end
-- return
-- end
if eventname == 'capn_summon_crew' then
--double check:
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
@ -595,7 +583,7 @@ function Public.click(event)
end
if eventname == 'class_renounce' then
Classes.try_renounce_class(player)
Classes.try_renounce_class(player, true)
return
end

View File

@ -590,8 +590,8 @@ function Public.update_gui(player)
charged_bool = dynamic_data.silocharged
launched_bool = dynamic_data.rocketlaunched
cost_bool = destination.static_params.cost_to_leave and (not atsea_sailing_bool) and (not retreating_bool)
cost_includes_rocket_launch = cost_bool and destination.static_params.cost_to_leave['launch_rocket']
cost_bool = destination.static_params.base_cost_to_undock and (not atsea_sailing_bool) and (not retreating_bool)
cost_includes_rocket_launch = cost_bool and destination.static_params.base_cost_to_undock['launch_rocket']
leave_anytime_bool = (landed_bool and not (eta_bool or cost_bool))
end
@ -688,6 +688,9 @@ function Public.update_gui(player)
end
if cost_bool then
local costs = destination.static_params.base_cost_to_undock
local adjusted_costs = Common.time_adjusted_departure_cost(costs)
local cost_table = flow2.cost_table
flow2.etaframe_label_3.visible = true
@ -709,31 +712,33 @@ function Public.update_gui(player)
flow2.etaframe_label_3.visible = false
flow2.etaframe_label_1.visible = true
flow2.etaframe_label_1.caption = 'To escape, store'
if cost_includes_rocket_launch then
tooltip = {'pirates.resources_needed_tooltip_3_rocketvariant'}
else
tooltip = {'pirates.resources_needed_tooltip_3'}
end
else
flow2.etaframe_label_3.caption = 'Or pay'
flow2.etaframe_label_3.caption = 'Or store'
local adjusted_costs_resources_strings = Common.time_adjusted_departure_cost_resources_strings(memory)
if cost_includes_rocket_launch then
tooltip = {'pirates.resources_needed_tooltip_2_rocketvariant'}
tooltip = {'pirates.resources_needed_tooltip_2_rocketvariant', adjusted_costs_resources_strings[1], adjusted_costs_resources_strings[2]}
else
tooltip = {'pirates.resources_needed_tooltip_2'}
--@Future reference: localisation handling
tooltip = {'pirates.resources_needed_tooltip_2', adjusted_costs_resources_strings[1], adjusted_costs_resources_strings[2]}
end
end
local costs = destination.static_params.cost_to_leave
for i = 1, #CoreData.cost_items do
local item_name = CoreData.cost_items[i].name
if costs[item_name] and cost_table['cost_' .. i] then
if adjusted_costs[item_name] and cost_table['cost_' .. i] then
local stored = (memory.boat.stored_resources and memory.boat.stored_resources[item_name]) or 0
if atsea_loading_bool then
cost_table['cost_' .. i].number = costs[item_name]
cost_table['cost_' .. i].number = adjusted_costs[item_name]
else --subtract off the amount we've stored
cost_table['cost_' .. i].number = Math.max(costs[item_name] - stored, 0)
cost_table['cost_' .. i].number = Math.max(adjusted_costs[item_name] - stored, 0)
end
cost_table['cost_' .. i].tooltip = CoreData.cost_items[i].display_name
cost_table['cost_' .. i].visible = true
@ -742,7 +747,7 @@ function Public.update_gui(player)
end
end
if costs['launch_rocket'] and cost_table['cost_launch_rocket'] then
if adjusted_costs['launch_rocket'] and cost_table['cost_launch_rocket'] then
if atsea_loading_bool or (not dynamic_data.rocketlaunched) then
cost_table['cost_launch_rocket'].number = 1
else
@ -782,7 +787,7 @@ function Public.update_gui(player)
-- if cost_bool then
-- flow1.visible = true
-- -- local costs = destination.static_params.cost_to_leave
-- -- local costs = destination.static_params.base_cost_to_undock
-- -- for i = 1, #CoreData.cost_items do
-- -- local item_name = CoreData.cost_items[i].name
@ -1147,11 +1152,7 @@ local function on_gui_click(event)
if memory.boat.state == Boats.enum_state.DOCKED then
Progression.undock_from_dock(true)
elseif memory.boat.state == Boats.enum_state.LANDED then
if Common.query_can_pay_cost_to_leave() then
Progression.try_retreat_from_island(true)
else
Common.notify_force_error(player.force, 'Undock error: Not enough stored resources.')
end
Progression.try_retreat_from_island(player, true)
end
else
memory.undock_shortcut_are_you_sure_data[player.index] = game.tick

View File

@ -58,7 +58,7 @@ function Public.silo_died()
if CoreData.rocket_silo_death_causes_loss then
-- Crew.lose_life()
Crew.try_lose('silo destroyed')
elseif (not destination.dynamic_data.rocketlaunched) and destination.static_params and destination.static_params.cost_to_leave and destination.static_params.cost_to_leave['launch_rocket'] and destination.static_params.cost_to_leave['launch_rocket'] == true then
elseif (not destination.dynamic_data.rocketlaunched) and destination.static_params and destination.static_params.base_cost_to_undock and destination.static_params.base_cost_to_undock['launch_rocket'] and destination.static_params.base_cost_to_undock['launch_rocket'] == true then
Crew.try_lose('silo destroyed before a necessary launch')
elseif (not destination.dynamic_data.rocketlaunched) then
Common.notify_force(force, 'The silo was destroyed.')
@ -169,7 +169,7 @@ local function enemyboat_spawners_invulnerable(event)
end
end
local function artillery_damage(event)
local function damage_to_artillery(event)
local memory = Memory.get_crew_memory()
if not (event.entity and event.entity.valid and event.entity.name and event.entity.name == 'artillery-turret') then return end
@ -186,14 +186,20 @@ local function artillery_damage(event)
end
end
local function kraken_damage(event)
local memory = Memory.get_crew_memory()
local function damage_to_krakens(event)
if not (event.entity and event.entity.valid and event.entity.name and event.entity.name == 'biter-spawner') then return end
if string.sub(event.entity.force.name, 1, 5) ~= 'enemy' then
return
end
if not event.cause then return end
if not event.cause.valid then return end
if not event.cause.name then return end
local memory = Memory.get_crew_memory()
local surface_name = memory.boat and memory.boat.surface_name
if not (surface_name == memory.sea_name) then return end
@ -232,7 +238,7 @@ end
local function extra_damage_to_players(event)
local function damage_to_players_changes(event)
local memory = Memory.get_crew_memory()
if not (event.entity and event.entity.valid and event.entity.name and event.entity.name == 'character') then return end
@ -244,60 +250,68 @@ local function extra_damage_to_players(event)
-- if string.sub(event.cause.force.name, 1, 5) ~= 'enemy' then return end --Enemy Forces
local player_index = event.entity.player.index
if memory.classes_table and memory.classes_table[player_index] then
if memory.classes_table[player_index] == Classes.enum.MERCHANT then
event.entity.health = event.entity.health - event.final_damage_amount * 0.5
elseif memory.classes_table[player_index] == Classes.enum.SCOUT then
event.entity.health = event.entity.health - event.final_damage_amount * 0.2
elseif memory.classes_table[player_index] == Classes.enum.IRON_LEG and event.final_health > 0 then --lethal damage is unaffected, as otherwise they can never die
local inv = event.entity.get_inventory(defines.inventory.character_main)
if not (inv and inv.valid) then return end
local count = inv.get_item_count('iron-ore')
if count and count >= 3500 then
event.entity.health = event.entity.health + event.final_damage_amount * 0.87
end
end --samurai health buff is elsewhere
end
local class = memory.classes_table and memory.classes_table[player_index]
if event.final_health > 0 then
if event.damage_type.name == 'poison' then --make all poison damage stronger
event.entity.health = event.entity.health - event.final_damage_amount * 0.25
end
local damage_multiplier = 1
event.entity.health = event.entity.health - event.final_damage_amount * Balance.bonus_damage_to_humans()
end
end
local function scout_damage_dealt_changes(event)
local memory = Memory.get_crew_memory()
local player_index = event.cause.player.index
if memory.classes_table and memory.classes_table[player_index] and memory.classes_table[player_index] == Classes.enum.SCOUT then
if event.final_health > 0 then --lethal damage is unaffected, as otherwise they can never kill
event.entity.health = event.entity.health + 0.4 * event.final_damage_amount
if class and class == Classes.enum.MERCHANT then
damage_multiplier = damage_multiplier * 1.5
elseif class and class == Classes.enum.SCOUT then
damage_multiplier = damage_multiplier * 1.25
elseif class and class == Classes.enum.SAMURAI then
damage_multiplier = damage_multiplier * 0.25
elseif class and class == Classes.enum.HATAMOTO then --lethal damage needs to be unaffected
damage_multiplier = damage_multiplier * 0.15
elseif class and class == Classes.enum.IRON_LEG then --lethal damage needs to be unaffected
local inv = event.entity.get_inventory(defines.inventory.character_main)
if not (inv and inv.valid) then return end
local count = inv.get_item_count('iron-ore')
if count and count >= 3500 then
damage_multiplier = damage_multiplier * 0.15
end
else
damage_multiplier = damage_multiplier * (1 + Balance.bonus_damage_to_humans())
end
if event.damage_type.name == 'poison' then --make all poison damage stronger
damage_multiplier = damage_multiplier * 1.25
end
if damage_multiplier > 1 then
event.entity.health = event.entity.health - event.final_damage_amount * (damage_multiplier - 1)
elseif damage_multiplier < 1 and event.final_health > 0 then --lethal damage needs to be unaffected, else they never die
event.entity.health = event.entity.health + event.final_damage_amount * (1 - damage_multiplier)
end
end
local function samurai_damage_dealt_changes(event)
local function damage_dealt_by_players_changes(event)
local memory = Memory.get_crew_memory()
if not event.cause then return end
if not event.cause.valid then return end
if not event.entity.valid then return end
if event.cause.name ~= 'character' then return end
local character = event.cause
local player = character.player
local player_index = player.index
local physical = event.damage_type.name == 'physical'
local acid = event.damage_type.name == 'acid'
if player and memory.classes_table and memory.classes_table[player_index] then
local player_index = player.index
local class = memory.classes_table and memory.classes_table[player_index]
if class and class == Classes.enum.SCOUT and event.final_health > 0 then --lethal damage must be unaffected
event.entity.health = event.entity.health + 0.4 * event.final_damage_amount
elseif class and (class == Classes.enum.SAMURAI or class == Classes.enum.HATAMOTO) then
local samurai = memory.classes_table[player_index] == Classes.enum.SAMURAI
local hatamoto = memory.classes_table[player_index] == Classes.enum.HATAMOTO
--==Note this!
if not (samurai or hatamoto) then return end
local physical = event.damage_type.name == 'physical'
local acid = event.damage_type.name == 'acid'
local no_weapon = (not (character.get_inventory(defines.inventory.character_guns) and character.get_inventory(defines.inventory.character_guns)[character.selected_gun_index] and character.get_inventory(defines.inventory.character_guns)[character.selected_gun_index].valid_for_read))
local melee = (physical or acid) and no_weapon
@ -335,35 +349,35 @@ local function samurai_damage_dealt_changes(event)
end
end
end
end
if physical then
local function quartermaster_damage_dealt_changes(event)
local memory = Memory.get_crew_memory()
if not memory.classes_table then return end
if event.damage_type.name ~= 'physical' then return end
local character = event.cause
if not character.valid then return end
local player = character.player
local player_index = player.index
local nearby_players = player.surface.find_entities_filtered{position = player.position, radius = Common.quartermaster_range, type = {'character'}}
for _, p2 in pairs(nearby_players) do
if p2.player and p2.player.valid then
local p2_index = p2.player.index
if player_index ~= p2_index and memory.classes_table[p2_index] and memory.classes_table[p2_index] == Classes.enum.QUARTERMASTER then
if event.damage_type.name == 'physical' then
-- QUARTERMASTER BUFFS
local nearby_players = player.surface.find_entities_filtered{position = player.position, radius = Common.quartermaster_range, type = {'character'}}
for _, p2 in pairs(nearby_players) do
if p2.player and p2.player.valid then
local p2_index = p2.player.index
if player_index ~= p2_index and memory.classes_table[p2_index] and memory.classes_table[p2_index] == Classes.enum.QUARTERMASTER then
event.entity.damage(0.1 * event.final_damage_amount, character.force, 'impact', character) --triggers this function again, but not physical this time
end
end
end
-- PISTOL BUFFS
if character.shooting_state.state ~= defines.shooting.not_shooting then
local weapon = character.get_inventory(defines.inventory.character_guns)[character.selected_gun_index]
local ammo = character.get_inventory(defines.inventory.character_ammo)[character.selected_gun_index]
if weapon.valid_for_read and ammo.valid_for_read and weapon.name == 'pistol' and (ammo.name == 'firearm-magazine' or ammo.name == 'piercing-rounds-magazine' or ammo.name == 'uranium-rounds-magazine') then
event.entity.damage(event.final_damage_amount * (Balance.pistol_damage_multiplier() - 1), character.force, 'impact', character) --triggers this function again, but not physical this time
end
end
end
end
local function swamp_resist_poison(event)
local memory = Memory.get_crew_memory()
@ -431,38 +445,20 @@ local function event_on_entity_damaged(event)
if not event.entity.valid then return end -- need to call again, silo might be dead
if not event.entity.health then return end
damage_to_players_changes(event)
enemyboat_spawners_invulnerable(event)
biters_chew_stuff_faster(event)
extra_damage_to_players(event)
artillery_damage(event)
damage_to_artillery(event)
swamp_resist_poison(event)
maze_walls_resistance(event)
damage_to_krakens(event)
if string.sub(event.entity.force.name, 1, 5) == 'enemy' then
kraken_damage(event)
-- Balance.biter_immunities(event)
end
damage_dealt_by_players_changes(event)
if not event.cause then return end
if not event.cause.valid then return end
if event.cause.name ~= 'character' then return end
scout_damage_dealt_changes(event)
samurai_damage_dealt_changes(event)
quartermaster_damage_dealt_changes(event)
if event.damage_type.name ~= 'physical' then return end --guns and melee... maybe more
local character = event.cause
if character.shooting_state.state == defines.shooting.not_shooting then return end
local weapon = character.get_inventory(defines.inventory.character_guns)[character.selected_gun_index]
local ammo = character.get_inventory(defines.inventory.character_ammo)[character.selected_gun_index]
if not weapon.valid_for_read or not ammo.valid_for_read then return end
if weapon.name ~= 'pistol' then return end
if ammo.name ~= 'firearm-magazine' and ammo.name ~= 'piercing-rounds-magazine' and ammo.name ~= 'uranium-rounds-magazine' then return end
if not event.entity.valid then return end
event.entity.damage(event.final_damage_amount * (Balance.pistol_damage_multiplier() - 1), character.force, 'impact', character) --triggers this function again, but not physical this time
-- if string.sub(event.entity.force.name, 1, 5) == 'enemy' then
-- -- Balance.biter_immunities(event)
-- end
end
@ -628,6 +624,26 @@ local function event_on_player_mined_entity(event)
tick_tack_trap(memory.enemy_force_name, entity.surface, entity.position)
return
end
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
if Math.random(7) == 1 then
give[#give + 1] = {name = 'coin', count = 15}
end
elseif memory.classes_table[event.player_index] == Classes.enum.WOOD_LORD then
give[#give + 1] = {name = 'iron-ore', count = 2}
give[#give + 1] = {name = 'copper-ore', count = 2}
give[#give + 1] = {name = 'coal', count = 2}
if Math.random(7) == 1 then
give[#give + 1] = {name = 'coin', count = 15}
end
end
end
if #give > 0 then
Common.give(player, give, entity.position)
end
else
local give = {}
@ -1068,8 +1084,6 @@ local function event_on_player_joined_game(event)
end
end
Roles.confirm_captain_exists(player)
if not _DEBUG then
Gui.info.toggle_window(player)
end
@ -1433,7 +1447,7 @@ local function event_on_rocket_launched(event)
end
local force = memory.force
Common.notify_force_light(force,'Granted ' .. Balance.rocket_launch_coin_reward .. ' [item=coin] and ' .. destination.dynamic_data.rocketcoalreward .. ' fuel.')
Common.notify_force_light(force,'Granted ' .. string.format('%.1fk', Balance.rocket_launch_coin_reward/1000) .. ' [item=coin] and ' .. string.format('%.1fk', destination.dynamic_data.rocketcoalreward/1000) .. ' fuel.')
if destination.dynamic_data.quest_type == Quest.enum.TIME and (not destination.dynamic_data.quest_complete) then
destination.dynamic_data.quest_progressneeded = 1

View File

@ -21,7 +21,7 @@ Public.buried_treasure_loot_data_raw = {
{150, 0, 1, false, 'crude-oil-barrel', 25, 45},
{70, 0, 1, false, 'effectivity-module-3', 3, 4},
{70, 0, 1, false, 'speed-module-3', 3, 4},
{10, 0, 1, false, 'productivity-module-3', 2, 2},
{10, 0, 1, false, 'productivity-module-2', 2, 2}, --3s are banned because of game mech
{70, 0, 1, false, 'plastic-bar', 40, 70},
{60, 0, 1, false, 'chemical-science-pack', 12, 24},
{70, 0, 1, false, 'assembling-machine-3', 2, 2},
@ -330,11 +330,11 @@ end
Public.maze_treasure_data_raw = {
{2, -1, 1, true, 'rocket', 18, 24},
{2, -1, 1, false, 'stack-inserter', 8, 10},
{2, -1, 1, false, 'stack-filter-inserter', 5, 6},
{2, 0, 1, false, 'poison-capsule', 10, 12},
{2, 0, 1, false, 'destroyer-capsule', 6, 6},
{2, 0, 1, false, 'slowdown-capsule', 8, 8},
{2, -0.8, 0.8, false, 'stack-inserter', 8, 10},
{2, -0.8, 0.8, false, 'stack-filter-inserter', 5, 6},
{2, 0, 1, false, 'poison-capsule', 22, 22},
{2, 0, 1, false, 'destroyer-capsule', 8, 8},
{2, 0, 1, false, 'slowdown-capsule', 14, 14},
{2, 0, 1, false, 'uranium-rounds-magazine', 15, 25},
{2, 0, 1, false, 'artillery-shell', 5, 7},
@ -346,7 +346,7 @@ Public.maze_treasure_data_raw = {
{1, 0, 0.8, false, 'speed-module-3', 2, 2},
{1, 0, 0.8, false, 'effectivity-module-3', 3, 3},
{0.5, 0, 1, false, 'productivity-module-3', 2, 2},
{0.5, 0, 1, false, 'productivity-module-2', 2, 2}, --3s are banned because of game mech
{2, 0, 1.5, true, 'production-science-pack', 20, 25},
{2, 0, 2, true, 'utility-science-pack', 7, 8},
@ -417,7 +417,7 @@ Public.dredger_loot_raw = {
{0.05, 0, 1, false, 'speed-module-3', 1, 1},
{0.05, 0, 1, false, 'effectivity-module-3', 1, 1},
{0.05, 0, 1, false, 'productivity-module-3', 1, 1},
{0.05, 0, 1, false, 'productivity-module-2', 1, 1}, --3s are banned because of game mech
{0.1, 0, 1, false, 'rocket', 1, 1},
{0.01, 0, 1, false, 'explosive-rocket', 1, 1},

View File

@ -79,6 +79,9 @@ function Public.generate_overworld_destination(p)
if macrop.x == 4 then
island_subtype_raffle = Utils.ordered_table_with_values_removed(island_subtype_raffle, Surfaces.Island.enum.STANDARD)
end
if macrop.x == 18 then
island_subtype_raffle = Utils.ordered_table_with_values_removed('none') --flying-robot-frame cost is here, and we just make sure there's an island to see it
end
if macrop.x == 19 then
island_subtype_raffle = Utils.ordered_table_with_values_removed(island_subtype_raffle, Surfaces.Island.enum.SWAMP)
end
@ -109,7 +112,7 @@ function Public.generate_overworld_destination(p)
subtype = Surfaces.Island.enum.WALKWAYS
elseif macrop.x == 23 then --overwrite dock. rocket launch cost
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.MAZE
subtype = Surfaces.Island.enum.WALKWAYS
elseif macrop.y == -1 and (((macrop.x % 4) == 3 and macrop.x ~= 15) or macrop.x == 14) then --avoid x=15 because radioactive is there
type = Surfaces.enum.DOCK
elseif macrop.x == 5 then --biter boats appear. large island works well so players run off
@ -135,7 +138,7 @@ function Public.generate_overworld_destination(p)
elseif macrop.x == 11 then --just after krakens, but dock is here too, so there's a choice
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.SWAMP
elseif macrop.x == 15 then
elseif macrop.x == 16 then
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.RADIOACTIVE
--electric engines needed at 20
@ -150,7 +153,7 @@ function Public.generate_overworld_destination(p)
type = nil
elseif macrop.x == 24 then --rocket launch cost
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.WALKWAYS
subtype = Surfaces.Island.enum.MAZE
elseif macrop.x == 25 then
type = nil --finish line
else
@ -168,7 +171,7 @@ function Public.generate_overworld_destination(p)
if _DEBUG and type == Surfaces.enum.ISLAND then
-- warning: the first map is unique in that it isn't all loaded by the time you arrive, which can cause issues. For example, structures might get placed after ore, thereby deleting the ore underneath them.
subtype = Surfaces.Island.enum.MAZE
subtype = Surfaces.Island.enum.WALKWAYS
-- subtype = nil
-- type = Surfaces.enum.DOCK
end
@ -183,103 +186,105 @@ function Public.generate_overworld_destination(p)
local scope = Surfaces[Surfaces.enum.ISLAND][subtype]
local static_params = Utils.deepcopy(scope.Data.static_params_default)
local cost_to_leave
local base_cost_to_undock
-- These need to scale up slower than the static fuel depletion rate:
local normal_costitems = {'electronic-circuit', 'engine-unit', 'advanced-circuit'}
local normal_costitems = {'electronic-circuit', 'advanced-circuit'}
-- local normal_costitems = {'electronic-circuit', 'engine-unit', 'advanced-circuit'}
local base_cost_0 = {
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*65),
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*80),
}
local base_cost_1 = {
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*65),
['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*80),
-- ['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
}
local base_cost_2 = {
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*65),
['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['advanced-circuit'] = Math.ceil(((macrop.x-14)^(2/3))*10),
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*80),
-- ['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['advanced-circuit'] = Math.ceil(((macrop.x-14)^(2/3))*12),
}
local base_cost_2b = {
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*65),
['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*80),
-- ['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['flying-robot-frame'] = 2,
}
local base_cost_2c = {
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*65),
['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['advanced-circuit'] = Math.ceil(((macrop.x-14)^(2/3))*10),
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*80),
-- ['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['advanced-circuit'] = Math.ceil(((macrop.x-14)^(2/3))*12),
['launch_rocket'] = true,
}
local base_cost_3 = {
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*65),
['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['advanced-circuit'] = Math.ceil(((macrop.x-14)^(2/3))*10),
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*80),
-- ['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['advanced-circuit'] = Math.ceil(((macrop.x-14)^(2/3))*12),
['flying-robot-frame'] = Math.ceil(((macrop.x-18)^(2/3))*5),
['launch_rocket'] = true,
}
local base_cost_4 = {
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*65),
['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['advanced-circuit'] = Math.ceil(((macrop.x-14)^(2/3))*10),
['electronic-circuit'] = Math.ceil(((macrop.x-2)^(2/3))*80),
-- ['engine-unit'] = Math.ceil(((macrop.x-7)^(2/3))*12),
['advanced-circuit'] = Math.ceil(((macrop.x-14)^(2/3))*12),
['flying-robot-frame'] = Math.ceil(((macrop.x-18)^(2/3))*5),
}
if macrop.x == 0 then
-- if _DEBUG then
-- cost_to_leave = {
-- base_cost_to_undock = {
-- ['electronic-circuit'] = 5,
-- ['engine-unit'] = 5,
-- ['advanced-circuit'] = 5,
-- ['flying-robot-frame'] = 5,
-- }
-- end
-- cost_to_leave = nil
-- base_cost_to_undock = nil
elseif macrop.x <= 6 then
-- cost_to_leave = {['electronic-circuit'] = 5}
cost_to_leave = nil
-- base_cost_to_undock = {['electronic-circuit'] = 5}
base_cost_to_undock = nil
elseif macrop.x <= 9 then
cost_to_leave = base_cost_0
base_cost_to_undock = base_cost_0
elseif macrop.x <= 15 then
if macrop.x % 3 > 0 then
cost_to_leave = base_cost_1
base_cost_to_undock = base_cost_1
else
cost_to_leave = nil
base_cost_to_undock = nil
end
elseif macrop.x == 18 then --a super small amount of flying-robot-frame on a relatively early level so that they see they need lubricant
cost_to_leave = base_cost_2b
base_cost_to_undock = base_cost_2b
elseif macrop.x <= 20 then
if macrop.x % 3 > 0 then
cost_to_leave = base_cost_2
base_cost_to_undock = base_cost_2
else
cost_to_leave = nil
base_cost_to_undock = nil
end
elseif macrop.x <= 22 then
cost_to_leave = base_cost_2c
base_cost_to_undock = base_cost_2c
elseif macrop.x <= 24 then
cost_to_leave = base_cost_3
base_cost_to_undock = base_cost_3
else
cost_to_leave = Utils.deepcopy(base_cost_4)
base_cost_to_undock = Utils.deepcopy(base_cost_4)
local delete = normal_costitems[Math.random(#normal_costitems)]
cost_to_leave[delete] = nil
base_cost_to_undock[delete] = nil
if macrop.x % 2 == 0 then
cost_to_leave['launch_rocket'] = true
base_cost_to_undock['launch_rocket'] = true
end
end
-- override:
if subtype == Surfaces.Island.enum.RADIOACTIVE then
cost_to_leave = {
base_cost_to_undock = {
['uranium-235'] = Math.ceil(Math.ceil(80 + (macrop.x))),
-- ['uranium-235'] = Math.ceil(Math.ceil(80 + (macrop.x)/2)), --tried adding beacons instead of this
}
end
-- -- debug override:
-- if _DEBUG then
-- cost_to_leave = {
-- ['launch_rocket'] = true,
-- }
-- end
if _DEBUG then
base_cost_to_undock = {
['electronic-circuit'] = 200,
['launch_rocket'] = true,
}
end
static_params.cost_to_leave = cost_to_leave -- Multiplication by Balance.cost_to_leave_multiplier() happens later, in destination_on_collide.
static_params.base_cost_to_undock = base_cost_to_undock -- Multiplication by Balance.cost_to_leave_multiplier() happens later, in destination_on_collide.
--scheduled raft raids moved to destination_on_arrival
@ -313,7 +318,7 @@ function Public.generate_overworld_destination(p)
static_params.radius_squared_modifier = (2 + 2 * Math.random())
if macrop.x == 0 then static_params.radius_squared_modifier = 2 end
if macrop.x == 0 then static_params.radius_squared_modifier = 1.75 end
static_params.discord_emoji = scope.Data.discord_emoji

View File

@ -71,7 +71,7 @@ function Public.parrot_kraken_warning()
end
function Public.parrot_radioactive_tip_1()
local memory = Memory.get_crew_memory()
Common.parrot_speak(memory.force, '600 leagues? We\'ll need uranium-235 to push away from this island...')
Common.parrot_speak(memory.force, 'We\'ll need uranium-235 to push away from this island...')
end
function Public.parrot_radioactive_tip_2()
local memory = Memory.get_crew_memory()
@ -83,7 +83,7 @@ function Public.parrot_maze_tip_1()
end
function Public.parrot_800_tip()
local memory = Memory.get_crew_memory()
Common.parrot_speak(memory.force, '800 leagues? The resources needed to leave will get a bit harder now...')
Common.parrot_speak(memory.force, 'The resources needed to leave will get a bit harder now...')
end
function Public.parrot_overstay_tip()
local memory = Memory.get_crew_memory()

View File

@ -47,7 +47,7 @@ function Public.fuel_depletion_rate()
elseif state == Boats.enum_state.LANDED then
return Balance.fuel_depletion_rate_static()
elseif state == Boats.enum_state.DOCKED then
return 0.1
return -0.1
else
return 0
end
@ -417,53 +417,30 @@ end
function Public.try_retreat_from_island(manual) -- Assumes the cost can be paid
function Public.try_retreat_from_island(player, manual) -- Assumes the cost can be paid
local memory = Memory.get_crew_memory()
if memory.game_lost then return end
local destination = Common.current_destination()
local captain_index = memory.playerindex_captain
local captain = game.players[captain_index]
if Common.query_can_pay_cost_to_leave() then
if destination.dynamic_data.timeratlandingtime and destination.dynamic_data.timer < destination.dynamic_data.timeratlandingtime + 10 then
if player and Common.validate_player(player) then
Common.notify_player_error(player, 'Undock error: Can\'t undock in the first 10 seconds.')
end
else
local cost = destination.static_params.base_cost_to_undock
if captain and Common.validate_player(captain) and destination.dynamic_data.timeratlandingtime and destination.dynamic_data.timer < destination.dynamic_data.timeratlandingtime + 10 then
Common.notify_player_error(captain, 'Undock error: Can\'t undock in the first 10 seconds.')
else
local cost = destination.static_params.cost_to_leave
-- if cost and (not destination.dynamic_data.rocketlaunched) then
if cost then
local adjusted_cost = Common.time_adjusted_departure_cost(cost)
-- local gold = memory.gold
-- local captain_index = memory.playerindex_captain
-- if not (gold and captain_index) then return end
-- local captain = game.players[captain_index]
-- if not Common.validate_player_and_character(captain) then return end
-- local captain_inv = captain.get_inventory(defines.inventory.character_main)
-- if not captain_inv then return end
-- local can_buy = true
-- if cost.name == 'gold' then
-- can_buy = gold >= cost.count
-- else
-- can_buy = captain_inv.get_item_count(cost.name) >= cost.count
-- end
-- if can_buy then
-- if cost.name == 'gold' then
-- memory.gold = memory.gold - cost.count
-- else
-- captain_inv.remove{name=cost.name, count=cost.count}
-- end
-- Public.retreat_from_island()
-- else
-- Common.notify_player(captain, 'Can\'t afford it.')
-- end
-- else
-- Public.retreat_from_island()
-- end
if cost then
Common.spend_stored_resources(cost)
Common.spend_stored_resources(adjusted_cost)
end
Public.retreat_from_island(manual)
end
else
if player and Common.validate_player(player) then
Common.notify_player_error(player.force, 'Undock error: Not enough resources stored in the captain\'s cabin.')
end
Public.retreat_from_island(manual)
end
end
@ -537,16 +514,18 @@ function Public.go_from_currentdestination_to_sea()
Boats.teleport_boat(boat, seaname, new_boatposition, CoreData.static_boat_floor, 'water')
if memory.overworldx == 0 and memory.boat then
if Common.difficulty() >= 1 then
if Common.difficulty() >= 1 and Common.difficulty() < 2 then
Boats.upgrade_chests(boat, 'iron-chest')
Hold.upgrade_chests(1, 'iron-chest')
Crowsnest.upgrade_chests('iron-chest')
Common.parrot_speak(memory.force, 'The harbor upgraded our ship\'s chests, due to our choice of difficulty.')
-- elseif Common.difficulty() > 1 then
-- Boats.upgrade_chests(boat, 'steel-chest')
-- Hold.upgrade_chests(1, 'steel-chest')
-- Crowsnest.upgrade_chests('steel-chest')
elseif Common.difficulty() >= 2 then
Boats.upgrade_chests(boat, 'steel-chest')
Hold.upgrade_chests(1, 'steel-chest')
Crowsnest.upgrade_chests('steel-chest')
Common.parrot_speak(memory.force, 'The harbor upgraded our ship\'s chests, due to our choice of difficulty.')
end
end

View File

@ -329,7 +329,7 @@ Public.resourcecount_quest_data_raw = {
{1.2, 0, 1, false, 'transport-belt', 1600},
{1, 0, 1, false, 'repair-pack', 350},
-- {0.1, 0, 1, false, 'red-wire', 500},
{0.5, 0, 1, false, 'empty-barrel', 600},
{0.5, 0, 1, false, 'empty-barrel', 200},
{0.3, 0, 0.2, false, 'underground-belt', 200},
{0.3, 0, 0.2, false, 'splitter', 150},
{0.4, 0.2, 1, false, 'fast-splitter', 60},

View File

@ -143,9 +143,7 @@ function Public.assign_class(player_index, class, self_assigned)
if Utils.contains(memory.spare_classes, class) then -- verify that one is spare
if memory.classes_table[player_index] then
Public.try_renounce_class(player)
end
Public.try_renounce_class(player, false)
memory.classes_table[player_index] = class
@ -169,7 +167,7 @@ function Public.assign_class(player_index, class, self_assigned)
end
end
function Public.try_renounce_class(player, override_message)
function Public.try_renounce_class(player, whisper_failure_message, override_message)
local memory = Memory.get_crew_memory()
local force = memory.force
@ -186,7 +184,7 @@ function Public.try_renounce_class(player, override_message)
memory.spare_classes[#memory.spare_classes + 1] = memory.classes_table[player.index]
memory.classes_table[player.index] = nil
else
elseif whisper_failure_message then
Common.notify_player_error(player, 'Class error: You don\'t have any class to give up.')
end
end
@ -248,12 +246,7 @@ local function class_on_player_used_capsule(event)
if memory.classes_table and memory.classes_table[player_index] then
local class = memory.classes_table[player_index]
if class == Public.enum.SAMURAI then
-- vanilla heal is 80HP
player.character.health = player.character.health + 130
elseif class == Public.enum.HATAMOTO then
player.character.health = player.character.health + 190
elseif class == Public.enum.GOURMET then
if class == Public.enum.GOURMET then
local tile = player.surface.get_tile(player.position)
if tile.valid then
local multiplier = 0

View File

@ -221,7 +221,7 @@ function Public.player_left_so_redestribute_roles(player)
-- end
end
Classes.try_renounce_class(player, "A %s class is now spare.")
Classes.try_renounce_class(player, false, "A %s class is now spare.")
end
@ -269,7 +269,7 @@ function Public.confirm_captain_exists(player_to_make_captain_otherwise)
if (memory.id and memory.id > 0 and memory.crewstatus and memory.crewstatus == 'adventuring') and (not (memory.playerindex_captain and game.players[memory.playerindex_captain] and Common.validate_player(game.players[memory.playerindex_captain]))) then --fixme: enum hacked
if player_to_make_captain_otherwise then
Public.make_captain(player_to_make_captain_otherwise)
game.print('Reassigning captain.')
game.print('Auto-reassigning captain.')
else
log('Error: Couldn\'t make a captain.')
end

View File

@ -94,7 +94,7 @@ Public.main_shop_data_2 = {
artillery_shell = {
tooltip = '8 cannon shells.',
what_you_get_sprite_buttons = {['item/artillery-shell'] = 8},
base_cost = {coins = 800, fuel = 10},
base_cost = {coins = 800, fuel = 30},
},
artillery_remote = {
tooltip = 'An artillery targeting remote.',
@ -254,7 +254,7 @@ function Public.main_shop_try_purchase(player, purchase_name)
for _, c in pairs(cannons) do
c.health = c.prototype.max_health
end
Common.notify_force_light(force,string.format('%s repaired the ship\'s cannons.', player.name))
Common.notify_force(force,string.format('[font=heading-1]%s repaired the cannons.[/font]', player.name))
memory.mainshop_availability_bools[purchase_name] = false
elseif purchase_name == Upgrades.enum.MORE_POWER then

View File

@ -108,7 +108,7 @@ function Public.event_on_market_item_purchased(event)
else
-- check if they have a role already - renounce it if so
if memory.classes_table and memory.classes_table[player.index] then
Classes.try_renounce_class(player)
Classes.try_renounce_class(player, false)
end
if force and force.valid then

View File

@ -8,7 +8,7 @@ Public.tile_areas = {
}
Public.width = 18
Public.height = 9
Public.spawn_point = {x = -7, y = 0}
Public.spawn_point = {x = -6, y = 0}
Public.areas_infront = {
{{0,-4},{1,5}},
}

View File

@ -163,7 +163,7 @@ function Public.create_cabin_surface()
e.destructible = false
e.minable = false
e.rotatable = false
e.operable = false
-- e.operable = false
boat.input_chests[#boat.input_chests + 1] = e
end
end

View File

@ -182,10 +182,10 @@ function Public.create_hold_surface(nth)
end
if subtype == enum.SECONDARY then
if Common.difficulty() >= 1 then
if Common.difficulty() >= 1 and Common.difficulty() < 2 then
Public.upgrade_chests(nth, 'iron-chest')
-- elseif Common.difficulty() > 1 then
-- Public.upgrade_chests(nth, 'steel-chest')
elseif Common.difficulty() >= 2 then
Public.upgrade_chests(nth, 'steel-chest')
end
Public.nth_hold_connect_linked_belts(nth)

View File

@ -345,7 +345,7 @@ function Public.spawn_silo_setup()
-- eei.power_usage = 0
-- end
if CoreData.rocket_silo_death_causes_loss or (destination.static_params and destination.static_params.cost_to_leave and destination.static_params.cost_to_leave['launch_rocket'] and destination.static_params.cost_to_leave['launch_rocket'] == true) then
if CoreData.rocket_silo_death_causes_loss or (destination.static_params and destination.static_params.base_cost_to_undock and destination.static_params.base_cost_to_undock['launch_rocket'] and destination.static_params.base_cost_to_undock['launch_rocket'] == true) then
-- we need to know where it is
force.chart(surface, {{p_silo.x - 4, p_silo.y - 4},{p_silo.x + 4, p_silo.y + 4}})
Task.set_timeout_in_ticks(2, silo_chart_tag, {p_silo = p_silo, surface_name = destination.surface_name, crew_id = memory.id})

View File

@ -11,6 +11,7 @@ Public.terraingen_frame_width = 700
Public.terraingen_frame_height = 700
Public.static_params_default = {
starting_time_of_day = 0.45,
brightness_visual_weights = {0.8, 0.8, 0.8},
daynightcycletype = 4,
min_brightness = 0,
base_starting_treasure = 1000,

View File

@ -279,13 +279,19 @@ local function radioactive_tick()
end
destination.dynamic_data.evolution_accrued_time = destination.dynamic_data.evolution_accrued_time + extra_evo
-- faster pollute:
local pollution = 4.7 * (6 * Common.difficulty()^(1.1) * (memory.overworldx/40)^(14/10) * (Balance.crew_scale())^(0.6)) / 3600 * tickinterval * (1 + (Common.difficulty()-1)*0.2 + 0.001 * (destination.dynamic_data.timer or 0))
if not memory.floating_pollution then memory.floating_pollution = 0 end
memory.floating_pollution = memory.floating_pollution + pollution
game.pollution_statistics.on_flow('uranium-ore', pollution)
-- faster pollute:
local pollution = 0
if destination.dynamic_data.timer > 15 then
pollution = 4.7 * (6 * Common.difficulty()^(1.1) * (memory.overworldx/40)^(14/10) * (Balance.crew_scale())^(0.6)) / 3600 * tickinterval * (1 + (Common.difficulty()-1)*0.2 + 0.001 * (destination.dynamic_data.timer or 0))
end
if pollution > 0 then
memory.floating_pollution = memory.floating_pollution + pollution
game.pollution_statistics.on_flow('uranium-ore', pollution)
end
local surface = game.surfaces[destination.surface_name]
if surface and surface.valid and (not surface.freeze_daytime) and destination.dynamic_data.timer and destination.dynamic_data.timer >= CoreData.daynightcycle_types[Public.Data.static_params_default.daynightcycletype].ticksperday/60/2 then --once daytime, never go back to night

View File

@ -23,7 +23,7 @@ Public.static_params_default = {
function Public.base_ores()
return {
['copper-ore'] = 0.4,
['copper-ore'] = 0.9,
['iron-ore'] = 5.7,
['coal'] = 4,
['stone'] = 1.0,

View File

@ -23,7 +23,7 @@ Public.static_params_default = {
function Public.base_ores()
return {
['copper-ore'] = 3.7,
['copper-ore'] = 4.4,
['iron-ore'] = 4.9,
['coal'] = 4,
['stone'] = 1.2,

View File

@ -10,9 +10,9 @@ Public.display_names = {'Poisonous Fen'}
Public.terraingen_frame_width = 325
Public.terraingen_frame_height = 325
Public.static_params_default = {
starting_time_of_day = 0.4,
starting_time_of_day = 0.35,
daynightcycletype = 1,
brightness_visual_weights = {0.1, 0.1, 0.1},
brightness_visual_weights = {0, 0, 0},
default_decoratives = true,
base_starting_treasure = 1000,
base_starting_rock_material = 800,
@ -80,7 +80,6 @@ Public.noiseparams = {
normalised = true,
params = {
{wavelength = 60, amplitude = 1},
{wavelength = 10, amplitude = 0.1},
},
},
}

View File

@ -68,7 +68,7 @@ function Public.terrain(args)
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
else
if noises.forest_abs(p) > 0.15 then
local treedensity = 0.08 * Math.slopefromto(noises.forest_abs_suppressed(p), 0.3, 0.6) + 0.3 * Math.slopefromto(noises.forest_abs_suppressed(p), 0.65, 1.2)
local treedensity = 0.08 * Math.slopefromto(noises.forest_abs_suppressed(p), 0.3, 0.6) + 0.3 * Math.slopefromto(noises.forest_abs_suppressed(p), 0.65, 1.0)
if noises.forest(p) > 1.3 then
if Math.random(1,100) < treedensity*100 then args.entities[#args.entities + 1] = {name = 'tree-09-brown', position = args.p} end
else

View File

@ -13,14 +13,15 @@ Public.static_params_default = {
starting_time_of_day = 0,
daynightcycletype = 4,
min_brightness = 0.1,
brightness_visual_weights = {1, 1, 1}, --almost pitch black
default_decoratives = false,
base_starting_rock_material = 800,
}
function Public.base_ores()
return {
['copper-ore'] = 1.7,
['iron-ore'] = 2.2,
['copper-ore'] = 2.6,
['iron-ore'] = 2.8,
['coal'] = 4,
['crude-oil'] = 100,
}

View File

@ -142,16 +142,16 @@ function Public.destination_on_collide(destination)
Crowsnest.paint_around_destination(index, CoreData.overworld_loading_tile)
end
if destination and destination.static_params and destination.static_params.cost_to_leave then
if destination and destination.static_params and destination.static_params.base_cost_to_undock then
local replace = {}
for item, count in pairs(destination.static_params.cost_to_leave) do
for item, count in pairs(destination.static_params.base_cost_to_undock) do
if item == 'uranium-235' or item == 'launch_rocket' then
replace[item] = count
else
replace[item] = Math.ceil(count * Balance.cost_to_leave_multiplier())
end
end
destination.static_params.cost_to_leave = replace
destination.static_params.base_cost_to_undock = replace
end
if destination.type == Public.enum.ISLAND then
@ -160,68 +160,71 @@ function Public.destination_on_collide(destination)
if destination.subtype == Islands.enum.RADIOACTIVE then
Parrot.parrot_radioactive_tip_1()
else
local scheduled_raft_raids
-- temporarily placed this back here, as moving it to shorehit broke things:
local playercount = Common.activecrewcount()
local max_evo
if Common.difficulty() < 1 then
if memory.overworldx/40 < 20 then
max_evo = 0.9 - (20 - memory.overworldx/40) * 1/100
else
max_evo = 0.91 + (memory.overworldx/40 - 20) * 0.25/100
end
elseif Common.difficulty() == 1 then
if memory.overworldx/40 < 15 then
max_evo = 0.9 - (15 - memory.overworldx/40) * 0.5/100
else
max_evo = 0.91 + (memory.overworldx/40 - 15) * 0.25/100
end
elseif Common.difficulty() > 1 then
if memory.overworldx/40 < 12 then
max_evo = 0.9
else
max_evo = 0.91 + (memory.overworldx/40 - 12) * 0.25/100
end
end
if memory.overworldx > 200 then
scheduled_raft_raids = {}
local times = {600, 360, 215, 210, 120, 30, 10, 5}
for i = 1, #times do
local t = times[i]
if Math.random(6) == 1 and #scheduled_raft_raids < 6 then
scheduled_raft_raids[#scheduled_raft_raids + 1] = {timeinseconds = t, max_evo = max_evo}
-- scheduled_raft_raids[#scheduled_raft_raids + 1] = {timeinseconds = t, max_bonus_evolution = 0.52}
local scheduled_raft_raids
-- temporarily placed this back here, as moving it to shorehit broke things:
local playercount = Common.activecrewcount()
local max_evo
if Common.difficulty() < 1 then
if memory.overworldx/40 < 20 then
max_evo = 0.9 - (20 - memory.overworldx/40) * 1/100
else
max_evo = 0.91 + (memory.overworldx/40 - 20) * 0.25/100
end
elseif Common.difficulty() == 1 then
if memory.overworldx/40 < 15 then
max_evo = 0.9 - (15 - memory.overworldx/40) * 0.5/100
else
max_evo = 0.91 + (memory.overworldx/40 - 15) * 0.25/100
end
elseif Common.difficulty() > 1 then
if memory.overworldx/40 < 12 then
max_evo = 0.9
else
max_evo = 0.91 + (memory.overworldx/40 - 12) * 0.25/100
end
end
elseif memory.overworldx == 200 or _DEBUG then
local times
if playercount <= 2 then
times = {1, 5, 10, 15, 20}
elseif playercount <= 8 then
times = {1, 5, 10, 15, 20, 25}
elseif playercount <= 15 then
times = {1, 5, 10, 15, 20, 25, 30}
elseif playercount <= 21 then
times = {1, 5, 10, 15, 20, 25, 30, 35}
else
times = {1, 5, 10, 15, 20, 25, 30, 35, 40}
end
scheduled_raft_raids = {}
for _, t in pairs(times) do
-- scheduled_raft_raids[#scheduled_raft_raids + 1] = {timeinseconds = t, max_bonus_evolution = 0.62}
scheduled_raft_raids[#scheduled_raft_raids + 1] = {timeinseconds = t, max_evo = max_evo}
if memory.overworldx > 200 then
scheduled_raft_raids = {}
local times = {600, 360, 215, 210, 120, 30, 10, 5}
for i = 1, #times do
local t = times[i]
if Math.random(6) == 1 and #scheduled_raft_raids < 6 then
scheduled_raft_raids[#scheduled_raft_raids + 1] = {timeinseconds = t, max_evo = max_evo}
-- scheduled_raft_raids[#scheduled_raft_raids + 1] = {timeinseconds = t, max_bonus_evolution = 0.52}
end
end
elseif memory.overworldx == 200 or _DEBUG then
local times
if playercount <= 2 then
times = {1, 5, 10, 15, 20}
elseif playercount <= 8 then
times = {1, 5, 10, 15, 20, 25}
elseif playercount <= 15 then
times = {1, 5, 10, 15, 20, 25, 30}
elseif playercount <= 21 then
times = {1, 5, 10, 15, 20, 25, 30, 35}
else
times = {1, 5, 10, 15, 20, 25, 30, 35, 40}
end
scheduled_raft_raids = {}
for _, t in pairs(times) do
-- scheduled_raft_raids[#scheduled_raft_raids + 1] = {timeinseconds = t, max_bonus_evolution = 0.62}
scheduled_raft_raids[#scheduled_raft_raids + 1] = {timeinseconds = t, max_evo = max_evo}
end
end
destination.static_params.scheduled_raft_raids = scheduled_raft_raids
end
destination.static_params.scheduled_raft_raids = scheduled_raft_raids
end
if memory.overworldx == 40*5 then Parrot.parrot_boats_warning() end
if memory.overworldx == 600 then
Parrot.parrot_radioactive_tip_1()
if memory.overworldx == 40*5 then
Parrot.parrot_boats_warning()
elseif memory.overworldx == 800 then
Parrot.parrot_800_tip()
end

View File

@ -114,14 +114,14 @@ function Public.check_all_spawners_dead(tickinterval)
local destination = Common.current_destination()
local boat = memory.boat
if destination.static_params and destination.static_params.cost_to_leave and (not (destination.subtype and destination.subtype == Islands.enum.RED_DESERT)) then
if destination.static_params and destination.static_params.base_cost_to_undock and (not (destination.subtype and destination.subtype == Islands.enum.RED_DESERT)) then
if boat and boat.surface_name and boat.surface_name == destination.surface_name then
local surface = game.surfaces[destination.surface_name]
if not (surface and surface.valid) then return end
local spawnerscount = Common.spawner_count(surface)
if spawnerscount == 0 then
destination.static_params.cost_to_leave = nil
destination.static_params.base_cost_to_undock = nil
Common.notify_force(memory.force, 'All biter bases destroyed — escape cost removed.')
end
end
@ -159,7 +159,7 @@ end
function Public.ship_deplete_fuel(tickinterval)
local memory = Memory.get_crew_memory()
if memory.game_lost then return end
if not (memory.stored_fuel and memory.boat.input_chests and memory.boat.input_chests[1])then return end
if not (memory.stored_fuel and memory.boat.input_chests and memory.boat.input_chests[1]) then return end
local rate = Progression.fuel_depletion_rate()
@ -178,6 +178,11 @@ function Public.ship_deplete_fuel(tickinterval)
memory.stored_fuel = memory.stored_fuel + count + rate*tickinterval/60
if rate < 0 and memory.stored_fuel < 1000 and (not (memory.parrot_fuel_most_recent_warning and memory.parrot_fuel_most_recent_warning >= game.tick - 60*60*12)) then --12 minutes
memory.parrot_fuel_most_recent_warning = game.tick
Common.parrot_speak(memory.force, 'Fuel is low!')
end
if memory.stored_fuel < 0 then
Crew.try_lose('out of fuel')
end
@ -1158,8 +1163,11 @@ function Public.silo_update(tickinterval)
-- Eventually I want to reformulate pollution not to pull from the map directly, but to pull from pollution_statistics. Previously all the silo pollution went to the map, but this causes a lag ~1-2 minutes. So as a compromise, let's send half to floating_pollution directly, and half to the map:
memory.floating_pollution = memory.floating_pollution + pollution/2
game.surfaces[destination.surface_name].pollute(p, pollution/2)
if dynamic_data.rocketsiloenergyconsumed >= dynamic_data.rocketsiloenergyneeded and (not (silo.rocket_parts == 100)) and (dynamic_data.silocharged == false) and (not memory.game_lost) then
if memory.overworldx >= 500 and dynamic_data.rocketsiloenergyconsumed >= 0.25 * dynamic_data.rocketsiloenergyneeded and (not dynamic_data.parrot_silo_warned) then
dynamic_data.parrot_silo_warned = true
Common.parrot_speak(memory.force, 'The silo is attracting biters!')
elseif dynamic_data.rocketsiloenergyconsumed >= dynamic_data.rocketsiloenergyneeded and (not (silo.rocket_parts == 100)) and (dynamic_data.silocharged == false) and (not memory.game_lost) then
-- silo.energy = 0
silo.rocket_parts = 100
dynamic_data.silocharged = true
@ -1219,7 +1227,7 @@ function Public.LOS_tick(tickinterval)
force.chart(surface, {{p.x - BoatData.width/2 - 70, p.y - 80},{p.x - BoatData.width/2 + 70, p.y + 80}})
end
if CoreData.rocket_silo_death_causes_loss or (destination.static_params and destination.static_params.cost_to_leave and destination.static_params.cost_to_leave['launch_rocket'] and destination.static_params.cost_to_leave['launch_rocket'] == true) then
if CoreData.rocket_silo_death_causes_loss or (destination.static_params and destination.static_params.base_cost_to_undock and destination.static_params.base_cost_to_undock['launch_rocket'] and destination.static_params.base_cost_to_undock['launch_rocket'] == true) then
local silos = destination.dynamic_data.rocketsilos
if silos and silos[1] and silos[1].valid then
local p = silos[1].position

View File

@ -108,16 +108,17 @@ function Public.update_character_properties(tickinterval)
character.character_reach_distance_bonus = max_reach_bonus
end
local health_boost = 0
-- base health is 250
if memory.classes_table and memory.classes_table[player_index] then
local class = memory.classes_table[player_index]
if class == Classes.enum.SAMURAI then
health_boost = health_boost + 800
elseif class == Classes.enum.HATAMOTO then
health_boost = health_boost + 1300
end
end
local health_boost = 0 -- base health is 250
-- moved to damage resistance:
-- if memory.classes_table and memory.classes_table[player_index] then
-- local class = memory.classes_table[player_index]
-- if class == Classes.enum.SAMURAI then
-- health_boost = health_boost + 800
-- elseif class == Classes.enum.HATAMOTO then
-- health_boost = health_boost + 1300
-- end
-- end
if Common.is_captain(player) then
health_boost = health_boost + 50
end