Differences From
Artifact [6c01c64259]:
101 101 end
102 102
103 103 local elixir_can_apply = function(elixir, potion)
104 104 -- accepts an elixir def and potion def
105 105 if elixir == nil or
106 106 potion == nil then return false end
107 107
108 - if elixir.apply and potion.on_use then
109 - -- the ingredient is an elixir and at least one potion
110 - -- is a fully enchanted, usable potion
111 - if elixir.flag and potion._proto and
112 - potion._proto['no_' .. elixir.flag] == true then
108 + if elixir.apply and potion._proto and potion._proto.quals then
109 + -- the ingredient is an elixir and at least one potion has a
110 + -- quality that can be enhanced
111 + if elixir.qual and potion._proto and not potion._proto.quals[elixir.qual] then
113 112 -- does the elixir have a property used to denote
114 113 -- compatibility? if so, check the potion to see if it's
115 114 -- marked as incompatible
116 115 return false
117 116 else
118 117 return true
119 118 end
................................................................................
122 121 return false
123 122 end
124 123
125 124 local effects_table = function(potion)
126 125 local meta = potion:get_meta()
127 126 local tbl = {}
128 127 for k,v in pairs(sorcery.data.elixirs) do
129 - if not v.flag then goto skip end
130 - local val = meta:get_int(v.flag)
128 + if not v.qual then goto skip end
129 + local val = meta:get_int(v.qual)
131 130 if val > 0 then
132 131 local aff, title, desc = v.describe(potion)
133 132 if val > 3 then title = title .. ' x' .. val
134 133 elseif val == 3 then title = 'thrice-' .. title
135 134 elseif val == 2 then title = 'twice-' .. title
136 135 end
137 136 tbl[#tbl + 1] = {
................................................................................
146 145
147 146 sorcery.alchemy.elixir_apply = function(elixir, potion)
148 147 if not potion then return end
149 148 local pdef = potion:get_definition()
150 149 if elixir_can_apply(elixir, pdef) then
151 150 elixir.apply(potion, pdef._proto)
152 151 potion:get_meta():set_string('description', sorcery.lib.ui.tooltip {
153 - title = pdef._proto.name .. ' Draught';
152 + title = string.format('%s %s', pdef._proto.name, pdef._proto.kind.label);
154 153 desc = pdef._proto.desc;
155 154 color = sorcery.lib.color(pdef._proto.color):readable();
156 155 props = effects_table(potion);
157 156 });
158 157 end
159 158 return potion
160 159 end
................................................................................
301 300 elseif r.enhance then
302 301 if fx.onenhance then out = fx.onenhance {
303 302 pos = pos;
304 303 stack = out;
305 304 potion = r.proto;
306 305 elixir = r.elixir;
307 306 } end
308 - log.act(dump(r))
309 307 log.act(string.format('an infuser at %s has enhanced a %s potion with a %s elixir',
310 308 minetest.pos_to_string(pos), out:get_name(), infusion[1]:get_name()))
311 309 end
312 310 inv:set_stack('potions',i,discharge(out))
313 311 end
314 312
315 313 inv:set_stack('infusion',1,residue)