Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a29fa973a6 |
Binary file not shown.
BIN
BGM/blank.ogg
BIN
BGM/blank.ogg
Binary file not shown.
BIN
BGM/cruelty.ogg
BIN
BGM/cruelty.ogg
Binary file not shown.
BIN
BGM/end.ogg
BIN
BGM/end.ogg
Binary file not shown.
BIN
BGM/final.ogg
BIN
BGM/final.ogg
Binary file not shown.
BIN
BGM/infinite.ogg
BIN
BGM/infinite.ogg
Binary file not shown.
BIN
BGM/newera.ogg
BIN
BGM/newera.ogg
Binary file not shown.
BIN
BGM/push.ogg
BIN
BGM/push.ogg
Binary file not shown.
BIN
BGM/race.ogg
BIN
BGM/race.ogg
Binary file not shown.
BIN
BGM/reason.ogg
BIN
BGM/reason.ogg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
BGM/shining terminal.ogg
Normal file
BIN
BGM/shining terminal.ogg
Normal file
Binary file not shown.
BIN
BGM/way.ogg
BIN
BGM/way.ogg
Binary file not shown.
BIN
SFX/blip_1.ogg
BIN
SFX/blip_1.ogg
Binary file not shown.
BIN
SFX/blip_2.ogg
BIN
SFX/blip_2.ogg
Binary file not shown.
BIN
SFX/button.ogg
BIN
SFX/button.ogg
Binary file not shown.
BIN
SFX/clear_1.ogg
BIN
SFX/clear_1.ogg
Binary file not shown.
BIN
SFX/clear_2.ogg
BIN
SFX/clear_2.ogg
Binary file not shown.
BIN
SFX/clear_3.ogg
BIN
SFX/clear_3.ogg
Binary file not shown.
BIN
SFX/clear_4.ogg
BIN
SFX/clear_4.ogg
Binary file not shown.
BIN
SFX/collect.ogg
BIN
SFX/collect.ogg
Binary file not shown.
BIN
SFX/drop.ogg
BIN
SFX/drop.ogg
Binary file not shown.
BIN
SFX/fail.ogg
BIN
SFX/fail.ogg
Binary file not shown.
BIN
SFX/fall.ogg
BIN
SFX/fall.ogg
Binary file not shown.
BIN
SFX/hold.ogg
BIN
SFX/hold.ogg
Binary file not shown.
BIN
SFX/lock.ogg
BIN
SFX/lock.ogg
Binary file not shown.
BIN
SFX/move.ogg
BIN
SFX/move.ogg
Binary file not shown.
Binary file not shown.
BIN
SFX/prehold.ogg
BIN
SFX/prehold.ogg
Binary file not shown.
Binary file not shown.
BIN
SFX/reach.ogg
BIN
SFX/reach.ogg
Binary file not shown.
BIN
SFX/ready.ogg
BIN
SFX/ready.ogg
Binary file not shown.
BIN
SFX/rotate.ogg
BIN
SFX/rotate.ogg
Binary file not shown.
Binary file not shown.
BIN
SFX/spin_1.ogg
BIN
SFX/spin_1.ogg
Binary file not shown.
BIN
SFX/spin_2.ogg
BIN
SFX/spin_2.ogg
Binary file not shown.
BIN
SFX/spin_3.ogg
BIN
SFX/spin_3.ogg
Binary file not shown.
BIN
SFX/start.ogg
BIN
SFX/start.ogg
Binary file not shown.
BIN
SFX/swipe.ogg
BIN
SFX/swipe.ogg
Binary file not shown.
BIN
SFX/win.ogg
BIN
SFX/win.ogg
Binary file not shown.
235
ai.lua
235
ai.lua
@@ -8,8 +8,76 @@
|
||||
4deepShape
|
||||
BlockedWells;
|
||||
]]
|
||||
local abs=math.abs
|
||||
local int,ceil,min,abs,rnd=math.floor,math.ceil,math.min,math.abs,math.random
|
||||
local ins,rem=table.insert,table.remove
|
||||
local Timer=love.timer.getTime
|
||||
-- controlname:
|
||||
-- 1~5:mL,mR,rR,rL,rF,
|
||||
-- 6~10:hD,sD,H,A,R,
|
||||
-- 11~13:LL,RR,DD
|
||||
local blockPos={4,4,4,4,4,5,4}
|
||||
local scs={{1,2},{1,2},{1,2},{1,2},{1,2},{1.5,1.5},{0.5,2.5}}
|
||||
-------------------------------------------------Cold clear
|
||||
local CCblockID={4,3,5,6,1,2,0}
|
||||
if system~="Windows"then goto SKIP end
|
||||
require("CCloader")
|
||||
BOT={
|
||||
getConf= cc.get_default_config ,--()options,weights
|
||||
--setConf= cc.set_options ,--(options,hold,20g,bag7)
|
||||
|
||||
new= cc.launch_async ,--(options,weights)bot
|
||||
addNext= cc.add_next_piece_async ,--(bot,piece)
|
||||
update= cc.reset_async ,--(bot,field,b2b,combo)
|
||||
think= cc.request_next_move ,--(bot)
|
||||
getMove= cc.poll_next_move ,--(bot)success,hold,move
|
||||
ifDead= cc.is_dead_async ,--(bot)dead
|
||||
destroy= cc.destroy_async ,--(bot)
|
||||
|
||||
setHold= cc.set_hold ,--(opt,bool)
|
||||
set20G= cc.set_20g ,--(opt,bool)
|
||||
setBag= cc.set_bag7 ,--(opt,bool)
|
||||
setNode= cc.set_max_nodes ,--(opt,bool)
|
||||
free= cc.free ,--(opt/wei)
|
||||
}
|
||||
function CC_updateField(P)
|
||||
local F,i={},1
|
||||
for y=1,#P.field do
|
||||
for x=1,10 do
|
||||
F[i],i=P.field[y][x]>0,i+1
|
||||
end
|
||||
end
|
||||
while i<400 do
|
||||
F[i],i=false,i+1
|
||||
end
|
||||
BOT.update(P.AI_bot,F,P.b2b>=100,P.combo)
|
||||
end
|
||||
function CC_switch20G(P)
|
||||
P.AIdata._20G=true
|
||||
P.AI_keys={}
|
||||
BOT.destroy(P.AI_bot)
|
||||
local opt,wei=BOT.getConf()
|
||||
BOT.setHold(opt,P.AIdata.hold)
|
||||
BOT.set20G(opt,P.AIdata._20G)
|
||||
BOT.setBag(opt,P.AIdata.bag7)
|
||||
BOT.setNode(opt,P.AIdata.node)
|
||||
P.AI_bot=BOT.new(opt,wei)
|
||||
BOT.free(opt)BOT.free(wei)
|
||||
for i=1,P.AIdata.next do
|
||||
BOT.addNext(P.AI_bot,CCblockID[P.next[i].id])
|
||||
end
|
||||
CC_updateField(P)
|
||||
P.hold={bk={{}},id=0,color=0,name=0}P.holded=false
|
||||
P.cur=rem(P.next,1)
|
||||
P.sc,P.dir=scs[P.cur.id],0
|
||||
P.r,P.c=#P.cur.bk,#P.cur.bk[1]
|
||||
P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2)
|
||||
|
||||
P.freshNext()
|
||||
BOT.addNext(P.AI_bot,CCblockID[P.next[P.AIdata.next].id])
|
||||
collectgarbage()
|
||||
end
|
||||
::SKIP::
|
||||
-------------------------------------------------⑨Stack setup
|
||||
local dirCount={1,1,3,3,3,0,1}
|
||||
local spinOffset={
|
||||
{1,0,0},--S
|
||||
@@ -20,12 +88,6 @@ local spinOffset={
|
||||
{0,0,0},--O
|
||||
{2,0,1},--I
|
||||
}for i=1,7 do spinOffset[i][0]=0 end
|
||||
--[[
|
||||
controlname:
|
||||
1~5:mL,mR,rR,rL,rF,
|
||||
6~10:hD,sD,H,A,R,
|
||||
11~13:LL,RR,DD
|
||||
]]
|
||||
local FCL={
|
||||
[1]={
|
||||
{{11},{11,2},{1},{},{2},{2,2},{12,1},{12}},
|
||||
@@ -68,7 +130,7 @@ local function resetField(f0,f,start)
|
||||
end
|
||||
end
|
||||
end
|
||||
local function getScore(field,bn,cb,cx,cy)
|
||||
local function getScore(field,cb,cy)
|
||||
local score=0
|
||||
local highest=0
|
||||
local height=getNewRow(0)
|
||||
@@ -123,58 +185,111 @@ local function getScore(field,bn,cb,cx,cy)
|
||||
if mh1>3 then score=score-40-mh1*30 end
|
||||
return score
|
||||
end
|
||||
function AI_getControls(ctrl)
|
||||
local Tfield={}--test field
|
||||
local field_org=P.field
|
||||
for i=1,#field_org do
|
||||
Tfield[i]=getNewRow(0)
|
||||
for j=1,10 do
|
||||
Tfield[i][j]=field_org[i][j]
|
||||
end
|
||||
end
|
||||
local best={x=1,dir=0,hold=false,score=-9e99}
|
||||
for ifhold=0,P.gameEnv.hold and 1 or 0 do
|
||||
local bn=ifhold==0 and P.cur.id or P.hold.id>0 and P.hold.id or P.next[1].id
|
||||
for dir=0,dirCount[bn] do--each dir
|
||||
local cb=blocks[bn][dir]
|
||||
for cx=1,11-#cb[1]do--each pos
|
||||
local cy=#Tfield+1
|
||||
::L::if not ifoverlapAI(Tfield,cb,cx,cy-1)then
|
||||
cy=cy-1
|
||||
goto L
|
||||
end--move to bottom
|
||||
for i=1,#cb do
|
||||
local y=cy+i-1
|
||||
if not Tfield[y]then Tfield[y]=getNewRow(0)end
|
||||
for j=1,#cb[1]do
|
||||
if cb[i][j]then
|
||||
Tfield[y][cx+j-1]=1
|
||||
end
|
||||
end
|
||||
end--simulate lock
|
||||
local score=getScore(Tfield,bn,cb,cx,cy)
|
||||
if score>best.score then
|
||||
best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score}
|
||||
-------------------------------------------------
|
||||
AI_think={
|
||||
["9S"]={
|
||||
function(ctrl)
|
||||
local Tfield={}--test field
|
||||
local field_org=P.field
|
||||
for i=1,#field_org do
|
||||
Tfield[i]=getNewRow(0)
|
||||
for j=1,10 do
|
||||
Tfield[i][j]=field_org[i][j]
|
||||
end
|
||||
end
|
||||
local best={x=1,dir=0,hold=false,score=-9e99}
|
||||
for ifhold=0,P.gameEnv.hold and 1 or 0 do
|
||||
local bn=ifhold==0 and P.cur.id or P.hold.id>0 and P.hold.id or P.next[1].id
|
||||
for dir=0,dirCount[bn] do--each dir
|
||||
local cb=blocks[bn][dir]
|
||||
for cx=1,11-#cb[1]do--each pos
|
||||
local cy=#Tfield+1
|
||||
::L::if not ifoverlapAI(Tfield,cb,cx,cy-1)then
|
||||
cy=cy-1
|
||||
goto L
|
||||
end--move to bottom
|
||||
for i=1,#cb do
|
||||
local y=cy+i-1
|
||||
if not Tfield[y]then Tfield[y]=getNewRow(0)end
|
||||
for j=1,#cb[1]do
|
||||
if cb[i][j]then
|
||||
Tfield[y][cx+j-1]=1
|
||||
end
|
||||
end
|
||||
end--simulate lock
|
||||
local score=getScore(Tfield,cb,cy)
|
||||
if score>best.score then
|
||||
best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score}
|
||||
end
|
||||
resetField(field_org,Tfield,cy)
|
||||
end
|
||||
end
|
||||
resetField(field_org,Tfield,cy)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
::L::
|
||||
if #Tfield>0 then
|
||||
removeRow(Tfield,1)
|
||||
goto L
|
||||
end--Release cache
|
||||
local p=#ctrl+1
|
||||
if best.hold then
|
||||
ctrl[p]=8
|
||||
p=p+1
|
||||
end
|
||||
local l=FCL[best.bn][best.dir+1][best.x]
|
||||
for i=1,#l do
|
||||
ctrl[p]=l[i]
|
||||
p=p+1
|
||||
end
|
||||
ctrl[p]=6
|
||||
end
|
||||
::L::
|
||||
if #Tfield>0 then
|
||||
removeRow(Tfield,1)
|
||||
goto L
|
||||
end--Release cache
|
||||
local p=#ctrl+1
|
||||
if best.hold then
|
||||
ctrl[p]=8
|
||||
p=p+1
|
||||
end
|
||||
local l=FCL[best.bn][best.dir+1][best.x]
|
||||
for i=1,#l do
|
||||
ctrl[p]=l[i]
|
||||
p=p+1
|
||||
end
|
||||
ctrl[p]=6
|
||||
return 2
|
||||
end,
|
||||
function()
|
||||
P.AI_delay=P.AI_delay0
|
||||
if Timer()-P.modeData.point>P.modeData.event then
|
||||
P.modeData.point=Timer()
|
||||
P.modeData.event=P.AI_delay0+rnd(2,10)
|
||||
changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
||||
end
|
||||
return 1
|
||||
end,
|
||||
},
|
||||
["CC"]={
|
||||
function()
|
||||
if P.AI_needFresh then
|
||||
CC_updateField(P)
|
||||
P.AI_needFresh=false
|
||||
end
|
||||
BOT.think(P.AI_bot)
|
||||
return 2
|
||||
end,
|
||||
function(ctrl)
|
||||
if BOT.ifDead(P.AI_bot)then ins(ctrl,6)return 3 end
|
||||
local success,hold,move=BOT.getMove(P.AI_bot)
|
||||
if success then
|
||||
if hold then ctrl[1]=8 end--Hold
|
||||
while move[1]do
|
||||
local m=rem(move,1)
|
||||
if m<4 then
|
||||
ins(ctrl,m+1)
|
||||
elseif not P.AIdata._20G then
|
||||
ins(ctrl,13)
|
||||
end
|
||||
end
|
||||
ins(ctrl,6)
|
||||
return 3
|
||||
else
|
||||
return 2--stay this stage
|
||||
end
|
||||
end,
|
||||
function()
|
||||
P.AI_delay=P.AI_delay0
|
||||
if Timer()-P.modeData.point>P.modeData.event then
|
||||
P.modeData.point=Timer()
|
||||
P.modeData.event=P.AI_delay0+rnd(2,10)
|
||||
changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
||||
end
|
||||
return 1
|
||||
end,
|
||||
},
|
||||
}--AI think stage
|
||||
51
class.lua
51
class.lua
@@ -1,17 +1,24 @@
|
||||
Task={}
|
||||
local rem=table.remove
|
||||
|
||||
metatable_task={__index=Task}
|
||||
Task={}
|
||||
function Task:update()
|
||||
if(not self.P or self.P and scene=="play")and self:code(self.P,self.data)then
|
||||
local e=#Task
|
||||
for i=1,e do
|
||||
if Task[i]==self then
|
||||
Task[e],Task[i]=nil,Task[e]
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function newTask(code,P,data)
|
||||
local id=#Task+1
|
||||
local obj={
|
||||
Task[#Task+1]={
|
||||
update=Task.update,
|
||||
|
||||
code=code,
|
||||
P=P,
|
||||
data=data,
|
||||
id=id,
|
||||
}
|
||||
setmetatable(obj,metatable_task)
|
||||
Task[id]=obj
|
||||
end
|
||||
function clearTask(opt)
|
||||
if opt=="all"then
|
||||
@@ -34,14 +41,22 @@ function clearTask(opt)
|
||||
end
|
||||
end
|
||||
end
|
||||
function Task:update()
|
||||
if(not self.P or self.P and scene=="play")and self:code(self.P,self.data)then
|
||||
local e=#Task
|
||||
for i=1,e do
|
||||
if Task[i]==self then
|
||||
Task[e],Task[i]=nil,Task[e]
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function newButton(x,y,w,h,color,font,code,hide,up,down,left,right)
|
||||
return{
|
||||
type="button",
|
||||
x=x-w*.5,y=y-h*.5,w=w,h=h,
|
||||
color=color,font=font,
|
||||
code=code,hide=hide,
|
||||
up=up,down=down,left=left,right=right,
|
||||
}
|
||||
end
|
||||
function newSlider(x,y,w,unit,color,font,code,hide,up,down,left,right)
|
||||
return{
|
||||
type="slider",
|
||||
x=x,y=y,w=w,unit=unit,
|
||||
color=color,font=font,
|
||||
code=code,hide=hide,
|
||||
up=up,down=down,left=left,right=right,
|
||||
}
|
||||
end
|
||||
2
conf.lua
2
conf.lua
@@ -1,4 +1,4 @@
|
||||
gameVersion="Alpha V0.7.22"
|
||||
gameVersion="Alpha V0.7.23"
|
||||
function love.conf(t)
|
||||
t.identity="Techmino"--Save directory name
|
||||
t.version="11.1"
|
||||
|
||||
772
dataList.lua
772
dataList.lua
File diff suppressed because it is too large
Load Diff
533
gamefunc.lua
533
gamefunc.lua
@@ -1,29 +1,29 @@
|
||||
local gc=love.graphics
|
||||
local int,ceil,abs,rnd,max,min=math.floor,math.ceil,math.abs,math.random,math.max,math.min
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local null=function()end
|
||||
local gameEnv0={
|
||||
das=10,arr=2,
|
||||
sddas=0,sdarr=2,
|
||||
sddas=2,sdarr=2,
|
||||
ghost=true,center=true,
|
||||
grid=false,swap=true,
|
||||
_20G=false,bone=false,
|
||||
drop=30,lock=45,
|
||||
drop=60,lock=60,
|
||||
wait=0,fall=0,
|
||||
next=6,hold=true,oncehold=true,
|
||||
sequence="bag7",
|
||||
|
||||
block=true,
|
||||
keepVisible=true,visible="show",
|
||||
Fkey=false,puzzle=false,ospin=true,
|
||||
freshLimit=1e99,target=1e99,reach=null,
|
||||
visible="show",--keepVisible=visile~="show"
|
||||
Fkey=null,puzzle=false,ospin=true,
|
||||
freshLimit=1e99,easyFresh=true,
|
||||
target=1e99,dropPiece=null,
|
||||
bg="none",bgm="race"
|
||||
}
|
||||
local blockPos={4,4,4,4,4,5,4}
|
||||
local renATK={[0]=0,0,0,1,1,2,2,3,3,4,4}--3 else
|
||||
local b2bPoint={50,100,180}
|
||||
local b2bATK={3,5,8}
|
||||
local clearSCR={40,100,180}
|
||||
local clearSCR={80,200,400}
|
||||
local spinSCR={--[blockName][row]
|
||||
{200,750,1600},--Z
|
||||
{200,750,1600},--S
|
||||
@@ -43,6 +43,7 @@ local clearName={"single","double","triple"}
|
||||
local spin_n={[0]="spin_0","spin_1","spin_2","spin_3"}
|
||||
local clear_n={"clear_1","clear_2","clear_3","clear_4"}
|
||||
local ren_n={}for i=1,11 do ren_n[i]="ren_"..i end
|
||||
local blockPos={4,4,4,4,4,5,4}
|
||||
local scs={
|
||||
{[0]={1,2},{2,1},{2,2},{2,2}},
|
||||
{[0]={1,2},{2,1},{2,2},{2,2}},
|
||||
@@ -60,7 +61,7 @@ local TRS={
|
||||
[21]={{0,0},{-1,0},{-1,1},{1,0},{0,-2},{-1,-2}},
|
||||
[23]={{0,0},{1,0},{1,1},{1,-1},{0,-2},{1,-2}},
|
||||
[32]={{0,0},{-1,0},{-1,-1},{-1,1},{0,2},{-1,2}},
|
||||
[30]={{0,0},{-1,0},{-1,-1},{0,2},{-1,2},{0,-1}},
|
||||
[30]={{0,0},{-1,0},{-1,-1},{0,-1},{0,2},{-1,2}},
|
||||
[03]={{0,0},{1,0},{1,1},{1,-1},{0,-2},{1,-2},{0,1}},
|
||||
[02]={{0,0},{1,0},{-1,0},{0,-1},{0,1}},
|
||||
[20]={{0,0},{-1,0},{1,0},{0,1},{0,-1}},
|
||||
@@ -69,7 +70,7 @@ local TRS={
|
||||
},--Z/J
|
||||
[2]={
|
||||
[01]={{0,0},{-1,0},{-1,1},{-1,-1},{0,-2},{-1,-2}},
|
||||
[10]={{0,0},{1,0},{1,-1},{0,2},{1,2}},
|
||||
[10]={{0,0},{1,0},{1,-1},{0,-1},{0,2},{1,2}},
|
||||
[12]={{0,0},{1,0},{1,-1},{1,1},{0,2},{1,2}},
|
||||
[21]={{0,0},{-1,0},{-1,1},{-1,-1},{0,-2},{-1,-2}},
|
||||
[23]={{0,0},{1,0},{1,1},{-1,0},{0,-2},{1,-2}},
|
||||
@@ -110,7 +111,27 @@ local TRS={
|
||||
[31]={{0,0},{1,0},{-1,0}},
|
||||
}
|
||||
}TRS[3],TRS[4]=TRS[2],TRS[1]
|
||||
|
||||
local AIRS={{
|
||||
[01]={{0,0},{-1,0},{-1,1},{0,-2},{-1,-2}},
|
||||
[10]={{0,0},{1,0},{1,-1},{0,2},{1,2}},
|
||||
[12]={{0,0},{1,0},{1,-1},{0,2},{1,2}},
|
||||
[21]={{0,0},{-1,0},{-1,1},{0,-2},{-1,-2}},
|
||||
[23]={{0,0},{1,0},{1,1},{0,-2},{1,-2}},
|
||||
[32]={{0,0},{-1,0},{-1,-1},{0,2},{-1,2}},
|
||||
[30]={{0,0},{-1,0},{-1,-1},{0,2},{-1,2}},
|
||||
[03]={{0,0},{1,0},{1,1},{0,-2},{1,-2}},
|
||||
}}for i=2,6 do AIRS[i]=AIRS[1]end
|
||||
AIRS[7]={
|
||||
[01]={{0,0},{-2,0},{1,0},{-2,-1},{1,2}},
|
||||
[10]={{0,0},{2,0},{-1,0},{2,1},{-1,-2}},
|
||||
[12]={{0,0},{-1,0},{2,0},{-1,2},{2,-1}},
|
||||
[21]={{0,0},{1,0},{-2,0},{1,-2},{-2,1}},
|
||||
[23]={{0,0},{2,0},{-1,0},{2,1},{-1,-2}},
|
||||
[32]={{0,0},{-2,0},{1,0},{-2,-1},{1,2}},
|
||||
[30]={{0,0},{1,0},{-2,0},{1,-2},{-2,1}},
|
||||
[03]={{0,0},{-1,0},{2,0},{-1,2},{2,-1}},
|
||||
}
|
||||
local CCblockID={4,3,5,6,1,2,0}
|
||||
local function newNext(n)
|
||||
P.next[#P.next+1]={bk=blocks[n][0],id=n,color=P.gameEnv.bone and 8 or n,name=n}
|
||||
end
|
||||
@@ -214,6 +235,7 @@ function changeAtkMode(m)
|
||||
::L::
|
||||
end
|
||||
function changeAtk(P,R)
|
||||
-- if not P.human then R=players[1]end--1vALL mode
|
||||
if P.atking then
|
||||
local K=P.atking.atker
|
||||
for i=1,#K do
|
||||
@@ -285,11 +307,15 @@ function royaleLevelup()
|
||||
local P=players.alive[i]
|
||||
P.gameEnv.drop=spd
|
||||
end
|
||||
if curMode.lv==5 and players[1].alive then
|
||||
local P=players[1]
|
||||
P.gameEnv.drop=int(P.gameEnv.drop*.3)
|
||||
if P.gameEnv.drop==0 then
|
||||
P.gameEnv._20G=true
|
||||
if curMode.lv==3 then
|
||||
for i=1,#players.alive do
|
||||
local P=players.alive[i]
|
||||
P.gameEnv.drop=int(P.gameEnv.drop*.3)
|
||||
if P.gameEnv.drop==0 then
|
||||
P.curY=P.y_img
|
||||
P.gameEnv._20G=true
|
||||
if P.AI_mode=="CC"then CC_switch20G(P)end--little cheating,never mind
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -303,16 +329,14 @@ function loadGame(mode,level)
|
||||
end
|
||||
local function resetPartGameData()
|
||||
frame=30
|
||||
if players then
|
||||
for _,P in next,players do if P.id then
|
||||
while P.field[1]do
|
||||
removeRow(P.field)
|
||||
removeRow(P.visTime)
|
||||
end
|
||||
end end
|
||||
end
|
||||
destroyPlayers()
|
||||
players={alive={}}human=0
|
||||
loadmode[curMode.id]()
|
||||
if modeEnv.task then
|
||||
for i=1,#players do
|
||||
newTask(Event_task[modeEnv.task],players[i])
|
||||
end
|
||||
end
|
||||
if modeEnv.royaleMode then
|
||||
for i=1,#players do
|
||||
changeAtk(players[i],randomTarget(players[i]))
|
||||
@@ -330,17 +354,16 @@ function resetGameData()
|
||||
pushSpeed=3
|
||||
pauseTime=0--Time paused
|
||||
pauseCount=0--Times paused
|
||||
if players then
|
||||
for _,P in next,players do if P.id then
|
||||
while P.field[1]do
|
||||
removeRow(P.field)
|
||||
removeRow(P.visTime)
|
||||
end
|
||||
end end
|
||||
end
|
||||
destroyPlayers()
|
||||
players={alive={}}human=0
|
||||
modeEnv=defaultModeEnv[curMode.id][curMode.lv]or defaultModeEnv[curMode.id][1]
|
||||
loadmode[curMode.id]()
|
||||
local E=defaultModeEnv[curMode.id]
|
||||
modeEnv=E[curMode.lv]or E[1]
|
||||
loadmode[curMode.id]()--bg/bgm need redefine in custom,so up here
|
||||
if modeEnv.task then
|
||||
for i=1,#players do
|
||||
newTask(Event_task[modeEnv.task],players[i])
|
||||
end
|
||||
end
|
||||
curBG=modeEnv.bg
|
||||
BGM(modeEnv.bgm)
|
||||
|
||||
@@ -387,7 +410,7 @@ function gameStart()
|
||||
end
|
||||
setmetatable(_G,nil)
|
||||
end
|
||||
function createPlayer(id,x,y,size,AIspeed,data)
|
||||
function createPlayer(id,x,y,size,AIdata)
|
||||
players[id]={id=id}
|
||||
P=players[id]
|
||||
local P=P
|
||||
@@ -406,17 +429,6 @@ function createPlayer(id,x,y,size,AIspeed,data)
|
||||
P.absFieldY=P.y+60*P.size
|
||||
end
|
||||
|
||||
if AIspeed then
|
||||
P.ai={
|
||||
controls={},
|
||||
controlDelay=30,
|
||||
controlDelay0=AIspeed,
|
||||
}
|
||||
else
|
||||
P.human=true
|
||||
human=human+1
|
||||
end
|
||||
|
||||
P.alive=true
|
||||
P.control=false
|
||||
P.timing=false
|
||||
@@ -442,9 +454,7 @@ function createPlayer(id,x,y,size,AIspeed,data)
|
||||
|
||||
P.gameEnv={}--Game setting vars,like dropDelay setting
|
||||
for k,v in pairs(gameEnv0)do
|
||||
if data and data[k]~=nil then
|
||||
P.gameEnv[k]=data[k]
|
||||
elseif modeEnv[k]~=nil then
|
||||
if modeEnv[k]~=nil then
|
||||
P.gameEnv[k]=modeEnv[k]
|
||||
elseif setting[k]~=nil then
|
||||
P.gameEnv[k]=setting[k]
|
||||
@@ -462,7 +472,7 @@ function createPlayer(id,x,y,size,AIspeed,data)
|
||||
P.dropDelay,P.lockDelay=P.gameEnv.drop,P.gameEnv.lock
|
||||
P.freshTime=0
|
||||
P.spinLast,P.lastClear=false,nil
|
||||
|
||||
|
||||
P.his={rnd(7),rnd(7),rnd(7),rnd(7)}
|
||||
local s=P.gameEnv.sequence
|
||||
if s=="bag7"or s=="his4"then
|
||||
@@ -493,6 +503,46 @@ function createPlayer(id,x,y,size,AIspeed,data)
|
||||
elseif P.gameEnv.sequence==3 then--Pure random
|
||||
end
|
||||
|
||||
if AIdata then
|
||||
P.human=false
|
||||
P.AI_mode=AIdata.type
|
||||
P.AI_stage=1
|
||||
P.AI_needFresh=false
|
||||
P.AI_keys={}
|
||||
P.AI_delay=min(int(P.gameEnv.drop*.8),2*AIdata.delta)
|
||||
P.AI_delay0=AIdata.delta
|
||||
P.AIdata={
|
||||
next=AIdata.next,
|
||||
hold=AIdata.hold,
|
||||
_20G=P.gameEnv._20G,
|
||||
bag7=AIdata.bag7=="bag7",
|
||||
node=AIdata.node,
|
||||
}
|
||||
if not BOT then P.AI_mode="9S"end
|
||||
if P.AI_mode=="CC"then
|
||||
P.RS=AIRS
|
||||
local opt,wei=BOT.getConf()
|
||||
BOT.setHold(opt,P.AIdata.hold)
|
||||
BOT.set20G(opt,P.AIdata._20G)
|
||||
BOT.setBag(opt,P.AIdata.bag7)
|
||||
BOT.setNode(opt,P.AIdata.node)
|
||||
P.AI_bot=BOT.new(opt,wei)
|
||||
BOT.free(opt)BOT.free(wei)
|
||||
for i=1,AIdata.next do
|
||||
BOT.addNext(P.AI_bot,CCblockID[P.next[i].id])
|
||||
end
|
||||
elseif P.AI_mode=="9S"then
|
||||
P.RS=TRS
|
||||
P.AI_keys={}
|
||||
P.AI_Delay=min(int(P.gameEnv.drop*.8),2*AIdata.delta)
|
||||
P.AI_Delay0=AIdata.delta
|
||||
end
|
||||
else
|
||||
P.human=true
|
||||
P.RS=TRS
|
||||
human=human+1
|
||||
end
|
||||
|
||||
P.showTime=visible_opt[P.gameEnv.visible]
|
||||
P.keepVisible=P.gameEnv.visible=="show"
|
||||
P.keyPressing={}for i=1,12 do P.keyPressing[i]=false end
|
||||
@@ -527,7 +577,7 @@ local function createBeam(S,R,send,time,target,color,clear,spin,mini,combo)
|
||||
local radius,corner
|
||||
local a,r,g,b=1,unpack(blockColor[color])
|
||||
if clear>10 then
|
||||
radius=30+3*(send-target)
|
||||
radius=10+3*send+100/(target+4)
|
||||
local t=clear%10
|
||||
if t==1 then
|
||||
corner=3
|
||||
@@ -562,11 +612,9 @@ local function createBeam(S,R,send,time,target,color,clear,spin,mini,combo)
|
||||
g=1-g*.3
|
||||
b=1-b*.3
|
||||
end
|
||||
if modeEnv.royaleMode then
|
||||
if S.ai and R.ai then
|
||||
radius=radius*.3
|
||||
a=.35
|
||||
end
|
||||
if modeEnv.royaleMode and not(S.human or R.human)then
|
||||
radius=radius*.4
|
||||
a=.35
|
||||
end
|
||||
FX.attack[#FX.attack+1]={
|
||||
x1=x1,y1=y1,
|
||||
@@ -583,11 +631,10 @@ local function garbageSend(S,R,send,time,...)
|
||||
R.lastRecv=S
|
||||
if R.atkBuffer.sum<20 then
|
||||
local B=R.atkBuffer
|
||||
send=min(send,20-B.sum)
|
||||
B.sum=B.sum+send
|
||||
if B.sum+send>20 then send=20-B.sum end--no more then 20
|
||||
local m,k=#B,1
|
||||
while k<=m and time>B[k].countdown do k=k+1 end
|
||||
for i=k,m do
|
||||
for i=m,k,-1 do
|
||||
B[i+1]=B[i]
|
||||
end
|
||||
B[k]={
|
||||
@@ -599,6 +646,7 @@ local function garbageSend(S,R,send,time,...)
|
||||
sent=false,
|
||||
lv=min(int(send^.69),5),
|
||||
}--Sorted insert
|
||||
B.sum=B.sum+send
|
||||
R.stat.recv=R.stat.recv+send
|
||||
if R.human then
|
||||
SFX(send<4 and "blip_1"or"blip_2",min(send+1,5)*.1)
|
||||
@@ -606,15 +654,23 @@ local function garbageSend(S,R,send,time,...)
|
||||
end
|
||||
end
|
||||
local function garbageRelease()
|
||||
for i=1,#P.atkBuffer do
|
||||
local A=P.atkBuffer[i]
|
||||
if not A.sent and A.countdown<=0 then
|
||||
local flag
|
||||
while true do
|
||||
local A=P.atkBuffer[1]
|
||||
if A and A.countdown<=0 and not A.sent then
|
||||
garbageRise(8+A.lv,A.amount,A.pos)
|
||||
P.atkBuffer.sum=P.atkBuffer.sum-A.amount
|
||||
A.sent,A.time=true,0
|
||||
P.stat.pend=P.stat.pend+A.amount
|
||||
for i=1,#P.atkBuffer do
|
||||
P.atkBuffer[i]=P.atkBuffer[i+1]
|
||||
end
|
||||
flag=true
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
if flag and P.AI_mode=="CC"then CC_updateField(P)end
|
||||
end
|
||||
function garbageRise(color,amount,pos)
|
||||
local t=P.showTime*2
|
||||
@@ -648,20 +704,24 @@ local function ckfull(i)
|
||||
end
|
||||
local function checkrow(start,height)--(cy,r)
|
||||
local c=0
|
||||
for i=start,start+height-1 do
|
||||
if ckfull(i)then
|
||||
ins(P.clearing,1,i)
|
||||
local h=start
|
||||
for i=1,height do
|
||||
if ckfull(h)then
|
||||
ins(P.clearing,h)
|
||||
removeRow(P.field,h)
|
||||
removeRow(P.visTime,h)
|
||||
c=c+1
|
||||
if not P.small then
|
||||
local S=PTC.dust[P.id]
|
||||
for k=1,100 do
|
||||
S:setPosition(rnd(300),600-30*i+rnd(30))
|
||||
S:setPosition(rnd(300),600-30*h+rnd(30))
|
||||
S:emit(3)
|
||||
end
|
||||
end
|
||||
else
|
||||
h=h+1
|
||||
end
|
||||
end
|
||||
if c>0 then P.falling=P.gameEnv.fall end
|
||||
return c
|
||||
end
|
||||
local function solid(x,y)
|
||||
@@ -714,7 +774,9 @@ end
|
||||
local function spin(d,ifpre)
|
||||
local idir=(P.dir+d)%4
|
||||
if P.cur.id==6 then
|
||||
freshLockDelay()
|
||||
if P.gameEnv.easyFresh then
|
||||
freshLockDelay()
|
||||
end
|
||||
if P.human then
|
||||
SFX(ifpre and"prerotate"or"rotate")
|
||||
end
|
||||
@@ -765,7 +827,7 @@ local function spin(d,ifpre)
|
||||
local ir,ic=#icb,#icb[1]
|
||||
local ix,iy=P.curX+P.sc[2]-isc[2],P.curY+P.sc[1]-isc[1]
|
||||
local t--succssful test
|
||||
local iki=TRS[P.cur.id][P.dir*10+idir]
|
||||
local iki=P.RS[P.cur.id][P.dir*10+idir]
|
||||
for i=1,P.freshTime<=1.2*P.gameEnv.freshLimit and #iki or 1 do
|
||||
if not ifoverlap(icb,ix+iki[i][1],iy+iki[i][2])then
|
||||
ix,iy=ix+iki[i][1],iy+iki[i][2]
|
||||
@@ -778,12 +840,13 @@ local function spin(d,ifpre)
|
||||
if P.human and setting.fxs>0 then
|
||||
createShade(P.curX,P.curY+P.r-1,P.curX+P.c-1,P.curY)
|
||||
end
|
||||
local y0=P.curY
|
||||
P.curX,P.curY,P.dir=ix,iy,idir
|
||||
P.sc,P.cur.bk=scs[P.cur.id][idir],icb
|
||||
P.r,P.c=ir,ic
|
||||
P.spinLast=t==2 and d==2 and 0 or 1
|
||||
freshgho()
|
||||
freshLockDelay()
|
||||
if not ifpre then freshgho()end
|
||||
if P.gameEnv.easyFresh or y0>P.curY then freshLockDelay()end
|
||||
if P.human then
|
||||
SFX(ifpre and"prerotate"or ifoverlap(P.cur.bk,P.curX,P.curY+1)and ifoverlap(P.cur.bk,P.curX-1,P.curY)and ifoverlap(P.cur.bk,P.curX+1,P.curY)and"rotatekick"or"rotate")
|
||||
end
|
||||
@@ -797,15 +860,17 @@ local function hold(ifpre)
|
||||
if P.cur.id==0 then
|
||||
P.cur=rem(P.next,1)
|
||||
P.freshNext()
|
||||
if P.AI_mode=="CC"then BOT.addNext(P.AI_bot,CCblockID[P.next[P.AIdata.next].id])end
|
||||
end
|
||||
P.sc,P.dir=scs[P.cur.id][0],0
|
||||
P.r,P.c=#P.cur.bk,#P.cur.bk[1]
|
||||
P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2)
|
||||
|
||||
if abs(P.moving)-P.gameEnv.das>1 and not ifoverlap(P.cur.bk,P.curX+(P.moving>0 and 1 or -1),P.curY)then
|
||||
if abs(P.moving)>P.gameEnv.das and not ifoverlap(P.cur.bk,P.curX+(P.moving>0 and 1 or -1),P.curY)then
|
||||
P.curX=P.curX+(P.moving>0 and 1 or -1)
|
||||
end
|
||||
|
||||
--IMS
|
||||
|
||||
freshgho()
|
||||
P.dropDelay,P.lockDelay,P.freshTime=P.gameEnv.drop,P.gameEnv.lock,max(P.freshTime-5,0)
|
||||
if ifoverlap(P.cur.bk,P.curX,P.curY)then lock()Event.lose()end
|
||||
@@ -820,6 +885,7 @@ function resetblock()
|
||||
P.holded,P.spinLast=false,false
|
||||
P.cur=rem(P.next,1)
|
||||
P.freshNext()
|
||||
if P.AI_mode=="CC"then BOT.addNext(P.AI_bot,CCblockID[P.next[P.AIdata.next].id])end
|
||||
P.sc,P.dir=scs[P.cur.id][0],0--spin center/direction
|
||||
P.r,P.c=#P.cur.bk,#P.cur.bk[1]--row/column
|
||||
P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2)
|
||||
@@ -829,55 +895,56 @@ function resetblock()
|
||||
if P.keyPressing[3]then spin(1,true)end
|
||||
if P.keyPressing[4]then spin(-1,true)end
|
||||
if P.keyPressing[5]then spin(2,true)end
|
||||
if abs(P.moving)-P.gameEnv.das>1 and not ifoverlap(P.cur.bk,P.curX+(P.moving>0 and 1 or -1),P.curY)then
|
||||
if abs(P.moving)>P.gameEnv.das and not ifoverlap(P.cur.bk,P.curX+(P.moving>0 and 1 or -1),P.curY)then
|
||||
P.curX=P.curX+(P.moving>0 and 1 or -1)
|
||||
end--Initial SYSs
|
||||
|
||||
end
|
||||
--Initial SYSs
|
||||
if ifoverlap(P.cur.bk,P.curX,P.curY)then lock()Event.lose()end
|
||||
freshgho()
|
||||
freshgho()
|
||||
if P.keyPressing[6]then act.hardDrop()P.keyPressing[6]=false end
|
||||
end
|
||||
function drop()
|
||||
if P.curY==P.y_img then
|
||||
P.dropTime[11]=ins(P.dropTime,1,frame)--update speed dial
|
||||
P.waiting=P.gameEnv.wait
|
||||
local dospin=0
|
||||
if P.spinLast then
|
||||
if P.cur.id<6 then
|
||||
local x,y=P.curX+P.sc[2]-1,P.curY+P.sc[1]-1
|
||||
local c=0
|
||||
if solid(x-1,y+1)then c=c+1 end
|
||||
if solid(x+1,y+1)then c=c+1 end
|
||||
if c==0 then goto NTC end
|
||||
if solid(x-1,y-1)then c=c+1 end
|
||||
if solid(x+1,y-1)then c=c+1 end
|
||||
if c>2 then dospin=dospin+1 end
|
||||
end--Three point
|
||||
::NTC::
|
||||
if P.cur.id~=6 and ifoverlap(P.cur.bk,P.curX-1,P.curY)and ifoverlap(P.cur.bk,P.curX+1,P.curY)and ifoverlap(P.cur.bk,P.curX,P.curY+1)then
|
||||
dospin=dospin+2
|
||||
end--Immobile
|
||||
end
|
||||
lock()
|
||||
local cc,send,exblock=checkrow(P.curY,P.r),0,0--Currect clear&send&sendTime
|
||||
local cscore,sendTime=0,0
|
||||
local mini
|
||||
if P.spinLast and cc>0 and dospin>0 then
|
||||
dospin=dospin+P.spinLast
|
||||
end
|
||||
if not P.spinLast then
|
||||
P.dropTime[11]=ins(P.dropTime,1,frame)--update speed dial
|
||||
P.waiting=P.gameEnv.wait
|
||||
local dospin=0
|
||||
if P.spinLast then
|
||||
if P.cur.id<6 then
|
||||
local x,y=P.curX+P.sc[2]-1,P.curY+P.sc[1]-1
|
||||
local c=0
|
||||
if solid(x-1,y+1)then c=c+1 end
|
||||
if solid(x+1,y+1)then c=c+1 end
|
||||
if c==0 then goto NTC end
|
||||
if solid(x-1,y-1)then c=c+1 end
|
||||
if solid(x+1,y-1)then c=c+1 end
|
||||
if c>2 then dospin=dospin+1 end
|
||||
end--Three point
|
||||
::NTC::
|
||||
if P.cur.id~=6 and ifoverlap(P.cur.bk,P.curX-1,P.curY)and ifoverlap(P.cur.bk,P.curX+1,P.curY)and ifoverlap(P.cur.bk,P.curX,P.curY+1)then
|
||||
dospin=dospin+2
|
||||
end--Immobile
|
||||
end
|
||||
lock()
|
||||
local cc,send,exblock=checkrow(P.curY,P.r),0,0--Currect clear&send&sendTime
|
||||
if cc>0 then P.falling=P.gameEnv.fall end
|
||||
local cscore,sendTime=0,0
|
||||
local mini
|
||||
if P.spinLast and cc>0 and dospin>0 then
|
||||
dospin=dospin+P.spinLast
|
||||
end
|
||||
if not P.spinLast then
|
||||
dospin=false
|
||||
elseif cc==0 then
|
||||
if dospin==0 then
|
||||
dospin=false
|
||||
elseif cc==0 then
|
||||
if dospin==0 then
|
||||
dospin=false
|
||||
end
|
||||
elseif dospin<2 then
|
||||
dospin=false
|
||||
elseif dospin==2 then
|
||||
mini=P.cur.id<6 and cc<3 and cc<P.r
|
||||
end
|
||||
|
||||
P.combo=P.combo+1--combo=0 is under
|
||||
elseif dospin<2 then
|
||||
dospin=false
|
||||
elseif dospin==2 then
|
||||
mini=P.cur.id<6 and cc<3 and cc<P.r
|
||||
end
|
||||
|
||||
if cc>0 then
|
||||
P.combo=P.combo+1
|
||||
if cc==4 then
|
||||
cscore=1000
|
||||
if P.b2b>1000 then
|
||||
@@ -955,7 +1022,7 @@ function drop()
|
||||
VOICE(blockName[P.cur.name])
|
||||
VOICE("spin_")
|
||||
end
|
||||
elseif #P.clearing<#P.field then
|
||||
elseif #P.field>0 then
|
||||
P.b2b=max(P.b2b-250,0)
|
||||
showText(P,text.clear[cc],"appear",32+cc*3,-30,(8-cc)*.3)
|
||||
send=cc-1
|
||||
@@ -967,23 +1034,9 @@ function drop()
|
||||
if P.human then
|
||||
VOICE(clearName[cc])
|
||||
end
|
||||
else
|
||||
P.combo=0
|
||||
if dospin then
|
||||
showText(P,text.spin[P.cur.name],"appear",50,-30)
|
||||
P.b2b=P.b2b+20
|
||||
P.stat.spin_0=P.stat.spin_0+1
|
||||
if P.human then
|
||||
SFX("spin_0")
|
||||
VOICE(blockName[P.cur.name])
|
||||
VOICE("spin")
|
||||
end
|
||||
cscore=cscore+20
|
||||
end
|
||||
cscore=cscore+5
|
||||
end
|
||||
send=send+(renATK[P.combo]or 4)
|
||||
if #P.clearing==#P.field then
|
||||
send=send+(renATK[P.combo]or 3)
|
||||
if #P.field==0 then
|
||||
showText(P,text.PC,"flicker",70,-80)
|
||||
send=min(send,4)+min(6+P.stat.pc,10)
|
||||
exblock=exblock+2
|
||||
@@ -1005,29 +1058,29 @@ function drop()
|
||||
showText(P,text.cmb[min(P.combo,20)],P.combo<10 and"appear"or"flicker",20+min(P.combo,25)*3,60)
|
||||
cscore=cscore+min(20*P.combo,300)*cc
|
||||
end
|
||||
sendTime=sendTime+20*P.combo
|
||||
if P.human and cc>0 then
|
||||
sendTime=sendTime+25*P.combo
|
||||
if P.human then
|
||||
SFX(clear_n[cc])
|
||||
SFX(ren_n[min(P.combo,11)])
|
||||
if P.combo>14 then SFX("ren_mega",(P.combo-10)*.1)end
|
||||
VIB(cc)
|
||||
VIB(cc+1)
|
||||
end
|
||||
if P.b2b>1200 then P.b2b=1200 end
|
||||
|
||||
if cc>0 and modeEnv.royaleMode then
|
||||
if modeEnv.royaleMode then
|
||||
local i=min(#P.atker,9)
|
||||
if i>1 then
|
||||
send=send+reAtk[i]
|
||||
exblock=exblock+reDef[i]
|
||||
end
|
||||
end
|
||||
end--Counter attack
|
||||
|
||||
if send>0 then
|
||||
P.stat.atk=P.stat.atk+send
|
||||
--ATK statistics
|
||||
if exblock then exblock=int(exblock*(1+P.strength*.25))end
|
||||
send=send*(1+P.strength*.25)
|
||||
if mini then send=send end
|
||||
if mini then send=send*.8 end
|
||||
send=int(send)
|
||||
--Badge Buff
|
||||
if send==0 then goto L end
|
||||
@@ -1048,10 +1101,11 @@ function drop()
|
||||
send=send-A.amount
|
||||
P.atkBuffer.sum=P.atkBuffer.sum-A.amount
|
||||
A.sent,A.time=true,0
|
||||
goto R
|
||||
if send>0 then goto R end
|
||||
else
|
||||
A.amount=A.amount-send
|
||||
P.atkBuffer.sum=P.atkBuffer.sum-send
|
||||
send=0
|
||||
end
|
||||
end
|
||||
::E::
|
||||
@@ -1081,59 +1135,39 @@ function drop()
|
||||
P.stat.send=P.stat.send+send
|
||||
if P.human and send>3 then SFX("emit",min(send,8)*.125)end
|
||||
end
|
||||
elseif cc==0 then
|
||||
if P.b2b>1000 then
|
||||
P.b2b=max(P.b2b-40,1000)
|
||||
end
|
||||
garbageRelease()
|
||||
end
|
||||
P.stat.score=P.stat.score+cscore
|
||||
P.spinLast=dospin and cc>0
|
||||
P.stat.piece,P.stat.row=P.stat.piece+1,P.stat.row+cc
|
||||
if P.stat.row>=P.gameEnv.target then
|
||||
P.gameEnv.reach()
|
||||
end
|
||||
if P.human then
|
||||
SFX("lock")
|
||||
end
|
||||
else
|
||||
P.curY=P.curY-1
|
||||
P.spinLast=false
|
||||
P.combo=0
|
||||
if dospin then
|
||||
showText(P,text.spin[P.cur.name],"appear",50,-30)
|
||||
P.b2b=P.b2b+20
|
||||
P.stat.spin_0=P.stat.spin_0+1
|
||||
if P.human then
|
||||
SFX("spin_0")
|
||||
VOICE(blockName[P.cur.name])
|
||||
VOICE("spin")
|
||||
end
|
||||
cscore=cscore+30
|
||||
end
|
||||
cscore=cscore+10
|
||||
if P.b2b>1000 then
|
||||
P.b2b=max(P.b2b-40,1000)
|
||||
end
|
||||
garbageRelease()
|
||||
end
|
||||
P.stat.score=P.stat.score+cscore
|
||||
P.stat.piece,P.stat.row=P.stat.piece+1,P.stat.row+cc
|
||||
P.gameEnv.dropPiece()
|
||||
if P.human then SFX("lock")end
|
||||
end
|
||||
function pressKey(i,p)
|
||||
P=p
|
||||
P.keyPressing[i]=true
|
||||
P=p;P.keyPressing[i]=true
|
||||
if P.human then
|
||||
virtualkeyDown[i]=true
|
||||
virtualkeyPressTime[i]=10
|
||||
end
|
||||
if i==10 then
|
||||
act.restart()
|
||||
elseif P.alive then
|
||||
if P.control and P.waiting==-1 then
|
||||
act[actName[i]]()
|
||||
if i>2 and i<7 then P.keyPressing[i]=false end
|
||||
elseif i==9 and not setting.swap then
|
||||
P.atkMode=P.atkMode<3 and P.atkMode+2 or 5-P.atkMode
|
||||
elseif P.keyPressing[9]and setting.swap then
|
||||
if i==1 then
|
||||
P.atkMode=1
|
||||
changeAtk(P,randomTarget(P))
|
||||
elseif i==2 then
|
||||
P.atkMode=2
|
||||
elseif i==6 then
|
||||
P.atkMode=3
|
||||
elseif i==7 then
|
||||
P.atkMode=4
|
||||
end
|
||||
else
|
||||
if i==1 then
|
||||
P.moving=-1
|
||||
elseif i==2 then
|
||||
P.moving=1
|
||||
end
|
||||
end
|
||||
if P.alive then
|
||||
act[actName[i]]()
|
||||
P.keyTime[11]=ins(P.keyTime,1,frame)
|
||||
P.stat.key=P.stat.key+1
|
||||
end
|
||||
@@ -1146,65 +1180,94 @@ function releaseKey(i,p)
|
||||
end
|
||||
act={
|
||||
moveLeft=function(auto)
|
||||
if P.keyPressing[9]and setting.swap then
|
||||
changeAtkMode(1)
|
||||
else
|
||||
if not auto then
|
||||
P.moving=-1
|
||||
if P.keyPressing[9]then
|
||||
if setting.swap then
|
||||
changeAtkMode(1)
|
||||
end
|
||||
elseif P.control and P.waiting==-1 then
|
||||
if not ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
||||
P.curX=P.curX-1
|
||||
local y0=P.curY
|
||||
freshgho()
|
||||
freshLockDelay()
|
||||
if P.gameEnv.easyFresh or y0~=P.curY then freshLockDelay()end
|
||||
if P.human and P.curY==P.y_img then SFX("move")end
|
||||
P.spinLast=false
|
||||
if not auto then P.moving=-1 end
|
||||
else
|
||||
P.moving=-P.gameEnv.das-1
|
||||
end
|
||||
else
|
||||
P.moving=-1
|
||||
end
|
||||
end,
|
||||
moveRight=function(auto)
|
||||
if P.keyPressing[9]and setting.swap then
|
||||
changeAtkMode(2)
|
||||
else
|
||||
if not auto then
|
||||
P.moving=1
|
||||
if P.keyPressing[9]then
|
||||
if setting.swap then
|
||||
changeAtkMode(2)
|
||||
end
|
||||
elseif P.control and P.waiting==-1 then
|
||||
if not ifoverlap(P.cur.bk,P.curX+1,P.curY)then
|
||||
P.curX=P.curX+1
|
||||
local y0=P.curY
|
||||
freshgho()
|
||||
freshLockDelay()
|
||||
if P.gameEnv.easyFresh or y0~=P.curY then freshLockDelay()end
|
||||
if P.human and P.curY==P.y_img then SFX("move")end
|
||||
P.spinLast=false
|
||||
if not auto then P.moving=1 end
|
||||
else
|
||||
P.moving=P.gameEnv.das+1
|
||||
end
|
||||
else
|
||||
P.moving=1
|
||||
end
|
||||
end,
|
||||
rotRight=function()
|
||||
if P.control and P.waiting==-1 then
|
||||
spin(1)
|
||||
P.keyPressing[3]=false
|
||||
end
|
||||
end,
|
||||
rotLeft=function()
|
||||
if P.control and P.waiting==-1 then
|
||||
spin(-1)
|
||||
P.keyPressing[4]=false
|
||||
end
|
||||
end,
|
||||
rotFlip=function()
|
||||
if P.control and P.waiting==-1 then
|
||||
spin(2)
|
||||
P.keyPressing[5]=false
|
||||
end
|
||||
end,
|
||||
rotRight=function()spin(1)end,
|
||||
rotLeft=function()spin(-1)end,
|
||||
rotFlip=function()spin(2)end,
|
||||
hardDrop=function()
|
||||
if P.keyPressing[9]and setting.swap then
|
||||
changeAtkMode(3)
|
||||
else
|
||||
if P.waiting==-1 then
|
||||
if P.curY~=P.y_img then
|
||||
if P.human and setting.fxs>0 then
|
||||
createShade(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1)
|
||||
P.fieldOffY=2*setting.fxs+1
|
||||
end
|
||||
P.curY=P.y_img
|
||||
P.spinLast=false
|
||||
if P.human then
|
||||
SFX("drop")
|
||||
VIB(0)
|
||||
end
|
||||
end
|
||||
P.lockDelay=-1
|
||||
drop()
|
||||
if P.keyPressing[9]then
|
||||
if setting.swap then
|
||||
changeAtkMode(3)
|
||||
end
|
||||
P.keyPressing[6]=false
|
||||
elseif P.control and P.waiting==-1 then
|
||||
if P.curY~=P.y_img then
|
||||
if P.human and setting.fxs>0 then
|
||||
createShade(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1)
|
||||
P.fieldOffY=2*setting.fxs+1
|
||||
end
|
||||
P.curY=P.y_img
|
||||
P.spinLast=false
|
||||
if P.human then
|
||||
SFX("drop")
|
||||
VIB(1)
|
||||
end
|
||||
end
|
||||
P.lockDelay=-1
|
||||
drop()
|
||||
P.keyPressing[6]=false
|
||||
end
|
||||
end,
|
||||
softDrop=function()
|
||||
if P.keyPressing[9]and setting.swap then
|
||||
changeAtkMode(4)
|
||||
if P.keyPressing[9]then
|
||||
if setting.swap then
|
||||
changeAtkMode(4)
|
||||
end
|
||||
else
|
||||
if P.curY~=P.y_img then
|
||||
P.curY=P.curY-1
|
||||
@@ -1213,33 +1276,21 @@ act={
|
||||
P.downing=1
|
||||
end
|
||||
end,
|
||||
hold=function()hold()end,
|
||||
func=function()
|
||||
if P.gameEnv.Fkey then
|
||||
if modeEnv.royaleMode then
|
||||
for i=1,#P.keyPressing do
|
||||
if P.keyPressing[i]then
|
||||
P.keyPressing[i]=false
|
||||
end
|
||||
end
|
||||
if setting.swap then
|
||||
P.keyPressing[9]=true
|
||||
else
|
||||
changeAtkMode(P.atkMode<3 and P.atkMode+2 or 5-P.atkMode)
|
||||
P.swappingAtkMode=30
|
||||
end
|
||||
end
|
||||
if P.gameEnv.puzzle then
|
||||
P.modeData.event=1-P.modeData.event
|
||||
end
|
||||
hold=function()
|
||||
if P.control and P.waiting==-1 then
|
||||
hold()
|
||||
end
|
||||
end,
|
||||
func=function()
|
||||
P.gameEnv.Fkey()
|
||||
end,
|
||||
restart=function()
|
||||
if frame<180 then
|
||||
clearTask("play")
|
||||
resetPartGameData()
|
||||
end
|
||||
end,
|
||||
|
||||
insDown=function()
|
||||
if P.curY~=P.y_img then
|
||||
if P.human and setting.fxs>0 then
|
||||
@@ -1252,7 +1303,7 @@ act={
|
||||
end
|
||||
end,
|
||||
insLeft=function()
|
||||
local x0=P.curX
|
||||
local x0,y0=P.curX,P.curY
|
||||
::L::if not ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
||||
P.curX=P.curX-1
|
||||
if P.human and setting.fxs>0 then
|
||||
@@ -1265,11 +1316,11 @@ act={
|
||||
if P.human and setting.fxs>0 then
|
||||
P.fieldOffX=-2*setting.fxs
|
||||
end
|
||||
freshLockDelay()
|
||||
if P.gameEnv.easyFresh or y0~=P.curY then freshLockDelay()end
|
||||
end
|
||||
end,
|
||||
insRight=function()
|
||||
local x0=P.curX
|
||||
local x0,y0=P.curX,P.curY
|
||||
::L::if not ifoverlap(P.cur.bk,P.curX+1,P.curY)then
|
||||
P.curX=P.curX+1
|
||||
if P.human and setting.fxs>0 then
|
||||
@@ -1282,7 +1333,7 @@ act={
|
||||
if P.human and setting.fxs>0 then
|
||||
P.fieldOffX=2*setting.fxs
|
||||
end
|
||||
freshLockDelay()
|
||||
if P.gameEnv.easyFresh or y0~=P.curY then freshLockDelay()end
|
||||
end
|
||||
end,
|
||||
down1=function()
|
||||
|
||||
@@ -15,9 +15,10 @@ return{
|
||||
PC="Perfect Clear",
|
||||
hold="暂存",next="下一个",
|
||||
|
||||
stage={"关卡 1","关卡 2","关卡 3","关卡 4","关卡 5",},
|
||||
awesome="精彩。",
|
||||
continue="继续。",
|
||||
stage=function(n)return"关卡 "..n end,
|
||||
great="Great!",
|
||||
awesome="Awesome.",
|
||||
continue="Continue.",
|
||||
maxspeed="最高速度",
|
||||
speedup="速度加快",
|
||||
|
||||
@@ -44,7 +45,7 @@ return{
|
||||
bgm="背景音乐:",
|
||||
},
|
||||
customVal={
|
||||
drop={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"∞","[20G]"},
|
||||
drop={"[20G]",1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"∞"},
|
||||
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"∞"},
|
||||
wait=nil,
|
||||
fall=nil,
|
||||
@@ -54,7 +55,7 @@ return{
|
||||
visible={"可见","半隐","全隐","瞬隐"},
|
||||
target={10,20,40,100,200,500,1000,"∞"},
|
||||
freshLimit={0,8,15,"∞"},
|
||||
opponent={"无电脑",1,2,3,4,5,6,7,8,9,10,11},
|
||||
opponent={"无电脑","9S Lv1","9S Lv2","9S Lv3","9S Lv4","9S Lv5","CC Lv1","CC Lv2","CC Lv3","CC Lv4","CC Lv5","CC Lv6"},
|
||||
},
|
||||
softdropdas="软降DAS:",
|
||||
softdroparr="软降ARR:",
|
||||
@@ -68,7 +69,8 @@ return{
|
||||
actName={"左移:","右移:","顺时针旋转:","逆时针旋转:","180°旋转","硬降:","软降:","暂存:","功能键:","重新开始:","左瞬移:","右瞬移:","软降到底:"},
|
||||
modeName={
|
||||
[0]="自定义",
|
||||
"竞速","马拉松","大师","经典","禅","无尽","单挑","仅TSD","隐形","挖掘","生存","科研",
|
||||
"竞速","马拉松","大师","经典","禅","无尽","单挑","回合制","仅TSD","隐形",
|
||||
"挖掘","生存","防守","进攻","科研",
|
||||
"C4W练习","全清训练","全清挑战","49人混战","99人混战","干旱","多人",
|
||||
},
|
||||
modeInfo={
|
||||
@@ -79,10 +81,13 @@ return{
|
||||
zen="无重力消除200行",
|
||||
infinite="科研沙盒",
|
||||
solo="打败AI",
|
||||
round="下棋",
|
||||
tsd="尽可能做TSD",
|
||||
blind="最强大脑",
|
||||
dig="核能挖掘机",
|
||||
survivor="防守练习",
|
||||
survivor="你能存活多久?",
|
||||
defender="防守练习",
|
||||
attacker="进攻练习",
|
||||
tech="尽可能不要普通消除",
|
||||
c4wtrain="无 限 连 击",
|
||||
pctrain="熟悉全清定式的组合",
|
||||
@@ -147,8 +152,8 @@ return{
|
||||
"使用LOVE2D引擎",
|
||||
"作者:MrZ 邮箱:1046101471@qq.com",
|
||||
"程序:MrZ 美术:MrZ 音乐:MrZ 音效:MrZ 语音:Miya",
|
||||
"使用工具:VScode,GFIE,Beepbox,Goldwave",
|
||||
"特别感谢:Farter,196,Teatube,Flyz,T830,[所有测试人员]和 你!",
|
||||
"使用工具:VScode,GFIE,Beepbox,Goldwave,Cold_Clear",
|
||||
"特别感谢:Farter,Flyz,196,Teatube,T830,[所有测试人员]和 你!",
|
||||
"错误或者建议请附带相关信息发送到作者邮箱~",
|
||||
},
|
||||
support="支持作者",
|
||||
@@ -217,6 +222,7 @@ return{
|
||||
},
|
||||
pause={
|
||||
resume="继续",
|
||||
restart="重新开始",
|
||||
quit="退出",
|
||||
},
|
||||
setting={
|
||||
@@ -224,7 +230,7 @@ return{
|
||||
center=function()return"旋转中心:"..SWC[setting.center]end,
|
||||
grid=function()return"网格:"..SWC[setting.grid]end,
|
||||
swap=function()return setting.swap and"目标选择:组合键"or"目标选择:循环"end,
|
||||
fxs=function()return setting.fxs>0 and"特效等级:"..setting.fxs or"特效 关"end,
|
||||
fxs=function()return setting.fxs>0 and"特效等级:"..setting.fxs or"特效:关"end,
|
||||
bg=function()return"背景:"..SWC[setting.bg]end,
|
||||
dasD="-",dasU="+",
|
||||
arrD="-",arrU="+",
|
||||
@@ -248,13 +254,13 @@ return{
|
||||
back=BK,
|
||||
},
|
||||
setting3={
|
||||
back=BK,
|
||||
hide=function()return setting.virtualkeySwitch and"隐藏虚拟按键"or"显示虚拟按键"end,
|
||||
default="默认组合",
|
||||
snap=function()return text.snapLevelName[snapLevel]end,
|
||||
alpha=function()return setting.virtualkeyAlpha.."0%"end,
|
||||
icon="图标",
|
||||
size="大小",
|
||||
back=BK,
|
||||
},
|
||||
help={
|
||||
his="历史",
|
||||
|
||||
@@ -15,7 +15,8 @@ return{
|
||||
PC="场地全清",
|
||||
hold="暂存",next="下一个",
|
||||
|
||||
stage={"关卡 1","关卡 2","关卡 3","关卡 4","关卡 5",},
|
||||
stage=function(n)return"关卡 "..n end,
|
||||
great="不错!",
|
||||
awesome="精彩。",
|
||||
continue="继续。",
|
||||
maxspeed="最高速度",
|
||||
@@ -44,7 +45,7 @@ return{
|
||||
bgm="背景音乐:",
|
||||
},
|
||||
customVal={
|
||||
drop={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"∞","[20G]"},
|
||||
drop={"[20G]",1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"∞"},
|
||||
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"∞"},
|
||||
wait=nil,
|
||||
fall=nil,
|
||||
@@ -54,7 +55,7 @@ return{
|
||||
visible={"可见","半隐","全隐","瞬隐"},
|
||||
target={10,20,40,100,200,500,1000,"∞"},
|
||||
freshLimit={0,8,15,"∞"},
|
||||
opponent={"无电脑",1,2,3,4,5,6,7,8,9,10,11},
|
||||
opponent={"无电脑","9S Lv1","9S Lv2","9S Lv3","9S Lv4","9S Lv5","CC Lv1","CC Lv2","CC Lv3","CC Lv4","CC Lv5","CC Lv6"},
|
||||
},
|
||||
softdropdas="软降DAS:",
|
||||
softdroparr="软降ARR:",
|
||||
@@ -68,7 +69,8 @@ return{
|
||||
actName={"左移:","右移:","顺时针旋转:","逆时针旋转:","180°旋转","硬降:","软降:","暂存:","功能键:","重新开始:","左瞬移:","右瞬移:","软降到底:"},
|
||||
modeName={
|
||||
[0]="自定义",
|
||||
"竞速","马拉松","大师","经典","禅","无尽","单挑","仅TSD","隐形","挖掘","生存","科研",
|
||||
"竞速","马拉松","大师","经典","禅","无尽","单挑","回合制","仅TSD","隐形",
|
||||
"挖掘","生存","防守","进攻","科研",
|
||||
"C4W练习","全清训练","全清挑战","49人混战","99人混战","干旱","多人",
|
||||
},
|
||||
modeInfo={
|
||||
@@ -79,10 +81,13 @@ return{
|
||||
zen="无重力消除200行",
|
||||
infinite="科研沙盒",
|
||||
solo="打败AI",
|
||||
round="下棋",
|
||||
tsd="尽可能做T旋双清",
|
||||
blind="最强大脑",
|
||||
dig="核能挖掘机",
|
||||
survivor="防守练习",
|
||||
survivor="你能存活多久?",
|
||||
defender="防守练习",
|
||||
attacker="进攻练习",
|
||||
tech="尽可能不要普通消除!",
|
||||
c4wtrain="无 限 连 击",
|
||||
pctrain="熟悉全清定式的组合",
|
||||
@@ -147,8 +152,8 @@ return{
|
||||
"使用LOVE2D引擎",
|
||||
"作者:MrZ 邮箱:1046101471@qq.com",
|
||||
"程序:MrZ 美术:MrZ 音乐:MrZ 音效:MrZ 语音:Miya",
|
||||
"使用工具:VScode,GFIE,Beepbox,Goldwave",
|
||||
"特别感谢:Farter,Teatube,196,Flyz,T830,[所有测试人员]和 你!",
|
||||
"使用工具:VScode,GFIE,Beepbox,Goldwave,Cold_Clear",
|
||||
"特别感谢:Farter,Flyz,196,Teatube,T830,[所有测试人员]和 你!",
|
||||
"错误或者建议请附带相关信息发送到作者邮箱~",
|
||||
},
|
||||
support="支持作者",
|
||||
@@ -217,6 +222,7 @@ return{
|
||||
},
|
||||
pause={
|
||||
resume="继续",
|
||||
restart="重新开始",
|
||||
quit="退出",
|
||||
},
|
||||
setting={
|
||||
@@ -224,7 +230,7 @@ return{
|
||||
center=function()return"旋转中心:"..SWC[setting.center]end,
|
||||
grid=function()return"网格:"..SWC[setting.grid]end,
|
||||
swap=function()return setting.swap and"目标选择:组合键"or"目标选择:循环"end,
|
||||
fxs=function()return setting.fxs>0 and"特效等级:"..setting.fxs or"特效 关"end,
|
||||
fxs=function()return setting.fxs>0 and"特效等级:"..setting.fxs or"特效:关"end,
|
||||
bg=function()return"背景:"..SWC[setting.bg]end,
|
||||
dasD="-",dasU="+",
|
||||
arrD="-",arrU="+",
|
||||
@@ -248,13 +254,13 @@ return{
|
||||
back=BK,
|
||||
},
|
||||
setting3={
|
||||
back=BK,
|
||||
hide=function()return setting.virtualkeySwitch and"隐藏虚拟按键"or"显示虚拟按键"end,
|
||||
default="默认组合",
|
||||
snap=function()return text.snapLevelName[snapLevel]end,
|
||||
alpha=function()return setting.virtualkeyAlpha.."0%"end,
|
||||
icon="图标",
|
||||
size="大小",
|
||||
back=BK,
|
||||
},
|
||||
help={
|
||||
his="历史",
|
||||
|
||||
@@ -15,7 +15,8 @@ return{
|
||||
PC="Perfect Clear",
|
||||
hold="Hold",next="Next",
|
||||
|
||||
stage={"STAGE 1","STAGE 2","STAGE 3","STAGE 4","STAGE 5",},
|
||||
stage=function(n)return"STAGE "..n end,
|
||||
great="Great!",
|
||||
awesome="Awesome.",
|
||||
continue="Continue.",
|
||||
maxspeed="Max speed",
|
||||
@@ -26,7 +27,7 @@ return{
|
||||
pause="PAUSE",
|
||||
finish="FINISH",
|
||||
pauseTime="Pause time",
|
||||
|
||||
|
||||
custom="Custom Game",
|
||||
customOption={
|
||||
drop="Drop delay:",
|
||||
@@ -44,7 +45,7 @@ return{
|
||||
bgm="BGM:",
|
||||
},
|
||||
customVal={
|
||||
drop={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"∞","[20G]"},
|
||||
drop={"[20G]",1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"∞"},
|
||||
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"∞"},
|
||||
wait=nil,
|
||||
fall=nil,
|
||||
@@ -54,7 +55,7 @@ return{
|
||||
visible={"normal","time","invisible","sudden"},
|
||||
target={10,20,40,100,200,500,1000,"∞"},
|
||||
freshLimit={0,8,15,"∞"},
|
||||
opponent={"No CPU",1,2,3,4,5,6,7,8,9,10,11},
|
||||
opponent={"No CPU","9S Lv1","9S Lv2","9S Lv3","9S Lv4","9S Lv5","CC Lv1","CC Lv2","CC Lv3","CC Lv4","CC Lv5","CC Lv6"},
|
||||
},
|
||||
softdropdas="Down DAS:",
|
||||
softdroparr="Down ARR:",
|
||||
@@ -68,7 +69,8 @@ return{
|
||||
actName={"Move Left:","Move Right:","Rotate Right:","Rotate Left:","Rotate Flip:","Hard Drop:","Soft Drop:","Hold:","Function:","Restart:","Instant Left:","Instant Right:","Ins Down:"},
|
||||
modeName={
|
||||
[0]="Custom",
|
||||
"Sprint","Marathon","Master","Classic","Zen","Infinite","1v1","TSD-only","Blind","Dig","Survivor","Tech",
|
||||
"Sprint","Marathon","Master","Classic","Zen","Infinite","1v1","Round","TSD-only","Blind",
|
||||
"Dig","Survivor","Defender","Attacker","Tech",
|
||||
"C4W Train","PC Train","PC Challenge","Techmino49","Techmino99","Drought","Hotseat",
|
||||
},
|
||||
modeInfo={
|
||||
@@ -79,10 +81,13 @@ return{
|
||||
zen="Clear 200 Lines without gravity",
|
||||
infinite="Infinite game,infinite happiness",
|
||||
solo="Beat AI",
|
||||
round="Chess?",
|
||||
tsd="Make more T-spin-doubles",
|
||||
blind="Invisible board",
|
||||
dig="Downstack!",
|
||||
survivor="Hand them!",
|
||||
survivor="Survive Longer!",
|
||||
defender="Hand them!",
|
||||
attacker="Attacking better then defending",
|
||||
tech="Don't do normal clear",
|
||||
c4wtrain="Infinite combo",
|
||||
pctrain="Let's learn some PCs",
|
||||
@@ -147,8 +152,8 @@ return{
|
||||
"Powered by LOVE2D",
|
||||
"Author:MrZ E-mail:1046101471@qq.com",
|
||||
"Programe:MrZ Art:MrZ Music:MrZ SFX:MrZ VOICE:Miya",
|
||||
"Tool used:VScode,GFIE,Beepbox,Goldwave",
|
||||
"Special thanks:Farter,Teatube,196,Flyz,T830,[all test staff] and YOU!",
|
||||
"Tool used:VScode,GFIE,Beepbox,Goldwave,Cold_Clear",
|
||||
"Special thanks:Farter,Flyz,196,Teatube,T830,[all test staff] and YOU!",
|
||||
"Any bugs/suggestions to my E-mail.",
|
||||
},
|
||||
support="Support Author",
|
||||
@@ -217,6 +222,7 @@ return{
|
||||
},
|
||||
pause={
|
||||
resume="Resume",
|
||||
restart="Restart",
|
||||
quit="Quit",
|
||||
},
|
||||
setting={
|
||||
@@ -248,13 +254,13 @@ return{
|
||||
back=BK,
|
||||
},
|
||||
setting3={
|
||||
back=BK,
|
||||
hide=function()return setting.virtualkeySwitch and"Hide Virtual Key"or"Show Virtual Key"end,
|
||||
default="Defaults",
|
||||
snap=function()return text.snapLevelName[snapLevel]end,
|
||||
alpha=function()return setting.virtualkeyAlpha.."0%"end,
|
||||
icon="Icon",
|
||||
size="Size",
|
||||
back=BK,
|
||||
},
|
||||
help={
|
||||
his="History",
|
||||
|
||||
288
list.lua
288
list.lua
@@ -2,7 +2,7 @@ local gc=love.graphics
|
||||
local tc,kb=love.touch,love.keyboard
|
||||
local sys=love.system
|
||||
local fs=love.filesystem
|
||||
local mobile=mobile
|
||||
local mobile=system=="Android"or system=="iOS"
|
||||
|
||||
actName={"moveLeft","moveRight","rotRight","rotLeft","rotFlip","hardDrop","softDrop","hold","func","restart","insLeft","insRight","insDown"}
|
||||
color={
|
||||
@@ -79,6 +79,7 @@ bgm={
|
||||
"secret8th",
|
||||
"rockblock",
|
||||
"8-bit happiness",
|
||||
"shining terminal",
|
||||
"end",
|
||||
}
|
||||
voiceList={
|
||||
@@ -120,12 +121,13 @@ musicID={
|
||||
"push",
|
||||
"reason",
|
||||
"infinite",
|
||||
"cruelty",
|
||||
"final",
|
||||
"secret7th",
|
||||
"secret8th",
|
||||
"shining terminal",
|
||||
"rockblock",
|
||||
"8-bit happiness",
|
||||
"cruelty",
|
||||
"final",
|
||||
"end",
|
||||
}
|
||||
customID={
|
||||
@@ -139,7 +141,7 @@ customID={
|
||||
"bg","bgm",
|
||||
}
|
||||
customRange={
|
||||
drop={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99,-1},
|
||||
drop={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
|
||||
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
|
||||
wait={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
|
||||
fall={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
|
||||
@@ -149,7 +151,7 @@ customRange={
|
||||
visible={"show","time","fast","none"},
|
||||
target={10,20,40,100,200,500,1000,1e99},
|
||||
freshLimit={0,8,15,1e99},
|
||||
opponent={0,60,30,20,15,10,7,5,4,3,2,1},
|
||||
opponent={0,1,2,3,4,5,11,12,13,14,15,16},
|
||||
bg={"none","game1","game2","game3","strap","rgb","glow","matrix"},
|
||||
bgm={"blank","way","race","newera","push","reason","infinite","secret7th","secret8th","rockblock"},
|
||||
}
|
||||
@@ -160,27 +162,31 @@ up0to4={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",}
|
||||
|
||||
modeID={
|
||||
[0]="custom",
|
||||
"sprint","marathon","master","classic","zen","infinite","solo","tsd","blind","dig","survivor","tech",
|
||||
"sprint","marathon","master","classic","zen","infinite","solo","round","tsd","blind",
|
||||
"dig","survivor","defender","attacker","tech",
|
||||
"c4wtrain","pctrain","pcchallenge","techmino49","techmino99","drought","hotseat",
|
||||
}
|
||||
modeLevel={
|
||||
sprint={"10L","20L","40L","100L","400L","1000L"},
|
||||
marathon={"EASY","NORMAL","HARD"},
|
||||
master={"LUNATIC","ULTIMATE"},
|
||||
master={"LUNATIC","ULTIMATE","FINAL"},
|
||||
classic={"CTWC"},
|
||||
zen={"NORMAL"},
|
||||
infinite={"NORMAL","EXTRA"},
|
||||
solo={"EASY","NORMAL","HARD","LUNATIC"},
|
||||
solo={"EASY","EASY+","NORMAL","NORMAL+","HARD","HARD+","LUNATIC","LUNATIC+","ULTIMATE"},
|
||||
round={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"},
|
||||
tsd={"NORMAL","HARD"},
|
||||
blind={"EASY","HARD","HARD+","LUNATIC","ULTIMATE","GM"},
|
||||
dig={"NORMAL","LUNATIC"},
|
||||
survivor={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE","EXTRA"},
|
||||
defender={"NORMAL","LUNATIC"},
|
||||
attacker={"HARD","ULTIMATE"},
|
||||
tech={"NORMAL","NORMAL+","HARD","HARD+","LUNATIC","LUNATIC+",},
|
||||
c4wtrain={"NORMAL","LUNATIC"},
|
||||
pctrain={"NORMAL","EXTRA"},
|
||||
pcchallenge={"NORMAL","HARD","LUNATIC"},
|
||||
techmino49={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"},
|
||||
techmino99={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"},
|
||||
techmino49={"EASY","HARD","ULTIMATE"},
|
||||
techmino99={"EASY","HARD","ULTIMATE"},
|
||||
drought={"NORMAL","MESS"},
|
||||
hotseat={"2P","3P","4P",},
|
||||
custom={"Normal","Puzzle"},
|
||||
@@ -274,194 +280,192 @@ local function useDefaultSet(n)
|
||||
curBG=customRange.bg[customSel[12]]
|
||||
BGM(customRange.bgm[customSel[13]])
|
||||
end
|
||||
Buttons={
|
||||
Widget={
|
||||
load={},
|
||||
intro={},
|
||||
main={
|
||||
qplay= {x=160,y=300,w=150, h=150, rgb=color.lightRed, f=40,code=function()loadGame(modeSel,levelSel)end,down="stat",right="play"},
|
||||
play= {x=380,y=300,w=240, h=240, rgb=color.red, f=70,code=function()gotoScene("mode")end,down="stat",left="qplay",right="setting"},
|
||||
setting={x=640,y=300,w=240, h=240, rgb=color.lightBlue,f=55,code=function()gotoScene("setting")end,down="stat",left="play",right="music"},
|
||||
music= {x=900,y=300,w=240, h=240, rgb=color.lightCyan,f=42,code=function()gotoScene("music")end,down="help",left="setting",right="quit"},
|
||||
stat= {x=640,y=560,w=240, h=240, rgb=color.cyan, f=55,code=function()gotoScene("stat")end,up="setting",left="play",right="help"},
|
||||
help= {x=900,y=560,w=240, h=240, rgb=color.yellow, f=55,code=function()gotoScene("help")end,up="music",left="stat",right="quit"},
|
||||
quit= {x=1180,y=620,w=120,h=120, rgb=color.lightGrey,f=50,code=function()gotoScene("quit")end,up="setting",left="help"},
|
||||
qplay= newButton(160, 300,150,150,color.lightRed, 40,function()loadGame(modeSel,levelSel)end, nil, nil, "stat", nil, "play" ),
|
||||
play= newButton(380, 300,240,240,color.red, 70,function()gotoScene("mode")end, nil, nil, "stat", "qplay", "setting" ),
|
||||
setting=newButton(640, 300,240,240,color.lightBlue,55,function()gotoScene("setting")end, nil, nil, "stat", "play", "music" ),
|
||||
music= newButton(900, 300,240,240,color.lightCyan,42,function()gotoScene("music")end, nil, nil, "help", "setting", "quit" ),
|
||||
stat= newButton(640, 560,240,240,color.cyan, 55,function()gotoScene("stat")end, nil, "setting", nil, "play", "help" ),
|
||||
help= newButton(900, 560,240,240,color.yellow, 55,function()gotoScene("help")end, nil, "music", nil, "stat", "quit" ),
|
||||
quit= newButton(1180, 620,120,120,color.lightGrey,50,function()gotoScene("quit")end, nil, "music", nil, "help", nil ),
|
||||
},
|
||||
mode={
|
||||
up= {x=1000,y=210,w=200,h=140, rgb=color.white, f=80, code=function()love.keypressed("up")end, hide=function()return modeSel==1 end,},
|
||||
down= {x=1000,y=430,w=200,h=140, rgb=color.white, f=80, code=function()love.keypressed("down")end, hide=function()return modeSel==#modeID end,},
|
||||
left= {x=190, y=160,w=100,h=80, rgb=color.white, code=function()love.keypressed("left")end, hide=function()return levelSel==1 end,},
|
||||
right= {x=350, y=160,w=100,h=80, rgb=color.white, code=function()love.keypressed("right")end, hide=function()return levelSel==#modeLevel[modeID[modeSel]]end,},
|
||||
start= {x=1000,y=600,w=250,h=100, rgb=color.green, f=50, code=function()loadGame(modeSel,levelSel)end},
|
||||
custom= {x=275, y=420,w=200,h=90, rgb=color.yellow, code=function()gotoScene("custom")end},
|
||||
back= {x=640, y=630,w=230,h=90, rgb=color.white, f=45, code=back},
|
||||
up= newButton(1000, 210,200,140,color.white, 80,function()love.keypressed("up")end,function()return modeSel==1 end),
|
||||
down= newButton(1000, 430,200,140,color.white, 80,function()love.keypressed("down")end,function()return modeSel==#modeID end),
|
||||
left= newButton(190, 160,100,80, color.white, 40,function()love.keypressed("left")end,function()return levelSel==1 end),
|
||||
right= newButton(350, 160,100,80, color.white, 40,function()love.keypressed("right")end,function()return levelSel==#modeLevel[modeID[modeSel]]end),
|
||||
start= newButton(1000, 600,250,100,color.green, 50,function()loadGame(modeSel,levelSel)end),
|
||||
custom= newButton(275, 420,200,90, color.yellow, 40,function()gotoScene("custom")end),
|
||||
back= newButton(640, 630,230,90, color.white, 45,back),
|
||||
},
|
||||
music={
|
||||
bgm= {x=1100,y=80, w=160, h=80, rgb=color.white,code=function()BGM()setting.bgm=not setting.bgm end},
|
||||
up= {x=1100,y=200, w=120, h=120, rgb=color.white,f=40,hide=function()return not setting.bgm end,code=function()sel=(sel-2)%#musicID+1 end},
|
||||
play= {x=1100,y=340, w=120, h=120, rgb=color.white,f=40,hide=function()return not setting.bgm end,code=function()BGM(musicID[sel])end},
|
||||
down= {x=1100,y=480, w=120, h=120, rgb=color.white,f=50,hide=function()return not setting.bgm end,code=function()sel=sel%#musicID+1 end},
|
||||
back= {x=640, y=630, w=230, h=90, rgb=color.white,f=45,code=back},
|
||||
bgm= newButton(1100, 80, 160,80, color.white,40,function()BGM()setting.bgm=not setting.bgm end),
|
||||
up= newButton(1100, 200, 120,120,color.white,60,function()love.keypressed("up")end, function()return not setting.bgm end),
|
||||
play= newButton(1100, 340, 120,120,color.white,40,function()love.keypressed("space")end, function()return not setting.bgm end),
|
||||
down= newButton(1100, 480, 120,120,color.white,60,function()love.keypressed("down")end, function()return not setting.bgm end),
|
||||
back= newButton(640, 630, 230,90, color.white,45,back),
|
||||
},
|
||||
custom={
|
||||
up= {x=1000,y=220, w=100,h=100, rgb=color.white,f=50, code=function()sel=(sel-2)%#customID+1 end},
|
||||
down= {x=1000,y=460, w=100,h=100, rgb=color.white,f=50, code=function()sel=sel%#customID+1 end},
|
||||
left= {x=880, y=340, w=100,h=100, rgb=color.white,f=50, code=function()
|
||||
customSel[sel]=(customSel[sel]-2)%#customRange[customID[sel]]+1
|
||||
if sel==12 then
|
||||
curBG=customRange.bg[customSel[12]]
|
||||
elseif sel==13 then
|
||||
BGM(customRange.bgm[customSel[13]])
|
||||
end
|
||||
end},
|
||||
right= {x=1120,y=340, w=100,h=100, rgb=color.white,f=50, code=function()
|
||||
customSel[sel]=customSel[sel]%#customRange[customID[sel]]+1
|
||||
if sel==12 then
|
||||
curBG=customRange.bg[customSel[12]]
|
||||
elseif sel==13 then
|
||||
BGM(customRange.bgm[customSel[13]])
|
||||
end
|
||||
end},
|
||||
start1= {x=880, y=580, w=220,h=70, rgb=color.green, code=function()loadGame(0,1)end},
|
||||
start2= {x=1120,y=580, w=220,h=70, rgb=color.lightPurple, code=function()loadGame(0,2)end},
|
||||
draw= {x=1000,y=90, w=190,h=85, rgb=color.cyan, code=function()gotoScene("draw")end},
|
||||
set1= {x=640, y=160, w=240,h=75, rgb=color.lightRed, code=function()useDefaultSet(1)end},
|
||||
set2= {x=640, y=250, w=240,h=75, rgb=color.lightRed, code=function()useDefaultSet(2)end},
|
||||
set3= {x=640, y=340, w=240,h=75, rgb=color.lightRed, code=function()useDefaultSet(3)end},
|
||||
set4= {x=640, y=430, w=240,h=75, rgb=color.lightRed, code=function()useDefaultSet(4)end},
|
||||
set5= {x=640, y=520, w=240,h=75, rgb=color.lightRed, code=function()useDefaultSet(5)end},
|
||||
back= {x=640, y=630, w=180,h=60, rgb=color.white, code=back},
|
||||
up= newButton(1000, 220, 100,100,color.white, 50,function()sel=(sel-2)%#customID+1 end),
|
||||
down= newButton(1000, 460, 100,100,color.white, 50,function()sel=sel%#customID+1 end),
|
||||
left= newButton(880, 340, 100,100,color.white, 50,function()love.keypressed("left")end),
|
||||
right= newButton(1120, 340, 100,100,color.white, 50,function()love.keypressed("right")end),
|
||||
start1= newButton(880, 580, 220,70, color.green, 40,function()loadGame(0,1)end),
|
||||
start2= newButton(1120, 580, 220,70, color.lightPurple, 40,function()loadGame(0,2)end),
|
||||
draw= newButton(1000, 90, 190,85, color.cyan, 40,function()gotoScene("draw")end),
|
||||
set1= newButton(640, 160, 240,75, color.lightRed, 40,function()useDefaultSet(1)end),
|
||||
set2= newButton(640, 250, 240,75, color.lightRed, 40,function()useDefaultSet(2)end),
|
||||
set3= newButton(640, 340, 240,75, color.lightRed, 40,function()useDefaultSet(3)end),
|
||||
set4= newButton(640, 430, 240,75, color.lightRed, 40,function()useDefaultSet(4)end),
|
||||
set5= newButton(640, 520, 240,75, color.lightRed, 40,function()useDefaultSet(5)end),
|
||||
back= newButton(640, 630, 180,60, color.white, 40,back),
|
||||
},
|
||||
draw={
|
||||
any= {x=700, y=80,w=120,h=120, f=45, rgb=color.lightGrey,code=function()pen=-1 end},
|
||||
block1= {x=840, y=80,w=120,h=120, f=65, rgb=color.red, code=function()pen=1 end},
|
||||
block2= {x=980, y=80,w=120,h=120, f=65, rgb=color.green, code=function()pen=2 end},
|
||||
block3= {x=1120,y=80,w=120,h=120, f=65, rgb=color.orange, code=function()pen=3 end},
|
||||
block4= {x=840, y=220,w=120,h=120, f=65, rgb=color.blue, code=function()pen=4 end},
|
||||
block5= {x=980, y=220,w=120,h=120, f=65, rgb=color.magenta, code=function()pen=5 end},
|
||||
block6= {x=1120,y=220,w=120,h=120, f=65, rgb=color.yellow, code=function()pen=6 end},
|
||||
block7= {x=840, y=360,w=120,h=120, f=65, rgb=color.cyan, code=function()pen=7 end},
|
||||
gb1= {x=980, y=360,w=120,h=120, f=65, rgb=color.darkGrey, code=function()pen=9 end},
|
||||
gb2= {x=1120,y=360,w=120,h=120, f=65, rgb=color.grey, code=function()pen=10 end},
|
||||
gb3= {x=840, y=500,w=120,h=120, f=65, rgb=color.darkPurple,code=function()pen=11 end},
|
||||
gb4= {x=980, y=500,w=120,h=120, f=65, rgb=color.darkRed, code=function()pen=12 end},
|
||||
gb5= {x=1120,y=500,w=120,h=120, f=65, rgb=color.darkGreen,code=function()pen=13 end},
|
||||
space= {x=840, y=640,w=120,h=120, f=70, rgb=color.grey, code=function()pen=0 end},
|
||||
clear= {x=1120,y=640,w=120,h=120, f=45, rgb=color.white, code=function()
|
||||
if clearSureTime>15 then
|
||||
for y=1,20 do for x=1,10 do preField[y][x]=-1 end end
|
||||
clearSureTime=0
|
||||
else
|
||||
clearSureTime=50
|
||||
end
|
||||
end},
|
||||
back= {x=1235,y=45,w=80,h=80, f=35, rgb=color.white, code=back},
|
||||
any= newButton(700, 80, 120,120,color.lightGrey, 45,function()pen=0 end),
|
||||
block1= newButton(840, 80, 120,120,color.red, 65,function()pen=1 end),
|
||||
block2= newButton(980, 80, 120,120,color.green, 65,function()pen=2 end),
|
||||
block3= newButton(1120, 80, 120,120,color.orange, 65,function()pen=3 end),
|
||||
block4= newButton(840, 220, 120,120,color.blue, 65,function()pen=4 end),
|
||||
block5= newButton(980, 220, 120,120,color.magenta, 65,function()pen=5 end),
|
||||
block6= newButton(1120, 220, 120,120,color.yellow, 65,function()pen=6 end),
|
||||
block7= newButton(840, 360, 120,120,color.cyan, 65,function()pen=7 end),
|
||||
gb1= newButton(980, 360, 120,120,color.darkGrey, 65,function()pen=9 end),
|
||||
gb2= newButton(1120, 360, 120,120,color.grey, 65,function()pen=10 end),
|
||||
gb3= newButton(840, 500, 120,120,color.darkPurple, 65,function()pen=11 end),
|
||||
gb4= newButton(980, 500, 120,120,color.darkRed, 65,function()pen=12 end),
|
||||
gb5= newButton(1120, 500, 120,120,color.darkGreen, 65,function()pen=13 end),
|
||||
space= newButton(840, 640, 120,120,color.grey, 70,function()pen=-1 end),
|
||||
clear= newButton(1120, 640, 120,120,color.white, 45,function()love.keypressed("delete")end),
|
||||
back= newButton(1235, 45, 80, 80, color.white, 35,back),
|
||||
},
|
||||
play={
|
||||
pause={x=1235,y=45,w=80,h=80,rgb=color.white,f=30,code=pauseGame},
|
||||
pause= newButton(1235,45,80,80,color.white,30,pauseGame),
|
||||
},
|
||||
pause={
|
||||
resume= {x=640,y=400,w=240,h=100, rgb=color.white,f=50,code=resumeGame},
|
||||
quit= {x=640,y=550,w=240,h=100, rgb=color.white,f=50,code=back},
|
||||
resume= newButton(640,290,240,100,color.white,50,resumeGame),
|
||||
restart=newButton(640,445,240,100,color.white,50,function()
|
||||
clearTask("play")
|
||||
updateStat()
|
||||
resetGameData()
|
||||
gotoScene("play","none")
|
||||
end),
|
||||
quit= newButton(640,600,240,100,color.white,50,back),
|
||||
},
|
||||
setting={--Normal setting
|
||||
ghost= {x=290, y=90, w=210, h=60, rgb=color.white,code=function()setting.ghost=not setting.ghost end,down="grid",right="center"},
|
||||
center= {x=505, y=90, w=210, h=60, rgb=color.white,code=function()setting.center=not setting.center end,down="swap",left="ghost",right="sfx"},
|
||||
grid= {x=290, y=160, w=210, h=60, rgb=color.white,code=function()setting.grid=not setting.grid end,up="ghost",down="fxs",right="swap"},
|
||||
swap= {x=505, y=160, w=210, h=60,f=28, rgb=color.white,code=function()setting.swap=not setting.swap end,up="center",down="bg",left="grid",right="vib"},
|
||||
fxs= {x=290, y=230, w=210, h=60, rgb=color.white,code=function()setting.fxs=(setting.fxs+1)%4 end,up="grid",down="dasU",right="bg"},
|
||||
bg= {x=505, y=230, w=210, h=60, rgb=color.white,code=function()setting.bg=not setting.bg end,up="swap",down="arrD",left="fxs",right="fullscreen"},
|
||||
dasD= {x=210, y=300, w=50, h=50, rgb=color.white,code=function()setting.das=(setting.das-1)%31 end,up="fxs",down="sddasD",right="dasU"},
|
||||
dasU= {x=370, y=300, w=50, h=50, rgb=color.white,code=function()setting.das=(setting.das+1)%31 end,up="fxs",down="sddasU",left="dasD",right="arrD"},
|
||||
arrD= {x=425, y=300, w=50, h=50, rgb=color.white,code=function()setting.arr=(setting.arr-1)%16 end,up="bg",down="sdarrD",left="dasU",right="arrU"},
|
||||
arrU= {x=585, y=300, w=50, h=50, rgb=color.white,code=function()setting.arr=(setting.arr+1)%16 end,up="bg",down="sdarrU",left="arrD",right="bgblock"},--3~6
|
||||
sddasD= {x=210, y=370, w=50, h=50, rgb=color.white,code=function()setting.sddas=(setting.sddas-1)%11 end,up="dasD",down="ctrl",right="sddasU"},
|
||||
sddasU= {x=370, y=370, w=50, h=50, rgb=color.white,code=function()setting.sddas=(setting.sddas+1)%11 end,up="dasU",down="ctrl",left="sddasD",right="sdarrD"},
|
||||
sdarrD= {x=425, y=370, w=50, h=50, rgb=color.white,code=function()setting.sdarr=(setting.sdarr-1)%4 end,up="arrD",down="ctrl",left="sddasU",right="sdarrU"},
|
||||
sdarrU= {x=585, y=370, w=50, h=50, rgb=color.white,code=function()setting.sdarr=(setting.sdarr+1)%4 end,up="arrU",down="ctrl",left="sdarrD",right="frame"},
|
||||
ghost= newButton(290, 90, 210,60,color.white,40,function()setting.ghost=not setting.ghost end, nil, nil, "grid", nil, "center" ),
|
||||
center= newButton(505, 90, 210,60,color.white,40,function()setting.center=not setting.center end, nil, nil, "swap", "ghost", "sfx" ),
|
||||
grid= newButton(290, 160,210,60,color.white,40,function()setting.grid=not setting.grid end, nil, "ghost", "fxs", nil, "swap" ),
|
||||
swap= newButton(505, 160,210,60,color.white,28,function()setting.swap=not setting.swap end, nil, "center", "bg", "grid", "vib" ),
|
||||
fxs= newButton(290, 230,210,60,color.white,40,function()setting.fxs=(setting.fxs+1)%4 end, nil, "grid", "dasU", nil, "bg" ),
|
||||
bg= newButton(505, 230,210,60,color.white,40,function()setting.bg=not setting.bg end, nil, "swap", "arrD", "fxs", "fullscreen" ),
|
||||
dasD= newButton(210, 300,50, 50,color.white,40,function()setting.das=(setting.das-1)%31 end, nil, "fxs", "sddasD", nil, "dasU" ),
|
||||
dasU= newButton(370, 300,50, 50,color.white,40,function()setting.das=(setting.das+1)%31 end, nil, "fxs", "sddasU", "dasD", "arrD" ),
|
||||
arrD= newButton(425, 300,50, 50,color.white,40,function()
|
||||
setting.arr=(setting.arr-1)%16
|
||||
if setting.arr>setting.das then
|
||||
setting.das=setting.arr
|
||||
Widget.setting.dasU.alpha,Widget.setting.dasD.alpha=1,1
|
||||
SFX("blip_1",.4)
|
||||
end
|
||||
end,nil,"bg","sdarrD","dasU","arrU"),
|
||||
arrU= newButton(585, 300,50, 50,color.white,40,function()
|
||||
setting.arr=(setting.arr+1)%16
|
||||
if setting.arr>setting.das then
|
||||
setting.das=setting.arr
|
||||
Widget.setting.dasU.alpha,Widget.setting.dasD.alpha=1,1
|
||||
SFX("blip_1",.4)
|
||||
end
|
||||
end,nil,"bg","sdarrU","arrD","bgblock"),
|
||||
sddasD= newButton(210, 370,50, 50,color.white,40,function()setting.sddas=(setting.sddas-1)%11 end, nil, "dasD", "ctrl", nil, "sddasU" ),
|
||||
sddasU= newButton(370, 370,50, 50,color.white,40,function()setting.sddas=(setting.sddas+1)%11 end, nil, "dasU", "ctrl", "sddasD", "sdarrD" ),
|
||||
sdarrD= newButton(425, 370,50, 50,color.white,40,function()setting.sdarr=(setting.sdarr-1)%4 end, nil, "arrD", "ctrl", "sddasU", "sdarrU" ),
|
||||
sdarrU= newButton(585, 370,50, 50,color.white,40,function()setting.sdarr=(setting.sdarr+1)%4 end, nil, "arrU", "ctrl", "sdarrD", "frame" ),
|
||||
|
||||
ctrl= {x=340,y=440, w=310, h=60,rgb=color.green, code=function()gotoScene("setting2")end,up="sddasU",down="touch",left="lang",right="skin"},
|
||||
touch= {x=340,y=510, w=310, h=60,rgb=color.yellow,code=function()gotoScene("setting3")end,up="ctrl",down="back",right="lang"},
|
||||
lang= {x=580,y=510, w=150, h=60,rgb=color.red, code=function()
|
||||
ctrl= newButton(340,440, 310,60,color.green,40, function()gotoScene("setting2")end, nil, "sddasU", "touch", "lang", "skin" ),
|
||||
touch= newButton(340,510, 310,60,color.yellow,40, function()gotoScene("setting3")end, nil, "ctrl", "back", nil, "lang" ),
|
||||
lang= newButton(580,510, 150,60,color.red,40, function()
|
||||
setting.lang=setting.lang%#langName+1
|
||||
swapLanguage(setting.lang)
|
||||
end,up="sdarrU",down="back",left="touch",right="skin"},
|
||||
end,nil,"sdarrU","back","touch","skin"),
|
||||
|
||||
sfx= {x=760,y=90, w=160, h=60, rgb=color.white,code=function()setting.sfx=not setting.sfx end,down="vib",left="center",right="bgm"},
|
||||
bgm= {x=940,y=90, w=160, h=60, rgb=color.white,code=function()BGM()setting.bgm=not setting.bgm BGM("blank")end,down="voc",left="sfx"},
|
||||
vib= {x=760,y=160, w=160, h=60,rgb=color.white, code=function()setting.vib=(setting.vib+1)%6 VIB(1)end,up="sfx",down="fullscreen",left="swap",right="voc"},
|
||||
voc= {x=940,y=160, w=160, h=60,rgb=color.white,code=function()setting.voc=not setting.voc end,up="sfx",down="fullscreen",left="vib"},
|
||||
fullscreen= {x=850,y=230,w=340, h=60,rgb=color.white, code=function()
|
||||
sfx= newButton(760,90, 160,60,color.white,40, function()setting.sfx=not setting.sfx end, nil, nil, "vib", "center", "bgm" ),
|
||||
bgm= newButton(940,90, 160,60,color.white,40, function()BGM()setting.bgm=not setting.bgm BGM("blank")end, nil, nil, "voc", "sfx", nil ),
|
||||
vib= newButton(760,160, 160,60,color.white,40, function()setting.vib=(setting.vib+1)%6 VIB(1)end, nil, "sfx", "fullscreen", "swap", "voc" ),
|
||||
voc= newButton(940,160, 160,60,color.white,40, function()setting.voc=not setting.voc end, nil, "sfx", "fullscreen", "vib", nil ),
|
||||
fullscreen= newButton(850,230, 340,60,color.white,40, function()
|
||||
setting.fullscreen=not setting.fullscreen
|
||||
love.window.setFullscreen(setting.fullscreen)
|
||||
if not setting.fullscreen then
|
||||
love.resize(gc.getWidth(),gc.getHeight())
|
||||
love.resize(gc.getWidth(),gc.getHeight())
|
||||
end
|
||||
end,up="vib",down="bgblock",left="bg"},
|
||||
bgblock={x=850,y=300, w=340, h=60,rgb=color.white, code=function()
|
||||
setting.bgblock=not setting.bgblock
|
||||
--if not setting.bgblock then for i=1,16 do BGblockList[i].v=3*BGblockList[i].v end end
|
||||
end,up="fullscreen",down="frame",left="arrU"},
|
||||
frame= {x=850,y=370, w=340, h=60,rgb=color.white, code=function()
|
||||
end,nil,"vib","bgblock","bg",nil),
|
||||
bgblock= newButton(850,300, 340,60,color.white,40, function()
|
||||
setting.bgblock=not setting.bgblock--if not setting.bgblock then for i=1,16 do BGblockList[i].v=3*BGblockList[i].v end end
|
||||
end,nil,"fullscreen","frame","arrU",nil),
|
||||
frame= newButton(850,370, 340,60,color.white,40, function()
|
||||
setting.frameMul=setting.frameMul+(setting.frameMul<50 and 5 or 10)
|
||||
if setting.frameMul>100 then setting.frameMul=25 end
|
||||
end,up="bgblock",down="skin",left="sdarrU"},
|
||||
skin= {x=740,y=440, w=120, h=60,rgb=color.white, code=function()
|
||||
end,nil,"bgblock","skin","sdarrU",nil),
|
||||
skin= newButton(740,440, 120,60,color.white,40, function()
|
||||
setting.skin=setting.skin%6+1
|
||||
changeBlockSkin(setting.skin)
|
||||
end,up="frame",down="back",left="ctrl",right="smo"},
|
||||
smo= {x=920,y=440, w=200, h=60,f=27,rgb=color.white, code=function()
|
||||
end,nil,"frame","back","ctrl","smo"),
|
||||
smo= newButton(920,440, 200,60,color.white,27, function()
|
||||
setting.smo=not setting.smo
|
||||
end,up="frame",down="back",left="skin"},
|
||||
back= {x=640,y=620, w=300,h=70,rgb=color.white, code=back,up="lang"},
|
||||
end,nil,"frame","back","skin",nil),
|
||||
back= newButton(640,620, 300,70,color.white,40, back,nil,nil,"lang",nil,nil),
|
||||
},
|
||||
setting2={--Control setting
|
||||
back={x=840,y=630,w=180,h=60,rgb=color.white,code=back},
|
||||
back=newButton(840,630,180,60,color.white,40,back),
|
||||
},
|
||||
setting3={--Touch setting
|
||||
back={x=640,y=410,w=170,h=80,f=45,code=back},
|
||||
hide={x=640,y=210,w=500,h=80,f=45,code=function()
|
||||
hide= newButton(640,210,500,80,color.white,45,function()
|
||||
setting.virtualkeySwitch=not setting.virtualkeySwitch
|
||||
end},
|
||||
default={x=450,y=310,w=170,h=80,code=function()
|
||||
end),
|
||||
default=newButton(450,310,170,80,color.white,40,function()
|
||||
for K=1,#virtualkey do
|
||||
local b,b0=virtualkey[K],virtualkeySet[defaultSel][K]
|
||||
b[1],b[2],b[3],b[4]=b0[1],b0[2],b0[3],b0[4]
|
||||
end--Default virtualkey
|
||||
defaultSel=defaultSel%5+1
|
||||
end},
|
||||
snap={x=640,y=310,w=170,h=80,code=function()
|
||||
end),
|
||||
snap= newButton(640,310,170,80,color.white,40,function()
|
||||
snapLevel=snapLevel%6+1
|
||||
end},
|
||||
alpha={x=830,y=310,w=170,h=80,f=45,code=function()
|
||||
end),
|
||||
alpha= newButton(830,310,170,80,color.white,45,function()
|
||||
setting.virtualkeyAlpha=(setting.virtualkeyAlpha+1)%11
|
||||
--Adjust virtualkey alpha
|
||||
end},
|
||||
icon={x=450,y=410,w=170,h=80,f=45,code=function()
|
||||
end),
|
||||
icon= newButton(450,410,170,80,color.white,45,function()
|
||||
setting.virtualkeyIcon=not setting.virtualkeyIcon
|
||||
--Switch virtualkey icon
|
||||
end},
|
||||
size={x=830,y=410,w=170,h=80,f=45,code=function()
|
||||
end),
|
||||
size= newButton(830,410,170,80,color.white,45,function()
|
||||
if sel then
|
||||
local b=virtualkey[sel]
|
||||
b[4]=b[4]+10
|
||||
if b[4]==150 then b[4]=40 end
|
||||
b[3]=b[4]^2
|
||||
end
|
||||
end},
|
||||
end),
|
||||
back= newButton(640,410,170,80,color.white,45,back),
|
||||
},
|
||||
help={
|
||||
his={x=1050,y=520,w=230,h=60,rgb=color.white,code=function()gotoScene("history")end,down="qq",left="back"},
|
||||
qq={x=1050,y=600,w=230,h=60,hide=function()return mobile end,rgb=color.white,code=function()sys.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end,up="his",left="back"},
|
||||
back={x=640,y=600,w=180,h=60,rgb=color.white,code=back,up="his",right="qq"},
|
||||
his= newButton(1050, 520,230,60,color.white,40,function()gotoScene("history")end, nil, nil, "qq", "back", nil),
|
||||
qq= newButton(1050, 600,230,60,color.white,40,function()sys.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end, function()return mobile end,"his", nil, "back", nil),
|
||||
back= newButton(640, 600,180,60,color.white,40,back, nil, "his", nil, nil, "qq"),
|
||||
},
|
||||
history={
|
||||
prev= {x=75, y=320,w=100, h=300, rgb=color.white,hide=function()return sel==1 end,code=function()sel=sel-1 end},
|
||||
next= {x=1205,y=320,w=100, h=300, rgb=color.white,hide=function()return sel==#updateLog end,code=function()sel=sel+1 end},
|
||||
back= {x=640, y=640,w=200,h=70, rgb=color.white,code=back},
|
||||
prev= newButton(75, 320,100,300,color.white,40,function()love.keypressed("left")end,function()return sel==1 end),
|
||||
next= newButton(1205, 320,100,300,color.white,40,function()love.keypressed("right")end,function()return sel==#updateLog end),
|
||||
back= newButton(640, 640,200,70, color.white,40,back),
|
||||
},
|
||||
stat={
|
||||
path={x=980,y=590,w=250,h=60,f=30,rgb=color.white,hide=function()return mobile end,code=function()sys.openURL(fs.getSaveDirectory())end,left="back"},
|
||||
back={x=640,y=590,w=180,h=60,rgb=color.white,code=back,right="path"},
|
||||
path= newButton(980,590,250,60,color.white,30,function()sys.openURL(fs.getSaveDirectory())end,function()return mobile end,nil,nil,"back",nil),
|
||||
back= newButton(640,590,180,60,color.white,40,back,nil,nil,nil,nil,"path"),
|
||||
},
|
||||
sel=nil,--selected button id(integer)
|
||||
sel=nil,--selected widget id
|
||||
}
|
||||
294
main.lua
294
main.lua
@@ -7,10 +7,11 @@ local find,format=string.find,string.format
|
||||
local ins,rem=table.insert,table.remove
|
||||
local Timer=tm.getTime
|
||||
-- sort=table.sort
|
||||
-------------------------------------------------------------
|
||||
|
||||
local F=false
|
||||
null=function()end
|
||||
-------------------------------------------------------------
|
||||
system=sys.getOS()
|
||||
local mobile=system=="Android"or system=="iOS"
|
||||
local xOy=love.math.newTransform()
|
||||
local mx,my,mouseShow=-20,-20,false
|
||||
local touching--1st touching ID
|
||||
@@ -22,10 +23,9 @@ curBG="none"
|
||||
voicePlaying={}
|
||||
local devMode=0
|
||||
|
||||
local F=false
|
||||
kb.setKeyRepeat(F)
|
||||
kb.setTextInput(F)
|
||||
ms.setVisible(F)
|
||||
kb.setKeyRepeat(true)
|
||||
kb.setTextInput(false)
|
||||
ms.setVisible(false)
|
||||
-------------------------------------------------------------
|
||||
local Fonts={}
|
||||
function setFont(s)
|
||||
@@ -43,21 +43,21 @@ function setFont(s)
|
||||
end
|
||||
customSel={22,22,1,1,7,3,1,1,8,4,1,1,1}
|
||||
preField={h=20}
|
||||
for i=1,18 do preField[i]={0,0,0,0,0,0,0,0,0,0}end
|
||||
for i=19,20 do preField[i]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}end
|
||||
for i=1,10 do preField[i]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}end
|
||||
for i=11,20 do preField[i]={0,0,0,0,0,0,0,0,0,0}end
|
||||
freeRow={L=40}for i=1,40 do freeRow[i]={0,0,0,0,0,0,0,0,0,0}end
|
||||
--Game system Vars
|
||||
setting={
|
||||
ghost=true,center=true,
|
||||
grid=F,swap=true,
|
||||
grid=false,swap=true,
|
||||
fxs=3,bg=true,
|
||||
das=10,arr=2,
|
||||
sddas=0,sdarr=2,
|
||||
lang=1,
|
||||
|
||||
|
||||
sfx=true,bgm=true,
|
||||
vib=3,voc=F,
|
||||
fullscreen=F,
|
||||
vib=3,voc=false,
|
||||
fullscreen=false,
|
||||
bgblock=true,
|
||||
skin=1,smo=true,
|
||||
keyMap={
|
||||
@@ -91,7 +91,7 @@ setting={
|
||||
},
|
||||
virtualkeyAlpha=3,
|
||||
virtualkeyIcon=true,
|
||||
virtualkeySwitch=F,
|
||||
virtualkeySwitch=false,
|
||||
frameMul=100,
|
||||
}
|
||||
stat={
|
||||
@@ -126,9 +126,9 @@ virtualkeyPressTime={0,0,0,0,0,0,0,0,0,0,0,0,0}
|
||||
-------------------------------------------------------------
|
||||
require("class")
|
||||
require("toolfunc")
|
||||
require("ai")
|
||||
require("gamefunc")
|
||||
require("list")
|
||||
require("ai")
|
||||
require("dataList")
|
||||
require("texture")
|
||||
local Tmr=require("timer")
|
||||
@@ -147,18 +147,7 @@ if sys.getPowerInfo()~="unknown"then
|
||||
gc.clear(0,0,0,.3)
|
||||
gc.setLineWidth(4)
|
||||
setFont(25)
|
||||
if pow then
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(batteryImage,58,3)
|
||||
if pow>90 then gc.setColor(color.lightGreen)
|
||||
elseif pow<60 then gc.setColor(color.lightRed)
|
||||
elseif pow<20 then gc.setColor(color.red)
|
||||
elseif pow==26 then gc.setColor(color.purple)
|
||||
end
|
||||
gc.rectangle("fill",61,6,pow*.15,10)
|
||||
gc.setColor(1,1,1)
|
||||
gc.print(pow.."%",94,-3)
|
||||
end
|
||||
local charging
|
||||
if state~="battery"then
|
||||
gc.setColor(1,1,1)
|
||||
if state=="nobattery"then
|
||||
@@ -166,8 +155,22 @@ if sys.getPowerInfo()~="unknown"then
|
||||
gc.line(61.5,.5,83.5,22.5)
|
||||
elseif state=="charging"or state=="charged"then
|
||||
gc.draw(chargeImage,84,3)
|
||||
F=true
|
||||
end
|
||||
end
|
||||
if pow then
|
||||
if charging then gc.setColor(0,1,0)
|
||||
elseif pow>50 then gc.setColor(1,1,1)
|
||||
elseif pow>26 then gc.setColor(1,1,0)
|
||||
elseif pow<26 then gc.setColor(1,0,0)
|
||||
else gc.setColor(.5,0,1)--special~
|
||||
end
|
||||
::L::
|
||||
gc.rectangle("fill",61,6,pow*.15,10)
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(batteryImage,58,3)
|
||||
gc.print(pow.."%",94,-3)
|
||||
end
|
||||
gc.print(os.date("%H:%M",os.time()),2,-3)
|
||||
gc.pop()gc.setCanvas()
|
||||
end
|
||||
@@ -209,20 +212,22 @@ local sceneInit={
|
||||
mode=function()
|
||||
curBG="none"
|
||||
saveData()
|
||||
destroyPlayers()
|
||||
BGM("blank")
|
||||
end,
|
||||
custom=function()
|
||||
sel=sel or 1
|
||||
destroyPlayers()
|
||||
curBG=customRange.bg[customSel[12]]
|
||||
BGM(customRange.bgm[customSel[13]])
|
||||
end,
|
||||
draw=function()
|
||||
curBG="none"
|
||||
kb.setKeyRepeat(true)
|
||||
clearSureTime=0
|
||||
pen,sx,sy=1,1,1
|
||||
end,
|
||||
play=function()
|
||||
kb.setKeyRepeat(false)
|
||||
restartCount=0
|
||||
if needResetGameData then
|
||||
resetGameData()
|
||||
@@ -276,37 +281,41 @@ local function onVirtualkey(x,y)
|
||||
end
|
||||
local function buttonControl_key(i)
|
||||
if i=="up"or i=="down"or i=="left"or i=="right"then
|
||||
if Buttons.sel then
|
||||
Buttons.sel=Buttons[scene][Buttons.sel[i]]or Buttons.sel
|
||||
if Widget.sel then
|
||||
Widget.sel=Widget[scene][Widget.sel[i]]or Widget.sel
|
||||
else
|
||||
Buttons.sel=select(2,next(Buttons[scene]))
|
||||
Widget.sel=select(2,next(Widget[scene]))
|
||||
end
|
||||
elseif i=="space"or i=="return"then
|
||||
if not sceneSwaping and Buttons.sel then
|
||||
local B=Buttons.sel
|
||||
B.alpha=1
|
||||
B.code()
|
||||
if B.hide and B.hide()then Buttons.sel=nil end
|
||||
SFX("button")
|
||||
VOICE("nya")
|
||||
if not sceneSwaping and Widget.sel then
|
||||
local W=Widget.sel
|
||||
if W.type=="button"then
|
||||
W.alpha=1
|
||||
W.code()
|
||||
if W.hide and W.hide()then Widget.sel=nil end
|
||||
SFX("button")
|
||||
VOICE("nya")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local function buttonControl_gamepad(i)
|
||||
if i=="dpup"or i=="dpdown"or i=="dpleft"or i=="dpright"then
|
||||
if Buttons.sel then
|
||||
Buttons.sel=Buttons[scene][Buttons.sel[i=="dpup"and"up"or i=="dpdown"and"down"or i=="dpleft"and"left"or"right"]]or Buttons.sel
|
||||
if Widget.sel then
|
||||
Widget.sel=Widget[scene][Widget.sel[i=="dpup"and"up"or i=="dpdown"and"down"or i=="dpleft"and"left"or"right"]]or Widget.sel
|
||||
else
|
||||
Buttons.sel=select(2,next(Buttons[scene]))
|
||||
Widget.sel=select(2,next(Widget[scene]))
|
||||
end
|
||||
elseif i=="start"then
|
||||
if not sceneSwaping and Buttons.sel then
|
||||
local B=Buttons.sel
|
||||
B.alpha=1
|
||||
B.code()
|
||||
if B.hide and B.hide()then Buttons.sel=nil end
|
||||
SFX("button")
|
||||
VOICE("nya")
|
||||
if not sceneSwaping and Widget.sel then
|
||||
local W=Widget.sel
|
||||
if W.type=="button"then
|
||||
W.alpha=1
|
||||
W.code()
|
||||
if W.hide and W.hide()then Widget.sel=nil end
|
||||
SFX("button")
|
||||
VOICE("nya")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -381,7 +390,11 @@ function keyDown.music(key)
|
||||
elseif key=="up"then
|
||||
sel=(sel-2)%#musicID+1
|
||||
elseif key=="return"or key=="space"then
|
||||
BGM(musicID[sel])
|
||||
if bgmPlaying~=musicID[sel]then
|
||||
BGM(musicID[sel])
|
||||
else
|
||||
BGM()
|
||||
end
|
||||
elseif key=="escape"then
|
||||
back()
|
||||
end
|
||||
@@ -450,7 +463,12 @@ function touchMove.draw(id,x,y,dx,dy)
|
||||
end
|
||||
function keyDown.draw(key)
|
||||
if key=="delete"then
|
||||
Buttons.draw.clear.code()
|
||||
if clearSureTime>15 then
|
||||
for y=1,20 do for x=1,10 do preField[y][x]=0 end end
|
||||
clearSureTime=0
|
||||
else
|
||||
clearSureTime=50
|
||||
end
|
||||
elseif key=="up"or key=="down"or key=="left"or key=="right"then
|
||||
if not sx then sx=1 end
|
||||
if not sy then sy=1 end
|
||||
@@ -606,6 +624,7 @@ function touchDown.play(id,x,y)
|
||||
local t=onVirtualkey(x,y)
|
||||
if t then
|
||||
pressKey(t,players[1])
|
||||
VIB(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -702,15 +721,17 @@ function love.mousepressed(x,y,k,t,num)
|
||||
back()
|
||||
end
|
||||
if k==1 then
|
||||
if not sceneSwaping and Buttons.sel then
|
||||
local B=Buttons.sel
|
||||
B.code()
|
||||
B.alpha=1
|
||||
Buttons.sel=nil
|
||||
love.mousemoved(x,y,0,0)
|
||||
SFX("button")
|
||||
VOICE("nya")
|
||||
VIB(1)
|
||||
if not sceneSwaping and Widget.sel then
|
||||
local W=Widget.sel
|
||||
if W.type=="button"then
|
||||
W.code()
|
||||
W.alpha=1
|
||||
Widget.sel=nil
|
||||
love.mousemoved(x,y,0,0)
|
||||
SFX("button")
|
||||
VOICE("nya")
|
||||
VIB(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -718,15 +739,17 @@ function love.mousemoved(x,y,dx,dy,t)
|
||||
if t then return end
|
||||
mouseShow=true
|
||||
mx,my=xOy:inverseTransformPoint(x,y)
|
||||
Buttons.sel=nil
|
||||
Widget.sel=nil
|
||||
if mouseMove[scene]then
|
||||
mouseMove[scene](mx,my,dx/scr.k,dy/scr.k)
|
||||
end
|
||||
for _,B in next,Buttons[scene]do
|
||||
if not(B.hide and B.hide())then
|
||||
if abs(mx-B.x)<B.w*.5 and abs(my-B.y)<B.h*.5 then
|
||||
Buttons.sel=B
|
||||
return
|
||||
for _,W in next,Widget[scene]do
|
||||
if not(W.hide and W.hide())then
|
||||
if W.type=="button"then
|
||||
if mx>W.x and mx<W.x+W.w and my>W.y and my<W.y+W.h then
|
||||
Widget.sel=W
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -755,16 +778,17 @@ end
|
||||
function love.touchreleased(id,x,y)
|
||||
if id==touching then
|
||||
touching=nil
|
||||
if Buttons.sel then
|
||||
local B=Buttons.sel
|
||||
B.code()
|
||||
B.alpha=1
|
||||
Buttons.sel=nil
|
||||
SFX("button")
|
||||
VOICE("nya")
|
||||
VIB(1)
|
||||
if Widget.sel then
|
||||
local W=Widget.sel
|
||||
if W.type=="button"then
|
||||
W.code()
|
||||
W.alpha=1
|
||||
SFX("button")
|
||||
VOICE("nya")
|
||||
VIB(1)
|
||||
end
|
||||
end
|
||||
Buttons.sel=nil
|
||||
Widget.sel=nil
|
||||
end
|
||||
if touchUp[scene]then
|
||||
touchUp[scene](id,xOy:inverseTransformPoint(x,y))
|
||||
@@ -775,16 +799,18 @@ function love.touchmoved(id,x,y,dx,dy)
|
||||
if touchMove[scene]then
|
||||
touchMove[scene](id,x,y,dx/scr.k,dy/scr.k)
|
||||
end
|
||||
Buttons.sel=nil
|
||||
for _,B in next,Buttons[scene]do
|
||||
if not(B.hide and B.hide())then
|
||||
if abs(x-B.x)<B.w*.5 and abs(y-B.y)<B.h*.5 then
|
||||
Buttons.sel=B
|
||||
return
|
||||
Widget.sel=nil
|
||||
for _,W in next,Widget[scene]do
|
||||
if not(W.hide and W.hide())then
|
||||
if W.type=="button"then
|
||||
if x>W.x and x<W.x+W.w and y>W.y and y<W.y+W.h then
|
||||
Widget.sel=W
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if not Buttons.sel then
|
||||
if not Widget.sel then
|
||||
touching=nil
|
||||
end
|
||||
end
|
||||
@@ -793,24 +819,26 @@ function love.keypressed(i)
|
||||
if i=="f8"then devMode=(devMode+1)%3 end
|
||||
if devMode==2 then
|
||||
if i=="k"then
|
||||
P=players.alive[rnd(#players.alive)]
|
||||
if P.id~=1 then
|
||||
P.lastRecv=players[1]
|
||||
Event.lose()
|
||||
for i=1,8 do
|
||||
P=players.alive[rnd(#players.alive)]
|
||||
if P.id~=1 then
|
||||
P.lastRecv=players[1]
|
||||
Event.lose()
|
||||
end
|
||||
end
|
||||
--Test code here
|
||||
--Test code here
|
||||
elseif i=="q"then
|
||||
local B=Buttons.sel if B then print(format("x=%d,y=%d,w=%d,h=%d",B.x,B.y,B.w,B.h))end
|
||||
elseif Buttons.sel then
|
||||
local B=Buttons.sel
|
||||
if i=="left"then B.x=B.x-10
|
||||
elseif i=="right"then B.x=B.x+10
|
||||
elseif i=="up"then B.y=B.y-10
|
||||
elseif i=="down"then B.y=B.y+10
|
||||
elseif i==","then B.w=B.w-10
|
||||
elseif i=="."then B.w=B.w+10
|
||||
elseif i=="/"then B.h=B.h-10
|
||||
elseif i=="'"then B.h=B.h+10
|
||||
local W=Widget.sel if W then print(format("x=%d,y=%d,w=%d,h=%d",W.x,W.y,W.w,W.h))end
|
||||
elseif Widget.sel then
|
||||
local W=Widget.sel
|
||||
if i=="left"then W.x=W.x-10
|
||||
elseif i=="right"then W.x=W.x+10
|
||||
elseif i=="up"then W.y=W.y-10
|
||||
elseif i=="down"then W.y=W.y+10
|
||||
elseif i==","then W.w=W.w-10
|
||||
elseif i=="."then W.w=W.w+10
|
||||
elseif i=="/"then W.h=W.h-10
|
||||
elseif i=="'"then W.h=W.h+10
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -890,12 +918,15 @@ function love.update(dt)
|
||||
if sceneSwaping then
|
||||
sceneSwaping.time=sceneSwaping.time-1
|
||||
if sceneSwaping.time==sceneSwaping.mid then
|
||||
for k,B in next,Buttons[scene]do
|
||||
B.alpha=0
|
||||
end--Reset buttons' alpha
|
||||
Buttons.sel=nil
|
||||
for k,W in next,Widget[scene]do
|
||||
if W.type=="button"then
|
||||
W.alpha=0
|
||||
end--Reset widgets' alpha
|
||||
end
|
||||
Widget.sel=nil
|
||||
scene=sceneSwaping.tar
|
||||
sceneInit[scene]()
|
||||
--scene swapped!
|
||||
elseif sceneSwaping.time==0 then
|
||||
sceneSwaping=nil
|
||||
end
|
||||
@@ -912,11 +943,13 @@ function love.update(dt)
|
||||
end
|
||||
if voicePlaying[1] and not voicePlaying[1]:isPlaying()then voicePlaying[1]:play()end
|
||||
end
|
||||
for k,B in next,Buttons[scene]do
|
||||
local t=B==Buttons.sel and .4 or 0
|
||||
B.alpha=abs(B.alpha-t)>.02 and(B.alpha+(B.alpha<t and .02 or -.02))or t
|
||||
if B.alpha>t then B.alpha=B.alpha-.02 elseif B.alpha<t then B.alpha=B.alpha+.02 end
|
||||
end--update Buttons
|
||||
for k,W in next,Widget[scene]do
|
||||
if W.type=="button"then
|
||||
local t=W==Widget.sel and .4 or 0
|
||||
W.alpha=abs(W.alpha-t)>.02 and(W.alpha+(W.alpha<t and .02 or -.02))or t
|
||||
if W.alpha>t then W.alpha=W.alpha-.02 elseif W.alpha<t then W.alpha=W.alpha+.02 end
|
||||
end
|
||||
end--update Widgets
|
||||
end
|
||||
local scs={1,2,1,2,1,2,1,2,1,2,1.5,1.5,.5,2.5}
|
||||
function love.draw()
|
||||
@@ -933,30 +966,32 @@ function love.draw()
|
||||
end end
|
||||
end
|
||||
if Pnt[scene]then Pnt[scene]()end
|
||||
for k,B in next,Buttons[scene]do
|
||||
if not(B.hide and B.hide())then
|
||||
local C=B.rgb or color.white
|
||||
gc.setColor(C[1],C[2],C[3],B.alpha)
|
||||
gc.rectangle("fill",B.x-B.w*.5,B.y-B.h*.5,B.w,B.h)
|
||||
gc.setColor(C)
|
||||
gc.setLineWidth(3)gc.rectangle("line",B.x-B.w*.5,B.y-B.h*.5,B.w,B.h,4)
|
||||
gc.setColor(C[1],C[2],C[3],.3)
|
||||
gc.setLineWidth(5)gc.rectangle("line",B.x-B.w*.5,B.y-B.h*.5,B.w,B.h,4)
|
||||
local t=B.t
|
||||
local y0
|
||||
if t then
|
||||
if type(t)=="function"then t=t()end
|
||||
setFont(B.f or 40)
|
||||
y0=B.y-currentFont*.64
|
||||
gc.printf(t,B.x-201,y0+2,400,"center")
|
||||
gc.printf(t,B.x-199,y0+2,400,"center")
|
||||
gc.printf(t,B.x-201,y0,400,"center")
|
||||
gc.printf(t,B.x-199,y0,400,"center")
|
||||
for k,W in next,Widget[scene]do
|
||||
if not(W.hide and W.hide())then
|
||||
if W.type=="button"then
|
||||
local C=W.color
|
||||
gc.setColor(C[1],C[2],C[3],W.alpha)
|
||||
gc.rectangle("fill",W.x,W.y,W.w,W.h)
|
||||
gc.setColor(C)
|
||||
mStr(t,B.x,y0+1)
|
||||
gc.setLineWidth(3)gc.rectangle("line",W.x,W.y,W.w,W.h,4)
|
||||
gc.setColor(C[1],C[2],C[3],.3)
|
||||
gc.setLineWidth(5)gc.rectangle("line",W.x,W.y,W.w,W.h,4)
|
||||
local t=W.text
|
||||
if t then
|
||||
if type(t)=="function"then t=t()end
|
||||
setFont(W.font)
|
||||
local x=W.x+W.w*.5
|
||||
local y0=W.y+W.h*.5-currentFont*.64
|
||||
gc.printf(t,x-201,y0+2,400,"center")
|
||||
gc.printf(t,x-199,y0+2,400,"center")
|
||||
gc.printf(t,x-201,y0,400,"center")
|
||||
gc.printf(t,x-199,y0,400,"center")
|
||||
gc.setColor(C)
|
||||
mStr(t,x,y0+1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end--Draw buttons
|
||||
end--Draw widgets
|
||||
if mouseShow and not touching then
|
||||
local r=Timer()*.5
|
||||
gc.setColor(1,1,1,min(1-abs(1-r%1*2),.3))
|
||||
@@ -985,6 +1020,9 @@ function love.draw()
|
||||
setFont(20)
|
||||
gc.print(tm.getFPS(),5,700)
|
||||
if devMode>0 then
|
||||
if devMode==2 then
|
||||
gc.setColor(1,1,0)
|
||||
end
|
||||
gc.print(mx.." "..my,5,640)
|
||||
gc.print(#freeRow.."/"..freeRow.L,5,660)
|
||||
gc.print(gcinfo(),5,680)
|
||||
@@ -999,7 +1037,7 @@ function love.run()
|
||||
return function()
|
||||
PUMP()
|
||||
for N,a,b,c,d,e in POLL()do
|
||||
if N=="quit"then return 0
|
||||
if N=="quit"then destroyPlayers()return 0
|
||||
elseif love[N]then love[N](a,b,c,d,e)end
|
||||
end
|
||||
tm.step()
|
||||
@@ -1031,7 +1069,7 @@ if fs.getInfo("usersetting")then
|
||||
loadSetting()
|
||||
elseif system=="Android" or system=="iOS"then
|
||||
setting.virtualkeySwitch=true
|
||||
setting.swap=F
|
||||
setting.swap=false
|
||||
end
|
||||
math.randomseed(os.time()*626)
|
||||
swapLanguage(setting.lang)
|
||||
|
||||
99
paint.lua
99
paint.lua
@@ -26,11 +26,13 @@ local modeLevelColor={
|
||||
NORMAL=color.green,
|
||||
HARD=color.magenta,
|
||||
LUNATIC=color.red,
|
||||
EXTRA=color.lightMagenta,
|
||||
ULTIMATE=color.lightYellow,
|
||||
FINAL=color.lightGrey,
|
||||
["EASY+"]=color.darkCyan,
|
||||
["NORMAL+"]=color.darkGreen,
|
||||
["HARD+"]=color.darkMagenta,
|
||||
["LUNATIC+"]=color.darkRed,
|
||||
EXTRA=color.lightMagenta,
|
||||
ULTIMATE=color.lightYellow,
|
||||
|
||||
MESS=color.lightGrey,
|
||||
GM=color.blue,
|
||||
@@ -109,7 +111,7 @@ FX={
|
||||
shake=0,--Screen shake(frame)
|
||||
attack={},--Attack beam
|
||||
badge={},--badge thrown
|
||||
|
||||
|
||||
appear=function(t,a)
|
||||
setFont(t.font)
|
||||
gc.setColor(1,1,1,a)
|
||||
@@ -246,27 +248,27 @@ end,
|
||||
game1=function()
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(background1,640,360,Timer()*.15,12,nil,64,64)
|
||||
end,
|
||||
end,--Rainbow
|
||||
game2=function()
|
||||
gc.setColor(1,.5,.5)
|
||||
gc.draw(background1,640,360,Timer()*.2,12,nil,64,64)
|
||||
end,
|
||||
end,--Red rainbow
|
||||
game3=function()
|
||||
gc.setColor(.6,.6,1)
|
||||
gc.draw(background1,640,360,Timer()*.25,12,nil,64,64)
|
||||
end,
|
||||
end,--Blue rainbow
|
||||
game4=function()
|
||||
gc.setColor(.1,.5,.5)
|
||||
local x=Timer()%4*320
|
||||
gc.draw(background2,x,0,nil,10)
|
||||
gc.draw(background2,x-1280,0,nil,10)
|
||||
end,
|
||||
end,--Fast strap
|
||||
game5=function()
|
||||
local t=2.5-Timer()%20%6%2.5
|
||||
if t<.5 then gc.clear(t,t,t)
|
||||
else gc.clear(0,0,0)
|
||||
end
|
||||
end,
|
||||
end,--Lightning
|
||||
game6=function()
|
||||
local t=1.2-Timer()%10%3%1.2
|
||||
if t<.5 then gc.clear(t,t,t)
|
||||
@@ -275,7 +277,7 @@ game6=function()
|
||||
gc.setColor(.3,.3,.3)
|
||||
local r=7-int(Timer()*.5)%7
|
||||
gc.draw(mouseBlock[r],640,360,Timer()%3.1416*6,400,400,scs[r][2]-.5,#blocks[r][0]-scs[r][1]+.5)
|
||||
end,
|
||||
end,--Fast lightning&spining tetromino
|
||||
rgb=function()
|
||||
gc.clear(
|
||||
sin(Timer()*1.2)*.15+.5,
|
||||
@@ -361,19 +363,19 @@ function Pnt.mode()
|
||||
end
|
||||
function Pnt.music()
|
||||
gc.setColor(1,1,1,.3+sin(Timer()*5)*.2)
|
||||
gc.rectangle("fill",45,98+30*sel,237,30)
|
||||
gc.rectangle("fill",45,98+30*sel,250,30)
|
||||
gc.setColor(.8,.8,.8)
|
||||
gc.draw(drawableText.musicRoom,20,20)
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(drawableText.musicRoom,22,23)
|
||||
gc.draw(drawableText.nowPlaying,520,83)
|
||||
gc.draw(drawableText.nowPlaying,490,110)
|
||||
setFont(35)
|
||||
for i=1,#musicID do
|
||||
gc.print(musicID[i],50,90+30*i)
|
||||
end
|
||||
setFont(50)
|
||||
gc.setColor(sin(Timer()*.5)*.2+.8,sin(Timer()*.7)*.2+.8,sin(Timer())*.2+.8)
|
||||
gc.print(bgmPlaying or"",600,140)
|
||||
mStr(bgmPlaying or"",630,180)
|
||||
end
|
||||
function Pnt.custom()
|
||||
gc.setColor(1,1,1,.3+sin(Timer()*8)*.2)
|
||||
@@ -406,7 +408,7 @@ function Pnt.draw()
|
||||
local B=preField[y][x]
|
||||
if B>0 then
|
||||
drawPixel(y,x,B)
|
||||
elseif B==0 then
|
||||
elseif B==-1 then
|
||||
gc.line(30*x-25,605-30*y,30*x-5,625-30*y)
|
||||
gc.line(30*x-25,625-30*y,30*x-5,605-30*y)
|
||||
end
|
||||
@@ -424,7 +426,7 @@ function Pnt.draw()
|
||||
gc.setLineWidth(13)
|
||||
gc.setColor(blockColor[pen])
|
||||
gc.rectangle("line",945,605,70,70)
|
||||
elseif pen==0 then
|
||||
elseif pen==-1 then
|
||||
gc.setLineWidth(5)
|
||||
gc.setColor(.9,.9,.9)
|
||||
gc.line(960,620,1000,660)
|
||||
@@ -443,16 +445,11 @@ function Pnt.play()
|
||||
gc.push("transform")
|
||||
gc.origin()
|
||||
gc.setColor(1,1,1,P.result and max(20-P.endCounter,0)*.05 or 1)
|
||||
local h=#P.clearing
|
||||
local F=P.field
|
||||
for j=1,#F do
|
||||
if j==P.clearing[h]and P.falling>-1 then
|
||||
h=h-1
|
||||
else
|
||||
for i=1,10 do if F[j][i]>0 then
|
||||
gc.draw(blockSkinmini[F[j][i]],6*i-6,120-6*j)
|
||||
end end
|
||||
end
|
||||
for i=1,10 do if F[j][i]>0 then
|
||||
gc.draw(blockSkinmini[F[j][i]],6*i-6,120-6*j)
|
||||
end end
|
||||
end--Field
|
||||
if P.alive then
|
||||
gc.setLineWidth(2)
|
||||
@@ -471,6 +468,7 @@ function Pnt.play()
|
||||
end
|
||||
gc.pop()
|
||||
gc.setCanvas()
|
||||
--draw content
|
||||
end
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(P.canvas,P.x,P.y,nil,P.size*10)
|
||||
@@ -479,6 +477,7 @@ function Pnt.play()
|
||||
gc.setColor(1,0,0,min(P.endCounter,25)*.04)
|
||||
gc.circle("line",P.centerX,P.centerY,(840-20*min(P.endCounter,30))*P.size)
|
||||
end
|
||||
--draw Canvas
|
||||
else
|
||||
gc.push("transform")
|
||||
gc.translate(P.x,P.y)gc.scale(P.size)--Position
|
||||
@@ -497,26 +496,24 @@ function Pnt.play()
|
||||
end--Grid lines
|
||||
gc.translate(0,P.fieldBeneath)
|
||||
gc.setScissor(scr.x+P.absFieldX*scr.k,scr.y+P.absFieldY*scr.k,300*P.size*scr.k,610*P.size*scr.k)
|
||||
-- local dy=setting.smo and(P.y_img~=P.curY and min(P.dropDelay,8e98)/P.gameEnv.drop or min(P.lockDelay,8e98)/P.gameEnv.lock)^4*30 or 0
|
||||
local dy,stepY=0,setting.smo and (1-(P.falling/P.gameEnv.fall)^3)*30 or 0
|
||||
local h=#P.clearing
|
||||
local dy,stepY=0,setting.smo and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30
|
||||
local h=1
|
||||
for j=int(P.fieldBeneath/30+1),#P.field do
|
||||
if j==P.clearing[h]and P.falling>-1 then
|
||||
h=h-1
|
||||
while j==P.clearing[h]and P.falling>-1 do
|
||||
h=h+1
|
||||
dy=dy+stepY
|
||||
gc.translate(0,stepY)
|
||||
gc.translate(0,-stepY)
|
||||
gc.setColor(1,1,1,P.falling/P.gameEnv.fall)
|
||||
gc.rectangle("fill",0,600-30*j,320,30-stepY)
|
||||
else
|
||||
for i=1,10 do
|
||||
if P.field[j][i]>0 then
|
||||
gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1))
|
||||
drawPixel(j,i,P.field[j][i])
|
||||
end
|
||||
gc.rectangle("fill",0,630-30*j,320,stepY)
|
||||
end
|
||||
for i=1,10 do
|
||||
if P.field[j][i]>0 then
|
||||
gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1))
|
||||
drawPixel(j,i,P.field[j][i])
|
||||
end
|
||||
end
|
||||
end--Field
|
||||
gc.translate(0,-dy)
|
||||
gc.translate(0,dy)
|
||||
for i=1,#P.shade do
|
||||
local S=P.shade[i]
|
||||
gc.setColor(1,1,1,S[1]*.12)
|
||||
@@ -535,10 +532,28 @@ function Pnt.play()
|
||||
end
|
||||
end end
|
||||
end--Ghost
|
||||
local dy=setting.smo and(P.y_img~=P.curY and min(P.dropDelay,8e98)/P.gameEnv.drop or min(P.lockDelay,8e98)/P.gameEnv.lock)^4*30 or 0
|
||||
-- local dy=setting.smo and(P.y_img~=P.curY and or 1)^4*30 or 0
|
||||
local dy
|
||||
if setting.smo then
|
||||
if P.y_img~=P.curY then
|
||||
dy=(min(P.dropDelay,1e99)/P.gameEnv.drop-1)*30
|
||||
else
|
||||
dy=0
|
||||
end
|
||||
--[[
|
||||
if P.y_img~=P.curY then
|
||||
dy=(min(P.dropDelay,8e98)/P.gameEnv.drop)^4*30
|
||||
else
|
||||
dy=(min(P.lockDelay,8e98)/P.gameEnv.lock)^(P.gameEnv._20G and 3 or 7)*30
|
||||
end
|
||||
]]
|
||||
else
|
||||
dy=0
|
||||
end
|
||||
gc.translate(0,-dy)
|
||||
local trans=P.lockDelay/P.gameEnv.lock
|
||||
if P.gameEnv.block then
|
||||
gc.setColor(1,1,1,P.lockDelay/P.gameEnv.lock)
|
||||
gc.setColor(1,1,1,trans)
|
||||
for i=1,P.r do for j=1,P.c do
|
||||
if P.cur.bk[i][j]then
|
||||
gc.rectangle("fill",30*(j+P.curX-1)-33,597-30*(i+P.curY-1),36,36)
|
||||
@@ -552,7 +567,7 @@ function Pnt.play()
|
||||
end end--Block
|
||||
end
|
||||
if P.gameEnv.center then
|
||||
gc.setColor(1,1,1)
|
||||
gc.setColor(1,1,1,trans)
|
||||
local x=30*(P.curX+P.sc[2]-1)-30+15
|
||||
gc.draw(spinCenter,x,600-30*(P.curY+P.sc[1]-1)+15,nil,nil,nil,4,4)
|
||||
gc.translate(0,dy)
|
||||
@@ -761,10 +776,10 @@ function Pnt.pause()
|
||||
end
|
||||
setFont(40)
|
||||
if system~="Android"then
|
||||
mStr(text.space.."/"..text.enter,640,300)
|
||||
gc.print("ESC",610,598)
|
||||
mStr(text.space.."/"..text.enter,640,335)
|
||||
gc.print("ESC",610,509)
|
||||
end
|
||||
mDraw(gamefinished and drawableText.finish or drawableText.pause,640,140-12*(5-pauseTimer*.1)^2)
|
||||
mDraw(gamefinished and drawableText.finish or drawableText.pause,640,60-10*(5-pauseTimer*.1)^1.5)
|
||||
end
|
||||
function Pnt.setting()
|
||||
gc.setColor(1,1,1)
|
||||
|
||||
122
timer.lua
122
timer.lua
@@ -102,8 +102,12 @@ play=function(dt)
|
||||
end
|
||||
for p=1,#players do
|
||||
P=players[p]
|
||||
if P.keyPressing[1]or P.keyPressing[2]then
|
||||
P.moving=P.moving+(P.moving>0 and 1 or -1)
|
||||
if P.keyPressing[1]then
|
||||
if P.moving>0 then P.moving=0 end
|
||||
P.moving=P.moving-1
|
||||
elseif P.keyPressing[2]then
|
||||
if P.moving<0 then P.moving=0 end
|
||||
P.moving=P.moving+1
|
||||
else
|
||||
P.moving=0
|
||||
end
|
||||
@@ -140,23 +144,15 @@ play=function(dt)
|
||||
end
|
||||
end
|
||||
|
||||
if P.ai and P.waiting==-1 then
|
||||
P.ai.controlDelay=P.ai.controlDelay-1
|
||||
if P.ai.controlDelay==0 then
|
||||
if #P.ai.controls>0 then
|
||||
local C=P.ai.controls
|
||||
pressKey(C[1],P)releaseKey(C[1],P)
|
||||
local k=#C for i=1,k do C[i]=C[i+1]end--table.remove(C,1)
|
||||
P.ai.controlDelay=P.ai.controlDelay0+1
|
||||
else
|
||||
AI_getControls(P.ai.controls)
|
||||
P.ai.controlDelay=P.ai.controlDelay0+2
|
||||
if Timer()-P.modeData.point>P.modeData.event then
|
||||
P.modeData.point=Timer()
|
||||
P.modeData.event=P.ai.controlDelay0+rnd(2,10)
|
||||
changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
||||
end
|
||||
end
|
||||
if not P.human and P.control and P.waiting==-1 then
|
||||
local C=P.AI_keys
|
||||
P.AI_delay=P.AI_delay-1
|
||||
if not C[1]then
|
||||
P.AI_stage=AI_think[P.AI_mode][P.AI_stage](C)
|
||||
elseif P.AI_delay<=0 then
|
||||
pressKey(C[1],P)releaseKey(C[1],P)
|
||||
local k=#C for i=1,k do C[i]=C[i+1]end--table.remove(C,1)
|
||||
P.AI_delay=P.AI_delay0*2
|
||||
end
|
||||
end
|
||||
if not P.keepVisible then
|
||||
@@ -164,21 +160,38 @@ play=function(dt)
|
||||
if P.visTime[j][i]>0 then P.visTime[j][i]=P.visTime[j][i]-1 end
|
||||
end end
|
||||
end--Fresh visible time
|
||||
|
||||
if P.keyPressing[1]or P.keyPressing[2]then
|
||||
P.moving=P.moving+(P.moving>0 and 1 or -1)
|
||||
local d=abs(P.moving)-P.gameEnv.das
|
||||
if d>1 then
|
||||
if P.gameEnv.arr>0 then
|
||||
if d%P.gameEnv.arr==0 then
|
||||
act[P.moving>0 and"moveRight"or"moveLeft"](true)
|
||||
if P.moving<0 then
|
||||
if P.keyPressing[1]then
|
||||
if -P.moving<=P.gameEnv.das then
|
||||
P.moving=P.moving-1
|
||||
elseif P.waiting==-1 then
|
||||
local x=P.curX
|
||||
if P.gameEnv.arr>0 then
|
||||
act.moveLeft(true)
|
||||
else
|
||||
act.insLeft()
|
||||
end
|
||||
else
|
||||
act[P.moving>0 and"insRight"or"insLeft"]()
|
||||
if x~=P.curX then P.moving=P.moving+P.gameEnv.arr-1 end
|
||||
end
|
||||
else
|
||||
P.moving=0
|
||||
end
|
||||
elseif P.moving>0 then
|
||||
if P.keyPressing[2]then
|
||||
if P.moving<=P.gameEnv.das then
|
||||
P.moving=P.moving+1
|
||||
elseif P.waiting==-1 then
|
||||
local x=P.curX
|
||||
if P.gameEnv.arr>0 then
|
||||
act.moveRight(true)
|
||||
else
|
||||
act.insRight()
|
||||
end
|
||||
if x~=P.curX then P.moving=P.moving-P.gameEnv.arr+1 end
|
||||
end
|
||||
else
|
||||
P.moving=0
|
||||
end
|
||||
else
|
||||
P.moving=0
|
||||
end
|
||||
if P.keyPressing[7]and not P.keyPressing[9]then
|
||||
local d=abs(P.downing)-P.gameEnv.sddas
|
||||
@@ -197,16 +210,17 @@ play=function(dt)
|
||||
end
|
||||
if P.falling>=0 then
|
||||
P.falling=P.falling-1
|
||||
if P.falling>=0 then goto stop end
|
||||
if P.human and P.gameEnv.fall>0 and #P.field>P.clearing[1]then SFX("fall")end
|
||||
for i=1,#P.clearing do
|
||||
removeRow(P.field,P.clearing[i])
|
||||
removeRow(P.visTime,P.clearing[i])
|
||||
end
|
||||
for i=1,#P.clearing do
|
||||
P.clearing[i]=nil
|
||||
if P.falling>=0 then
|
||||
goto stop
|
||||
else
|
||||
local L=#P.clearing
|
||||
if P.human and P.gameEnv.fall>0 and #P.field+L>P.clearing[L]then SFX("fall")end
|
||||
for i=1,L do
|
||||
P.clearing[i]=nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if not P.control then goto stop end
|
||||
if P.waiting>=0 then
|
||||
P.waiting=P.waiting-1
|
||||
if P.waiting==-1 then resetblock()end
|
||||
@@ -215,11 +229,17 @@ play=function(dt)
|
||||
if P.curY~=P.y_img then
|
||||
if P.dropDelay>=0 then
|
||||
P.dropDelay=P.dropDelay-1
|
||||
if P.dropDelay>=0 then goto stop end
|
||||
if P.dropDelay>0 then goto stop end
|
||||
end
|
||||
drop()
|
||||
P.curY=P.curY-1
|
||||
P.spinLast=false
|
||||
if P.y_img~=P.curY then
|
||||
P.dropDelay=P.gameEnv.drop
|
||||
elseif P.AI_mode=="CC"then
|
||||
P.AI_needFresh=true
|
||||
if not P.AIdata._20G and P.gameEnv.drop<P.AI_delay0*.5 then
|
||||
CC_switch20G(P)
|
||||
end
|
||||
end
|
||||
if P.freshTime<=P.gameEnv.freshLimit then
|
||||
P.lockDelay=P.gameEnv.lock
|
||||
@@ -228,6 +248,9 @@ play=function(dt)
|
||||
P.lockDelay=P.lockDelay-1
|
||||
if P.lockDelay>=0 then goto stop end
|
||||
drop()
|
||||
if P.AI_mode=="CC"then
|
||||
P.AI_needFresh=true
|
||||
end
|
||||
end
|
||||
::stop::
|
||||
if P.b2b1==P.b2b then
|
||||
@@ -248,14 +271,14 @@ play=function(dt)
|
||||
end
|
||||
if P.falling>=0 then
|
||||
P.falling=P.falling-1
|
||||
if P.falling>=0 then goto stop end
|
||||
if P.human and P.gameEnv.fall>0 and #P.field>P.clearing[1]then SFX("fall")end
|
||||
for i=1,#P.clearing do
|
||||
removeRow(P.field,P.clearing[i])
|
||||
removeRow(P.visTime,P.clearing[i])
|
||||
end
|
||||
for i=1,#P.clearing do
|
||||
P.clearing[i]=nil
|
||||
if P.falling>=0 then
|
||||
goto stop
|
||||
else
|
||||
local L=#P.clearing
|
||||
if P.human and P.gameEnv.fall>0 and #P.field+L>P.clearing[L]then SFX("fall")end
|
||||
for i=1,L do
|
||||
P.clearing[i]=nil
|
||||
end
|
||||
end
|
||||
end::stop::
|
||||
if P.endCounter<40 then
|
||||
@@ -297,6 +320,7 @@ play=function(dt)
|
||||
if b.t>=60 then rem(P.bonus,i)end
|
||||
end
|
||||
end
|
||||
|
||||
for i=#P.atkBuffer,1,-1 do
|
||||
local atk=P.atkBuffer[i]
|
||||
atk.time=atk.time+1
|
||||
|
||||
66
toolfunc.lua
66
toolfunc.lua
@@ -25,6 +25,22 @@ function mDraw(s,x,y)
|
||||
gc.draw(s,x-s:getWidth()*.5,y)
|
||||
end
|
||||
|
||||
function destroyPlayers()
|
||||
if players then
|
||||
for _,P in next,players do if P.id then
|
||||
while P.field[1]do
|
||||
removeRow(P.field)
|
||||
removeRow(P.visTime)
|
||||
end
|
||||
if P.AI_mode=="CC"then
|
||||
BOT.free(P.bot_opt)
|
||||
BOT.free(P.bot_wei)
|
||||
BOT.destroy(P.AI_bot)
|
||||
P.AI_mode=nil
|
||||
end
|
||||
end end
|
||||
end
|
||||
end
|
||||
function getNewRow(val)
|
||||
local t=rem(freeRow)
|
||||
for i=1,10 do
|
||||
@@ -62,11 +78,13 @@ local drawableTextLoad={
|
||||
}
|
||||
function swapLanguage(l)
|
||||
text=require("language/"..langID[l])
|
||||
Buttons.sel=nil
|
||||
for S,L in next,Buttons do
|
||||
for N,B in next,L do
|
||||
B.alpha=0
|
||||
B.t=text.ButtonText[S][N]
|
||||
Widget.sel=nil
|
||||
for S,L in next,Widget do
|
||||
for N,W in next,L do
|
||||
if W.type=="button"then
|
||||
W.alpha=0
|
||||
W.text=text.ButtonText[S][N]
|
||||
end
|
||||
end
|
||||
end
|
||||
gc.push("transform")
|
||||
@@ -101,7 +119,7 @@ function changeBlockSkin(n)
|
||||
gc.setCanvas()
|
||||
end
|
||||
|
||||
local vibrateLevel={0,.02,.03,.04,.05,.06,.07,.08}
|
||||
local vibrateLevel={0,.015,.02,.03,.04,.05,.06,.07,.08,.09}
|
||||
function VIB(t)
|
||||
if setting.vib>0 then
|
||||
love.system.vibrate(vibrateLevel[setting.vib+t])
|
||||
@@ -132,21 +150,25 @@ function VOICE(s,n)
|
||||
end
|
||||
end
|
||||
function BGM(s)
|
||||
if setting.bgm and bgmPlaying~=s then
|
||||
if bgmPlaying then newTask(Event_task.bgmFadeOut,nil,bgmPlaying)end
|
||||
for i=#Task,1,-1 do
|
||||
local T=Task[i]
|
||||
if T.code==Event_task.bgmFadeIn then
|
||||
T.code=Event_task.bgmFadeOut
|
||||
elseif T.code==Event_task.bgmFadeOut and T.data==s then
|
||||
rem(Task,i)
|
||||
if setting.bgm then
|
||||
if bgmPlaying~=s then
|
||||
if bgmPlaying then newTask(Event_task.bgmFadeOut,nil,bgmPlaying)end
|
||||
for i=#Task,1,-1 do
|
||||
local T=Task[i]
|
||||
if T.code==Event_task.bgmFadeIn then
|
||||
T.code=Event_task.bgmFadeOut
|
||||
elseif T.code==Event_task.bgmFadeOut and T.data==s then
|
||||
rem(Task,i)
|
||||
end
|
||||
end
|
||||
if s then
|
||||
newTask(Event_task.bgmFadeIn,nil,s)
|
||||
bgm[s]:play()
|
||||
end
|
||||
bgmPlaying=s
|
||||
else
|
||||
if bgmPlaying then bgm[bgmPlaying]:play()end
|
||||
end
|
||||
if s then
|
||||
newTask(Event_task.bgmFadeIn,nil,s)
|
||||
bgm[s]:play()
|
||||
end
|
||||
bgmPlaying=s
|
||||
end
|
||||
end
|
||||
|
||||
@@ -199,7 +221,7 @@ function gotoScene(s,style)
|
||||
time=swap[style][1],mid=swap[style][2],
|
||||
draw=swap[style].d
|
||||
}
|
||||
Buttons.sel=nil
|
||||
Widget.sel=nil
|
||||
if style~="none"then
|
||||
SFX("swipe")
|
||||
end
|
||||
@@ -218,10 +240,10 @@ local prevMenu={
|
||||
mode="main",
|
||||
custom="mode",
|
||||
draw=function()
|
||||
kb.setKeyRepeat(false)
|
||||
gotoScene("custom")
|
||||
end,
|
||||
play=function()
|
||||
kb.setKeyRepeat(true)
|
||||
updateStat()
|
||||
clearTask("play")
|
||||
gotoScene(curMode.id~="custom"and"mode"or"custom","deck")
|
||||
@@ -249,7 +271,6 @@ function pauseGame()
|
||||
pauseTimer=0--Pause timer for animation
|
||||
if not gamefinished then
|
||||
pauseCount=pauseCount+1
|
||||
if bgmPlaying then bgm[bgmPlaying]:pause()end
|
||||
end
|
||||
for i=1,#players.alive do
|
||||
local l=players.alive[i].keyPressing
|
||||
@@ -262,7 +283,6 @@ function pauseGame()
|
||||
gotoScene("pause","none")
|
||||
end
|
||||
function resumeGame()
|
||||
if bgmPlaying then bgm[bgmPlaying]:play()end
|
||||
gotoScene("play","fade")
|
||||
end
|
||||
local dataOpt={
|
||||
|
||||
@@ -1,27 +1,40 @@
|
||||
return{
|
||||
[=[Future outlook:
|
||||
"classic" rule
|
||||
backfire mode
|
||||
Encrypt source code(JIT to byte code)
|
||||
game recording
|
||||
virtual key switch(all keys)
|
||||
easier CTWC
|
||||
fineese/bigbang mode
|
||||
more FXs
|
||||
TTT mode
|
||||
smarter AI
|
||||
Brand New GUI:
|
||||
custom restart method
|
||||
custom block color/direction
|
||||
custom sequence
|
||||
virtual key switch(all keys)
|
||||
Normal Things:
|
||||
demo play at main menu
|
||||
any screen size
|
||||
CC smarter(think of gaebage buffer)
|
||||
fineese/bigbang mode & easier CTWC
|
||||
new AI:task-Z
|
||||
game recording
|
||||
TTT mode
|
||||
Hard Things:
|
||||
Encrypt source code(JIT to byte code)
|
||||
infinite 1v1
|
||||
square mode
|
||||
3d features
|
||||
layer-feeling
|
||||
more animation]=],[=[
|
||||
more FXs & 3d features & animations]=],[=[
|
||||
0.7.23:
|
||||
remake all BGM!
|
||||
new mode:Master-Final
|
||||
new modes:attacker & defender(not survivor!)
|
||||
add restart button when pause
|
||||
Code Clear added,face it bravely!(Windows only)
|
||||
change falling animation
|
||||
new GUI details
|
||||
louder sound
|
||||
code optimized & many bugs fixed]=],[=[
|
||||
0.7.22:
|
||||
scoring system
|
||||
smooth dropping
|
||||
can change FX level
|
||||
new attaking FX
|
||||
new bone skin
|
||||
baattery info/time display
|
||||
battery info/time display
|
||||
in-game update log(this page)
|
||||
fast game
|
||||
much many more better GUI details
|
||||
|
||||
Reference in New Issue
Block a user