From c4e3aa1b3dd9962d66f96ebe70d321028c37c639 Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Mon, 23 Apr 2018 03:38:02 +0200
Subject: [PATCH] Worldly Knowledge is not for NPCs

---
 game/modules/tome/class/Actor.lua           | 6 ++----
 game/modules/tome/data/talents/uber/cun.lua | 2 ++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua
index cbb79dd72e..4f73366982 100644
--- a/game/modules/tome/class/Actor.lua
+++ b/game/modules/tome/class/Actor.lua
@@ -4939,7 +4939,6 @@ end
 -- @param ab the talent (not the id, the table)
 -- @return true to continue, false to stop
 function _M:preUseTalent(ab, silent, fake)
-
 	if ab._ai_parsed == nil then -- add some AI info to the talent if needed
 		print("[Actor:preUseTalent] PARSING TALENT for AI info", ab.id, self.name)
 		mod.class.interface.ActorAI.aiParseTalent(ab, self)
@@ -4950,7 +4949,8 @@ function _M:preUseTalent(ab, silent, fake)
 		return false
 	end
 
-	if not self:attr("no_talent_fail") then
+	if self:attr("no_talent_fail") then return true end
+
 	if not ab.never_fail and self:attr("feared") and (ab.mode ~= "sustained" or not self:isTalentActive(ab.id)) then
 		if not silent then game.logSeen(self, "%s is too afraid to use %s.", self.name:capitalize(), ab.name) end
 		return false
@@ -5169,8 +5169,6 @@ function _M:preUseTalent(ab, silent, fake)
 	if ab.is_heal and (self:attr("no_healing") or ((self.healing_factor or 1) <= 0)) then return false end
 	if ab.is_teleport and self:attr("encased_in_ice") then return false end
 
-	end
-
 	return true
 end
 
diff --git a/game/modules/tome/data/talents/uber/cun.lua b/game/modules/tome/data/talents/uber/cun.lua
index e5c86fbd5d..8ec4a86da0 100644
--- a/game/modules/tome/data/talents/uber/cun.lua
+++ b/game/modules/tome/data/talents/uber/cun.lua
@@ -273,7 +273,9 @@ uberTalent{
 	name = "Worldly Knowledge",
 	mode = "passive",
 	cant_steal = true,
+	no_npc_use = true,
 	on_learn = function(self, t, kind)
+		if not game.party:hasMember(self) then return end
 		local Chat = require "engine.Chat"
 		local chat = Chat.new("worldly-knowledge", {name="Worldly Knowledge"}, self)
 		chat:invoke()
-- 
GitLab