Commit 9ef05670cae59d311f43f75495e1222f747a592e

Authored by Otowa Kotori
1 parent 60fd8374

forceUseTalent will not break things like movement infusion and won't be distrubed by confusion

... ... @@ -1179,6 +1179,10 @@ function _M:getCurrentTalentMode()
1179 1179 return self._temp_data and self._temp_data.current_talent_mode and self._temp_data.current_talent_mode[1] or "none"
1180 1180 end
1181 1181
  1182 +function _M:getCurrentTalentModeLast()
  1183 + return self._temp_data and self._temp_data.current_talent_mode and self._temp_data.current_talent_mode[#self._temp_data.current_talent_mode] or "none"
  1184 +end
  1185 +
1182 1186 function _M:setCurrentTalentMode(mode, tid)
1183 1187 if not self._temp_data then self._temp_data = {} end
1184 1188 if not self._temp_data.current_talent_mode then self._temp_data.current_talent_mode = {} end
... ...
... ... @@ -5918,7 +5918,7 @@ function _M:preUseTalent(ab, silent, fake, ignore_ressources)
5918 5918 end
5919 5919 if self:fireTalentCheck("callbackOnTalentPre", ab, silent, fake, ignore_ressources) then return false end
5920 5920
5921   - if not ab.never_fail then
  5921 + if self:getCurrentTalentModeLast() ~= "forced" and not ab.never_fail then
5922 5922 -- Confused ? lose a turn!
5923 5923 if self:attr("confused") and (ab.mode ~= "sustained" or not self:isTalentActive(ab.id)) and util.getval(ab.no_energy, self, ab) ~= true and not fake and not self:attr("force_talent_ignore_ressources") then
5924 5924 if rng.percent(util.bound(self:attr("confused"), 0, 50)) then
... ... @@ -6479,7 +6479,7 @@ function _M:postUseTalent(ab, ret, silent)
6479 6479 end
6480 6480
6481 6481 -- break stealth, channels, etc...
6482   - if not self.turn_procs.resetting_talents then
  6482 + if self:getCurrentTalentModeLast() ~= "forced" and not self.turn_procs.resetting_talents then
6483 6483 -- Cancel stealth!
6484 6484 if not util.getval(ab.no_break_stealth, self, ab) and util.getval(ab.no_energy, self, ab) ~= true then self:breakStealth() end
6485 6485
... ...