diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index a76cfc9a28632bfde1a904a9bbb214793934ca20..a67a89d5934e3fb1e77f1d88658653c28a12098c 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -5107,14 +5107,15 @@ function _M:learnItemTalent(o, tid, level) local t = self:getTalentFromId(tid) local max = t.hard_cap or (t.points and t.points + 2) or 5 if not self.item_talent_surplus_levels then self.item_talent_surplus_levels = {} end - --local item_talent_surplus_levels = self.item_talent_surplus_levels or {} if not self.item_talent_surplus_levels[tid] then self.item_talent_surplus_levels[tid] = 0 end - --item_talent_levels[tid] = item_talent_levels[tid] + level + if not self.item_talent_levels_learnt then self.item_talent_levels_learnt = {} end + if not self.item_talent_levels_learnt[tid] then self.item_talent_levels_learnt[tid] = 0 end for i = 1, level do if self:getTalentLevelRaw(t) >= max then self.item_talent_surplus_levels[tid] = self.item_talent_surplus_levels[tid] + 1 else self:learnTalent(tid, true, 1, {no_unlearn = true}) + self.item_talent_levels_learnt[tid] = self.item_talent_levels_learnt[tid] + 1 end end @@ -5128,8 +5129,9 @@ function _M:unlearnItemTalent(o, tid, level) local t = self:getTalentFromId(tid) local max = (t.points and t.points + 2) or 5 if not self.item_talent_surplus_levels then self.item_talent_surplus_levels = {} end - --local item_talent_surplus_levels = self.item_talent_surplus_levels or {} if not self.item_talent_surplus_levels[tid] then self.item_talent_surplus_levels[tid] = 0 end + if not self.item_talent_levels_learnt then self.item_talent_levels_learnt = {} end + if not self.item_talent_levels_learnt[tid] then self.item_talent_levels_learnt[tid] = 0 end if self:isTalentActive(t) then self:forceUseTalent(t, {ignore_energy=true}) end @@ -5138,6 +5140,7 @@ function _M:unlearnItemTalent(o, tid, level) self.item_talent_surplus_levels[tid] = self.item_talent_surplus_levels[tid] - 1 else self:unlearnTalent(tid, nil, nil, {no_unlearn = true}) + self.item_talent_levels_learnt[tid] = self.item_talent_levels_learnt[tid] - 1 end end end diff --git a/game/modules/tome/dialogs/LevelupDialog.lua b/game/modules/tome/dialogs/LevelupDialog.lua index 74b3fb3f93d546044bf8ae21f9deb3f218a3e834..5b727be261d1e2c37b5529da925f95859c9204d4 100644 --- a/game/modules/tome/dialogs/LevelupDialog.lua +++ b/game/modules/tome/dialogs/LevelupDialog.lua @@ -348,6 +348,11 @@ function _M:checkDeps(simple, ignore_special) end function _M:isUnlearnable(t, limit) + -- Dont let them unlearn talents granted by items + if self.actor.item_talent_levels_learnt and self.actor.item_talent_levels_learnt[t.id] then + if self.actor:getTalentLevelRaw(t) <= self.actor.item_talent_levels_learnt[t.id] then return nil end + end + if config.settings.cheat then return 9999 end if not self.actor.last_learnt_talents then return end if self.on_birth and self.actor:knowTalent(t.id) and not t.no_unlearn_last then return 1 end -- On birth we can reset any talents except a very few