+ basic vf calculation
This commit is contained in:
parent
c51daa0273
commit
3025c6651d
|
@ -0,0 +1,44 @@
|
|||
-- 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
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
local volforceBadgeImage = gfx.CreateSkinImage("volforce/10.png", 0);
|
||||
|
||||
function render(deltatime, x, y)
|
||||
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
|
||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
||||
|
||||
local volforceAmount = game.GetSkinSetting('_volforce') or 0;
|
||||
|
||||
-- Draw volforce badge
|
||||
gfx.BeginPath();
|
||||
gfx.ImageRect(x, y, 42, 42, volforceBadgeImage, 1, 0);
|
||||
|
||||
-- Draw volforce label
|
||||
gfx.FontSize(11)
|
||||
gfx.Text('VOLFORCE', x + 47, y + 14);
|
||||
gfx.FontSize(18)
|
||||
gfx.Text(string.format('%.3f', volforceAmount), x + 47, y + 30);
|
||||
end
|
||||
|
||||
return {
|
||||
render = render
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
local Easing = require('common.easings');
|
||||
local Footer = require('components.footer');
|
||||
|
||||
local VolforceWindow = require('components.volforceWindow')
|
||||
|
||||
local resx, resy = game.GetResolution()
|
||||
local desw = 1080
|
||||
local desh = 1920
|
||||
|
@ -312,7 +314,7 @@ local drawBottomPanel = function()
|
|||
bottomPanelImage, 1, 0);
|
||||
end
|
||||
|
||||
local drawBottomPanelContent = function ()
|
||||
local drawBottomPanelContent = function (deltatime)
|
||||
-- Draw appeal card
|
||||
gfx.BeginPath();
|
||||
gfx.ImageRect(bottomPanelX+58, bottomPanelY+277, 103, 132, appealCardImage, 1, 0);
|
||||
|
@ -331,15 +333,8 @@ local drawBottomPanelContent = function ()
|
|||
gfx.BeginPath();
|
||||
gfx.ImageRect(bottomPanelX+187, bottomPanelY+362, 107, 29, danBadgeImage, 1, 0);
|
||||
|
||||
-- Draw volforce badge
|
||||
gfx.BeginPath();
|
||||
gfx.ImageRect(bottomPanelX+310, bottomPanelY+355, 42, 42, volforceBadgeImage, 1, 0);
|
||||
|
||||
-- Draw volforce label
|
||||
gfx.FontSize(11)
|
||||
gfx.Text('VOLFORCE', bottomPanelX+357, bottomPanelY+369);
|
||||
gfx.FontSize(18)
|
||||
gfx.Text('20.148', bottomPanelX+357, bottomPanelY+385);
|
||||
-- Draw volforce
|
||||
VolforceWindow.render(0, bottomPanelX+310, bottomPanelY+355)
|
||||
end
|
||||
|
||||
local drawJacketPanel = function()
|
||||
|
@ -471,7 +466,7 @@ render = function(deltaTime, showStats)
|
|||
gfx.GlobalAlpha(Easing.outQuad(transitionEnterScale))
|
||||
|
||||
drawBottomPanel()
|
||||
drawBottomPanelContent()
|
||||
drawBottomPanelContent(deltaTime)
|
||||
|
||||
drawRightPanel()
|
||||
drawRightPanelContent()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
require('common')
|
||||
local Easing = require('common.easings');
|
||||
|
||||
local VolforceCalc = require('components.volforceCalc');
|
||||
|
||||
local backgroundImage = gfx.CreateSkinImage("song_select/bg.png", 1)
|
||||
local dataPanelImage = gfx.CreateSkinImage("song_select/data_bg_overlay.png", 1)
|
||||
local dataGlowOverlayImage = gfx.CreateSkinImage("song_select/data_panel/data_glow_overlay.png", 1)
|
||||
|
@ -571,6 +573,31 @@ render = function (deltaTime)
|
|||
gfx.Text('S_I: ' .. selectedIndex .. ' // S_D: ' .. selectedDifficulty .. ' // S_UP: ' .. debugScrollingUp .. ' // AC_TS: ' .. transitionAfterscrollScale, 8, 8);
|
||||
end
|
||||
|
||||
songs_changed = function (withAll)
|
||||
if not withAll then return end
|
||||
|
||||
local diffs = {}
|
||||
for i = 1, #songwheel.allSongs do
|
||||
local song = songwheel.allSongs[i]
|
||||
for j = 1, #song.difficulties do
|
||||
local diff = song.difficulties[j]
|
||||
diff.force = VolforceCalc.calc(diff)
|
||||
table.insert(diffs, diff)
|
||||
end
|
||||
end
|
||||
table.sort(diffs, function (l, r)
|
||||
return l.force > r.force
|
||||
end)
|
||||
totalForce = 0
|
||||
for i = 1, 50 do
|
||||
if diffs[i] then
|
||||
totalForce = totalForce + diffs[i].force
|
||||
end
|
||||
end
|
||||
|
||||
game.SetSkinSetting('_volforce', totalForce)
|
||||
end
|
||||
|
||||
set_index = function(newIndex)
|
||||
transitionScrollScale = 0;
|
||||
transitionAfterscrollScale = 0;
|
||||
|
|
Loading…
Reference in New Issue