Differences From
Artifact [69ba246df3]:
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 42 local calc_phial_props = function(phial) --> mine interval: float, time factor: float
43 + local m = phial:get_meta()
43 44 local g = phial:get_definition()._proto.data.grade
44 45 local i = constants.rune_mine_interval
45 46 local fac = (g-1) / 5
47 + fac = fac + 0.4 * m:get_int('speed')
46 48 return i - ((i*0.5) * fac), 0.5 * fac
47 49 end
48 50 sorcery.register.runes.foreach('sorcery:generate',{},function(name,rune)
49 51 local id = 'sorcery:rune_' .. name
50 52 rune.image = rune.image or string.format('sorcery_rune_%s.png',name)
51 53 rune.item = id
52 54 local c = sorcery.lib.color(rune.tone)
................................................................................
55 57 short_description = rune.name .. ' Rune';
56 58 inventory_image = rune.image;
57 59 stack_max = 1;
58 60 groups = {
59 61 sorcery_rune = 1;
60 62 not_in_creative_inventory = 1;
61 63 };
62 - _proto = { id = name, data = rune; };
64 + _proto = { id = name, data = rune };
63 65 })
64 66 end)
67 +
68 +local phkind = {
69 + label = 'Phial';
70 + desc = 'An alchemical substance which rune forges consume while coalescing new runes';
71 +}
65 72
66 73 for name,p in pairs(constants.phial_kinds) do
67 74 local f = string.format
68 75 local color = sorcery.lib.color(142,232,0)
69 76 local fac = p.grade / 6
70 77 local id = f('phial_%s', name);
78 + local fname = f('%s Phial',p.name);
79 + 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."
71 80 sorcery.register_potion_tbl {
72 81 name = id;
73 - label = f('%s Phial',p.name);
74 - 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.";
82 + label = fname;
83 + desc = desc;
75 84 color = color:brighten(1 + fac*0.5);
76 85 imgvariant = (fac >= 5) and 'sparkle' or 'dull';
77 86 glow = 5+p.grade;
78 87 extra = {
79 88 groups = { sorcery_phial = p.grade };
80 - _proto = { id = name, data = p };
89 + _proto = { id = name, desc = desc, name = p.name, kind = phkind, data = p, quals = {force = true, speed = true}, color = color };
81 90 };
82 91 }
83 92 sorcery.register.infusions.link {
84 93 infuse = p.infusion;
85 94 into = 'sorcery:potion_subtle';
86 95 output = 'sorcery:'..id;
87 96 }
................................................................................
255 264 local pow_min = l.self.powerdraw >= l.self.minpower
256 265 local pow_max = l.self.powerdraw >= l.self.maxpower
257 266 local has_phial = function() return not i:is_empty('phial') end
258 267
259 268 if time and has_phial() and pow_min and not probe.disjunction then -- roll for runes
260 269 local phial = i:get_stack('phial',1)
261 270 local int, powerfac = calc_phial_props(phial)
271 + local pf = phial:get_meta():get_int('force')
262 272 local rolls = math.floor(time/int)
263 273 local newrunes = {}
264 274 for _=1,rolls do
265 275 local choices = {}
266 276 for name,rune in pairs(sorcery.data.runes) do
267 277 -- print('considering',name)
268 278 -- print('-- power',rune.minpower,(rune.minpower*powerfac)*time,'//',l.self.powerdraw,l.self.powerdraw/time,'free',l.freepower,'max',l.maxpower)
269 - if (rune.minpower*powerfac)*time <= l.self.powerdraw and math.random(rune.rarity) == 1 then
279 + if (rune.minpower*powerfac)*time <= l.self.powerdraw and math.random(rune.rarity - pf) == 1 then
270 280 choices[#choices + 1] = rune
271 281 end
272 282 end
273 283 if #choices > 0 then
274 284 -- if multiple runes were rolled up, be nice to the player
275 285 -- and pick the rarest one to give them
276 286 local rare, choice = 0
................................................................................
491 501 local wrench if not inv:is_empty('wrench') then
492 502 wrench = inv:get_stack('wrench',1):get_definition()._proto
493 503 end
494 504 if fl == 'cache' then
495 505 if probe.disjunction then return 0 end
496 506 if tl == 'cache' then return 1 end
497 507 if tl == 'active' and inv:is_empty('active') then
498 - print(dump(wrench))
499 508 if wrench and wrench.powers.imbue and not inv:is_empty('amulet') then
500 509 local amulet = inv:get_stack('amulet',1)
501 510 local rune = inv:get_stack(fl,fi)
502 511 local runeid = rune:get_definition()._proto.id
503 512 local runegrade = rune:get_meta():get_int('rune_grade')
504 513 if sorcery.data.runes[runeid].amulets[amulet:get_definition()._sorcery.amulet.base] then
505 514 local spell do -- haaaack