@@ -50,9 +50,9 @@ end) for name,p in pairs(constants.phial_kinds) do local f = string.format - local color = sorcery.lib.color(204,38,235) + local color = sorcery.lib.color(142,232,0) local fac = p.grade / 6 local id = f('phial_%s', name); sorcery.register_potion_tbl { name = id; @@ -229,35 +229,45 @@ base_spell = base_spell; } end - local runeforge_update = function(pos,time) local m = minetest.get_meta(pos) local i = m:get_inventory() local l = sorcery.ley.netcaps(pos,time or 1) + local probe = sorcery.spell.probe(pos) local pow_min = l.self.powerdraw >= l.self.minpower local pow_max = l.self.powerdraw >= l.self.maxpower local has_phial = function() return not i:is_empty('phial') end - if time and has_phial() and pow_min then -- roll for runes + if time and has_phial() and pow_min and not probe.disjunction then -- roll for runes local int, powerfac = calc_phial_props(i:get_stack('phial',1)) 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) + -- 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 - local n = ItemStack(rune.item) - choices[#choices + 1] = n + choices[#choices + 1] = rune + end + end + if #choices > 0 then + -- if multiple runes were rolled up, be nice to the player + -- and pick the rarest one to give them + local rare, choice = 0 + for i,c in pairs(choices) do + if c.rarity > rare then + rare = c.rarity + choice = c + end end + newrunes[#newrunes + 1] = ItemStack(choice.item) end - if #choices > 0 then newrunes[#newrunes + 1] = choices[math.random(#choices)] end - print('rune choices:',dump(choices)) - print('me',dump(l.self)) + -- print('rune choices:',dump(choices)) + -- print('me',dump(l.self)) end for _,r in pairs(newrunes) do if i:room_for_item('cache',r) and has_phial() then @@ -287,10 +297,11 @@ list[current_player;main;0.25,3;8,4;] image[0.25,0.50;1,1;sorcery_statlamp_%s.png] ]], (10.5 - constants.rune_cache_max*1.25)/2, constants.rune_cache_max, - ((has_phial and pow_max) and 'green' ) or - ((has_phial and pow_min) and 'yellow') or 'off') + ((not (has_phial and pow_min)) and 'off' ) or + ( probe.disjunction and 'blue' ) or + ((has_phial and pow_max) and 'green') or 'yellow') local ghost = function(slot,x,y,img) if i:is_empty(slot) then spec = spec .. string.format([[ image[%f,%f;1,1;%s.png] @@ -449,12 +460,14 @@ return 0 end; allow_metadata_inventory_move = function(pos, fl,fi, tl,ti, count, user) local inv = minetest.get_meta(pos):get_inventory() + local probe = sorcery.spell.probe(pos) local wrench if not inv:is_empty('wrench') then wrench = inv:get_stack('wrench',1):get_definition()._proto end 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 @@ -477,8 +490,9 @@ end end end if fl == 'active' then + if probe.disjunction then return 0 end if tl == 'cache' and wrench and (wrench.powers.extract or wrench.powers.purge) then return 1 end end return 0 end;