Commit bd3bcea1e18d02da46ae3e10365235f25d5483e9

Authored by DarkGod
1 parent c898b480

Fixed Lichform doesnt preventing removing points from necrosis talents

... ... @@ -449,7 +449,7 @@ end
449 449 --- Checks the talent if learnable
450 450 -- @param t the talent to check
451 451 -- @param offset the level offset to check, defaults to 1
452   -function _M:canLearnTalent(t, offset)
  452 +function _M:canLearnTalent(t, offset, ignore_special)
453 453 -- Check prerequisites
454 454 if rawget(t, "require") then
455 455 local req = t.require
... ... @@ -468,7 +468,7 @@ function _M:canLearnTalent(t, offset)
468 468 return nil, "not enough levels"
469 469 end
470 470 end
471   - if req.special then
  471 + if req.special and not ignore_special then
472 472 if not req.special.fct(self, t, offset) then
473 473 return nil, req.special.desc
474 474 end
... ...
... ... @@ -152,7 +152,7 @@ function _M:getMaxTPoints(t)
152 152 end
153 153
154 154 function _M:finish()
155   - local ok, dep_miss = self:checkDeps(true)
  155 + local ok, dep_miss = self:checkDeps(true, true)
156 156 if not ok then
157 157 self:simpleLongPopup("Impossible", "You cannot learn this talent(s): "..dep_miss, game.w * 0.4)
158 158 return nil
... ... @@ -252,7 +252,7 @@ function _M:computeDeps(t)
252 252 end
253 253 end
254 254
255   -function _M:checkDeps(simple)
  255 +function _M:checkDeps(simple, ignore_special)
256 256 local talents = ""
257 257 local stats_ok = true
258 258
... ... @@ -263,7 +263,7 @@ function _M:checkDeps(simple)
263 263 checked[t_id] = true
264 264
265 265 local t = self.actor:getTalentFromId(t_id)
266   - local ok, reason = self.actor:canLearnTalent(t, 0)
  266 + local ok, reason = self.actor:canLearnTalent(t, 0, ignore_special)
267 267 if not ok and (self.actor:knowTalent(t) or force) then talents = talents.."\n#GOLD##{bold}# - "..t.name.."#{normal}##LAST#("..reason..")" end
268 268 if reason == "not enough stat" then
269 269 stats_ok = false
... ... @@ -335,7 +335,7 @@ function _M:learnTalent(t_id, v)
335 335 self.actor:unlearnTalent(t_id, nil, true, {no_unlearn=true})
336 336 self.talents_changed[t_id] = true
337 337 local _, reason = self.actor:canLearnTalent(t, 0)
338   - local ok, dep_miss, stats_ok = self:checkDeps()
  338 + local ok, dep_miss, stats_ok = self:checkDeps(nil, true)
339 339 self.actor:learnTalent(t_id, true, nil, {no_unlearn=true})
340 340 if ok or reason == "not enough stat" or not stats_ok then
341 341 self.actor:unlearnTalent(t_id)
... ... @@ -398,7 +398,7 @@ function _M:learnType(tt, v)
398 398 self.talent_types_learned[tt][2] = nil
399 399 else
400 400 self.actor:unlearnTalentType(tt)
401   - local ok, dep_miss = self:checkDeps()
  401 + local ok, dep_miss = self:checkDeps(nil, true)
402 402 if ok then
403 403 self.actor.unused_talents_types = self.actor.unused_talents_types + 1
404 404 self.new_talents_changed = true
... ...
... ... @@ -54,6 +54,7 @@ configuration "Debug"
54 54 defines { }
55 55 flags { "Symbols" }
56 56 buildoptions { "-ggdb" }
  57 + buildoptions { "-O3" }
57 58 targetdir "bin/Debug"
58 59 if _OPTIONS.luaassert then defines {"LUA_USE_APICHECK"} end
59 60 if _OPTIONS.pedantic then buildoptions { "-Wall" } end
... ...