重构next和hold系统,支持多next
This commit is contained in:
@@ -156,18 +156,121 @@ local function drawNextPreview(P,B)
|
||||
end
|
||||
end end
|
||||
end
|
||||
local function drawHold(P,clr)
|
||||
local B=P.hd.bk
|
||||
local texture=SKIN.curText
|
||||
for i=1,#B do for j=1,#B[1]do
|
||||
if B[i][j]then
|
||||
Draw(texture[clr],30*(j+2.06-#B[1]*.5)-30,-30*(i+1.36-#B*.5))-- drawCell(i+1.36-#B*.5,j+2.06-#B[1]*.5,clr)
|
||||
end
|
||||
end end
|
||||
end
|
||||
|
||||
local draw={}
|
||||
|
||||
function draw.drawNext_norm(P)
|
||||
local ENV=P.gameEnv
|
||||
local N=ENV.nextCount*72
|
||||
local texture=SKIN.curText
|
||||
gc.push("transform")
|
||||
gc.translate(316,116)
|
||||
gc.setColor(0,0,0,.4)gc.rectangle("fill",0,-80,124,N+8)
|
||||
gc.setColor(1,1,1)gc.rectangle("line",0,-80,124,N+8)
|
||||
mText(drawableText.next,62,-131)
|
||||
N=1
|
||||
while N<=ENV.nextCount and P.nextQueue[N]do
|
||||
local bk,clr=P.nextQueue[N].bk,P.nextQueue[N].color
|
||||
for i=1,#bk do for j=1,#bk[1] do
|
||||
if bk[i][j]then
|
||||
Draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*N-#bk*.5))-- drawCell(i-2.4*N-#bk*.5,j+12.6-#bk[1]*.5,clr)
|
||||
end
|
||||
end end
|
||||
N=N+1
|
||||
end
|
||||
|
||||
if ENV.bagLine then
|
||||
local L=ENV.bagLen
|
||||
local C=-P.pieceCount%L--Phase
|
||||
gc.setColor(.8,.5,.5)
|
||||
for i=C,N-1,L do
|
||||
local y=72*i-77
|
||||
gc.line(2+P.fieldOff.x,y,120,y)
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
function draw.drawNext_hidden(P)
|
||||
local ENV=P.gameEnv
|
||||
local N=ENV.nextCount*72
|
||||
local texture=SKIN.curText
|
||||
gc.push("transform")
|
||||
gc.translate(316,116)
|
||||
gc.setColor(.5,0,0,.4)gc.rectangle("fill",0,-80,124,N+8)
|
||||
gc.setColor(1,1,1)gc.rectangle("line",0,-80,124,N+8)
|
||||
mText(drawableText.next,62,-131)
|
||||
N=min(ENV.nextStartPos,P.pieceCount+1)
|
||||
while N<=ENV.nextCount and P.nextQueue[N]do
|
||||
local bk,clr=P.nextQueue[N].bk,P.nextQueue[N].color
|
||||
for i=1,#bk do for j=1,#bk[1] do
|
||||
if bk[i][j]then
|
||||
Draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*N-#bk*.5))-- drawCell(i-2.4*N-#bk*.5,j+12.6-#bk[1]*.5,clr)
|
||||
end
|
||||
end end
|
||||
N=N+1
|
||||
end
|
||||
|
||||
if ENV.bagLine then
|
||||
local L=ENV.bagLen
|
||||
local C=-P.pieceCount%L--Phase
|
||||
gc.setColor(.8,.5,.5)
|
||||
for i=C,N-1,L do
|
||||
local y=72*i-77
|
||||
gc.line(2+P.fieldOff.x,y,120,y)
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
function draw.drawHold_norm(P)
|
||||
local texture=SKIN.curText
|
||||
gc.push("transform")
|
||||
gc.translate(-140,116)
|
||||
gc.setColor(0,0,0,.4)gc.rectangle("fill",0,-80,124,80)
|
||||
gc.setColor(1,1,1)gc.rectangle("line",0,-80,124,80)
|
||||
if P.holdTime==0 then gc.setColor(.6,.4,.4)end
|
||||
mText(drawableText.hold,62,-131)
|
||||
|
||||
local B=P.holdQueue[1]
|
||||
if B then
|
||||
local bk,clr=B.bk,B.color
|
||||
for i=1,#bk do for j=1,#bk[1]do
|
||||
if bk[i][j]then
|
||||
Draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*1-#bk*.5))-- drawCell(i+1.36-#B*.5,j+2.06-#B[1]*.5,clr)
|
||||
end
|
||||
end end
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
function draw.drawHold_multi(P)
|
||||
local ENV=P.gameEnv
|
||||
local N=ENV.holdCount*72
|
||||
local texture=SKIN.curText
|
||||
gc.push("transform")
|
||||
gc.translate(-140,116)
|
||||
gc.setColor(0,0,0,.4)gc.rectangle("fill",0,-80,124,N+8)
|
||||
gc.setColor(1,1,1)gc.rectangle("line",0,-80,124,N+8)
|
||||
if P.holdTime==0 then gc.setColor(.6,.4,.4)end
|
||||
mText(drawableText.hold,62,-131)
|
||||
|
||||
gc.setColor(1,1,1)
|
||||
if P.holdQueue[ENV.holdCount]then
|
||||
N=P.holdTime+1
|
||||
else
|
||||
N=1
|
||||
end
|
||||
for n=1,#P.holdQueue do
|
||||
if n==N then gc.setColor(.6,.4,.4)end
|
||||
local bk,clr=P.holdQueue[n].bk,P.holdQueue[n].color
|
||||
for i=1,#bk do for j=1,#bk[1]do
|
||||
if bk[i][j]then
|
||||
Draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*n-#bk*.5))-- drawCell(i+1.36-#B*.5,j+2.06-#B[1]*.5,clr)
|
||||
end
|
||||
end end
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
function draw.drawTargetLine(P,r)
|
||||
if r<21+(P.fieldBeneath+P.fieldUp)/30 and r>0 then
|
||||
gc.setLineWidth(4)
|
||||
@@ -273,8 +376,8 @@ function draw.norm(P)
|
||||
end
|
||||
|
||||
--Draw next preview
|
||||
if ENV.nextPos and P.next[1]then
|
||||
drawNextPreview(P,P.next[1].bk)
|
||||
if ENV.nextPos and P.nextQueue[1]then
|
||||
drawNextPreview(P,P.nextQueue[1].bk)
|
||||
end
|
||||
|
||||
gc.setScissor()
|
||||
@@ -346,49 +449,13 @@ function draw.norm(P)
|
||||
end
|
||||
|
||||
--Draw Hold
|
||||
if ENV.hold then
|
||||
gc.push("transform")
|
||||
gc.translate(-140,116)
|
||||
gc.setColor(0,0,0,.4)gc.rectangle("fill",0,-80,124,80)
|
||||
gc.setColor(1,1,1)gc.rectangle("line",0,-80,124,80)
|
||||
if P.holded then gc.setColor(.6,.4,.4)end
|
||||
mText(drawableText.hold,62,-131)
|
||||
if P.hd then drawHold(P,P.hd.color)end
|
||||
gc.pop()
|
||||
end
|
||||
P:drawHold()
|
||||
|
||||
--Draw Next(s)
|
||||
local N=ENV.next*72
|
||||
if ENV.next>0 then
|
||||
gc.setColor(0,0,0,.4)gc.rectangle("fill",316,36,124,N)
|
||||
gc.setColor(1,1,1)gc.rectangle("line",316,36,124,N)
|
||||
mText(drawableText.next,378,-15)
|
||||
N=1
|
||||
local texture=SKIN.curText
|
||||
while N<=ENV.next and P.next[N]do
|
||||
local bk,clr=P.next[N].bk,P.next[N].color
|
||||
for i=1,#bk do for j=1,#bk[1] do
|
||||
if bk[i][j]then
|
||||
Draw(texture[clr],30*(j+12.6-#bk[1]*.5)-30,-30*(i-2.4*N-#bk*.5))-- drawCell(i-2.4*N-#bk*.5,j+12.6-#bk[1]*.5,clr)
|
||||
end
|
||||
end end
|
||||
N=N+1
|
||||
end
|
||||
end
|
||||
|
||||
--Draw Bagline(s)
|
||||
if ENV.bagLine then
|
||||
local L=ENV.bagLen
|
||||
local C=-P.pieceCount%L--Phase
|
||||
gc.setColor(.8,.5,.5)
|
||||
for i=C,N-1,L do
|
||||
local y=72*i+36
|
||||
gc.line(318+P.fieldOff.x,y,438,y)
|
||||
end
|
||||
end
|
||||
P:drawNext()
|
||||
|
||||
--Draw target selecting pad
|
||||
if modeEnv.royaleMode then
|
||||
if MODEENV.royaleMode then
|
||||
if P.atkMode then
|
||||
gc.setColor(1,.8,0,P.swappingAtkMode*.02)
|
||||
gc.rectangle("fill",RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4)
|
||||
@@ -539,7 +606,7 @@ function draw.small(P)
|
||||
end
|
||||
|
||||
--Draw badge
|
||||
if modeEnv.royaleMode then
|
||||
if MODEENV.royaleMode then
|
||||
gc.setColor(1,1,1)
|
||||
for i=1,P.strength do
|
||||
gc.draw(IMG.badgeIcon,12*i-7,4,nil,.5)
|
||||
@@ -598,20 +665,22 @@ function draw.demo(P)
|
||||
end
|
||||
gc.pop()
|
||||
|
||||
--Draw hold
|
||||
local blockImg=TEXTURE.miniBlock
|
||||
if P.hd then
|
||||
local id=P.hd.id
|
||||
--Draw hold
|
||||
local N=1
|
||||
while P.holdQueue[N]do
|
||||
local id=P.holdQueue[N].id
|
||||
_=P.color[id]
|
||||
gc.setColor(_[1],_[2],_[3],.3)
|
||||
_=blockImg[id]
|
||||
gc.draw(_,15,30,nil,16,nil,0,_:getHeight()*.5)
|
||||
gc.draw(_,15,40*N-10,nil,16,nil,_:getWidth(),_:getHeight()*.5)
|
||||
N=N+1
|
||||
end
|
||||
|
||||
--Draw next
|
||||
local N=1
|
||||
while N<=ENV.next and P.next[N]do
|
||||
local id=P.next[N].id
|
||||
N=1
|
||||
while N<=ENV.nextCount and P.nextQueue[N]do
|
||||
local id=P.nextQueue[N].id
|
||||
_=P.color[id]
|
||||
gc.setColor(_[1],_[2],_[3],.3)
|
||||
_=blockImg[id]
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
return{
|
||||
das=10,arr=2,sddas=2,sdarr=2,
|
||||
ihs=true,irs=true,ims=true,
|
||||
das=10,
|
||||
arr=2,
|
||||
sddas=2,
|
||||
sdarr=2,
|
||||
ihs=true,
|
||||
irs=true,
|
||||
ims=true,
|
||||
swap=true,
|
||||
|
||||
ghost=.3,center=1,
|
||||
@@ -20,8 +25,8 @@ return{
|
||||
drop=60,lock=60,
|
||||
wait=0,fall=0,
|
||||
bone=false,
|
||||
next=6,
|
||||
hold=true,oncehold=true,
|
||||
nextCount=6,nextStartPos=1,
|
||||
holdCount=1,oncehold=true,
|
||||
ospin=true,
|
||||
RS="TRS",
|
||||
sequence="bag",
|
||||
|
||||
@@ -72,99 +72,12 @@ local function releaseKey_Rec(P,keyID)
|
||||
end
|
||||
P.keyPressing[keyID]=false
|
||||
end
|
||||
local function loadGameEnv(P)--Load gameEnv
|
||||
P.gameEnv={}--Current game setting environment
|
||||
local ENV=P.gameEnv
|
||||
--Load game settings
|
||||
for k,v in next,gameEnv0 do
|
||||
if modeEnv[k]~=nil then
|
||||
v=modeEnv[k] --Mode setting
|
||||
-- DBP("mode-"..k..":"..tostring(v))
|
||||
elseif GAME.setting[k]~=nil then
|
||||
v=GAME.setting[k] --Game setting
|
||||
-- DBP("game-"..k..":"..tostring(v))
|
||||
elseif SETTING[k]~=nil then
|
||||
v=SETTING[k] --Global setting
|
||||
-- DBP("global-"..k..":"..tostring(v))
|
||||
-- else
|
||||
-- DBP("default-"..k..":"..tostring(v))
|
||||
end
|
||||
if type(v)~="table"then--Default setting
|
||||
ENV[k]=v
|
||||
else
|
||||
ENV[k]=copyTable(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
local function applyGameEnv(P)--Finish gameEnv processing
|
||||
local ENV=P.gameEnv
|
||||
|
||||
P._20G=ENV.drop==0
|
||||
P.dropDelay=ENV.drop
|
||||
P.lockDelay=ENV.lock
|
||||
|
||||
P.color={}
|
||||
for _=1,7 do
|
||||
P.color[_]=SKIN.libColor[ENV.skin[_]]
|
||||
end
|
||||
|
||||
P.life=ENV.life
|
||||
|
||||
P.keyAvailable={true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true}
|
||||
if ENV.noTele then
|
||||
for i=11,20 do
|
||||
if i~=14 then
|
||||
P.keyAvailable[i]=false
|
||||
virtualkey[i].ava=false
|
||||
end
|
||||
end
|
||||
end
|
||||
for _,v in next,ENV.keyCancel do
|
||||
P.keyAvailable[v]=false
|
||||
virtualkey[v].ava=false
|
||||
end
|
||||
P:setInvisible(
|
||||
ENV.visible=="show"and -1 or
|
||||
ENV.visible=="time"and 300 or
|
||||
ENV.visible=="fast"and 20 or
|
||||
ENV.visible=="none"and 0
|
||||
)
|
||||
P:set20G(P._20G)
|
||||
P:setHold(ENV.hold)
|
||||
P:setRS(ENV.RS)
|
||||
|
||||
if type(ENV.mission)=="table"then
|
||||
P.curMission=1
|
||||
end
|
||||
|
||||
ENV.das=max(ENV.das,ENV.mindas)
|
||||
ENV.arr=max(ENV.arr,ENV.minarr)
|
||||
ENV.sdarr=max(ENV.sdarr,ENV.minsdarr)
|
||||
ENV.next=min(ENV.next,SETTING.maxNext)
|
||||
|
||||
if ENV.sequence~="bag"and ENV.sequence~="loop"then
|
||||
ENV.bagLine=false
|
||||
else
|
||||
ENV.bagLen=#ENV.bag
|
||||
end
|
||||
|
||||
if ENV.next==0 then ENV.nextPos=false end
|
||||
|
||||
if ENV.lockFX==0 then ENV.lockFX=nil end
|
||||
if ENV.dropFX==0 then ENV.dropFX=nil end
|
||||
if ENV.moveFX==0 then ENV.moveFX=nil end
|
||||
if ENV.clearFX==0 then ENV.clearFX=nil end
|
||||
if ENV.shakeFX==0 then ENV.shakeFX=nil end
|
||||
|
||||
if ENV.ghost==0 then ENV.ghost=nil end
|
||||
if ENV.center==0 then ENV.center=nil end
|
||||
end
|
||||
local function newEmptyPlayer(id,x,y,size)
|
||||
local P={id=id}
|
||||
PLAYERS[id]=P
|
||||
PLAYERS.alive[id]=P
|
||||
|
||||
--Inherit functions of player class
|
||||
--Inherit functions of Player class
|
||||
for k,v in next,Player do P[k]=v end
|
||||
|
||||
if P.id==1 and GAME.recording then
|
||||
@@ -224,10 +137,10 @@ local function newEmptyPlayer(id,x,y,size)
|
||||
--P.cur={bk=matrix[2], id=shapeID, color=colorID, name=nameID}
|
||||
--P.sc,P.dir={0,0},0--SpinCenterCoord, direction
|
||||
--P.r,P.c=0,0--row, col
|
||||
--P.hd={...},same as P.cur
|
||||
-- P.curX,P.curY,P.imgY,P.minY=0,0,0,0--x,y,ghostY
|
||||
P.holded=false
|
||||
P.next={}
|
||||
P.holdQueue={}
|
||||
P.holdTime=0
|
||||
P.nextQueue={}
|
||||
P.seqData={}
|
||||
|
||||
P.freshTime=0
|
||||
@@ -276,6 +189,100 @@ local function newEmptyPlayer(id,x,y,size)
|
||||
|
||||
return P
|
||||
end
|
||||
local function loadGameEnv(P)--Load gameEnv
|
||||
P.gameEnv={}--Current game setting environment
|
||||
local ENV=P.gameEnv
|
||||
local MODOPT=MODOPT
|
||||
local GAME=GAME
|
||||
local SETTING=SETTING
|
||||
--Load game settings
|
||||
for k,v in next,gameEnv0 do
|
||||
if MODOPT[k]~=nil then
|
||||
v=MODOPT[k] --Mod setting
|
||||
-- DBP("mod-"..k..":"..tostring(v))
|
||||
elseif MODEENV[k]~=nil then
|
||||
v=MODEENV[k] --Mode setting
|
||||
-- DBP("mode-"..k..":"..tostring(v))
|
||||
elseif GAME.setting[k]~=nil then
|
||||
v=GAME.setting[k] --Game setting
|
||||
-- DBP("game-"..k..":"..tostring(v))
|
||||
elseif SETTING[k]~=nil then
|
||||
v=SETTING[k] --Global setting
|
||||
-- DBP("global-"..k..":"..tostring(v))
|
||||
-- else
|
||||
-- DBP("default-"..k..":"..tostring(v))
|
||||
end
|
||||
if type(v)~="table"then--Default setting
|
||||
ENV[k]=v
|
||||
else
|
||||
ENV[k]=copyTable(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
local function applyGameEnv(P)--Finish gameEnv processing
|
||||
local ENV=P.gameEnv
|
||||
|
||||
P._20G=ENV.drop==0
|
||||
P.dropDelay=ENV.drop
|
||||
P.lockDelay=ENV.lock
|
||||
|
||||
P.color={}
|
||||
for _=1,7 do
|
||||
P.color[_]=SKIN.libColor[ENV.skin[_]]
|
||||
end
|
||||
|
||||
P.life=ENV.life
|
||||
|
||||
P.keyAvailable={true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true}
|
||||
if ENV.noTele then
|
||||
for i=11,20 do
|
||||
if i~=14 then
|
||||
P.keyAvailable[i]=false
|
||||
virtualkey[i].ava=false
|
||||
end
|
||||
end
|
||||
end
|
||||
for _,v in next,ENV.keyCancel do
|
||||
P.keyAvailable[v]=false
|
||||
virtualkey[v].ava=false
|
||||
end
|
||||
P:setInvisible(
|
||||
ENV.visible=="show"and -1 or
|
||||
ENV.visible=="time"and 300 or
|
||||
ENV.visible=="fast"and 20 or
|
||||
ENV.visible=="none"and 0
|
||||
)
|
||||
P:set20G(P._20G)
|
||||
P:setHold(ENV.holdCount)
|
||||
P:setNext(ENV.nextCount,ENV.nextStartPos>1)
|
||||
P:setRS(ENV.RS)
|
||||
|
||||
if type(ENV.mission)=="table"then
|
||||
P.curMission=1
|
||||
end
|
||||
|
||||
ENV.das=max(ENV.das,ENV.mindas)
|
||||
ENV.arr=max(ENV.arr,ENV.minarr)
|
||||
ENV.sdarr=max(ENV.sdarr,ENV.minsdarr)
|
||||
ENV.nextCount=min(ENV.nextCount,SETTING.maxNext)
|
||||
|
||||
if ENV.sequence~="bag"and ENV.sequence~="loop"then
|
||||
ENV.bagLine=false
|
||||
else
|
||||
ENV.bagLen=#ENV.bag
|
||||
end
|
||||
|
||||
if ENV.nextCount==0 then ENV.nextPos=false end
|
||||
|
||||
if ENV.lockFX==0 then ENV.lockFX=nil end
|
||||
if ENV.dropFX==0 then ENV.dropFX=nil end
|
||||
if ENV.moveFX==0 then ENV.moveFX=nil end
|
||||
if ENV.clearFX==0 then ENV.clearFX=nil end
|
||||
if ENV.shakeFX==0 then ENV.shakeFX=nil end
|
||||
|
||||
if ENV.ghost==0 then ENV.ghost=nil end
|
||||
if ENV.center==0 then ENV.center=nil end
|
||||
end
|
||||
--------------------------</Lib Func>--------------------------
|
||||
|
||||
--------------------------<Public>--------------------------
|
||||
@@ -303,48 +310,16 @@ function PLY.newDemoPlayer(id,x,y,size)
|
||||
P.control=true
|
||||
P.gameEnv={
|
||||
das=10,arr=2,sddas=2,sdarr=2,
|
||||
swap=true,
|
||||
|
||||
ghost=SETTING.ghost,
|
||||
center=SETTING.center,
|
||||
smooth=SETTING.smooth,
|
||||
grid=SETTING.grid,
|
||||
text=SETTING.text,
|
||||
score=SETTING.score,
|
||||
lockFX=SETTING.lockFX,
|
||||
dropFX=SETTING.dropFX,
|
||||
moveFX=SETTING.moveFX,
|
||||
clearFX=SETTING.clearFX,
|
||||
shakeFX=SETTING.shakeFX,
|
||||
|
||||
drop=1e99,lock=1e99,
|
||||
wait=10,fall=20,
|
||||
bone=false,
|
||||
next=6,
|
||||
hold=true,oncehold=true,
|
||||
ospin=true,
|
||||
RS="TRS",
|
||||
sequence="bag",
|
||||
bag={1,2,3,4,5,6,7},
|
||||
face={0,0,0,0,0,0,0},
|
||||
skin=copyTable(SETTING.skin),
|
||||
mission=false,
|
||||
|
||||
life=1e99,
|
||||
pushSpeed=3,
|
||||
block=true,
|
||||
noTele=false,
|
||||
visible="show",
|
||||
freshLimit=1e99,easyFresh=true,
|
||||
|
||||
keyCancel={},
|
||||
mindas=0,minarr=0,minsdarr=0,
|
||||
}
|
||||
loadGameEnv(P)
|
||||
applyGameEnv(P)
|
||||
prepareSequence(P)
|
||||
P:loadAI({
|
||||
type="CC",
|
||||
next=5,
|
||||
nextCount=5,
|
||||
hold=true,
|
||||
delay=30,
|
||||
delta=4,
|
||||
|
||||
@@ -96,7 +96,7 @@ function Player.createBeam(P,R,send,color)
|
||||
local r,g,b=unpack(SKIN.libColor[color])
|
||||
r,g,b=r*2,g*2,b*2
|
||||
|
||||
local a=modeEnv.royaleMode and not(P.human or R.human)and .2 or 1
|
||||
local a=MODEENV.royaleMode and not(P.human or R.human)and .2 or 1
|
||||
SYSFX.newAttack(1-SETTING.atkFX*.1,x1,y1,x2,y2,wid,r,g,b,a*(SETTING.atkFX+2)*.0626)
|
||||
end
|
||||
--------------------------</FX>--------------------------
|
||||
@@ -113,16 +113,34 @@ function Player.set20G(P,if20g,init)
|
||||
virtualkey[7].ava=not if20g
|
||||
if init and if20g and P.AI_mode=="CC"then CC.switch20G(P)end
|
||||
end
|
||||
function Player.setHold(P,ifhold)
|
||||
P.gameEnv.hold=ifhold
|
||||
P.keyAvailable[8]=ifhold
|
||||
virtualkey[8].ava=ifhold
|
||||
if not ifhold then
|
||||
P.hd=nil
|
||||
function Player.setHold(P,count)
|
||||
if not count then
|
||||
count=0
|
||||
elseif count==true then
|
||||
count=1
|
||||
end
|
||||
P.gameEnv.holdCount=count
|
||||
P.holdTime=count
|
||||
P.keyAvailable[8]=count>0
|
||||
virtualkey[8].ava=count>0
|
||||
if count==0 then
|
||||
P.drawHold=NULL
|
||||
while P.holdQueue[1]do rem(P.holdQueue)end
|
||||
elseif count==1 then
|
||||
P.drawHold=PLY.draw.drawHold_norm
|
||||
else
|
||||
P.drawHold=PLY.draw.drawHold_multi
|
||||
end
|
||||
end
|
||||
function Player.setNext(P,next)
|
||||
P.gameEnv.next=next
|
||||
function Player.setNext(P,next,hidden)
|
||||
P.gameEnv.nextCount=next
|
||||
if next==0 then
|
||||
P.drawNext=NULL
|
||||
elseif not hidden then
|
||||
P.drawNext=PLY.draw.drawNext_norm
|
||||
else
|
||||
P.drawNext=PLY.draw.drawNext_hidden
|
||||
end
|
||||
end
|
||||
function Player.setInvisible(P,time)
|
||||
if time<0 then
|
||||
@@ -510,8 +528,9 @@ function Player.spin(P,d,ifpre)
|
||||
end
|
||||
end
|
||||
function Player.hold(P,ifpre)
|
||||
if not P.holded and (ifpre or P.waiting==-1) and P.gameEnv.hold then
|
||||
local H,C=P.hd,P.cur
|
||||
if P.holdTime>0 and(ifpre or P.waiting==-1)then
|
||||
local N=#P.holdQueue<P.gameEnv.holdCount and #P.holdQueue+1 or 1
|
||||
local H,C=P.holdQueue[N],P.cur
|
||||
if not(H or C)then return end
|
||||
|
||||
--Finesse check
|
||||
@@ -524,31 +543,33 @@ function Player.hold(P,ifpre)
|
||||
P.spinLast=false
|
||||
P.spinSeq=0
|
||||
|
||||
P.cur,P.hd=H,C--Swap hold
|
||||
H,C=P.hd,P.cur
|
||||
P.cur,P.holdQueue[N]=H,C--Swap hold
|
||||
H,C=P.holdQueue[N],P.cur
|
||||
|
||||
if P.next[1]or C then--Make hold available in fixed sequence
|
||||
P.holded=P.gameEnv.oncehold
|
||||
if P.nextQueue[1]or C then--Make hold available in fixed sequence
|
||||
if P.gameEnv.oncehold then
|
||||
P.holdTime=P.holdTime-1
|
||||
end
|
||||
end
|
||||
|
||||
if H then
|
||||
local hid=P.hd.id
|
||||
P.hd.bk=BLOCKS[hid][P.gameEnv.face[hid]]
|
||||
local hid=P.holdQueue[N].id
|
||||
P.holdQueue[N].bk=BLOCKS[hid][P.gameEnv.face[hid]]
|
||||
end
|
||||
if not C then
|
||||
C=rem(P.next,1)
|
||||
C=rem(P.nextQueue,1)
|
||||
P:newNext()
|
||||
if C then
|
||||
P.cur=C
|
||||
P.pieceCount=P.pieceCount+1
|
||||
if P.AI_mode=="CC"then
|
||||
local next=P.next[P.AIdata.next]
|
||||
local next=P.nextQueue[P.AIdata.nextCount]
|
||||
if next then
|
||||
CC.addNext(P.AI_bot,next.id)
|
||||
end
|
||||
end
|
||||
else
|
||||
P.holded=false
|
||||
P.holdTime=0
|
||||
end
|
||||
end
|
||||
if C then
|
||||
@@ -556,10 +577,14 @@ function Player.hold(P,ifpre)
|
||||
P:freshBlock(false,true)
|
||||
P.dropDelay=P.gameEnv.drop
|
||||
P.lockDelay=P.gameEnv.lock
|
||||
P.freshTime=max(P.freshTime-5,0)
|
||||
P.freshTime=max(P.freshTime-5,int(P.gameEnv.freshLimit*(P.gameEnv.holdCount-P.holdTime)/P.gameEnv.holdCount))
|
||||
if P:ifoverlap(P.cur.bk,P.curX,P.curY)then P:lock()P:lose()end
|
||||
end
|
||||
|
||||
if #P.holdQueue==P.gameEnv.holdCount then
|
||||
ins(P.holdQueue,rem(P.holdQueue,1))
|
||||
end
|
||||
|
||||
if P.sound then
|
||||
SFX.play(ifpre and"prehold"or"hold")
|
||||
end
|
||||
@@ -569,20 +594,20 @@ end
|
||||
|
||||
function Player.getNext(P,n)
|
||||
local E=P.gameEnv
|
||||
ins(P.next,{bk=BLOCKS[n][E.face[n]],id=n,color=E.bone and 17 or E.skin[n],name=n})
|
||||
ins(P.nextQueue,{bk=BLOCKS[n][E.face[n]],id=n,color=E.bone and 17 or E.skin[n],name=n})
|
||||
end
|
||||
function Player.popNext(P)--Pop next queue to hand
|
||||
P.holded=false
|
||||
P.holdTime=P.gameEnv.holdCount
|
||||
P.spinLast=false
|
||||
P.spinSeq=0
|
||||
P.ctrlCount=0
|
||||
|
||||
P.cur=rem(P.next,1)
|
||||
P.cur=rem(P.nextQueue,1)
|
||||
P:newNext()
|
||||
if P.cur then
|
||||
P.pieceCount=P.pieceCount+1
|
||||
if P.AI_mode=="CC"then
|
||||
local next=P.next[P.AIdata.next]
|
||||
local next=P.nextQueue[P.AIdata.nextCount]
|
||||
if next then
|
||||
CC.addNext(P.AI_bot,next.id)
|
||||
end
|
||||
@@ -873,9 +898,9 @@ do--player:drop()--Place piece
|
||||
end
|
||||
piece.finePts=finePts
|
||||
|
||||
P.stat.finesseRate=P.stat.finesseRate+finePts
|
||||
STAT.finesseRate=STAT.finesseRate+finePts
|
||||
if finePts<5 then
|
||||
P.stat.extraPiece=P.stat.extraPiece+1
|
||||
STAT.extraPiece=STAT.extraPiece+1
|
||||
if ENV.fineKill then
|
||||
P:lose()
|
||||
end
|
||||
@@ -1036,7 +1061,7 @@ do--player:drop()--Place piece
|
||||
if P.b2b>1200 then P.b2b=1200 end
|
||||
|
||||
--Bonus atk/def when focused
|
||||
if modeEnv.royaleMode then
|
||||
if MODEENV.royaleMode then
|
||||
local i=min(#P.atker,9)
|
||||
if i>1 then
|
||||
atk=atk+reAtk[i]
|
||||
@@ -1061,7 +1086,7 @@ do--player:drop()--Place piece
|
||||
off=off+_
|
||||
if send>0 then
|
||||
local T
|
||||
if modeEnv.royaleMode then
|
||||
if MODEENV.royaleMode then
|
||||
if P.atkMode==4 then
|
||||
local M=#P.atker
|
||||
if M>0 then
|
||||
@@ -1218,7 +1243,7 @@ function Player.loadAI(P,AIdata)--Load AI params
|
||||
delay=AIdata.delay,
|
||||
delta=AIdata.delta,
|
||||
|
||||
next=AIdata.next,
|
||||
nextCount=AIdata.nextCount,
|
||||
hold=AIdata.hold,
|
||||
_20G=P._20G,
|
||||
bag=AIdata.bag,
|
||||
@@ -1229,6 +1254,7 @@ function Player.loadAI(P,AIdata)--Load AI params
|
||||
P.AI_delay0=int(P.AI_delay0*.26)
|
||||
end
|
||||
if P.AI_mode=="CC"then
|
||||
P:setHold(1)
|
||||
P:setRS("SRS")
|
||||
local opt,wei=CC.getConf()
|
||||
CC.fastWeights(wei)
|
||||
@@ -1238,10 +1264,11 @@ function Player.loadAI(P,AIdata)--Load AI params
|
||||
CC.setNode(opt,P.AIdata.node)
|
||||
P.AI_bot=CC.new(opt,wei)
|
||||
CC.free(opt)CC.free(wei)
|
||||
for i=1,AIdata.next do
|
||||
CC.addNext(P.AI_bot,P.next[i].id)
|
||||
for i=1,AIdata.nextCount do
|
||||
CC.addNext(P.AI_bot,P.nextQueue[i].id)
|
||||
end
|
||||
else
|
||||
P:setHold(1)
|
||||
P:setRS("TRS")
|
||||
end
|
||||
end
|
||||
@@ -1323,7 +1350,7 @@ function Player.win(P,result)
|
||||
if P.result then return end
|
||||
P:die()
|
||||
P.result="WIN"
|
||||
if modeEnv.royaleMode then
|
||||
if MODEENV.royaleMode then
|
||||
P.modeData.event=1
|
||||
P:changeAtk()
|
||||
end
|
||||
@@ -1331,7 +1358,7 @@ function Player.win(P,result)
|
||||
GAME.result=result or"win"
|
||||
SFX.play("win")
|
||||
VOC.play("win")
|
||||
if modeEnv.royaleMode then
|
||||
if MODEENV.royaleMode then
|
||||
BGM.play("8-bit happiness")
|
||||
end
|
||||
end
|
||||
@@ -1362,7 +1389,7 @@ function Player.lose(P,force)
|
||||
|
||||
if P.AI_mode=="CC"then
|
||||
CC.destroy(P.AI_bot)
|
||||
P.hd=nil
|
||||
while P.holdQueue[1]do rem(P.holdQueue)end
|
||||
P:loadAI(P.AIdata)
|
||||
end
|
||||
|
||||
@@ -1398,7 +1425,7 @@ function Player.lose(P,force)
|
||||
end
|
||||
end
|
||||
P.result="K.O."
|
||||
if modeEnv.royaleMode then
|
||||
if MODEENV.royaleMode then
|
||||
P:changeAtk()
|
||||
P.modeData.event=#PLAYERS.alive+1
|
||||
P.strength=0
|
||||
@@ -1440,7 +1467,7 @@ function Player.lose(P,force)
|
||||
GAME.result="gameover"
|
||||
SFX.play("fail")
|
||||
VOC.play("lose")
|
||||
if modeEnv.royaleMode then
|
||||
if MODEENV.royaleMode then
|
||||
if P.modeData.event==2 then
|
||||
BGM.play("hay what kind of feeling")
|
||||
else
|
||||
|
||||
@@ -14,7 +14,7 @@ local freshPrepare={
|
||||
for i=1,L do
|
||||
P.seqData[i]=bag[L+1-i]
|
||||
end
|
||||
while #P.next<6 do
|
||||
while #P.nextQueue<6 do
|
||||
if P.seqData[1]then
|
||||
P:getNext(rem(P.seqData))
|
||||
else
|
||||
@@ -27,7 +27,7 @@ freshMethod={
|
||||
none=NULL,
|
||||
bag=function(P)
|
||||
local bag=P.seqData
|
||||
while #P.next<6 do
|
||||
while #P.nextQueue<6 do
|
||||
if #bag==0 then--Copy a new bag
|
||||
local bag0=P.gameEnv.bag
|
||||
for i=1,#bag0 do bag[i]=bag0[i]end
|
||||
@@ -36,7 +36,7 @@ freshMethod={
|
||||
end
|
||||
end,
|
||||
his4=function(P)
|
||||
while #P.next<6 do
|
||||
while #P.nextQueue<6 do
|
||||
local bag=P.gameEnv.bag
|
||||
local L=#bag
|
||||
for n=1,4 do
|
||||
@@ -51,7 +51,7 @@ freshMethod={
|
||||
end
|
||||
end,
|
||||
rnd=function(P)
|
||||
while #P.next<6 do
|
||||
while #P.nextQueue<6 do
|
||||
local bag=P.gameEnv.bag
|
||||
local L=#bag
|
||||
for i=1,4 do
|
||||
@@ -59,14 +59,14 @@ freshMethod={
|
||||
repeat
|
||||
i=bag[P:RND(L)]
|
||||
count=count+1
|
||||
until i~=P.next[#P.next].id or count>=L
|
||||
until i~=P.nextQueue[#P.nextQueue].id or count>=L
|
||||
P:getNext(i)
|
||||
end
|
||||
end
|
||||
end,
|
||||
reverb=function(P)
|
||||
local seq=P.seqData
|
||||
while #P.next<6 do
|
||||
while #P.nextQueue<6 do
|
||||
if #seq==0 then
|
||||
local bag0=P.gameEnv.bag
|
||||
for i=1,#bag0 do seq[i]=bag0[i]end
|
||||
@@ -87,7 +87,7 @@ freshMethod={
|
||||
end
|
||||
end,
|
||||
loop=function(P)
|
||||
while #P.next<6 do
|
||||
while #P.nextQueue<6 do
|
||||
if #P.seqData==0 then
|
||||
local bag=P.gameEnv.bag
|
||||
local L=#bag
|
||||
@@ -99,11 +99,11 @@ freshMethod={
|
||||
end
|
||||
end,
|
||||
fixed=function(P)
|
||||
while #P.next<6 do
|
||||
while #P.nextQueue<6 do
|
||||
if P.seqData[1]then
|
||||
P:getNext(rem(P.seqData))
|
||||
else
|
||||
if not(P.cur or P.hd)then P:lose(true)end
|
||||
if not(P.cur or P.holdQueue[1])then P:lose(true)end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
@@ -113,7 +113,7 @@ function update.alive(P,dt)
|
||||
for i=2,10 do v=v+i*(i-1)*7.2/(_-P.dropTime[i])end
|
||||
P.dropSpeed=P.dropSpeed*.99+v*.1
|
||||
|
||||
if modeEnv.royaleMode then
|
||||
if MODEENV.royaleMode then
|
||||
if P.keyPressing[9]then
|
||||
P.swappingAtkMode=min(P.swappingAtkMode+2,30)
|
||||
else
|
||||
@@ -313,7 +313,7 @@ function update.dead(P,dt)
|
||||
P.keySpeed=P.keySpeed*.96+P.stat.key/P.stat.time*60*.04
|
||||
P.dropSpeed=P.dropSpeed*.96+P.stat.piece/P.stat.time*60*.04
|
||||
--Final average speeds
|
||||
if modeEnv.royaleMode then
|
||||
if MODEENV.royaleMode then
|
||||
P.swappingAtkMode=min(P.swappingAtkMode+2,30)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user