1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-30 23:17:53 +02:00

balance, fixes for gui, and maybe a bit more

This commit is contained in:
hanakocz 2020-05-22 14:44:33 +02:00
parent 66eb2ff498
commit 7337e8a8ec
16 changed files with 298 additions and 343 deletions

View File

@ -99,6 +99,7 @@ message_quest3=Comfylatron: Ah, we need to give this machine more power and bett
message_quest5=Comfylatron: Finally found the main issue. We will need to rebuild whole processor. Exactly what I feared of. Just a few more things...
message_quest6=Comfylatron: And, I've got the last part of the CPU brain done. Now we just need to synchronize our time correctly and we are done! Bring me satellite and rocket silo.
message_game_won1=Comfylatron: Thank you all for helping me with fish delivery. It was tough ride. And now that the biters are dead, the fish will be safe here forever...
message_comfylatron_desync=Comfylatron: I got you that time! Back to work, __1__!
map_1=Terra Ferrata
map_2=Malachite Hills

View File

@ -76,6 +76,7 @@ message_danger2=Компилатрон: Battery is unstable, we need to survive
message_danger3=Голос робота: ВНИМАНИЕ! Жизненные формы обнаружены! Необходимо устранить!
message_danger4=Голос робота: Ядерные ракеты вооружены, обратный отсчет запуска включен.
message_rampup50=Comfylatron: Biters start to adapt to our presence, getting stronger every second...
message_overstay=Компилатрон: Похоже, вы оставались на предыдущей планете так долго, что у врагов на других планетах было дополнительное время для эволюции!
message_jump180=Компилатрон: Зарядка аккумулятора отключена, отсчет 180 секунд до прыжка!
message_jump60=Компилатрон: ChronoTrain почти заряжен! Хватайте все, что сможете, мы уходим через 60 секунд!
message_jump30=Компилатрон: Вам лучше поторопиться! Осталось 30 секунд!
@ -99,7 +100,7 @@ message_quest3=Компилатрон: Ах, нам нужно дать этой
message_quest5=Компилатрон: Наконец-то нашел основную проблему. Нам нужно будет восстановить весь процессор. Именно то, чего я боялся. Еще несколько вещей ...
message_quest6=Компилатрон: И это была последняя часть работы процессора. Теперь нам просто нужно правильно синхронизировать время, и все готово! Принеси мне спутник и ракетную шахту.
message_game_won1=Компилатрон: Спасибо, что помогли мне с этой доставкой. Это было очень тяжело. Я надеюсь, что теперь, когда все кусачие мертвы, рыба будет в безопасности здесь навсегда...
message_overstay=Компилатрон: Похоже, вы оставались на предыдущей планете так долго, что у врагов на других планетах было дополнительное время для эволюции!
message_comfylatron_desync=Компилатрон: I got you that time! Back to work, __1__!
map_1=Феррата Земли
map_2=Малахитовые холмы

View File

@ -1,5 +1,6 @@
local Public = {}
local Rand = require 'maps.chronosphere.random'
local Chrono_table = require 'maps.chronosphere.table'
local math_floor = math.floor
local math_min = math.min
@ -118,10 +119,12 @@ Public.Chronotrain_max_HP = 10000
Public.Chronotrain_HP_repaired_per_pack = 150
Public.Tech_price_multiplier = 0.6
Public.starting_items = {['pistol'] = 1, ['firearm-magazine'] = 32, ['grenade'] = 2, ['raw-fish'] = 4, ['wood'] = 16}
Public.starting_items = {['pistol'] = 1, ['firearm-magazine'] = 32, ['grenade'] = 4, ['raw-fish'] = 4, ['wood'] = 16}
Public.wagon_starting_items = {{name = 'firearm-magazine', count = 16},{name = 'iron-plate', count = 16},{name = 'wood', count = 16},{name = 'burner-mining-drill', count = 8}}
function Public.jumps_until_overstay_is_on(difficulty) --both overstay penalties, and evoramp
local objective = Chrono_table.get_table()
if not objective.config.overstay_penalty then return 999 end
if difficulty > 1 then return 2
elseif difficulty == 1 then return 3
else return 5
@ -170,9 +173,6 @@ function Public.player_ammo_damage_modifiers() -- bullet affects gun turrets, bu
}
return data
end
function Public.pistol_damage_multiplier(difficulty) return 2.5 end --3 will one-shot biters
function Public.coin_reward_per_second_jumped_early(seconds, difficulty)
local minutes = seconds / 60
@ -280,9 +280,9 @@ function Public.initial_cargo_boxes()
{name = "shotgun-shell", count = math_random(4, 5)},
{name = "shotgun-shell", count = math_random(4, 5)},
{name = "land-mine", count = math_random(6, 18)},
-- {name = "grenade", count = math_random(2, 3)}, --make these harder to get
-- {name = "grenade", count = math_random(2, 3)},
-- {name = "grenade", count = math_random(2, 3)},
{name = "grenade", count = math_random(2, 3)},
{name = "grenade", count = math_random(2, 3)},
{name = "grenade", count = math_random(2, 3)},
{name = "iron-gear-wheel", count = math_random(7, 15)},
{name = "iron-gear-wheel", count = math_random(7, 15)},
{name = "iron-gear-wheel", count = math_random(7, 15)},
@ -305,12 +305,87 @@ end
function Public.treasure_quantity_difficulty_scaling(difficulty) return difficulty_sloped(difficulty, 1) end
function Public.Base_ore_loot_yield(jumps)
return 13 + 2 * jumps
function Public.Base_ore_loot_yield(jumps, scrap)
if scrap then
return 5 + 1 * jumps
else
return 15 + 3 * jumps
end
end
function Public.scrap_quantity_multiplier(evolution_factor)
return 1 + 3 * evolution_factor
function Public.scrap()
local main_loot = {
["iron-plate"] = {amount = 5, chance = 400},
["iron-gear-wheel"] = {amount = 3, chance = 250},
["iron-stick"] = {amount = 2, chance = 100},
["copper-plate"] = {amount = 5, chance = 400},
["copper-cable"] = {amount = 8, chance = 150},
["electronic-circuit"] = {amount = 3, chance = 100},
["steel-plate"] = {amount = 4, chance = 100},
["pipe"] = {amount = 3, chance = 50},
["pipe-to-ground"] = {amount = 1, chance = 10},
["battery"] = {amount = 3, chance = 10},
["explosives"] = {amount = 3, chance = 5},
["advanced-circuit"] = {amount = 5, chance = 3},
["plastic-bar"] = {amount = 5, chance = 5},
["processing-unit"] = {amount = 2, chance = 1},
["used-up-uranium-fuel-cell"] = {amount = 1, chance = 4},
["uranium-fuel-cell"] = {amount = 0.3, chance = 1},
["rocket-control-unit"] = {amount = 0.3, chance = 1},
["low-density-structure"] = {amount = 0.5, chance = 2},
["heat-pipe"] = {amount = 1, chance = 1},
["engine-unit"] = {amount = 3, chance = 3},
["electric-engine-unit"] = {amount = 2, chance = 2},
["flying-robot-frame"] = {amount = 1, chance = 2},
["logistic-robot"] = {amount = 0.3, chance = 1},
["construction-robot"] = {amount = 0.3, chance = 1},
["land-mine"] = {amount = 1, chance = 1},
["rocket"] = {amount = 2, chance = 1},
["explosive-rocket"] = {amount = 2, chance = 1},
["defender-capsule"] = {amount = 2, chance = 1},
["destroyer-capsule"] = {amount = 0.3, chance = 1},
["distractor-capsule"] = {amount = 0.3, chance = 1}
}
local second_loot = {
["cannon-shell"] = {amount = 0.1, chance = 5},
["explosive-cannon-shell"] = {amount = 0.1, chance = 4},
["uranium-cannon-shell"] = {amount = 0.1, chance = 3},
["explosive-uranium-cannon-shell"] = {amount = 0.1, chance = 2},
["artillery-shell"] = {amount = 0.1, chance = 1},
["cluster-grenade"] = {amount = 0.2, chance = 20},
["firearm-magazine"] = {amount = 0.4, chance = 70},
["piercing-rounds-magazine"] = {amount = 0.2, chance = 55},
["uranium-rounds-magazine"] = {amount = 0.1, chance = 40},
["nuclear-fuel"] = {amount = 0.1, chance = 3},
["rocket-fuel"] = {amount = 0.3, chance = 8},
["grenade"] = {amount = 0.3, chance = 40},
["solid-fuel"] = {amount = 0.4, chance = 50},
["empty-barrel"] = {amount = 0.1, chance = 50},
["crude-oil-barrel"] = {amount = 0.1, chance = 70},
["lubricant-barrel"] = {amount = 0.1, chance = 40},
["petroleum-gas-barrel"] = {amount = 0.1, chance = 60},
["heavy-oil-barrel"] = {amount = 0.1, chance = 70},
["light-oil-barrel"] = {amount = 0.1, chance = 70},
["water-barrel"] = {amount = 0.1, chance = 40},
}
local scrap_raffle = {}
for k, t in pairs (main_loot) do
for x = 1, t.chance, 1 do
table.insert(scrap_raffle, {name = k, amount = t.amount})
end
end
local second_raffle = {}
for k, t in pairs (second_loot) do
for x = 1, t.chance, 1 do
table.insert(second_raffle, {name = k, amount = t.amount})
end
end
Rand.shuffle(scrap_raffle)
Rand.shuffle(second_raffle)
return {main = scrap_raffle, second = second_raffle}
end
return Public

