Module:WeaponDPS: Difference between revisions

No edit summary
No edit summary
Line 10: Line 10:
end
end


-- Theoretical DPS formula
-- Theoretical DPS formula (scaled down)
function p.dps(frame)
function p.dps(frame)
local args = frame:getParent().args
local args = frame:getParent().args
Line 19: Line 19:
local speed = tonumber(args["speed"]) or 0
local speed = tonumber(args["speed"]) or 0


-- Prevent invalid speed
if speed <= 0 then
if speed <= 0 then
return "Invalid speed"
return "Invalid speed"
Line 25: Line 24:


local attacksPerSecond = getAttacksPerSecond(speed)
local attacksPerSecond = getAttacksPerSecond(speed)
-- Combined offensive stat
local offensiveStat = strength + magic + range
local offensiveStat = strength + magic + range


-- Theoretical DPS
-- Scale DPS down by 90% (multiply by 0.1)
local dps = accuracy * offensiveStat * attacksPerSecond
local dps = accuracy * offensiveStat * attacksPerSecond * 0.1


return string.format("%.2f", dps)
return string.format("%.2f", dps)