From 15c1aacf701800d019d782166d04cdc57afbb498 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Fri, 15 Jun 2012 15:27:18 +0000
Subject: [PATCH] update randart_able

git-svn-id: http://svn.net-core.org/repos/t-engine4@5244 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/engines/default/engine/utils.lua         |  7 ++
 game/modules/tome/class/Game.lua              | 11 ++-
 game/modules/tome/class/GameState.lua         | 80 +++++++++++++------
 .../tome/data/general/objects/2haxes.lua      |  2 +-
 .../tome/data/general/objects/2hmaces.lua     |  2 +-
 .../tome/data/general/objects/2hswords.lua    |  2 +-
 .../tome/data/general/objects/2htridents.lua  |  2 +-
 .../tome/data/general/objects/axes.lua        |  2 +-
 .../tome/data/general/objects/bows.lua        |  3 +-
 .../tome/data/general/objects/cloak.lua       |  2 +-
 .../data/general/objects/cloth-armors.lua     |  2 +-
 .../tome/data/general/objects/gauntlets.lua   |  2 +-
 .../tome/data/general/objects/gloves.lua      |  2 +-
 .../data/general/objects/heavy-armors.lua     |  2 +-
 .../tome/data/general/objects/heavy-boots.lua |  2 +-
 .../tome/data/general/objects/helms.lua       |  2 +-
 .../tome/data/general/objects/jewelry.lua     |  4 +-
 .../tome/data/general/objects/knifes.lua      |  2 +-
 .../data/general/objects/leather-belt.lua     |  2 +-
 .../data/general/objects/leather-boots.lua    |  2 +-
 .../data/general/objects/leather-caps.lua     |  2 +-
 .../data/general/objects/light-armors.lua     |  2 +-
 .../tome/data/general/objects/lites.lua       |  2 +-
 .../tome/data/general/objects/maces.lua       |  2 +-
 .../data/general/objects/massive-armors.lua   |  2 +-
 .../tome/data/general/objects/mindstars.lua   |  2 +-
 .../general/objects/random-artifacts/ammo.lua |  4 +-
 .../objects/random-artifacts/gloves.lua       |  2 +
 .../objects/random-artifacts/melee.lua        |  4 +-
 .../objects/random-artifacts/shields.lua      |  2 +
 .../tome/data/general/objects/shields.lua     |  2 +-
 .../tome/data/general/objects/slings.lua      |  3 +-
 .../tome/data/general/objects/staves.lua      |  2 +-
 .../tome/data/general/objects/swords.lua      |  2 +-
 .../tome/data/general/objects/torques.lua     |  2 +-
 .../tome/data/general/objects/totems.lua      |  2 +-
 .../tome/data/general/objects/wands.lua       |  2 +-
 .../tome/data/general/objects/whips.lua       |  2 +-
 .../tome/data/general/objects/wizard-hat.lua  |  2 +-
 39 files changed, 116 insertions(+), 62 deletions(-)

diff --git a/game/engines/default/engine/utils.lua b/game/engines/default/engine/utils.lua
index 7fdf9db386..1aabfe0bb5 100644
--- a/game/engines/default/engine/utils.lua
+++ b/game/engines/default/engine/utils.lua
@@ -196,6 +196,13 @@ function table.from_list(t, k, v)
 	for i, e in ipairs(t) do tt[e[k or 1]] = e[v or 2] end
 	return tt
 end
+
+function table.removeFromList(t, ...)
+	for _, v in ipairs{...} do
+		for i = #t, 1, -1 do if t[i] == v then table.remove(t, i) end end
+	end
+end
+
 --- Adds missing keys from the src table to the dst table.
 -- @param dst The destination table, which will have all merged values.
 -- @param src The source table, supplying values to be merged.
diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua
index 78f5baef72..4be784737c 100644
--- a/game/modules/tome/class/Game.lua
+++ b/game/modules/tome/class/Game.lua
@@ -1210,10 +1210,13 @@ function _M:setupCommands()
 			setfenv(f, setmetatable({level=self.level, zone=self.zone}, {__index=_G}))
 			print(pcall(f))
 --]]
-			package.loaded["mod.dialogs.elements.TalentTrees"] = nil
-			package.loaded["mod.dialogs.Levelup2Dialog"] = nil
-			game:registerDialog(require("mod.dialogs.Levelup2Dialog").new(game.player))
-		end end,
+			local o = game.zone:makeEntity(game.level,"object", {
+			type = "weapon", subtype="battleaxe",random_object={}}, nil, true)
+			if o then
+				o:identify(true)
+				game.zone:addEntity(game.level, o, "object", game.player.x, game.player.y)
+			end
+			end end,
 		[{"_f","ctrl"}] = function() if config.settings.cheat then
 			self.player.quests["love-melinda"] = nil
 			self.player:grantQuest("love-melinda")
diff --git a/game/modules/tome/class/GameState.lua b/game/modules/tome/class/GameState.lua
index 7a14cca756..c42a868b2d 100644
--- a/game/modules/tome/class/GameState.lua
+++ b/game/modules/tome/class/GameState.lua
@@ -202,11 +202,6 @@ local randart_name_rules = {
 		syllablesEnd = "arc, bane, bait, bile, biter, blast, bliss, blood, blow, bloom, butcher, blur, bolt, bone, bore, brace, braid, braze, breacher, breaker, breeze, brawn, burst, bringer, bearer, bender, blight, brand, break, born, black, bright, crypt, crack, clash, clamor, cut, cast, cutter, dredge, dash, dream, dare, death, edge, envy, fury, fear, fame, foe, furnace, flash, fiend, fist, gore, gash, gasher, grind, grinder, guile, grit, glean, glory, glamour, hack, hacker, hash, hue, hunger, hunt, hunter, ire, idol, immortal, justice, jeer, jam, kill, killer, kiss, 's kiss, karma, kin, king, knave, knight, lord, lore, lash, lace, lady, maim, mark, moon, master, mistress, mire, monster, might, marrow, mortal, minister, malice, naught, null, noon, nail, nigh, night, oath, order, oracle, oozer, obeisance, oblivion, onslaught, obsidian, peal, pyre, parry, power, python, prophet, pain, passion, pierce, piercer, pride, pulverizer, piety, panic, pain, punish, pall, quench, quencher, quake, quarry, queen, quell, queller, quick, quill, reaper, ravage, ravager, raze, razor, roar, rage, race, radiance, raider, rain, rot, ransom, rune, reign, rupture, ream, rebel, raven, river, ripper, rip, ripper, rock, reek, reeve, resolve, rigor, rend, raptor, shine, slice, slicer, spar, spawn, spawner, spitter, squall, steel, stoker, snake, sorrow, sage, stake, serpent, shear, sin, sear, spire, stalker, shaper, strider, streak, streaker, saw, scar, schism, star, streak, sting, stinger, strike, striker, stun, sun, sweep, sweeper, swift, stone, seam, sever, smash, smasher, spike, spiker, thorn, terror, touch, tide, torrent, trial, typhoon, titan, tickler, tooth, treason, trencher, taint, trail, umbra, usher, valor, vagrant, vile, vein, veil, venom, viper, vault, vengeance, vortex, vice, wrack, walker, wake, waker, war, ward, warden, wasp, weeper, wedge, wend, well, whisper, wild, wilder, will, wind, wilter, wing, winnow, wire, wisp, wish, witch, wolf, woe, wither, witherer, worm, wreath, worth, wreck, wrecker, wrest, writher, wyrd, zeal, zephyr",
 		rules = "$s$e",
 	},
