sorcery  Diff

Differences From Artifact [b47d0e6fa4]:

To Artifact [2dad4b5804]:


   498    498   						};
   499    499   					}
   500    500   				end
   501    501   			};
   502    502   			diamond = {
   503    503   				name = 'Mundanity';
   504    504   				desc = 'Strip away the effects of all active potions and spells in your immediate vicinity, leaving adversaries without their magicks to enhance and protect them, and allies free of any curses they may be hobbled by -- and, of course, vice versa';
          505  +				cast = function(ctx)
          506  +					local where = ctx.caster:get_pos()
          507  +					local what = minetest.get_objects_inside_radius(where, 3 + (2*ctx.stats.power))
          508  +					local who = {}
          509  +					local pfac = math.min(1, ctx.stats.power/8)
          510  +					for _, w in pairs(what) do
          511  +						if w:is_player() and w ~= ctx.caster then
          512  +							who[#who+1] = {player = w}
          513  +						end
          514  +					end
          515  +					if not next(who) then return false end
          516  +
          517  +					local timeline = {}
          518  +					local casttime = 4 - (3 * pfac)
          519  +					local tf = casttime / #who
          520  +
          521  +					local h = ctx.heading.eyeheight*1.1
          522  +					sorcery.spell.cast {
          523  +						name = 'sorcery:mundanity';
          524  +						caster = ctx.caster;
          525  +						attach = 'caster';
          526  +						subjects = who;
          527  +						_aff_idx = 1;
          528  +						_ntgt = #who;
          529  +						duration = 3 + casttime;
          530  +						timeline = {
          531  +							[0] = function(s,te,tl)
          532  +								s.visual_caster {
          533  +									amount = 100 * s.duration, time = s.duration, glow = 14;
          534  +									texture = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render();
          535  +									minpos = { x = -0.1, y = -0.5,z = -0.1 };
          536  +									maxpos = { x =  0.1, y =  h*0.5,z =  0.1 };
          537  +									minvel = { x = -0.0, y = -8.0, z = -0.0 };
          538  +									maxvel = { x =  0.0, y =  8.0, z =  0.0 };
          539  +									minacc = { x = -0.2, y = -0.0, z = -0.2 };
          540  +									maxacc = { x =  0.2, y = -0.2, z =  0.2 };
          541  +									minexptime = 3, maxexptime = 3;
          542  +									minsize = 0.2, maxsize = 3.5;
          543  +									animation = {
          544  +										type = 'vertical_frames', length = (21/6) + 0.1;
          545  +										aspect_w = 16, aspect_h = 16;
          546  +									}
          547  +								}
          548  +							end;
          549  +							[0.3] = function(s,te,tl)
          550  +								s.visual_caster {
          551  +									amount = 100 * s.duration, time = s.duration, glow = 14;
          552  +									texture = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render();
          553  +									minpos = { x = -0.1, y =  3.0, z = -0.1 };
          554  +									maxpos = { x =  0.1, y =  3.2, z =  0.1 };
          555  +									minvel = { x = -5.0, y = -0.5, z = -5.0 };
          556  +									maxvel = { x =  5.0, y =  0.5, z =  5.0 };
          557  +									minacc = { x = -0.4, y =  1.0, z = -0.4 };
          558  +									maxacc = { x =  0.4, y = -1.0, z =  0.4 };
          559  +									minexptime = 6, maxexptime = 6;
          560  +									minsize = 0.2, maxsize = 1.4;
          561  +									animation = {
          562  +										type = 'vertical_frames', length = (21/24) + 0.1;
          563  +										aspect_w = 16, aspect_h = 16;
          564  +									};
          565  +								}
          566  +							end;
          567  +						};
          568  +						intervals = {
          569  +							{period = tf; after = {secs=1.2}; fn = function(c)
          570  +								print('---- aff idx is now', c.spell._aff_idx)
          571  +								print(dump(c.spell.subjects))
          572  +								local sub = c.spell.subjects[c.spell._aff_idx] 
          573  +								if sub then 
          574  +									print('  -- sub found')
          575  +									c.spell.visual {
          576  +										amount = 100, time = 2, glow = 14;
          577  +										attached = c.spell.subjects[c.spell._aff_idx].player;
          578  +										texture = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render();
          579  +										minpos = { x = -0.3, y =  7.3, z = -0.3 };
          580  +										maxpos = { x =  0.3, y =  5.7, z =  0.3 };
          581  +										minvel = { x = -0.0, y = -7.5, z = -0.0 };
          582  +										maxvel = { x =  0.0, y = -8.5, z =  0.0 };
          583  +										minacc = { x = -0.4, y =  1.0, z = -0.4 };
          584  +										maxacc = { x =  0.4, y = -2.0, z =  0.4 };
          585  +										minexptime = 6, maxexptime = 6;
          586  +										minsize = 3, maxsize = 7;
          587  +										animation = {
          588  +											type = 'vertical_frames', length = (21/6) + 0.1;
          589  +											aspect_w = 16, aspect_h = 16;
          590  +										};
          591  +									}
          592  +									-- if c.spell._aff_idx > c.spell._ntgt then return false end
          593  +								end
          594  +							end};
          595  +							{period = tf; after = {secs=2.1}; fn = function(c)
          596  +								local sub = c.spell.subjects[c.spell._aff_idx] 
          597  +								if sub then purge(sub.player) end
          598  +								c.spell._aff_idx = c.spell._aff_idx + 1
          599  +								print('---> aff idx is now', c.spell._aff_idx)
          600  +								print(dump(c.spell.subjects))
          601  +								-- if c.spell._aff_idx > c.spell._ntgt then return false end
          602  +							end};
          603  +						};
          604  +					}
          605  +				end;
   505    606   				frame = {
   506    607   					iridium = {
   507    608   						name = 'Spellshatter';
   508    609   						desc = 'Blast out a tidal wave of anti-magic that will nullify active spells, but also disenchant or destroy all magical items in range of its violently mundane grip';
          610  +						cast = function(ctx)
          611  +							local where = ctx.caster:get_pos()
          612  +							local what = minetest.get_objects_inside_radius(where, 3 + (2*ctx.stats.power))
          613  +							local who = {}
          614  +							local pfac = math.min(1, ctx.stats.power/8)
          615  +							for _, w in pairs(what) do
          616  +								if w:is_player() and w ~= ctx.caster then
          617  +									who[#who+1] = {player = w}
          618  +								end
          619  +							end
          620  +							if not next(who) then return false end
          621  +						end;
   509    622   					};
   510    623   				};
   511    624   			};
   512    625   		}
   513    626   	};
   514    627   	repulse = {
   515    628   		name = 'Repulse';