Module:Monsters: Difference between revisions

Added handling for a few more types of max hit for monsters
(Added DR reduction to various monster table Max Hit columns)
(Added handling for a few more types of max hit for monsters)
Line 343: Line 343:
end
end


function p.getSpecAttackMaxHit(specAttack, normalMaxHit)
function p.getSpecAttackMaxHit(specAttack, normalMaxHit, monsterDR)
local result = 0
local result = 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
Line 363: Line 362:
result = dmg.maxPercent * normalMaxHit * 0.01
result = dmg.maxPercent * normalMaxHit * 0.01
end
end
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
result = dmg.maxPercent * 20
elseif dmg.maxRoll == 'MaxHitScaledByHP2x' then
result = normalMaxHit * 2
elseif dmg.maxRoll == 'PoisonMax35' then
result = normalMaxHit * 1.35
elseif dmg.maxRoll == "MaxHitDR" then
result = 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
Line 410: Line 418:
normalChance = normalChance - specAttack.defaultChance
normalChance = normalChance - specAttack.defaultChance
end
end
local thisMax = p.getSpecAttackMaxHit(specAttack, normalMaxHit)
local thisMax = p.getSpecAttackMaxHit(specAttack, normalMaxHit, p._getMonsterStat(monster, 'damageReduction'))
if not canStun and p.canSpecAttackApplyEffect(specAttack, 'Stun') then canStun = true end
if not canStun and p.canSpecAttackApplyEffect(specAttack, 'Stun') then canStun = true end
if not canSleep and p.canSpecAttackApplyEffect(specAttack, 'Sleep') then canSleep = true end
if not canSleep and p.canSpecAttackApplyEffect(specAttack, 'Sleep') then canSleep = true end