Skip to content

Commit 903ad1e

Browse files
authored
improve implementation of Kaom's Heart 'You have no spirit' mod. changed mod parsing, mod calculation to consider the override and calculate negative spirit, and calc sections to display the override on the calc panel (#475)
1 parent 79505a1 commit 903ad1e

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

src/Data/ModCache.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3058,7 +3058,7 @@ c["You have a Smoke Cloud around you while stationary"]={nil,"a Smoke Cloud arou
30583058
c["You have no Accuracy Penalty at Distance"]={nil,"no Accuracy Penalty at Distance "}
30593059
c["You have no Elemental Resistances"]={{[1]={flags=0,keywordFlags=0,name="FireResist",type="OVERRIDE",value=0},[2]={flags=0,keywordFlags=0,name="ColdResist",type="OVERRIDE",value=0},[3]={flags=0,keywordFlags=0,name="LightningResist",type="OVERRIDE",value=0}},nil}
30603060
c["You have no Life Regeneration"]={{[1]={flags=0,keywordFlags=0,name="NoLifeRegen",type="FLAG",value=true}},nil}
3061-
c["You have no Spirit"]={{[1]={flags=0,keywordFlags=0,name="NoSpirit",type="FLAG",value=true}},nil}
3061+
c["You have no Spirit"]={{[1]={flags=0,keywordFlags=0,name="Spirit",type="OVERRIDE",value=0}},nil}
30623062
c["You lose 5% of Energy Shield per second"]={{[1]={flags=0,keywordFlags=0,name="EnergyShieldDegenPercent",type="BASE",value=5}},nil}
30633063
c["You take 10% of damage from Blocked Hits"]={{[1]={flags=0,keywordFlags=0,name="BlockEffect",type="BASE",value=10}},nil}
30643064
c["You take 20% of damage from Blocked Hits"]={{[1]={flags=0,keywordFlags=0,name="BlockEffect",type="BASE",value=20}},nil}

src/Modules/CalcDefence.lua

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ function calcs.doActorLifeManaSpirit(actor)
7070
local inc = modDB:Sum("INC", nil, res)
7171
local more = modDB:More(nil, res)
7272
local conv = m_min(modDB:Sum("BASE", nil, res .. "ConvertToEnergyShield", res .. "ConvertToArmour", res .. "ConvertToEvasion"), 100)
73-
output[res] = m_max(round((base * (1 - conv/100) + extra) * (1 + inc/100) * more), 1)
73+
local override = modDB:Override(nil, res)
74+
output[res.."HasOverride"] = override ~= nil
75+
output[res] = override or m_max(round((base * (1 - conv/100) + extra) * (1 + inc/100) * more), 1)
7476
if breakdown then
7577
if inc ~= 0 or more ~= 1 or conv ~= 0 or extra ~= 0 then
7678
breakdown[res][1] = s_format("%g ^8(base)", base)
@@ -100,9 +102,6 @@ function calcs.doActorLifeManaSpirit(actor)
100102
condList["FullLife"] = true
101103
end
102104
output.LowestOfMaximumLifeAndMaximumMana = m_min(output.Life, output.Mana)
103-
if modDB:Flag(nil, "NoSpirit") then
104-
output.Spirit = 0
105-
end
106105
end
107106

108107
-- Calculate life/mana/spirit reservation
@@ -229,22 +228,19 @@ function calcs.doActorLifeManaSpiritReservation(actor)
229228

230229
for _, pool in pairs({"Life", "Mana", "Spirit"}) do
231230
local max = output[pool]
232-
local reserved
231+
local lowPerc = modDB:Sum("BASE", nil, "Low" .. pool .. "Percentage")
232+
local reserved = (actor["reserved_"..pool.."Base"] or 0) + m_ceil(max * (actor["reserved_"..pool.."Percent"] or 0) / 100)
233+
uncancellableReservation = actor["uncancellable_"..pool.."Reservation"] or 0
234+
output[pool.."Reserved"] = m_min(reserved, max)
235+
output[pool.."Unreserved"] = max - reserved
236+
output[pool.."UncancellableReservation"] = m_min(uncancellableReservation, 0)
237+
output[pool.."CancellableReservation"] = 100 - uncancellableReservation
233238
if max > 0 then
234-
local lowPerc = modDB:Sum("BASE", nil, "Low" .. pool .. "Percentage")
235-
reserved = (actor["reserved_"..pool.."Base"] or 0) + m_ceil(max * (actor["reserved_"..pool.."Percent"] or 0) / 100)
236-
uncancellableReservation = actor["uncancellable_"..pool.."Reservation"] or 0
237-
output[pool.."Reserved"] = m_min(reserved, max)
238239
output[pool.."ReservedPercent"] = m_min(reserved / max * 100, 100)
239-
output[pool.."Unreserved"] = max - reserved
240240
output[pool.."UnreservedPercent"] = (max - reserved) / max * 100
241-
output[pool.."UncancellableReservation"] = m_min(uncancellableReservation, 0)
242-
output[pool.."CancellableReservation"] = 100 - uncancellableReservation
243241
if (max - reserved) / max <= (lowPerc > 0 and lowPerc or data.misc.LowPoolThreshold) then
244242
condList["Low"..pool] = true
245243
end
246-
else
247-
reserved = 0
248244
end
249245
for _, value in ipairs(modDB:List(nil, "GrantReserved"..pool.."AsAura")) do
250246
local auraMod = copyTable(value.mod)

src/Modules/CalcSections.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,7 @@ return {
14851485
{ label = "Inc. from Tree", { format = "{0:mod:1}%", { modName = "Spirit", modType = "INC", modSource = "Tree" }, }, },
14861486
{ label = "Total Base", { format = "{0:mod:1}", { modName = "Spirit", modType = "BASE" }, }, },
14871487
{ label = "Total Increased", { format = "{0:mod:1}%", { modName = "Spirit", modType = "INC" }, }, },
1488+
{ label = "Override", haveOutput = "SpiritHasOverride", { format = "{0:mod:1}", { modName = "Spirit", modType = "OVERRIDE" }, }, },
14881489
{ label = "Total", { format = "{0:output:Spirit}", { breakdown = "Spirit" }, }, },
14891490
{ label = "Reserved", { format = "{0:output:SpiritReserved} ({0:output:SpiritReservedPercent}%)", { breakdown = "SpiritReserved" }, }, },
14901491
{ label = "Unreserved", { format = "{0:output:SpiritUnreserved} ({0:output:SpiritUnreservedPercent}%)" }, },

src/Modules/ModParser.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4272,7 +4272,9 @@ local specialModList = {
42724272
mod("ColdResist", "OVERRIDE", 0),
42734273
mod("LightningResist", "OVERRIDE", 0),
42744274
},
4275-
["you have no spirit"] = { flag("NoSpirit") },
4275+
["you have no spirit"] = {
4276+
mod("Spirit", "OVERRIDE", 0),
4277+
},
42764278
["you have no elemental resistances"] = {
42774279
mod("FireResist", "OVERRIDE", 0),
42784280
mod("ColdResist", "OVERRIDE", 0),

0 commit comments

Comments
 (0)