-	venom = {
-		syllablesStart ="Ichor, Offal, Rot, Scab, Squalor, Taint, Undeath, Vile, Weep, Plague, Pox, Pus, Gore, Sepsis, Corruption, Filth, Muck, Fester, Toxin, Venom, Scorpion, Serpent, Viper, Cobra, Sulfur, Mire, Ooze, Wretch, Carrion, Bile, Bog, Sewer, Swamp, Corpse, Scum, Mold, Spider, Phlegm, Mucus, Morbus, Murk, Smear, Cyst",
-		syllablesEnd = "arc, bane, bait, biter, blast, bliss, blood, blow, bloom, butcher, blur, bolt, bone, bore, brace, braid, braze, breacher, breaker, breeze, brawn, burst, bringer, bearer, bender, blight, brand, break, born, black, bright, crypt, crack, clash, clamor, cut, cast, cutter, dredge, dash, dream, dare, death, edge, envy, fury, fear, fame, foe, furnace, flash, fiend, fist, gash, gasher, grind, grinder, guile, grit, glean, glory, glamour, hack, hacker, hash, hue, hunger, hunt, hunter, ire, idol, immortal, justice, jeer, jam, kill, killer, kiss, 's kiss, karma, kin, king, knave, knight, lord, lore, lash, lace, lady, maim, mark, moon, master, mistress, mire, monster, might, marrow, mortal, minister, malice, naught, null, noon, nail, nigh, night, oath, order, oracle, oozer, obeisance, oblivion, onslaught, obsidian, peal, pyre, parry, power, python, prophet, pain, passion, pierce, piercer, pride, pulverizer, piety, panic, pain, punish, pall, quench, quencher, quake, quarry, queen, quell, queller, quick, quill, reaper, ravage, ravager, raze, razor, roar, rage, race, radiance, raider, rain, ransom, rune, reign, rupture, ream, rebel, raven, river, ripper, rip, ripper, rock, reek, reeve, resolve, rigor, rend, raptor, shine, slice, slicer, spar, spawn, spawner, spitter, squall, steel, stoker, snake, sorrow, sage, stake, shear, sin, sear, spire, stalker, shaper, strider, streak, streaker, saw, scar, schism, star, streak, sting, stinger, strike, striker, stun, sun, sweep, sweeper, swift, stone, seam, sever, smash, smasher, spike, spiker, thorn, terror, touch, tide, torrent, trial, typhoon, titan, tickler, tooth, treason, trencher, trail, umbra, usher, valor, vagrant, vile, vein, veil, venom, viper, vault, vengeance, vortex, vice, wrack, walker, wake, waker, war, ward, warden, wasp, weeper, wedge, wend, well, whisper, wild, wilder, will, wind, wilter, wing, winnow, winter, wire, wisp, wish, witch, wolf, woe, wither, witherer, worm, wreath, worth, wreck, wrecker, wrest, writher, wyrd, zeal, zephyr",
-		rules = "$s$e",
-	},
 	lightning = {
 		syllablesStart ="Tempest, Storm, Lightning, Arc, Shock, Thunder, Charge, Cloud, Air, Nimbus, Gale, Crackle, Shimmer, Flash, Spark, Blast, Blaze, Strike, Sky, Bolt",
 		syllablesEnd = "bane, bait, bile, biter, blast, bliss, blood, blow, bloom, butcher, blur, bone, bore, brace, braid, braze, breacher, breaker, breeze, brawn, burst, bringer, bearer, bender, blight, brand, break, born, black, bright, crypt, crack, clash, clamor, cut, cast, cutter, dredge, dash, dream, dare, death, edge, envy, fury, fear, fame, foe, furnace, flash, fiend, fist, gore, gash, gasher, grind, grinder, guile, grit, glean, glory, glamour, hack, hacker, hash, hue, hunger, hunt, hunter, ire, idol, immortal, justice, jeer, jam, kill, killer, kiss, 's kiss, karma, kin, king, knave, knight, lord, lore, lash, lace, lady, maim, mark, moon, master, mistress, mire, monster, might, marrow, mortal, minister, malice, naught, null, noon, nail, nigh, night, oath, order, oracle, oozer, obeisance, oblivion, onslaught, obsidian, peal, pyre, parry, power, python, prophet, pain, passion, pierce, piercer, pride, pulverizer, piety, panic, pain, punish, pall, quench, quencher, quake, quarry, queen, quell, queller, quick, quill, reaper, ravage, ravager, raze, razor, roar, rage, race, radiance, raider, rain, rot, ransom, rune, reign, rupture, ream, rebel, raven, river, ripper, rip, ripper, rock, reek, reeve, resolve, rigor, rend, raptor, shine, slice, slicer, spar, spawn, spawner, spitter, squall, steel, stoker, snake, sorrow, sage, stake, serpent, shear, sin, sear, spire, stalker, shaper, strider, streak, streaker, saw, scar, schism, star, streak, sting, stinger, stun, sun, sweep, sweeper, swift, stone, seam, sever, smash, smasher, spike, spiker, thorn, terror, touch, tide, torrent, trial, typhoon, titan, tickler, tooth, treason, trencher, taint, trail, umbra, usher, valor, vagrant, vile, vein, veil, venom, viper, vault, vengeance, vortex, vice, wrack, walker, wake, waker, war, ward, warden, wasp, weeper, wedge, wend, well, whisper, wild, wilder, will, wind, wilter, wing, winnow, winter, wire, wisp, wish, witch, wolf, woe, wither, witherer, worm, wreath, worth, wreck, wrecker, wrest, writher, wyrd, zeal, zephyr",
@@ -223,18 +218,14 @@ local randart_name_rules = {
 		rules = "$s$e",
 	},
 	nature = {
-		syllablesStart ="Nature, Green, Loam, Earth, Heal, Root, Growth, Grow, Bark, Bloom, Satyr, Rain, Pure, Wild, Wind, Cure, Cleanse, Forest, Breeze, Oak, Willow, Tree, Balance, Flower",
-		syllablesEnd = "arc, bane, bait, bile, biter, blast, bliss, blood, blow, bloom, butcher, blur, bolt, bone, bore, brace, braid, braze, breacher, breaker, brawn, burst, bringer, bearer, bender, blight, brand, break, born, black, bright, crypt, crack, clash, clamor, cut, cast, cutter, dredge, dash, dream, dare, death, edge, envy, fury, fear, fame, foe, furnace, flash, fiend, fist, gore, gash, gasher, grind, grinder, guile, grit, glean, glory, glamour, hack, hacker, hash, hue, hunger, hunt, hunter, ire, idol, immortal, justice, jeer, jam, kill, killer, kiss, 's kiss, karma, kin, king, knave, knight, lord, lore, lash, lace, lady, maim, mark, moon, master, mistress, mire, monster, might, marrow, mortal, minister, malice, naught, null, noon, nail, nigh, night, oath, order, oracle, oozer, obeisance, oblivion, onslaught, obsidian, peal, pyre, parry, power, python, prophet, pain, passion, pierce, piercer, pride, pulverizer, piety, panic, pain, punish, pall, quench, quencher, quake, quarry, queen, quell, queller, quick, quill, reaper, ravage, ravager, raze, razor, roar, rage, race, radiance, raider, rot, ransom, rune, reign, rupture, ream, rebel, raven, river, ripper, rip, ripper, rock, reek, reeve, resolve, rigor, rend, raptor, shine, slice, slicer, spar, spawn, spawner, spitter, squall, steel, stoker, snake, sorrow, sage, stake, serpent, shear, sin, sear, spire, stalker, shaper, strider, streak, streaker, saw, scar, schism, star, streak, sting, stinger, strike, striker, stun, sun, sweep, sweeper, swift, stone, seam, sever, smash, smasher, spike, spiker, thorn, terror, touch, tide, torrent, trial, typhoon, titan, tickler, tooth, treason, trencher, taint, trail, umbra, usher, valor, vagrant, vile, vein, veil, venom, viper, vault, vengeance, vortex, vice, wrack, walker, wake, waker, war, ward, warden, wasp, weeper, wedge, wend, well, whisper, wild, wilder, will, wind, wilter, wing, winnow, winter, wire, wisp, wish, witch, wolf, woe, wither, witherer, worm, wreath, worth, wreck, wrecker, wrest, writher, wyrd, zeal, zephyr",
+		syllablesStart ="Nature, Green, Loam, Earth, Heal, Root, Growth, Grow, Bark, Bloom, Satyr, Rain, Pure, Wild, Wind, Cure, Cleanse, Forest, Breeze, Oak, Willow, Tree, Balance, Flower, Ichor, Offal, Rot, Scab, Squalor, Taint, Undeath, Vile, Weep, Plague, Pox, Pus, Gore, Sepsis, Corruption, Filth, Muck, Fester, Toxin, Venom, Scorpion, Serpent, Viper, Cobra, Sulfur, Mire, Ooze, Wretch, Carrion, Bile, Bog, Sewer, Swamp, Corpse, Scum, Mold, Spider, Phlegm, Mucus, Morbus, Murk, Smear, Cyst",
+		syllablesEnd = "arc, bane, bait, bile, biter, blast, bliss, blood, blow, bloom, butcher, blur, bolt, bone, bore, brace, braid, braze, breacher, breaker, brawn, burst, bringer, bearer, bender, blight, brand, break, born, black, bright, crypt, crack, clash, clamor, cut, cast, cutter, dredge, dash, dream, dare, death, edge, envy, fury, fear, fame, foe, furnace, flash, fiend, fist, gore, gash, gasher, grind, grinder, guile, grit, glean, glory, glamour, hack, hacker, hash, hue, hunger, hunt, hunter, ire, idol, immortal, justice, jeer, jam, kill, killer, kiss, 's kiss, karma, kin, king, knave, knight, lord, lore, lash, lace, lady, maim, mark, moon, master, mistress, mire, monster, might, marrow, mortal, minister, malice, naught, null, noon, nail, nigh, night, oath, order, oracle, oozer, obeisance, oblivion, onslaught, obsidian, peal, pyre, parry, power, python, prophet, pain, passion, pierce, piercer, pride, pulverizer, piety, panic, pain, punish, pall, quench, quencher, quake, quarry, queen, quell, queller, quick, quill, reaper, ravage, ravager, raze, razor, roar, rage, race, radiance, raider, rot, ransom, rune, reign, rupture, ream, rebel, raven, river, ripper, rip, ripper, rock, reek, reeve, resolve, rigor, rend, raptor, shine, slice, slicer, spar, spawn, spawner, spitter, squall, steel, stoker, snake, sorrow, sage, stake, serpent, shear, sin, sear, spire, stalker, shaper, strider, streak, streaker, saw, scar, schism, star, streak, sting, stinger, strike, striker, stun, sun, sweep, sweeper, swift, stone, seam, sever, smash, smasher, spike, spiker, thorn, terror, touch, tide, torrent, trial, typhoon, titan, tickler, tooth, treason, trencher, taint, trail, umbra, usher, valor, vagrant, vile, vein, veil, venom, viper, vault, vengeance, vortex, vice, wrack, walker, wake, waker, war, ward, warden, wasp, weeper, wedge, wend, well, whisper, wild, wilder, will, wind, wilter, wing, winnow, winter, wire, wisp, wish, witch, wolf, woe, wither, witherer, worm, wreath, worth, wreck, wrecker, wrest, writher, wyrd, zeal, zephyr,",
 		rules = "$s$e",
 	},
 }
 
 --- Generate randarts for this state
 function _M:generateRandart(data)
