Module:WeaponDPS: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 26: | Line 26: | ||
-- Scaled-down DPS formula | -- Scaled-down DPS formula | ||
local dps = offensiveStat * attacksPerSecond * 0. | local dps = offensiveStat * attacksPerSecond * 0.25 | ||
return string.format("%.2f", dps) | return string.format("%.2f", dps) |
Revision as of 12:29, 22 May 2025
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 (accuracy removed, balanced)
function p.dps(frame)
local args = frame:getParent().args
local strength = tonumber(args["strength"]) or 0
local magic = tonumber(args["magic"]) or 0
local range = tonumber(args["range"]) or 0
local speed = tonumber(args["speed"]) or 0
if speed <= 0 then
return "Invalid speed"
end
local attacksPerSecond = getAttacksPerSecond(speed)
local offensiveStat = strength + magic + range
-- Scaled-down DPS formula
local dps = offensiveStat * attacksPerSecond * 0.25
return string.format("%.2f", dps)
end
return p