Differences From
Artifact [27b08793ec]:
22 22
23 23 local inv = user:get_inventory()
24 24 local btl = ItemStack('vessels:glass_bottle')
25 25 if not inv:contains_item('main', btl) then
26 26 return nil
27 27 end
28 28
29 - local damage
30 29 local blood
31 30 local target
31 + local caps
32 32 if selfharm then
33 - damage = 3
34 33 blood = ItemStack('sorcery:blood 1')
35 34 target = user
35 + caps = {
36 + full_punch_interval = 1.0,
37 + damage_groups = { fleshy = 3 },
38 + }
36 39 else
37 40 if not minetest.is_player(pointat) then
38 41 return nil
39 42 end
40 - damage = 5
41 - blood = ItemStack('sorcery:blood 3')
42 43 target = pointat
44 + caps = stack:get_tool_capabilities()
45 + blood = ItemStack {
46 + name = 'sorcery:blood';
47 + count = math.floor(caps.damage_groups.fleshy * 1.5);
48 + }
43 49 end
44 50 local pos = target:get_pos()
45 51 pos.y = pos.y + 1.5
46 52
47 53 local wear = 65535 / dagger_uses
48 54 stack:add_wear(wear)
49 55
50 56 inv:remove_item('main',btl)
51 57 inv:add_item('main',blood)
52 58
53 - target:punch(user, 1.0, {
54 - full_punch_interval = 1.0,
55 - damage_groups = { fleshy = damage },
56 - }, nil)
59 + target:punch(user, 1.0, caps, nil)
57 60 for i=0, 48 do
58 61 minetest.add_particle{
59 62 texture = 'sorcery_blood_' .. math.random(5) .. '.png',
60 63 size = 7,
61 64 expirationtime = 2 + math.random(),
62 65 glow = 1,
63 66 pos = pos,
................................................................................
70 73 x = 0,
71 74 y = -1,
72 75 z = 0
73 76 }
74 77 }
75 78 end
76 79
77 - if math.random(3) == 1 then
80 + if math.random(3 + sorcery.enchant.strength(stack,'sanctify') * 6) == 1 then
78 81 -- we've used up the consecration
79 82 local unholy = ItemStack("sorcery:dagger")
80 83 unholy:set_wear(stack:get_wear())
84 + local ench = sorcery.enchant.get(stack)
85 + if #ench.spells > 0 then
86 + sorcery.enchant.set(unholy,ench)
87 + end
81 88 return unholy
82 89 else
83 90 -- consecration is holding, return dagger as-is
84 91 return stack
85 92 end
86 93 end
87 94 end