sorcery  Diff

Differences From Artifact [dd6f797d8b]:

To Artifact [fd9aa86a12]:


   273    273   	if time and has_phial() and pow_min and not probe.disjunction then -- roll for runes
   274    274   		local phial = i:get_stack('phial',1)
   275    275   		local int, powerfac = calc_phial_props(phial)
   276    276   		local pf = phial:get_meta():get_int('force')
   277    277   		local rolls = math.floor(time/int)
   278    278   		local newrunes = {}
   279    279   		for _=1,rolls do
   280         -			print('--- rune roll',_,'pf',pf)
   281    280   			local choices = {}
   282    281   			for name,rune in pairs(sorcery.data.runes) do
   283    282   				local powreq = (rune.minpower*powerfac)*time 
   284         -				print('- rune', name)
   285         -				print('powreq',powreq)
   286         -				print('power draw',l.self.powerdraw)
   287    283   				if powreq <= l.self.powerdraw then
   288         -					print(' ! sufficient power for rune')
   289    284   					choices[#choices + 1] = rune
   290    285   				end
   291    286   			end
   292    287   			for k,v in pairs(choices) do print(' * choice',k,v.item) end
   293    288   			if #choices > 0 then
   294    289   				for try = 1,#choices do
   295         -					print(' -- try',try)
   296    290   					local _, choice = sorcery.lib.tbl.pick(choices)
   297    291   					local adjrare = math.max(2, choice.rarity - pf)
   298         -					print(choice.item,'rarity',choice.rarity, 'adjusted', adjrare)
   299    292   					if math.random(adjrare) == 1 then
   300         -						print(' ! picking ', choice.item)
   301    293   						newrunes[#newrunes + 1] = ItemStack(choice.item)
   302    294   						break
   303    295   					end
   304    296   				end
   305    297   			end
   306    298   			-- print('rune choices:',dump(choices))
   307    299   			-- print('me',dump(l.self))