Module:Sandbox/User:Sfoxrs/5

From WIDEVERSE Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Sandbox/User:Sfoxrs/5/doc

-- <pre>
local p = {}
 
local yesno = require ("Module:Yesno")
 
function p.main(frame)
    local args = frame:getParent().args
    local enrage = tonumber(args.enrage) or 0
    local streak = tonumber(args.streak) or 0    
    local lotd = yesno(args.lotd) or false
    local modifiedEnrage = enrage
 
    if lotd then
        modifiedEnrage = math.min(enrage + 25,4000)
    end
 
    local res = ""
 
    local unique = math.floor(10000 / (10 + .25*modifiedEnrage + 3*streak) )
    if enrage<100 then
        unique = unique*10
    end
    if enrage<25 then
        unique = unique*3
    end
    
    unique = math.max(unique,9)
 
    res = res .. "The chance of receiving any unique is " .. "1/" .. string.format("%.0f",unique) .. "<br/>"
    res = res .. "The chance of receiving an orb is " .. "1/" .. string.format("%.0f",unique * 115/75) .. "<br/>"
    res = res .. "The chance of receiving any dormant/codex is " .. "1/" .. string.format("%.0f",unique * 115/40) .. "<br/>"
    res = res .. "The chance of receiving a specific dormant/codex is " .. "1/" .. string.format("%.0f",unique * 115/10)
 
    return res
 
end
return p