From 3c43e2588d39ff544c82611ca3f7ab38bddbea87 Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Sat, 19 Oct 2013 17:18:32 +0200
Subject: [PATCH] Orcs will search your buddies for the staff too

---
 game/modules/tome/class/Party.lua                      |  1 +
 .../tome/data/chats/shertul-fortress-caldizar.lua      |  4 ++--
 .../data/general/objects/world-artifacts-far-east.lua  |  6 +++---
 game/modules/tome/data/quests/keepsake.lua             | 10 +++++-----
 game/modules/tome/data/quests/shertul-fortress.lua     |  4 ++--
 game/modules/tome/data/quests/staff-absorption.lua     |  7 ++++---
 6 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/game/modules/tome/class/Party.lua b/game/modules/tome/class/Party.lua
index 1b18d8fd76..bdae458c80 100644
--- a/game/modules/tome/class/Party.lua
+++ b/game/modules/tome/class/Party.lua
@@ -431,3 +431,4 @@ function _M:findInAllPartyInventoriesBy(prop, value)
 		if o then return mem, o, item, inven_id  end
 	end
 end
+_M.findInAllInventoriesBy = _M.findInAllPartyInventoriesBy 
diff --git a/game/modules/tome/data/chats/shertul-fortress-caldizar.lua b/game/modules/tome/data/chats/shertul-fortress-caldizar.lua
index 1ba5d3905c..6f8c9b10e4 100644
--- a/game/modules/tome/data/chats/shertul-fortress-caldizar.lua
+++ b/game/modules/tome/data/chats/shertul-fortress-caldizar.lua
@@ -18,9 +18,9 @@
 -- darkgod@te4.org
 
 local has_staff = false
-local o, item, inven_id = player:findInAllInventoriesBy("define_as", "STAFF_ABSORPTION")
+local carry, o, item, inven_id = game.party:findInAllInventoriesBy("define_as", "STAFF_ABSORPTION")
 if o then has_staff = true end
-local o, item, inven_id = player:findInAllInventoriesBy("define_as", "STAFF_ABSORPTION_AWAKENED")
+local carry, o, item, inven_id = game.party:findInAllInventoriesBy("define_as", "STAFF_ABSORPTION_AWAKENED")
 if o then has_staff = true end
 
 local speak
