@@ -30,9 +30,9 @@ 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'; + desc = 'Destroy items on an enchanter and channel their essence with enchanting lenses to anchor ' .. aff .. ' spells into an object, enabling it to produce preternatural effects'; uses = uses; affinity = recipe; color = affcolor; sound = 'xdecor_enchanting'; -- FIXME make own @@ -115,8 +115,10 @@ elseif spec.item then default_mode = 'consume' if stack:get_name() ~= spec.item then return false end + if spec.consume and stack:get_count() < spec.consume then + return false end else return false end @@ -128,9 +130,18 @@ if mode == 'dmg' then stack:add_wear((spec.dmg or 1) * 1000) return stack elseif mode == 'consume' then + local r = sorcery.register.residue.db[stack:get_name()] stack:take_item(spec.consume or 1) + if r then + local rs = ItemStack(r) + rs:set_count(rs:get_count() * (spec.consume or 1)) + if stack:is_empty() + then stack = rs + else minetest.add_item(ctx.target.above, rs) + end + end return stack end end for ench,data in pairs(sorcery.data.enchants) do @@ -194,9 +205,9 @@ }; seal = { name = 'sealing'; color = {255,238,16}; - uses = 32; + uses = 128; desc = 'Bind an object to your spirit such that it will be rendered impregnable to others, or break a sealing created with this same wand'; leytype = 'imperic'; affinity = {'pine','dark'}; cast = function(ctx) @@ -255,13 +266,13 @@ local color = ctx.base.gem == 'sapphire'; local duration = (ctx.base.gem == 'amethyst' and 4) or 2; local ley = sorcery.ley.estimate(ctx.caster:get_pos()) - local strength = ley.force + local strength = ley.force * 4 * ley.force if color then strength = strength / #ley.aff for _,a in pairs(ley.aff) do - cast_sparkle(ctx,sorcery.lib.color(sorcery.data.affinities[a].color):brighten(1.3), strength, duration * strength) + cast_sparkle(ctx,sorcery.lib.color(sorcery.data.affinities[a].color):brighten(1.3), strength, duration * (strength*0.5)) end else cast_sparkle(ctx,sorcery.lib.color(250,255,185), strength, duration*strength) end @@ -586,8 +597,9 @@ sorcery.ley.setcharge(rechargee,charge + newenergy) e:set_stack('item',1,rechargee) enchantment_sparkle(ctx, sorcery.lib.color(212,6,63)) + sorcery.enchant.update_enchanter(ctx.target.under) end; }; transfer = { name = 'transfer'; @@ -627,8 +639,9 @@ end end sorcery.enchant.set(item,e) ei:set_stack('item',1,item) + sorcery.enchant.update_enchanter(ctx.target.under) enchantment_sparkle(ctx,sorcery.lib.color(255,154,44)) enchantment_sparkle(ctx,sorcery.lib.color(226,44,255)) end; };