-
-	if not self.randart_powers then self.randart_powers = engine.Object:loadList("/data/general/objects/random-artifacts.lua") end
-	local powers_list = self.randart_powers
-
 	-- Setup level
 	local lev = data.lev or rng.range(12, 50)
 	local oldlev = game.level.level
@@ -249,10 +240,30 @@ function _M:generateRandart(data)
 	if not base then game.level.level = oldlev resolvers.current_level = oldclev return end
 	local o = base:cloneFull()
 
-	local allthemes = {'misc','psionic','sorcerous','nature','brawny','lightning','arcane','light','physical','def','tireless','unyielding','dark','nimble','spell','cold','fire','venom','attack'}
-	local pthemes = table.listify(o.randart_able)
-	local themes = {[rng.table(allthemes)] = true}
-	for i = 1, #pthemes do if rng.percent(pthemes[i][2]) then themes[pthemes[i][1]] = true no_theme = false end end
+	local powers_list = engine.Object:loadList(o.randart_able, nil, nil, function(e) if e.rarity then e.rarity = math.ceil(e.rarity / 5) end end)
+	o.randart_able = nil
+
+	local allthemes = {
+		'physical', 'mental', 'spell', 'defense', 'misc', 'fire',
+		'lightning', 'acid', 'mind', 'arcane', 'blight', 'nature',
+		'temporal', 'light', 'dark', 'antimagic'
+	}
+	local themes = {}
+	if data.force_themes then
+		for i, v in ipairs(data.force_themes) do 
+			table.removeFromList(allthemes, v) 
+			themes[v] = true
+			if v == 'antimagic' then table.removeFromList(allthemes, 'spell', 'arcane', 'blight', 'temporal') end
+			if v == 'spell' or v == 'arcane' or v == 'blight' or v == 'temporal' then table.removeFromList(allthemes, 'antimagic') end
+		end
+	end
+	for i = #themes + 1, (data.nb_themes or 2) do 
+		if #allthemes == 0 then break end 
+		local v = rng.tableRemove(allthemes)
+		themes[v] = true
+		if v == 'antimagic' then table.removeFromList(allthemes, 'spell', 'arcane', 'blight', 'temporal') end
+		if v == 'spell' or v == 'arcane' or v == 'blight' or v == 'temporal' then table.removeFromList(allthemes, 'antimagic') end
+	end
 	local themes_fct = function(e)
 		for theme, _ in pairs(e.theme) do if themes[theme] then return true end end
 		return false
