sorcery  Diff

Differences From Artifact [807df7a655]:

  • File data/spells.lua — part of check-in [ea6e475e44] at 2020-10-19 09:52:11 on branch trunk — continue dev on celestial mechanics, add melding+division spells (resonance), refine itemclasses, add keypunch and punchcards, add paper pulp, add a shitload of visuals, add convenience scripts for working with the wiki, make the flamebolt spell actually useful instead of just a pretty lightshow, add essences, inferno crystal, and other goodies; iterate on wands, lots of shit i can't remember, various bugfixes (user: lexi, size: 25710) [annotate] [blame] [check-ins using]

To Artifact [bdb226347b]:


15
16
17
18
19
20
21








22
23
24
25
26
27
28
..
53
54
55
56
57
58
59

60
61
62
63
64
65
66
67
68
69
70
71
...
170
171
172
173
174
175
176

177
178
179
180
181
182
183
184


185
186
187
188
189
190
191
192
193
194
195
196
197
...
405
406
407
408
409
410
411

412
413
414
415
416
417
418
419
420
421
422
...
447
448
449
450
451
452
453

454
455
456
457
458
459
460
461
462
463
464
465
...
677
678
679
680
681
682
683

684
685
686
687
688
689
690
691
	sorcery.vfx.cast_sparkle(ctx.caster,color,strength,duration)
end

local enchantment_sparkle = function(ctx,color)
	sorcery.vfx.enchantment_sparkle(ctx.target,color)
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;
................................................................................
			   or #eligible_spells == 0
			   or  material == nil
			   or  material.data.slots == nil
			   or #material.data.slots == 0
				   then return false end

			-- determine the properties the enchantment will have

			local power = 10
			local energy = material.data.maxenergy
			local reliability = 100
			if ctx.base.gem == 'sapphire' then power = power + 5
			elseif ctx.base.gem == 'amethyst' then
				energy = energy * (math.random() * 0.7)
			elseif ctx.base.gem == 'diamond' then
				if math.random(5) == 1 then
					power = power * 2
					reliability = reliability - (reliability / 4)
				else
					power = power + 5
