@@ -281,10 +281,15 @@ name = 'verdant'; color = {16,29,255}; uses = 48; leytype = 'imperic'; - desc = 'Pour life-energy into the soil, causing flowers and trees to spring up at your command'; + desc = 'Pour a fraction of your life-energy into the soil, causing flowers and trees to spring up at your command'; affinity = {'jungle','verdant'}; + -- rubies(?) make it draw life-energy from bottles of blood + -- in inventory rather than your own bodily health points + cast = function(ctx) + + end }; praxic = anchorwand('praxic', 16, {'pine','shimmering','blazing'}); counterpraxic = anchorwand('counterpraxic',23, {'pine','shimmering','silent'}); entropic = anchorwand('entropic', 8, {'jungle','dark'}); @@ -504,13 +509,86 @@ end }; sacrifice = { name = 'sacrifice'; - uses = 58; + uses = 24; color = {212,6,63}; affinity = {'aspen','blazing'}; leytype = 'syncretic'; - desc = 'Transform the matter of one to three items on an enchanter into energy and empower the item on the center of the enchanter with it. Useful to recharge wands in areas with weak leylines.'; + desc = 'Transform the matter of one to three items on an enchanter into energy and empower the item on the center of the enchanter with it. Useful to quickly recharge wands in areas with weak leylines or in emergencies.'; + cast = function(ctx) + local bitch = function(err) + sorcery.log('data/spells(sacrifice)', err) + return false + end + + local e = get_enchanter(ctx) + if not e then return false end + + local scgroups = { + sorcery_tech = 400; + sorcery_magitech = 600; + shovel = 100; + sword = 200; + pick = 300; + axe = 250; + } + + local rechargee = e:get_stack('item',1) + if rechargee:is_empty() then return false end + local charge, maxcharge = sorcery.ley.getcharge(rechargee) + if not charge then return false end + + local getscval = function(stack) + local name,def = stack:get_name(),stack:get_definition() + local getitemval = function() + if name == 'sorcery:ash' or name == 'new_campfire:ash' then + return 0 + end + + do local f = sorcery.itemclass.get(name, 'fuel') + if f then return f.burntime * 3, f.leftover end + end + + if def._sorcery and def._sorcery.material then + local m = def._sorcery.material + if m.sacrifice_value then return m.sacrifice_value end + if m.metal then + return (m.data.level * 120) * (m.value or 1) + end + if m.mass then return m.mass*15 end + if m.value then return m.value*25 end + end + + for g,v in pairs(scgroups) do + if minetest.get_item_group(name,g) ~= 0 then return v end + end + + return 80 + end + local v,l = getitemval() + if l then l:set_count(stack:get_count()) end + return v * stack:get_count(), l + end + + local newenergy = 0 + for i=1,e:get_size('foci') do + local st = e:get_stack('foci',i) + local val,leftover = getscval(st) + if val > 0 and newenergy + val <= maxcharge then + newenergy = newenergy + val + e:set_stack('foci',i,leftover or ItemStack { + name = 'sorcery:ash', count = st:get_count(); + }) + end + end + newenergy = math.min(maxcharge, newenergy * (ctx.stats.power or 1)) + + sorcery.ley.setcharge(rechargee,charge + newenergy) + e:set_stack('item',1,rechargee) + + enchantment_sparkle(ctx, sorcery.lib.color(212,6,63)) + end; }; transfer = { name = 'transfer'; uses = 65; @@ -520,13 +598,13 @@ desc = 'Transfer ley-current from items on an enchanter into the item in the center, but at a 50% loss if they are of mismatched affinities. One third of maximum current is transferred, and when used on items with little power may destroy them or their enchantments'; }; transmute = { name = 'transmutation'; - uses = 7; + uses = 13; color = {255,90,18}; leytype = 'imperic'; affinity = {'aspen','shimmering','dark','blazing'}; - desc = 'Transmute three ingots into one of a different metal, determined by chance, and influenced by configuration of the wand as well as the stars and the phase of the moon'; + desc = 'Transmute three parts of metal into one of a different metal, determined by chance, and influenced by configuration of the wand as well as the stars and the phase of the moon'; -- diamond = quantity varies between 1-3 }; disjoin = { name = 'disjunction';