You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2026-06-20 16:32:28 +02:00
Merge pull request #173 from ComfyFactory/fixes_and_tweaks
Various bug fixes and minor tweak to mining drills bonus
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ pool_reward=[color=blue]Global Pool Reward:[/color]\n __1__ received nothing. Re
|
|||||||
|
|
||||||
[rpg_gui]
|
[rpg_gui]
|
||||||
gain_info_tooltip=XP gain from mining, moving, crafting, repairing and combat.
|
gain_info_tooltip=XP gain from mining, moving, crafting, repairing and combat.
|
||||||
allocate_info=Right-click to allocate __1__ points.\nShift + click to allocate all points.
|
allocate_info=Right-click to allocate __1__ points.\nShift + left-click to allocate all points\nShift + right-click to allocate half your points.
|
||||||
player_name=Hello __1__!
|
player_name=Hello __1__!
|
||||||
class_info=You're a __1__.
|
class_info=You're a __1__.
|
||||||
settings_frame=Configure your RPG player-settings here!
|
settings_frame=Configure your RPG player-settings here!
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ local function get_coin_count(entity)
|
|||||||
if not biter_health_boost_units[unit_number][3] then
|
if not biter_health_boost_units[unit_number][3] then
|
||||||
return coin_count
|
return coin_count
|
||||||
end
|
end
|
||||||
|
if not biter_health_boost_units[unit_number][3].healthbar_id then -- only bosses
|
||||||
|
return coin_count
|
||||||
|
end
|
||||||
local m = 1 / biter_health_boost_units[unit_number][2]
|
local m = 1 / biter_health_boost_units[unit_number][2]
|
||||||
coin_count = floor(coin_count * m)
|
coin_count = floor(coin_count * m)
|
||||||
if coin_count < 1 then
|
if coin_count < 1 then
|
||||||
|
|||||||
@@ -1123,7 +1123,6 @@ function Public.boost_difficulty()
|
|||||||
WPT.set('bonus_xp_on_join', 500)
|
WPT.set('bonus_xp_on_join', 500)
|
||||||
WD.set('next_wave', game.tick + 3600 * 15)
|
WD.set('next_wave', game.tick + 3600 * 15)
|
||||||
WPT.set('spidertron_unlocked_at_zone', 10)
|
WPT.set('spidertron_unlocked_at_zone', 10)
|
||||||
WD.set_biter_health_boost(1.50)
|
|
||||||
unit_modifiers.limit_value = 30
|
unit_modifiers.limit_value = 30
|
||||||
unit_modifiers.health_increase_per_boss_wave = 0.04
|
unit_modifiers.health_increase_per_boss_wave = 0.04
|
||||||
WPT.set('difficulty_set', true)
|
WPT.set('difficulty_set', true)
|
||||||
@@ -1141,7 +1140,6 @@ function Public.boost_difficulty()
|
|||||||
WPT.set('spidertron_unlocked_at_zone', 8)
|
WPT.set('spidertron_unlocked_at_zone', 8)
|
||||||
unit_modifiers.limit_value = 40
|
unit_modifiers.limit_value = 40
|
||||||
unit_modifiers.health_increase_per_boss_wave = 0.06
|
unit_modifiers.health_increase_per_boss_wave = 0.06
|
||||||
WD.set_biter_health_boost(2)
|
|
||||||
WPT.set('difficulty_set', true)
|
WPT.set('difficulty_set', true)
|
||||||
elseif name == 'Ultra-violence' then
|
elseif name == 'Ultra-violence' then
|
||||||
force.character_running_speed_modifier = 0
|
force.character_running_speed_modifier = 0
|
||||||
@@ -1156,7 +1154,6 @@ function Public.boost_difficulty()
|
|||||||
WPT.set('spidertron_unlocked_at_zone', 6)
|
WPT.set('spidertron_unlocked_at_zone', 6)
|
||||||
unit_modifiers.limit_value = 50
|
unit_modifiers.limit_value = 50
|
||||||
unit_modifiers.health_increase_per_boss_wave = 0.08
|
unit_modifiers.health_increase_per_boss_wave = 0.08
|
||||||
WD.set_biter_health_boost(4)
|
|
||||||
WPT.set('difficulty_set', true)
|
WPT.set('difficulty_set', true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1469,7 +1466,7 @@ function Public.on_research_finished(event)
|
|||||||
local player = game.forces.player
|
local player = game.forces.player
|
||||||
|
|
||||||
research.force.character_inventory_slots_bonus = player.mining_drill_productivity_bonus * 50 -- +5 Slots /
|
research.force.character_inventory_slots_bonus = player.mining_drill_productivity_bonus * 50 -- +5 Slots /
|
||||||
bonus_drill.mining_drill_productivity_bonus = bonus_drill.mining_drill_productivity_bonus + 0.1
|
bonus_drill.mining_drill_productivity_bonus = bonus_drill.mining_drill_productivity_bonus + 0.03
|
||||||
if bonus_drill.mining_drill_productivity_bonus >= 3 then
|
if bonus_drill.mining_drill_productivity_bonus >= 3 then
|
||||||
bonus_drill.mining_drill_productivity_bonus = 3
|
bonus_drill.mining_drill_productivity_bonus = 3
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ local function do_place_entities(data)
|
|||||||
if entity then
|
if entity then
|
||||||
if e.note then
|
if e.note then
|
||||||
local modified_unit_health = WD.get('modified_unit_health')
|
local modified_unit_health = WD.get('modified_unit_health')
|
||||||
BiterHealthBooster.add_unit(entity, modified_unit_health.current_value)
|
BiterHealthBooster.add_unit(entity, modified_unit_health.current_value + 1)
|
||||||
end
|
end
|
||||||
wintery(entity)
|
wintery(entity)
|
||||||
if e.direction then
|
if e.direction then
|
||||||
@@ -379,7 +379,7 @@ local function do_place_entities(data)
|
|||||||
if entity then
|
if entity then
|
||||||
if e.note then
|
if e.note then
|
||||||
local modified_unit_health = WD.get('modified_unit_health')
|
local modified_unit_health = WD.get('modified_unit_health')
|
||||||
BiterHealthBooster.add_unit(entity, modified_unit_health.current_value)
|
BiterHealthBooster.add_unit(entity, modified_unit_health.current_value + 1)
|
||||||
end
|
end
|
||||||
wintery(entity)
|
wintery(entity)
|
||||||
if e.direction then
|
if e.direction then
|
||||||
|
|||||||
@@ -1342,9 +1342,13 @@ local function create_market(data, rebuild)
|
|||||||
this.market = surface.create_entity {name = 'market', position = center_position, force = 'player'}
|
this.market = surface.create_entity {name = 'market', position = center_position, force = 'player'}
|
||||||
|
|
||||||
if this.mystical_chest_enabled then
|
if this.mystical_chest_enabled then
|
||||||
|
if this.mystical_chest and this.mystical_chest.entity then
|
||||||
|
this.mystical_chest.entity.destroy()
|
||||||
|
this.mystical_chest.entity = nil
|
||||||
|
end
|
||||||
|
|
||||||
this.mystical_chest = {
|
this.mystical_chest = {
|
||||||
entity = surface.create_entity {name = 'logistic-chest-requester', position = {x = center_position.x, y = center_position.y + 2}, force = 'neutral'},
|
entity = surface.create_entity {name = 'logistic-chest-requester', position = {x = center_position.x, y = center_position.y + 2}, force = 'neutral'}
|
||||||
price = false
|
|
||||||
}
|
}
|
||||||
this.mystical_chest.entity.minable = false
|
this.mystical_chest.entity.minable = false
|
||||||
this.mystical_chest.entity.destructible = false
|
this.mystical_chest.entity.destructible = false
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ local init_bonus_drill_force = function()
|
|||||||
end
|
end
|
||||||
bonus_drill.set_friend('player', true)
|
bonus_drill.set_friend('player', true)
|
||||||
player.set_friend('bonus_drill', true)
|
player.set_friend('bonus_drill', true)
|
||||||
bonus_drill.mining_drill_productivity_bonus = 1
|
bonus_drill.mining_drill_productivity_bonus = 0.5
|
||||||
end
|
end
|
||||||
|
|
||||||
local is_position_near_tbl = function(position, tbl)
|
local is_position_near_tbl = function(position, tbl)
|
||||||
@@ -274,7 +274,7 @@ function Public.reset_map()
|
|||||||
WD.alert_boss_wave(true)
|
WD.alert_boss_wave(true)
|
||||||
WD.clear_corpses(false)
|
WD.clear_corpses(false)
|
||||||
WD.remove_entities(true)
|
WD.remove_entities(true)
|
||||||
WD.enable_threat_log(true)
|
WD.enable_threat_log(false) -- creates waaaay to many entries in the global table
|
||||||
WD.check_collapse_position(true)
|
WD.check_collapse_position(true)
|
||||||
WD.set_disable_threat_below_zero(true)
|
WD.set_disable_threat_below_zero(true)
|
||||||
WD.increase_boss_health_per_wave(true)
|
WD.increase_boss_health_per_wave(true)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
-- modified by gerkiz
|
-- modified by gerkiz
|
||||||
|
|
||||||
local Global = require 'utils.global'
|
local Global = require 'utils.global'
|
||||||
|
local SpamProtection = require 'utils.spam_protection'
|
||||||
local Event = require 'utils.event'
|
local Event = require 'utils.event'
|
||||||
local BottomFrame = require 'comfy_panel.bottom_frame'
|
local BottomFrame = require 'comfy_panel.bottom_frame'
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
@@ -289,7 +290,6 @@ local function insert_to_furnace(player_inventory, chests, name, count, floaty_t
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function insert_into_wagon(stack, chests, name, floaty_text_list)
|
local function insert_into_wagon(stack, chests, name, floaty_text_list)
|
||||||
|
|
||||||
-- Attempt to load filtered cargo wagon
|
-- Attempt to load filtered cargo wagon
|
||||||
for chestnr, chest in pairs(chests.chest) do
|
for chestnr, chest in pairs(chests.chest) do
|
||||||
if chest.type == 'cargo-wagon' then
|
if chest.type == 'cargo-wagon' then
|
||||||
@@ -307,7 +307,6 @@ local function insert_into_wagon(stack, chests, name, floaty_text_list)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function insert_into_wagon_filtered(stack, chests, name, floaty_text_list)
|
local function insert_into_wagon_filtered(stack, chests, name, floaty_text_list)
|
||||||
|
|
||||||
-- Attempt to load filtered cargo wagon
|
-- Attempt to load filtered cargo wagon
|
||||||
for chestnr, chest in pairs(chests.chest) do
|
for chestnr, chest in pairs(chests.chest) do
|
||||||
if chest.type == 'cargo-wagon' then
|
if chest.type == 'cargo-wagon' then
|
||||||
@@ -552,7 +551,8 @@ local function create_gui_button(player)
|
|||||||
tooltip =
|
tooltip =
|
||||||
'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.\nSHIFT+LMB: Everything onto filtered slots to wagon.\nSHIFT+RMB: Only ores to wagon'
|
'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.\nSHIFT+LMB: Everything onto filtered slots to wagon.\nSHIFT+RMB: Only ores to wagon'
|
||||||
else
|
else
|
||||||
tooltip = 'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.'
|
tooltip =
|
||||||
|
'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.'
|
||||||
end
|
end
|
||||||
if this.bottom_button then
|
if this.bottom_button then
|
||||||
local data = BottomFrame.get('bottom_quickbar_button')
|
local data = BottomFrame.get('bottom_quickbar_button')
|
||||||
@@ -634,6 +634,10 @@ local function on_gui_click(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if event.element.name == name then
|
if event.element.name == name then
|
||||||
|
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash Click')
|
||||||
|
if is_spamming then
|
||||||
|
return
|
||||||
|
end
|
||||||
auto_stash(player, event)
|
auto_stash(player, event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+31
-12
@@ -86,17 +86,36 @@ local function on_gui_click(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if shift then
|
if shift then
|
||||||
local count = rpg_t.points_left
|
if event.button == defines.mouse_button_type.left then
|
||||||
if not count then
|
local count = rpg_t.points_left
|
||||||
return
|
if not count then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
rpg_t.points_left = 0
|
||||||
|
rpg_t[index] = rpg_t[index] + count
|
||||||
|
if not rpg_t.reset then
|
||||||
|
rpg_t.total = rpg_t.total + count
|
||||||
|
end
|
||||||
|
Public.toggle(player, true)
|
||||||
|
Public.update_player_stats(player)
|
||||||
|
elseif event.button == defines.mouse_button_type.right then
|
||||||
|
local left = rpg_t.points_left / 2
|
||||||
|
if left > 2 then
|
||||||
|
for _ = 1, left, 1 do
|
||||||
|
if rpg_t.points_left <= 0 then
|
||||||
|
Public.toggle(player, true)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
rpg_t.points_left = rpg_t.points_left - 1
|
||||||
|
rpg_t[index] = rpg_t[index] + 1
|
||||||
|
if not rpg_t.reset then
|
||||||
|
rpg_t.total = rpg_t.total + 1
|
||||||
|
end
|
||||||
|
Public.update_player_stats(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Public.toggle(player, true)
|
||||||
end
|
end
|
||||||
rpg_t.points_left = 0
|
|
||||||
rpg_t[index] = rpg_t[index] + count
|
|
||||||
if not rpg_t.reset then
|
|
||||||
rpg_t.total = rpg_t.total + count
|
|
||||||
end
|
|
||||||
Public.toggle(player, true)
|
|
||||||
Public.update_player_stats(player)
|
|
||||||
elseif event.button == defines.mouse_button_type.right then
|
elseif event.button == defines.mouse_button_type.right then
|
||||||
for _ = 1, points_per_level, 1 do
|
for _ = 1, points_per_level, 1 do
|
||||||
if rpg_t.points_left <= 0 then
|
if rpg_t.points_left <= 0 then
|
||||||
@@ -590,8 +609,8 @@ local function one_punch(character, target, damage, get_health_pool)
|
|||||||
if max_unit_health <= 0 then
|
if max_unit_health <= 0 then
|
||||||
max_unit_health = 4
|
max_unit_health = 4
|
||||||
end
|
end
|
||||||
if max_unit_health >= 15 then
|
if max_unit_health >= 10 then
|
||||||
max_unit_health = 15
|
max_unit_health = 10
|
||||||
end
|
end
|
||||||
local final = floor(damage * max_unit_health)
|
local final = floor(damage * max_unit_health)
|
||||||
character.surface.create_entity(
|
character.surface.create_entity(
|
||||||
|
|||||||
@@ -86,7 +86,12 @@ local function find_initial_spot(surface, position)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if math_random(1, 2) == 1 then
|
if math_random(1, 2) == 1 then
|
||||||
local random_pos = {{x = pos.x - 10, y = pos.y - 5}, {x = pos.x + 10, y = pos.y + 5}, {x = pos.x - 10, y = pos.y + 5}, {x = pos.x + 10, y = pos.y - 5}}
|
local random_pos = {
|
||||||
|
{x = pos.x - 10, y = pos.y - 5},
|
||||||
|
{x = pos.x + 10, y = pos.y + 5},
|
||||||
|
{x = pos.x - 10, y = pos.y + 5},
|
||||||
|
{x = pos.x + 10, y = pos.y - 5}
|
||||||
|
}
|
||||||
local actual_pos = shuffle(random_pos)
|
local actual_pos = shuffle(random_pos)
|
||||||
pos = {x = actual_pos[1].x, y = actual_pos[1].y}
|
pos = {x = actual_pos[1].x, y = actual_pos[1].y}
|
||||||
end
|
end
|
||||||
@@ -261,6 +266,7 @@ local function is_unit_valid(biter)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function refresh_active_unit_threat()
|
local function refresh_active_unit_threat()
|
||||||
|
local unit_group_pos = Public.get('unit_group_pos')
|
||||||
local active_biter_threat = Public.get('active_biter_threat')
|
local active_biter_threat = Public.get('active_biter_threat')
|
||||||
local active_biters = Public.get('active_biters')
|
local active_biters = Public.get('active_biters')
|
||||||
debug_print('refresh_active_unit_threat - current value ' .. active_biter_threat)
|
debug_print('refresh_active_unit_threat - current value ' .. active_biter_threat)
|
||||||
@@ -275,6 +281,10 @@ local function refresh_active_unit_threat()
|
|||||||
local biter_health_boost = BiterHealthBooster.get('biter_health_boost')
|
local biter_health_boost = BiterHealthBooster.get('biter_health_boost')
|
||||||
Public.set('active_biter_threat', math_round(biter_threat * biter_health_boost, 2))
|
Public.set('active_biter_threat', math_round(biter_threat * biter_health_boost, 2))
|
||||||
debug_print('refresh_active_unit_threat - new value ' .. active_biter_threat)
|
debug_print('refresh_active_unit_threat - new value ' .. active_biter_threat)
|
||||||
|
if unit_group_pos.index > 500 then
|
||||||
|
unit_group_pos.positions = {}
|
||||||
|
unit_group_pos.index = 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function time_out_biters()
|
local function time_out_biters()
|
||||||
@@ -327,7 +337,11 @@ local function get_random_close_spawner()
|
|||||||
end
|
end
|
||||||
goto retry
|
goto retry
|
||||||
end
|
end
|
||||||
if not spawner or (center.x - spawner_2.position.x) ^ 2 + (center.y - spawner_2.position.y) ^ 2 < (center.x - spawner.position.x) ^ 2 + (center.y - spawner.position.y) ^ 2 then
|
if
|
||||||
|
not spawner or
|
||||||
|
(center.x - spawner_2.position.x) ^ 2 + (center.y - spawner_2.position.y) ^ 2 <
|
||||||
|
(center.x - spawner.position.x) ^ 2 + (center.y - spawner.position.y) ^ 2
|
||||||
|
then
|
||||||
spawner = spawner_2
|
spawner = spawner_2
|
||||||
if spawner and spawner.position then
|
if spawner and spawner.position then
|
||||||
debug_print('get_random_close_spawner - Found at x' .. spawner.position.x .. ' y' .. spawner.position.y)
|
debug_print('get_random_close_spawner - Found at x' .. spawner.position.x .. ' y' .. spawner.position.y)
|
||||||
@@ -379,7 +393,9 @@ local function set_main_target()
|
|||||||
end
|
end
|
||||||
|
|
||||||
Public.set('target', sec_target)
|
Public.set('target', sec_target)
|
||||||
debug_print('set_main_target -- New main target ' .. sec_target.name .. ' at position x' .. sec_target.position.x .. ' y' .. sec_target.position.y .. ' selected.')
|
debug_print(
|
||||||
|
'set_main_target -- New main target ' .. sec_target.name .. ' at position x' .. sec_target.position.x .. ' y' .. sec_target.position.y .. ' selected.'
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_group_spawn_position(surface)
|
local function set_group_spawn_position(surface)
|
||||||
@@ -398,27 +414,25 @@ end
|
|||||||
|
|
||||||
local function set_enemy_evolution()
|
local function set_enemy_evolution()
|
||||||
local wave_number = Public.get('wave_number')
|
local wave_number = Public.get('wave_number')
|
||||||
local biter_health_boost = Public.get('biter_health_boost')
|
local active_biters = Public.get('active_biters')
|
||||||
local threat = Public.get('threat')
|
local threat = Public.get('threat')
|
||||||
local evolution_factor = wave_number * 0.001
|
local evolution_factor = wave_number * 0.001
|
||||||
local biter_h_boost = 1
|
|
||||||
local enemy = game.forces.enemy
|
local enemy = game.forces.enemy
|
||||||
|
local biter_health_boost = 1
|
||||||
|
|
||||||
if evolution_factor > 1 then
|
if evolution_factor > 1 then
|
||||||
evolution_factor = 1
|
evolution_factor = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if biter_health_boost then
|
if not next(active_biters) then
|
||||||
biter_h_boost = math_round(biter_health_boost + (threat - 5000) * 0.000044, 3)
|
Public.set('active_biter_count', 0)
|
||||||
else
|
|
||||||
biter_h_boost = math_round(biter_h_boost + (threat - 5000) * 0.000044, 3)
|
|
||||||
end
|
|
||||||
if biter_h_boost <= 1 then
|
|
||||||
biter_h_boost = 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
BiterHealthBooster.set('biter_health_boost', biter_h_boost)
|
if threat > 50000 then
|
||||||
Public.set('biter_health_boost', biter_h_boost)
|
biter_health_boost = math_round(biter_health_boost + (threat - 50000) * 0.000033, 3)
|
||||||
|
end
|
||||||
|
|
||||||
|
BiterHealthBooster.set('biter_health_boost', biter_health_boost)
|
||||||
|
|
||||||
if enemy.evolution_factor == 1 and evolution_factor == 1 then
|
if enemy.evolution_factor == 1 and evolution_factor == 1 then
|
||||||
return
|
return
|
||||||
@@ -455,6 +469,7 @@ end
|
|||||||
|
|
||||||
local function get_active_unit_groups_count()
|
local function get_active_unit_groups_count()
|
||||||
local unit_groups = Public.get('unit_groups')
|
local unit_groups = Public.get('unit_groups')
|
||||||
|
local unit_group_pos = Public.get('unit_group_pos')
|
||||||
local count = 0
|
local count = 0
|
||||||
|
|
||||||
for k, g in pairs(unit_groups) do
|
for k, g in pairs(unit_groups) do
|
||||||
@@ -469,17 +484,13 @@ local function get_active_unit_groups_count()
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
unit_groups[k] = nil
|
unit_groups[k] = nil
|
||||||
|
unit_group_pos.positions[k] = nil
|
||||||
local unit_groups_size = Public.get('unit_groups_size')
|
local unit_groups_size = Public.get('unit_groups_size')
|
||||||
Public.set('unit_groups_size', unit_groups_size - 1)
|
Public.set('unit_groups_size', unit_groups_size - 1)
|
||||||
local unit_group_last_command = Public.get('unit_group_last_command')
|
local unit_group_last_command = Public.get('unit_group_last_command')
|
||||||
if unit_group_last_command[k] then
|
if unit_group_last_command[k] then
|
||||||
unit_group_last_command[k] = nil
|
unit_group_last_command[k] = nil
|
||||||
end
|
end
|
||||||
local unit_group_pos = Public.get('unit_group_pos')
|
|
||||||
local positions = unit_group_pos.positions
|
|
||||||
if positions[k] then
|
|
||||||
positions[k] = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
debug_print('Active unit group count: ' .. count)
|
debug_print('Active unit group count: ' .. count)
|
||||||
@@ -527,7 +538,7 @@ local function spawn_biter(surface, position, forceSpawn, is_boss_biter)
|
|||||||
local increase_boss_health_per_wave = Public.get('increase_boss_health_per_wave')
|
local increase_boss_health_per_wave = Public.get('increase_boss_health_per_wave')
|
||||||
if increase_boss_health_per_wave then
|
if increase_boss_health_per_wave then
|
||||||
local modified_boss_unit_health = Public.get('modified_boss_unit_health')
|
local modified_boss_unit_health = Public.get('modified_boss_unit_health')
|
||||||
BiterHealthBooster.add_boss_unit(biter, modified_boss_unit_health, 0.55)
|
BiterHealthBooster.add_boss_unit(biter, modified_boss_unit_health.current_value, 0.55)
|
||||||
else
|
else
|
||||||
local sum = boosted_health * 5
|
local sum = boosted_health * 5
|
||||||
debug_print('Boss Health Boosted: ' .. sum)
|
debug_print('Boss Health Boosted: ' .. sum)
|
||||||
@@ -569,8 +580,8 @@ local function increase_biters_health()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local boosted_health = BiterHealthBooster.get('biter_health_boost')
|
-- local boosted_health = BiterHealthBooster.get('biter_health_boost')
|
||||||
local wave_number = Public.get('wave_number')
|
-- local wave_number = Public.get('wave_number')
|
||||||
|
|
||||||
-- this sets normal units health
|
-- this sets normal units health
|
||||||
local modified_unit_health = Public.get('modified_unit_health')
|
local modified_unit_health = Public.get('modified_unit_health')
|
||||||
@@ -581,17 +592,24 @@ local function increase_biters_health()
|
|||||||
Public.set('modified_unit_health').current_value = modified_unit_health.current_value + modified_unit_health.health_increase_per_boss_wave
|
Public.set('modified_unit_health').current_value = modified_unit_health.current_value + modified_unit_health.health_increase_per_boss_wave
|
||||||
|
|
||||||
-- this sets boss units health
|
-- this sets boss units health
|
||||||
if boosted_health == 1 then
|
-- if boosted_health == 1 then
|
||||||
boosted_health = 1.25
|
-- boosted_health = 1.25
|
||||||
end
|
-- end
|
||||||
|
|
||||||
boosted_health = math_round(boosted_health * (wave_number * 0.04), 3)
|
-- boosted_health = math_round(boosted_health * (wave_number * 0.04), 3)
|
||||||
debug_print_health('boosted_health: ' .. boosted_health)
|
-- debug_print_health('boosted_health: ' .. boosted_health)
|
||||||
if boosted_health >= 300 then
|
-- if boosted_health >= 300 then
|
||||||
boosted_health = 300
|
-- boosted_health = 300
|
||||||
end
|
-- end
|
||||||
|
-- Public.set('modified_boss_unit_health', boosted_health)
|
||||||
|
|
||||||
Public.set('modified_boss_unit_health', boosted_health)
|
-- this sets boss units health
|
||||||
|
local modified_boss_unit_health = Public.get('modified_boss_unit_health')
|
||||||
|
if modified_boss_unit_health.current_value > modified_boss_unit_health.limit_value then
|
||||||
|
modified_boss_unit_health.current_value = modified_boss_unit_health.limit_value
|
||||||
|
end
|
||||||
|
debug_print_health('modified_boss_unit_health.current_value: ' .. modified_boss_unit_health.current_value)
|
||||||
|
Public.set('modified_boss_unit_health').current_value = modified_boss_unit_health.current_value + modified_boss_unit_health.health_increase_per_boss_wave
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_next_wave()
|
local function set_next_wave()
|
||||||
@@ -994,6 +1012,7 @@ local function spawn_unit_group(fs, only_bosses)
|
|||||||
|
|
||||||
local unit_group_pos = Public.get('unit_group_pos')
|
local unit_group_pos = Public.get('unit_group_pos')
|
||||||
local unit_group = surface.create_unit_group({position = spawn_position, force = 'enemy'})
|
local unit_group = surface.create_unit_group({position = spawn_position, force = 'enemy'})
|
||||||
|
unit_group_pos.index = unit_group_pos.index + 1
|
||||||
unit_group_pos.positions[unit_group.group_number] = {position = unit_group.position, index = 0}
|
unit_group_pos.positions[unit_group.group_number] = {position = unit_group.position, index = 0}
|
||||||
local average_unit_group_size = Public.get('average_unit_group_size')
|
local average_unit_group_size = Public.get('average_unit_group_size')
|
||||||
local group_size = math_floor(average_unit_group_size * group_size_modifier_raffle[math_random(1, group_size_modifier_raffle_size)])
|
local group_size = math_floor(average_unit_group_size * group_size_modifier_raffle[math_random(1, group_size_modifier_raffle_size)])
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ function Public.reset_wave_defense()
|
|||||||
this.unit_groups = {}
|
this.unit_groups = {}
|
||||||
this.unit_groups_size = 0
|
this.unit_groups_size = 0
|
||||||
this.unit_group_pos = {
|
this.unit_group_pos = {
|
||||||
|
index = 0,
|
||||||
positions = {}
|
positions = {}
|
||||||
}
|
}
|
||||||
this.index = 0
|
this.index = 0
|
||||||
@@ -60,7 +61,6 @@ function Public.reset_wave_defense()
|
|||||||
this.worm_building_density = 16
|
this.worm_building_density = 16
|
||||||
this.worm_raffle = {}
|
this.worm_raffle = {}
|
||||||
this.clear_corpses = false
|
this.clear_corpses = false
|
||||||
this.biter_health_boost = 1
|
|
||||||
this.alert_boss_wave = false
|
this.alert_boss_wave = false
|
||||||
this.remove_entities = false
|
this.remove_entities = false
|
||||||
this.enable_side_target = false
|
this.enable_side_target = false
|
||||||
@@ -74,8 +74,13 @@ function Public.reset_wave_defense()
|
|||||||
this.fill_tiles_so_biter_can_path = true
|
this.fill_tiles_so_biter_can_path = true
|
||||||
this.modified_unit_health = {
|
this.modified_unit_health = {
|
||||||
current_value = 1.02,
|
current_value = 1.02,
|
||||||
limit_value = 30,
|
limit_value = 60,
|
||||||
health_increase_per_boss_wave = 0.04
|
health_increase_per_boss_wave = 0.08
|
||||||
|
}
|
||||||
|
this.modified_boss_unit_health = {
|
||||||
|
current_value = 2.00,
|
||||||
|
limit_value = 500,
|
||||||
|
health_increase_per_boss_wave = 0.15
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -209,15 +214,6 @@ function Public.increase_damage_per_wave(boolean)
|
|||||||
return this.increase_damage_per_wave
|
return this.increase_damage_per_wave
|
||||||
end
|
end
|
||||||
|
|
||||||
function Public.set_biter_health_boost(number)
|
|
||||||
if number and type(number) == 'number' then
|
|
||||||
this.biter_health_boost = number
|
|
||||||
else
|
|
||||||
this.biter_health_boost = 1
|
|
||||||
end
|
|
||||||
return this.biter_health_boost
|
|
||||||
end
|
|
||||||
|
|
||||||
function Public.pause(boolean)
|
function Public.pause(boolean)
|
||||||
this.paused = boolean or false
|
this.paused = boolean or false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ local function place_nest_near_unit_group()
|
|||||||
|
|
||||||
local spawner = unit.surface.create_entity({name = name, position = position, force = unit.force})
|
local spawner = unit.surface.create_entity({name = name, position = position, force = unit.force})
|
||||||
if boss then
|
if boss then
|
||||||
BiterHealthBooster.add_boss_unit(spawner, modified_boss_unit_health)
|
BiterHealthBooster.add_boss_unit(spawner, modified_boss_unit_health.current_value)
|
||||||
else
|
else
|
||||||
BiterHealthBooster.add_unit(spawner, modified_unit_health.current_value)
|
BiterHealthBooster.add_unit(spawner, modified_unit_health.current_value)
|
||||||
end
|
end
|
||||||
@@ -188,7 +188,7 @@ function Public.build_worm()
|
|||||||
local modified_boss_unit_health = Public.get('modified_boss_unit_health')
|
local modified_boss_unit_health = Public.get('modified_boss_unit_health')
|
||||||
|
|
||||||
if boss then
|
if boss then
|
||||||
BiterHealthBooster.add_boss_unit(u, modified_boss_unit_health)
|
BiterHealthBooster.add_boss_unit(u, modified_boss_unit_health.current_value)
|
||||||
else
|
else
|
||||||
BiterHealthBooster.add_unit(u, modified_unit_health.current_value)
|
BiterHealthBooster.add_unit(u, modified_unit_health.current_value)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user