sorcery  Diff

Differences From Artifact [dd6f797d8b]:

To Artifact [fd9aa86a12]:


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







<



<
<
<

<






<


<

<







273
274
275
276
277
278
279

280
281
282



283

284
285
286
287
288
289

290
291

292

293
294
295
296
297
298
299
	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
				local powreq = (rune.minpower*powerfac)*time 



				if powreq <= l.self.powerdraw then

					choices[#choices + 1] = rune
				end
			end
			for k,v in pairs(choices) do print(' * choice',k,v.item) end
			if #choices > 0 then
				for try = 1,#choices do

					local _, choice = sorcery.lib.tbl.pick(choices)
					local adjrare = math.max(2, choice.rarity - pf)

					if math.random(adjrare) == 1 then

						newrunes[#newrunes + 1] = ItemStack(choice.item)
						break
					end
				end
			end
			-- print('rune choices:',dump(choices))
			-- print('me',dump(l.self))