sorcery  Diff

Differences From Artifact [42c4d86138]:

  • File gems.lua — part of check-in [147592b8e9] at 2020-10-26 03:58:08 on branch trunk — add over-time spellcasting abstraction to enable metamagic and in particular disjunction, add more animations and sound effects, add excavation spell, possibly some others, forget when the last commit was, edit a bunch of magitech to make it subject to the disjunction mechanism (throw up a disjunction aura and waltz right through those force fields bby, wheee), also illumination spells, tweak runeforge and rune frequence to better the balance and also limit player frustration, move some math functions into their own library category, various tweaks and bugfixes, probably other shit i don't remember (user: lexi, size: 9009) [annotate] [blame] [check-ins using]

To Artifact [68440cd05e]:


55
56
57
58
59
60
61
62







63
64
65
66

67
68
69
70
71
72
73
74
75
76
77
78
79
..
93
94
95
96
97
98
99

100
101
102
103
104
105

106










107
108
109
110
111
112
113
	if not gem.foreign_amulet then
		local img = sorcery.lib.image
		local img_stone = img('sorcery_amulet.png'):multiply(sorcery.lib.color(gem.tone))
		local img_sparkle = img('sorcery_amulet_sparkle.png')
		local useamulet = function(stack,user,target)
			local sp = sorcery.amulet.getspell(stack)
			if not sp or not sp.cast then return nil end
			local stats = sorcery.amulet.stats(stack)







			local probe = sorcery.spell.probe(user:get_pos())
			-- amulets don't work in antimagic fields, though some may want to 
			-- implement this logic themselves (for instance to check a range)
			if (probe.disjunction and not sp.ignore_disjunction) then return nil end


			local ctx = {
				caster = user;
				target = target;
				stats = stats;
				wield = stack;
				amulet = stack:get_definition()._sorcery.amulet;
				meta = stack:get_meta(); -- avoid spell boilerplate
				color = sorcery.lib.color(sp.tone);
				today = minetest.get_day_count();
				probe = probe;
				heading = {
					pos   = user:get_pos();
................................................................................
					pos = user:get_pos();
					gain = 1;
				})
			end
			if ctx.sparkle then
				sorcery.vfx.cast_sparkle(user, ctx.color, stats.power,0.5)
			end

			if res == nil then
				if not minetest.check_player_privs(user, 'sorcery:infinirune') then
					sorcery.amulet.setrune(stack)
				end
			end


			return ctx.wield










		end;
		minetest.register_craftitem(amuletname, {
			description = sorcery.lib.str.capitalize(name) .. ' amulet';
			inventory_image = img_sparkle:blit(img_stone):render();
			wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
			groups = { sorcery_amulet = 1 };
			on_use = useamulet;







<
>
>
>
>
>
>
>




>





|







 







>

<
|
|
<

>
|
>
>
>
>
>
>
>
>
>
>







55
56
57
58
59
60
61

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
100
101
102
103
104
105
106
107
108

109
110

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
	if not gem.foreign_amulet then
		local img = sorcery.lib.image
		local img_stone = img('sorcery_amulet.png'):multiply(sorcery.lib.color(gem.tone))
		local img_sparkle = img('sorcery_amulet_sparkle.png')
		local useamulet = function(stack,user,target)
			local sp = sorcery.amulet.getspell(stack)
			if not sp or not sp.cast then return nil end


			local usedamulet if stack:get_count() == 1 then
				usedamulet = stack
			else
				usedamulet = ItemStack(stack)
				usedamulet:set_count(1)
			end
			local probe = sorcery.spell.probe(user:get_pos())
			-- amulets don't work in antimagic fields, though some may want to 
			-- implement this logic themselves (for instance to check a range)
			if (probe.disjunction and not sp.ignore_disjunction) then return nil end
			local stats = sorcery.amulet.stats(usedamulet)

			local ctx = {
				caster = user;
				target = target;
				stats = stats;
				wield = usedamulet;
				amulet = stack:get_definition()._sorcery.amulet;
				meta = stack:get_meta(); -- avoid spell boilerplate
				color = sorcery.lib.color(sp.tone);
				today = minetest.get_day_count();
				probe = probe;
				heading = {
					pos   = user:get_pos();
................................................................................
					pos = user:get_pos();
					gain = 1;
				})
			end
			if ctx.sparkle then
				sorcery.vfx.cast_sparkle(user, ctx.color, stats.power,0.5)
			end
			local infinirune = minetest.check_player_privs(user, 'sorcery:infinirune')
			if res == nil then

				if not infinirune then sorcery.amulet.setrune(usedamulet) end
			end


			if stack:get_count() == 1 then
				return ctx.wield
			else
				if not infinirune then
					stack:take_item(1)
					local leftover = user:get_inventory():add_item('main',usedamulet)
					if leftover and leftover:get_count() > 0 then
						minetest.add_item(user:get_pos(), leftover)
					end
				end
				return stack
			end
		end;
		minetest.register_craftitem(amuletname, {
			description = sorcery.lib.str.capitalize(name) .. ' amulet';
			inventory_image = img_sparkle:blit(img_stone):render();
			wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
			groups = { sorcery_amulet = 1 };
			on_use = useamulet;