4,951
edits
(Fix (another) user export table) |
Falterfire (talk | contribs) (Updated getSpecAttackMaxHit to properly account for multi-hit attacks) |
||
Line 344: | Line 344: | ||
function p.getSpecAttackMaxHit(specAttack, normalMaxHit, monsterDR) | function p.getSpecAttackMaxHit(specAttack, normalMaxHit, monsterDR) | ||
local | local bestHit = 0 | ||
for i, dmg in pairs(specAttack.damage) do | for i, dmg in pairs(specAttack.damage) do | ||
if dmg.damageType == 'Normal' then | if dmg.damageType == 'Normal' then | ||
--Account for special attacks that include a normal attack hit | --Account for special attacks that include a normal attack hit | ||
thisHit = normalMaxHit | |||
if dmg.amplitude ~= nil then | if dmg.amplitude ~= nil then | ||
thisHit = thisHit * (dmg.amplitude / 100) | |||
end | end | ||
elseif dmg.maxRoll == 'Fixed' then | elseif dmg.maxRoll == 'Fixed' then | ||
thisHit = dmg.maxPercent * 10 | |||
elseif dmg.maxRoll == 'MaxHit' then | elseif dmg.maxRoll == 'MaxHit' then | ||
if dmg.character == 'Target' then | if dmg.character == 'Target' then | ||
--Confusion applied damage based on the player's max hit. Gonna just ignore that one | --Confusion applied damage based on the player's max hit. Gonna just ignore that one | ||
thisHit = 0 | |||
else | else | ||
thisHit = dmg.maxPercent * normalMaxHit * 0.01 | |||
end | end | ||
elseif Shared.contains(dmg.maxRoll, "Fixed100") then | elseif Shared.contains(dmg.maxRoll, "Fixed100") then | ||
--Handles attacks that are doubled when conditions are met like Trogark's double damage if the player is burning | --Handles attacks that are doubled when conditions are met like Trogark's double damage if the player is burning | ||
thisHit = dmg.maxPercent * 20 | |||
elseif dmg.maxRoll == 'MaxHitScaledByHP2x' then | elseif dmg.maxRoll == 'MaxHitScaledByHP2x' then | ||
thisHit = normalMaxHit * 2 | |||
elseif dmg.maxRoll == 'PoisonMax35' then | elseif dmg.maxRoll == 'PoisonMax35' then | ||
thisHit = normalMaxHit * 1.35 | |||
elseif dmg.maxRoll == "MaxHitDR" then | elseif dmg.maxRoll == "MaxHitDR" then | ||
thisHit = normalMaxHit * dmg.maxPercent * 0.01 * (1 + monsterDR * 0.01) | |||
elseif Shared.contains({'Bleeding', 'Poisoned'}, dmg.maxRoll) then | elseif Shared.contains({'Bleeding', 'Poisoned'}, dmg.maxRoll) then | ||
-- TODO: This is limited in that there is no verification that bleed/poison | -- TODO: This is limited in that there is no verification that bleed/poison | ||
-- can be applied to the target, it is assumed that it can and so this applies | -- can be applied to the target, it is assumed that it can and so this applies | ||
thisHit = thisHit + dmg.maxPercent * 10 | |||
end | |||
if thisHit > bestHit then | |||
bestHit = thisHit | |||
end | end | ||
end | end | ||
return | return bestHit | ||
end | end | ||