整理刚增加的模式的代码

This commit is contained in:
MrZ_26
2022-01-19 02:41:51 +08:00
parent 58d068b776
commit 89134d4f07
2 changed files with 222 additions and 221 deletions

View File

@@ -15,90 +15,92 @@ local prevDrop70=false --determines if previous piece has level less than __70
local nextSpeedUp=false --determines if the next section speed should be boosted by 100 local nextSpeedUp=false --determines if the next section speed should be boosted by 100
local isInRollTrans=false local isInRollTrans=false
local function getGrav(l) local function getGrav(l)
return return
l<30 and 64 or l<30 and 64 or
l<35 and 43 or l<35 and 43 or
l<40 and 32 or l<40 and 32 or
l<50 and 26 or l<50 and 26 or
l<60 and 21 or l<60 and 21 or
l<70 and 16 or l<70 and 16 or
l<80 and 8 or l<80 and 8 or
l<90 and 6 or l<90 and 6 or
l<120 and 4 or l<120 and 4 or
l<160 and 3 or l<160 and 3 or
l<200 and 2 or l<200 and 2 or
l<220 and 64 or l<220 and 64 or
l<230 and 8 or l<230 and 8 or
l<233 and 4 or l<233 and 4 or
l<236 and 3 or l<236 and 3 or
l<243 and 2 or l<243 and 2 or
l<300 and 1 or l<300 and 1 or
l<360 and 0.5 or l<360 and 0.5 or
l<450 and 0.25 or l<450 and 0.25 or
0 0
end end
local function getLock(l) local function getLock(l)
return return
l<900 and 30 or l<900 and 30 or
l<1100 and 19 or l<1100 and 19 or
15 15
end end
local function getWait(l) local function getWait(l)
return return
l<700 and 23 or l<700 and 23 or
l<800 and 16 or l<800 and 16 or
l<1000 and 12 or l<1000 and 12 or
l<1100 and 7 or l<1100 and 7 or
6 6
end end
local function getFall(l) local function getFall(l)
return return
l<500 and 25 or l<500 and 25 or
l<600 and 18 or l<600 and 18 or
l<700 and 12 or l<700 and 12 or
l<800 and 8 or l<800 and 8 or
4 4
end end
local function getDas(l) local function getDas(l)
return return
l<500 and 10 or l<500 and 10 or
l<900 and 8 or l<900 and 8 or
6 6
end end
local function getGrade() local function getGrade()
local gradeList={"9","8","7","6","5","4","3","2","1", local gradeList={
"S1","S2","S3","S4","S5","S6","S7","S8","S9", "9","8","7","6","5","4","3","2","1",
"m1","m2","m3","m4","m5","m6","m7","m8","m9", "S1","S2","S3","S4","S5","S6","S7","S8","S9",
"M","MK","MV","MO","MM-","MM","MM+","GM-","GM","GM+","TM-","TM","TM+"} "m1","m2","m3","m4","m5","m6","m7","m8","m9",
if int_grade==nil then int_grade=0 end "M","MK","MV","MO","MM-","MM","MM+","GM-","GM","GM+","TM-","TM","TM+"
if rollGrades==nil then rollGrades=0 end }
return gradeList[math.min(math.floor(int_grade_boosts[int_grade+1]+rollGrades+cools+1-regrets),#gradeList)] if int_grade==nil then int_grade=0 end
if rollGrades==nil then rollGrades=0 end
return gradeList[math.min(math.floor(int_grade_boosts[int_grade+1]+rollGrades+cools+1-regrets),#gradeList)]
end end
local function addGrade(row, cmb, lvl) -- IGS = internal grade system local function addGrade(row, cmb, lvl) -- IGS = internal grade system
if row<1 then return end if row<1 then return end
local pts=0 local pts=0
local cmb_mult=1.0 local cmb_mult=1.0
local lvl_mult=math.floor(lvl/250)+1 local lvl_mult=math.floor(lvl/250)+1
if row==1 then if row==1 then
pts=int_grade<5 and 10 or int_grade<10 and 5 or 2 pts=int_grade<5 and 10 or int_grade<10 and 5 or 2
cmb_mult=1.0 cmb_mult=1.0
elseif row==2 then elseif row==2 then
pts=int_grade<3 and 20 or int_grade<6 and 15 or int_grade<10 and 10 or 12 pts=int_grade<3 and 20 or int_grade<6 and 15 or int_grade<10 and 10 or 12
cmb_mult=cmb==1 and 1 or cmb<4 and 1.2 or cmb<8 and 1.4 or cmb<10 and 1.5 or 2.0 cmb_mult=cmb==1 and 1 or cmb<4 and 1.2 or cmb<8 and 1.4 or cmb<10 and 1.5 or 2.0
elseif row==3 then elseif row==3 then
pts=int_grade==0 and 40 or int_grade<4 and 30 or int_grade<7 and 20 or int_grade<10 and 15 or 13 pts=int_grade==0 and 40 or int_grade<4 and 30 or int_grade<7 and 20 or int_grade<10 and 15 or 13
cmb_mult=cmb==1 and 1 or cmb<10 and 1+(cmb+2)*0.1 or 2 cmb_mult=cmb==1 and 1 or cmb<10 and 1+(cmb+2)*0.1 or 2
else else
pts=int_grade==0 and 50 or int_grade<5 and 40 or 30 pts=int_grade==0 and 50 or int_grade<5 and 40 or 30
cmb_mult=cmb==1 and 1 or cmb==2 and 1.5 or cmb<6 and (0.2*cmb)+1.2 or cmb<10 and (0.1*cmb)+1.7 or 3 cmb_mult=cmb==1 and 1 or cmb==2 and 1.5 or cmb<6 and (0.2*cmb)+1.2 or cmb<10 and (0.1*cmb)+1.7 or 3
end end
grade_points=grade_points+(pts*cmb_mult*lvl_mult) grade_points=grade_points+(pts*cmb_mult*lvl_mult)
if grade_points>=100 then if grade_points>=100 then
grade_points=0 grade_points=0
int_grade=int_grade+1 int_grade=int_grade+1
end end
end end
return{ return{
@@ -108,47 +110,48 @@ return{
fall=25, fall=25,
noTele=true, noTele=true,
das=16,arr=1, das=16,arr=1,
minsdarr=1,
mesDisp=function(P) mesDisp=function(P)
gc.setColor(1,1,1,1) gc.setColor(1,1,1,1)
setFont(45) setFont(45)
mText(TEXTOBJ.grade,63,180) mText(TEXTOBJ.grade,63,180)
setFont(62) setFont(62)
mStr(getGrade(),63,110) mStr(getGrade(),63,110)
if isInRoll then if isInRoll then
setFont(20) setFont(20)
mStr(("%.1f"):format(rollGrades),63,208) mStr(("%.1f"):format(rollGrades),63,208)
gc.setLineWidth(2) gc.setLineWidth(2)
gc.setColor(.98,.98,.98,.8) gc.setColor(.98,.98,.98,.8)
gc.rectangle('line',0,240,126,80,4) gc.rectangle('line',0,240,126,80,4)
gc.setColor(.98,.98,.98,.4) gc.setColor(.98,.98,.98,.4)
gc.rectangle('fill',0+2,240+2,126-4,80-4,2) gc.rectangle('fill',0+2,240+2,126-4,80-4,2)
setFont(45) setFont(45)
local t=(P.stat.frame-prevSectTime)/60 local t=(P.stat.frame-prevSectTime)/60
local T=("%.1f"):format(60-t) local T=("%.1f"):format(60-t)
gc.setColor(COLOR.dH) gc.setColor(COLOR.dH)
mStr(T,65,250) mStr(T,65,250)
t=t/60 t=t/60
gc.setColor(1.7*t,2.3-2*t,.3) gc.setColor(1.7*t,2.3-2*t,.3)
mStr(T,63,248) mStr(T,63,248)
else else
setFont(20) setFont(20)
mStr(grade_points,63,208) mStr(grade_points,63,208)
setFont(45) setFont(45)
PLY.draw.drawProgress(P.modeData.pt,P.modeData.target) PLY.draw.drawProgress(P.modeData.pt,P.modeData.target)
end end
end, end,
hook_drop=function(P) hook_drop=function(P)
local D=P.modeData local D=P.modeData
local c=#P.clearedRow local c=#P.clearedRow
if cools>8 and isInRoll then if cools>8 and isInRoll then
rollGrades=rollGrades+(c==4 and 1 or 0.1*c) rollGrades=rollGrades+(c==4 and 1 or 0.1*c)
return return
elseif isInRoll then elseif isInRoll then
rollGrades=rollGrades+(c==4 and 0.26 or 0.04*c) rollGrades=rollGrades+(c==4 and 0.26 or 0.04*c)
return return
end end
if c==0 and D.pt+1>=D.target then return end if c==0 and D.pt+1>=D.target then return end
local s=c<3 and c+1 or c==3 and 5 or 7 local s=c<3 and c+1 or c==3 and 5 or 7
@@ -156,44 +159,44 @@ return{
elseif P.combo>3 then s=s+1 elseif P.combo>3 then s=s+1
end end
addGrade(c,P.combo,D.pt) addGrade(c,P.combo,D.pt)
D.pt=D.pt+s D.pt=D.pt+s
spd_lvl=spd_lvl+1 spd_lvl=spd_lvl+1
P.gameEnv.drop=getGrav(spd_lvl) P.gameEnv.drop=getGrav(spd_lvl)
if(P.gameEnv.drop==0) then if(P.gameEnv.drop==0) then
P:set20G(true) P:set20G(true)
end end
if D.pt%100>70 and not prevDrop70 then if D.pt%100>70 and not prevDrop70 then
if P.stat.frame-prevSectTime < cool_time[math.ceil(D.pt/100)] then if P.stat.frame-prevSectTime < cool_time[math.ceil(D.pt/100)] then
cools=cools+1 cools=cools+1
P:_showText(text.cool,0,-120,80,'fly',.8) P:_showText(text.cool,0,-120,80,'fly',.8)
nextSpeedUp=true nextSpeedUp=true
end end
prevDrop70=true prevDrop70=true
end end
if D.pt+1==D.target then if D.pt+1==D.target then
SFX.play('warn_1') SFX.play('warn_1')
elseif D.pt>=D.target then--Level up! elseif D.pt>=D.target then--Level up!
spd_lvl=nextSpeedUp and spd_lvl+100 or spd_lvl spd_lvl=nextSpeedUp and spd_lvl+100 or spd_lvl
nextSpeedUp=false nextSpeedUp=false
prevDrop70=false prevDrop70=false
s=D.target/100 s=D.target/100
local E=P.gameEnv local E=P.gameEnv
E.lock=getLock(spd_lvl) E.lock=getLock(spd_lvl)
E.wait=getWait(spd_lvl) E.wait=getWait(spd_lvl)
E.fall=getFall(spd_lvl) E.fall=getFall(spd_lvl)
E.das=getDas(spd_lvl) E.das=getDas(spd_lvl)
if P.stat.frame-prevSectTime > reg_time[math.ceil(s)] then if P.stat.frame-prevSectTime > reg_time[math.ceil(s)] then
regrets=regrets+1 regrets=regrets+1
regretDelay=60 regretDelay=60
end end
prevSectTime=P.stat.frame prevSectTime=P.stat.frame
if s==2 then if s==2 then
BG.set('rainbow') BG.set('rainbow')
elseif s==4 then elseif s==4 then
@@ -210,16 +213,16 @@ return{
elseif s==6 then elseif s==6 then
BG.set('lightning') BG.set('lightning')
elseif s>9 then elseif s>9 then
if cools>8 then if cools>8 then
E.lockFX=E.lockFX>1 and 1 or E.lockFX E.lockFX=E.lockFX>1 and 1 or E.lockFX
P:setInvisible(5) P:setInvisible(5)
else else
P:setInvisible(300) P:setInvisible(300)
end end
D.pt=999 D.pt=999
P.waiting=240 P.waiting=240
BGM.stop() BGM.stop()
isInRollTrans=true isInRollTrans=true
return return
end end
D.target=D.target<900 and D.target+100 or 999 D.target=D.target<900 and D.target+100 or 999
@@ -228,66 +231,65 @@ return{
end end
end, end,
task=function(P) task=function(P)
regretDelay=-1 regretDelay=-1
P.modeData.pt=0 P.modeData.pt=0
P.modeData.target=100 P.modeData.target=100
int_grade=0 int_grade=0
grade_points=0 grade_points=0
rollGrades=0 rollGrades=0
spd_lvl=0 spd_lvl=0
cools=0 cools=0
regrets=0 regrets=0
prevSectTime=0 prevSectTime=0
isInRoll=false isInRoll=false
isInRollTrans=false isInRollTrans=false
prevDrop70=false prevDrop70=false
nextSpeedUp=false nextSpeedUp=false
local h=false local decayRate={125,80,80,50,45,45,45,40,40,40,40,40,30,30,30,20,20,20,20,20,15,15,15,15,15,15,15,15,15,15,10,10,10}
local decayRate={125,80,80,50,45,45,45,40,40,40,40,40,30,30,30,20,20,20,20,20,15,15,15,15,15,15,15,15,15,15,10,10,10} local decayTimer=0
local decayTimer=0 while true do
while true do YIELD()
YIELD() P.modeData.grade=getGrade()
P.modeData.grade=getGrade() P.modeData.gradePts=math.min(math.floor(int_grade_boosts[int_grade+1]+rollGrades+cools-regrets),36)
P.modeData.gradePts=math.min(math.floor(int_grade_boosts[int_grade+1]+rollGrades+cools-regrets),36) if regretDelay>-1 then
if regretDelay>-1 then regretDelay=regretDelay-1
regretDelay=regretDelay-1 if regretDelay==-1 then P:_showText(text.regret,0,-120,80,'beat',.8) end
if regretDelay==-1 then P:_showText(text.regret,0,-120,80,'beat',.8) end end
end if isInRollTrans then
if isInRollTrans then if P.waiting==220 then
if P.waiting==220 then --Make field invisible
--Make field invisible for j=1,#P.field do for i=1,10 do
for j=1,#P.field do for i=1,10 do P.visTime[j][i]=P.visTime[j][i]-0.001
P.visTime[j][i]=P.visTime[j][i]-0.001 end end
end end elseif P.waiting==190 then
elseif P.waiting==190 then for _=#P.field,1,-1 do
for _=#P.field,1,-1 do P.field[_],P.visTime[_]=nil
P.field[_],P.visTime[_]=nil end
end elseif P.waiting==180 then
elseif P.waiting==180 then playReadySFX(3,3)
playReadySFX(3,3) elseif P.waiting==120 then
elseif P.waiting==120 then playReadySFX(2,2)
playReadySFX(2,2) elseif P.waiting==60 then
elseif P.waiting==60 then playReadySFX(1,1)
playReadySFX(1,1) elseif P.waiting==1 then
elseif P.waiting==1 then playReadySFX(0,0)
playReadySFX(0,0) isInRollTrans=false
isInRollTrans=false isInRoll=true
isInRoll=true BGM.play('hope')
BGM.play('hope') BG.set('blockspace')
BG.set('blockspace') prevSectTime=P.stat.frame
prevSectTime=P.stat.frame end
end end
end if P.waiting<=0 and grade_points>0 and not isInRoll then
if P.waiting<=0 and grade_points>0 and not isInRoll then decayTimer=decayTimer+1
decayTimer=decayTimer+1 if decayTimer>=decayRate[int_grade+1] then
if decayTimer>=decayRate[int_grade+1] then decayTimer=0
decayTimer=0 grade_points=grade_points-1
grade_points=grade_points-1 end
end elseif isInRoll and P.stat.frame>=prevSectTime+3600 then
elseif isInRoll and P.stat.frame>=prevSectTime+3600 then rollGrades=rollGrades+(cools>8 and 1.6 or 0.5)
rollGrades=rollGrades+(cools>8 and 1.6 or 0.5) P:win('finish')
P:win('finish') end
end end
end
end, end,
} }

View File

@@ -1,22 +1,21 @@
return{ return{
env={ env={
freshLimit=15, freshLimit=15,
fieldH=19,
sequence="bagES", sequence="bagES",
eventSet='master_g', eventSet='master_g',
bg='bg2',bgm='secret7th', bg='bg2',bgm='secret7th',
}, },
slowMark=true, slowMark=true,
score=function(P) score=function(P)
if not tonumber(P.modeData.grade) then if not tonumber(P.modeData.grade) then
return{P.modeData.grade,P.stat.time} return{P.modeData.grade,P.stat.time}
else else
return{"Grade "..tostring(P.modeData.grade),P.stat.time} return{"Grade "..tostring(P.modeData.grade),P.stat.time}
end end
end,
scoreDisp=function(D) return D[1].." "..STRING.time(D[2])end,
comp=function(a,b)
return a[1]>b[1]or(a[1]==b[1]and a[2]<b[2])
end, end,
scoreDisp=function(D) return D[1].." "..STRING.time(D[2])end,
comp=function(a,b)return a[1]>b[1]or(a[1]==b[1]and a[2]<b[2])end,
getRank=function(P) getRank=function(P)
local G=P.modeData.gradePts local G=P.modeData.gradePts
return return
@@ -25,10 +24,10 @@ return{
G>=25 and 3 or -- m8 - MO G>=25 and 3 or -- m8 - MO
G>=18 and 2 or -- m1-m7 G>=18 and 2 or -- m1-m7
G>=9 and 1 or -- S1-S9 G>=9 and 1 or -- S1-S9
0 0
-- Table of grades vs values -- Table of grades vs values
-- 9 8 7 6 5 4 3 2 1 S1 S2 S3 S4 S5 S6 S7 S8 S9 m1 m2 m3 m4 m5 m6 m7 m8 m9 M MK MV MO MM- MM MM+ GM- GM GM+ TM- TM TM+ -- 9 8 7 6 5 4 3 2 1 S1 S2 S3 S4 S5 S6 S7 S8 S9 m1 m2 m3 m4 m5 m6 m7 m8 m9 M MK MV MO MM- MM MM+ GM- GM GM+ TM- TM TM+
-- 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 27 28 29 30 31 32 33 34 35 36 37 38 39 -- 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 27 28 29 30 31 32 33 34 35 36 37 38 39
end, end,
} }