sorcery  Diff

Differences From Artifact [dffc43152b]:

  • File data/spells.lua — part of check-in [15f176a7fe] at 2020-10-31 19:49:49 on branch trunk — add background noise for condensers (temporary hack, need to write a proper environment sound framework as the fucking env_sounds module is completely impossible to extend), fix a couple of really stupid bugs, make higher-quality phials increase the chance of getting good runes so it's not a complete waste to burn iridium or levitanium powder on making them, add targeted disjunction and some other amulet spells (user: lexi, size: 28431) [annotate] [blame] [check-ins using]

To Artifact [2d770c6227]:


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
...
112
113
114
115
116
117
118


119
120
121
122
123
124
125
126
127
128
129
130
131

132








133
134
135
136
137
138
139
...
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
...
583
584
585
586
587
588
589

590
591
592
593
594
595
596
...
624
625
626
627
628
629
630

631
632
633
634
635
636
637
	end
	return r[math.random(#r)]
end
local anchorwand = function(aff,uses,recipe)
	local affcolor = sorcery.lib.color(sorcery.data.affinities[aff].color)
	return {
		name = aff .. ' anchor';
		desc = 'With an enchanter, anchor ' .. aff .. ' spells into an object to enable it to produce preternatural effects';
		uses = uses;
		affinity = recipe;
		color = affcolor;
		sound = 'xdecor_enchanting'; -- FIXME make own
		cast = function(ctx)
			local node = target_node(ctx, 'sorcery:enchanter')
			if not node then return false end
................................................................................
					local proto = stack:get_definition()._proto
					if proto.kind ~= spec.lens or proto.gem ~= spec.gem
						then return false end
				elseif spec.item then
					default_mode = 'consume'
					if stack:get_name() ~= spec.item then
						return false end


				else
					return false
				end

				local mode
				if spec.dmg then mode = 'dmg'
				elseif spec.consume then mode = 'consume'
				else mode = default_mode end

				if mode == 'dmg' then
					stack:add_wear((spec.dmg or 1) * 1000)
					return stack
				elseif mode == 'consume' then

					stack:take_item(spec.consume or 1)








					return stack
				end
			end
			for ench,data in pairs(sorcery.data.enchants) do
				if data.affinity ~= aff or data.recipe == nil then goto skip end
				local newinv = {}
				for s,v in pairs(data.recipe) do
................................................................................
			bolt:get_luaentity()._blastradius = radius
			bolt:set_velocity(vel)
		end;
	};
	seal = {
		name = 'sealing';
		color = {255,238,16};
		uses = 32;
		desc = 'Bind an object to your spirit such that it will be rendered impregnable to others, or break a sealing created with this same wand';
		leytype = 'imperic';
		affinity = {'pine','dark'};
		cast = function(ctx)
			if ctx.target == nil or ctx.target.type ~= 'node' then return false end
			local meta = minetest.get_meta(ctx.target.under)
			-- first we need to check if the wand has an identifying 'key' yet,
................................................................................
		uses = 128;
		desc = 'Reveal the strength and affinities of the local leyline';
		cast = function(ctx)
			local color = ctx.base.gem == 'sapphire';
			local duration = (ctx.base.gem == 'amethyst' and 4) or 2;
			local ley = sorcery.ley.estimate(ctx.caster:get_pos())

			local strength = ley.force
			if color then
				strength = strength / #ley.aff
				for _,a in pairs(ley.aff) do
					cast_sparkle(ctx,sorcery.lib.color(sorcery.data.affinities[a].color):brighten(1.3), strength, duration * strength)
				end
			else
				cast_sparkle(ctx,sorcery.lib.color(250,255,185), strength, duration*strength)
			end

		end;
	};
................................................................................
			end
			newenergy = math.min(maxcharge, newenergy * (ctx.stats.power or 1))

			sorcery.ley.setcharge(rechargee,charge + newenergy)
			e:set_stack('item',1,rechargee)

			enchantment_sparkle(ctx, sorcery.lib.color(212,6,63))

		end;
	};
	transfer = {
		name = 'transfer';
		uses = 65;
		color = {6,212,121};
		leytype = 'syncretic';
................................................................................
				if ctx.base.gem == 'sapphire'
					then e.spells = {} e.energy = 0
					else table.remove(e.spells, math.random(#e.spells))
				end
			end
			sorcery.enchant.set(item,e)
			ei:set_stack('item',1,item)

			enchantment_sparkle(ctx,sorcery.lib.color(255,154,44))
			enchantment_sparkle(ctx,sorcery.lib.color(226,44,255))
		end;
	};
	divine = {
		name = 'divining';
		desc = 'Steal away the secrets of the cosmos';







|







 







>
>













>

>
>
>
>
>
>
>
>







 







|







 







|



|







 







>







 







>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
...
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
...
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
...
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
...
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
...
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
	end
	return r[math.random(#r)]
end
local anchorwand = function(aff,uses,recipe)
	local affcolor = sorcery.lib.color(sorcery.data.affinities[aff].color)
	return {
		name = aff .. ' anchor';
		desc = 'Destroy items on an enchanter and channel their essence with enchanting lenses to anchor ' .. aff .. ' spells into an object, enabling it to produce preternatural effects';
		uses = uses;
		affinity = recipe;
		color = affcolor;
		sound = 'xdecor_enchanting'; -- FIXME make own
		cast = function(ctx)
			local node = target_node(ctx, 'sorcery:enchanter')
			if not node then return false end
................................................................................
					local proto = stack:get_definition()._proto
					if proto.kind ~= spec.lens or proto.gem ~= spec.gem
						then return false end
				elseif spec.item then
					default_mode = 'consume'
					if stack:get_name() ~= spec.item then
						return false end
					if spec.consume and stack:get_count() < spec.consume then
						return false end
				else
					return false
				end

				local mode
				if spec.dmg then mode = 'dmg'
				elseif spec.consume then mode = 'consume'
				else mode = default_mode end

				if mode == 'dmg' then
					stack:add_wear((spec.dmg or 1) * 1000)
					return stack
				elseif mode == 'consume' then
					local r = sorcery.register.residue.db[stack:get_name()]
					stack:take_item(spec.consume or 1)
					if r then
						local rs = ItemStack(r) 
						rs:set_count(rs:get_count() * (spec.consume or 1))
						if stack:is_empty()
							then stack = rs
							else minetest.add_item(ctx.target.above, rs)
						end
					end
					return stack
				end
			end
			for ench,data in pairs(sorcery.data.enchants) do
				if data.affinity ~= aff or data.recipe == nil then goto skip end
				local newinv = {}
				for s,v in pairs(data.recipe) do
................................................................................
			bolt:get_luaentity()._blastradius = radius
			bolt:set_velocity(vel)
		end;
	};
	seal = {
		name = 'sealing';
		color = {255,238,16};
		uses = 128;
		desc = 'Bind an object to your spirit such that it will be rendered impregnable to others, or break a sealing created with this same wand';
		leytype = 'imperic';
		affinity = {'pine','dark'};
		cast = function(ctx)
			if ctx.target == nil or ctx.target.type ~= 'node' then return false end
			local meta = minetest.get_meta(ctx.target.under)
			-- first we need to check if the wand has an identifying 'key' yet,
................................................................................
		uses = 128;
		desc = 'Reveal the strength and affinities of the local leyline';
		cast = function(ctx)
			local color = ctx.base.gem == 'sapphire';
			local duration = (ctx.base.gem == 'amethyst' and 4) or 2;
			local ley = sorcery.ley.estimate(ctx.caster:get_pos())

			local strength = ley.force * 4 * ley.force
			if color then
				strength = strength / #ley.aff
				for _,a in pairs(ley.aff) do
					cast_sparkle(ctx,sorcery.lib.color(sorcery.data.affinities[a].color):brighten(1.3), strength, duration * (strength*0.5))
				end
			else
				cast_sparkle(ctx,sorcery.lib.color(250,255,185), strength, duration*strength)
			end

		end;
	};
................................................................................
			end
			newenergy = math.min(maxcharge, newenergy * (ctx.stats.power or 1))

			sorcery.ley.setcharge(rechargee,charge + newenergy)
			e:set_stack('item',1,rechargee)

			enchantment_sparkle(ctx, sorcery.lib.color(212,6,63))
			sorcery.enchant.update_enchanter(ctx.target.under)
		end;
	};
	transfer = {
		name = 'transfer';
		uses = 65;
		color = {6,212,121};
		leytype = 'syncretic';
................................................................................
				if ctx.base.gem == 'sapphire'
					then e.spells = {} e.energy = 0
					else table.remove(e.spells, math.random(#e.spells))
				end
			end
			sorcery.enchant.set(item,e)
			ei:set_stack('item',1,item)
			sorcery.enchant.update_enchanter(ctx.target.under)
			enchantment_sparkle(ctx,sorcery.lib.color(255,154,44))
			enchantment_sparkle(ctx,sorcery.lib.color(226,44,255))
		end;
	};
	divine = {
		name = 'divining';
		desc = 'Steal away the secrets of the cosmos';