Overview
Comment: | add background noise for condensers (temporary hack, need to write a proper environment sound framework as the fucking env_sounds module is completely impossible to extend), fix a couple of really stupid bugs, make higher-quality phials increase the chance of getting good runes so it's not a complete waste to burn iridium or levitanium powder on making them, add targeted disjunction and some other amulet spells |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
15f176a7fefa031a320ed873892e85e5 |
User & Date: | lexi on 2020-10-31 19:49:49 |
Other Links: | manifest | tags |
Context
2021-04-21
| ||
01:32 | ui tweaks, rework enchantment slightly check-in: 41fdb5b0b8 user: lexi tags: trunk | |
2020-10-31
| ||
19:49 | add background noise for condensers (temporary hack, need to write a proper environment sound framework as the fucking env_sounds module is completely impossible to extend), fix a couple of really stupid bugs, make higher-quality phials increase the chance of getting good runes so it's not a complete waste to burn iridium or levitanium powder on making them, add targeted disjunction and some other amulet spells check-in: 15f176a7fe user: lexi tags: trunk | |
2020-10-30
| ||
19:03 | squish oversized sound effect check-in: b96185e88b user: lexi tags: trunk | |
Changes
Modified data/runes.lua from [3a290dc995] to [56e196edd6].
97 98 99 100 101 102 103 104 105 106 107 108 109 110 ... 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 ... 161 162 163 164 165 166 167 168 169 170 171 172 173 174 ... 194 195 196 197 198 199 200 201 202 203 204 205 206 207 ... 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 ... 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 ... 881 882 883 884 885 886 887 888 889 890 891 892 893 894 ... 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 |
sounds = { [0] = { sound = 'sorcery_stutter', pos = 'subjects' }; }; } end end end return { translocate = { name = 'Translocate'; tone = {0,235,233}; minpower = 3; rarity = 7; amulets = { ................................................................................ else ctx.sparkle = false end end; frame = { tungsten = { name = 'Quick Joining'; desc = 'Give this amulet to another and they can arrive safely at your side almost instantaneously from anywhere in the world — though returning whence they came may be a more difficult matter'; }; gold = { name = 'Exchange'; desc = 'Give this amulet to another and they will be able to trade places with you no matter where in the world each of you might be.'; }; cobalt = { name = 'Sending'; ................................................................................ end; cast = function(ctx) if not ctx.meta:contains('rune_return_dest') then local pos = ctx.caster:get_pos() ctx.meta:set_string('rune_return_dest',minetest.pos_to_string(pos)) return true -- play effects but do not break spell else local pos = minetest.string_to_pos(ctx.meta:get_string('rune_return_dest')) ctx.meta:set_string('rune_return_dest','') local subjects = { ctx.caster } local center = ctx.caster:get_pos() ctx.sparkle = false local delay = math.max(3,10 - ctx.stats.power) + 3*(math.random()*2-1) teleport(ctx,{{ref=ctx.caster}},delay,pos) ................................................................................ desc = 'Use this amulet once to bind it to a particular point in the world, then use it again to seize up everyone surrounding you in the grip of a fearsome magic that will deport them all in the blink of an eye to whatever destination you have chosen'; }; }; }; ruby = minetest.get_modpath('beds') and { name = 'Escape'; desc = 'Immediately transport yourself out of a dangerous situation back to the last place you slept, before anyone has time to net you in a disjunction'; cast = function(ctx) -- if not beds.spawns then beds.read_spawns() end local subjects = {ctx.caster} for _,s in pairs(subjects) do local spp = beds.spawn[ctx.caster:get_player_name()] if spp then local oldpos = s:get_pos() ................................................................................ sapphire = { name = 'Unsealing'; desc = 'Wielding this amulet, a touch of your hand will unravel even the mightiest protective magics, leaving doors unsealed and walls free to tear down'; }; amethyst = { name = 'Purging'; desc = 'Free yourself from the grip of any malicious spellwork with a snap of your fingers — interrupting all of your own active spells in the process, including impending translocations'; cast = function(ctx) local h = ctx.heading.eyeheight * 1.1 minetest.add_particlespawner { time = 0.2, amount = math.random(200,250), attached = ctx.caster; glow = 14, texture = sorcery.vfx.glowspark(sorcery.lib.color(156,255,10)):render(); minpos = {x = -0.3, y = -0.5, z = -0.3}; maxpos = {x = 0.3, y = h, z = 0.3}; minvel = {x = -1.8, y = -1.8, z = -1.8}; maxvel = {x = 1.8, y = 1.8, z = 1.8}; minsize = 0.2, maxsize = 5; animation = { type = 'vertical_frames', length = 4.1; aspect_w = 16, aspect_h = 16; }; minexptime = 2, maxexptime = 4; } minetest.sound_play('sorcery_disjoin',{object=ctx.caster},true) sorcery.spell.disjoin{target=ctx.caster} end; }; emerald = { name = 'Disjunction Field'; desc = 'Render an area totally opaque to spellwork for a period of time, disrupting any existing spells and preventing further spellcasting therein'; }; ruby = { name = 'Disjunction'; desc = 'Wield this amulet against a spellcaster to disrupt and abort all their spells in progress, perhaps to trap a foe intent on translocating away, or unleash its force upon the victim of a malign hex to free them from its clutches'; frame = { iridium = { name = 'Nullification'; desc = 'Not only will your victim\'s spells be nullified, but all enchanted objects they carry will be stripped of their power — or possibly even destroyed outright'; }; }; }; luxite = { name = 'Disjunctive Aura'; desc = 'For a time, all magic undertaken in your vicinity will fail totally — including your own'; ................................................................................ mingrade = 4; name = 'Duplication'; desc = 'Bring an exact twin of any object or item into existence, no matter how common or rare it might be'; cast = function(ctx) local color = sorcery.lib.color(255,61,205) local dup, sndpos, anchor, sbj, ty if ctx.target.type == 'object' and ctx.target.ref:get_luaentity().name == '__builtin:item' then sorcery.vfx.imbue(color, ctx.target.ref) sndpos = 'subjects' sbj = {{player = ctx.target.ref}} local item = ItemStack(ctx.target.ref:get_luaentity().itemstring) local r = function() return math.random() * 2 - 1 end local putpos = vector.offset(ctx.target.ref:get_pos(), r(), 1, r()) dup = function() item:set_count(1) -- nice try bouge-san ................................................................................ vp[#vp+1] = sum end end if #vp > 0 then npos=vp[math.random(#vp)] end end if npos then minetest.set_node(npos, minetest.get_node(ctx.target.under)) minetest.get_meta(npos):from_table(origmeta) return npos, true else local nstack = ItemStack(ty) nstack:get_meta():from_table(origmeta) local leftover = ctx.caster:get_inventory():add_item('main',nstack) if leftover and not leftover.is_empty() then ................................................................................ tone = {255,194,0}; minpower = 1; rarity = 5; amulets = { luxite = { name = 'Glow'; desc = 'Swathe yourself in an aura of sparkling radiance, casting light upon all the dark places where you voyage'; iridium = { name = 'Aura'; desc = 'Dazzling golden luminance emanates from the bodies of all those around you, and you walk in light even amid the darkest depths of the earth'; }; }; diamond = { name = 'Radiance'; desc = 'Set the air around you alight with a mystic luminance, letting you see clearly a great distance in every direction for several minutes'; frame = { iridium = { name = 'Sunshine'; mingrade = 5; desc = 'Unleash the power of this amulet to seize ultimate control over the forces of nature and summon the Sun high into the nighttime sky'; }; }; }; }; }; dominate = { name = 'Dominate'; |
> > > > > > > > > > > > > > > > > > > > > | > > | < < < < < < < < < < < < < < < < < < > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 ... 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 ... 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 ... 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 ... 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 ... 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 ... 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 ... 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 |
sounds = { [0] = { sound = 'sorcery_stutter', pos = 'subjects' }; }; } end end end local purge = function(target) local h = target:get_properties().eye_height * 1.1 minetest.add_particlespawner { time = 0.2, amount = math.random(200,250), attached = target; glow = 14, texture = sorcery.vfx.glowspark(sorcery.lib.color(156,255,10)):render(); minpos = {x = -0.3, y = -0.5, z = -0.3}; maxpos = {x = 0.3, y = h, z = 0.3}; minvel = {x = -1.8, y = -1.8, z = -1.8}; maxvel = {x = 1.8, y = 1.8, z = 1.8}; minsize = 0.2, maxsize = 5; animation = { type = 'vertical_frames', length = 4.1; aspect_w = 16, aspect_h = 16; }; minexptime = 2, maxexptime = 4; } minetest.sound_play('sorcery_disjoin',{object=target},true) sorcery.spell.disjoin{target=target} end return { translocate = { name = 'Translocate'; tone = {0,235,233}; minpower = 3; rarity = 7; amulets = { ................................................................................ else ctx.sparkle = false end end; frame = { tungsten = { name = 'Quick Joining'; desc = 'Give this amulet to another and they can arrive safely at your side almost instantaneously from anywhere at all in the world — though returning whence they came may be a more difficult matter'; }; gold = { name = 'Exchange'; desc = 'Give this amulet to another and they will be able to trade places with you no matter where in the world each of you might be.'; }; cobalt = { name = 'Sending'; ................................................................................ end; cast = function(ctx) if not ctx.meta:contains('rune_return_dest') then local pos = ctx.caster:get_pos() ctx.meta:set_string('rune_return_dest',minetest.pos_to_string(pos)) return true -- play effects but do not break spell else if ctx.caster:get_attach() ~= nil then return false end local pos = minetest.string_to_pos(ctx.meta:get_string('rune_return_dest')) ctx.meta:set_string('rune_return_dest','') local subjects = { ctx.caster } local center = ctx.caster:get_pos() ctx.sparkle = false local delay = math.max(3,10 - ctx.stats.power) + 3*(math.random()*2-1) teleport(ctx,{{ref=ctx.caster}},delay,pos) ................................................................................ desc = 'Use this amulet once to bind it to a particular point in the world, then use it again to seize up everyone surrounding you in the grip of a fearsome magic that will deport them all in the blink of an eye to whatever destination you have chosen'; }; }; }; ruby = minetest.get_modpath('beds') and { name = 'Escape'; desc = 'Immediately transport yourself out of a dangerous situation back to the last place you slept, before anyone has time to net you in a disjunction'; mingrade = 4; cast = function(ctx) -- if not beds.spawns then beds.read_spawns() end local subjects = {ctx.caster} for _,s in pairs(subjects) do local spp = beds.spawn[ctx.caster:get_player_name()] if spp then local oldpos = s:get_pos() ................................................................................ sapphire = { name = 'Unsealing'; desc = 'Wielding this amulet, a touch of your hand will unravel even the mightiest protective magics, leaving doors unsealed and walls free to tear down'; }; amethyst = { name = 'Purging'; desc = 'Free yourself from the grip of any malicious spellwork with a snap of your fingers — interrupting all of your own active spells in the process, including impending translocations'; cast = function(ctx) purge(ctx.caster) end; }; emerald = { name = 'Disjunction Field'; desc = 'Render an area totally opaque to spellwork for a period of time, disrupting any existing spells and preventing further spellcasting therein'; }; ruby = { name = 'Disjunction'; desc = 'Wield this amulet against a spellcaster to disrupt and abort all their spells in progress, perhaps to trap a foe intent on translocating away, or unleash its force upon the victim of a malign hex to free them from its clutches'; mingrade = 3; cast = function(ctx) if ctx.target.type == 'object' then purge(ctx.target.ref) else return false end end; frame = { iridium = { name = 'Nullification'; mingrade = 5; desc = 'Not only will your victim\'s spells be nullified, but all enchanted objects they carry will be stripped of their power — or possibly even destroyed outright'; }; }; }; luxite = { name = 'Disjunctive Aura'; desc = 'For a time, all magic undertaken in your vicinity will fail totally — including your own'; ................................................................................ mingrade = 4; name = 'Duplication'; desc = 'Bring an exact twin of any object or item into existence, no matter how common or rare it might be'; cast = function(ctx) local color = sorcery.lib.color(255,61,205) local dup, sndpos, anchor, sbj, ty if ctx.target.type == 'object' and ctx.target.ref:get_luaentity().name == '__builtin:item' then -- sorcery.vfx.imbue(color, ctx.target.ref) -- causes graphics card problems??? sndpos = 'subjects' sbj = {{player = ctx.target.ref}} local item = ItemStack(ctx.target.ref:get_luaentity().itemstring) local r = function() return math.random() * 2 - 1 end local putpos = vector.offset(ctx.target.ref:get_pos(), r(), 1, r()) dup = function() item:set_count(1) -- nice try bouge-san ................................................................................ vp[#vp+1] = sum end end if #vp > 0 then npos=vp[math.random(#vp)] end end if npos then minetest.set_node(npos, minetest.get_node(ctx.target.under)) if minetest.registered_nodes[ty].on_construct then minetest.registered_nodes[ty].on_construct(npos) end minetest.get_meta(npos):from_table(origmeta) return npos, true else local nstack = ItemStack(ty) nstack:get_meta():from_table(origmeta) local leftover = ctx.caster:get_inventory():add_item('main',nstack) if leftover and not leftover.is_empty() then ................................................................................ tone = {255,194,0}; minpower = 1; rarity = 5; amulets = { luxite = { name = 'Glow'; desc = 'Swathe yourself in an aura of sparkling radiance, casting light upon all the dark places where you voyage'; cast = function(ctx) local fac = (ctx.stats.power * 0.1) local radius = 2 + 5*fac local period = 0.4 - 0.3*fac local glowduration = 5 + 50*fac sorcery.spell.cast { name = "sorcery:glow"; caster = ctx.caster; subjects = {{player=ctx.caster}}; duration = 40 + 120*fac; nodes = {}; disjoin = function(self) for _,n in pairs(self.nodes) do if sorcery.lib.str.beginswith(minetest.get_node(n).name,'sorcery:air_glimmer_') then minetest.remove_node(n) end end end; intervals = { {period = period, after = {whence=0,secs=0.7}, fn = function(c) print('cycling!') for _,sub in pairs(c.spell.subjects) do local ox, oy, oz = math.random(-radius,radius), math.random(-radius,radius), math.random(-radius,radius) local pos = vector.offset(sub.player:get_pos(), ox,oy,oz) print('pos',minetest.pos_to_string(pos),'player',minetest.pos_to_string(sub.player:get_pos())) if sorcery.lib.node.is_air(pos) then print('is air!') local power = math.random(4,minetest.LIGHT_MAX) minetest.set_node(pos, { name = 'sorcery:air_glimmer_' .. tostring(power); }) c.spell.nodes[#c.spell.nodes + 1] = pos local d = glowduration * (0.5 + math.random()*0.5) local m = minetest.get_meta(pos) m:set_float('duration', d) m:set_float('timeleft', d) m:set_int('power', power) else print('not air!', dump(minetest.get_node(pos))) end end end}; }; } end; iridium = { name = 'Aura'; desc = 'Dazzling golden luminance emanates from the bodies of all those around you, and you walk in light even amid the darkest depths of the earth'; }; }; diamond = { name = 'Radiance'; desc = 'Set the air around you alight with a mystic luminance, letting you see clearly a great distance in every direction for several minutes'; frame = { iridium = { name = 'Sunshine'; mingrade = 5; desc = 'Unleash the power of this amulet to seize ultimate control over the forces of nature and summon the Sun high into the nighttime sky'; cast = function(ctx) local time = minetest.get_timeofday() if not (time < 0.3 or time > 0.7) then return false end local diff = 0.5 - time local frames = 40 local duration = 1.5 local delta = diff / frames local tl = {} for i=1,frames do local wh = {whence=0, secs=duration*(i/frames)} tl[wh] = function(s) minetest.set_timeofday(time + delta*i) end end sorcery.spell.cast { name = 'sorcery:sunshine'; caster = ctx.caster; timeline = tl; duration = duration; } end; }; }; }; }; }; dominate = { name = 'Dominate'; |
Modified data/spells.lua from [16c84d9b57] to [dffc43152b].
781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
local delta = vector.subtract(pos,center)
local near = 1 - (delta.x^2 + delta.y^2 + delta.z^2)/(range^2)
if minetest.get_node(pos).name == 'air' then
minetest.set_node(pos,{name='sorcery:air_glimmer_' .. tostring(lum)})
do local lm = minetest.get_meta(pos)
lm:set_float('duration',duration)
lm:set_float('timeleft',duration)
lm:set_float('power',lum * near)
end
end
end
end;
};
}
|
| |
781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
local delta = vector.subtract(pos,center)
local near = 1 - (delta.x^2 + delta.y^2 + delta.z^2)/(range^2)
if minetest.get_node(pos).name == 'air' then
minetest.set_node(pos,{name='sorcery:air_glimmer_' .. tostring(lum)})
do local lm = minetest.get_meta(pos)
lm:set_float('duration',duration)
lm:set_float('timeleft',duration)
lm:set_int('power',lum * near)
end
end
end
end;
};
}
|
Modified leylines.lua from [fd8a9ad01c] to [a8ee2829a5].
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
sorcery.ley.estimate = function(pos) local affs = { 'praxic'; 'counterpraxic'; 'cognic'; 'mandatic'; 'occlutic'; 'imperic'; 'syncretic'; 'entropic'; }; local forcemap = minetest.get_perlin(0xe9a01d, 3, 2, 150) local aff1map = minetest.get_perlin(0x10eb03, 3, 2, 300) local aff2map = minetest.get_perlin(0x491e12, 3, 2, 240) local txpos = { --- :( :( :( :( x = pos.x; y = pos.z; z = pos.y; } local normalize = function(map) local v = map:get_2d(txpos) return (v + 6) / 12 -- seriously?? end ................................................................................ end; }; recipe = { note = 'Captures radiant force and suffuses it through distribution net. Energy production varies with local leyline strength.'; }; }; }) end minetest.register_craft { output = 'sorcery:condenser'; recipe = { {'sorcery:accumulator'}; {'sorcery:conduit'}; |
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
sorcery.ley.estimate = function(pos) local affs = { 'praxic'; 'counterpraxic'; 'cognic'; 'mandatic'; 'occlutic'; 'imperic'; 'syncretic'; 'entropic'; }; local forcemap = minetest.get_perlin(0xe9a01d, 3, 2, 150) local aff1map = minetest.get_perlin(0x10eb03, 3, 2, 300) local aff2map = minetest.get_perlin(0x491e12, 3, 2, 240) local txpos = { x = pos.x; y = pos.z; --- :( :( :( :( z = pos.y; } local normalize = function(map) local v = map:get_2d(txpos) return (v + 6) / 12 -- seriously?? end ................................................................................ end; }; recipe = { note = 'Captures radiant force and suffuses it through distribution net. Energy production varies with local leyline strength.'; }; }; }) minetest.register_abm { name = 'Condenser sound effects'; nodenames = {'sorcery:condenser'}; neighbors = {'group:sorcery_ley_device'}; interval = 5.6, chance = 1, catch_up = false; action = function(pos) local force = sorcery.ley.estimate(pos).force minetest.sound_play('sorcery_condenser_bg', { pos = pos, max_hear_distance = 5 + 8*force, gain = force*0.3; }) end; } end minetest.register_craft { output = 'sorcery:condenser'; recipe = { {'sorcery:accumulator'}; {'sorcery:conduit'}; |
Modified lib/node.lua from [4b89fedafd] to [b8ef82adf6].
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
end;
is_air = function(pos)
local n = sorcery.lib.node.force(pos)
if n.name == 'air' then return true end
local d = minetest.registered_nodes[n.name]
if not d then return false end
return not d.walkable
end;
is_clear = function(pos)
if not sorcery.lib.node.is_air(pos) then return false end
local ents = minetest.get_objects_inside_radius(pos,0.5)
if #ents > 0 then return false end
return true
|
| |
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
end;
is_air = function(pos)
local n = sorcery.lib.node.force(pos)
if n.name == 'air' then return true end
local d = minetest.registered_nodes[n.name]
if not d then return false end
return (d.walkable == false) and (d.drawtype == 'airlike' or d.buildable_to == true)
end;
is_clear = function(pos)
if not sorcery.lib.node.is_air(pos) then return false end
local ents = minetest.get_objects_inside_radius(pos,0.5)
if #ents > 0 then return false end
return true
|
Modified runeforge.lua from [f2cf52d41a] to [4e5c236dfa].
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 .. 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 ... 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 ... 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 ... 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
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 phial_kinds = { lesser = {grade = 1; name = 'Lesser'; infusion = 'sorcery:powder_brass'}; simple = {grade = 2; name = 'Simple'; infusion = 'sorcery:powder_silver'}; great = {grade = 3; name = 'Great'; infusion = 'sorcery:powder_gold'}; splendid = {grade = 4; name = 'Splendid'; infusion = 'sorcery:powder_electrum'}; exalted = {grade = 5; name = 'Exalted'; infusion = 'sorcery:powder_levitanium'}; supreme = {grade = 6; name = 'Supreme'; infusion = 'sorcery:essence_force'}; }; } local calc_phial_props = function(phial) --> mine interval: float, time factor: float local g = phial:get_definition()._proto.data.grade local i = constants.rune_mine_interval local fac = (g-1) / 5 return i - ((i*0.5) * fac), 0.5 * fac ................................................................................ local f = string.format 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; label = f('%s Phial',p.name); desc = "A powerful liquid consumed in the operation of a rune forge. Its quality determines how fast new runes can be constructed and how much energy is required by the process."; color = color:brighten(1 + fac*0.5); imgvariant = (fac >= 5) and 'sparkle' or 'dull'; glow = 5+p.grade; extra = { groups = { sorcery_phial = p.grade }; _proto = { id = name, data = p }; }; ................................................................................ end sorcery.amulet.getspell = function(stack) local m = stack:get_meta() local proto = stack:get_definition()._sorcery.amulet if not m:contains('amulet_rune') then return nil end local rune = m:get_string('amulet_rune') local rg = m:get_string('amulet_rune_grade') local rd = sorcery.data.runes[rune] local spell = rd.amulets[proto.base] if not spell then return nil end local title,desc,cast,apply,remove,mingrade = spell.name, spell.desc, spell.cast, spell.apply, spell.remove, spell.mingrade -- FIXME in serious need of refactoring local base_spell = true if proto.frame and spell.frame and spell.frame[proto.frame] then local sp = spell.frame[proto.frame] 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 remove base_spell = false end return { rune = rune, grade = rg; spell = spell, mingrade = mingrade; name = title, desc = desc; cast = cast, apply = apply, remove = remove; ................................................................................ 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 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) ................................................................................ end -- 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 local qual = math.random(#constants.rune_grades) rune_set(r,{grade = qual}) i:add_item('cache',r) -- consume a phial local ph = i:get_stack('phial',1) local n = ph:get_name() ph:take_item(1) i:set_stack('phial',1,ph) minetest.add_item(pos,i:add_item('refuse',ItemStack(sorcery.register.residue.db[n]))) else break end end end has_phial = has_phial() local spec = string.format([[ formspec_version[3] size[10.25,8] real_coordinates[true] |
| > > | > > | > > | > > | > > | > > | | > | | | | | | | > > | > > > > | > > > > > > < | |
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 .. 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 ... 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 ... 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 ... 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 308 309 310 311 312 |
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 phial_kinds = { lesser = {grade = 1, name = 'Lesser'; infusion = 'sorcery:powder_brass'; dist = { Fragile = 1, Weak = 0.7, Ordinary = 0.1, Pristine = 0.05, Sublime = 0.01 }; }; simple = {grade = 2, name = 'Simple'; infusion = 'sorcery:powder_silver'; dist = { Fragile = 1, Weak = 0.8, Ordinary = 0.2, Pristine = 0.07, Sublime = 0.015 }; }; great = {grade = 3, name = 'Great'; infusion = 'sorcery:powder_gold'; dist = { Fragile = 1, Weak = 0.9, Ordinary = 0.5, Pristine = 0.1, Sublime = 0.05 }; }; splendid = {grade = 4, name = 'Splendid'; infusion = 'sorcery:powder_electrum'; dist = { Fragile = 1, Weak = 0.95, Ordinary = 0.7, Pristine = 0.3, Sublime = 0.1 }; }; exalted = {grade = 5, name = 'Exalted'; infusion = 'sorcery:powder_iridium'; 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 g = phial:get_definition()._proto.data.grade local i = constants.rune_mine_interval local fac = (g-1) / 5 return i - ((i*0.5) * fac), 0.5 * fac ................................................................................ local f = string.format 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; label = f('%s Phial',p.name); desc = "A powerful liquid consumed in the operation of a rune forge. Its quality determines how fast new runes can be constructed and how much energy is required by the process, and affects your odds of getting a high-quality rune."; color = color:brighten(1 + fac*0.5); imgvariant = (fac >= 5) and 'sparkle' or 'dull'; glow = 5+p.grade; extra = { groups = { sorcery_phial = p.grade }; _proto = { id = name, data = p }; }; ................................................................................ end sorcery.amulet.getspell = function(stack) local m = stack:get_meta() local proto = stack:get_definition()._sorcery.amulet if not m:contains('amulet_rune') then return nil end local rune = m:get_string('amulet_rune') local rg = m:get_int('amulet_rune_grade') local rd = sorcery.data.runes[rune] local spell = rd.amulets[proto.base] if not spell then return nil end local title,desc,cast,apply,remove,mingrade = spell.name, spell.desc, spell.cast, spell.apply, spell.remove, spell.mingrade -- FIXME in serious need of refactoring 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 return { rune = rune, grade = rg; spell = spell, mingrade = mingrade; name = title, desc = desc; cast = cast, apply = apply, remove = remove; ................................................................................ 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 and not probe.disjunction then -- roll for runes local phial = i:get_stack('phial',1) local int, powerfac = calc_phial_props(phial) 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) ................................................................................ end -- 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 local qual -- iterate through qualities from highest to lowest, rolling against the phial's -- distribution for each, and stopping when we find one local qdist = phial:get_definition()._proto.data.dist for i=#constants.rune_grades,1,-1 do local chance = qdist[constants.rune_grades[i]] if chance == 1 or math.random() <= chance then qual = i break end end rune_set(r,{grade = qual}) i:add_item('cache',r) -- consume a phial local ph = i:get_stack('phial',1) ph:take_item(1) i:set_stack('phial',1,ph) minetest.add_item(pos,i:add_item('refuse',ItemStack(sorcery.register.residue.db[ph:get_name()]))) else break end end end has_phial = has_phial() local spec = string.format([[ formspec_version[3] size[10.25,8] real_coordinates[true] |
Added sounds/sorcery_condenser_bg.ogg version [51e11fd1e4].
cannot compute difference between binary files