View File

@ -89,7 +89,7 @@ function Public_chrono.restart_settings()
game.map_settings.pollution.pollution_with_max_forest_damage = 10
game.map_settings.pollution.pollution_per_tree_damage = 0.1
game.map_settings.pollution.ageing = 0.1
game.map_settings.pollution.diffusion_ratio = 0.12
game.map_settings.pollution.diffusion_ratio = 0.1
game.map_settings.pollution.enemy_attack_pollution_consumption_modifier = 5
game.map_settings.unit_group.min_group_gathering_time = 1800
game.map_settings.unit_group.max_group_gathering_time = 18000

View File

@ -460,10 +460,14 @@ local function desync(event)
frame_speed = 0.1,
vertical_speed = 0.1,
height = 0.1,
movement = {m2 - (math.random(0, m) * 0.01), m2 - (math.random(0, m) * 0.01)}
movement = {m2 - (math_random(0, m) * 0.01), m2 - (math_random(0, m) * 0.01)}
})
end
if not event or math_random(1,2) == 1 then -- 20/04/04: nerf comfylatron
local blocked = false
if not objective.comfylatron.surface.find_non_colliding_position("compilatron", objective.comfylatron.position, 0.5, 0.1) then
blocked = true
end
if not event or blocked or math_random(1,5) == 1 then
objective.comfylatron.surface.create_entity({name = "medium-explosion", position = objective.comfylatron.position})
objective.comfylatron.surface.create_entity({name = "flying-text", position = objective.comfylatron.position, text = "desync", color = {r = 150, g = 0, b = 0}})
objective.comfylatron.destroy()
@ -472,7 +476,7 @@ local function desync(event)
objective.comfylatron.surface.create_entity({name = "flying-text", position = objective.comfylatron.position, text = "desync evaded", color = {r = 0, g = 150, b = 0}})
if event.cause then
if event.cause.valid and event.cause.player then
game.print("Comfylatron: I got you that time! Back to work, " .. event.cause.player.name .. "!", {r = 200, g = 0, b = 0})
game.print({"chronosphere.message_comfylatron_desync", event.cause.player.name}, {r = 200, g = 0, b = 0})
event.cause.die("player", objective.comfylatron)
end
end
@ -603,7 +607,7 @@ local function go_to_some_location()
}
})
end
local symbols = {"!","!!","..","..."," "}
local arg1 = symbols[math_random(1, #symbols)]
local randomphrase = texts["random_travel"][math_random(1, #texts["random_travel"])]

View File

@ -29,6 +29,18 @@ local functions = {
game.players[event.player_index].print("You are not an admin!")
end
end,
["comfy_panel_overstay_penalty"] = function(event)
local objective = Chrono_table.get_table()
if game.players[event.player_index].admin then
if event.element.switch_state == "left" then
objective.config.overstay_penalty = true
else
objective.config.overstay_penalty = false
end
else
game.players[event.player_index].print("You are not an admin!")
end
end,
["comfy_panel_game_lost"] = function(event)
local objective = Chrono_table.get_table()
@ -109,6 +121,12 @@ local build_config_gui = (function (_, frame)
line_elements[#line_elements + 1] = frame.add({type = "line"})
switch_state = "right"
if objective.config.overstay_penalty then switch_state = "left" end
add_switch(frame, switch_state, "comfy_panel_overstay_penalty", "Overstay Penalty", "Disables or enables penalty for staying too long on maps.\nThat is additional evolution growth and permanent biter bonuses.")
line_elements[#line_elements + 1] = frame.add({type = "line"})
switch_state = "right"
if objective.game_lost then switch_state = "left" end
add_switch(frame, switch_state, "comfy_panel_game_lost", "Reset Run", "Marks game as lost and starts countdown for map reset (Use with caution!)")

View File

@ -11,12 +11,14 @@ local math_random = math.random
local math_floor = math.floor
local math_ceil = math.ceil
local function get_ore_amount()
local function get_ore_amount(scrap)
local objective = Chrono_table.get_table()
local amount = Balance.Base_ore_loot_yield(objective.chronojumps) * objective.planet[1].ore_richness.factor
if amount > 600 then amount = 600 end
local scaling = (game.forces.player.mining_drill_productivity_bonus - 1) / 2
local amount = Balance.Base_ore_loot_yield(objective.chronojumps, scrap) * (1 + scaling)
if not scrap then amount = amount * objective.planet[1].ore_richness.factor end
if amount > 500 then amount = 500 end
amount = math_random(math_floor(amount * 0.7), math_floor(amount * 1.3))
if amount < 1 then amount = 1 end
return amount
end
@ -38,6 +40,15 @@ local function reward_ores(amount, mined_loot, surface, player, entity)
end
end
local function flying_text(surface, position, text)
surface.create_entity({
name = "flying-text",
position = {position.x, position.y - 0.5},
text = text,
color = {r=0.98, g=0.66, b=0.22}
})
end
function Public_event.biters_chew_rocks_faster(event)
if event.entity.force.index ~= 3 then return end --Neutral Force
if not event.cause then return end
@ -130,44 +141,42 @@ function Public_event.choppy_loot(event)
if choppy_entity_yield[entity.name] then
if event.buffer then event.buffer.clear() end
if not event.player_index then return end
local amount = math_ceil(math_ceil(get_ore_amount() / 5))
local amount = math_ceil(get_ore_amount(false))
local second_item_amount = math_random(1,3)
local second_item = "wood"
local main_item = choppy_entity_yield[entity.name][math_random(1,#choppy_entity_yield[entity.name])]
entity.surface.create_entity({
name = "flying-text",
position = entity.position,
text = "+" .. amount .. " [item=" .. main_item .. "] +" .. second_item_amount .. " [item=" .. second_item .. "]",
color = {r=0.8,g=0.8,b=0.8}
})
local text = "+" .. amount .. " [item=" .. main_item .. "] +" .. second_item_amount .. " [item=" .. second_item .. "]"
local player = game.players[event.player_index]
flying_text(entity.surface, entity.position, text, {r = 0.8, g = 0.8, b = 0.8})
reward_ores(amount, main_item, entity.surface, player, player)
local inserted_count = player.insert({name = second_item, count = second_item_amount})
second_item_amount = second_item_amount - inserted_count
if second_item_amount > 0 then
entity.surface.spill_item_stack(entity.position,{name = second_item, count = second_item_amount}, true)
end
reward_ores(second_item_amount, second_item, entity.surface, player, player)
end
end
function Public_event.rocky_loot(event)
local objective = Chrono_table.get_table()
local surface = game.surfaces[objective.active_surface_index]
local player = game.players[event.player_index]
surface.spill_item_stack(player.position,{name = "raw-fish", count = math_random(1,3)},true)
local amount = math_floor(get_ore_amount())
local amount = math_ceil(get_ore_amount(false))
local rock_mining = {"iron-ore", "iron-ore", "iron-ore", "iron-ore", "copper-ore", "copper-ore", "copper-ore", "stone", "stone", "coal", "coal"}
local mined_loot = rock_mining[math_random(1,#rock_mining)]
surface.create_entity({
name = "flying-text",
position = {player.position.x, player.position.y - 0.5},
text = "+" .. amount .. " [img=item/" .. mined_loot .. "]",
color = {r=0.98, g=0.66, b=0.22}
})
reward_ores(amount, mined_loot, surface, player, player)
local text = "+" .. amount .. " [item=" .. mined_loot .. "]"
flying_text(player.surface, player.position, text, {r = 0.98, g = 0.66, b = 0.22})
reward_ores(amount, mined_loot, player.surface, player, player)
reward_ores(math_random(1,3), "raw-fish", player.surface, player, player)
end
function Public_event.scrap_loot(event)
local objective = Chrono_table.get_table()
local scrap_table = Balance.scrap()
local scrap = scrap_table.main[math_random(1, #scrap_table.main)]
local scrap2 = scrap_table.second[math_random(1, #scrap_table.second)]
local amount = math_ceil(get_ore_amount(true) * scrap.amount)
local amount2 = math_ceil(get_ore_amount(true) * scrap2.amount)
local player = game.players[event.player_index]
local text = "+" .. amount .. " [item=" .. scrap.name .. "] + " .. amount2 .. " [item=" .. scrap2.name .. "]"
flying_text(player.surface, player.position, text, {r = 0.98, g = 0.66, b = 0.22})
reward_ores(amount, scrap.name, player.surface, player, player)
reward_ores(amount2, scrap2.name, player.surface, player, player)
end
function Public_event.swamp_loot(event)
@ -189,9 +198,9 @@ function Public_event.swamp_loot(event)
["spitter-spawner"] = 10,
}
local surface = game.surfaces[objective.active_surface_index]
local amount = math_floor(get_ore_amount() / 10)
local amount = math_floor(get_ore_amount(false) / 10)
if ore_yield[event.entity.name] then
amount = math_floor((get_ore_amount() * ore_yield[event.entity.name]) / 10)
amount = math_floor((get_ore_amount(false) * ore_yield[event.entity.name]) / 10)
end
if amount > 50 then amount = 50 end
@ -263,7 +272,7 @@ end
function Public_event.flamer_nerfs()
local objective = Chrono_table.get_table()
local difficulty = Difficulty.get().difficulty_vote_value
local flame_researches = {
[1] = {name = "refined-flammables-1", bonus = 0.2},
[2] = {name = "refined-flammables-2", bonus = 0.2},
@ -304,7 +313,7 @@ function Public_event.mining_buffs(event)
end
if mining_researches[event.research.name] == nil then return end
local tech = mining_researches[event.research.name]
if tech.bonus_productivity then

View File

@ -246,11 +246,17 @@ function Public_gui.update_gui(player)
gui.label.caption = {"chronosphere.gui_1"}
gui.jump_number.caption = objective.chronojumps
gui.charger.caption = {"chronosphere.gui_2"}
if (objective.chronochargesneeded<100000) then
gui.charger_value.caption = string.format("%.2f", objective.chronocharges/1000) .. " / " .. math_floor(objective.chronochargesneeded)/1000 .. " GJ"
else
gui.charger_value.caption = string.format("%.2f", objective.chronocharges/1000000) .. " / " .. math_floor(objective.chronochargesneeded)/1000000 .. " TJ"
end
local interval = objective.chronochargesneeded
gui.progressbar.value = 1 - (objective.chronochargesneeded - objective.chronocharges) / interval
gui.charger.caption = {"chronosphere.gui_2"}
--[[
if (objective.chronochargesneeded<1000) then
gui.charger_value.caption = objective.chronocharges .. "/" .. objective.chronochargesneeded .. " MJ"
@ -265,26 +271,21 @@ function Public_gui.update_gui(player)
end
]]
if (objective.chronochargesneeded<100000) then
gui.charger_value.caption = string.format("%.2f", objective.chronocharges/1000) .. " / " .. math_floor(objective.chronochargesneeded)/1000 .. " GJ"
else
gui.charger_value.caption = string.format("%.2f", objective.chronocharges/1000000) .. " / " .. math_floor(objective.chronochargesneeded)/1000000 .. " TJ"
end
if objective.jump_countdown_start_time == -1 then
if tick % 60 == 58 then -- charge history updates
local history = objective.accumulator_energy_history
objective.accumulator_energy_history = {}
--if tick % 60 == 58 then -- charge history updates
--local history = objective.accumulator_energy_history
--objective.accumulator_energy_history = {}
local powerobserved,storedbattery,seconds_ETA = 0,0,0
if #history == 2 and history[1] and history[2] then
powerobserved = (history[2] - history[1]) / 54 * 60
storedbattery = history[2]
end
--if #history == 2 and history[1] and history[2] then
-- powerobserved = (history[2] - history[1]) / 54 * 60
-- storedbattery = history[2]
--end
seconds_ETA = ETA_seconds_until_full(powerobserved, storedbattery)
gui.timer.caption = {"chronosphere.gui_3"}
gui.timer_value.caption = math_floor(seconds_ETA / 60) .. "m" .. seconds_ETA % 60 .. "s"
gui.timer_value.style.font_color = {r = 0, g = 0.98, b = 0}
if objective.planet[1].type.id == 19 and objective.passivetimer > 31 then
local nukecase = objective.dangertimer
@ -301,10 +302,16 @@ function Public_gui.update_gui(player)
gui.timer_value2.style.font_color = {r = 0, g = 200, b = 0}
end
end
end
--end
if objective.chronojumps >= Balance.jumps_until_overstay_is_on(difficulty) then
local time_until_overstay = (objective.chronochargesneeded * 0.75 / objective.passive_chronocharge_rate - objective.passivetimer)
local time_until_evo = (objective.chronochargesneeded * 0.5 / objective.passive_chronocharge_rate - objective.passivetimer)
if time_until_evo <= seconds_ETA then
gui.timer_value.style.font_color = {r = 0.98, g = 0.5, b = 0}
end
if time_until_overstay <= seconds_ETA then
gui.timer_value.style.font_color = {r = 0.98, g = 0, b = 0}
end
local first_part = "Biters permanently evolve in: " .. math_floor(time_until_overstay/60) .. "m" .. math_floor(time_until_overstay) % 60 .. "s"
if time_until_overstay < 0 then
@ -375,7 +382,9 @@ local function upgrades_gui(player)
end
if upgrades[i].quest then upg_table.visible = false end
end
frame.add({type = "button", name = "close_upgrades", caption = "Close"})
frame.add({type = "line", direction = "horizontal"})
local close = frame.add({type = "button", name = "close_upgrades", caption = "Close"})
close.style.horizontally_stretchable = true
return costs
end

View File

@ -247,7 +247,7 @@ function Public.chronojump(choice)
if objective.chronojumps <= 24 then
award_coins(
Balance.coin_reward_per_second_jumped_early(objective.chronochargesneeded / objective.passive_chronocharge_rate + objective.jump_countdown_length - objective.passivetimer, Difficulty.get().difficulty_vote_value)
Balance.coin_reward_per_second_jumped_early(objective.chronochargesneeded / objective.passive_chronocharge_rate + 180 - objective.passivetimer, Difficulty.get().difficulty_vote_value)
)
end
@ -315,10 +315,9 @@ end
local function check_if_overstayed()
local objective = Chrono_table.get_table()
if objective.passivetimer * objective.passive_chronocharge_rate > (objective.chronochargesneeded * 0.75) and objective.chronojumps >= Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value) then
objective.overstaycount = objective.overstaycount + 1
end
if objective.passivetimer * objective.passive_chronocharge_rate > (objective.chronochargesneeded * 0.75) and objective.chronojumps >= Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value) then
objective.overstaycount = objective.overstaycount + 1
end
end
function Public.add_chronocharge()
@ -433,7 +432,7 @@ local function tick() --only even ticks trigger
game.surfaces[objective.active_surface_index].pollute(pos, exterior_pollution)
game.pollution_statistics.on_flow("locomotive", exterior_pollution)
else
if objective.passivetimer == objective.jump_countdown_start_time + objective.jump_countdown_length then
if objective.passivetimer == objective.jump_countdown_start_time + 180 then
Public.chronojump(nil)
else
local pos = objective.locomotive.position or {x=0,y=0}
@ -502,6 +501,7 @@ local function on_init()
objective.config.offline_loot = true
objective.config.jumpfailure = true
objective.config.overstay_penalty = true
game.create_force("scrapyard")
local mgs = game.surfaces["nauvis"].map_gen_settings
mgs.width = 16
@ -569,6 +569,9 @@ local function on_player_mined_entity(event)
elseif
objective.planet[1].type.id == 11 then event.buffer.clear() -- rocky planet
end
elseif entity.name == "mineable-wreckage" then
Event_functions.scrap_loot(event)
event.buffer.clear()
end
end
@ -724,21 +727,6 @@ local function on_entity_damaged(event)
if event.entity.force.name == "enemy" then
Event_functions.biter_immunities(event)
end
if not event.cause then return end
if not event.cause.valid then return end
if event.cause.name ~= "character" then return end
if event.damage_type.name ~= "physical" then return end
local player = event.cause
if player.shooting_state.state == defines.shooting.not_shooting then return end
local weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index]
local ammo = player.get_inventory(defines.inventory.character_ammo)[player.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(difficulty) - 1), player.force, "impact", player)
end

View File

@ -27,7 +27,7 @@ local function draw_noise_ore_patch(position, name, surface, radius, richness, m
local distance_to_center = math.sqrt(x^2 + y^2)
local a = richness - richness_part * distance_to_center
if distance_to_center < radius - math.abs(noise * radius * 0.85) and a > 1 then
if mixed then
noise = simplex_noise(pos.x * 0.005, pos.y * 0.005, seed) + simplex_noise(pos.x * 0.01, pos.y * 0.01, seed) * 0.3 + simplex_noise(pos.x * 0.05, pos.y * 0.05, seed) * 0.2
local i = (math_floor(noise * 100) % 7) + 1
@ -52,7 +52,7 @@ local function draw_noise_ore_patch(position, name, surface, radius, richness, m
end
local function get_size_of_ore(ore, planet)
local base_size = math_random(5, 10) + math_floor(planet[1].ore_richness.factor * 3)
local base_size = math_random(5, 10) + math_floor(planet[1].ore_richness.factor * 4)
local final_size
if planet[1].type.id == 1 and ore == "iron-ore" then --iron planet
final_size = math_floor(base_size * 1.5)
@ -75,10 +75,10 @@ end
local function get_oil_amount(pos, oil_w, richness)
local objective = Chrono_table.get_table()
local hundred_percent = 300000
return math_ceil((hundred_percent / 100) * (4 + objective.chronojumps) * oil_w * richness / 3)
return math_ceil((hundred_percent / 50) * (3 + objective.chronojumps) * oil_w * richness)
end
local function spawn_ore_vein(surface, pos, planet)
local function spawn_ore_vein(surface, pos, planet, extrasize)
local objective = Chrono_table.get_table()
local mixed = false
if planet[1].type.id == 6 then mixed = true end --mixed planet
@ -110,9 +110,13 @@ local function spawn_ore_vein(surface, pos, planet)
--if surface.can_place_entity({name = choice, position = pos, amount = 1}) then
if choice == "crude-oil" then
surface.create_entity({name = "crude-oil", position = pos, amount = get_oil_amount(pos, oil.w, planet[1].ore_richness.factor) })
local amount = get_oil_amount(pos, oil.w, planet[1].ore_richness.factor)
if extrasize then amount = amount * 2 end
surface.create_entity({name = "crude-oil", position = pos, amount = amount})
else
draw_noise_ore_patch(pos, choice, surface, get_size_of_ore(choice, planet), richness * 0.75, mixed)
local size = get_size_of_ore(choice, planet)
if extrasize then size = size * 2 end
draw_noise_ore_patch(pos, choice, surface, size, richness * 0.75, mixed)
end
--end
end
@ -120,177 +124,19 @@ end
function Public_ores.prospect_ores(entity, surface, pos)
local objective = Chrono_table.get_table()
local planet = objective.planet
local chance = 10
local chance = 15
local extrasize = false
if entity then
if entity.name == "rock-huge" then chance = 40 end
if entity.type == "unit-spawner" then chance = 40 end
if entity.name == "rock-huge" then chance = 45 end
if entity.type == "unit-spawner" then chance = 45 end
if planet[1].type.id == 15 then chance = chance + 30 end
if math_random(chance + math_floor(10 * planet[1].ore_richness.factor) ,100 + chance) >= 100 then
spawn_ore_vein(surface, pos, planet)
if math_random(chance + math_floor(10 * planet[1].ore_richness.factor), 100 + chance) >= 100 then
spawn_ore_vein(surface, pos, planet, extrasize)
end
else
spawn_ore_vein(surface, pos, planet)
extrasize = true
spawn_ore_vein(surface, pos, planet, extrasize)
end
end
---- SCRAP ----
local scrap_yield_amounts = {
["iron-plate"] = 8,
["iron-gear-wheel"] = 4,
["iron-stick"] = 8,
["copper-plate"] = 8,
["copper-cable"] = 12,
["electronic-circuit"] = 4,
["steel-plate"] = 4,
["pipe"] = 4,
["solid-fuel"] = 4,
["empty-barrel"] = 3,
["crude-oil-barrel"] = 3,
["lubricant-barrel"] = 3,
["petroleum-gas-barrel"] = 3,
["heavy-oil-barrel"] = 3,
["light-oil-barrel"] = 3,
["water-barrel"] = 3,
["grenade"] = 3,
["battery"] = 3,
["explosives"] = 3,
["advanced-circuit"] = 3,
["nuclear-fuel"] = 0.1,
["pipe-to-ground"] = 1,
["plastic-bar"] = 3,
["processing-unit"] = 1,
["used-up-uranium-fuel-cell"] = 1,
["uranium-fuel-cell"] = 0.3,
["rocket-fuel"] = 0.3,
["rocket-control-unit"] = 0.3,
["low-density-structure"] = 0.3,
["heat-pipe"] = 1,
["green-wire"] = 8,
["red-wire"] = 8,
["engine-unit"] = 2,
["electric-engine-unit"] = 2,
["logistic-robot"] = 0.3,
["construction-robot"] = 0.3,
["land-mine"] = 1,
["rocket"] = 2,
["explosive-rocket"] = 2,
["cannon-shell"] = 2,
["explosive-cannon-shell"] = 2,
["uranium-cannon-shell"] = 2,
["explosive-uranium-cannon-shell"] = 2,
["artillery-shell"] = 0.3,
["cluster-grenade"] = 0.3,
["defender-capsule"] = 2,
["destroyer-capsule"] = 0.3,
["distractor-capsule"] = 0.3
}
local scrap_mining_chance_weights = {
{name = "iron-plate", chance = 600},
{name = "iron-gear-wheel", chance = 400},
{name = "copper-plate", chance = 400},
{name = "copper-cable", chance = 200},
{name = "electronic-circuit", chance = 150},
{name = "steel-plate", chance = 100},
{name = "pipe", chance = 75},
{name = "iron-stick", chance = 30},
{name = "solid-fuel", chance = 20},
{name = "battery", chance = 10},
{name = "crude-oil-barrel", chance = 10},
{name = "petroleum-gas-barrel", chance = 7},
{name = "heavy-oil-barrel", chance = 7},
{name = "light-oil-barrel", chance = 7},
{name = "lubricant-barrel", chance = 4},
{name = "empty-barrel", chance = 4},
{name = "water-barrel", chance = 4},
{name = "green-wire", chance = 4},
{name = "red-wire", chance = 4},
{name = "grenade", chance = 3},
{name = "pipe-to-ground", chance = 3},
{name = "explosives", chance = 3},
{name = "advanced-circuit", chance = 3},
{name = "plastic-bar", chance = 3},
{name = "engine-unit", chance = 2},
{name = "nuclear-fuel", chance = 1},
{name = "processing-unit", chance = 1},
{name = "used-up-uranium-fuel-cell", chance = 1},
{name = "uranium-fuel-cell", chance = 1},
{name = "rocket-fuel", chance = 1},
{name = "rocket-control-unit", chance = 1},
{name = "low-density-structure", chance = 1},
{name = "heat-pipe", chance = 1},
{name = "electric-engine-unit", chance = 1},
{name = "logistic-robot", chance = 1},
{name = "construction-robot", chance = 1},
{name = "land-mine", chance = 1},
{name = "rocket", chance = 1},
{name = "explosive-rocket", chance = 1},
{name = "cannon-shell", chance = 1},
{name = "explosive-cannon-shell", chance = 1},
{name = "uranium-cannon-shell", chance = 1},
{name = "explosive-uranium-cannon-shell", chance = 1},
{name = "artillery-shell", chance = 1},
{name = "cluster-grenade", chance = 1},
{name = "defender-capsule", chance = 1},
{name = "destroyer-capsule", chance = 1},
{name = "distractor-capsule", chance = 1}
}
local scrap_raffle = {}
for _, t in pairs (scrap_mining_chance_weights) do
for x = 1, t.chance, 1 do
table.insert(scrap_raffle, t.name)
end
end
local size_of_scrap_raffle = #scrap_raffle
local function on_player_mined_entity(event)
local entity = event.entity
if not entity.valid then return end
if entity.name ~= "mineable-wreckage" then return end
event.buffer.clear()
local scrap = scrap_raffle[math.random(1, size_of_scrap_raffle)]
local amount_bonus_multiplier = Balance.scrap_quantity_multiplier(game.forces.enemy.evolution_factor)
local r1 = math.ceil(scrap_yield_amounts[scrap] * 0.3 * amount_bonus_multiplier)
local r2 = math.ceil(scrap_yield_amounts[scrap] * 1.7 * amount_bonus_multiplier)
local amount = math.random(r1, r2)
local player = game.players[event.player_index]
local inserted_count = player.insert({name = scrap, count = amount})
if inserted_count ~= amount then
local amount_to_spill = amount - inserted_count
entity.surface.spill_item_stack(entity.position,{name = scrap, count = amount_to_spill}, true)
end
entity.surface.create_entity({
name = "flying-text",
position = entity.position,
text = "+" .. amount .. " [img=item/" .. scrap .. "]",
color = {r=0.98, g=0.66, b=0.22}
})
end
local Event = require 'utils.event'
Event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
return Public_ores
return Public_ores

View File

@ -9,7 +9,7 @@ local math_min = math.min
local math_abs = math.abs
local math_sqrt = math.sqrt
local level_depth = 960
local lake_noise_value = -0.9
local lake_noise_value = -0.85
local labyrinth_cell_size = 32 --valid values are 2, 4, 8, 16, 32
local Treasure = require 'maps.chronosphere.treasure'
local simplex_noise = require "utils.simplex_noise".d2
@ -159,7 +159,7 @@ local function process_dangerevent_position(p, seed, tiles, entities, treasure,
tiles[#tiles + 1] = {name = "dirt-7", position = p}
if scrapyard < -0.38 or scrapyard > 0.38 then
if math_random(1,36) == 1 then entities[#entities + 1] = {name = scrap_entities[math_random(1, scrap_entities_index)], position = p, force = "enemy"} end
if math_random(1,6) == 1 then entities[#entities + 1] = {name="mineable-wreckage", position=p} end
if math_random(1,3) == 1 then entities[#entities + 1] = {name="mineable-wreckage", position=p} end
return
end
return
@ -201,19 +201,19 @@ local function process_hedgemaze_position(p, seed, tiles, entities, treasure, pl
if math_random(1,252 - biters) == 1 and math_sqrt(p.x * p.x + p.y * p.y) > 300 then entities[#entities + 1] = {name = spawner_raffle[math_random(1, 4)], position = p} end
elseif things == "camp" then
if p.x % 32 > 12 and p.x % 32 < 20 and p.y % 32 > 12 and p.y % 32 < 20 then
if math_random(1,16) == 1 then treasure[#treasure + 1] = p end
if math_random(1,10) == 1 then treasure[#treasure + 1] = p end
elseif p.x % 32 == 11 or p.x % 32 == 12 or p.y % 32 == 11 or p.y % 32 == 12 or p.x % 32 == 21 or p.x % 32 == 20 or p.y % 32 == 21 or p.y % 32 == 20 then
if math_random(1,28) == 1 then entities[#entities + 1] = {name = "land-mine", position = p, force = "scrapyard"} end
if math_random(1,14) == 1 then entities[#entities + 1] = {name = "land-mine", position = p, force = "scrapyard"} end
end
elseif things == "crashsite" then
if math_random(1,10) == 1 then
if math_random(1,2) == 1 then
entities[#entities + 1] = {name="mineable-wreckage", position=p}
end
elseif things == "treasure" then
local roll = math_random(1,512)
local roll = math_random(1,128)
if roll <= 2 then
treasure[#treasure + 1] = p
elseif roll == 3 then
elseif roll > 2 and roll < 10 then
entities[#entities + 1] = {name = "land-mine", position = p, force = "scrapyard"}
end
end
@ -241,15 +241,15 @@ local function process_hedgemaze_position(p, seed, tiles, entities, treasure, pl
elseif things == "prospect" then
if math_random(1,252 - biters) == 1 and math_sqrt(p.x * p.x + p.y * p.y) > 300 then entities[#entities + 1] = {name = spawner_raffle[math_random(1, 4)], position = p} end
elseif things == "camp" then
if p.x % 32 > 12 and p.x % 32 < 20 and p.y % 32 > 12 and p.y % 32 < 20 and math_random(1,16) == 1 then
if p.x % 32 > 12 and p.x % 32 < 20 and p.y % 32 > 12 and p.y % 32 < 20 and math_random(1,6) == 1 then
treasure[#treasure + 1] = p
end
elseif things == "crashsite" then
if math_random(1,10) == 1 then
if math_random(1,2) == 1 then
entities[#entities + 1] = {name="mineable-wreckage", position=p}
end
elseif things == "treasure" then
if math_random(1,256) == 1 then
if math_random(1,128) == 1 then
treasure[#treasure + 1] = p
end
end
@ -518,8 +518,11 @@ local function process_scrapyard_position(p, seed, tiles, entities, treasure, pl
if math_random(1,100) > 42 then entities[#entities + 1] = {name = tree_raffle[math_random(1, s_tree_raffle)], position = p} end
end
if scrapyard < -0.28 or scrapyard > 0.28 then
if math_random(1,48) == 1 then entities[#entities + 1] = {name = scrap_entities[math_random(1, scrap_entities_index)], position = p, force = "enemy"} end
if math_random(1,3) == 1 then entities[#entities + 1] = {name="mineable-wreckage", position=p} end
if math_random(1,48) == 1 then
entities[#entities + 1] = {name = scrap_entities[math_random(1, scrap_entities_index)], position = p, force = "enemy"}
else
entities[#entities + 1] = {name="mineable-wreckage", position=p}
end
return
end
return
@ -686,9 +689,9 @@ local entity_functions = {
Treasure(surface, entity.position, entity.name)
end,
["lab"] = function(surface, entity)
local objective = Chrono_table.get_table()
local objective = Chrono_table.get_table()
local e = surface.create_entity(entity)
local evo = 1 + math_min(math_floor(objective.chronojumps / 4), 4)
local evo = 1 + math_min(math_floor(objective.chronojumps / 5), 4)
local research = {
{"automation-science-pack", "logistic-science-pack"},
{"automation-science-pack", "logistic-science-pack", "military-science-pack"},
@ -697,7 +700,7 @@ local entity_functions = {
{"automation-science-pack", "logistic-science-pack", "military-science-pack", "chemical-science-pack", "production-science-pack", "utility-science-pack"}
}
for _,science in pairs(research[evo]) do
e.insert({name = science, count = math_random(math_min(32 + objective.chronojumps, 100), math_min(64 + objective.chronojumps, 200))})
e.insert({name = science, count = math_random(math_min(30 + objective.chronojumps * 5, 100), math_min(60 + objective.chronojumps * 5, 200))})
end
end,
}
@ -892,32 +895,25 @@ local function normal_chunk(surface, left_top, level, planet)
if things == "prospect" then
Ores.prospect_ores(nil, surface, {x = left_top.x + 16, y = left_top.y + 16})
elseif things == "camp" or things == "lab" then
local positions = {
{x = left_top.x + 9, y = left_top.y + 9},{x = left_top.x + 9, y = left_top.y + 16},{x = left_top.x + 9, y = left_top.y + 23},
{x = left_top.x + 16, y = left_top.y + 9},{x = left_top.x + 16, y = left_top.y + 23},
{x = left_top.x + 23, y = left_top.y + 9},{x = left_top.x + 23, y = left_top.y + 16},{x = left_top.x + 23, y = left_top.y + 23}
}
for i = 1, 8, 1 do
entities[#entities + 1] = {name = "gun-turret", position = positions[i], force = "scrapyard"}
end
Specials.defended_position(surface, left_top, entities)
if things == "lab" then
entities[#entities + 1] = {name = "lab", position = {x = left_top.x + 15, y = left_top.y + 15}, force = "neutral"}
end
end
end
for y = 0, 31, 1 do
for x = 0, 31, 1 do
local p = {x = left_top.x + x, y = left_top.y + y}
process_level(p, seed, tiles, entities, treasure, planet, cell, things)
end
end
for x = 0, 31, 1 do
local p = {x = left_top.x + x, y = left_top.y + y}
process_level(p, seed, tiles, entities, treasure, planet, cell, things)
end
end
else
for y = 0, 31, 1 do
for x = 0, 31, 1 do
local p = {x = left_top.x + x, y = left_top.y + y}
process_level(p, seed, tiles, entities, treasure, planet)
end
end
for x = 0, 31, 1 do
local p = {x = left_top.x + x, y = left_top.y + y}
process_level(p, seed, tiles, entities, treasure, planet)
end
end
end
surface.set_tiles(tiles, true)

View File

@ -101,6 +101,15 @@ function Public_terrain.fish_market(surface, left_top)
track.minable = false
end
function Public_terrain.defended_position(surface, left_top, entities)
local positions = {
{x = left_top.x + 9, y = left_top.y + 9},{x = left_top.x + 9, y = left_top.y + 16},{x = left_top.x + 9, y = left_top.y + 23},
{x = left_top.x + 16, y = left_top.y + 9},{x = left_top.x + 16, y = left_top.y + 23},
{x = left_top.x + 23, y = left_top.y + 9},{x = left_top.x + 23, y = left_top.y + 16},{x = left_top.x + 23, y = left_top.y + 23}
}
for i = 1, 8, 1 do
entities[#entities + 1] = {name = "gun-turret", position = positions[i], force = "scrapyard"}
end
end
return Public_terrain

View File

@ -31,12 +31,12 @@ function Public_tick.realtime_events()
end
if objective.jump_countdown_start_time ~= -1 then
if objective.passivetimer == objective.jump_countdown_start_time + objective.jump_countdown_length - 60 then
if objective.passivetimer == objective.jump_countdown_start_time + 180 - 60 then
game.print({"chronosphere.message_jump60"}, {r=0.98, g=0.66, b=0.22})
elseif objective.passivetimer == objective.jump_countdown_start_time + objective.jump_countdown_length - 30 then
elseif objective.passivetimer == objective.jump_countdown_start_time + 180 - 30 then
game.print({"chronosphere.message_jump30"}, {r=0.98, g=0.66, b=0.22})
elseif objective.passivetimer >= objective.jump_countdown_start_time + objective.jump_countdown_length - 10 and objective.jump_countdown_start_time + objective.jump_countdown_length - objective.passivetimer > 0 then
game.print({"chronosphere.message_jump10", objective.jump_countdown_start_time + objective.jump_countdown_length - objective.passivetimer}, {r=0.98, g=0.66, b=0.22})
elseif objective.passivetimer >= objective.jump_countdown_start_time + 180 - 10 and objective.jump_countdown_start_time + 180 - objective.passivetimer > 0 then
game.print({"chronosphere.message_jump10", objective.jump_countdown_start_time + 180 - objective.passivetimer}, {r=0.98, g=0.66, b=0.22})
end
end
end

View File

@ -47,17 +47,17 @@ local function treasure_chest_loot(difficulty, planet)
--shotgun meta:
{10, -0.2, 0.4, true, "shotgun-shell", 12, 24},
{5, 0, 0.4, true, "shotgun", 1, 1},
{3, 0, 1.2, true, "piercing-shotgun-shell", 8, 24},
{2, 0, 1.2, true, "combat-shotgun", 1, 1},
{3, 0.4, 1.2, true, "piercing-shotgun-shell", 8, 24},
{2, 0.4, 1.2, true, "combat-shotgun", 1, 1},
--modular armor meta:
{0.7, -3, 1, true, "modular-armor", 1, 1},
{0.4, 0.3, 1, true, "power-armor", 1, 1},
{0.7, 0.25, 0.6, true, "modular-armor", 1, 1},
{0.4, 0.5, 1, true, "power-armor", 1, 1},
-- {0.5, -1,3, true, "power-armor-mk2", 1, 1},
{2, 0, 1, true, "solar-panel-equipment", 1, 2},
{2, 0, 1, true, "battery-equipment", 1, 1},
{1.6, 0, 1, true, "energy-shield-equipment", 1, 2},
{0.8, 0, 1, true, "night-vision-equipment", 1, 1},
{3, 0.1, 1, true, "solar-panel-equipment", 1, 2},
{2, 0.1, 1, true, "battery-equipment", 1, 1},
{1.6, 0.2, 1, true, "energy-shield-equipment", 1, 2},
{0.8, 0.1, 1, true, "night-vision-equipment", 1, 1},
{0.4, 0.5, 1.5, true, "personal-laser-defense-equipment", 1, 1},
--loader meta:
@ -66,13 +66,13 @@ local function treasure_chest_loot(difficulty, planet)
{math_max(1.5 * difficulty - 1.25, 0), 0.6, 1, false, "express-loader", 1, 2},
--science meta:
{8, -0.5, 0.5, true, "automation-science-pack", 4, 12},
{8, -0.6, 0.6, true, "logistic-science-pack", 4, 12},
{6, -0.1, 1, true, "military-science-pack", 8, 8}, --careful with this
{6, 0.2, 1.4, true, "chemical-science-pack", 16, 24},
{6, 0.3, 1.5, true, "production-science-pack", 16, 24},
{4, 0.4, 1.5, true, "utility-science-pack", 16, 24},
{10, 0.5, 1.5, true, "space-science-pack", 16, 24},
{8, -0.5, 0.5, true, "automation-science-pack", 4, 32},
{8, -0.6, 0.6, true, "logistic-science-pack", 4, 32},
{6, -0.1, 1, true, "military-science-pack", 8, 32},
{6, 0.2, 1.4, true, "chemical-science-pack", 16, 64},
{6, 0.3, 1.5, true, "production-science-pack", 16, 64},
{4, 0.4, 1.5, true, "utility-science-pack", 16, 64},
{10, 0.5, 1.5, true, "space-science-pack", 16, 64},
--early-game:
{3, -0.1, 0.2, false, "railgun-dart", 2, 4},
@ -80,13 +80,12 @@ local function treasure_chest_loot(difficulty, planet)
{5, -0.1, 0.1, true, "burner-inserter", 8, 20},
{1, -0.2, 0.2, true, "offshore-pump", 1, 3},
{3, -0.2, 0.2, true, "boiler", 3, 6},
{6, -0.2, 0.2, true, "lab", 1, 2},
{3, 0, 0.1, true, "lab", 1, 3},
{3, -0.2, 0.2, true, "steam-engine", 2, 4},
{3, -0.2, 0.2, true, "burner-mining-drill", 2, 4},
{2.7, 0, 0.15, false, "submachine-gun", 1, 3},
{0.3, 0, 0.15, false, "vehicle-machine-gun", 1, 1},
{2, 0, 0.1, false, "submachine-gun", 1, 2},
{3, 0, 0.3, true, "iron-chest", 8, 40},
{4, -0.3, 0.3, true, "light-armor", 1, 1},
{4, 0, 0.1, false, "light-armor", 1, 1},
{4, -0.3, 0.3, true, "inserter", 8, 16},
{8, -0.3, 0.3, true, "small-electric-pole", 16, 32},
{6, -0.4, 0.4, true, "stone-furnace", 8, 16},
@ -107,7 +106,7 @@ local function treasure_chest_loot(difficulty, planet)
{4, -0.1, 0.8, true, "fast-underground-belt", 3, 10},
{4, -0.1, 0.8, true, "fast-splitter", 1, 5},
{2, 0, 0.6, true, "storage-tank", 2, 6},
{4, 0, 0.6, true, "heavy-armor", 1, 1},
{2, 0, 0.5, true, "heavy-armor", 1, 1},
{3, 0, 0.7, true, "steel-plate", 15, 100},
{8, 0, 0.9, true, "piercing-rounds-magazine", 20, 128},
{4, 0.2, 0.6, true, "engine-unit", 16, 32},
@ -234,26 +233,26 @@ local function treasure_chest_loot(difficulty, planet)
{9, 0, 1, false, "green-wire", 10, 29},
{9, 0, 1, false, "red-wire", 10, 29},
{11, 0, 0.6, true, "modular-armor", 1, 1},
{7, -0.2,1, true, "power-armor", 1, 1},
{3, 0,2, true, "power-armor-mk2", 1, 1},
{11, 0.2, 0.6, false, "modular-armor", 1, 1},
{7, 0.4, 1, false, "power-armor", 1, 1},
{3, 0.8, 2, false, "power-armor-mk2", 1, 1},
{4, 0, 1, false, "exoskeleton-equipment", 1, 1},
{4, 0, 1, false, "belt-immunity-equipment", 1, 1},
{4, 0, 1, true, "energy-shield-equipment", 1, 2},
{4, 0, 1, false, "night-vision-equipment", 1, 1},
{4, 0, 1, false, "discharge-defense-equipment", 1, 1},
{4, 0.2, 1, false, "personal-roboport-equipment", 1, 2},
{4, 0.4, 1, false, "personal-laser-defense-equipment", 1, 1},
{8, 0, 1, false, "solar-panel-equipment", 1, 2},
{8, 0, 1, false, "battery-equipment", 1, 1},
{4, 0.5, 1, false, "exoskeleton-equipment", 1, 1},
{4, 0.2, 1, false, "belt-immunity-equipment", 1, 1},
{4, 0.3, 1, true, "energy-shield-equipment", 1, 2},
{4, 0.2, 1, false, "night-vision-equipment", 1, 1},
{4, 0.6, 1, false, "discharge-defense-equipment", 1, 1},
{4, 0.4, 1, false, "personal-roboport-equipment", 1, 2},
{4, 0.6, 1, false, "personal-laser-defense-equipment", 1, 1},
{8, 0.2, 1, false, "solar-panel-equipment", 1, 2},
{8, 0.2, 1, false, "battery-equipment", 1, 1},
{1, 0.5, 1, false, "energy-shield-mk2-equipment", 1, 1},
{1, 0.5, 1, false, "battery-mk2-equipment", 1, 1},
{1, 0.6, 1, false, "energy-shield-mk2-equipment", 1, 1},
{1, 0.6, 1, false, "battery-mk2-equipment", 1, 1},
{3, 0, 1, true, "copper-cable", 20, 400},
{3, -0.3, 0.6, true, "electronic-circuit", 50, 100},
{3, 0.2, 1.4, true, "advanced-circuit", 50, 100},
{3, 0.3, 1.4, true, "advanced-circuit", 50, 100},
{3, 0.5, 1.5, true, "processing-unit", 50, 100},
}
end
@ -287,8 +286,8 @@ function Public.treasure_chest(surface, position, container_name)
local chest_raffle = {}
local distance_to_center = (jumps / 40)
if distance_to_center > 1 then distance_to_center = 1 end
local distance = (jumps / 40)
if distance > 1 then distance = 1 end
local loot_data = treasure_chest_loot(difficulty, objective.planet[1])
local loot_types, loot_weights = {}, {}
@ -298,9 +297,9 @@ function Public.treasure_chest(surface, position, container_name)
if loot_data[i].scaling then -- scale down weights away from the midpoint 'peak' (without changing the mean)
local midpoint = (loot_data[i].d_max + loot_data[i].d_min) / 2
local difference = (loot_data[i].d_max - loot_data[i].d_min)
table.insert(loot_weights,loot_data[i].weight * math_max(0, 1 - (math_abs(distance_to_center - midpoint) / (difference / 2))))
table.insert(loot_weights,loot_data[i].weight * math_max(0, 1 - (math_abs(distance - midpoint) / (difference / 2))))
else -- no scaling
if loot_data[i].d_min <= distance_to_center and loot_data[i].d_max >= distance_to_center then
if loot_data[i].d_min <= distance and loot_data[i].d_max >= distance then
table.insert(loot_weights, loot_data[i].weight)
else
table.insert(loot_weights, 0)
@ -310,8 +309,8 @@ function Public.treasure_chest(surface, position, container_name)
local e = surface.create_entity({name = container_name, position=position, force="neutral", create_build_effect_smoke = false})
e.minable = false
local i = e.get_inventory(defines.inventory.chest)
for _ = 1, math_random(2,5), 1 do -- 20/04/04: max 5 items better than 6, so that if you observe 4 items in alt-mode the chance of an extra one is 1/2 rather than 2/3
local inv = e.get_inventory(defines.inventory.chest)
for _ = 1, math_random(2,6), 1 do
local loot = Rand.raffle(loot_types,loot_weights)
local difficulty_scaling = Balance.treasure_quantity_difficulty_scaling(difficulty)
if objective.chronojumps == 0 then difficulty_scaling = 1 end
@ -324,7 +323,7 @@ function Public.treasure_chest(surface, position, container_name)
elseif lucky <= 10 then
_count = _count * 2
end
i.insert({name = loot.name, count = _count})
inv.insert({name = loot.name, count = _count})
end
end

View File

@ -187,7 +187,7 @@ function Public.upgrades()
quest = false,
message = {"chronosphere.upgrade_mk2_message"},
tooltip = {"chronosphere.upgrade_mk2_tooltip"},
jump_limit = 24,
jump_limit = 28,
cost = {
item1 = {name = "low-density-structure", tt = "item-name", sprite = "item/low-density-structure", count = 100},
item2 = {name = "railgun-dart", tt = "item-name", sprite = "item/railgun-dart", count = 300},

View File

@ -35,7 +35,7 @@ local function on_entity_damaged(event)
if not event.entity.valid then
return
end
event.entity.damage(event.final_damage_amount * 4, player.force, 'impact', player)
event.entity.damage(event.final_damage_amount * 3, player.force, 'impact', player)
end
Event.add(defines.events.on_entity_damaged, on_entity_damaged)