Module:Weapon Calculation: Difference between revisions
From HorizonXI Wiki
Starfox9507 (talk | contribs) No edit summary |
Starfox9507 (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function round(num) | |||
return math.floor(num * 100 + 0.5) / 100 | |||
end | |||
function p.test (frame) | function p.test (frame) | ||
| Line 10: | Line 14: | ||
if ( not weapontype ) then | if ( not weapontype ) then | ||
dps = ( damage * 60 ) / delay | dps = round( ( damage * 60 ) / delay ) | ||
end | end | ||
Revision as of 11:20, 2 July 2025
Documentation for this module may be created at Module:Weapon Calculation/doc
local p = {}
function round(num)
return math.floor(num * 100 + 0.5) / 100
end
function p.test (frame)
local damage = tonumber(frame.args.dmg)
local delay = tonumber(frame.args.delay)
local weapontype = frame.args.type or nil
local changes = frame.args.changes or nil
local dps,tps;
if ( not weapontype ) then
dps = round( ( damage * 60 ) / delay )
end
return dps
end
-- 2 == DMG, 3 == DELAY
-- {{#switch:{{{1|}}}
-- | dps | damage per second = {{#iferror:{{#expr:{{{2}}} + {{{3}}}}}||{{#ifeq:hand-to-hand|{{lc:{{{type}}}}}|+{{#expr: ({{{2}}} * 60) / (480 + {{{3}}}) * 2 round 2}}|{{#expr: ({{{2}}} * 60) / {{{3}}} round 2}} }} }}
-- | tp per hit = {{#iferror:{{#expr:{{{2|}}}}}||{{#ifeq:hand-to-hand|{{lc:{{{type}}}}}|+<!---
-- --->{{#ifexpr:({{{2}}} + 480) >= 530|{{#expr:(14.5 + ((({{{2}}} - 50) * 3.5) / 470) - 14.18 round 1) * 10}}|<!---
-- --->{{#ifexpr:({{{2}}} + 480) > 480|{{#expr:(13.0 + ((({{{2}}} + 0) * 1.5) / 50) - 13.05 round 1) * 10}}|0}} }}|<!---
-- --->{{#ifexpr:{{{2}}} >= 530|{{#expr:(14.5 + ((({{{2}}} - 530) * 3.5) / 470) - 0.05 round 1) * 10}}|<!---
-- --->{{#ifexpr:{{{2}}} >= 480|{{#expr:(13.0 + ((({{{2}}} - 480) * 1.5) / 50) - 0.05 round 1) * 10}}|<!---
-- --->{{#ifexpr:{{{2}}} >= 450|{{#expr:(11.5 + ((({{{2}}} - 450) * 1.5) / 30) - 0.05 round 1) * 10}}|<!---
-- --->{{#ifexpr:{{{2}}} >= 180|{{#expr:(5.0 + ((({{{2}}} - 180) * 6.5) / 270) - 0.05 round 1) * 10}}|<!---
-- --->{{#ifexpr:{{{2}}} >= 0|{{#expr:(5.0 + ((({{{2}}} - 180) * 1.5) / 180) - 0.05 round 1) * 10}}|}} }} }} }} }} }} }}
-- }}
return p
