Refactor Master Graded (#960)
This commit is contained in:
@@ -13,7 +13,7 @@ local PLAYERS=PLAYERS
|
||||
|
||||
|
||||
|
||||
-- System
|
||||
------------------------------[System]------------------------------
|
||||
do-- function tryBack()
|
||||
local sureTime=-1e99
|
||||
function tryBack()
|
||||
@@ -186,7 +186,73 @@ do-- function applySettings()
|
||||
end
|
||||
end
|
||||
|
||||
-- Royale mode
|
||||
------------------------------[Generate Grades]------------------------------
|
||||
local smallDigits={[0]="₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"}
|
||||
local function getSmallNum(num)
|
||||
local str=tostring(num)
|
||||
local out=""
|
||||
for i=1,#str do
|
||||
out=out..smallDigits[tonumber(string.sub(str,i,i))]
|
||||
end
|
||||
return out
|
||||
end
|
||||
do -- Secret Grade
|
||||
local r={"GM","GM+","TM","TM+"}
|
||||
function getSecretGrade(index)
|
||||
if index<11 then -- rank 10 - 1
|
||||
return tostring(11-index)
|
||||
elseif index<20 then -- S1 - S9 ranks
|
||||
return "S"..index-10
|
||||
elseif index<24 then -- GM, GM+, TM, TM+ ranks
|
||||
return r[index-19]
|
||||
else
|
||||
return "TM+"..getSmallNum(index-22)
|
||||
end
|
||||
end
|
||||
end
|
||||
function getSecretGradeText(index)
|
||||
if index<11 then
|
||||
return "Grade "..tostring(11-index)
|
||||
else
|
||||
return getSecretGrade(index)
|
||||
end
|
||||
end
|
||||
|
||||
do -- Master GRADED
|
||||
local master_postm_grades={"M","MK","MV","MO","MM-","MM","MM+","GM-","GM","GM+","TM-","TM","TM+"}
|
||||
function getMasterGrade(index)
|
||||
if index<10 then
|
||||
return tostring(10-index)
|
||||
elseif index<19 then
|
||||
return "S"..index-9
|
||||
elseif index<28 then
|
||||
return "m"..index-18
|
||||
elseif index<41 then
|
||||
return master_postm_grades[index-27]
|
||||
else
|
||||
return master_postm_grades[#master_postm_grades]..getSmallNum(index-39)
|
||||
end
|
||||
end
|
||||
local master_postm_grades_text={
|
||||
"Master","MasterK","MasterV","MasterO","MasterM-","MasterM","MasterM+",
|
||||
"Grand Master-","Grand Master","Grand Master+",
|
||||
"Tech Master-","Tech Master","Tech Master+"
|
||||
}
|
||||
function getMasterGradeText(index)
|
||||
if index<10 then
|
||||
return "Grade "..tostring(10-index)
|
||||
elseif index<19 then
|
||||
return "S"..index-9
|
||||
elseif index<28 then
|
||||
return "m"..index-18
|
||||
elseif index<41 then
|
||||
return master_postm_grades_text[index-27]
|
||||
else
|
||||
return master_postm_grades_text[#master_postm_grades]..index-39
|
||||
end
|
||||
end
|
||||
end
|
||||
------------------------------[Royale mode]------------------------------
|
||||
function randomTarget(P)-- Return a random opponent for P
|
||||
local l=TABLE.shift(PLY_ALIVE,0)
|
||||
local count=0
|
||||
@@ -292,7 +358,7 @@ function royaleLevelup()
|
||||
end
|
||||
end
|
||||
|
||||
-- Sound shortcuts
|
||||
------------------------------[Sound shortcuts]------------------------------
|
||||
function playClearSFX(cc)
|
||||
if cc<=0 or cc%1~=0 then return end
|
||||
if cc<=4 then
|
||||
@@ -344,7 +410,7 @@ function playReadySFX(i,vol)
|
||||
end
|
||||
|
||||
|
||||
-- Game
|
||||
------------------------------[Game]------------------------------
|
||||
function getItem(itemName,amount)
|
||||
STAT.item[itemName]=STAT.item[itemName]+(amount or 1)
|
||||
end
|
||||
@@ -1063,7 +1129,7 @@ end
|
||||
|
||||
|
||||
|
||||
-- Game draw
|
||||
------------------------------[Graphics]------------------------------
|
||||
do-- function drawSelfProfile()
|
||||
local name
|
||||
local textObj,scaleK,width,offY
|
||||
@@ -1113,7 +1179,7 @@ end
|
||||
|
||||
|
||||
|
||||
-- Widget function shortcuts
|
||||
------------------------------[Widget function shortcuts]------------------------------
|
||||
function backScene() SCN.back() end
|
||||
do-- function goScene(name,style)
|
||||
local cache={}
|
||||
|
||||
Reference in New Issue
Block a user