diff --git a/maps/pirates/balance.lua b/maps/pirates/balance.lua index a3b8ce44..9e0bcfc2 100644 --- a/maps/pirates/balance.lua +++ b/maps/pirates/balance.lua @@ -75,18 +75,21 @@ end function Public.silo_count() local E = Public.silo_energy_needed_MJ() - return Math.ceil(E/(16.8 * 210)) --no more than this many seconds to charge it. Players can in fact go even faster using beacons + return Math.ceil(E/(16.8 * 300)) --no more than this many seconds to charge it. Players can in fact go even faster using beacons + -- return Math.ceil(E/(16.8 * 210)) --no more than this many seconds to charge it. Players can in fact go even faster using beacons end function Public.game_slowness_scale() - return 1 / Public.crew_scale()^(55/100) / Math.sloped(Common.difficulty(), 1/4) --changed crew_scale factor significantly to help smaller crews + -- return 1 / Public.crew_scale()^(55/100) / Math.sloped(Common.difficulty(), 1/4) --changed crew_scale factor significantly to help smaller crews + return 1 / Public.crew_scale()^(50/100) / Math.sloped(Common.difficulty(), 1/4) --changed crew_scale factor significantly to help smaller crews end function Public.max_time_on_island_formula() --always >0 --tuned return 60 * ( - (32 + 2.2 * (Common.overworldx()/40)^(1/3)) + -- (32 + 2.2 * (Common.overworldx()/40)^(1/3)) + (33 + 0.2 * (Common.overworldx()/40)^(1/3)) --based on observing x=2000, lets try killing the extra time ) * Public.game_slowness_scale() end @@ -159,7 +162,7 @@ function Public.boat_passive_pollution_per_minute(time) end return boost * ( - 5.2 * Common.difficulty() * (Common.overworldx()/40)^(1.6) * (Public.crew_scale())^(55/100) + 2.73 * Common.difficulty() * (Common.overworldx()/40)^(1.8) * (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 @@ -236,7 +239,10 @@ function Public.evolution_per_nest_kill() --it's important to have evo go up wit end function Public.evolution_per_full_silo_charge() - return 0.05 --too low and you always charge immediately, too high and you always charge late + --too low and you always charge immediately, too high and you always charge late + -- return 0.05 + -- observed x=2000 run, changed this to: + return 0.05 + 0.03 * Common.overworldx()/1000 end function Public.bonus_damage_to_humans() diff --git a/maps/pirates/common.lua b/maps/pirates/common.lua index 939d99d8..146d71bd 100644 --- a/maps/pirates/common.lua +++ b/maps/pirates/common.lua @@ -363,11 +363,13 @@ function Public.is_captain(player) end end +-- lifted shamelessly from biter battles, since I haven't done balancing work on this: function Public.surplus_evo_biter_damage_modifier(surplus_evo) - return Math.floor(surplus_evo/2*1000)/1000 + return Math.floor(surplus_evo/2*1000)/1000 --is this floor needed? end function Public.surplus_evo_biter_health_fractional_modifier(surplus_evo) - return Math.floor(surplus_evo*3*1000)/1000 + return surplus_evo*3 + -- return Math.floor(surplus_evo*3*1000)/1000 end function Public.set_biter_surplus_evo_modifiers() @@ -980,7 +982,7 @@ function Public.entity_positions_from_blueprint(bp_string, offset) end function Public.get_random_unit_type(evolution) - -- approximating graphs from https://wiki.factorio.com/Enemies + -- designed to approximate https://wiki.factorio.com/Enemies local r = Math.random() if Math.random(5) == 1 then @@ -1009,7 +1011,7 @@ function Public.get_random_unit_type(evolution) end function Public.get_random_biter_type(evolution) - -- approximating graphs from https://wiki.factorio.com/Enemies + -- designed to approximate https://wiki.factorio.com/Enemies local r = Math.random() if r < 1 - 1/0.4*(evolution - 0.2) then @@ -1024,7 +1026,7 @@ function Public.get_random_biter_type(evolution) end function Public.get_random_spitter_type(evolution) - -- approximating graphs from https://wiki.factorio.com/Enemies + -- designed to approximate https://wiki.factorio.com/Enemies local r = Math.random() if r < 1 - 1/0.3*(evolution - 0.4) then diff --git a/maps/pirates/coredata.lua b/maps/pirates/coredata.lua index 898b6835..678853fa 100644 --- a/maps/pirates/coredata.lua +++ b/maps/pirates/coredata.lua @@ -5,8 +5,8 @@ local _inspect = require 'utils.inspect'.inspect local Public = {} Public.scenario_id_name = 'pirates' -Public.version_string = '1.1.1.5.1' -Public.version_float = 1.1151 +Public.version_string = '1.1.1.5.2' +Public.version_float = 1.1152 Public.blueprint_library_allowed = true Public.blueprint_importing_allowed = true diff --git a/maps/pirates/crew.lua b/maps/pirates/crew.lua index 749a6b60..3176423f 100644 --- a/maps/pirates/crew.lua +++ b/maps/pirates/crew.lua @@ -667,6 +667,8 @@ function Public.initialise_crew(accepted_proposal) Memory.reset_crew_memory(new_id) Memory.set_working_id(new_id) + game.reset_time_played() -- affects the multiplayer lobby view + local memory = Memory.get_crew_memory() local secs = Server.get_current_time() @@ -886,11 +888,7 @@ function Public.reset_crew_and_enemy_force(id) crew_force.technologies['spidertron'].enabled = false crew_force.technologies['atomic-bomb'].enabled = false crew_force.technologies['explosive-rocketry'].enabled = false - crew_force.technologies['artillery-shell-range-1'].enabled = false - crew_force.technologies['artillery-shell-speed-1'].enabled = false - crew_force.technologies['worker-robots-storage-1'].enabled = false - crew_force.technologies['worker-robots-storage-2'].enabled = false - crew_force.technologies['worker-robots-storage-3'].enabled = false + crew_force.technologies['research-speed-1'].enabled = false crew_force.technologies['research-speed-2'].enabled = false crew_force.technologies['research-speed-3'].enabled = false @@ -901,18 +899,44 @@ function Public.reset_crew_and_enemy_force(id) -- crew_force.technologies['follower-robot-count-2'].enabled = false -- crew_force.technologies['follower-robot-count-3'].enabled = false -- crew_force.technologies['follower-robot-count-4'].enabled = false - crew_force.technologies['follower-robot-count-5'].enabled = false - crew_force.technologies['follower-robot-count-6'].enabled = false - crew_force.technologies['follower-robot-count-7'].enabled = false + -- crew_force.technologies['inserter-capacity-bonus-3'].enabled = false -- crew_force.technologies['inserter-capacity-bonus-4'].enabled = false -- crew_force.technologies['inserter-capacity-bonus-5'].enabled = false -- crew_force.technologies['inserter-capacity-bonus-6'].enabled = false - crew_force.technologies['inserter-capacity-bonus-7'].enabled = false -- crew_force.technologies['refined-flammables-3'].enabled = false - crew_force.technologies['refined-flammables-4'].enabled = false + -- crew_force.technologies['refined-flammables-4'].enabled = false + -- crew_force.technologies['refined-flammables-5'].enabled = false + + -- for lategame balance: + -- crew_force.technologies['worker-robots-storage-1'].enabled = false + crew_force.technologies['worker-robots-storage-2'].enabled = false + crew_force.technologies['worker-robots-storage-3'].enabled = false + crew_force.technologies['worker-robots-speed-5'].enabled = false + crew_force.technologies['worker-robots-speed-6'].enabled = false + crew_force.technologies['follower-robot-count-5'].enabled = false + crew_force.technologies['follower-robot-count-6'].enabled = false + crew_force.technologies['follower-robot-count-7'].enabled = false + crew_force.technologies['inserter-capacity-bonus-6'].enabled = false + crew_force.technologies['inserter-capacity-bonus-7'].enabled = false + + crew_force.technologies['weapon-shooting-speed-6'].enabled = false + crew_force.technologies['laser-shooting-speed-6'].enabled = false + crew_force.technologies['laser-shooting-speed-7'].enabled = false crew_force.technologies['refined-flammables-5'].enabled = false crew_force.technologies['refined-flammables-6'].enabled = false + crew_force.technologies['refined-flammables-7'].enabled = false + crew_force.technologies['energy-weapons-damage-5'].enabled = false --5 makes krakens too easy + crew_force.technologies['energy-weapons-damage-6'].enabled = false + crew_force.technologies['energy-weapons-damage-7'].enabled = false + crew_force.technologies['physical-projectile-damage-5'].enabled = false + crew_force.technologies['physical-projectile-damage-6'].enabled = false + crew_force.technologies['physical-projectile-damage-7'].enabled = false + crew_force.technologies['stronger-explosives-5'].enabled = false + crew_force.technologies['stronger-explosives-6'].enabled = false + crew_force.technologies['stronger-explosives-7'].enabled = false + crew_force.technologies['artillery-shell-range-1'].enabled = false --infinite techs + -- crew_force.technologies['artillery-shell-speed-1'].enabled = false --infinite techs crew_force.technologies['steel-axe'].enabled = false @@ -936,11 +960,6 @@ function Public.reset_crew_and_enemy_force(id) crew_force.technologies['rocket-silo'].enabled = false crew_force.technologies['space-science-pack'].enabled = false crew_force.technologies['mining-productivity-4'].enabled = false - crew_force.technologies['worker-robots-speed-6'].enabled = false - crew_force.technologies['energy-weapons-damage-7'].enabled = false - crew_force.technologies['physical-projectile-damage-7'].enabled = false - crew_force.technologies['refined-flammables-7'].enabled = false - crew_force.technologies['stronger-explosives-7'].enabled = false crew_force.technologies['logistics-3'].enabled = true crew_force.technologies['nuclear-fuel-reprocessing'].enabled = false diff --git a/maps/pirates/interface.lua b/maps/pirates/interface.lua index 784d75af..737413f9 100644 --- a/maps/pirates/interface.lua +++ b/maps/pirates/interface.lua @@ -431,6 +431,34 @@ local function maze_walls_resistance(event) end + + +local function damage_to_enemies(event) + local memory = Memory.get_crew_memory() + + if not (event.entity and event.entity.valid and event.entity.force and event.entity.force.valid) then return end + + if not string.sub(event.entity.force.name, 1, 5) == 'enemy' then return end + local evo = memory.evolution_factor + + if evo and evo > 1 and event.final_health > 0 then --lethal damage needs to be unaffected, else they never die + + local surplus = evo - 1 + + local damage_multiplier = 1/(1 + Common.surplus_evo_biter_health_fractional_modifier(surplus)) + + if damage_multiplier < 1 then + event.entity.health = event.entity.health + event.final_damage_amount * (1 - damage_multiplier) + end + end + + -- commented out as this is done elsewhere: + -- if event.damage_type.name == 'poison' then + -- event.entity.health = event.entity.health + event.final_damage_amount + -- end +end + + local function event_on_entity_damaged(event) -- figure out which crew this is about: @@ -459,39 +487,12 @@ local function event_on_entity_damaged(event) damage_dealt_by_players_changes(event) - -- if string.sub(event.entity.force.name, 1, 5) == 'enemy' then - -- -- Balance.biter_immunities(event) - -- end + damage_to_enemies(event) end --- function Public.biter_immunities(event) --- -- local memory = Memory.get_crew_memory() --- -- local planet = memory.planet[1].type.id --- -- if event.damage_type.name == 'fire' then --- -- if planet == 14 then --lava planet --- -- event.entity.health = event.entity.health + event.final_damage_amount --- -- local fire = event.entity.stickers --- -- if fire and #fire > 0 then --- -- for i = 1, #fire, 1 do --- -- if fire[i].sticked_to == event.entity and fire[i].name == 'fire-sticker' then fire[i].destroy() break end --- -- end --- -- end --- -- -- else -- other planets --- -- -- event.entity.health = Math.floor(event.entity.health + event.final_damage_amount - (event.final_damage_amount / (1 + 0.02 * memory.difficulty * memory.chronojumps))) --- -- end --- -- elseif event.damage_type.name == 'poison' then --- -- if planet == 18 then --swamp planet --- -- event.entity.health = event.entity.health + event.final_damage_amount --- -- end --- -- end --- end - - - - function Public.load_some_map_chunks(destination_index, fraction, force_load) --in a 'spear' from the left --WARNING: if force_load is true, THIS DOES NOT PLAY NICELY WITH DELAYED TASKS. log(_inspect{global_memory.working_id}) was observed to vary before and after this function. force_load = force_load or false diff --git a/maps/pirates/overworld.lua b/maps/pirates/overworld.lua index 46582e77..dce2f0a9 100644 --- a/maps/pirates/overworld.lua +++ b/maps/pirates/overworld.lua @@ -101,10 +101,10 @@ function Public.generate_destination_type_and_subtype(overworld_position) elseif macro_x == 2 then type = Surfaces.enum.ISLAND subtype = Surfaces.Island.enum.STANDARD_VARIANT --aesthetically different to first map - elseif (macro_x > 25 and (macro_x - 22) % 20 == 0) then --we want this to overwrite dock, so putting it here + elseif (macro_x > 25 and (macro_x - 22) % 20 == 0) then --we want this to overwrite dock, so putting it here. type = Surfaces.enum.ISLAND subtype = Surfaces.Island.enum.RADIOACTIVE - elseif (macro_x > 25 and (macro_x - 22) % 20 == 18) then --we want this to overwrite dock, so putting it here + elseif (macro_x > 25 and (macro_x - 22) % 20 == 18) then --we want this to overwrite dock, so putting it here. should be even so rocket launch is forced type = Surfaces.enum.ISLAND subtype = Surfaces.Island.enum.MAZE elseif macro_x == 23 then --overwrite dock. rocket launch cost @@ -239,6 +239,9 @@ function Public.generate_overworld_destination(p) ['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*100), ['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*18), ['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*10), + -- ['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*100), + -- ['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*18), + -- ['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*10), } -- if macro_p.x == 0 then -- if _DEBUG then @@ -279,7 +282,11 @@ function Public.generate_overworld_destination(p) base_cost_to_undock = Utils.deepcopy(base_cost_5) local delete = normal_costitems[Math.random(#normal_costitems)] base_cost_to_undock[delete] = nil - if macro_p.x % 2 == 0 then + if macro_p.x < 50 then + if macro_p.x % 2 == 0 then + base_cost_to_undock['launch_rocket'] = true + end + else --now we're just trying to kill you base_cost_to_undock['launch_rocket'] = true end end diff --git a/maps/pirates/tick_functions.lua b/maps/pirates/tick_functions.lua index a7f3ffa4..788a84af 100644 --- a/maps/pirates/tick_functions.lua +++ b/maps/pirates/tick_functions.lua @@ -1361,26 +1361,30 @@ function Public.silo_insta_update() if silos and silos[1] and silos[1].valid then --need the first silo to be alive in order to charge any others if dynamic_data.silocharged then for i, silo in ipairs(silos) do - silo.energy = silo.electric_buffer_size + if silo and silo.valid then --sometimes theyre overwritten by other structures e.g. market + silo.energy = silo.electric_buffer_size + end end else for i, silo in ipairs(silos) do - local e = silo.energy - 1 - local e2 = dynamic_data.rocketsiloenergyneeded - dynamic_data.rocketsiloenergyconsumed - if e > 0 and e2 > 0 then - local absorb = Math.min(e, e2) - dynamic_data.energychargedinsilosincelastcheck = dynamic_data.energychargedinsilosincelastcheck + absorb - silo.energy = silo.energy - absorb - - if dynamic_data.rocketsilochargedbools and (not dynamic_data.rocketsilochargedbools[i]) then - dynamic_data.rocketsilochargedbools[i] = true - local inv = silo.get_inventory(defines.inventory.assembling_machine_input) - inv.insert{name = 'rocket-control-unit', count = 10} - inv.insert{name = 'low-density-structure', count = 10} - inv.insert{name = 'rocket-fuel', count = 10} + if silo and silo.valid then --sometimes theyre overwritten by other structures e.g. market + local e = silo.energy - 1 + local e2 = dynamic_data.rocketsiloenergyneeded - dynamic_data.rocketsiloenergyconsumed + if e > 0 and e2 > 0 then + local absorb = Math.min(e, e2) + dynamic_data.energychargedinsilosincelastcheck = dynamic_data.energychargedinsilosincelastcheck + absorb + silo.energy = silo.energy - absorb + + if dynamic_data.rocketsilochargedbools and (not dynamic_data.rocketsilochargedbools[i]) then + dynamic_data.rocketsilochargedbools[i] = true + local inv = silo.get_inventory(defines.inventory.assembling_machine_input) + inv.insert{name = 'rocket-control-unit', count = 10} + inv.insert{name = 'low-density-structure', count = 10} + inv.insert{name = 'rocket-fuel', count = 10} + end + else + silo.energy = 0 end - else - silo.energy = 0 end end end diff --git a/maps/pirates/utils_local.lua b/maps/pirates/utils_local.lua index dc4e0546..9b38131e 100644 --- a/maps/pirates/utils_local.lua +++ b/maps/pirates/utils_local.lua @@ -270,7 +270,7 @@ function Public.time_longform(seconds) elseif seconds2 < 60 * 60 * 24 - 1 then str2 = string.format('%.0f hours, %.0f mins, %.0f seconds', Math.floor(Math.ceil(seconds2) / (60*60)), Math.floor(Math.ceil(seconds2) / 60) % 60, Math.ceil(seconds2) % 60) else - str2 = string.format('%.0fdays, %.0f hours, %.0f mins, %.0f seconds', Math.floor(Math.ceil(seconds2) / (24*60*60)), Math.floor(Math.ceil(seconds2) / (60*60)) % 24, Math.floor(Math.ceil(seconds2) / 60) % 60, Math.ceil(seconds2) % 60) + str2 = string.format('%.0f days, %.0f hours, %.0f mins, %.0f seconds', Math.floor(Math.ceil(seconds2) / (24*60*60)), Math.floor(Math.ceil(seconds2) / (60*60)) % 24, Math.floor(Math.ceil(seconds2) / 60) % 60, Math.ceil(seconds2) % 60) end return str1 .. str2 end