@@ -39,11 +39,13 @@ }; }; } local calc_phial_props = function(phial) --> mine interval: float, time factor: float + local m = phial:get_meta() local g = phial:get_definition()._proto.data.grade local i = constants.rune_mine_interval local fac = (g-1) / 5 + fac = fac + 0.4 * m:get_int('speed') return i - ((i*0.5) * fac), 0.5 * fac end sorcery.register.runes.foreach('sorcery:generate',{},function(name,rune) local id = 'sorcery:rune_' .. name @@ -58,27 +60,34 @@ groups = { sorcery_rune = 1; not_in_creative_inventory = 1; }; - _proto = { id = name, data = rune; }; + _proto = { id = name, data = rune }; }) end) + +local phkind = { + label = 'Phial'; + desc = 'An alchemical substance which rune forges consume while coalescing new runes'; +} for name,p in pairs(constants.phial_kinds) do local f = string.format local color = sorcery.lib.color(142,232,0) local fac = p.grade / 6 local id = f('phial_%s', name); + local fname = f('%s Phial',p.name); + local desc = "A powerful liquid consumed in the operation of a rune forge. Its quality determines how fast new runes can be constructed and how much energy is required by the process, and affects your odds of getting a high-quality rune." sorcery.register_potion_tbl { name = id; - label = f('%s Phial',p.name); - desc = "A powerful liquid consumed in the operation of a rune forge. Its quality determines how fast new runes can be constructed and how much energy is required by the process, and affects your odds of getting a high-quality rune."; + label = fname; + desc = desc; color = color:brighten(1 + fac*0.5); imgvariant = (fac >= 5) and 'sparkle' or 'dull'; glow = 5+p.grade; extra = { groups = { sorcery_phial = p.grade }; - _proto = { id = name, data = p }; + _proto = { id = name, desc = desc, name = p.name, kind = phkind, data = p, quals = {force = true, speed = true}, color = color }; }; } sorcery.register.infusions.link { infuse = p.infusion; @@ -258,16 +267,17 @@ if time and has_phial() and pow_min and not probe.disjunction then -- roll for runes local phial = i:get_stack('phial',1) local int, powerfac = calc_phial_props(phial) + local pf = phial:get_meta():get_int('force') local rolls = math.floor(time/int) local newrunes = {} for _=1,rolls do local choices = {} for name,rune in pairs(sorcery.data.runes) do -- print('considering',name) -- print('-- power',rune.minpower,(rune.minpower*powerfac)*time,'//',l.self.powerdraw,l.self.powerdraw/time,'free',l.freepower,'max',l.maxpower) - if (rune.minpower*powerfac)*time <= l.self.powerdraw and math.random(rune.rarity) == 1 then + if (rune.minpower*powerfac)*time <= l.self.powerdraw and math.random(rune.rarity - pf) == 1 then choices[#choices + 1] = rune end end if #choices > 0 then @@ -494,9 +504,8 @@ if fl == 'cache' then if probe.disjunction then return 0 end if tl == 'cache' then return 1 end if tl == 'active' and inv:is_empty('active') then - print(dump(wrench)) if wrench and wrench.powers.imbue and not inv:is_empty('amulet') then local amulet = inv:get_stack('amulet',1) local rune = inv:get_stack(fl,fi) local runeid = rune:get_definition()._proto.id