sorcery  Diff

Differences From Artifact [65aa0a1ed6]:

To Artifact [b7d5d6135c]:


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
..
89
90
91
92
93
94
95



96
97
98
99
100
101
102
...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
...
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334



335
336
337
338
339
340
341
342
343
...
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
-- passively consumes ley-current
--  -- are phials & rune-wrenches enough for this now?

local constants = {
	rune_mine_interval = 240;
	-- how often a powered forge rolls for new runes

	rune_cache_max = 4;
	-- how many runes a runeforge can hold at a time
	
	rune_grades = {'Fragile', 'Weak', 'Ordinary', 'Pristine', 'Sublime'};
	-- how many grades of rune quality/power there are
	
	amulet_grades = {'Slight', 'Minor', 'Major', 'Grand', 'Ultimate' };
	-- what kind of amulet each rune grade translates to
................................................................................
			dist = { Fragile = 0, Weak = 1,    Ordinary = 0.9, Pristine = 0.5,  Sublime = 0.25 };
		};
		supreme  = {grade = 6, name = 'Supreme';  infusion = 'sorcery:powder_levitanium';
			dist = { Fragile = 0, Weak = 0,    Ordinary = 1,   Pristine = 0.7,  Sublime = 0.4 };
		};
	};
}
local calc_phial_props = function(phial) --> mine interval: float, time factor: float
	local m = phial:get_meta()
	local g = phial:get_definition()._proto.data.grade
	local i = constants.rune_mine_interval 
	local fac = (g-1) / 5
	fac = fac + 0.4 * m:get_int('speed')
	return i - ((i*0.5) * fac), 0.5 * fac
