Module:Sandbox/User:Sfoxrs/ruby: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(No difference)
|
Revision as of 13:37, 4 August 2021
Documentation for this module may be created at Module:Sandbox/User:Sfoxrs/ruby/doc
-- <pre>
local p = {}
local yesno = require ("Module:Yesno")
local chart = require( 'Module:Chart data' )
local lang = mw.getContentLanguage()
local min = math.min
local max = math.max
local floor = math.floor
local ceil = math.ceil
function p.main(frame)
local invokeArgs = frame.args
local args = frame:getParent().args
return p._main( invokeArgs, args )
end
function bool_to_number(value)
return value and 1 or 0
end
function p._main( invokeArgs, args )
--arguments
local lookup_toggle = 0
local maxlp = tonumber(args.max_hp) or 0
local monster_Name = args.monsterName
local currenthp = tonumber(args.current_hp) or 0
local playermaxlp = tonumber(args.your_max_hp) or 0
local playercurrentlp = tonumber(args.your_hp) or 0
local critical = yesno(args.crtical)
local thirtykcap = yesno(args.thirtykcap)
local grico = yesno(args.grico)
local rangedlevelbase = tonumber(args.rangedlevelbase) or 0
local rangedlevelboosted = tonumber(args.rangedlevelboosted) or 0
local pocket = args.pocket
local seers = yesno(args.seers)
local rangedcape = yesno(args.ranged_Cape)
local precise = tonumber(args.precise) or 0
local equilibrium = tonumber(args.equilibrium) or 0
local prayer = args.prayer
local aura = args.aura
local needle = yesno(args.needle)
local swiftness = yesno(args.swiftness)
local vuln = yesno(args.vulnerability)
local smokecloud = yesno(args.smokecloud)
local berserkersfuryrelicpower = yesno(args.berserkersfuryrelicpower)
local average_toggle = yesno(args.average_toggle)
local average = tonumber(args.average) or 0
local timeBetween = tonumber(args.timeBetween) or 0
--start calculating
local percentage = max(1,floor(20*currentlp/maxlp))
local fraction = percentage/100
--max damage
local maxdamage = 10000
if thirykcap then maxdamage = 30000
elseif critical then
if (pocket=="Erethdors grimoire") then
maxdamage = 15000*(1+bool_to_number(smokecloud)*0.048)
else
maxdamage = 12000*(1+bool_to_number(smokecloud)*0.048)
end
end
--softcap
local softcapmax = 10000
if (pocket=="Erethdors grimoire") then softcapmax = 15000 end
local softcap = softcapmax
if (currentlp<=(maxlp/2)) then floor(softcapmax*2*currentlp/maxlp) end
--basehit
end