44 lines
1.0 KiB
Lua
44 lines
1.0 KiB
Lua
-- force calculation
|
|
--------------------
|
|
totalForce = nil
|
|
|
|
local badgeRates = {
|
|
0.5, -- Played
|
|
1.0, -- Cleared
|
|
1.02, -- Hard clear
|
|
1.04, -- UC
|
|
1.1 -- PUC
|
|
}
|
|
|
|
local gradeRates = {
|
|
{["min"] = 9900000, ["rate"] = 1.05}, -- S
|
|
{["min"] = 9800000, ["rate"] = 1.02}, -- AAA+
|
|
{["min"] = 9700000, ["rate"] = 1}, -- AAA
|
|
{["min"] = 9500000, ["rate"] = 0.97}, -- AA+
|
|
{["min"] = 9300000, ["rate"] = 0.94}, -- AA
|
|
{["min"] = 9000000, ["rate"] = 0.91}, -- A+
|
|
{["min"] = 8700000, ["rate"] = 0.88}, -- A
|
|
{["min"] = 7500000, ["rate"] = 0.85}, -- B
|
|
{["min"] = 6500000, ["rate"] = 0.82}, -- C
|
|
{["min"] = 0, ["rate"] = 0.8} -- D
|
|
}
|
|
|
|
calculate_force = function(diff)
|
|
if #diff.scores < 1 then
|
|
return 0
|
|
end
|
|
local score = diff.scores[1]
|
|
local badgeRate = badgeRates[diff.topBadge]
|
|
local gradeRate
|
|
for i, v in ipairs(gradeRates) do
|
|
if score.score >= v.min then
|
|
gradeRate = v.rate
|
|
break
|
|
end
|
|
end
|
|
return math.floor((diff.level * 2) * (score.score / 10000000) * gradeRate * badgeRate) / 100
|
|
end
|
|
|
|
return {
|
|
calc = calculate_force
|
|
} |