Running below 1 resource deactivates sustains

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Serph
Posts: 1
Joined: Thu Jun 13, 2019 2:52 am

Running below 1 resource deactivates sustains

#1 Post by Serph »

This was obviously programmed this way for a reason.
But nonetheless as a player this is unexpected behavior, it took me looking at the source code to figure out why my sustains would suddenly deactivate.
EX: Activate Sustain, Have 12 Mana, Cast Lightning for 11.2 Mana, Mana is technically .8 but rounded up to appear as 1, sustains are then deactivated as Mana is less than 1.
Really hope to see this improvement in the next patch.

-- Break some sustains if certain resources are too low
-- Note: force_talent_ignore_ressources has no effect here
-- consider replacing the minimum resource value of 1 with a number based on the talent and resource
for tid, p in pairs(self.sustain_talents) do
local deact, t = false, self.talents_def[tid]
-- check each possible resource the talent uses
for res, res_def in ipairs(_M.resources_def) do
if (t.remove_on_zero == nil and res_def.depleted_unsustain) or (t.remove_on_zero ~= nil and util.getval(t.remove_on_zero, self, t)) then
if t[res_def.sustain_prop] then
if res == self.RS_STAMINA and self:hasEffect(self.EFF_ADRENALINE_SURGE) then
else
if res_def.invert_values then
if self[res_def.maxname] and (self[res_def.maxname] - self[res_def.short_name]) < 1 then
deact = true break
end
else
if self[res_def.minname] and (self[res_def.short_name] - self[res_def.minname]) < 1 then
deact = true break
end
end
end
end
end
end
if deact then self:forceUseTalent(tid, {ignore_energy=true}) end
end

-- Handle if Embers DLC is available.
if self.steam and self.steam < 1 then
for tid, _ in pairs(self.sustain_talents) do
local t = self:getTalentFromId(tid)
if (t.sustain_steam or t.drain_steam) then
self:forceUseTalent(tid, {ignore_energy=true})
end
end
end


-- clear grappling
if self:hasEffect(self.EFF_GRAPPLING) and self.stamina < 1 and not self:hasEffect(self.EFF_ADRENALINE_SURGE) then
self:removeEffect(self.EFF_GRAPPLING)
end

-- disable spell sustains
if self:attr("spell_failure") then
for tid, _ in pairs(self.sustain_talents) do
local t = self:getTalentFromId(tid)
if t.is_spell and rng.percent(self:attr("spell_failure")/10)then
self:forceUseTalent(tid, {ignore_energy=true})
if not silent then game.logSeen(self, "%s has been disrupted by #ORCHID#anti-magic forces#LAST#!", t.name) end
end
end
end
Attachments
tomeEX.GIF
tomeEX.GIF (69.63 KiB) Viewed 870 times

Cathbald
Uruivellas
Posts: 743
Joined: Wed Jan 22, 2014 1:46 pm

Re: Running below 1 resource deactivates sustains

#2 Post by Cathbald »

Good to know is also that sustains are deactivated after you regen resources, so having 1 mana regen takes care of that.
I write guides and make addons too now, apparently

You can go here for a compilation of everything I wrote, plus some other important stuff!

Includes general guides (inscriptions, zone, prodigies), and class guides (Demo, Anorithil, Bulwark, Zerker, Sblade)

Post Reply