diff --git a/game/modules/tome/data/general/objects/world-artifacts-far-east.lua b/game/modules/tome/data/general/objects/world-artifacts-far-east.lua
index 9e1fc6818e..431bfe354f 100644
--- a/game/modules/tome/data/general/objects/world-artifacts-far-east.lua
+++ b/game/modules/tome/data/general/objects/world-artifacts-far-east.lua
@@ -42,11 +42,11 @@ newEntity{ base = "BASE_SCROLL", define_as = "JEWELER_TOME", subtype="tome", no_
 newEntity{ base = "BASE_GEM", define_as = "ANCIENT_STORM_SAPHIR",
 	power_source = {unknown=true},
 	unique = true,
-	unided_name = "strange saphir",
-	name = "Ancient Storm Saphir", subtype = "blue", image = "object/ancient_storm_saphir.png",
+	unided_name = "strange sapphire",
+	name = "Ancient Storm Sapphire", subtype = "blue", image = "object/ancient_storm_saphir.png",
 	color = colors.ROYAL_BLUE,
 	level_range = {30, 50},
-	desc = [[This seemingly normal saphir seems to be charged with the destructive power of a raging storm.]],
+	desc = [[This seemingly normal sapphire seems to be charged with the destructive power of a raging storm.]],
 	rarity = 300,
 	cost = 0,
 	material_level = 4,
diff --git a/game/modules/tome/data/quests/keepsake.lua b/game/modules/tome/data/quests/keepsake.lua
index eae2b3440b..799ae1e24b 100644
--- a/game/modules/tome/data/quests/keepsake.lua
+++ b/game/modules/tome/data/quests/keepsake.lua
@@ -259,9 +259,9 @@ on_berethh_death = function(self, who, berethh)
 	
 	who:setQuestStatus("keepsake", engine.Quest.DONE)
 	
-	local o, item, inven_id = who:findInAllInventoriesBy("define_as", "IRON_ACORN_BASIC")
-	if o then
-		who:removeObject(inven_id, item, true)
+	local carry, o, item, inven_id = game.party:findInAllInventoriesBy("define_as", "IRON_ACORN_BASIC")
+	if carry and o then
+		carry:removeObject(inven_id, item, true)
 		o:removed()
 		
 		local o
@@ -272,9 +272,9 @@ on_berethh_death = function(self, who, berethh)
 		end
 		if o then
 			game.zone:addEntity(game.level, o, "object")
-			who:addObject(who.INVEN_INVEN, o)
+			carry:addObject(carry.INVEN_INVEN, o)
 			o:added()
-			who:sortInven()
+			carry:sortInven()
 		end
 	end
 end
diff --git a/game/modules/tome/data/quests/shertul-fortress.lua b/game/modules/tome/data/quests/shertul-fortress.lua
index df3b11dca0..14411b2fd9 100644
--- a/game/modules/tome/data/quests/shertul-fortress.lua
+++ b/game/modules/tome/data/quests/shertul-fortress.lua
@@ -60,7 +60,7 @@ desc = function(self, who)
 		if self:isCompleted("flight-done") then
 			desc[#desc+1] = "#LIGHT_GREEN#* You have re-enabled the fortress flight systems. You can now fly around in your fortress!#WHITE#"
 		else
-			desc[#desc+1] = "#SLATE#* The fortress shadow has asked that you find an Ancient Storm Saphir, along with at least 250 energy, to re-enable the fortress flight systems.#WHITE#"
+			desc[#desc+1] = "#SLATE#* The fortress shadow has asked that you find an Ancient Storm Sapphire, along with at least 250 energy, to re-enable the fortress flight systems.#WHITE#"
 		end
 	end
 	if self.shertul_energy > 0 then
@@ -117,7 +117,7 @@ gain_energy = function(self, energy)
 	-- if self.shertul_energy >= 250 and not self:isCompleted("flight") then
 	-- 	game.player:setQuestStatus(self.id, self.COMPLETED, "flight")
 	-- 	local Dialog = require "engine.ui.Dialog"
-	-- 	Dialog:simpleLongPopup("Fortress Shadow", "Master, you have sent enough energy to activate the flight systems.\nHowever, one control crystal is broken. You need to find an #GOLD#Ancient Storm Saphir#WHITE#.", 400)
+	-- 	Dialog:simpleLongPopup("Fortress Shadow", "Master, you have sent enough energy to activate the flight systems.\nHowever, one control crystal is broken. You need to find an #GOLD#Ancient Storm Sapphire#WHITE#.", 400)
 	-- end
 end
 
diff --git a/game/modules/tome/data/quests/staff-absorption.lua b/game/modules/tome/data/quests/staff-absorption.lua
index a55db0a1d3..f79454b9e3 100644
--- a/game/modules/tome/data/quests/staff-absorption.lua
+++ b/game/modules/tome/data/quests/staff-absorption.lua
@@ -76,10 +76,11 @@ start_ambush = function(self, who)
 
 		-- Protect from other hits on the same turn
 		self:setEffect(self.EFF_DAMAGE_SHIELD, 3, {power=1000000})
+		self:removeEffectsFilter{status="detrimental"}
 
-		local o, item, inven_id = self:findInAllInventoriesBy("define_as", "STAFF_ABSORPTION")
-		if o then
-			self:removeObject(inven_id, item, true)
+		local carry, o, item, inven_id = game.party:findInAllInventoriesBy("define_as", "STAFF_ABSORPTION")
+		if carry and o then
+			carry:removeObject(inven_id, item, true)
 			o:removed()
 		end
 
-- 
GitLab