自定义场地多页面功能(暂不支持多页复制)
This commit is contained in:
@@ -1,9 +1,53 @@
|
||||
local int=math.floor
|
||||
|
||||
local function notAir(L)
|
||||
for i=1,10 do
|
||||
if L[i]>0 then return true end
|
||||
end
|
||||
end
|
||||
local function setField(P,page)
|
||||
local F=FIELD[page]
|
||||
local height=0
|
||||
for y=20,1,-1 do
|
||||
if notAir(F[y])then
|
||||
height=y
|
||||
break
|
||||
end
|
||||
end
|
||||
local t=P.showTime*3
|
||||
for y=1,height do
|
||||
local solid=notAir(F[y])
|
||||
P.field[y]=freeRow.get(0,solid)
|
||||
P.visTime[y]=freeRow.get(t)
|
||||
if solid then
|
||||
for x=1,10 do
|
||||
P.field[y][x]=F[y][x]
|
||||
end
|
||||
P.garbageBeneath=P.garbageBeneath+1
|
||||
end
|
||||
end
|
||||
end
|
||||
local function checkClear(P)
|
||||
if P.garbageBeneath==0 then
|
||||
P.modeData.point=P.modeData.point+1
|
||||
if FIELD[P.modeData.point+1]then
|
||||
P.waiting=26
|
||||
for _=#P.field,1,-1 do
|
||||
freeRow.discard(P.field[_])
|
||||
freeRow.discard(P.visTime[_])
|
||||
P.field[_],P.visTime[_]=nil
|
||||
end
|
||||
setField(P,P.modeData.point+1)
|
||||
sysFX.newShade(.7,.6,.8,.6,P.x+150*P.size,P.y+60*P.size,300*P.size,610*P.size)
|
||||
SFX.play("blip_1")
|
||||
else
|
||||
P:win("finish")
|
||||
end
|
||||
end
|
||||
end
|
||||
return{
|
||||
color=color.white,
|
||||
env={
|
||||
dropPiece=PLY.check_lineReach,
|
||||
},
|
||||
env={},
|
||||
load=function()
|
||||
for k,v in next,customEnv do
|
||||
modeEnv[k]=v
|
||||
@@ -18,6 +62,19 @@ return{
|
||||
else
|
||||
modeEnv.mission=nil
|
||||
end
|
||||
local clearmode
|
||||
if FIELD[1]then
|
||||
for y=1,20 do
|
||||
if notAir(FIELD[1][y])then
|
||||
clearmode=true
|
||||
end
|
||||
end
|
||||
end
|
||||
if clearmode then
|
||||
modeEnv.dropPiece=checkClear
|
||||
else
|
||||
modeEnv.dropPiece=PLY.check_lineReach
|
||||
end
|
||||
PLY.newPlayer(1,340,15)
|
||||
local L=modeEnv.opponent
|
||||
if L~=0 then
|
||||
@@ -28,24 +85,8 @@ return{
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",2*L-11,int(L*.5-1.5),modeEnv.hold,4000*L))
|
||||
end
|
||||
end
|
||||
FIELD.h=20
|
||||
repeat
|
||||
for i=1,10 do
|
||||
if FIELD[FIELD.h][i]>0 then
|
||||
goto L
|
||||
end
|
||||
end
|
||||
FIELD.h=FIELD.h-1
|
||||
until FIELD.h==0
|
||||
::L::
|
||||
for _,P in next,PLAYERS.alive do
|
||||
local t=P.showTime*3
|
||||
for y=1,FIELD.h do
|
||||
P.field[y]=freeRow.get(0,true)
|
||||
P.visTime[y]=freeRow.get(t)
|
||||
for x=1,10 do P.field[y][x]=FIELD[y][x]end
|
||||
end
|
||||
P.garbageBeneath=FIELD.h
|
||||
setField(P,1)
|
||||
end
|
||||
modeEnv.bg=customEnv.bg
|
||||
modeEnv.bgm=customEnv.bgm
|
||||
|
||||
Reference in New Issue
Block a user