Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing source and lack of base mod filtering on resistance conversion #6460

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/Modules/CalcDefence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ function calcs.defence(env, actor)
end
end
if maxRes ~= 0 then
modDB:NewMod(resTo.."ResistMax", "BASE", maxRes * conversionRate)
modDB:NewMod(resTo.."ResistMax", "BASE", maxRes * conversionRate, resFrom.." To "..resTo.." Max Resistance Conversion")
end
end
end
Expand All @@ -340,8 +340,17 @@ function calcs.defence(env, actor)
for _, resTo in ipairs(resistTypeList) do
local conversionRate = modDB:Sum("BASE", nil, resFrom.."ResConvertTo"..resTo) / 100
if conversionRate ~= 0 then
if not res then res = modDB:Sum("BASE", nil, resFrom.."Resist") end
modDB:NewMod(resTo.."Resist", "BASE", res * conversionRate)
if not res then
res = 0
for _, mod in ipairs(modDB:Tabulate("BASE", nil, resFrom.."Resist")) do
if mod.mod.source ~= "Base" then
res = res + mod.value
end
end
end
if res ~= 0 then
modDB:NewMod(resTo.."Resist", "BASE", res * conversionRate, resFrom.." To "..resTo.." Resistance Conversion")
end
end
end
end
Expand Down