Module:WeaponDPS
Documentation for this module may be created at Module:WeaponDPS/doc
local p = {}
-- Converts speed to attacks per second
local function getAttacksPerSecond(speed)
if speed <= 0 then
return 0
end
local attackTimeSeconds = speed * 0.6
return 1 / attackTimeSeconds
end
-- Theoretical DPS formula
function p.dps(frame)
local args = frame:getParent().args
local accuracy = tonumber(args["accuracy"]) or 0
local strength = tonumber(args["strength"]) or 0
local speed = tonumber(args["speed"]) or 0
-- Prevent division by zero or invalid speed
if speed <= 0 then
return "Invalid speed"
end
local attacksPerSecond = getAttacksPerSecond(speed)
-- Pseudo-DPS: simple product of stats
local dps = accuracy * strength * attacksPerSecond
return string.format("%.2f", dps)
end
return p