end
sorcery.register.runes.foreach('sorcery:generate',{},function(name,rune)
	local id = 'sorcery:rune_' .. name
	rune.image = rune.image or string.format('sorcery_rune_%s.png',name)
	rune.item = id
	local c = sorcery.lib.color(rune.tone)
	minetest.register_craftitem(id, {
................................................................................
			_proto = { id = name, desc = desc, name = p.name, kind = phkind, data = p, quals = {force = true, speed = true}, color = color };
		};
	}
	sorcery.register.infusions.link {
		infuse = p.infusion;
		into = 'sorcery:potion_subtle';
		output = 'sorcery:'..id;



	}
end

local register_rune_wrench = function(w)
	local mp = sorcery.data.metals[w.metal].parts
	minetest.register_tool(w.name, {
		description = w.desc;
................................................................................
	local base_spell = true

	if proto.frame and spell.frame and spell.frame[proto.frame] then
		local sp = spell.frame[proto.frame]
		if not sp.mingrade or rg >= sp.mingrade then
			title = sp.name or title
			desc = sp.desc or desc
			cast = sp.desc or cast
			apply = sp.apply or apply
			remove = sp.remove or remove
			mingrade = sp.mingrade or mingrade
			base_spell = false
		end
	end
	
................................................................................
			else break end
		end
	end

	has_phial = has_phial()
	local spec = string.format([[
		formspec_version[3] size[10.25,8] real_coordinates[true]
		list[context;cache;%f,0.25;%u,1;]
		list[context;amulet;3.40,1.50;1,1;]
		list[context;active;5.90,1.50;1,1;]

		list[context;wrench;1.25,1.75;1,1;]
		list[context;phial;7.25,1.75;1,1;]
		list[context;refuse;8.50,1.75;1,1;]

		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,
		((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]
................................................................................
				local max,min = 0
				for _,r in pairs(sorcery.data.runes) do
					if r.minpower > max then max = r.minpower end
					if min == nil or r.minpower < min then min = r.minpower end
				end
				-- high-quality phials reduce power usage
				local fac = select(2, calc_phial_props(phial))
				min = min * fac  max = max * fac
				return min*time,max*time
			end;
		};
		on_leychange = runeforge_update;
		recipe = {
			note = 'Periodically creates runes when sufficiently powered and can be used to imbue them into an amulet, giving it a powerful magical effect';
		};







|







 







|




|
|







 







>
>
>







 







|







 







<









>
>
>

|







 







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
..
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
...
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
...
321
322
323
324
325
326
327

328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
...
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
-- passively consumes ley-current
--  -- are phials & rune-wrenches enough for this now?

local constants = {
	rune_mine_interval = 240;
	-- how often a powered forge rolls for new runes

	rune_cache_max = 6;
	-- how many runes a runeforge can hold at a time
	
	rune_grades = {'Fragile', 'Weak', 'Ordinary', 'Pristine', 'Sublime'};
	-- how many grades of rune quality/power there are
	
	amulet_grades = {'Slight', 'Minor', 'Major', 'Grand', 'Ultimate' };
	-- what kind of amulet each rune grade translates to
................................................................................
			dist = { Fragile = 0, Weak = 1,    Ordinary = 0.9, Pristine = 0.5,  Sublime = 0.25 };
		};
		supreme  = {grade = 6, name = 'Supreme';  infusion = 'sorcery:powder_levitanium';
			dist = { Fragile = 0, Weak = 0,    Ordinary = 1,   Pristine = 0.7,  Sublime = 0.4 };
		};
	};
}
local calc_phial_props = function(phial) --> mine interval: float, power factor: float
	local m = phial:get_meta()
	local g = phial:get_definition()._proto.data.grade
	local i = constants.rune_mine_interval 
	local fac = (g-1) / 5
	fac = fac + 0.2 * m:get_int('speed')
	return math.max(3,i - ((i*0.5) * fac)), 0.5 * fac
end
sorcery.register.runes.foreach('sorcery:generate',{},function(name,rune)
	local id = 'sorcery:rune_' .. name
	rune.image = rune.image or string.format('sorcery_rune_%s.png',name)
	rune.item = id
	local c = sorcery.lib.color(rune.tone)
	minetest.register_craftitem(id, {
................................................................................
			_proto = { id = name, desc = desc, name = p.name, kind = phkind, data = p, quals = {force = true, speed = true}, color = color };
		};
	}
	sorcery.register.infusions.link {
		infuse = p.infusion;
		into = 'sorcery:potion_subtle';
		output = 'sorcery:'..id;
		_proto = {
			data = { color = color };
		};
	}
end

local register_rune_wrench = function(w)
	local mp = sorcery.data.metals[w.metal].parts
	minetest.register_tool(w.name, {
		description = w.desc;
................................................................................
	local base_spell = true

	if proto.frame and spell.frame and spell.frame[proto.frame] then
		local sp = spell.frame[proto.frame]
		if not sp.mingrade or rg >= sp.mingrade then
			title = sp.name or title
			desc = sp.desc or desc
			cast = sp.cast or cast
			apply = sp.apply or apply
			remove = sp.remove or remove
			mingrade = sp.mingrade or mingrade
			base_spell = false
		end
	end
	
................................................................................
			else break end
		end
	end

	has_phial = has_phial()
	local spec = string.format([[
		formspec_version[3] size[10.25,8] real_coordinates[true]

		list[context;amulet;3.40,1.50;1,1;]
		list[context;active;5.90,1.50;1,1;]

		list[context;wrench;1.25,1.75;1,1;]
		list[context;phial;7.25,1.75;1,1;]
		list[context;refuse;8.50,1.75;1,1;]

		list[current_player;main;0.25,3;8,4;]

		style_type[list;size=0.8]
		list[context;cache;%f,0.25;%u,1;]

		image[0.25,0.50;1,1;sorcery_statlamp_%s.png]
	]], (10.5 - 0.8*(constants.rune_cache_max*1.25))/2, constants.rune_cache_max,
		((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]
................................................................................
				local max,min = 0
				for _,r in pairs(sorcery.data.runes) do
					if r.minpower > max then max = r.minpower end
					if min == nil or r.minpower < min then min = r.minpower end
				end
				-- high-quality phials reduce power usage
				local fac = select(2, calc_phial_props(phial))
				min = min / fac  max = max / fac
				return min*time,max*time
			end;
		};
		on_leychange = runeforge_update;
		recipe = {
			note = 'Periodically creates runes when sufficiently powered and can be used to imbue them into an amulet, giving it a powerful magical effect';
		};