Module:WeaponDPS: Difference between revisions
No edit summary |
No edit summary |
||
(24 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
function p.dps(frame) | function p.dps(frame) | ||
local | local args = frame.args | ||
local | local parent = frame:getParent() | ||
local str = tonumber(args.Strength or parent.args.Strength) or 0 | |||
local acc = tonumber(args.Accuracy or parent.args.Accuracy) or 0 | |||
local ticks = tonumber(args.Speed or parent.args.Speed) | |||
local maxHit = | if (str == 0 and acc == 0) then return "No STR or ACC" end | ||
if not ticks then return "No speed" end | |||
local effectiveStr = str + acc | |||
local maxHit = effectiveStr / 14 | |||
local seconds = ticks * 0.6 | local seconds = ticks * 0.6 | ||
local dps = maxHit / seconds | local dps = maxHit / seconds | ||
return string.format( | return '<abbr title="Theoretical damage per second">' .. string.format('%.2f', dps) .. '</abbr>' | ||
end | end | ||
return p | return p |