Add secret grade mode (#631)

This commit is contained in:
NOT_A_ROBOT
2022-01-28 04:19:45 -08:00
committed by GitHub
parent d4090dea6f
commit 83349707d5
2 changed files with 79 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
local gc_setColor,gc_draw=love.graphics.setColor,love.graphics.draw
local ply_applyField=PLY.draw.applyField
local function GetOpenHole(num)
return -math.abs(((num-1) % 18)-9)+10
end
local F={}
local ranks={"10","9","8","7","6","5","4","3","2","1","S1","S2","S3","S4","S5","S6","S7","S8","S9","GM","GM+","TM","TM+","TM+₂","TM+₃", "TM+₄","TM+₅"}
-- lines: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
return
{
fkey1=function(P)P.modeData.showGuide=not P.modeData.showGuide end,
mesDisp=function(P)
mText(TEXTOBJ.grade,63,190)
setFont(55)
mStr(ranks[P.modeData.rankPts],63,125)
ply_applyField(P)
local mark=TEXTURE.puzzleMark
gc_setColor(1,1,1)
if P.modeData.showGuide then
for y=1,P.modeData.rankPts+1 do for x=1,10 do
local T=F[y][x]
if T~=0 then
gc_draw(mark[T],30*x-30,600-30*y)
end
end end
end
PLY.draw.cancelField(P)
end,
task=function(P)
P.modeData.rankPts=1
P.modeData.showGuide=true
for i=1,50 do
F[i] = {}
local h=GetOpenHole(i)
for j=1,10 do
F[i][j]=h==j and -1 or 21
end
end
end,
hook_drop=function(P)
local Pf=P.field
local D=P.modeData
D.rankPts=1
for i=1,#P.field do
local h=GetOpenHole(i)
for j=1,10 do
if P.field[i][j]>0 and h==j then return end
if P.field[i][j]==0 and h~=j then return end
end
if i==#P.field then return end
if P.field[i+1][h]==0 then return end
D.rankPts=D.rankPts+1
end
end
}

View File

@@ -0,0 +1,23 @@
local ranks={"Grade 10","Grade 9","Grade 8","Grade 7","Grade 6","Grade 5","Grade 4","Grade 3","Grade 2","Grade 1","S1","S2","S3","S4","S5","S6","S7","S8","S9","GM","GM+","TM","TM+","TM+₂","TM+₃", "TM+₄","TM+₅"}
-- index: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
return{
env={
drop=180,lock=180,
hang=15,
eventSet='secret_grade',
bg='bg2',bgm='race',
},
score=function(P)return{P.modeData.rankPts,P.stat.piece}end,
scoreDisp=function(D)return ranks[D[1]].." "..D[2].." Pieces"end,
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
getRank=function(P)
local G=P.modeData.rankPts
return
G>=23 and 5 or
G>=21 and 4 or
G>=19 and 3 or
G>=15 and 2 or
G>=11 and 1 or
G>=7 and 0
end,
}