From 1932272f08b7055de69ea60a0f3ac1bb186f919c Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 6 Dec 2009 21:12:51 +0000
Subject: [PATCH] color

git-svn-id: http://svn.net-core.org/repos/t-engine4@96 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/engine/dialogs/UseTalents.lua                 |  1 +
 game/engine/interface/ActorTalents.lua             | 13 +++++++++++++
 game/modules/tome/data/birth/races.lua             |  2 +-
 game/modules/tome/dialogs/LevelupTalentsDialog.lua | 10 +++++++++-
 game/modules/tome/load.lua                         |  2 ++
 5 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/game/engine/dialogs/UseTalents.lua b/game/engine/dialogs/UseTalents.lua
index c051056bad..9520907041 100644
--- a/game/engine/dialogs/UseTalents.lua
+++ b/game/engine/dialogs/UseTalents.lua
@@ -49,6 +49,7 @@ end
 function _M:defineHotkey(id)
 	self.actor.hotkey[id] = self.list[self.talentsel].talent
 	self:simplePopup("Hotkey "..id.." assigned", self.actor:getTalentFromId(self.list[self.talentsel].talent).name:capitalize().." assigned to hotkey "..id)
+	self.actor.changed = true
 end
 
 function _M:use()
diff --git a/game/engine/interface/ActorTalents.lua b/game/engine/interface/ActorTalents.lua
index 6746b51df3..51ff69e9d9 100644
--- a/game/engine/interface/ActorTalents.lua
+++ b/game/engine/interface/ActorTalents.lua
@@ -137,6 +137,16 @@ function _M:learnTalent(t_id, force)
 		if not ok and err then return nil, err end
 	end
 
+	-- Auto assign to hotkey
+	if t.mode ~= "passive" then
+		for i = 1, 12 do
+			if not self.hotkey[i] then
+				self.hotkey[i] = t_id
+				break
+			end
+		end
+	end
+
 	self.talents[t_id] = true
 	self.changed = true
 	return true
@@ -146,6 +156,9 @@ end
 -- @param t_id the id of the talent to learn
 -- @return true if the talent was unlearnt, nil and an error message otherwise
 function _M:unlearnTalent(t_id)
+	for i, known_t_id in pairs(self.hotkey) do
+		if known_t_id == t_id then self.hotkey[i] = nil end
+	end
 	self.talents[t_id] = nil
 	self.changed = true
 	return true
diff --git a/game/modules/tome/data/birth/races.lua b/game/modules/tome/data/birth/races.lua
index 3fb671df04..fbc579565e 100644
--- a/game/modules/tome/data/birth/races.lua
+++ b/game/modules/tome/data/birth/races.lua
@@ -100,7 +100,7 @@ newBirthDescriptor{
 			Fallohide = "allow",
 		},
 	},
-	stats = { str=-2, cun=2, dex=3, con=2, },
+	stats = { str=-3, dex=3, con=2, lck=5, },
 	experience = 1.1,
 	talents = {
 		ActorTalents.T_IMPROVED_HEALTH_I,
diff --git a/game/modules/tome/dialogs/LevelupTalentsDialog.lua b/game/modules/tome/dialogs/LevelupTalentsDialog.lua
index 3ce91026ac..1b9e4365ee 100644
--- a/game/modules/tome/dialogs/LevelupTalentsDialog.lua
+++ b/game/modules/tome/dialogs/LevelupTalentsDialog.lua
@@ -44,7 +44,15 @@ function _M:generateList()
 						local typename = "talent"
 						if t.type[1]:find("^spell/") then typename = "spell" end
 						list[#list+1] = { name="    "..t.name.." ("..typename..")", talent=t.id }
-						if self.actor:knowTalent(t.id) then known[#known+1] = "#00FF00#known" else known[#known+1] = t.points.." point(s)" end
+						if self.actor:knowTalent(t.id) then
+							known[#known+1] = "#00FF00#known"
+						else
+							if not self.actor:canLearnTalent(t) then
+								known[#known+1] = "#FF0000#"..t.points.." point(s)"
+							else
+								known[#known+1] = t.points.." point(s)"
+							end
+						end
 					end
 				end
 			else
diff --git a/game/modules/tome/load.lua b/game/modules/tome/load.lua
index e09e1be356..c81e7a0ba8 100644
--- a/game/modules/tome/load.lua
+++ b/game/modules/tome/load.lua
@@ -20,6 +20,8 @@ ActorStats:defineStat("Magic",		"mag", 10, 1, 100, "Magic defines your character
 ActorStats:defineStat("Willpower",	"wil", 10, 1, 100, "Willpower defines your character's ability to concentrate. It increases your mana and stamina capacity, and your chance to resist mental attacks.")
 ActorStats:defineStat("Cunning",	"cun", 10, 1, 100, "Cunning defines your character's ability to learn and think. It allows you to learn many wordly abilities, increases your mental resistance and armor penetration.")
 ActorStats:defineStat("Constitution",	"con", 10, 1, 100, "Constitution defines your character's ability to withstand and resist damage. It increases your maximun life and physical resistance.")
+-- Luck is hidden and start at half max value (50) which is considered the standard
+ActorStats:defineStat("Luck",		"lck", 50, 1, 100, "Luck defines your character's chance when dealing with unknown events. It increases yoru critical strike chances, your chance for random encounters, ...")
 -- Actor autolevel schemes
 dofile("/data/autolevel_schemes.lua")
 -- Actor AIs
-- 
GitLab