From 86c5977de3798b90ffd6eb468c540b048a358d02 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Tue, 10 Aug 2010 14:16:09 +0000
Subject: [PATCH] Fixes giving the staffof absorption to the apprentice mage
 Ressource cost in talent display now correctly accounts for fatigue

git-svn-id: http://svn.net-core.org/repos/t-engine4@1002 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Actor.lua                 | 10 +++++-----
 game/modules/tome/data/quests/mage-apprentice.lua |  8 ++++++++
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua
index 52f1cdab38..1e34aa028b 100644
--- a/game/modules/tome/class/Actor.lua
+++ b/game/modules/tome/class/Actor.lua
@@ -1016,12 +1016,12 @@ function _M:getTalentFullDescription(t, addlevel)
 	else d[#d+1] = "#6fff83#Use mode: #00FF00#Activated"
 	end
 
-	if t.mana or t.sustain_mana then d[#d+1] = "#6fff83#Mana cost: #7fffd4#"..(t.mana or t.sustain_mana) end
-	if t.stamina or t.sustain_stamina then d[#d+1] = "#6fff83#Stamina cost: #ffcc80#"..(t.stamina or t.sustain_stamina) end
+	if t.mana or t.sustain_mana then d[#d+1] = "#6fff83#Mana cost: #7fffd4#"..(t.sustain_mana or t.mana * (100 + self.fatigue) / 100) end
+	if t.stamina or t.sustain_stamina then d[#d+1] = "#6fff83#Stamina cost: #ffcc80#"..(t.sustain_stamina or t.stamina * (100 + self.fatigue) / 100) end
 	if t.equilibrium or t.sustain_equilibrium then d[#d+1] = "#6fff83#Equilibrium cost: #00ff74#"..(t.equilibrium or t.sustain_equilibrium) end
-	if t.vim or t.sustain_vim then d[#d+1] = "#6fff83#Vim cost: #888888#"..(t.vim or t.sustain_vim) end
-	if t.positive or t.sustain_positive then d[#d+1] = "#6fff83#Positive energy cost: #GOLD#"..(t.positive or t.sustain_positive) end
-	if t.negative or t.sustain_negative then d[#d+1] = "#6fff83#Negative energy cost: #GREY#"..(t.negative or t.sustain_negative) end
+	if t.vim or t.sustain_vim then d[#d+1] = "#6fff83#Vim cost: #888888#"..(t.sustain_vim or t.vim * (100 + self.fatigue) / 100) end
+	if t.positive or t.sustain_positive then d[#d+1] = "#6fff83#Positive energy cost: #GOLD#"..(t.sustain_positive or t.positive * (100 + self.fatigue) / 100) end
+	if t.negative or t.sustain_negative then d[#d+1] = "#6fff83#Negative energy cost: #GREY#"..(t.sustain_negative or t.negative * (100 + self.fatigue) / 100) end
 	if self:getTalentRange(t) > 1 then d[#d+1] = "#6fff83#Range: #FFFFFF#"..self:getTalentRange(t)
 	else d[#d+1] = "#6fff83#Range: #FFFFFF#melee/personal"
 	end
diff --git a/game/modules/tome/data/quests/mage-apprentice.lua b/game/modules/tome/data/quests/mage-apprentice.lua
index 6e6e320994..d5d38bad6e 100644
--- a/game/modules/tome/data/quests/mage-apprentice.lua
+++ b/game/modules/tome/data/quests/mage-apprentice.lua
@@ -45,6 +45,14 @@ collect_staff = function(self, who, dialog)
 	who:showEquipInven("Offer which item?",
 		function(o) return (o.type == "weapon" and o.subtype == "staff" and (not o.define_as or o.define_as ~= "STAFF_ANGMAR")) or (o.type == "jewelry" and o.subtype == "ring") or (o.type == "jewelry" and o.subtype == "amulet") end,
 		function(o, inven, item)
+			-- Special handling for the staff of absorption
+			if o.define_as ans o.define_as == "STAFF_ABSORPTION" then
+				game.logPlayer(who, "#LIGHT_RED#As the apprentice touches the staff he begins to consume, flames bursting out of his mouth, life seems to be drained away from him and in an instant he collapses in a lifeless husk.")
+				who:setQuestStatus(self, self.FAILED)
+				game:unregisterDialog(dialog)
+				return true
+			end
+
 			self.nb_collect = self.nb_collect + 1
 			if self.nb_collect >= 15 then who:setQuestStatus(self, self.COMPLETED) end
 			who:removeObject(who:getInven(inven), item)
-- 
GitLab