Added frost effect

This commit is contained in:
the-real-herowl 2024-01-16 02:03:39 +01:00
parent 3f5cea3046
commit 5610fa1c4b
5 changed files with 60 additions and 1 deletions

View File

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B