@@ -355,10 +366,10 @@ function _M:generateRandart(data)
 			end
 		end
 		o.egos = nil o.egos_chance = nil o.force_ego = nil
-		-- Re-resolve with the (possibly) new resolvers
-		o:resolve()
-		o:resolve(nil, true)
 	end
+	-- Re-resolve with the (possibly) new resolvers
+	o:resolve()
+	o:resolve(nil, true)
 
 	-----------------------------------------------------------
 	-- Imbue powers in the randart
@@ -388,15 +399,22 @@ function _M:generateRandart(data)
 	local i = 0
 	while hpoints > 0 do
 		i = util.boundWrap(i + 1, 1, #powers)
-
 		local p = powers[i]:clone()
 		if p.points <= hpoints then
+			print(" * adding power: "..p.name)
 			if p.wielder then
 				o.wielder = o.wielder or {}
 				merger(o.wielder, p.wielder)
 			end
+			if p.combat then
+				o.combat = o.combat or {}
+				merger(o.combat, p.combat)
+			end
+			if p.special_combat then
+				o.special_combat = o.special_combat or {}
+				merger(o.special_combat, p.special_combat)
+			end
 			if p.copy then merger(o, p.copy) end
-			print(" * adding power: "..p.name)
 		end
 		hpoints = hpoints - p.points
 	end
@@ -423,6 +441,18 @@ function _M:generateRandart(data)
 		hpoints = hpoints - (p and p.points or 1) * 2
 	end
 
+	-- Power source if none
+	if not o.power_source then
+		local ps = {}
+		if themes.physical or themes.defense then ps.technique = true end
+		if themes.mental then ps[rng.percent(50) and 'nature' or 'psionic'] = true end
+		if themes.spell or themes.arcane or themes.blight or themes.temporal then ps.arcane = true end
+		if themes.nature then ps.nature = true end
+		if themes.antimagic then ps.antimagic = true end
+		if not next(ps) then ps[rng.table{'technique','nature','arcane','psionic','antimagic'}] = true end
+		o.power_source = ps
+	end
+
 	-- Setup the name
 	o.name = name
 
@@ -1149,11 +1179,15 @@ function _M:entityFilterPost(zone, level, type, e, filter)
 		end
 	elseif type == "object" then
 		if filter.random_object and not e.unique and e.randart_able then
+			local data = _G.type(filter.random_object) == "table" and filter.random_object or {}
+			local lev = math.max(4, game.zone:level_adjust_level(game.level, game.zone, "object"))
 			e = game.state:generateRandart{
-				lev = math.max(4, game.zone:level_adjust_level(game.level, game.zone, "object")),
+				lev = lev,
 				egos = 0,
-				power_points_factor = 3,
-				nb_powers_add = 1,
+				power_points_factor = data.power_points_factor or 3,
+				nb_powers_add = data.nb_powers_add or 1,
+				nb_themes = data.nb_themes or math.max(2, math.floor(lev / 20)),
+				force_themes = data.force_themes or nil,
 				base = e,
 				post = function(o) o.rare = true o.unique = nil o.randart = nil end,
 				namescheme = 3
diff --git a/game/modules/tome/data/general/objects/2haxes.lua b/game/modules/tome/data/general/objects/2haxes.lua
index 93b8b42b01..4d29f66e33 100644
--- a/game/modules/tome/data/general/objects/2haxes.lua
+++ b/game/modules/tome/data/general/objects/2haxes.lua
@@ -32,7 +32,7 @@ newEntity{
 	desc = [[Massive two-handed battleaxes.]],
 	twohanded = true,
 	ego_bonus_mult = 0.2,
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/melee.lua",
 	egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/2hmaces.lua b/game/modules/tome/data/general/objects/2hmaces.lua
index 7310435466..9ee77652b8 100644
--- a/game/modules/tome/data/general/objects/2hmaces.lua
+++ b/game/modules/tome/data/general/objects/2hmaces.lua
@@ -32,7 +32,7 @@ newEntity{
 	desc = [[Massive two-handed maul.]],
 	twohanded = true,
 	ego_bonus_mult = 0.2,
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/melee.lua",
 	egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/2hswords.lua b/game/modules/tome/data/general/objects/2hswords.lua
index 7855dd18ac..efdb5267e7 100644
--- a/game/modules/tome/data/general/objects/2hswords.lua
+++ b/game/modules/tome/data/general/objects/2hswords.lua
@@ -32,7 +32,7 @@ newEntity{
 	twohanded = true,
 	metallic = true,
 	ego_bonus_mult = 0.2,
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/melee.lua",
 	egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/2htridents.lua b/game/modules/tome/data/general/objects/2htridents.lua
index 3832455c17..71d98fc203 100644
--- a/game/modules/tome/data/general/objects/2htridents.lua
+++ b/game/modules/tome/data/general/objects/2htridents.lua
@@ -34,7 +34,7 @@ newEntity{
 Tridents require the exotic weapons mastery talent to use correctly.]],
 	twohanded = true,
 	ego_bonus_mult = 0.2,
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/melee.lua",
 	egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/axes.lua b/game/modules/tome/data/general/objects/axes.lua
index 80be834e8d..c7a2bbee26 100644
--- a/game/modules/tome/data/general/objects/axes.lua
+++ b/game/modules/tome/data/general/objects/axes.lua
@@ -29,7 +29,7 @@ newEntity{
 	metallic = true,
 	combat = { talented = "axe", damrange = 1.4, physspeed = 1, sound = {"actions/melee", pitch=0.6, vol=1.2}, sound_miss = {"actions/melee", pitch=0.6, vol=1.2}},
 	desc = [[One-handed war axes.]],
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/melee.lua",
 	egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/bows.lua b/game/modules/tome/data/general/objects/bows.lua
index 32f81b922b..4b2bf43e34 100644
--- a/game/modules/tome/data/general/objects/bows.lua
+++ b/game/modules/tome/data/general/objects/bows.lua
@@ -33,7 +33,7 @@ newEntity{
 	archery = "bow",
 	proj_image = resolvers.image_material("arrow", "wood"),
 	desc = [[Longbows are used to shoot arrows at your foes.]],
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/bow.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
@@ -114,6 +114,7 @@ newEntity{
 	proj_image = resolvers.image_material("arrow", "wood"),
 	archery_ammo = "bow",
 	desc = [[Arrows are used with bows to pierce your foes to death.]],
+	randart_able = "/data/general/objects/random-artifacts/ammo.lua",
 	egos = "/data/general/objects/egos/ammo.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 	resolvers.shooter_capacity(),
 }
diff --git a/game/modules/tome/data/general/objects/cloak.lua b/game/modules/tome/data/general/objects/cloak.lua
index 7d956583c0..883e54e930 100644
--- a/game/modules/tome/data/general/objects/cloak.lua
+++ b/game/modules/tome/data/general/objects/cloak.lua
@@ -27,7 +27,7 @@ newEntity{
 	encumber = 2,
 	rarity = 6,
 	desc = [[A cloth coat typically worn as a loose outer garment. It is spacious enough to be worn even over bulky metal armour.]],
-	randart_able = { attack=10, physical=10, spell=10, def=10, misc=50 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/cloak.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/cloth-armors.lua b/game/modules/tome/data/general/objects/cloth-armors.lua
index 01bd3ce263..3ef51efc2b 100644
--- a/game/modules/tome/data/general/objects/cloth-armors.lua
+++ b/game/modules/tome/data/general/objects/cloth-armors.lua
@@ -27,7 +27,7 @@ newEntity{
 	encumber = 2,
 	rarity = 5,
 	desc = [[A cloth vestment. It offers no intrinsic protection but can be enchanted.]],
-	randart_able = { attack=10, physical=10, spell=80, def=20, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/robe.lua", egos_chance = { prefix=resolvers.mbonus(30, 15), suffix=resolvers.mbonus(30, 15) },
 }
 
diff --git a/game/modules/tome/data/general/objects/gauntlets.lua b/game/modules/tome/data/general/objects/gauntlets.lua
index fdaba00a73..1eae886fbd 100644
--- a/game/modules/tome/data/general/objects/gauntlets.lua
+++ b/game/modules/tome/data/general/objects/gauntlets.lua
@@ -32,7 +32,7 @@ newEntity{
 	rarity = 9,
 	metallic = true,
 	desc = [[Metal gloves protecting the hands up to the middle of the lower arm.]],
-	randart_able = { attack=10, physical=10, spell=10, def=40, misc=30 },
+	randart_able = "/data/general/objects/random-artifacts/gloves.lua",
 	egos = "/data/general/objects/egos/gloves.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/gloves.lua b/game/modules/tome/data/general/objects/gloves.lua
index a876078b2f..15300327ea 100644
--- a/game/modules/tome/data/general/objects/gloves.lua
+++ b/game/modules/tome/data/general/objects/gloves.lua
@@ -30,7 +30,7 @@ newEntity{
 	encumber = 1,
 	rarity = 9,
 	desc = [[Light gloves which do not seriously hinder finger movements, while still protecting the hands somewhat.]],
-	randart_able = { attack=10, physical=10, spell=10, def=30, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/gloves.lua",
 	egos = "/data/general/objects/egos/gloves.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/heavy-armors.lua b/game/modules/tome/data/general/objects/heavy-armors.lua
index 5571fcab6f..688888f10f 100644
--- a/game/modules/tome/data/general/objects/heavy-armors.lua
+++ b/game/modules/tome/data/general/objects/heavy-armors.lua
@@ -31,7 +31,7 @@ newEntity{
 	rarity = 5,
 	metallic = true,
 	desc = [[A suit of armour made of mail.]],
-	randart_able = { attack=10, physical=10, spell=10, def=80, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/heavy-armor.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/heavy-boots.lua b/game/modules/tome/data/general/objects/heavy-boots.lua
index 5a45b032a3..9faa0783d5 100644
--- a/game/modules/tome/data/general/objects/heavy-boots.lua
+++ b/game/modules/tome/data/general/objects/heavy-boots.lua
@@ -31,7 +31,7 @@ newEntity{
 	rarity = 7,
 	metallic = true,
 	desc = [[Heavy boots, with metal strips at the toes, heels and other vulnerable parts, to better protect the wearer's feet from harm.]],
-	randart_able = { attack=10, physical=10, spell=10, def=40, misc=40 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/boots.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/helms.lua b/game/modules/tome/data/general/objects/helms.lua
index 85aef1ad87..3802525267 100644
--- a/game/modules/tome/data/general/objects/helms.lua
+++ b/game/modules/tome/data/general/objects/helms.lua
@@ -31,7 +31,7 @@ newEntity{
 	rarity = 7,
 	metallic = true,
 	desc = [[A large helmet that can protect the entire head. Ventilation and bad vision can be a problem, however.]],
-	randart_able = { attack=20, physical=10, spell=10, def=50, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/helm.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/jewelry.lua b/game/modules/tome/data/general/objects/jewelry.lua
index 75578335aa..9d77b28faf 100644
--- a/game/modules/tome/data/general/objects/jewelry.lua
+++ b/game/modules/tome/data/general/objects/jewelry.lua
@@ -25,7 +25,7 @@ newEntity{
 	encumber = 0.1,
 	rarity = 6,
 	desc = [[Rings can have magical properties.]],
-	randart_able = { attack=40, physical=40, spell=40, def=40, misc=40 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	-- Most rings are ego items
 	egos = "/data/general/objects/egos/rings.lua", egos_chance = { prefix=resolvers.mbonus(50, 40), suffix=resolvers.mbonus(50, 40) }, egos_chance_decay = 0.5,
 }
@@ -37,7 +37,7 @@ newEntity{
 	encumber = 0.1,
 	rarity = 8,
 	desc = [[Amulets can have magical properties.]],
-	randart_able = { attack=40, physical=40, spell=40, def=40, misc=40 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/amulets.lua", egos_chance = { prefix=resolvers.mbonus(50, 40), suffix=resolvers.mbonus(50, 40) }, egos_chance_decay = 0.5,
 }
 
diff --git a/game/modules/tome/data/general/objects/knifes.lua b/game/modules/tome/data/general/objects/knifes.lua
index 021ebc9e12..54d7d452e4 100644
--- a/game/modules/tome/data/general/objects/knifes.lua
+++ b/game/modules/tome/data/general/objects/knifes.lua
@@ -30,7 +30,7 @@ newEntity{
 	combat = { talented = "knife", damrange = 1.3, physspeed = 1, sound = {"actions/melee", pitch=1.2, vol=1.2}, sound_miss = {"actions/melee", pitch=1.2, vol=1.2} },
 	desc = [[Sharp, short and deadly.]],
 	ego_bonus_mult = -0.2,
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/melee.lua",
 	egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/leather-belt.lua b/game/modules/tome/data/general/objects/leather-belt.lua
index 6a4ad9008a..f9a155725d 100644
--- a/game/modules/tome/data/general/objects/leather-belt.lua
+++ b/game/modules/tome/data/general/objects/leather-belt.lua
@@ -25,7 +25,7 @@ newEntity{
 	encumber = 1,
 	rarity = 6,
 	desc = [[A belt that goes around your waist.]],
-	randart_able = { attack=10, physical=10, spell=10, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/belt.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/leather-boots.lua b/game/modules/tome/data/general/objects/leather-boots.lua
index 7e6aadc3ee..6859f24338 100644
--- a/game/modules/tome/data/general/objects/leather-boots.lua
+++ b/game/modules/tome/data/general/objects/leather-boots.lua
@@ -27,7 +27,7 @@ newEntity{
 	encumber = 2,
 	rarity = 6,
 	desc = [[A pair of boots made of leather.]],
-	randart_able = { attack=10, physical=10, spell=10, def=40, misc=30 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/light-boots.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/leather-caps.lua b/game/modules/tome/data/general/objects/leather-caps.lua
index 2ab6ae9655..ff755176df 100644
--- a/game/modules/tome/data/general/objects/leather-caps.lua
+++ b/game/modules/tome/data/general/objects/leather-caps.lua
@@ -27,7 +27,7 @@ newEntity{
 	encumber = 2,
 	rarity = 6,
 	desc = [[A cap made of leather.]],
-	randart_able = { attack=20, physical=10, spell=10, def=40, misc=30 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/helm.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/light-armors.lua b/game/modules/tome/data/general/objects/light-armors.lua
index c0fbe55cb5..8bdda813c1 100644
--- a/game/modules/tome/data/general/objects/light-armors.lua
+++ b/game/modules/tome/data/general/objects/light-armors.lua
@@ -27,7 +27,7 @@ newEntity{
 	encumber = 9,
 	rarity = 5,
 	desc = [[A suit of armour made of leather.]],
-	randart_able = { attack=20, physical=20, spell=20, def=60, misc=40 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/light-armor.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/lites.lua b/game/modules/tome/data/general/objects/lites.lua
index 86282d78f7..d6d0a1a949 100644
--- a/game/modules/tome/data/general/objects/lites.lua
+++ b/game/modules/tome/data/general/objects/lites.lua
@@ -23,7 +23,7 @@ newEntity{
 	type = "lite", subtype="lite", image = resolvers.image_material("lite", {"brass","","dwarven","","faenorian"}),
 	display = "~",
 	desc = [[Light up the dark places of the world!]],
-	randart_able = { attack=10, physical=10, spell=10, def=30, misc=40 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/lite.lua", egos_chance = { prefix=resolvers.mbonus(15, 3), suffix=resolvers.mbonus(15, 3) },
 }
 
diff --git a/game/modules/tome/data/general/objects/maces.lua b/game/modules/tome/data/general/objects/maces.lua
index 539a8c8fa7..52ba31e6fd 100644
--- a/game/modules/tome/data/general/objects/maces.lua
+++ b/game/modules/tome/data/general/objects/maces.lua
@@ -29,7 +29,7 @@ newEntity{
 	metallic = true,
 	combat = { talented = "mace", damrange = 1.4, physspeed = 1, sound = {"actions/melee", pitch=0.6, vol=1.2}, sound_miss = {"actions/melee", pitch=0.6, vol=1.2}},
 	desc = [[Blunt and deadly.]],
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/massive-armors.lua b/game/modules/tome/data/general/objects/massive-armors.lua
index 8169fc9ece..ea7e9c6784 100644
--- a/game/modules/tome/data/general/objects/massive-armors.lua
+++ b/game/modules/tome/data/general/objects/massive-armors.lua
@@ -31,7 +31,7 @@ newEntity{
 	rarity = 5,
 	metallic = true,
 	desc = [[A suit of armour made of metal plates.]],
-	randart_able = { attack=10, physical=10, spell=10, def=80, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/massive-armor.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/mindstars.lua b/game/modules/tome/data/general/objects/mindstars.lua
index 171b19141b..8a9bb4b545 100644
--- a/game/modules/tome/data/general/objects/mindstars.lua
+++ b/game/modules/tome/data/general/objects/mindstars.lua
@@ -25,7 +25,7 @@ newEntity{
 	display = "!", color=colors.LIGHT_RED, image = resolvers.image_material("mindstar", "nature"),
 	moddable_tile = resolvers.moddable_tile("mindstar"),
 	psiblade_tile = "mindstar_psiblade_%s_01",
-	randart_able = { attack=10, physical=40, spell=1, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/melee.lua",
 	encumber = 3,
 	rarity = 4,
 	power_source = {nature=true},
diff --git a/game/modules/tome/data/general/objects/random-artifacts/ammo.lua b/game/modules/tome/data/general/objects/random-artifacts/ammo.lua
index 73a2da5a38..ecdada0dd5 100644
--- a/game/modules/tome/data/general/objects/random-artifacts/ammo.lua
+++ b/game/modules/tome/data/general/objects/random-artifacts/ammo.lua
@@ -20,6 +20,8 @@
 local Stats = require "engine.interface.ActorStats"
 local Talents = require "engine.interface.ActorTalents"
 
+load("/data/general/objects/random-artifacts/generic.lua")
+
 ----------------------------------------------------------------
 -- Ammo Properties
 ----------------------------------------------------------------
@@ -99,7 +101,7 @@ newEntity{ theme={cold=true}, name="ice ranged", points = 1, rarity = 20, level_
 	combat = { ranged_project = {[DamageType.ICE] = resolvers.randartmax(1, 20), }, },
 }
 newEntity{ theme={antimagic=true}, name="manaburn ranged", points = 1, rarity = 18, level_range = {1, 50},
-	combat = { ranged_project = {[DamageType.MANA_BURN] = resolvers.randartmax(1, 20), }, },
+	combat = { ranged_project = {[DamageType.MANABURN] = resolvers.randartmax(1, 20), }, },
 }
 newEntity{ theme={nature=true, antimagic=true}, name="slime ranged", points = 1, rarity = 18, level_range = {1, 50},
 	combat = { ranged_project = {[DamageType.SLIME] = resolvers.randartmax(1, 20), }, },
diff --git a/game/modules/tome/data/general/objects/random-artifacts/gloves.lua b/game/modules/tome/data/general/objects/random-artifacts/gloves.lua
index c7773b79e4..b81f221d58 100644
--- a/game/modules/tome/data/general/objects/random-artifacts/gloves.lua
+++ b/game/modules/tome/data/general/objects/random-artifacts/gloves.lua
@@ -20,6 +20,8 @@
 local Stats = require "engine.interface.ActorStats"
 local Talents = require "engine.interface.ActorTalents"
 
+load("/data/general/objects/random-artifacts/generic.lua")
+
 ----------------------------------------------------------------
 -- Weapon Properties
 ----------------------------------------------------------------
diff --git a/game/modules/tome/data/general/objects/random-artifacts/melee.lua b/game/modules/tome/data/general/objects/random-artifacts/melee.lua
index a7ab6f4db0..d823960faf 100644
--- a/game/modules/tome/data/general/objects/random-artifacts/melee.lua
+++ b/game/modules/tome/data/general/objects/random-artifacts/melee.lua
@@ -20,6 +20,8 @@
 local Stats = require "engine.interface.ActorStats"
 local Talents = require "engine.interface.ActorTalents"
 
+load("/data/general/objects/random-artifacts/generic.lua")
+
 ----------------------------------------------------------------
 -- Weapon Properties
 ----------------------------------------------------------------
@@ -93,7 +95,7 @@ newEntity{ theme={cold=true}, name="ice melee", points = 1, rarity = 20, level_r
 	combat = { melee_project = {[DamageType.ICE] = resolvers.randartmax(1, 20), }, },
 }
 newEntity{ theme={antimagic=true}, name="manaburn melee", points = 1, rarity = 18, level_range = {1, 50},
-	combat = { melee_project = {[DamageType.MANA_BURN] = resolvers.randartmax(1, 20), }, },
+	combat = { melee_project = {[DamageType.MANABURN] = resolvers.randartmax(1, 20), }, },
 }
 newEntity{ theme={nature=true, antimagic=true}, name="slime melee", points = 1, rarity = 18, level_range = {1, 50},
 	combat = { melee_project = {[DamageType.SLIME] = resolvers.randartmax(1, 20), }, },
diff --git a/game/modules/tome/data/general/objects/random-artifacts/shields.lua b/game/modules/tome/data/general/objects/random-artifacts/shields.lua
index 617e665350..5084c4ecd6 100644
--- a/game/modules/tome/data/general/objects/random-artifacts/shields.lua
+++ b/game/modules/tome/data/general/objects/random-artifacts/shields.lua
@@ -20,6 +20,8 @@
 local Stats = require "engine.interface.ActorStats"
 local Talents = require "engine.interface.ActorTalents"
 
+load("/data/general/objects/random-artifacts/generic.lua")
+
 ----------------------------------------------------------------
 -- Weapon Properties
 ----------------------------------------------------------------
diff --git a/game/modules/tome/data/general/objects/shields.lua b/game/modules/tome/data/general/objects/shields.lua
index 9d53a6d8d7..00199ff010 100644
--- a/game/modules/tome/data/general/objects/shields.lua
+++ b/game/modules/tome/data/general/objects/shields.lua
@@ -31,7 +31,7 @@ newEntity{
 	metallic = true,
 	desc = [[Handheld deflection devices]],
 	require = { talent = { {Talents.T_ARMOUR_TRAINING,3} }, },
-	randart_able = { attack=20, physical=10, spell=10, def=50, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/shields.lua",
 	special_combat = { damrange = 1.2 },
 	egos = "/data/general/objects/egos/shield.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
diff --git a/game/modules/tome/data/general/objects/slings.lua b/game/modules/tome/data/general/objects/slings.lua
index bffdc09463..d1d62ca10d 100644
--- a/game/modules/tome/data/general/objects/slings.lua
+++ b/game/modules/tome/data/general/objects/slings.lua
@@ -32,7 +32,7 @@ newEntity{
 	require = { talent = { Talents.T_SHOOT }, },
 	proj_image = resolvers.image_material("shot_s", "metal"),
 	desc = [[Slings are used to hurl stones or metal shots at your foes.]],
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/sling.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
@@ -110,6 +110,7 @@ newEntity{
 	proj_image = resolvers.image_material("shot_s", "metal"),
 	archery_ammo = "sling",
 	desc = [[Shots are used with slings to pummel your foes to death.]],
+	randart_able = "/data/general/objects/random-artifacts/ammo.lua",
 	egos = "/data/general/objects/egos/ammo.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 	resolvers.shooter_capacity(),
 }
diff --git a/game/modules/tome/data/general/objects/staves.lua b/game/modules/tome/data/general/objects/staves.lua
index 7d1bc3308b..d5d0383c45 100644
--- a/game/modules/tome/data/general/objects/staves.lua
+++ b/game/modules/tome/data/general/objects/staves.lua
@@ -29,7 +29,7 @@ newEntity{
 	add_name = " (#COMBAT_DAMTYPE#)",
 	display = "\\", color=colors.LIGHT_RED, image = resolvers.image_material("staff", "wood"),
 	moddable_tile = resolvers.moddable_tile("staff"),
-	randart_able = { attack=10, physical=40, spell=80, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/melee.lua",
 	encumber = 5,
 	rarity = 4,
 	combat = {
diff --git a/game/modules/tome/data/general/objects/swords.lua b/game/modules/tome/data/general/objects/swords.lua
index 852cba1fdc..ab91476085 100644
--- a/game/modules/tome/data/general/objects/swords.lua
+++ b/game/modules/tome/data/general/objects/swords.lua
@@ -29,7 +29,7 @@ newEntity{
 	metallic = true,
 	combat = { talented = "sword", damrange = 1.4, physspeed = 1, sound = {"actions/melee", pitch=0.6, vol=1.2}, sound_miss = {"actions/melee", pitch=0.6, vol=1.2}},
 	desc = [[Sharp, long, and deadly.]],
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/melee.lua",
 	egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
diff --git a/game/modules/tome/data/general/objects/torques.lua b/game/modules/tome/data/general/objects/torques.lua
index 95e685a07f..aeefc995a8 100644
--- a/game/modules/tome/data/general/objects/torques.lua
+++ b/game/modules/tome/data/general/objects/torques.lua
@@ -31,7 +31,7 @@ newEntity{
 	egos = "/data/general/objects/egos/torques.lua", egos_chance = { prefix=resolvers.mbonus(20, 5), suffix=resolvers.mbonus(20, 5) },
 	addons = "/data/general/objects/egos/torques-powers.lua",
 	power_source = {psionic=true},
-	randart_able = { misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	talent_cooldown = "T_GLOBAL_CD",
 }
 
diff --git a/game/modules/tome/data/general/objects/totems.lua b/game/modules/tome/data/general/objects/totems.lua
index f4dfb54ac1..b9a75961e2 100644
--- a/game/modules/tome/data/general/objects/totems.lua
+++ b/game/modules/tome/data/general/objects/totems.lua
@@ -31,7 +31,7 @@ newEntity{
 	egos = "/data/general/objects/egos/totems.lua", egos_chance = { prefix=resolvers.mbonus(20, 5), suffix=resolvers.mbonus(20, 5) },
 	addons = "/data/general/objects/egos/totems-powers.lua",
 	power_source = {nature=true},
-	randart_able = { misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	talent_cooldown = "T_GLOBAL_CD",
 }
 
diff --git a/game/modules/tome/data/general/objects/wands.lua b/game/modules/tome/data/general/objects/wands.lua
index a74926b3c3..8bca508455 100644
--- a/game/modules/tome/data/general/objects/wands.lua
+++ b/game/modules/tome/data/general/objects/wands.lua
@@ -31,7 +31,7 @@ newEntity{
 	egos = "/data/general/objects/egos/wands.lua", egos_chance = { prefix=resolvers.mbonus(20, 5), },
 	addons = "/data/general/objects/egos/wands-powers.lua",
 	power_source = {arcane=true},
-	randart_able = { misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	talent_cooldown = "T_GLOBAL_CD",
 }
 
diff --git a/game/modules/tome/data/general/objects/whips.lua b/game/modules/tome/data/general/objects/whips.lua
index aca47a81d9..fa988e6781 100644
--- a/game/modules/tome/data/general/objects/whips.lua
+++ b/game/modules/tome/data/general/objects/whips.lua
@@ -29,6 +29,6 @@ newEntity{
 	metallic = true,
 	combat = { talented = "whip", damrange = 1.1, sound = "actions/melee", sound_miss = "actions/melee_miss",},
 	desc = [[Sharp, long and deadly.]],
-	randart_able = { attack=40, physical=80, spell=20, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
diff --git a/game/modules/tome/data/general/objects/wizard-hat.lua b/game/modules/tome/data/general/objects/wizard-hat.lua
index dcc6784023..9fd9a20d67 100644
--- a/game/modules/tome/data/general/objects/wizard-hat.lua
+++ b/game/modules/tome/data/general/objects/wizard-hat.lua
@@ -27,7 +27,7 @@ newEntity{
 	encumber = 2,
 	rarity = 6,
 	desc = [[A pointy cloth hat, very wizardly...]],
-	randart_able = { attack=10, physical=10, spell=80, def=10, misc=10 },
+	randart_able = "/data/general/objects/random-artifacts/generic.lua",
 	egos = "/data/general/objects/egos/wizard-hat.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
 }
 
-- 
GitLab