From b6aec3bd07b15f74042b7ce3050a59358702174b Mon Sep 17 00:00:00 2001 From: randomdud3 Date: Thu, 2 Jan 2020 23:51:29 +0100 Subject: [PATCH] Use the current health when calculating health pool changes Ideally, you could keep the health modifier in the pool structure so you dont need to calculate the inverse every time again, but since the 3rd spot meant stuff for bosses and it was used in other places, i didn't want to mess with it. --- modules/biter_health_booster.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/biter_health_booster.lua b/modules/biter_health_booster.lua index 9bf0f4c1..44dfc2df 100644 --- a/modules/biter_health_booster.lua +++ b/modules/biter_health_booster.lua @@ -98,8 +98,11 @@ local function on_entity_damaged(event) end end + --Calculate current actual health, accounting for regeneration + local current_health = biter.health * (1 / health_pool[2]) + --Reduce health pool - health_pool[1] = health_pool[1] - event.final_damage_amount + health_pool[1] = current_health - event.final_damage_amount --Set entity health relative to health pool biter.health = health_pool[1] * health_pool[2]