sorcery  Diff

Differences From Artifact [7cffae6fa3]:

To Artifact [6661143040]:


   546    546   									}
   547    547   								}
   548    548   							end;
   549    549   							[0.3] = function(s,te,tl)
   550    550   								s.visual_caster {
   551    551   									amount = 100 * s.duration, time = s.duration, glow = 14;
   552    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 };
          553  +									minpos = { x = -0.1, y =  4.0, z = -0.1 };
          554  +									maxpos = { x =  0.1, y =  4.2, z =  0.1 };
   555    555   									minvel = { x = -5.0, y = -0.5, z = -5.0 };
   556    556   									maxvel = { x =  5.0, y =  0.5, z =  5.0 };
   557    557   									minacc = { x = -0.4, y =  1.0, z = -0.4 };
   558    558   									maxacc = { x =  0.4, y = -1.0, z =  0.4 };
   559    559   									minexptime = 6, maxexptime = 6;
   560    560   									minsize = 0.2, maxsize = 1.4;
   561    561   									animation = {
................................................................................
   600    600   				end;
   601    601   				frame = {
   602    602   					iridium = {
   603    603   						name = 'Spellshatter';
   604    604   						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';
   605    605   						cast = function(ctx)
   606    606   							local where = ctx.caster:get_pos()
   607         -							local what = minetest.get_objects_inside_radius(where, 3 + (2*ctx.stats.power))
          607  +							local radius = 3 + (2*ctx.stats.power)
          608  +							local what = minetest.get_objects_inside_radius(where, radius)
   608    609   							local who = {}
   609    610   							local pfac = math.min(1, ctx.stats.power/8)
   610    611   							for _, w in pairs(what) do
   611    612   								if w:is_player() and w ~= ctx.caster then
   612    613   									who[#who+1] = {player = w}
   613    614   								end
   614    615   							end
   615         -							if not next(who) then return false end
          616  +							--if not next(who) then return false end
          617  +							local h = ctx.heading.eyeheight*1.1
          618  +							local tex = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render();
          619  +							local epicenter = ctx.caster:get_pos() + vector.new(0, h/2, 0)
          620  +							local maxima = vector.new(radius, radius, radius)
          621  +							local potential_targets = minetest.find_nodes_in_area(epicenter - maxima, epicenter + maxima, {'group:sorcery_magical', 'group:sorcery_magitech'})
          622  +							local wreck = {}
          623  +							for _, pos in pairs(potential_targets) do
          624  +								if sorcery.lib.math.vdcomp(radius,epicenter,pos) then
          625  +									print('got wreckable at',pos)
          626  +									wreck[#wreck+1] = pos
          627  +								end
          628  +							end
          629  +							sorcery.spell.cast {
          630  +								name = 'sorcery:spellshatter';
          631  +								caster = ctx.caster;
          632  +								anchor = epicenter;
          633  +								--disjunction = true;
          634  +								--range = radius;
          635  +								duration = 10;
          636  +								timeline = {
          637  +									[0] = function(s)
          638  +										s.visual_caster {
          639  +											texture = tex;
          640  +											amount = 100, time = 0.2;
          641  +											minpos = { x = -0.1, y = -0.5, z = -0.1 };
          642  +											maxpos = { x =  0.1, y =  h,   z =  0.1 };
          643  +											minvel = { x = -10.0, y = -0.0, z = -10.0 };
          644  +											maxvel = { x =  10.0, y =  0.0, z =  10.0 };
          645  +											minexptime = 3, maxexptime = 3;
          646  +											minsize = 5, maxsize = 8;
          647  +											animation = {
          648  +												type = 'vertical_frames', length = (21/6) + 0.1;
          649  +												aspect_w = 16, aspect_h = 16;
          650  +											}
          651  +										}
          652  +										s.visual_caster {
          653  +											texture = tex;
          654  +											amount = 5000, time = 2;
          655  +											minpos = { x = -0.1, y = -0.5, z = -0.1 };
          656  +											maxpos = { x =  0.1, y =  h,   z =  0.1 };
          657  +											minvel = { x = -10.0, y = -0.0, z = -10.0 };
          658  +											maxvel = { x =  10.0, y =  0.0, z =  10.0 };
          659  +											minexptime = 3, maxexptime = 3;
          660  +											minsize = 0.7, maxsize = 2;
          661  +											animation = {
          662  +												type = 'vertical_frames', length = (21/6) + 0.1;
          663  +												aspect_w = 16, aspect_h = 16;
          664  +											}
          665  +										}
          666  +									end;
          667  +								};
          668  +								intervals = {
          669  +									{period = 0.1, after = 0.15, fn = function(c)
          670  +										print('interval running')
          671  +										for i = 1,80 do
          672  +											local life = 0.2 + math.random() * 2
          673  +											local dir = vector.new(math.random()-0.5,0,math.random()-0.5):normalize()
          674  +											local pos = epicenter + (dir * (math.random()*radius))
          675  +											print('setting particle at',pos)
          676  +											minetest.add_particle {
          677  +												texture = tex;
          678  +												pos = pos;
          679  +												expirationtime = life;
          680  +												velocity = {x = 0, y = math.random() * 0.3 + 0.1, z = 0};
          681  +												size = 0.4 + math.random() * 3;
          682  +												glow = 14;
          683  +												animation = {
          684  +													type = 'vertical_frames', length = math.random(1,3)/10;
          685  +													aspect_w = 16, aspect_h = 16;
          686  +												}
          687  +											}
          688  +										end
          689  +										if next(wreck) then
          690  +											local k,p = sorcery.lib.tbl.pick(wreck)
          691  +
          692  +											minetest.add_particle {
          693  +												texture = sorcery.lib.image('sorcery_sparking.png'):glow(sorcery.lib.color(255,0,0)):render();
          694  +												pos = vector.offset(p,math.random(),math.random(),math.random());
          695  +												expirationtime = 1;
          696  +												size = 5 + math.random() * 4;
          697  +												glow = 14;
          698  +												animation = {
          699  +													type = 'vertical_frames', length = 0.3;
          700  +													aspect_w = 64, aspect_h = 64;
          701  +												}
          702  +											}
          703  +											minetest.add_particle {
          704  +												texture = sorcery.lib.image('sorcery_crackle.png'):glow(sorcery.lib.color(255,0,0)):render();
          705  +												pos = vector.offset(p,math.random(),math.random(),math.random());
          706  +												expirationtime = 1;
          707  +												size = 4 + math.random() * 6;
          708  +												glow = 14;
          709  +												animation = {
          710  +													type = 'vertical_frames', length = 0.6;
          711  +													aspect_w = 64, aspect_h = 64;
          712  +												}
          713  +											}
          714  +										end
          715  +									end};
          716  +								};
          717  +							}
   616    718   						end;
   617    719   					};
   618    720   				};
   619    721   			};
   620    722   		}
   621    723   	};
   622    724   	repulse = {