From b4804efd235a8cb02e230581aa896c9f8e2e70de Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Wed, 13 Oct 2010 08:06:30 +0000
Subject: [PATCH] Stats at birth as correctly applied

git-svn-id: http://svn.net-core.org/repos/t-engine4@1512 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/engines/default/engine/Birther.lua | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/game/engines/default/engine/Birther.lua b/game/engines/default/engine/Birther.lua
index 8f90120bd2..bddeefae19 100644
--- a/game/engines/default/engine/Birther.lua
+++ b/game/engines/default/engine/Birther.lua
@@ -259,6 +259,7 @@ end
 --- Apply all birth options to the actor
 function _M:apply()
 	self.actor.descriptor = {}
+	local stats = {}
 	for i, d in ipairs(self.descriptors) do
 		print("[BIRTH] Applying descriptor "..d.name)
 		self.actor.descriptor[d.type] = d.name
@@ -276,7 +277,7 @@ function _M:apply()
 		-- Change stats
 		if d.stats then
 			for stat, inc in pairs(d.stats) do
-				self.actor:incStat(stat, inc)
+				stats[stat] = (stats[stat] or 0) + inc
 			end
 		end
 		if d.talents_types then
@@ -289,7 +290,6 @@ function _M:apply()
 				end
 				self.actor:learnTalentType(t, v)
 				self.actor.talents_types_mastery[t] = (self.actor.talents_types_mastery[t] or 1) + mastery
-				print(t)
 			end
 		end
 		if d.talents then
@@ -305,4 +305,9 @@ function _M:apply()
 			self.actor:initBody()
 		end
 	end
+
+	-- Apply stats now to not be overridden by other things
+	for stat, inc in pairs(stats) do
+		self.actor:incStat(stat, inc)
+	end
 end
-- 
GitLab