diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 2bc9cd8ff..000720a31 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -531,6 +531,49 @@ mcl_potions.register_effect({ timer_uses_factor = true, }) +mcl_potions.register_effect({ + name = "frost", + description = S("Frost"), + get_tt = function(factor) + return S("-1 HP / 1 s, can kill, -@1% running speed", math.floor(factor*100)) + end, + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + mcl_burning.extinguish(object) + playerphysics.add_physics_factor(object, "speed", "mcl_potions:frost", 1-factor) + EF.frost[object].vignette = object:hud_add({ + hud_elem_type = "image", + position = {x = 0.5, y = 0.5}, + scale = {x = -101, y = -101}, + text = "mcl_potions_frost_hud.png", + z_index = -400 + }) + end, + on_hit_timer = function(object, factor, duration) + if object:is_player() or object:get_luaentity() then + mcl_util.deal_damage(object, 1, {type = "magic"}) + end + end, + on_end = function(object) + playerphysics.remove_physics_factor(object, "speed", "mcl_potions:frost") + if not EF.frost[object] then return end + object:hud_remove(EF.frost[object].vignette) + end, + particle_color = "#5B7DAA", + uses_factor = true, + lvl1_factor = 0.1, + lvl2_factor = 0.2, + timer_uses_factor = false, + hit_timer_step = 1, + damage_modifier = "is_fire", + modifier_func = function(damage, effect_vals) + effect_vals.timer = effect_vals.dur + return 0 + end, +}) + mcl_potions.register_effect({ name = "food_poisoning", description = S("Food Poisoning"), @@ -643,12 +686,28 @@ mcl_potions.register_hp_hudbar_modifier({ priority = 0, }) +mcl_potions.register_hp_hudbar_modifier({ + predicate = function(player) + if EF.frost[player] and EF.regeneration[player] then return true end + end, + icon = "mcl_potions_icon_regen_frost.png", + priority = 10, +}) + +mcl_potions.register_hp_hudbar_modifier({ + predicate = function(player) + if EF.frost[player] then return true end + end, + icon = "mcl_potions_icon_frost.png", + priority = 20, +}) + mcl_potions.register_hp_hudbar_modifier({ predicate = function(player) if EF.regeneration[player] then return true end end, icon = "hudbars_icon_regenerate.png", - priority = 10, + priority = 30, }) local function potions_set_hudbar(player) diff --git a/textures/mcl_potions_effect_frost.png b/textures/mcl_potions_effect_frost.png new file mode 100644 index 000000000..6a008d25c Binary files /dev/null and b/textures/mcl_potions_effect_frost.png differ diff --git a/textures/mcl_potions_frost_hud.png b/textures/mcl_potions_frost_hud.png new file mode 100644 index 000000000..282c713f1 Binary files /dev/null and b/textures/mcl_potions_frost_hud.png differ diff --git a/textures/mcl_potions_icon_frost.png b/textures/mcl_potions_icon_frost.png new file mode 100644 index 000000000..f9edd0d7c Binary files /dev/null and b/textures/mcl_potions_icon_frost.png differ diff --git a/textures/mcl_potions_icon_regen_frost.png b/textures/mcl_potions_icon_regen_frost.png new file mode 100644 index 000000000..0a604ec55 Binary files /dev/null and b/textures/mcl_potions_icon_regen_frost.png differ