2022-06-01 20:50:36 +02:00
-- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/danielmartin0/ComfyFactorio-Pirates.
2021-10-13 10:21:53 +02:00
local Math = require ' maps.pirates.math '
2022-03-19 23:20:55 +02:00
-- local Memory = require 'maps.pirates.memory'
2022-10-21 19:16:42 +02:00
local Balance = require ' maps.pirates.balance '
2022-03-19 23:20:55 +02:00
-- local CoreData = require 'maps.pirates.coredata'
2021-10-13 10:21:53 +02:00
local Common = require ' maps.pirates.common '
2022-03-19 23:20:55 +02:00
local _inspect = require ' utils.inspect ' . inspect
2021-10-13 10:21:53 +02:00
local Public = { }
2022-02-28 18:36:46 +02:00
Public.buried_treasure_loot_data_raw = {
2022-03-05 21:56:41 +02:00
{ 100 , 0 , 1 , false , ' coin ' , 1 , 600 } ,
{ 50 , 0 , 1 , false , ' steel-plate ' , 100 , 150 } ,
2022-02-28 22:35:45 +02:00
{ 50 , 0 , 1 , false , ' defender-capsule ' , 5 , 18 } ,
{ 25 , 0 , 1 , false , ' distractor-capsule ' , 5 , 18 } ,
2022-03-09 01:36:03 +02:00
{ 10 , 0 , 1 , false , ' destroyer-capsule ' , 3 , 8 } ,
2022-03-13 20:19:59 +02:00
-- {20, 0, 1, false, 'flying-robot-frame', 20, 35},
2022-02-28 22:35:45 +02:00
{ 40 , 0 , 1 , false , ' construction-robot ' , 15 , 25 } ,
2022-03-13 20:19:59 +02:00
-- {100, 0, 1, false, 'electronic-circuit', 150, 250},
2022-02-28 22:35:45 +02:00
{ 70 , 0 , 1 , false , ' advanced-circuit ' , 20 , 40 } ,
{ 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 } ,
2022-03-14 14:44:30 +02:00
{ 10 , 0 , 1 , false , ' productivity-module-2 ' , 2 , 2 } , --3s are banned because of game mech
2022-02-28 22:35:45 +02:00
{ 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 } ,
{ 65 , 0 , 1 , false , ' solar-panel ' , 7 , 8 } ,
{ 20 , 0 , 1 , false , ' radar ' , 10 , 20 } ,
{ 10 , 0 , 1 , false , ' production-science-pack ' , 12 , 24 } ,
2022-03-12 00:53:36 +02:00
{ 10 , 0 , 1 , false , ' utility-science-pack ' , 4 , 4 } ,
2022-02-28 22:35:45 +02:00
{ 5 , 0 , 1 , false , ' modular-armor ' , 1 , 1 } ,
2022-11-18 22:18:16 +02:00
{ 5 , 0 , 1 , false , ' laser-turret ' , 2 , 3 } ,
2022-02-28 22:35:45 +02:00
{ 5 , 0 , 1 , false , ' cannon-shell ' , 5 , 10 } ,
{ 50 , 0 , 1 , false , ' artillery-shell ' , 4 , 8 } ,
{ 50 , 0 , 1 , false , ' express-transport-belt ' , 8 , 20 } ,
{ 35 , 0 , 1 , false , ' express-underground-belt ' , 4 , 4 } ,
{ 35 , 0 , 1 , false , ' express-splitter ' , 4 , 11 } ,
{ 50 , 0 , 1 , false , ' stack-inserter ' , 4 , 12 } ,
2022-03-04 22:31:38 +02:00
{ 0.1 , 0 , 1 , false , ' atomic-bomb ' , 1 , 1 } ,
2022-11-18 22:18:16 +02:00
{ 1 , 0 , 1 , false , ' nuclear-reactor ' , 1 , 1 } ,
2022-02-28 18:36:46 +02:00
}
2021-10-13 10:21:53 +02:00
Public.chest_loot_data_raw = {
2022-05-06 14:00:57 +02:00
{ 80 , 0 , 1 , false , ' coin ' , 400 , 700 } ,
2023-06-25 14:57:32 +02:00
{ 10 , 0 , 1 , false , ' rail-signal ' , 50 , 50 } ,
2022-03-09 01:36:03 +02:00
{ 1 , 0.2 , 1 , false , ' electric-engine-unit ' , 1 , 2 } ,
2022-03-13 20:19:59 +02:00
{ 3 , 0 , 1 , false , ' small-lamp ' , 4 , 16 } ,
2022-03-09 01:36:03 +02:00
{ 10 , 0 , 1 , false , ' coal ' , 60 , 100 } ,
{ 12 , 0 , 1 , false , ' artillery-shell ' , 1 , 1 } ,
{ 4 , 0 , 0.8 , false , ' pistol ' , 1 , 3 } ,
{ 3 , 0 , 0.2 , false , ' storage-tank ' , 2 , 4 } ,
2022-10-13 20:39:42 +02:00
{ 2 , 0.1 , 1 , false , ' explosives ' , 5 , 9 } ,
{ 2 , 0.2 , 1 , false , ' cliff-explosives ' , 2 , 4 } ,
2022-03-09 01:36:03 +02:00
{ 0.25 , 0 , 0.5 , false , ' uranium-238 ' , 5 , 8 } ,
{ 8 , 0 , 1.2 , true , ' steel-chest ' , 4 , 12 } ,
{ 2 , 0 , 0.8 , false , ' empty-barrel ' , 1 , 10 } ,
{ 5 , - 0.2 , 0.8 , true , ' iron-gear-wheel ' , 20 , 80 } ,
{ 5 , - 0.2 , 0.8 , true , ' copper-cable ' , 30 , 100 } ,
2022-03-13 20:19:59 +02:00
-- {5, -0.2, 0.8, true, 'electronic-circuit', 15, 60},
2022-03-09 01:36:03 +02:00
{ 2 , 0.3 , 1 , true , ' rocket-fuel ' , 1 , 5 } ,
{ 1 , 0.2 , 1.2 , true , ' battery ' , 10 , 30 } ,
{ 4 , 0.2 , 1.4 , true , ' advanced-circuit ' , 10 , 40 } ,
{ 8 , - 0.3 , 0.3 , true , ' small-electric-pole ' , 16 , 30 } ,
2023-02-19 15:05:34 +02:00
{ 20 , 0 , 1 , false , ' medium-electric-pole ' , 2 , 10 } ,
2022-03-09 01:36:03 +02:00
{ 3 , 0.2 , 1.4 , true , ' big-electric-pole ' , 4 , 8 } ,
{ 1 , 0.2 , 1.8 , true , ' substation ' , 1 , 3 } ,
{ 5 , 0 , 1.2 , true , ' accumulator ' , 1 , 4 } ,
{ 10 , 0 , 1 , false , ' solar-panel ' , 2 , 3 } ,
{ 15 , - 0.6 , 0.6 , true , ' transport-belt ' , 20 , 60 } ,
{ 10 , 0 , 1 , false , ' fast-transport-belt ' , 8 , 40 } ,
{ 3 , 0.2 , 1.8 , true , ' express-transport-belt ' , 5 , 12 } ,
{ 12 , - 1 , 0.5 , true , ' splitter ' , 4 , 10 } ,
{ 8 , 0 , 1 , false , ' fast-splitter ' , 2 , 5 } ,
{ 5 , 0 , 2 , true , ' express-splitter ' , 1 , 3 } ,
{ 5 , - 1 , 0.5 , true , ' underground-belt ' , 6 , 6 } ,
{ 2 , 0 , 1 , false , ' fast-underground-belt ' , 6 , 6 } ,
{ 3 , 0 , 2 , true , ' express-underground-belt ' , 4 , 4 } ,
2023-02-04 19:39:07 +02:00
{ 0.5 , 0 , 1 , false , ' loader ' , 1 , 1 } ,
{ 0.5 , 0.2 , 1 , false , ' fast-loader ' , 1 , 1 } ,
{ 0.5 , 0.7 , 1 , false , ' express-loader ' , 1 , 1 } ,
2022-03-09 01:36:03 +02:00
{ 4 , - 0.3 , 0.3 , true , ' inserter ' , 8 , 20 } ,
{ 4 , 0 , 1 , true , ' fast-inserter ' , 2 , 12 } ,
{ 3 , 0 , 1 , false , ' filter-inserter ' , 2 , 9 } ,
{ 3 , 0 , 1 , false , ' long-handed-inserter ' , 4 , 16 } ,
{ 3 , 0 , 0.5 , false , ' stack-inserter ' , 1 , 4 } ,
{ 3 , 0.5 , 1 , false , ' stack-inserter ' , 5 , 8 } ,
{ 1 , 0 , 0.5 , false , ' stack-filter-inserter ' , 1 , 4 } ,
{ 1 , 0.5 , 1 , false , ' stack-filter-inserter ' , 5 , 8 } ,
2022-03-07 11:50:25 +02:00
2022-03-09 01:36:03 +02:00
{ 40 , - 0.5 , 0.5 , true , ' firearm-magazine ' , 10 , 32 } ,
2022-03-04 19:57:58 +02:00
{ 60 , - 1 , 1 , true , ' piercing-rounds-magazine ' , 8 , 16 } ,
2022-03-09 01:36:03 +02:00
{ 10 , 0 , 1 , false , ' uranium-rounds-magazine ' , 3 , 7 } ,
2023-02-19 15:05:34 +02:00
{ 2 , - 0.3 , 0.5 , true , ' assembling-machine-1 ' , 2 , 4 } ,
{ 10 , 0 , 0.9 , false , ' assembling-machine-2 ' , 1 , 3 } ,
2022-03-09 01:36:03 +02:00
{ 2 , 0 , 1 , false , ' electric-mining-drill ' , 2 , 4 } ,
{ 3 , 0.25 , 1.75 , true , ' assembling-machine-3 ' , 2 , 4 } ,
{ 5 , 0 , 1 , true , ' steel-furnace ' , 4 , 8 } ,
{ 4 , 0 , 2 , true , ' electric-furnace ' , 1 , 3 } ,
{ 3 , 0.2 , 1 , true , ' chemical-plant ' , 1 , 3 } ,
2022-11-18 22:18:16 +02:00
{ 0.2 , 0.3 , 1 , false , ' heat-exchanger ' , 1 , 3 } ,
{ 0.1 , 0.3 , 1 , false , ' nuclear-reactor ' , 1 , 1 } ,
{ 0.2 , 0.2 , 2 , true , ' concrete ' , 10 , 40 } ,
2022-03-09 01:36:03 +02:00
2023-02-19 15:05:34 +02:00
{ 15 , - 1 , 1 , true , ' speed-module ' , 1 , 3 } ,
{ 5 , 0 , 1.5 , true , ' speed-module-2 ' , 1 , 2 } ,
{ 2 , 0 , 2 , true , ' speed-module-3 ' , 1 , 1 } ,
{ 5 , - 1 , 1 , true , ' effectivity-module ' , 1 , 3 } ,
{ 3 , 0 , 1 , true , ' effectivity-module-2 ' , 1 , 3 } ,
{ 1 , 0 , 2 , true , ' effectivity-module-3 ' , 1 , 1 } ,
2022-03-09 01:36:03 +02:00
{ 3 , 0 , 1 , false , ' productivity-module ' , 1 , 1 } , --not many of these, merely to make them availabile for future features
2021-10-13 10:21:53 +02:00
2022-11-18 22:18:16 +02:00
{ 0.2 , 0.2 , 2 , true , ' car ' , 1 , 1 } ,
{ 0.01 , 0.2 , 2 , true , ' tank ' , 1 , 1 } ,
2022-03-09 01:36:03 +02:00
{ 4 , 0 , 0.1 , false , ' light-armor ' , 1 , 1 } ,
{ 2 , 0 , 0.5 , true , ' heavy-armor ' , 1 , 1 } ,
{ 2 , 0 , 0.1 , false , ' submachine-gun ' , 1 , 1 } ,
{ 1 , 0 , 1 , false , ' gun-turret ' , 2 , 4 } ,
{ 6 , 0 , 1 , false , ' grenade ' , 2 , 12 } ,
{ 4 , 0 , 1 , false , ' stone-wall ' , 12 , 50 } ,
2022-03-04 19:57:58 +02:00
{ 2 , 0 , 2 , true , ' rocket-launcher ' , 1 , 1 } ,
2022-03-09 01:36:03 +02:00
{ 4 , 0 , 2 , true , ' rocket ' , 4 , 10 } ,
{ 5 , 0.2 , 1.8 , true , ' explosive-rocket ' , 2 , 8 } ,
{ 0.2 , 0 , 1 , false , ' poison-capsule ' , 2 , 5 } ,
{ 0.2 , 0 , 1 , false , ' slowdown-capsule ' , 2 , 5 } ,
{ 0.2 , 0 , 1 , false , ' defender-capsule ' , 2 , 4 } ,
{ 0.15 , 0 , 1 , false , ' distractor-capsule ' , 2 , 4 } ,
{ 0.1 , 0 , 1 , false , ' destroyer-capsule ' , 2 , 2 } ,
2022-03-13 20:19:59 +02:00
{ 10 , 0.2 , 1.2 , true , ' piercing-shotgun-shell ' , 6 , 9 } ,
2022-03-09 01:36:03 +02:00
{ 2 , 0.3 , 1.2 , true , ' combat-shotgun ' , 1 , 1 } ,
{ 5 , 0.2 , 1.8 , true , ' cluster-grenade ' , 8 , 16 } ,
2022-03-04 19:57:58 +02:00
2022-05-06 02:47:27 +02:00
{ 0.04 , 0.1 , 1.9 , true , ' modular-armor ' , 1 , 1 } ,
{ 0.01 , 0.4 , 1.6 , true , ' power-armor ' , 1 , 1 } ,
{ 0.001 , 0.6 , 1.4 , true , ' power-armor-mk2 ' , 1 , 1 } ,
{ 0.6 , 0.05 , 2 , true , ' solar-panel-equipment ' , 1 , 2 } ,
{ 0.4 , 0.05 , 2 , true , ' battery-equipment ' , 1 , 1 } ,
{ 0.32 , 0.05 , 2 , true , ' energy-shield-equipment ' , 1 , 2 } ,
{ 0.16 , 0.05 , 1.5 , true , ' night-vision-equipment ' , 1 , 1 } ,
{ 0.12 , 0.01 , 1.8 , true , ' personal-laser-defense-equipment ' , 1 , 1 } ,
{ 0.12 , 0.01 , 1.8 , true , ' exoskeleton-equipment ' , 1 , 1 } ,
2022-03-09 01:36:03 +02:00
{ 8 , - 0.5 , 0.5 , true , ' automation-science-pack ' , 4 , 24 } ,
{ 8 , - 0.6 , 0.6 , true , ' logistic-science-pack ' , 4 , 24 } ,
{ 6 , - 0.1 , 1 , true , ' military-science-pack ' , 8 , 20 } ,
{ 6 , - 0.5 , 1.5 , true , ' chemical-science-pack ' , 8 , 16 } ,
{ 6 , 0 , 1.5 , true , ' production-science-pack ' , 8 , 16 } ,
2022-03-12 00:53:36 +02:00
{ 6 , 0 , 2 , true , ' utility-science-pack ' , 3 , 3 } ,
2022-03-09 01:36:03 +02:00
{ 0.5 , 0.2 , 1.4 , true , ' construction-robot ' , 5 , 15 } ,
2022-03-17 03:40:18 +02:00
{ 2 , 0.5 , 1.5 , true , ' roboport ' , 1 , 1 } ,
{ 2 , 0.5 , 1.5 , false , ' logistic-chest-passive-provider ' , 2 , 2 } ,
{ 2 , 0.5 , 1.5 , false , ' logistic-robot ' , 5 , 15 } ,
2022-03-09 01:36:03 +02:00
{ 4 , 0.2 , 1.2 , true , ' lubricant-barrel ' , 1 , 4 } ,
2021-10-27 16:25:25 +02:00
2021-10-13 10:21:53 +02:00
-- copying over most of those i made for chronotrain:
--always there (or normally always there):
2022-02-28 22:35:45 +02:00
-- {4, 0, 1, false, 'gate', 14, 32}, --can beat biters with them
2022-03-09 01:36:03 +02:00
-- {1, 0, 1, false, 'radar', 1, 2}, --disabled to reduce 'avalanche of crap' effect
2022-02-28 22:35:45 +02:00
-- {0.25, 0, 1, false, 'rail', 50, 100},
-- {0.25, 0, 1, false, 'uranium-rounds-magazine', 1, 4},
2022-03-09 01:36:03 +02:00
-- {1, 0.15, 1, false, 'pump', 1, 2}, --disabled to reduce 'avalanche of crap' effect
-- {2, 0.15, 1, false, 'pumpjack', 1, 3}, --disabled to reduce 'avalanche of crap' effect
-- {0.02, 0.15, 1, false, 'oil-refinery', 1, 2}, --disabled to reduce 'avalanche of crap' effect
2021-10-13 10:21:53 +02:00
--shotgun meta:
2022-03-09 01:36:03 +02:00
-- {10, -0.2, 0.4, true, 'shotgun-shell', 12, 24}, --disabled to reduce 'avalanche of crap' effect
-- {5, 0, 0.4, true, 'shotgun', 1, 1}, --disabled to reduce 'avalanche of crap' effect
2021-10-13 10:21:53 +02:00
--modular armor meta:
-- {0.5, -1,3, true, "power-armor-mk2", 1, 1},
--loader meta:
--science meta:
2022-03-03 02:19:20 +02:00
-- {4, 0.4, 1.5, true, 'utility-science-pack', 16, 32},
2021-10-13 10:21:53 +02:00
-- {10, 0.5, 1.5, true, 'space-science-pack', 16, 32},
--early-game:
--{3, -0.1, 0.2, false, "railgun-dart", 2, 4},
-- {3, -0.1, 0.1, true, 'wooden-chest', 8, 40},
2022-03-09 01:36:03 +02:00
-- {5, -0.1, 0.1, true, 'burner-inserter', 8, 20}, --disabled to reduce 'avalanche of crap' effect
-- {1, -0.2, 0.2, true, 'offshore-pump', 1, 3}, --disabled to reduce 'avalanche of crap' effect
-- {3, -0.2, 0.2, true, 'boiler', 3, 6}, --disabled to reduce 'avalanche of crap' effect
-- {3, 0, 0.1, true, 'lab', 1, 3}, --disabled to reduce 'avalanche of crap' effect
-- {3, -0.2, 0.2, true, 'steam-engine', 2, 4}, --disabled to reduce 'avalanche of crap' effect
2021-10-13 10:21:53 +02:00
-- {3, -0.2, 0.2, true, 'burner-mining-drill', 2, 4},
2022-03-09 01:36:03 +02:00
-- {3, 0, 0.3, true, 'iron-chest', 8, 40}, --disabled to reduce 'avalanche of crap' effect
-- {6, -0.4, 0.4, true, 'stone-furnace', 8, 16}, --disabled to reduce 'avalanche of crap' effect
2021-10-13 10:21:53 +02:00
--mid-game:
--{6, 0.2, 0.5, false, "railgun-dart", 4, 8},
2022-03-09 01:36:03 +02:00
-- {5, -0.2, 0.7, true, 'pipe', 30, 50}, --disabled to reduce 'avalanche of crap' effect
-- {1, -0.2, 0.7, true, 'pipe-to-ground', 4, 8}, --disabled to reduce 'avalanche of crap' effect
-- {3, 0, 0.7, true, 'steel-plate', 15, 80},
2021-10-13 10:21:53 +02:00
-- {8, 0, 0.9, true, 'piercing-rounds-magazine', 10, 64},
-- {4, 0.2, 0.6, true, 'engine-unit', 8, 16},
--late-game:
--{9, 0.5, 0.8, false, "railgun-dart", 8, 16},
-- {5, 0, 1.2, true, 'land-mine', 16, 32},
2022-03-04 19:57:58 +02:00
-- {5, 0.4, 0.7, true, 'cannon-shell', 16, 32},
-- {5, 0.4, 0.8, true, 'explosive-cannon-shell', 16, 32},
2021-10-13 10:21:53 +02:00
-- {2, 0.25, 1.75, true, 'logistic-robot', 5, 25},
2022-02-28 18:36:46 +02:00
-- {1, 0.25, 1.75, true, 'laser-turret', 1, 1},
2021-10-13 10:21:53 +02:00
-- {4, 0.4, 1.6, true, 'processing-unit', 30, 200},
-- super late-game:
--{9, 0.8, 1.2, false, "railgun-dart", 12, 20},
-- {1, 0.9, 1.1, true, 'power-armor-mk2', 1, 1},
-- {1, 0.8, 1.2, true, 'fusion-reactor-equipment', 1, 1}
--{2, 0, 1, , "computer", 1, 1},
--{1, 0.2, 1, , "railgun", 1, 1},
--{1, 0.9, 1, , "personal-roboport-mk2-equipment", 1, 1},
}
function Public . wooden_chest_loot ( )
2022-02-27 01:33:19 +02:00
local num = 1
2021-10-13 10:21:53 +02:00
2023-02-19 22:42:07 +02:00
-- return Public.chest_loot(
-- num,
-- Math.clamp(0, 1, Math.sloped(Common.difficulty_scale(),1/2) * Common.game_completion_progress())
-- )
return Public.chest_loot (
num ,
Math.clamp ( 0 , 1 , Common.game_completion_progress ( ) )
2022-05-14 00:35:12 +02:00
)
2021-10-13 10:21:53 +02:00
end
function Public . iron_chest_loot ( )
2022-03-04 19:57:58 +02:00
local num = 2
2021-10-13 10:21:53 +02:00
2023-02-19 22:42:07 +02:00
-- local loot = Public.chest_loot(
-- num,
-- Math.clamp(0, 1, Math.sloped(Common.difficulty_scale(),1/2) * (5/100 + Common.game_completion_progress()))
-- ) --reward higher difficulties with better loot
local loot = Public.chest_loot (
num ,
Math.clamp ( 0 , 1 , 5 / 100 + Common.game_completion_progress ( ) )
)
loot [ # loot + 1 ] = { name = ' coin ' , count = Math.ceil ( 1000 * Balance.island_richness_avg_multiplier ( ) * Math.random_float_in_range ( 0.8 , 1.2 ) ) }
2021-10-13 10:21:53 +02:00
return loot
end
2023-02-19 22:42:07 +02:00
function Public . quest_structure_coin_loot ( )
return Math.ceil ( 2000 * Balance.island_richness_avg_multiplier ( ) * Math.random_float_in_range ( 0.8 , 1.2 ) )
end
2021-10-13 10:21:53 +02:00
function Public . covered_wooden_chest_loot ( )
local num = 2
2022-02-28 22:35:45 +02:00
local loot = Public.chest_loot ( num ,
2022-06-01 20:50:36 +02:00
Math.clamp ( 0 , 1 , Math.sloped ( Common.difficulty_scale ( ) , 1 / 2 ) * ( 18 / 100 + Common.game_completion_progress ( ) ) )
2022-05-14 00:35:12 +02:00
) --reward higher difficulties with better loot
2021-10-13 10:21:53 +02:00
return loot
end
2022-05-14 00:35:12 +02:00
function Public . covered_wooden_chest_loot_1 ( )
2022-05-29 13:43:31 +02:00
2022-05-14 00:35:12 +02:00
return {
2023-02-19 22:42:07 +02:00
{ name = ' iron-plate ' , count = Math.ceil ( 600 * Balance.island_richness_avg_multiplier ( ) ) } ,
{ name = ' copper-plate ' , count = Math.ceil ( 200 * Balance.island_richness_avg_multiplier ( ) ) }
2022-05-14 00:35:12 +02:00
}
end
function Public . covered_wooden_chest_loot_2 ( )
2022-05-29 13:43:31 +02:00
2023-02-19 22:42:07 +02:00
return Common.raffle_from_processed_loot_data (
Common.processed_loot_data ( Public.chest_loot_data_raw ) ,
2 ,
Math.clamp ( 0 , 1 , 0.15 + Common.game_completion_progress ( ) )
)
2022-05-14 00:35:12 +02:00
end
2021-10-13 10:21:53 +02:00
function Public . stone_furnace_loot ( )
return {
{ name = ' coal ' , count = 50 } ,
}
end
2022-06-15 23:00:18 +02:00
function Public . assembling_machine_loot ( )
-- not sure if similar table exists already, but I couldn't find any
local loot_table = {
' transport-belt ' ,
' underground-belt ' ,
' splitter ' ,
' inserter ' ,
' long-handed-inserter ' ,
' fast-inserter ' ,
' small-electric-pole ' ,
' medium-electric-pole ' ,
' pipe ' ,
' pipe-to-ground ' ,
' small-lamp ' ,
' repair-pack ' ,
' iron-stick ' ,
' iron-gear-wheel ' ,
' stone-wall ' ,
}
local index = Math.random ( # loot_table )
-- even though count is bigger than the stack size, it will automatically delete excess items
return { name = loot_table [ index ] , count = 200 }
end
2022-03-04 19:57:58 +02:00
function Public . storage_tank_fluid_loot ( force_type )
2021-10-13 10:21:53 +02:00
local ret
local rng = Math.random ( 10 )
2022-03-04 19:57:58 +02:00
if force_type == ' crude-oil ' then
2022-03-12 00:53:36 +02:00
ret = { name = ' crude-oil ' , amount = Math.random ( 3000 , 12500 ) }
2022-03-04 19:57:58 +02:00
elseif force_type == ' petroleum-gas ' then
ret = { name = ' petroleum-gas ' , amount = Math.random ( 1500 , 7500 ) }
2022-06-01 20:50:36 +02:00
elseif rng <= 6 then
2022-03-09 01:36:03 +02:00
ret = { name = ' crude-oil ' , amount = Math.random ( 1500 , 4500 ) }
2021-10-13 10:21:53 +02:00
elseif rng == 7 then
2022-03-09 01:36:03 +02:00
ret = { name = ' light-oil ' , amount = Math.random ( 1500 , 3500 ) }
2021-10-13 10:21:53 +02:00
elseif rng == 8 then
2022-03-09 01:36:03 +02:00
ret = { name = ' heavy-oil ' , amount = Math.random ( 1500 , 3500 ) }
-- elseif rng == 9 then
-- ret = {name = 'lubricant', amount = Math.random(1000, 2000)}
2021-10-13 10:21:53 +02:00
else
2022-03-09 01:36:03 +02:00
ret = { name = ' petroleum-gas ' , amount = Math.random ( 1500 , 2000 ) }
2021-10-13 10:21:53 +02:00
end
return ret
end
function Public . swamp_storage_tank_fluid_loot ( )
local ret
2022-10-21 19:16:42 +02:00
-- ret = {name = 'sulfuric-acid', amount = 100*Math.ceil(Math.random(5^2, 40^2)^(1/2))} -- don't know why this formula made best amount most common, but lowest amount least common (was this intentional?).
2023-02-19 18:57:38 +02:00
ret = { name = ' sulfuric-acid ' , amount = Math.ceil ( 2000 * Math.random_float_in_range ( 0.8 , 1.2 ) * Balance.island_richness_avg_multiplier ( ) ) }
2021-10-13 10:21:53 +02:00
return ret
end
function Public . roboport_bots_loot ( )
return {
2023-02-19 18:57:38 +02:00
{ name = ' logistic-robot ' , count = Math.ceil ( ( 15 + Math.random ( 5 ) ) * Balance.island_richness_avg_multiplier ( ) ) } ,
{ name = ' construction-robot ' , count = Math.ceil ( ( 10 + Math.random ( 5 ) ) * Balance.island_richness_avg_multiplier ( ) ) } ,
2021-10-13 10:21:53 +02:00
}
end
2022-03-04 19:57:58 +02:00
function Public . random_plates ( multiplier )
multiplier = multiplier or 1
2023-02-19 15:05:34 +02:00
multiplier = multiplier * Balance.island_richness_avg_multiplier ( )
multiplier = multiplier * Math.random_float_in_range ( 0.9 , 1.1 )
2022-02-24 21:39:03 +02:00
local platesrng = Math.random ( 5 )
2023-02-19 15:05:34 +02:00
2022-02-24 21:39:03 +02:00
if platesrng <= 2 then
2023-02-19 18:57:38 +02:00
return { name = ' iron-plate ' , count = Math.ceil ( 80 * multiplier ) }
2022-02-24 21:39:03 +02:00
elseif platesrng <= 4 then
2023-02-19 18:57:38 +02:00
return { name = ' copper-plate ' , count = Math.ceil ( 80 * multiplier ) }
2022-02-24 21:39:03 +02:00
else
2023-02-19 18:57:38 +02:00
return { name = ' steel-plate ' , count = Math.ceil ( 12 * multiplier ) }
2022-02-24 21:39:03 +02:00
end
2022-03-04 19:57:58 +02:00
end
function Public . chest_loot ( number_of_items , game_completion_progress )
local ret = Common.raffle_from_processed_loot_data ( Common.processed_loot_data ( Public.chest_loot_data_raw ) , number_of_items , game_completion_progress )
ret [ # ret + 1 ] = ret [ 1 ]
ret [ 1 ] = Public.random_plates ( )
2022-02-24 21:39:03 +02:00
2021-10-13 10:21:53 +02:00
return ret
end
2022-02-28 18:36:46 +02:00
function Public . buried_treasure_loot ( )
2023-01-09 22:22:37 +02:00
local ret = Common.raffle_from_processed_loot_data ( Common.processed_loot_data ( Public.buried_treasure_loot_data_raw ) , 1 , Math.clamp ( 0 , 1 , Math.sloped ( Common.difficulty_scale ( ) , 1 / 2 ) * Common.game_completion_progress_capped ( ) ) )
2022-02-28 18:36:46 +02:00
if ret and ret [ 1 ] then return ret [ 1 ] end
end
2022-03-04 19:57:58 +02:00
function Public . maze_camp_loot ( )
2022-03-05 21:56:41 +02:00
if Math.random ( 10 ) <= 7 then
2022-03-04 19:57:58 +02:00
return { Public.random_plates ( ) }
else
2022-06-01 20:50:36 +02:00
return Common.raffle_from_processed_loot_data ( Common.processed_loot_data ( Public.chest_loot_data_raw ) , 1 , Math.clamp ( 0 , 1 , Math.sloped ( Common.difficulty_scale ( ) , 1 / 2 ) * ( 15 / 100 + Common.game_completion_progress ( ) ) ) )
2022-03-04 19:57:58 +02:00
end
end
2022-10-04 20:43:11 +02:00
Public.lab_loot_data_raw = {
2022-03-13 03:44:32 +02:00
{ 8 , - 0.5 , 0.5 , true , ' automation-science-pack ' , 5 , 20 } ,
{ 8 , - 0.6 , 0.6 , true , ' logistic-science-pack ' , 5 , 20 } ,
{ 6 , - 0.1 , 1 , true , ' military-science-pack ' , 5 , 18 } ,
{ 6 , - 0.5 , 1.5 , true , ' chemical-science-pack ' , 4 , 12 } ,
{ 6 , 0 , 1.5 , true , ' production-science-pack ' , 3 , 11 } ,
{ 2 , 0 , 2 , true , ' utility-science-pack ' , 2 , 3 } ,
2022-03-04 19:57:58 +02:00
-- {4, 0.4, 1.5, true, 'utility-science-pack', 16, 32},
-- {10, 0.5, 1.5, true, 'space-science-pack', 16, 32},
}
2022-10-04 20:43:11 +02:00
function Public . lab_loot ( )
return Common.raffle_from_processed_loot_data ( Common.processed_loot_data ( Public.lab_loot_data_raw ) , 1 , Math.clamp ( 0 , 1 , Math.sloped ( Common.difficulty_scale ( ) , 1 / 2 ) * ( Common.game_completion_progress ( ) ) ) )
2022-03-04 19:57:58 +02:00
end
Public.maze_treasure_data_raw = {
{ 2 , - 1 , 1 , true , ' rocket ' , 18 , 24 } ,
2022-03-14 14:44:30 +02:00
{ 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 } ,
2022-03-04 19:57:58 +02:00
{ 2 , 0 , 1 , false , ' uranium-rounds-magazine ' , 15 , 25 } ,
{ 2 , 0 , 1 , false , ' artillery-shell ' , 5 , 7 } ,
2023-06-25 14:57:32 +02:00
{ 2 , 0 , 1 , false , ' rail-signal ' , 250 , 250 } ,
2022-03-04 19:57:58 +02:00
{ 2 , 0 , 1 , false , ' electric-engine-unit ' , 3 , 4 } ,
{ 2 , 0 , 1 , false , ' cluster-grenade ' , 8 , 12 } ,
2022-03-13 20:19:59 +02:00
{ 0.5 , 0 , 1 , false , ' nuclear-fuel ' , 1 , 1 } ,
2022-03-04 19:57:58 +02:00
{ 1 , 0 , 0.8 , false , ' speed-module-3 ' , 2 , 2 } ,
{ 1 , 0 , 0.8 , false , ' effectivity-module-3 ' , 3 , 3 } ,
2022-03-14 14:44:30 +02:00
{ 0.5 , 0 , 1 , false , ' productivity-module-2 ' , 2 , 2 } , --3s are banned because of game mech
2022-03-04 19:57:58 +02:00
{ 2 , 0 , 1.5 , true , ' production-science-pack ' , 20 , 25 } ,
2022-03-12 00:53:36 +02:00
{ 2 , 0 , 2 , true , ' utility-science-pack ' , 7 , 8 } ,
2022-05-06 14:00:57 +02:00
-- {2, 0, 1.5, true, 'coin', 4000, 6500},
2022-03-07 11:50:25 +02:00
{ 3 , 0 , 0.9 , false , ' beacon ' , 1 , 1 } ,
2022-03-04 19:57:58 +02:00
2022-03-17 03:40:18 +02:00
{ 1 , 0 , 1 , false , ' construction-robot ' , 30 , 40 } ,
{ 3 , 0 , 1 , false , ' logistic-chest-passive-provider ' , 2 , 2 } ,
2022-03-12 00:53:36 +02:00
2022-03-04 19:57:58 +02:00
{ 1 , 0.2 , 1.8 , true , ' explosive-rocket ' , 6 , 8 } ,
{ 1 , 0 , 0.9 , false , ' express-transport-belt ' , 20 , 60 } ,
2022-03-09 01:36:03 +02:00
{ 0.5 , 0 , 0.9 , false , ' express-underground-belt ' , 6 , 6 } ,
2022-03-04 19:57:58 +02:00
{ 0.5 , 0 , 0.9 , false , ' express-splitter ' , 10 , 10 } ,
{ 1 , 0 , 0.9 , false , ' express-loader ' , 2 , 2 } ,
{ 0.5 , 0 , 0.5 , false , ' substation ' , 2 , 2 } ,
{ 0.5 , 0 , 0.8 , false , ' assembling-machine-3 ' , 3 , 3 } ,
{ 1 , 0 , 0.7 , false , ' electric-furnace ' , 4 , 6 } ,
{ 1 , 0 , 0.8 , false , ' modular-armor ' , 1 , 1 } ,
{ 1 , 0 , 2 , true , ' power-armor ' , 1 , 1 } ,
2022-03-08 00:00:14 +02:00
{ 0.1 , 0 , 2 , true , ' power-armor-mk2 ' , 1 , 1 } ,
2022-03-04 19:57:58 +02:00
2022-05-06 02:47:27 +02:00
{ 4 , - 1 , 1 , true , ' solar-panel-equipment ' , 3 , 4 } ,
{ 4 , - 1 , 1 , true , ' battery-equipment ' , 1 , 1 } ,
{ 2 , 0 , 2 , true , ' battery-mk2-equipment ' , 1 , 1 } ,
{ 4 , - 1 , 1 , true , ' energy-shield-equipment ' , 1 , 2 } ,
{ 2 , 0 , 2 , true , ' energy-shield-mk2-equipment ' , 1 , 1 } ,
{ 2 , - 1 , 1 , true , ' personal-roboport-equipment ' , 1 , 1 } ,
{ 1 , 0 , 2 , true , ' personal-roboport-mk2-equipment ' , 1 , 1 } ,
{ 1 , 0 , 0.8 , false , ' night-vision-equipment ' , 1 , 1 } ,
{ 2 , 0 , 1 , false , ' personal-laser-defense-equipment ' , 1 , 1 } ,
{ 1 , 0 , 1 , false , ' fusion-reactor-equipment ' , 1 , 1 } ,
{ 4 , 0 , 1 , false , ' exoskeleton-equipment ' , 1 , 1 } ,
2022-03-04 19:57:58 +02:00
{ 2 , - 0.7 , 1.3 , true , ' advanced-circuit ' , 40 , 90 } ,
2022-03-09 01:36:03 +02:00
2022-03-04 19:57:58 +02:00
{ 2 , 0 , 0.5 , false , ' laser-turret ' , 1 , 2 } ,
{ 2 , 0.6 , 1 , false , ' laser-turret ' , 4 , 5 } ,
{ 1 , 0 , 0.5 , false , ' roboport ' , 1 , 1 } ,
2022-03-04 22:31:38 +02:00
{ 1 , 0 , 1 , false , ' atomic-bomb ' , 1 , 1 } ,
2022-03-04 19:57:58 +02:00
}
function Public . maze_treasure_loot ( )
2022-03-05 02:11:11 +02:00
if Math.random ( 5 ) == 1 then
return { Public.random_plates ( 8 ) }
else
2022-06-01 20:50:36 +02:00
return Common.raffle_from_processed_loot_data ( Common.processed_loot_data ( Public.maze_treasure_data_raw ) , 1 , Math.clamp ( 0 , 1 , Math.sloped ( Common.difficulty_scale ( ) , 1 / 2 ) * ( Common.game_completion_progress ( ) ) ) )
2022-03-05 02:11:11 +02:00
end
2022-03-04 19:57:58 +02:00
end
2022-03-06 03:05:26 +02:00
Public.dredger_loot_raw = {
2022-07-16 20:46:23 +02:00
{ 8 , 0 , 1 , false , ' iron-plate ' , 5 , 80 } ,
{ 8 , 0 , 1 , false , ' copper-plate ' , 5 , 80 } ,
{ 8 , 0 , 1 , false , ' coal ' , 5 , 50 } ,
{ 10 , 0 , 1 , false , ' coin ' , 10 , 100 } ,
{ 2 , 0 , 1 , false , ' small-electric-pole ' , 2 , 10 } ,
{ 1 , 0 , 1 , false , ' medium-electric-pole ' , 1 , 5 } ,
{ 0.1 , 0 , 1 , false , ' big-electric-pole ' , 1 , 3 } ,
{ 0.2 , 0 , 1 , false , ' poison-capsule ' , 1 , 4 } ,
{ 0.2 , 0 , 1 , false , ' slowdown-capsule ' , 1 , 4 } ,
{ 0.1 , 0 , 1 , false , ' destroyer-capsule ' , 1 , 3 } ,
{ 0.2 , 0 , 1 , false , ' defender-capsule ' , 1 , 4 } ,
{ 0.2 , 0 , 1 , false , ' distractor-capsule ' , 1 , 3 } ,
{ 0.05 , 0 , 1 , false , ' speed-module-3 ' , 1 , 2 } ,
{ 0.05 , 0 , 1 , false , ' effectivity-module-3 ' , 1 , 2 } ,
{ 0.05 , 0 , 1 , false , ' productivity-module-2 ' , 1 , 2 } , --3s are banned because of game mech
{ 0.1 , 0 , 1 , false , ' rocket ' , 1 , 3 } ,
{ 0.01 , 0 , 1 , false , ' explosive-rocket ' , 1 , 2 } ,
{ 4 , 0 , 1 , false , ' automation-science-pack ' , 4 , 15 } ,
{ 4 , 0 , 1 , false , ' logistic-science-pack ' , 4 , 15 } ,
{ 2 , 0 , 1 , false , ' military-science-pack ' , 2 , 10 } ,
{ 1 , 0 , 1 , false , ' chemical-science-pack ' , 2 , 8 } ,
{ 1 , 0 , 1 , false , ' production-science-pack ' , 1 , 5 } ,
{ 0.5 , 0 , 1 , false , ' utility-science-pack ' , 1 , 4 } ,
2022-03-08 00:00:14 +02:00
2022-03-09 01:36:03 +02:00
{ 0.012 , 0 , 0.8 , false , ' night-vision-equipment ' , 1 , 1 } ,
{ 0.01 , 0 , 1 , false , ' exoskeleton-equipment ' , 1 , 1 } ,
{ 0.01 , - 1 , 1 , true , ' energy-shield-equipment ' , 1 , 1 } ,
{ 0.01 , - 1 , 1 , true , ' solar-panel-equipment ' , 1 , 1 } ,
{ 0.01 , - 1 , 1 , true , ' battery-equipment ' , 1 , 1 } ,
{ 0.008 , 0 , 2 , true , ' battery-mk2-equipment ' , 1 , 1 } ,
{ 0.008 , 0 , 1 , false , ' personal-laser-defense-equipment ' , 1 , 1 } ,
{ 0.008 , 0 , 2 , true , ' energy-shield-mk2-equipment ' , 1 , 1 } ,
{ 0.008 , - 1 , 1 , true , ' personal-roboport-equipment ' , 1 , 1 } ,
{ 0.004 , 0 , 1 , false , ' fusion-reactor-equipment ' , 1 , 1 } ,
{ 0.004 , 0 , 2 , true , ' personal-roboport-mk2-equipment ' , 1 , 1 } ,
2022-03-06 03:05:26 +02:00
}
function Public . dredger_loot ( )
2022-06-01 20:50:36 +02:00
return Common.raffle_from_processed_loot_data ( Common.processed_loot_data ( Public.dredger_loot_raw ) , 1 , Math.clamp ( 0 , 1 , Common.game_completion_progress ( ) ) )
2022-03-06 03:05:26 +02:00
end
2021-10-13 10:21:53 +02:00
return Public