PDA

View Full Version : 5E ActionDamage.checkNumericalReductionType



rhagelstrom
May 6th, 2023, 23:34
If checkNumericalReductionType is called and aReduction filter is "all" AND the damage roll has multiple damage types (aDmgType) this function will over reduce because it calls the checkNumericalReductionTypeHelper function with "all" for the number of aDmgType on the damage roll.

I believe the following is what was intended.



function checkNumericalReductionType(aReduction, aDmgType, nLimit)
local nAdjust = 0;
local nSpecificAdjust;
for _,sDmgType in pairs(aDmgType) do
if nLimit then
nSpecificAdjust = ActionDamage.checkNumericalReductionTypeHelper(aRe duction[sDmgType], aDmgType, nLimit);
nAdjust = nAdjust + nSpecificAdjust;
else
nAdjust = nAdjust + ActionDamage.checkNumericalReductionTypeHelper(aRe duction[sDmgType], aDmgType);
end
end
if nLimit then
local nGlobalAdjust = ActionDamage.checkNumericalReductionTypeHelper(aRe duction["all"], aDmgType, nLimit - nSpecificAdjust);
nAdjust = nAdjust + nGlobalAdjust;
else
nAdjust = nAdjust + ActionDamage.checkNumericalReductionTypeHelper(aRe duction["all"], aDmgType);
end

return nAdjust;
end

Moon Wizard
May 7th, 2023, 20:43
Thanks, I'll incorporate in the next big ruleset push.

Regards,
JPG