From fd724f4c1c3cbb223449a717cca965aeb93f344a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 5 Aug 2020 20:59:16 +0200 Subject: [PATCH] Lingering heal/harm potions change at least 1 HP --- mods/ITEMS/mcl_potions/functions.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index d18801b2d..5cd52b297 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -532,6 +532,10 @@ function mcl_potions.healing_func(player, hp) if obj and obj.harmed_by_heal then hp = -hp end if hp > 0 then + -- at least 1 HP + if hp < 1 then + hp = 1 + end if obj and obj._cmi_is_mob then obj.health = math.max(obj.health + hp, obj.hp_max) @@ -539,7 +543,10 @@ function mcl_potions.healing_func(player, hp) player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" }) end - else + elseif hp < 0 then + if hp > -1 then + hp = -1 + end if obj and obj._cmi_is_mob then obj.health = obj.health + hp