Commit 5e702c84092abcec783fc08944a169a6b4c800d2

Authored by DarkGod
2 parents b739184a 73be25dd

Merge branch 'force_talent_no_break' into 'master'

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



See merge request !728
... ... @@ -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
... ...
... ... @@ -5920,7 +5920,7 @@ function _M:preUseTalent(ab, silent, fake, ignore_ressources)
5920 5920 end
5921 5921 if self:fireTalentCheck("callbackOnTalentPre", ab, silent, fake, ignore_ressources) then return false end
5922 5922
5923   - if not ab.never_fail then
  5923 + if self:getCurrentTalentModeLast() ~= "forced" and not ab.never_fail then
5924 5924 -- Confused ? lose a turn!
5925 5925 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
5926 5926 if rng.percent(util.bound(self:attr("confused"), 0, 50)) then
... ... @@ -6482,7 +6482,7 @@ function _M:postUseTalent(ab, ret, silent)
6482 6482 end
6483 6483
6484 6484 -- break stealth, channels, etc...
6485   - if not self.turn_procs.resetting_talents then
  6485 + if self:getCurrentTalentModeLast() ~= "forced" and not self.turn_procs.resetting_talents then
6486 6486 -- Cancel stealth!
6487 6487 if not util.getval(ab.no_break_stealth, self, ab) and util.getval(ab.no_energy, self, ab) ~= true then self:breakStealth() end
6488 6488
... ... @@ -6502,11 +6502,11 @@ function _M:postUseTalent(ab, ret, silent)
6502 6502 end)
6503 6503 end
6504 6504 end
6505   - end
6506 6505
6507   - if not ab.innate and self:hasEffect(self.EFF_RAMPAGE) and ab.id ~= self.T_RAMPAGE and ab.id ~= self.T_SLAM then
6508   - local eff = self:hasEffect(self.EFF_RAMPAGE)
6509   - value = self.tempeffect_def[self.EFF_RAMPAGE].do_postUseTalent(self, eff, value)
  6506 + if not ab.innate and self:hasEffect(self.EFF_RAMPAGE) and ab.id ~= self.T_RAMPAGE and ab.id ~= self.T_SLAM then
  6507 + local eff = self:hasEffect(self.EFF_RAMPAGE)
  6508 + value = self.tempeffect_def[self.EFF_RAMPAGE].do_postUseTalent(self, eff, value)
  6509 + end
6510 6510 end
6511 6511
6512 6512 if ab.is_summon and ab.is_nature and self:attr("heal_on_nature_summon") then
... ...