sorcery  Diff

Differences From Artifact [3a290dc995]:

To Artifact [56e196edd6]:

  • File data/runes.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: 42828) [annotate] [blame] [check-ins using]

97
98
99
100
101
102
103





















104
105
106
107
108
109
110
...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
...
161
162
163
164
165
166
167

168
169
170
171
172
173
174
...
194
195
196
197
198
199
200

201
202
203
204
205
206
207
...
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422







423
424
425

426
427
428
429
430
431
432
...
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
...
881
882
883
884
885
886
887



888
889
890
891
892
893
894
...
972
973
974
975
976
977
978















































979
980
981
982
983
984
985
986
987
988
989
990
991





















992
993
994
995
996
997
998
				sounds = {
					[0] = { sound = 'sorcery_stutter', pos = 'subjects' };
				};
			}
		end
	end
end





















return {
	translocate = {
		name = 'Translocate';
		tone = {0,235,233};
		minpower = 3;
		rarity = 7;
		amulets = {
................................................................................
					else
						ctx.sparkle = false
					end
				end;
				frame = {
					tungsten = {
						name = 'Quick Joining';
						desc = 'Give this amulet to another and they can arrive safely at your side almost instantaneously from anywhere in the world — though returning whence they came may be a more difficult matter';
					};
					gold = {
						name = 'Exchange';
						desc = 'Give this amulet to another and they will be able to trade places with you no matter where in the world each of you might be.'; 
					};
					cobalt = {
						name = 'Sending';
................................................................................
				end;
				cast = function(ctx)
					if not ctx.meta:contains('rune_return_dest') then
						local pos = ctx.caster:get_pos()
						ctx.meta:set_string('rune_return_dest',minetest.pos_to_string(pos))
						return true -- play effects but do not break spell
					else

						local pos = minetest.string_to_pos(ctx.meta:get_string('rune_return_dest'))
						ctx.meta:set_string('rune_return_dest','')
						local subjects = { ctx.caster }
						local center = ctx.caster:get_pos()
						ctx.sparkle = false
						local delay = math.max(3,10 - ctx.stats.power) + 3*(math.random()*2-1)
						teleport(ctx,{{ref=ctx.caster}},delay,pos)
................................................................................
						desc = 'Use this amulet once to bind it to a particular point in the world, then use it again to seize up everyone surrounding you in the grip of a fearsome magic that will deport them all in the blink of an eye to whatever destination you have chosen';
					};
				};
			};
			ruby = minetest.get_modpath('beds') and {
				name = 'Escape';
				desc = 'Immediately transport yourself out of a dangerous situation back to the last place you slept, before anyone has time to net you in a disjunction';

				cast = function(ctx)
					-- if not beds.spawns then beds.read_spawns() end
					local subjects = {ctx.caster}
					for _,s in pairs(subjects) do
						local spp = beds.spawn[ctx.caster:get_player_name()]
						if spp then
							local oldpos = s:get_pos()
................................................................................
			sapphire = {
				name = 'Unsealing';
				desc = 'Wielding this amulet, a touch of your hand will unravel even the mightiest protective magics, leaving doors unsealed and walls free to tear down';
			};
			amethyst = {
				name = 'Purging';
				desc = 'Free yourself from the grip of any malicious spellwork with a snap of your fingers — interrupting all of your own active spells in the process, including impending translocations';
				cast = function(ctx)
					local h = ctx.heading.eyeheight * 1.1
					minetest.add_particlespawner {
						time = 0.2, amount = math.random(200,250), attached = ctx.caster;
						glow = 14, texture = sorcery.vfx.glowspark(sorcery.lib.color(156,255,10)):render();
						minpos = {x = -0.3, y = -0.5, z = -0.3};
						maxpos = {x =  0.3, y =  h,   z =  0.3};
						minvel = {x = -1.8, y = -1.8, z = -1.8};
						maxvel = {x =  1.8, y =  1.8, z =  1.8};
						minsize = 0.2, maxsize = 5;
						animation = {
							type = 'vertical_frames', length = 4.1;
							aspect_w = 16, aspect_h = 16;
						};
						minexptime = 2, maxexptime = 4;
					}
					minetest.sound_play('sorcery_disjoin',{object=ctx.caster},true)
					sorcery.spell.disjoin{target=ctx.caster}
				end;
			};
			emerald = {
				name = 'Disjunction Field';
				desc = 'Render an area totally opaque to spellwork for a period of time, disrupting any existing spells and preventing further spellcasting therein';
			};
			ruby = {
				name = 'Disjunction';
				desc = 'Wield this amulet against a spellcaster to disrupt and abort all their spells in progress, perhaps to trap a foe intent on translocating away, or unleash its force upon the victim of a malign hex to free them from its clutches';







				frame = {
					iridium = {
						name = 'Nullification';

						desc = 'Not only will your victim\'s spells be nullified, but all enchanted objects they carry will be stripped of their power — or possibly even destroyed outright';
					};
				};
			};
			luxite = {
				name = 'Disjunctive Aura';
				desc = 'For a time, all magic undertaken in your vicinity will fail totally — including your own';
................................................................................
				mingrade = 4;
				name = 'Duplication';
				desc = 'Bring an exact twin of any object or item into existence, no matter how common or rare it might be';
				cast = function(ctx)
					local color = sorcery.lib.color(255,61,205)
					local dup, sndpos, anchor, sbj, ty
					if ctx.target.type == 'object' and ctx.target.ref:get_luaentity().name == '__builtin:item' then
						sorcery.vfx.imbue(color, ctx.target.ref)
						sndpos = 'subjects'
						sbj = {{player = ctx.target.ref}}
						local item = ItemStack(ctx.target.ref:get_luaentity().itemstring)
						local r = function() return math.random() * 2 - 1 end
						local putpos = vector.offset(ctx.target.ref:get_pos(), r(), 1, r())
						dup = function()
							item:set_count(1) -- nice try bouge-san
................................................................................
										vp[#vp+1] = sum
									end
								end
								if #vp > 0 then npos=vp[math.random(#vp)] end
							end
							if npos then
								minetest.set_node(npos, minetest.get_node(ctx.target.under))



								minetest.get_meta(npos):from_table(origmeta)
								return npos, true
							else
								local nstack = ItemStack(ty)
								nstack:get_meta():from_table(origmeta)
								local leftover = ctx.caster:get_inventory():add_item('main',nstack)
								if leftover and not leftover.is_empty() then
................................................................................
		tone = {255,194,0};
		minpower = 1;
		rarity = 5;
		amulets = {
			luxite = {
				name = 'Glow';
				desc = 'Swathe yourself in an aura of sparkling radiance, casting light upon all the dark places where you voyage';















































				iridium = {
					name = 'Aura';
					desc = 'Dazzling golden luminance emanates from the bodies of all those around you, and you walk in light even amid the darkest depths of the earth';
				};
			};
			diamond = {
				name = 'Radiance';
				desc = 'Set the air around you alight with a mystic luminance, letting you see clearly a great distance in every direction for several minutes';
				frame = {
					iridium = {
						name = 'Sunshine';
						mingrade = 5;
						desc = 'Unleash the power of this amulet to seize ultimate control over the forces of nature and summon the Sun high into the nighttime sky';





















					};
				};
			};
		};
	};
	dominate = {
		name = 'Dominate';







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







>







 







>







 







|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








>
>
>
>
>
>
>



>







 







|







 







>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







97
98
99
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
131
...
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
...
412
413
414
415
416
417
418
419


















420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
...
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
...
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
...
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
				sounds = {
					[0] = { sound = 'sorcery_stutter', pos = 'subjects' };
				};
			}
		end
	end
end

local purge = function(target)
	local h = target:get_properties().eye_height * 1.1
	minetest.add_particlespawner {
		time = 0.2, amount = math.random(200,250), attached = target;
		glow = 14, texture = sorcery.vfx.glowspark(sorcery.lib.color(156,255,10)):render();
		minpos = {x = -0.3, y = -0.5, z = -0.3};
		maxpos = {x =  0.3, y =  h,   z =  0.3};
		minvel = {x = -1.8, y = -1.8, z = -1.8};
		maxvel = {x =  1.8, y =  1.8, z =  1.8};
		minsize = 0.2, maxsize = 5;
		animation = {
			type = 'vertical_frames', length = 4.1;
			aspect_w = 16, aspect_h = 16;
		};
		minexptime = 2, maxexptime = 4;
	}
	minetest.sound_play('sorcery_disjoin',{object=target},true)
	sorcery.spell.disjoin{target=target}
end

return {
	translocate = {
		name = 'Translocate';
		tone = {0,235,233};
		minpower = 3;
		rarity = 7;
		amulets = {
................................................................................
					else
						ctx.sparkle = false
					end
				end;
				frame = {
					tungsten = {
						name = 'Quick Joining';
						desc = 'Give this amulet to another and they can arrive safely at your side almost instantaneously from anywhere at all in the world — though returning whence they came may be a more difficult matter';
					};
					gold = {
						name = 'Exchange';
						desc = 'Give this amulet to another and they will be able to trade places with you no matter where in the world each of you might be.'; 
					};
					cobalt = {
						name = 'Sending';
................................................................................
				end;
				cast = function(ctx)
					if not ctx.meta:contains('rune_return_dest') then
						local pos = ctx.caster:get_pos()
						ctx.meta:set_string('rune_return_dest',minetest.pos_to_string(pos))
						return true -- play effects but do not break spell
					else
						if ctx.caster:get_attach() ~= nil then return false end
						local pos = minetest.string_to_pos(ctx.meta:get_string('rune_return_dest'))
						ctx.meta:set_string('rune_return_dest','')
						local subjects = { ctx.caster }
						local center = ctx.caster:get_pos()
						ctx.sparkle = false
						local delay = math.max(3,10 - ctx.stats.power) + 3*(math.random()*2-1)
						teleport(ctx,{{ref=ctx.caster}},delay,pos)
................................................................................
						desc = 'Use this amulet once to bind it to a particular point in the world, then use it again to seize up everyone surrounding you in the grip of a fearsome magic that will deport them all in the blink of an eye to whatever destination you have chosen';
					};
				};
			};
			ruby = minetest.get_modpath('beds') and {
				name = 'Escape';
				desc = 'Immediately transport yourself out of a dangerous situation back to the last place you slept, before anyone has time to net you in a disjunction';
				mingrade = 4;
				cast = function(ctx)
					-- if not beds.spawns then beds.read_spawns() end
					local subjects = {ctx.caster}
					for _,s in pairs(subjects) do
						local spp = beds.spawn[ctx.caster:get_player_name()]
						if spp then
							local oldpos = s:get_pos()
................................................................................
			sapphire = {
				name = 'Unsealing';
				desc = 'Wielding this amulet, a touch of your hand will unravel even the mightiest protective magics, leaving doors unsealed and walls free to tear down';
			};
			amethyst = {
				name = 'Purging';
				desc = 'Free yourself from the grip of any malicious spellwork with a snap of your fingers — interrupting all of your own active spells in the process, including impending translocations';
				cast = function(ctx) purge(ctx.caster) end;


















			};
			emerald = {
				name = 'Disjunction Field';
				desc = 'Render an area totally opaque to spellwork for a period of time, disrupting any existing spells and preventing further spellcasting therein';
			};
			ruby = {
				name = 'Disjunction';
				desc = 'Wield this amulet against a spellcaster to disrupt and abort all their spells in progress, perhaps to trap a foe intent on translocating away, or unleash its force upon the victim of a malign hex to free them from its clutches';
				mingrade = 3;
				cast = function(ctx)
					if ctx.target.type == 'object'
						then purge(ctx.target.ref)
						else return false
					end
				end;
				frame = {
					iridium = {
						name = 'Nullification';
						mingrade = 5;
						desc = 'Not only will your victim\'s spells be nullified, but all enchanted objects they carry will be stripped of their power — or possibly even destroyed outright';
					};
				};
			};
			luxite = {
				name = 'Disjunctive Aura';
				desc = 'For a time, all magic undertaken in your vicinity will fail totally — including your own';
................................................................................
				mingrade = 4;
				name = 'Duplication';
				desc = 'Bring an exact twin of any object or item into existence, no matter how common or rare it might be';
				cast = function(ctx)
					local color = sorcery.lib.color(255,61,205)
					local dup, sndpos, anchor, sbj, ty
					if ctx.target.type == 'object' and ctx.target.ref:get_luaentity().name == '__builtin:item' then
						-- sorcery.vfx.imbue(color, ctx.target.ref) -- causes graphics card problems???
						sndpos = 'subjects'
						sbj = {{player = ctx.target.ref}}
						local item = ItemStack(ctx.target.ref:get_luaentity().itemstring)
						local r = function() return math.random() * 2 - 1 end
						local putpos = vector.offset(ctx.target.ref:get_pos(), r(), 1, r())
						dup = function()
							item:set_count(1) -- nice try bouge-san
................................................................................
										vp[#vp+1] = sum
									end
								end
								if #vp > 0 then npos=vp[math.random(#vp)] end
							end
							if npos then
								minetest.set_node(npos, minetest.get_node(ctx.target.under))
								if minetest.registered_nodes[ty].on_construct then
									minetest.registered_nodes[ty].on_construct(npos)
								end
								minetest.get_meta(npos):from_table(origmeta)
								return npos, true
							else
								local nstack = ItemStack(ty)
								nstack:get_meta():from_table(origmeta)
								local leftover = ctx.caster:get_inventory():add_item('main',nstack)
								if leftover and not leftover.is_empty() then
................................................................................
		tone = {255,194,0};
		minpower = 1;
		rarity = 5;
		amulets = {
			luxite = {
				name = 'Glow';
				desc = 'Swathe yourself in an aura of sparkling radiance, casting light upon all the dark places where you voyage';
				cast = function(ctx)
					local fac = (ctx.stats.power * 0.1)
					local radius = 2 + 5*fac
					local period = 0.4 - 0.3*fac
					local glowduration = 5 + 50*fac
					sorcery.spell.cast {
						name = "sorcery:glow";
						caster = ctx.caster;
						subjects = {{player=ctx.caster}};
						duration = 40 + 120*fac;
						nodes = {};
						disjoin = function(self)
							for _,n in pairs(self.nodes) do
								if sorcery.lib.str.beginswith(minetest.get_node(n).name,'sorcery:air_glimmer_') then
									minetest.remove_node(n)
								end
							end
						end;
						intervals = {
							{period = period, after = {whence=0,secs=0.7}, fn = function(c)
								print('cycling!')
								for _,sub in pairs(c.spell.subjects) do
									local ox, oy, oz = math.random(-radius,radius),
													   math.random(-radius,radius),
													   math.random(-radius,radius)
									local pos = vector.offset(sub.player:get_pos(), ox,oy,oz)
									print('pos',minetest.pos_to_string(pos),'player',minetest.pos_to_string(sub.player:get_pos()))
									if sorcery.lib.node.is_air(pos) then
										print('is air!')
										local power = math.random(4,minetest.LIGHT_MAX)
										minetest.set_node(pos, {
											name = 'sorcery:air_glimmer_' .. tostring(power);
										})
										c.spell.nodes[#c.spell.nodes + 1] = pos
										local d = glowduration * (0.5 + math.random()*0.5)
										local m = minetest.get_meta(pos)
										m:set_float('duration', d)
										m:set_float('timeleft', d)
										m:set_int('power', power)
									else
										print('not air!', dump(minetest.get_node(pos)))
									end
								end
							end};
						};
					}
				end;
				iridium = {
					name = 'Aura';
					desc = 'Dazzling golden luminance emanates from the bodies of all those around you, and you walk in light even amid the darkest depths of the earth';
				};
			};
			diamond = {
				name = 'Radiance';
				desc = 'Set the air around you alight with a mystic luminance, letting you see clearly a great distance in every direction for several minutes';
				frame = {
					iridium = {
						name = 'Sunshine';
						mingrade = 5;
						desc = 'Unleash the power of this amulet to seize ultimate control over the forces of nature and summon the Sun high into the nighttime sky';
						cast = function(ctx)
							local time = minetest.get_timeofday()
							if not (time < 0.3 or time > 0.7) then return false end
							local diff = 0.5 - time
							local frames = 40
							local duration = 1.5
							local delta = diff / frames
							local tl = {}
							for i=1,frames do
								local wh = {whence=0, secs=duration*(i/frames)}
								tl[wh] = function(s)
									minetest.set_timeofday(time + delta*i)
								end
							end
							sorcery.spell.cast {
								name = 'sorcery:sunshine';
								caster = ctx.caster;
								timeline = tl;
								duration = duration;
							}
						end;
					};
				};
			};
		};
	};
	dominate = {
		name = 'Dominate';