mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-03 13:12:11 +02:00
Balance worm health and gun turrets
This commit is contained in:
parent
64f1a845b4
commit
02bb30997d
@ -13,6 +13,7 @@ local Public = {}
|
||||
local random = math.random
|
||||
local abs = math.abs
|
||||
local ceil = math.ceil
|
||||
local round = math.round
|
||||
local queue_task = Task.queue_task
|
||||
local tiles_per_call = 8
|
||||
local total_calls = ceil(1024 / tiles_per_call)
|
||||
@ -347,9 +348,13 @@ local function do_place_entities(data)
|
||||
if surface.can_place_entity(e) then
|
||||
entity = surface.create_entity(e)
|
||||
if entity then
|
||||
if e.note then
|
||||
if e.note then -- flamethrower-turret and artillery-turret are at default health, only gun-turret is modified
|
||||
local modified_unit_health = WD.get('modified_unit_health')
|
||||
BiterHealthBooster.add_unit(entity, modified_unit_health.current_value + 1)
|
||||
local final_health = round(modified_unit_health.current_value * 0.5, 3)
|
||||
if final_health < 1 then
|
||||
final_health = 1
|
||||
end
|
||||
BiterHealthBooster.add_unit(entity, final_health)
|
||||
end
|
||||
wintery(entity)
|
||||
if e.direction then
|
||||
@ -380,9 +385,14 @@ local function do_place_entities(data)
|
||||
else
|
||||
entity = surface.create_entity(e)
|
||||
if entity then
|
||||
if e.note then
|
||||
if e.note then -- small-worm-turret, medium-worm-turret, big-worm-turret, behemoth-worm-turret
|
||||
local modified_unit_health = WD.get('modified_unit_health')
|
||||
BiterHealthBooster.add_unit(entity, modified_unit_health.current_value + 1)
|
||||
local worm_unit_settings = WD.get('worm_unit_settings')
|
||||
local final_health = round(modified_unit_health.current_value * worm_unit_settings.scale_units_by_health[entity.name], 3)
|
||||
if final_health < 1 then
|
||||
final_health = 1
|
||||
end
|
||||
BiterHealthBooster.add_unit(entity, final_health)
|
||||
end
|
||||
wintery(entity)
|
||||
if e.direction then
|
||||
|
@ -101,6 +101,14 @@ function Public.reset_wave_defense()
|
||||
['behemoth-spitter'] = 0.25
|
||||
}
|
||||
}
|
||||
this.worm_unit_settings = { -- note that final health modifier isn't lower than 1
|
||||
scale_units_by_health = {
|
||||
['small-worm-turret'] = 0.8,
|
||||
['medium-worm-turret'] = 0.6,
|
||||
['big-worm-turret'] = 0.4,
|
||||
['behemoth-worm-turret'] = 0.2,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
--- This gets values from our table
|
||||
|
@ -2,6 +2,7 @@ local Public = require 'modules.wave_defense.table'
|
||||
local Event = require 'utils.event'
|
||||
local BiterHealthBooster = require 'modules.biter_health_booster_v2'
|
||||
local math_random = math.random
|
||||
local round = math.round
|
||||
local Token = require 'utils.token'
|
||||
local Task = require 'utils.task'
|
||||
|
||||
@ -200,13 +201,18 @@ function Public.build_worm()
|
||||
return
|
||||
end
|
||||
local u = unit.surface.create_entity({name = worm, position = position, force = unit.force})
|
||||
local worm_unit_settings = Public.get('worm_unit_settings')
|
||||
local modified_unit_health = Public.get('modified_unit_health')
|
||||
local modified_boss_unit_health = Public.get('modified_boss_unit_health')
|
||||
|
||||
if boss then
|
||||
BiterHealthBooster.add_boss_unit(u, modified_boss_unit_health.current_value)
|
||||
else
|
||||
BiterHealthBooster.add_unit(u, modified_unit_health.current_value)
|
||||
local final_health = round(modified_unit_health.current_value * worm_unit_settings.scale_units_by_health[worm.name], 3)
|
||||
if final_health < 1 then
|
||||
final_health = 1
|
||||
end
|
||||
BiterHealthBooster.add_unit(u, final_health)
|
||||
end
|
||||
|
||||
unit.surface.create_entity({name = 'blood-explosion-huge', position = position})
|
||||
|
Loading…
x
Reference in New Issue
Block a user