From 56da1b7af37738fead44abddd7e2e4e82fb2dcfb Mon Sep 17 00:00:00 2001
From: Shibari <ShibariTOME@Gmail.com>
Date: Wed, 29 Mar 2017 05:32:10 -0400
Subject: [PATCH] Copy all of the copy descriptor table to randbosses

Add a descriptor blocking weapons from being equipped from inventory on addedToLevel and give it to Brawler
---
 game/modules/tome/class/GameState.lua            | 2 ++
 game/modules/tome/class/NPC.lua                  | 4 +++-
 game/modules/tome/data/birth/classes/warrior.lua | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/game/modules/tome/class/GameState.lua b/game/modules/tome/class/GameState.lua
index df00719b3f..af16653983 100644
--- a/game/modules/tome/class/GameState.lua
+++ b/game/modules/tome/class/GameState.lua
@@ -2000,6 +2000,8 @@ print("   power types: not_power_source =", table.concat(table.keys(b.not_power_
 				if instant then b:check("birth_create_alchemist_golem") end
 			elseif k == "soul" then
 				b.soul = util.bound(1 + math.ceil(data.level / 10), 1, 10) -- Does this need to scale?
+			else
+				b[k] = resolver -- Copy any misc attributes that we don't need to play with
 			end
 		end
 		for k, resolver in pairs(mclass.copy or {}) do apply_resolvers(k, resolver) end
diff --git a/game/modules/tome/class/NPC.lua b/game/modules/tome/class/NPC.lua
index e64214c51c..842e03e5d0 100644
--- a/game/modules/tome/class/NPC.lua
+++ b/game/modules/tome/class/NPC.lua
@@ -528,7 +528,9 @@ function _M:addedToLevel(level, x, y)
 			for i = #MainInven, 1, -1 do
 				o = MainInven[i]
 				local inven, worn = self:getInven(o:wornInven())
-				if inven and game.state:checkPowers(self, o, nil, "antimagic_only") then -- check antimagic restrictions
+					--print("[NPC:addedToLevel]", self.name, self.uid, "checking", o.name, "type", o.type)
+				if inven and game.state:checkPowers(self, o, nil, "antimagic_only") and not (o.type and o.type == "weapon" and self.no_npc_weapon_equip) then -- check restrictions
+					--print("[NPC:addedToLevel]", self.name, self.uid, "passed restriction check", o.name)
 					local ro, replace = inven and inven[1], false
 					o = self:removeObject(self.INVEN_INVEN, i)
 					if o then
diff --git a/game/modules/tome/data/birth/classes/warrior.lua b/game/modules/tome/data/birth/classes/warrior.lua
index 6ca9281ccd..26591c6ac7 100644
--- a/game/modules/tome/data/birth/classes/warrior.lua
+++ b/game/modules/tome/data/birth/classes/warrior.lua
@@ -317,6 +317,7 @@ newBirthDescriptor{
 		[ActorTalents.T_UNARMED_MASTERY] = 1, -- early game is absolutely stupid without this
 	},
 	copy = {
+		no_npc_weapon_equip = true, -- avoids randbosses equipping weapons from their inventory
 		resolvers.equipbirth{ id=true,
 			{type="armor", subtype="hands", name="iron gauntlets", autoreq=true, ego_chance=-1000, ego_chance=-1000},
 			{type="armor", subtype="light", name="rough leather armour", autoreq=true, ego_chance=-1000, ego_chance=-1000},
-- 
GitLab