................................................................................
		color = {255,89,16};
		uses = 32;
		affinity = {'acacia','blazing'};
		leytype = 'praxic';
		desc = 'Conjure a gout of fire to scorch your foes with a flick of this wand';
		cast = function(ctx)
			local speed = 30 -- TODO maybe amethyst tip increases speed?

			local radius 
			if ctx.base.gem == 'sapphire'
				then radius = math.random(2,3)
				else radius = math.random(1,2)
			end
			local heading = ctx.heading
			heading.pos.y = heading.pos.y + heading.eyeheight*0.9
			local bolt = minetest.add_entity(heading.pos,'sorcery:spell_projectile_flamebolt')


			bolt:set_rotation(heading.yaw)
			local vel = {
				x = heading.yaw.x * speed;
				y = heading.yaw.y * speed;
				z = heading.yaw.z * speed;
			};
			bolt:get_luaentity()._blastradius = radius
			bolt:set_velocity(vel)
		end;
	};
	seal = {
		name = 'sealing';
		color = {255,238,16};
................................................................................
						end
					else
						e:set_stack('foci',t.slot,ItemStack(t.replacement))
					end
				end
				
				local res

				if type(m.results) == 'function' then
					res = m.results(ctx)
				elseif type(m.results) == 'table' and m.results[1] then -- haaaack
					res = select(2,sorcery.lib.tbl.pick(m.results))
				else
					res = m.results
				end

				e:set_stack('item',1,ItemStack(res))
				enchantment_sparkle(ctx,sorcery.lib.color(228,4,201))
			::next_meld::end
................................................................................
			end
			
			if div.restrict and not div.restrict(ctx) then
				return false
			end

			local dst

			if div.mode == 'any' then
				local lst = sorcery.lib.tbl.cshuf(div.give)
				dst = function(i) return lst[i] end
			elseif div.mode == 'random' then
				dst = function() return sorcery.lib.tbl.pick(div.give) end
			elseif div.mode == 'set' then
				dst = function(i) return div.give[i] end
			elseif div.mode == 'all' then
				dst = function() return div.give end
			elseif div.mode == 'fn' then
				dst = function(i) return div.give(i,ctx) end
			else return bitch('invalid division mode') end
................................................................................
		uses = 40;
		color = {244,255,157};
		affinity = {'acacia','shimmering','blazing'};
		leytype = 'cognic';
		cast = function(ctx)
			local center = ctx.heading.pos
			local maxpower = 20

			local power = (ctx.base.gem == 'sapphire' and maxpower) or maxpower/2
			local range = (ctx.base.gem == 'emerald' and 6) or 3
			local duration = (ctx.base.gem == 'amethyst' and 60) or 30
			if ctx.base.gem == 'diamond' then
				power = power * (math.random()*2)
				range = range * (math.random()*2)
				duration = duration * (math.random()*2)
			end







>
>
>
>
>
>
>
>







 







>
|

|
<
|







 







>
|
<
<
<
<


<
>
>

<
<
<
<
<







 







>



|







 







>




|







 







>
|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
..
61
62
63
64
65
66
67
68
69
70
71

72
73
74
75
76
77
78
79
...
178
179
180
181
182
183
184
185
186




187
188

189
190
191





192
193
194
195
196
197
198
...
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
...
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
...
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
	sorcery.vfx.cast_sparkle(ctx.caster,color,strength,duration)
end

local enchantment_sparkle = function(ctx,color)
	sorcery.vfx.enchantment_sparkle(ctx.target,color)
end

local tblroll = function(bonus,tbl) --> string
	local r = {}
	for _,v in ipairs(tbl) do
		local chance = math.max(1,v.value - bonus)
		if math.random(chance) == 1 then r[#r+1] = v.item end
	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;
................................................................................
			   or #eligible_spells == 0
			   or  material == nil
			   or  material.data.slots == nil
			   or #material.data.slots == 0
				   then return false end

			-- determine the properties the enchantment will have
			local pbonus = ctx.stats.power or 1
			local power = math.floor(10 + (pbonus*5 - 5))
			local energy = material.data.maxenergy
			local reliability = math.floor(100 * (ctx.stats.reliability or 1))

			if ctx.base.gem == 'amethyst' then
				energy = energy * (math.random() * 0.7)
			elseif ctx.base.gem == 'diamond' then
				if math.random(5) == 1 then
					power = power * 2
					reliability = reliability - (reliability / 4)
				else
					power = power + 5
................................................................................
		color = {255,89,16};
		uses = 32;
		affinity = {'acacia','blazing'};
		leytype = 'praxic';
		desc = 'Conjure a gout of fire to scorch your foes with a flick of this wand';
		cast = function(ctx)
			local speed = 30 -- TODO maybe amethyst tip increases speed?
			local radius = math.random(math.max(1,math.floor((ctx.stats.power or 1) - 0.5)), math.ceil((ctx.stats.power or 1)+0.5))
			print('!! radius',radius)




			local heading = ctx.heading
			heading.pos.y = heading.pos.y + heading.eyeheight*0.9

			local vel = vector.multiply(heading.yaw,speed)
			local bolt = minetest.add_entity(vector.add(heading.pos,vector.multiply(heading.yaw,2.5)),'sorcery:spell_projectile_flamebolt')
			bolt:set_rotation(heading.yaw)





			bolt:get_luaentity()._blastradius = radius
			bolt:set_velocity(vel)
		end;
	};
	seal = {
		name = 'sealing';
		color = {255,238,16};
................................................................................
						end
					else
						e:set_stack('foci',t.slot,ItemStack(t.replacement))
					end
				end
				
				local res
				local bonus = math.floor(ctx.stats.power or 1) 
				if type(m.results) == 'function' then
					res = m.results(ctx)
				elseif type(m.results) == 'table' and m.results[1] then -- haaaack
					res = tblroll(bonus,m.results)
				else
					res = m.results
				end

				e:set_stack('item',1,ItemStack(res))
				enchantment_sparkle(ctx,sorcery.lib.color(228,4,201))
			::next_meld::end
................................................................................
			end
			
			if div.restrict and not div.restrict(ctx) then
				return false
			end

			local dst
			local bonus = math.floor(ctx.stats.power or 1) 
			if div.mode == 'any' then
				local lst = sorcery.lib.tbl.cshuf(div.give)
				dst = function(i) return lst[i] end
			elseif div.mode == 'random' then
				dst = function() return tblroll(bonus,div.give) end
			elseif div.mode == 'set' then
				dst = function(i) return div.give[i] end
			elseif div.mode == 'all' then
				dst = function() return div.give end
			elseif div.mode == 'fn' then
				dst = function(i) return div.give(i,ctx) end
			else return bitch('invalid division mode') end
................................................................................
		uses = 40;
		color = {244,255,157};
		affinity = {'acacia','shimmering','blazing'};
		leytype = 'cognic';
		cast = function(ctx)
			local center = ctx.heading.pos
			local maxpower = 20
			local power = math.min(maxpower,(maxpower/2) + ((ctx.stats.power or 1)*(maxpower/2) - (maxpower/2)))
			-- (ctx.base.gem == 'sapphire' and maxpower) or maxpower/2
			local range = (ctx.base.gem == 'emerald' and 6) or 3
			local duration = (ctx.base.gem == 'amethyst' and 60) or 30
			if ctx.base.gem == 'diamond' then
				power = power * (math.random()*2)
				range = range * (math.random()*2)
				duration = duration * (math.random()*2)
			end