Alpha V0.7.7

This commit is contained in:
MrZ_26
2020-02-04 19:31:17 +08:00
parent 1b0ad009b0
commit c35152cf6e
13 changed files with 388 additions and 239 deletions

286
main.lua
View File

@@ -25,7 +25,6 @@ system=sys.getOS()
touching=nil--1st touching ID
scene=""
gameMode=""
bgmPlaying=nil
curBG="none"
BGblock={ct=150,next=7}
@@ -98,7 +97,7 @@ loadmode={
end,
solo=function()
createPlayer(1,20,15)--Player
createPlayer(2,660,85,.9,customRange.opponent[3*gameLevel])--AI
createPlayer(2,660,85,.9,customRange.opponent[3*curMode.lv])--AI
curBG="game2"
BGM("race")
end,
@@ -110,13 +109,45 @@ loadmode={
tsd=function()
createPlayer(1,340,15)
curBG="matrix"
BGM("infinite")
BGM("reason")
end,
blind=function()
createPlayer(1,340,15)
curBG="glow"
BGM("push")
end,
dig=function()
createPlayer(1,340,15)
local P=players[1]
if curMode.lv==1 then
ins(players[1].task,Event.task.dig_normal)
pushSpeed=1
elseif curMode.lv==2 then
ins(players[1].task,Event.task.dig_lunatic)
pushSpeed=1
end
curBG="game2"
BGM("push")
end,
survivor=function()
createPlayer(1,340,15)
local P=players[1]
if curMode.lv==1 then
ins(players[1].task,Event.task.survivor_easy)
pushSpeed=1
elseif curMode.lv==2 then
ins(players[1].task,Event.task.survivor_normal)
pushSpeed=1
elseif curMode.lv==3 then
ins(players[1].task,Event.task.survivor_hard)
pushSpeed=2
elseif curMode.lv==4 then
ins(players[1].task,Event.task.survivor_lunatic)
pushSpeed=2
end
curBG="game2"
BGM("push")
end,
sudden=function()
createPlayer(1,340,15)
curBG="matrix"
@@ -142,17 +173,17 @@ loadmode={
end,
techmino41=function()
createPlayer(1,340,15)--Player
if gameLevel==5 then players[1].gameEnv.drop=15 end
if curMode.lv==5 then players[1].gameEnv.drop=15 end
local n,min,max=2
if gameLevel==1 then
if curMode.lv==1 then
min,max=5,30
elseif gameLevel==2 then
elseif curMode.lv==2 then
min,max=3,25
elseif gameLevel==3 then
elseif curMode.lv==3 then
min,max=2,20
elseif gameLevel==4 then
elseif curMode.lv==4 then
min,max=2,10
elseif gameLevel==5 then
elseif curMode.lv==5 then
min,max=1,6
end
for i=1,4 do
@@ -173,17 +204,17 @@ loadmode={
end,
techmino99=function()
createPlayer(1,340,15)--Player
if gameLevel==5 then players[1].gameEnv.drop=15 end
if curMode.lv==5 then players[1].gameEnv.drop=15 end
local n,min,max=2
if gameLevel==1 then
if curMode.lv==1 then
min,max=5,32
elseif gameLevel==2 then
elseif curMode.lv==2 then
min,max=3,25
elseif gameLevel==3 then
elseif curMode.lv==3 then
min,max=2,18
elseif gameLevel==4 then
elseif curMode.lv==4 then
min,max=2,12
elseif gameLevel==5 then
elseif curMode.lv==5 then
min,max=1,12
end
for i=1,7 do
@@ -212,27 +243,20 @@ loadmode={
curBG="glow"
BGM("push")
end,
p2=function()
createPlayer(1,20,15)
createPlayer(2,650,15)
curBG="game2"
BGM("way")
end,
p3=function()
createPlayer(1,20,100,.65)
createPlayer(2,435,100,.65)
createPlayer(3,850,100,.65)
curBG="game2"
BGM("way")
end,
p4=function()
createPlayer(1,25,150,.5)
createPlayer(2,335,150,.5)
createPlayer(3,645,150,.5)
createPlayer(4,955,150,.5)
hotseat=function()
if curMode.lv==1 then
createPlayer(1,20,15)
createPlayer(2,650,15)
elseif curMode.lv==2 then
createPlayer(1,20,100,.65)
createPlayer(2,435,100,.65)
createPlayer(3,850,100,.65)
elseif curMode.lv==3 then
createPlayer(1,25,160,.5)
createPlayer(2,335,160,.5)
createPlayer(3,645,160,.5)
createPlayer(4,955,160,.5)
end
curBG="game2"
BGM("way")
end,
@@ -278,12 +302,6 @@ mesDisp={
mStr(P.gameEnv.target,-75,370)
gc.rectangle("fill",-120,376,90,4)
end,
death=function()
setFont(50)
mStr(P.cstat.row,-75,320)
mStr(P.gameEnv.target,-75,370)
gc.rectangle("fill",-120,376,90,4)
end,
tsd=function()
setFont(35)
gc.print("TSD",-102,405)
@@ -298,6 +316,18 @@ mesDisp={
mStr(P.cstat.row,-75,220)
mStr(P.cstat.techrash,-75,340)
end,
dig=function()
setFont(70)
mStr(P.cstat.event,-75,310)
setFont(30)
gc.print("Wave",-112,375)
end,
survivor=function()
setFont(70)
mStr(P.cstat.event,-75,310)
setFont(30)
gc.print("Wave",-112,375)
end,
pctrain=function()
setFont(25)
gc.print("Perfect Clear",-140,410)
@@ -346,12 +376,6 @@ mesDisp={
setFont(75)
mStr(max(100-P.cstat.row,0),-75,280)
end,
gmroll=function()
setFont(25)
gc.print("Techrash",-123,420)
setFont(80)
mStr(P.cstat.techrash,-75,340)
end,
custom=function()
if P.gameEnv.target<1e4 then
setFont(75)
@@ -367,8 +391,14 @@ Event={
P.timing=false
P.waiting=1e99
P.b2b=0
P.result="WIN"
changeAtk(P)
if modeEnv.royaleMode then
P.rank=#players.alive
P.result="WIN"
changeAtk(P)
end
while P.task[1]do
rem(P.task)
end
for i=1,#P.atkBuffer do
P.atkBuffer[i].sent=true
P.atkBuffer[i].time=0
@@ -388,16 +418,19 @@ Event={
P.timing=false
P.waiting=1e99
P.b2b=0
P.result="K.O."
showText(P,"LOSE","appear",90,nil,nil,true)
while P.task[1]do
rem(P.task)
end
for i=1,#players.alive do
if players.alive[i]==P then
rem(players.alive,i)
break
end
end
changeAtk(P)
if modeEnv.royaleMode then
changeAtk(P)
P.result="K.O."
P.rank=#players.alive
P.strength=0
if P.lastRecv and P.lastRecv.alive then
local A=P.lastRecv
@@ -412,7 +445,7 @@ Event={
end
end
end
freshRoyaleTarget()
freshMostBadge()
for i=1,#players.alive do
if players.alive[i].atking==P then
freshTarget(players.alive[i])
@@ -431,6 +464,7 @@ Event={
P.visTime[i][j]=min(P.visTime[i][j],20)
end
end
showText(P,"LOSE","appear",90,nil,nil,true)
if P.id==1 and players[2]and players[2].ai then SFX("fail")end
ins(P.task,Event.task.lose)
if #players.alive==1 then
@@ -449,7 +483,7 @@ Event={
SFX("reach")
end
end,
death_reach=function()
marathon_reach_lunatic=function()
if P.gameEnv.target==250 then
Event.gameover.win()
else
@@ -467,7 +501,7 @@ Event={
Event.gameover.lose()
else
P.gameEnv.target=P.gameEnv.target+2
if #P.field>10 and P.gameEnv.target%10~=0 then
if P.cstat.row%10~=0 then
ins(P.clearing,1)
end
end
@@ -477,31 +511,45 @@ Event={
Event.gameover.lose()
end
end,
sudden_reach_HARD=function()
sudden_reach_hard=function()
if #P.clearing>0 and P.lastClear<10 and P.lastClear~=74 then
Event.gameover.lose()
end
end,
newPC=function()
local P=players[1]
if #P.field==#P.clearing then
P.counter=P.cstat.piece==0 and 19 or 0
ins(P.task,Event.task.PC)
if gameLevel==2 then
local s=P.cstat.pc*.5
if int(s)==s and s>0 then
P.gameEnv.drop=pc_drop[s]or 10
P.gameEnv.lock=pc_lock[s]or 20
P.gameEnv.fall=pc_fall[s]or 5
if s==10 then
showText(P,"Max speed","appear",80,-120)
else
showText(P,"Speed up","appear",30,-130)
if P.cstat.piece%4==0 then
if #P.field==#P.clearing then
P.counter=P.cstat.piece==0 and 19 or 0
ins(P.task,Event.task.PC)
if curMode.lv==2 then
local s=P.cstat.pc*.5
if int(s)==s and s>0 then
P.gameEnv.drop=pc_drop[s]or 10
P.gameEnv.lock=pc_lock[s]or 20
P.gameEnv.fall=pc_fall[s]or 5
if s==10 then
showText(P,"Max speed","appear",80,-120)
else
showText(P,"Speed up","appear",30,-130)
end
end
end
local r=rnd(#PClist)
local f=P.cstat.pc%2==0
for i=1,4 do
local b=PClist[r][i]
if f then
if b<3 then b=3-b
elseif b<5 then b=7-b
end
end
ins(P.nxt,b)
ins(P.nb,blocks[b][0])
end
else
Event.gameover.lose()
end
else
Event.gameover.lose()
end
end,
task={
@@ -510,8 +558,8 @@ Event={
return true
end,
win=function()
P.counter=P.counter+1
if P.counter>80 then
P.endCounter=P.endCounter+1
if P.endCounter>80 then
if P.gameEnv.visible==1 then
for i=1,#P.field do
for j=1,10 do
@@ -520,21 +568,21 @@ Event={
end
end
end
if P.counter==100 then
if P.endCounter==100 then
for i=1,#P.field do
removeRow(P.field)
removeRow(P.visTime)
end
return true
end
elseif P.counter==100 then
elseif P.endCounter==100 then
return true
end
end
end,
lose=function()
P.counter=P.counter+1
if P.counter>80 then
P.endCounter=P.endCounter+1
if P.endCounter>80 then
if P.gameEnv.visible==1 then
for i=1,#P.field do
for j=1,10 do
@@ -543,26 +591,98 @@ Event={
end
end
end
if P.counter==100 then
if P.endCounter==100 then
for i=1,#P.field do
removeRow(P.field)
removeRow(P.visTime)
end
return true
end
elseif P.counter==100 then
elseif P.endCounter==100 then
return true
end
end
end,
garbagepush=function()
dig_normal=function()
local P=players[1]
P.counter=P.counter+1
if #P.clearing==0 and P.counter>=max(90,180-2*P.cstat.event)then
ins(P.field,1,getNewRow(13))
ins(P.visTime,1,getNewRow(1e99))
P.field[1][rnd(10)]=0
P.fieldBeneath=P.fieldBeneath+30
P.cy,P.y_img=P.cy+1,P.y_img+1
P.counter=0
P.cstat.event=P.cstat.event+1
end
end,
dig_lunatic=function()
local P=players[1]
P.counter=P.counter+1
if #P.clearing==0 and P.counter>=max(40,60-.5*P.cstat.event)then
ins(P.field,1,getNewRow(13))
ins(P.visTime,1,getNewRow(1e99))
P.field[1][rnd(10)]=0
P.fieldBeneath=P.fieldBeneath+30
P.cy,P.y_img=P.cy+1,P.y_img+1
P.counter=0
P.cstat.event=P.cstat.event+1
end
end,
survivor_easy=function()
local P=players[1]
P.counter=P.counter+1
if P.counter==max(60,180-2*P.cstat.event)then
ins(P.atkBuffer,{rnd(10),amount=1,countdown=0,cd0=0,time=0,sent=false,lv=1})
P.counter=0
P.cstat.event=P.cstat.event+1
end
end,
survivor_normal=function()
local P=players[1]
P.counter=P.counter+1
if P.counter==max(60,180-2*P.cstat.event)then
local d=P.cstat.event
if rnd()<.33 then
ins(P.atkBuffer,{rnd(10),amount=1,countdown=20,cd0=20,time=0,sent=false,lv=1})
elseif rnd()<.33 then
ins(P.atkBuffer,{rnd(10),amount=2,countdown=40,cd0=40,time=0,sent=false,lv=1})
elseif rnd()<.5 then
ins(P.atkBuffer,{rnd(10),amount=3,countdown=60,cd0=60,time=0,sent=false,lv=2})
else
ins(P.atkBuffer,{rnd(10),amount=4,countdown=90,cd0=90,time=0,sent=false,lv=3})
end
P.counter=0
P.cstat.event=P.cstat.event+1
end
end,
survivor_hard=function()
local P=players[1]
P.counter=P.counter+1
if P.counter==max(80,150-2*P.cstat.event)then
if rnd()<.33 then
ins(P.atkBuffer,{rnd(10),amount=1,countdown=0,cd0=0,time=0,sent=false,lv=1})
else
ins(P.atkBuffer,{rnd(10),amount=3,countdown=0,cd0=0,time=0,sent=false,lv=1})
end
P.counter=0
P.cstat.event=P.cstat.event+1
end
end,
survivor_lunatic=function()
local P=players[1]
P.counter=P.counter+1
if P.counter==max(90,150-P.cstat.event)then
local t=max(30,90-2*P.cstat.event)
ins(P.atkBuffer,{rnd(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3})
P.counter=0
P.cstat.event=P.cstat.event+1
end
end,
PC=function()
local P=players[1]
P.counter=P.counter+1
if P.counter==21 then
P.gameEnv.target=P.gameEnv.target+4
local t=P.cstat.pc%2
for i=1,4 do
local r=getNewRow()