1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-11-27 22:38:18 +02:00

rpg - modify the raw-fish of how much it heals

This commit is contained in:
Gerkiz
2021-10-24 18:08:37 +02:00
parent e56d7ce727
commit 711fb9933a
3 changed files with 43 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ local xp_floating_text_color = Public.xp_floating_text_color
local experience_levels = Public.experience_levels
local points_per_level = Public.points_per_level
local settings_level = Public.gui_settings_levels
local floor = math.floor
--RPG Frames
local main_frame_name = Public.main_frame_name
@@ -489,6 +490,45 @@ function Public.get_heal_modifier(player)
return (rpg_t.vitality - 10) * 0.06
end
function Public.get_heal_modifier_from_using_fish(player)
local rpg_extra = Public.get('rpg_extra')
if rpg_extra.disable_get_heal_modifier_from_using_fish then
return
end
local base_amount = 80
local rpg_t = Public.get_value_from_player(player.index)
local char = player.character
local vit = rpg_t.vitality
local position = player.position
if char and char.valid then
local health = player.character_health_bonus + 250
local multiplier = (vit - 10) * 0.018
local final = multiplier * base_amount / 2
if final < 80 then
final = base_amount
end
final = floor(final)
local color
if char.health > (health * 0.50) then
color = {b = 0.2, r = 0.1, g = 1, a = 0.8}
elseif char.health > (health * 0.25) then
color = {r = 1, g = 1, b = 0}
else
color = {b = 0.1, r = 1, g = 0, a = 0.8}
end
player.surface.create_entity(
{
name = 'flying-text',
position = {position.x, position.y + 0.6},
text = '+' .. final,
color = color
}
)
char.health = char.health + final
end
end
function Public.get_mana_modifier(player)
local rpg_t = Public.get_value_from_player(player.index)
if rpg_t.level <= 40 then