Skip to content

Commit b58702c

Browse files
LocalIdentityLocalIdentity
andauthored
Fix Damage conversion / gain calcs (#1374)
calcConvertedDamage was using the wrong order of variables for the function so it wasn't taking into account gained damage if a skill had innate conversion on it. E.g. Skill has 50% convert phys to fire and tree has 20% elemental as extra lightning, it was not finding the fire damage that had been converted so the ele as extra lightning was not giving any damage Now that this was fixed though it was taking into account the proportion of damage converted from a skill when calculating gain as e.g. 100% skill phys to fire stops mods like 20% phys as extra fire from working as there is no more base phys damage to scale from Lastly was a bug that GGG fixed where damage mods that increased the maximum amount of a damage type (e.g. 30% more maximum phys) was affecting damage types after conversion e.g. 100 to 100 phys damage skill with 30% more maximum phys and 100% skill phys to fire should have 100 to 100 fire damage, not 100 to130 that it was previously I hope this is all the conversion issues fixed now Co-authored-by: LocalIdentity <[email protected]>
1 parent b036f50 commit b58702c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Modules/CalcOffence.lua

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,11 @@ local function calcConvertedDamage(activeSkill, output, cfg, damageType)
6868
local conversionTable = activeSkill.conversionTable
6969
for _, otherType in ipairs(dmgTypeList) do
7070
local convMult = conversionTable[otherType][damageType]
71-
local moreMinDamage = skillModList:More(cfg, "Min"..otherType.."Damage")
72-
local moreMaxDamage = skillModList:More(cfg, "Max"..otherType.."Damage")
7371
if convMult > 0 then
7472
-- Damage is being converted/gained from the other damage type
7573
local min, max = output[otherType.."MinBase"], output[otherType.."MaxBase"]
76-
convertedMin = convertedMin + (min or 0) * convMult * moreMinDamage
77-
convertedMax = convertedMax + (max or 0) * convMult * moreMaxDamage
74+
convertedMin = convertedMin + (min or 0) * convMult
75+
convertedMax = convertedMax + (max or 0) * convMult
7876
end
7977
end
8078
if convertedMin ~= 0 and convertedMax ~= 0 then
@@ -90,12 +88,12 @@ local function calcGainedDamage(activeSkill, output, cfg, damageType)
9088

9189
local gainedMin, gainedMax = 0, 0
9290
for _, otherType in ipairs(dmgTypeList) do
93-
local baseMin = m_floor(output[otherType.."MinBase"])
94-
local baseMax = m_floor(output[otherType.."MaxBase"])
91+
local baseMin = m_floor(output[otherType.."MinBase"] * activeSkill.skillConversionTable[otherType].mult)
92+
local baseMax = m_floor(output[otherType.."MaxBase"] * activeSkill.skillConversionTable[otherType].mult)
9593
local gainMult = gainTable[otherType][damageType]
9694
if gainMult and gainMult > 0 then
9795
-- Damage is being converted/gained from the other damage type
98-
local convertedMin, convertedMax = calcConvertedDamage(activeSkill, cfg, output, otherType)
96+
local convertedMin, convertedMax = calcConvertedDamage(activeSkill, output, cfg, otherType)
9997
gainedMin = gainedMin + (baseMin + convertedMin) * gainMult
10098
gainedMax = gainedMax + (baseMax + convertedMax) * gainMult
10199
end
@@ -2047,15 +2045,18 @@ function calcs.offence(env, actor, activeSkill)
20472045
end
20482046

20492047
-- Calculate damage conversion percentages
2048+
activeSkill.skillConversionTable = wipeTable(activeSkill.skillConversionTable)
20502049
activeSkill.conversionTable = wipeTable(activeSkill.conversionTable)
20512050
activeSkill.gainTable = wipeTable(activeSkill.gainTable)
20522051

20532052
-- Initialize conversion tables
20542053
for _, type in ipairs(dmgTypeList) do
2054+
activeSkill.skillConversionTable[type] = {}
20552055
activeSkill.conversionTable[type] = {}
20562056
activeSkill.gainTable[type] = {}
20572057
for _, otherType in ipairs(dmgTypeList) do
20582058
activeSkill.conversionTable[type][otherType] = 0
2059+
activeSkill.skillConversionTable[type][otherType] = 0
20592060
end
20602061
end
20612062

@@ -2102,6 +2103,7 @@ function calcs.offence(env, actor, activeSkill)
21022103
activeSkill.conversionTable[damageType][toType] = amount
21032104
end
21042105
activeSkill.conversionTable[damageType].mult = 1 - m_min(skillTotal / 100, 1)
2106+
activeSkill.skillConversionTable[damageType].mult = 1 - m_min(skillTotal / 100, 1)
21052107
end
21062108

21072109
-- Second step: Process global conversion and gains

0 commit comments

Comments
 (0)