sorcery  Diff

Differences From Artifact [65aa0a1ed6]:

To Artifact [b7d5d6135c]:


     5      5   -- passively consumes ley-current
     6      6   --  -- are phials & rune-wrenches enough for this now?
     7      7   
     8      8   local constants = {
     9      9   	rune_mine_interval = 240;
    10     10   	-- how often a powered forge rolls for new runes
    11     11   
    12         -	rune_cache_max = 4;
           12  +	rune_cache_max = 6;
    13     13   	-- how many runes a runeforge can hold at a time
    14     14   	
    15     15   	rune_grades = {'Fragile', 'Weak', 'Ordinary', 'Pristine', 'Sublime'};
    16     16   	-- how many grades of rune quality/power there are
    17     17   	
    18     18   	amulet_grades = {'Slight', 'Minor', 'Major', 'Grand', 'Ultimate' };
    19     19   	-- what kind of amulet each rune grade translates to
................................................................................
    35     35   			dist = { Fragile = 0, Weak = 1,    Ordinary = 0.9, Pristine = 0.5,  Sublime = 0.25 };
    36     36   		};
    37     37   		supreme  = {grade = 6, name = 'Supreme';  infusion = 'sorcery:powder_levitanium';
    38     38   			dist = { Fragile = 0, Weak = 0,    Ordinary = 1,   Pristine = 0.7,  Sublime = 0.4 };
    39     39   		};
    40     40   	};
    41     41   }
    42         -local calc_phial_props = function(phial) --> mine interval: float, time factor: float
           42  +local calc_phial_props = function(phial) --> mine interval: float, power factor: float
    43     43   	local m = phial:get_meta()
    44     44   	local g = phial:get_definition()._proto.data.grade
    45     45   	local i = constants.rune_mine_interval 
    46     46   	local fac = (g-1) / 5
    47         -	fac = fac + 0.4 * m:get_int('speed')
    48         -	return i - ((i*0.5) * fac), 0.5 * fac
           47  +	fac = fac + 0.2 * m:get_int('speed')
           48  +	return math.max(3,i - ((i*0.5) * fac)), 0.5 * fac
    49     49   end
    50     50   sorcery.register.runes.foreach('sorcery:generate',{},function(name,rune)
    51     51   	local id = 'sorcery:rune_' .. name
    52     52   	rune.image = rune.image or string.format('sorcery_rune_%s.png',name)
    53     53   	rune.item = id
    54     54   	local c = sorcery.lib.color(rune.tone)
    55     55   	minetest.register_craftitem(id, {
................................................................................
    89     89   			_proto = { id = name, desc = desc, name = p.name, kind = phkind, data = p, quals = {force = true, speed = true}, color = color };
    90     90   		};
    91     91   	}
    92     92   	sorcery.register.infusions.link {
    93     93   		infuse = p.infusion;
    94     94   		into = 'sorcery:potion_subtle';
    95     95   		output = 'sorcery:'..id;
           96  +		_proto = {
           97  +			data = { color = color };
           98  +		};
    96     99   	}
    97    100   end
    98    101   
    99    102   local register_rune_wrench = function(w)
   100    103   	local mp = sorcery.data.metals[w.metal].parts
   101    104   	minetest.register_tool(w.name, {
   102    105   		description = w.desc;
................................................................................
   231    234   	local base_spell = true
   232    235   
   233    236   	if proto.frame and spell.frame and spell.frame[proto.frame] then
   234    237   		local sp = spell.frame[proto.frame]
   235    238   		if not sp.mingrade or rg >= sp.mingrade then
   236    239   			title = sp.name or title
   237    240   			desc = sp.desc or desc
   238         -			cast = sp.desc or cast
          241  +			cast = sp.cast or cast
   239    242   			apply = sp.apply or apply
   240    243   			remove = sp.remove or remove
   241    244   			mingrade = sp.mingrade or mingrade
   242    245   			base_spell = false
   243    246   		end
   244    247   	end
   245    248   	
................................................................................
   318    321   			else break end
   319    322   		end
   320    323   	end
   321    324   
   322    325   	has_phial = has_phial()
   323    326   	local spec = string.format([[
   324    327   		formspec_version[3] size[10.25,8] real_coordinates[true]
   325         -		list[context;cache;%f,0.25;%u,1;]
   326    328   		list[context;amulet;3.40,1.50;1,1;]
   327    329   		list[context;active;5.90,1.50;1,1;]
   328    330   
   329    331   		list[context;wrench;1.25,1.75;1,1;]
   330    332   		list[context;phial;7.25,1.75;1,1;]
   331    333   		list[context;refuse;8.50,1.75;1,1;]
   332    334   
   333    335   		list[current_player;main;0.25,3;8,4;]
   334    336   
          337  +		style_type[list;size=0.8]
          338  +		list[context;cache;%f,0.25;%u,1;]
          339  +
   335    340   		image[0.25,0.50;1,1;sorcery_statlamp_%s.png]
   336         -	]], (10.5 - constants.rune_cache_max*1.25)/2, constants.rune_cache_max,
          341  +	]], (10.5 - 0.8*(constants.rune_cache_max*1.25))/2, constants.rune_cache_max,
   337    342   		((not (has_phial and pow_min)) and 'off'  ) or
   338    343   		( probe.disjunction            and 'blue' ) or
   339    344   	    ((has_phial and pow_max)       and 'green') or 'yellow')
   340    345   
   341    346   	local ghost = function(slot,x,y,img)
   342    347   		if i:is_empty(slot) then spec = spec .. string.format([[
   343    348   			image[%f,%f;1,1;%s.png]
................................................................................
   397    402   				local max,min = 0
   398    403   				for _,r in pairs(sorcery.data.runes) do
   399    404   					if r.minpower > max then max = r.minpower end
   400    405   					if min == nil or r.minpower < min then min = r.minpower end
   401    406   				end
   402    407   				-- high-quality phials reduce power usage
   403    408   				local fac = select(2, calc_phial_props(phial))
   404         -				min = min * fac  max = max * fac
          409  +				min = min / fac  max = max / fac
   405    410   				return min*time,max*time
   406    411   			end;
   407    412   		};
   408    413   		on_leychange = runeforge_update;
   409    414   		recipe = {
   410    415   			note = 'Periodically creates runes when sufficiently powered and can be used to imbue them into an amulet, giving it a powerful magical effect';
   411    416   		};