@@ -25,22 +25,28 @@ if not inv:contains_item('main', btl) then return nil end - local damage local blood local target + local caps if selfharm then - damage = 3 blood = ItemStack('sorcery:blood 1') target = user + caps = { + full_punch_interval = 1.0, + damage_groups = { fleshy = 3 }, + } else if not minetest.is_player(pointat) then return nil end - damage = 5 - blood = ItemStack('sorcery:blood 3') target = pointat + caps = stack:get_tool_capabilities() + blood = ItemStack { + name = 'sorcery:blood'; + count = math.floor(caps.damage_groups.fleshy * 1.5); + } end local pos = target:get_pos() pos.y = pos.y + 1.5 @@ -49,12 +55,9 @@ inv:remove_item('main',btl) inv:add_item('main',blood) - target:punch(user, 1.0, { - full_punch_interval = 1.0, - damage_groups = { fleshy = damage }, - }, nil) + target:punch(user, 1.0, caps, nil) for i=0, 48 do minetest.add_particle{ texture = 'sorcery_blood_' .. math.random(5) .. '.png', size = 7, @@ -73,12 +76,16 @@ } } end - if math.random(3) == 1 then + if math.random(3 + sorcery.enchant.strength(stack,'sanctify') * 6) == 1 then -- we've used up the consecration local unholy = ItemStack("sorcery:dagger") unholy:set_wear(stack:get_wear()) + local ench = sorcery.enchant.get(stack) + if #ench.spells > 0 then + sorcery.enchant.set(unholy,ench) + end return unholy else -- consecration is holding, return dagger as-is return stack