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

Add an ActorTalent.deactivate_on property for things that disable at various events

Copying and pasting really awkward callbacks for this was getting old.  Also, theres an unknown bug with autocast and the deactivate callbacks causing permanent stat loss, hopefully moving where they happen indirectly fixes it.
parent 80677699
No related branches found
No related tags found
No related merge requests found
......@@ -8002,6 +8002,12 @@ function _M:checkStillInCombat()
-- Ok no more in combat!
self.in_combat = nil
for tid, _ in pairs(self.sustain_talents) do
local t = self:getTalentFromId(tid)
if t.deactivate_on and t.deactivate_on.no_combat then
self:forceUseTalent(tid, {ignore_energy=true})
end
end
self:updateInCombatStatus()
end
......
......@@ -1151,6 +1151,14 @@ function _M:restStep()
self:useEnergy()
self.resting.cnt = self.resting.cnt + 1
self:fireTalentCheck("callbackOnWait")
-- Disable sustains that deactivate on rest
for tid, _ in pairs(self.sustain_talents) do
local t = self:getTalentFromId(tid)
if t.deactivate_on and t.deactivate_on.rest then
self:forceUseTalent(tid, {ignore_energy=true, ignore_cd=true})
end
end
return true
end
end
......@@ -1227,8 +1235,16 @@ function _M:runCheck(ignore_memory)
if game.level.map:checkAllEntities(x, y, "store") then noticed = "store entrance spotted" ; return false, noticed end
end)
if noticed then return false, noticed end
return engine.interface.PlayerRun.runCheck(self)
local can, noticed = engine.interface.PlayerRun.runCheck(self)
if can then
for tid, _ in pairs(self.sustain_talents) do
local t = self:getTalentFromId(tid)
if t.deactivate_on and t.deactivate_on.run then
self:forceUseTalent(tid, {ignore_energy=true, ignore_cd=true})
end
end
end
return can, noticed
end
--- Move with the mouse
......
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