forked from VoxeLibre/VoxeLibre
Add poison. Update times/potency.
This commit is contained in:
parent
38a4e6ed89
commit
7dc36368b0
|
@ -65,25 +65,25 @@ function mcl_potions.weakness_func(player, factor, duration)
|
||||||
minetest.after(duration, function() player:set_attribute("weakness", tostring(0)) end )
|
minetest.after(duration, function() player:set_attribute("weakness", tostring(0)) end )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function mcl_potions.poison_func(player, factor, duration)
|
function mcl_potions.poison_func(player, factor, duration)
|
||||||
player:set_attribute("poison", tostring(factor))
|
for i=1,math.floor(duration/factor) do
|
||||||
print(player:get_player_name().." ".."poison = "..player:get_attribute("poison"))
|
minetest.after(i*factor, function() player:set_hp(player:get_hp() - 1) end)
|
||||||
minetest.after(duration, function() player:set_attribute("poison", tostring(0)) end )
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_potions.regeneration_func(player, factor, duration)
|
|
||||||
if minetest.is_player(player) then
|
|
||||||
|
|
||||||
for i=1,math.floor(duration/factor) do
|
|
||||||
minetest.after(i*factor, function()
|
|
||||||
if player:get_hp() < 20 then
|
|
||||||
player:set_hp(player:get_hp() + 1)
|
|
||||||
end
|
|
||||||
end )
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions.regeneration_func(player, factor, duration)
|
||||||
|
for i=1,math.floor(duration/factor) do
|
||||||
|
minetest.after(i*factor, function()
|
||||||
|
if player:get_hp() < 20 then
|
||||||
|
player:set_hp(player:get_hp() + 1)
|
||||||
|
end
|
||||||
|
end )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function mcl_potions.invisiblility_func(player, duration)
|
function mcl_potions.invisiblility_func(player, duration)
|
||||||
mcl_potions.invisible(player, true)
|
mcl_potions.invisible(player, true)
|
||||||
minetest.after(duration, function() mcl_potions.invisible(player, false) end )
|
minetest.after(duration, function() mcl_potions.invisible(player, false) end )
|
||||||
|
|
|
@ -143,27 +143,27 @@ register_lingering("slowness_plus", "Lingering Slowness +", "#000066", {
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("poison", "Lingering Poison", "#335544", {
|
register_lingering("poison", "Lingering Poison", "#335544", {
|
||||||
potion_fun = function(player, redx) mcl_potions.poison_func(player, 0.85, 180*redx) end
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, 45*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("poison_2", "Lingering Poison II", "#446655", {
|
register_lingering("poison_2", "Lingering Poison II", "#446655", {
|
||||||
potion_fun = function(player, redx) mcl_potions.poison_func(player, 0.85, 180*redx) end
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 1.2, 21*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("poison_plus", "Lingering Poison +", "#557766", {
|
register_lingering("poison_plus", "Lingering Poison +", "#557766", {
|
||||||
potion_fun = function(player, redx) mcl_potions.poison_func(player, 0.85, 180*redx) end
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, 90*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("regeneration", "Lingering Regeneration", "#A52BB2", {
|
register_lingering("regeneration", "Lingering Regeneration", "#A52BB2", {
|
||||||
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 0.85, 180*redx) end
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, 45*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("regeneration_2", "Lingering Regeneration II", "#B52CC2", {
|
register_lingering("regeneration_2", "Lingering Regeneration II", "#B52CC2", {
|
||||||
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 0.85, 180*redx) end
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 1.2, 21*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("regeneration_plus", "Lingering Regeneration +", "#C53DD3", {
|
register_lingering("regeneration_plus", "Lingering Regeneration +", "#C53DD3", {
|
||||||
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 0.85, 300*redx) end
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, 90*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_lingering("invisibility", "Lingering Invisibility", "#B0B0B0", {
|
register_lingering("invisibility", "Lingering Invisibility", "#B0B0B0", {
|
||||||
|
|
|
@ -143,27 +143,27 @@ register_splash("slowness_plus", "Splash Slowness +", "#000066", {
|
||||||
})
|
})
|
||||||
|
|
||||||
register_splash("poison", "Splash Poison", "#335544", {
|
register_splash("poison", "Splash Poison", "#335544", {
|
||||||
potion_fun = function(player, redx) mcl_potions.poison_func(player, 0.85, 180*redx) end
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, 45*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_splash("poison_2", "Splash Poison II", "#446655", {
|
register_splash("poison_2", "Splash Poison II", "#446655", {
|
||||||
potion_fun = function(player, redx) mcl_potions.poison_func(player, 0.85, 180*redx) end
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 1.2, 21*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_splash("poison_plus", "Splash Poison +", "#557766", {
|
register_splash("poison_plus", "Splash Poison +", "#557766", {
|
||||||
potion_fun = function(player, redx) mcl_potions.poison_func(player, 0.85, 180*redx) end
|
potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, 90*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_splash("regeneration", "Splash Regeneration", "#A52BB2", {
|
register_splash("regeneration", "Splash Regeneration", "#A52BB2", {
|
||||||
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 0.85, 180*redx) end
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, 45*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_splash("regeneration_2", "Splash Regeneration II", "#B52CC2", {
|
register_splash("regeneration_2", "Splash Regeneration II", "#B52CC2", {
|
||||||
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 0.85, 180*redx) end
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 1.2, 21*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_splash("regeneration_plus", "Splash Regeneration +", "#C53DD3", {
|
register_splash("regeneration_plus", "Splash Regeneration +", "#C53DD3", {
|
||||||
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 0.85, 300*redx) end
|
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, 90*redx) end
|
||||||
})
|
})
|
||||||
|
|
||||||
register_splash("invisibility", "Splash Invisibility", "#B0B0B0", {
|
register_splash("invisibility", "Splash Invisibility", "#B0B0B0", {
|
||||||
|
|
Loading…
Reference in New Issue