From feac87a07d79aa31782f896da46ea302889ceccd Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Wed, 11 May 2011 12:29:24 +0000
Subject: [PATCH] fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@3340 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/data/general/npcs/orc-gorbat.lua  | 13 +------------
 game/modules/tome/data/general/objects/scrolls.lua  |  2 +-
 .../modules/tome/data/talents/misc/inscriptions.lua |  8 ++++++++
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/game/modules/tome/data/general/npcs/orc-gorbat.lua b/game/modules/tome/data/general/npcs/orc-gorbat.lua
index 5c19075549..1d6f083bba 100644
--- a/game/modules/tome/data/general/npcs/orc-gorbat.lua
+++ b/game/modules/tome/data/general/npcs/orc-gorbat.lua
@@ -42,7 +42,7 @@ newEntity{
 	open_door = true,
 	resolvers.sustains_at_birth(),
 
---	resolvers.inscriptions(2, "infusion"),
+	resolvers.inscriptions(2, "infusion"),
 
 	autolevel = "warrior",
 	ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=3, },
@@ -55,17 +55,6 @@ newEntity{
 	end,
 }
 
-newEntity{ base = "BASE_NPC_ORC_GORBAT",
-	name = "orc TEST", color=colors.YELLOW,
-	desc = [[A fierce orc attuned to the wilds.]],
-	level_range = {30, nil}, exp_worth = 1,
-	rarity = 1,
-	ai = "tactical",
-	ai_state = { talent_in=1, },
-	rank=3,
-	resolvers.inscriptions(1, {"speed rune"}),
-}
-
 newEntity{ base = "BASE_NPC_ORC_GORBAT",
 	name = "orc summoner", color=colors.YELLOW,
 	desc = [[A fierce orc attuned to the wilds.]],
diff --git a/game/modules/tome/data/general/objects/scrolls.lua b/game/modules/tome/data/general/objects/scrolls.lua
index e39c1d12ec..f4196cf9ab 100644
--- a/game/modules/tome/data/general/objects/scrolls.lua
+++ b/game/modules/tome/data/general/objects/scrolls.lua
@@ -358,7 +358,7 @@ newEntity{ base = "BASE_RUNE",
 		dur = resolvers.mbonus_level(4, 3),
 		power = resolvers.mbonus_level(30, 30, function(e, v) return v * 0.3 end),
 		use_stat_mod = 0.3,
-		nb_uses = 2, --resolvers.mbonus_level(7, 4),
+		nb_uses = resolvers.mbonus_level(7, 4),
 	},
 	inscription_talent = "RUNE:_SPEED",
 }
diff --git a/game/modules/tome/data/talents/misc/inscriptions.lua b/game/modules/tome/data/talents/misc/inscriptions.lua
index cacc178d03..55deb72434 100644
--- a/game/modules/tome/data/talents/misc/inscriptions.lua
+++ b/game/modules/tome/data/talents/misc/inscriptions.lua
@@ -411,6 +411,10 @@ newInscription{
 	points = 1,
 	is_spell = true,
 	tactical = { DEFEND = 3, ESCAPE = 2 },
+	on_pre_use = function(self, t)
+		local ok, data = pcall(self.getInscriptionData, self, t.short_name)
+		return ok and data.nb_uses > 0
+	end,
 	action = function(self, t)
 		local data = self:getInscriptionData(t.short_name)
 		self:setEffect(self.EFF_INVISIBILITY, data.dur, {power=data.power + data.inc_stat})
@@ -435,6 +439,10 @@ newInscription{
 	is_spell = true,
 	no_energy = true,
 	tactical = { BUFF = 4 },
+	on_pre_use = function(self, t)
+		local ok, data = pcall(self.getInscriptionData, self, t.short_name)
+		return ok and data.nb_uses > 0
+	end,
 	action = function(self, t)
 		local data = self:getInscriptionData(t.short_name)
 		self:setEffect(self.EFF_SPEED, data.dur, {power=(data.power + data.inc_stat) / 100})
-- 
GitLab