sorcery  Check-in [de7d27795b]

Overview
Comment:remove debug statements >_<
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: de7d27795bcc95c2f2747ec9e1d105fa30f15aa94be60446ba28e8348e726f04
User & Date: lexi on 2021-08-01 13:42:53
Other Links: manifest | tags
Context
2021-10-16
23:51
continue work on runes, comment out test code in vfx.lua check-in: 967d5006f5 user: lexi tags: trunk
2021-08-01
13:42
remove debug statements >_< check-in: de7d27795b user: lexi tags: trunk
2021-07-31
19:13
optimize pngs, finish spellshatter spell, tweak rune forge algorithm to be more fair & reasonable, new spell-casting vfx check-in: cb09c77754 user: lexi tags: trunk
Changes

Modified data/runes.lua from [4936c92bc2] to [00d856eebe].

651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
....
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
							local tex = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render();
							local epicenter = ctx.caster:get_pos() + vector.new(0, h/2, 0)
							local maxima = vector.new(radius, radius, radius)
							local potential_targets = minetest.find_nodes_in_area(epicenter - maxima, epicenter + maxima, {'group:sorcery_magical', 'group:sorcery_magitech'})
							local wreck = {}
							for _, pos in pairs(potential_targets) do
								if sorcery.lib.math.vdcomp(radius,epicenter,pos) then
									print('got wreckable at',pos)
									wreck[#wreck+1] = pos
								end
							end
							sorcery.spell.cast {
								name = 'sorcery:spellshatter';
								caster = ctx.caster;
								anchor = epicenter;
................................................................................
							local put = function(ofs)
								timeline[{whence=0,secs=per*i}] = function(s)
									local p = vector.add(w,ofs)
									if not sorcery.lib.node.is_clear(p) then return end
									spark(s, p)
									minetest.sound_play('sorcery_put', {pos = p, gain = 0.4}, true)
									local lamp = mpick 'lamp_ext'
									print('installing lamp',lamp,p,vector.new(ofs))
									put_align(p, lamp, vector.multiply(ofs,-1))
								end
								i=i+1
							end
							put{x=o.x, y=0, z=0}
							put{x=0,   y=0, z=o.z}
						end







<







 







<







651
652
653
654
655
656
657

658
659
660
661
662
663
664
....
1503
1504
1505
1506
1507
1508
1509

1510
1511
1512
1513
1514
1515
1516
							local tex = sorcery.lib.image('sorcery_sputter.png'):glow(sorcery.lib.color(160,255,80)):render();
							local epicenter = ctx.caster:get_pos() + vector.new(0, h/2, 0)
							local maxima = vector.new(radius, radius, radius)
							local potential_targets = minetest.find_nodes_in_area(epicenter - maxima, epicenter + maxima, {'group:sorcery_magical', 'group:sorcery_magitech'})
							local wreck = {}
							for _, pos in pairs(potential_targets) do
								if sorcery.lib.math.vdcomp(radius,epicenter,pos) then

									wreck[#wreck+1] = pos
								end
							end
							sorcery.spell.cast {
								name = 'sorcery:spellshatter';
								caster = ctx.caster;
								anchor = epicenter;
................................................................................
							local put = function(ofs)
								timeline[{whence=0,secs=per*i}] = function(s)
									local p = vector.add(w,ofs)
									if not sorcery.lib.node.is_clear(p) then return end
									spark(s, p)
									minetest.sound_play('sorcery_put', {pos = p, gain = 0.4}, true)
									local lamp = mpick 'lamp_ext'

									put_align(p, lamp, vector.multiply(ofs,-1))
								end
								i=i+1
							end
							put{x=o.x, y=0, z=0}
							put{x=0,   y=0, z=o.z}
						end

Modified runeforge.lua from [dd6f797d8b] to [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))