sorcery  Diff

Differences From Artifact [27b08793ec]:

To Artifact [4a5f13d256]:


22
23
24
25
26
27
28
29
30
31

32
33
34
35




36
37
38
39
40
41
42





43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
..
70
71
72
73
74
75
76
77
78
79
80




81
82
83
84
85
86
87

		local inv = user:get_inventory()
		local btl = ItemStack('vessels:glass_bottle')
		if not inv:contains_item('main', btl) then
			return nil
		end

		local damage
		local blood
		local target

		if selfharm then
			damage = 3
			blood = ItemStack('sorcery:blood 1')
			target = user




		else
			if not minetest.is_player(pointat) then
				return nil
			end
			damage = 5
			blood = ItemStack('sorcery:blood 3')
			target = pointat





		end
		local pos = target:get_pos()
		pos.y = pos.y + 1.5

		local wear = 65535 / dagger_uses
		stack:add_wear(wear)

		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)
		for i=0, 48 do
			minetest.add_particle{
				texture = 'sorcery_blood_' .. math.random(5) .. '.png',
				size = 7,
				expirationtime = 2 + math.random(),
				glow = 1,
				pos = pos,
................................................................................
					x = 0,
					y = -1,
				 	z = 0
				}
			}
		end

		if math.random(3) == 1 then
			-- we've used up the consecration
			local unholy = ItemStack("sorcery:dagger")
			unholy:set_wear(stack:get_wear())




			return unholy
		else
			-- consecration is holding, return dagger as-is
			return stack
		end
	end
end







<


>

<


>
>
>
>




<
<

>
>
>
>
>










|
<
<
<







 







|



>
>
>
>







22
23
24
25
26
27
28

29
30
31
32

33
34
35
36
37
38
39
40
41
42


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59



60
61
62
63
64
65
66
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

		local inv = user:get_inventory()
		local btl = ItemStack('vessels:glass_bottle')
		if not inv:contains_item('main', btl) then
			return nil
		end


		local blood
		local target
		local caps
		if selfharm then

			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


			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

		local wear = 65535 / dagger_uses
		stack:add_wear(wear)

		inv:remove_item('main',btl)
		inv:add_item('main',blood)

		target:punch(user, 1.0, caps, nil)



		for i=0, 48 do
			minetest.add_particle{
				texture = 'sorcery_blood_' .. math.random(5) .. '.png',
				size = 7,
				expirationtime = 2 + math.random(),
				glow = 1,
				pos = pos,
................................................................................
					x = 0,
					y = -1,
				 	z = 0
				}
			}
		end

		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
		end
	end
end