Commit 0f35340e164a687f59d7e9da8cfa80aab87c37e8

Authored by DarkGod
2 parents 6307bf18 394622ad

Merge branch 'fix-object-force_talent_ignore_ressources' into 'master'

Fix talent ignore resource when lua error on item skill

Using item talent will temporary set force_talent_ignore_ressources to avoid using resources.

However, it will not reset the flag when a lua error happen and exit this function

This patch will fix this problem

See merge request !678
... ... @@ -248,7 +248,12 @@ function _M:useObject(who, ...)
248 248 else
249 249 local ok, special
250 250 ok, ret, special = xpcall(function() return ab.action(who, ab) end, debug.traceback)
251   - if not ok then who:onTalentLuaError(ab, ret) error(ret) end
  251 + if not ok then
  252 + who:attr("force_talent_ignore_ressources", -1)
  253 + who.talents[id] = old_level
  254 + who:onTalentLuaError(ab, ret)
  255 + error(ret)
  256 + end
252 257 end
253 258 who:attr("force_talent_ignore_ressources", -1)
254 259 who.talents[id] = old_level
... ...