sorcery  Diff

Differences From Artifact [dffc43152b]:

  • File data/spells.lua — part of check-in [15f176a7fe] at 2020-10-31 19:49:49 on branch trunk — add background noise for condensers (temporary hack, need to write a proper environment sound framework as the fucking env_sounds module is completely impossible to extend), fix a couple of really stupid bugs, make higher-quality phials increase the chance of getting good runes so it's not a complete waste to burn iridium or levitanium powder on making them, add targeted disjunction and some other amulet spells (user: lexi, size: 28431) [annotate] [blame] [check-ins using]

To Artifact [2d770c6227]:


    27     27   	end
    28     28   	return r[math.random(#r)]
    29     29   end
    30     30   local anchorwand = function(aff,uses,recipe)
    31     31   	local affcolor = sorcery.lib.color(sorcery.data.affinities[aff].color)
    32     32   	return {
    33     33   		name = aff .. ' anchor';
    34         -		desc = 'With an enchanter, anchor ' .. aff .. ' spells into an object to enable it to produce preternatural effects';
           34  +		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';
    35     35   		uses = uses;
    36     36   		affinity = recipe;
    37     37   		color = affcolor;
    38     38   		sound = 'xdecor_enchanting'; -- FIXME make own
    39     39   		cast = function(ctx)
    40     40   			local node = target_node(ctx, 'sorcery:enchanter')
    41     41   			if not node then return false end
................................................................................
   112    112   					local proto = stack:get_definition()._proto
   113    113   					if proto.kind ~= spec.lens or proto.gem ~= spec.gem
   114    114   						then return false end
   115    115   				elseif spec.item then
   116    116   					default_mode = 'consume'
   117    117   					if stack:get_name() ~= spec.item then
   118    118   						return false end
          119  +					if spec.consume and stack:get_count() < spec.consume then
          120  +						return false end
   119    121   				else
   120    122   					return false
   121    123   				end
   122    124   
   123    125   				local mode
   124    126   				if spec.dmg then mode = 'dmg'
   125    127   				elseif spec.consume then mode = 'consume'
   126    128   				else mode = default_mode end
   127    129   
   128    130   				if mode == 'dmg' then
   129    131   					stack:add_wear((spec.dmg or 1) * 1000)
   130    132   					return stack
   131    133   				elseif mode == 'consume' then
          134  +					local r = sorcery.register.residue.db[stack:get_name()]
   132    135   					stack:take_item(spec.consume or 1)
          136  +					if r then
          137  +						local rs = ItemStack(r) 
          138  +						rs:set_count(rs:get_count() * (spec.consume or 1))
          139  +						if stack:is_empty()
          140  +							then stack = rs
          141  +							else minetest.add_item(ctx.target.above, rs)
          142  +						end
          143  +					end
   133    144   					return stack
   134    145   				end
   135    146   			end
   136    147   			for ench,data in pairs(sorcery.data.enchants) do
   137    148   				if data.affinity ~= aff or data.recipe == nil then goto skip end
   138    149   				local newinv = {}
   139    150   				for s,v in pairs(data.recipe) do
................................................................................
   191    202   			bolt:get_luaentity()._blastradius = radius
   192    203   			bolt:set_velocity(vel)
   193    204   		end;
   194    205   	};
   195    206   	seal = {
   196    207   		name = 'sealing';
   197    208   		color = {255,238,16};
   198         -		uses = 32;
          209  +		uses = 128;
   199    210   		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';
   200    211   		leytype = 'imperic';
   201    212   		affinity = {'pine','dark'};
   202    213   		cast = function(ctx)
   203    214   			if ctx.target == nil or ctx.target.type ~= 'node' then return false end
   204    215   			local meta = minetest.get_meta(ctx.target.under)
   205    216   			-- first we need to check if the wand has an identifying 'key' yet,
................................................................................
   252    263   		uses = 128;
   253    264   		desc = 'Reveal the strength and affinities of the local leyline';
   254    265   		cast = function(ctx)
   255    266   			local color = ctx.base.gem == 'sapphire';
   256    267   			local duration = (ctx.base.gem == 'amethyst' and 4) or 2;
   257    268   			local ley = sorcery.ley.estimate(ctx.caster:get_pos())
   258    269   
   259         -			local strength = ley.force
          270  +			local strength = ley.force * 4 * ley.force
   260    271   			if color then
   261    272   				strength = strength / #ley.aff
   262    273   				for _,a in pairs(ley.aff) do
   263         -					cast_sparkle(ctx,sorcery.lib.color(sorcery.data.affinities[a].color):brighten(1.3), strength, duration * strength)
          274  +					cast_sparkle(ctx,sorcery.lib.color(sorcery.data.affinities[a].color):brighten(1.3), strength, duration * (strength*0.5))
   264    275   				end
   265    276   			else
   266    277   				cast_sparkle(ctx,sorcery.lib.color(250,255,185), strength, duration*strength)
   267    278   			end
   268    279   
   269    280   		end;
   270    281   	};
................................................................................
   583    594   			end
   584    595   			newenergy = math.min(maxcharge, newenergy * (ctx.stats.power or 1))
   585    596   
   586    597   			sorcery.ley.setcharge(rechargee,charge + newenergy)
   587    598   			e:set_stack('item',1,rechargee)
   588    599   
   589    600   			enchantment_sparkle(ctx, sorcery.lib.color(212,6,63))
          601  +			sorcery.enchant.update_enchanter(ctx.target.under)
   590    602   		end;
   591    603   	};
   592    604   	transfer = {
   593    605   		name = 'transfer';
   594    606   		uses = 65;
   595    607   		color = {6,212,121};
   596    608   		leytype = 'syncretic';
................................................................................
   624    636   				if ctx.base.gem == 'sapphire'
   625    637   					then e.spells = {} e.energy = 0
   626    638   					else table.remove(e.spells, math.random(#e.spells))
   627    639   				end
   628    640   			end
   629    641   			sorcery.enchant.set(item,e)
   630    642   			ei:set_stack('item',1,item)
          643  +			sorcery.enchant.update_enchanter(ctx.target.under)
   631    644   			enchantment_sparkle(ctx,sorcery.lib.color(255,154,44))
   632    645   			enchantment_sparkle(ctx,sorcery.lib.color(226,44,255))
   633    646   		end;
   634    647   	};
   635    648   	divine = {
   636    649   		name = 'divining';
   637    650   		desc = 'Steal away the secrets of the cosmos';