Skip to content
Snippets Groups Projects
Commit 91e023bb authored by Chris Davidson's avatar Chris Davidson
Browse files

Fix difficulty double dipping talents that grant other talents and causing undefined behavior

If a talent grants another talent it'll be inserted into the same table the difficulty bonus is iterating over and who knows what gets increased then.
parent 782cc50b
No related branches found
No related tags found
No related merge requests found
...@@ -451,7 +451,11 @@ function _M:addedToLevel(level, x, y) ...@@ -451,7 +451,11 @@ function _M:addedToLevel(level, x, y)
-- increase level of innate talents -- increase level of innate talents
-- Note: talent levels from added classes are not adjusted for difficulty directly -- Note: talent levels from added classes are not adjusted for difficulty directly
-- This means that the NPC's innate talents are generally higher level, preserving its "character" -- This means that the NPC's innate talents are generally higher level, preserving its "character"
for tid, lev in pairs(self.talents) do
-- Copy the table first so we don't insert talents that teach talents during iteration or double dip their scaling
local talents = table.clone(self.talents)
for tid, lev in pairs(talents) do
local t = self:getTalentFromId(tid) local t = self:getTalentFromId(tid)
if t.points ~= 1 then if t.points ~= 1 then
self:learnTalent(tid, true, math.floor(lev*(talent_mult - 1))) self:learnTalent(tid, true, math.floor(lev*(talent_mult - 1)))
......
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