Index: data/runes.lua ================================================================== --- data/runes.lua +++ data/runes.lua @@ -500,14 +500,127 @@ end }; diamond = { name = 'Mundanity'; 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'; + cast = function(ctx) + local where = ctx.caster:get_pos() + local what = minetest.get_objects_inside_radius(where, 3 + (2*ctx.stats.power)) + local who = {} + local pfac = math.min(1, ctx.stats.power/8) + for _, w in pairs(what) do + if w:is_player() and w ~= ctx.caster then + who[#who+1] = {player = w} + end + end + if not next(who) then return false end + + local timeline = {} + local casttime = 4 - (3 * pfac) + local tf = casttime / #who + + local h = ctx.heading.eyeheight*1.1 + sorcery.spell.cast { + name = 'sorcery:mundanity'; + caster = ctx.caster; + attach = 'caster'; + subjects = who; + _aff_idx = 1; + _ntgt = #who; + duration = 3 + casttime; + timeline = { + [0] = function(s,te,tl) + s.visual_caster { + amount = 100 * s.duration, time = s.duration, glow = 14; + texture = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render(); + minpos = { x = -0.1, y = -0.5,z = -0.1 }; + maxpos = { x = 0.1, y = h*0.5,z = 0.1 }; + minvel = { x = -0.0, y = -8.0, z = -0.0 }; + maxvel = { x = 0.0, y = 8.0, z = 0.0 }; + minacc = { x = -0.2, y = -0.0, z = -0.2 }; + maxacc = { x = 0.2, y = -0.2, z = 0.2 }; + minexptime = 3, maxexptime = 3; + minsize = 0.2, maxsize = 3.5; + animation = { + type = 'vertical_frames', length = (21/6) + 0.1; + aspect_w = 16, aspect_h = 16; + } + } + end; + [0.3] = function(s,te,tl) + s.visual_caster { + amount = 100 * s.duration, time = s.duration, glow = 14; + texture = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render(); + minpos = { x = -0.1, y = 3.0, z = -0.1 }; + maxpos = { x = 0.1, y = 3.2, z = 0.1 }; + minvel = { x = -5.0, y = -0.5, z = -5.0 }; + maxvel = { x = 5.0, y = 0.5, z = 5.0 }; + minacc = { x = -0.4, y = 1.0, z = -0.4 }; + maxacc = { x = 0.4, y = -1.0, z = 0.4 }; + minexptime = 6, maxexptime = 6; + minsize = 0.2, maxsize = 1.4; + animation = { + type = 'vertical_frames', length = (21/24) + 0.1; + aspect_w = 16, aspect_h = 16; + }; + } + end; + }; + intervals = { + {period = tf; after = {secs=1.2}; fn = function(c) + print('---- aff idx is now', c.spell._aff_idx) + print(dump(c.spell.subjects)) + local sub = c.spell.subjects[c.spell._aff_idx] + if sub then + print(' -- sub found') + c.spell.visual { + amount = 100, time = 2, glow = 14; + attached = c.spell.subjects[c.spell._aff_idx].player; + texture = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render(); + minpos = { x = -0.3, y = 7.3, z = -0.3 }; + maxpos = { x = 0.3, y = 5.7, z = 0.3 }; + minvel = { x = -0.0, y = -7.5, z = -0.0 }; + maxvel = { x = 0.0, y = -8.5, z = 0.0 }; + minacc = { x = -0.4, y = 1.0, z = -0.4 }; + maxacc = { x = 0.4, y = -2.0, z = 0.4 }; + minexptime = 6, maxexptime = 6; + minsize = 3, maxsize = 7; + animation = { + type = 'vertical_frames', length = (21/6) + 0.1; + aspect_w = 16, aspect_h = 16; + }; + } + -- if c.spell._aff_idx > c.spell._ntgt then return false end + end + end}; + {period = tf; after = {secs=2.1}; fn = function(c) + local sub = c.spell.subjects[c.spell._aff_idx] + if sub then purge(sub.player) end + c.spell._aff_idx = c.spell._aff_idx + 1 + print('---> aff idx is now', c.spell._aff_idx) + print(dump(c.spell.subjects)) + -- if c.spell._aff_idx > c.spell._ntgt then return false end + end}; + }; + } + end; frame = { iridium = { name = 'Spellshatter'; 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'; + cast = function(ctx) + local where = ctx.caster:get_pos() + local what = minetest.get_objects_inside_radius(where, 3 + (2*ctx.stats.power)) + local who = {} + local pfac = math.min(1, ctx.stats.power/8) + for _, w in pairs(what) do + if w:is_player() and w ~= ctx.caster then + who[#who+1] = {player = w} + end + end + if not next(who) then return false end + end; }; }; }; } }; Index: tap.lua ================================================================== --- tap.lua +++ tap.lua @@ -89,11 +89,11 @@ end end do return end ::found:: - local tposhash = vector.to_string(tpos) + local tposhash = minetest.hash_node_position(tpos) local live, should_cache local mass_leaves, mass_trunk, topnode, prevalidate if abm_cache.treehash[tposhash] then live = true local c = abm_cache.treehash[tposhash]