ToME: the Tales of Maj'Eyal
http://forums.te4.org/

Running below 1 resource deactivates sustains
http://forums.te4.org/viewtopic.php?f=42&t=49590
Page 1 of 1

Author:  Serph [ Thu Jun 13, 2019 3:20 am ]
Post subject:  Running below 1 resource deactivates sustains

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 370 times ]

Author:  Cathbald [ Sat Jun 15, 2019 2:22 pm ]
Post subject:  Re: Running below 1 resource deactivates sustains

Good to know is also that sustains are deactivated after you regen resources, so having 1 mana regen takes care of that.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/