Skip to content
Snippets Groups Projects
Commit 8b605561 authored by dg's avatar dg
Browse files

plopo


git-svn-id: http://svn.net-core.org/repos/t-engine4@1325 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3dd4fe4b
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,8 @@ function _M:init(t, no_default)
self.unused_generics = self.unused_generics or 1
self.unused_talents_types = self.unused_talents_types or 0
t.resource_pool_refs = t.resource_pool_refs or {}
t.lite = t.lite or 0
t.size_category = t.size_category or 3
......@@ -973,16 +975,40 @@ function _M:learnTalent(t_id, force, nb)
-- If we learned a spell, get mana, if you learned a technique get stamina, if we learned a wild gift, get power
local t = _M.talents_def[t_id]
if t.type[1]:find("^spell/") and not self:knowTalent(self.T_MANA_POOL) and t.mana or t.sustain_mana then self:learnTalent(self.T_MANA_POOL, true) end
if t.type[1]:find("^wild%-gift/") and not self:knowTalent(self.T_EQUILIBRIUM_POOL) and t.equilibrium or t.sustain_equilibrium then self:learnTalent(self.T_EQUILIBRIUM_POOL, true) end
if t.type[1]:find("^technique/") and not self:knowTalent(self.T_STAMINA_POOL) and t.stamina or t.sustain_stamina then self:learnTalent(self.T_STAMINA_POOL, true) end
if t.type[1]:find("^corruption/") and not self:knowTalent(self.T_VIM_POOL) and t.vim or t.sustain_vim then self:learnTalent(self.T_VIM_POOL, true) end
if t.type[1]:find("^divine/") and (t.positive or t.sustain_positive) and not self:knowTalent(self.T_POSITIVE_POOL) then self:learnTalent(self.T_POSITIVE_POOL, true) end
if t.type[1]:find("^divine/") and (t.negative or t.sustain_negative) and not self:knowTalent(self.T_NEGATIVE_POOL) then self:learnTalent(self.T_NEGATIVE_POOL, true) end
if t.type[1]:find("^cursed/") and not self:knowTalent(self.T_HATE_POOL) then self:learnTalent(self.T_HATE_POOL, true) end
if t.type[1]:find("^spell/") and not self:knowTalent(self.T_MANA_POOL) and t.mana or t.sustain_mana then
self:learnTalent(self.T_MANA_POOL, true)
self.resource_pool_refs[self.T_MANA_POOL] = self.resource_pool_refs[self.T_MANA_POOL] + 1
end
if t.type[1]:find("^wild%-gift/") and not self:knowTalent(self.T_EQUILIBRIUM_POOL) and t.equilibrium or t.sustain_equilibrium then
self:learnTalent(self.T_EQUILIBRIUM_POOL, true)
self.resource_pool_refs[self.T_EQUILIBRIUM_POOL] = self.resource_pool_refs[self.T_EQUILIBRIUM_POOL] + 1
end
if t.type[1]:find("^technique/") and not self:knowTalent(self.T_STAMINA_POOL) and t.stamina or t.sustain_stamina then
self:learnTalent(self.T_STAMINA_POOL, true)
self.resource_pool_refs[self.T_STAMINA_POOL] = self.resource_pool_refs[self.T_STAMINA_POOL] + 1
end
if t.type[1]:find("^corruption/") and not self:knowTalent(self.T_VIM_POOL) and t.vim or t.sustain_vim then
self:learnTalent(self.T_VIM_POOL, true)
self.resource_pool_refs[self.T_VIM_POOL] = self.resource_pool_refs[self.T_VIM_POOL] + 1
end
if t.type[1]:find("^divine/") and (t.positive or t.sustain_positive) and not self:knowTalent(self.T_POSITIVE_POOL) then
self:learnTalent(self.T_POSITIVE_POOL, true)
self.resource_pool_refs[self.T_POSITIVE_POOL] = self.resource_pool_refs[self.T_POSITIVE_POOL] + 1
end
if t.type[1]:find("^divine/") and (t.negative or t.sustain_negative) and not self:knowTalent(self.T_NEGATIVE_POOL) then
self:learnTalent(self.T_NEGATIVE_POOL, true)
self.resource_pool_refs[self.T_NEGATIVE_POOL] = self.resource_pool_refs[self.T_NEGATIVE_POOL] + 1
end
if t.type[1]:find("^cursed/") and not self:knowTalent(self.T_HATE_POOL) then
self:learnTalent(self.T_HATE_POOL, true)
self.resource_pool_refs[self.T_HATE_POOL] = self.resource_pool_refs[self.T_HATE_POOL] + 1
end
-- If we learn an archery talent, also learn to shoot
if t.type[1]:find("^technique/archery") and not self:knowTalent(self.T_SHOOT) then self:learnTalent(self.T_SHOOT, true) end
if t.type[1]:find("^technique/archery") and not self:knowTalent(self.T_SHOOT) then
self:learnTalent(self.T_SHOOT, true)
self.resource_pool_refs[self.T_SHOOT] = self.resource_pool_refs[self.T_SHOOT] + 1
end
return true
end
......@@ -992,6 +1018,12 @@ end
-- @return true if the talent was unlearnt, nil and an error message otherwise
function _M:unlearnTalent(t_id)
if not engine.interface.ActorTalents.unlearnTalent(self, t_id, force) then return false end
-- Check the various pools
for key, num_refs in pairs(self.resource_pool_refs) do
if num_refs == 0 then
self:unlearnTalent(key)
end
end
return true
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment