自定义模式允许设置消行任务
This commit is contained in:
@@ -195,7 +195,7 @@ drawableText={
|
||||
win=T(120),finish=T(120),
|
||||
gameover=T(100),pause=T(120),
|
||||
|
||||
custom=T(80),basic=T(35),rule=T(35),field=T(35),
|
||||
custom=T(80),basic=T(35),rule=T(35),field=T(35),mission=T(35),
|
||||
setting_game=T(80),setting_video=T(80),setting_sound=T(80),
|
||||
setting_control=T(70),setting_skin=T(70),
|
||||
preview=T(40),
|
||||
|
||||
@@ -34,6 +34,7 @@ local gameEnv0={
|
||||
hold=true,oncehold=true,
|
||||
ospin=true,
|
||||
sequence="bag",bag={1,2,3,4,5,6,7},
|
||||
mission=NULL,
|
||||
face=NULL,skin=NULL,
|
||||
|
||||
life=0,
|
||||
@@ -45,6 +46,7 @@ local gameEnv0={
|
||||
|
||||
Fkey=NULL,
|
||||
fine=false,fineKill=false,
|
||||
missionKill=false,
|
||||
target=1e99,dropPiece=NULL,
|
||||
mindas=0,minarr=0,minsdarr=0,
|
||||
|
||||
@@ -1205,6 +1207,10 @@ local function applyGameEnv(P)--Finish gameEnv processing
|
||||
end
|
||||
end
|
||||
|
||||
if type(ENV.mission)=="table"then
|
||||
P.missionProgress=0
|
||||
end
|
||||
|
||||
ENV.das=max(ENV.das,ENV.mindas)
|
||||
ENV.arr=max(ENV.arr,ENV.minarr)
|
||||
ENV.sdarr=max(ENV.sdarr,ENV.minsdarr)
|
||||
@@ -2214,7 +2220,7 @@ do--player.drop(P)--Place piece
|
||||
end
|
||||
end
|
||||
|
||||
if cc>0 then
|
||||
if cc>0 then--If lines cleared, about 200 lines below
|
||||
local C=P.lastClear
|
||||
C.id,C.name=CB.id,CB.name
|
||||
C.row=cc
|
||||
@@ -2297,6 +2303,7 @@ do--player.drop(P)--Place piece
|
||||
VOC.play(clearName[cc],CHN)
|
||||
end
|
||||
|
||||
--PC/HPC bonus
|
||||
if clear then
|
||||
if #P.field==0 then
|
||||
P:showText(text.PC,0,-80,50,"flicker")
|
||||
@@ -2332,6 +2339,7 @@ do--player.drop(P)--Place piece
|
||||
C.pc=false
|
||||
end
|
||||
|
||||
--Normal clear, reduce B2B point
|
||||
if not C.special then
|
||||
P.b2b=max(P.b2b-250,0)
|
||||
P:showText(text.clear[cc],0,-30,27+cc*3,"appear",(8-cc)*.3)
|
||||
@@ -2361,6 +2369,7 @@ do--player.drop(P)--Place piece
|
||||
end
|
||||
end
|
||||
|
||||
--Send Lines
|
||||
send=atk
|
||||
if send>0 then
|
||||
if exblock>0 then
|
||||
@@ -2402,13 +2411,47 @@ do--player.drop(P)--Place piece
|
||||
end
|
||||
end
|
||||
|
||||
--Check clearing task
|
||||
if P.missionProgress then
|
||||
local t=P.gameEnv.mission[P.missionProgress+1]
|
||||
local success
|
||||
if t<10 then
|
||||
if C.row==t then
|
||||
success=true
|
||||
end
|
||||
elseif t<90 then
|
||||
if C.row==int(t/10)and C.name==t%10 then
|
||||
success=true
|
||||
end
|
||||
elseif t<99 then
|
||||
if C.row==int(t/10)then
|
||||
success=true
|
||||
end
|
||||
elseif t==99 then
|
||||
if C.pc then
|
||||
success=true
|
||||
end
|
||||
end
|
||||
if success then
|
||||
P.missionProgress=P.missionProgress+1
|
||||
if P.missionProgress==#P.gameEnv.mission then
|
||||
P:win()
|
||||
end
|
||||
elseif P.gameEnv.missionKill then
|
||||
P:showText(text.missionFailed,0,200,40,"flicker",.5)
|
||||
SFX.play("finesseError_long",.6)
|
||||
P:lose()
|
||||
end
|
||||
end
|
||||
|
||||
--SFX & Vibrate
|
||||
if P.human then
|
||||
SFX.play(clear_n[cc])
|
||||
SFX.play(ren_n[min(cmb,11)])
|
||||
if cmb>14 then SFX.play("ren_mega",(cmb-10)*.1)end
|
||||
VIB(cc+1)
|
||||
end
|
||||
else
|
||||
else--No lines clear
|
||||
cmb=0
|
||||
local dropScore=10
|
||||
|
||||
|
||||
154
parts/scenes.lua
154
parts/scenes.lua
@@ -1229,7 +1229,7 @@ do--custom_norm
|
||||
function keyDown.custom_norm(key)
|
||||
if key=="tab"then
|
||||
if kb.isDown("lshift","rshift")then
|
||||
SCN.swapTo("custom_draw","swipeR")
|
||||
SCN.swapTo("custom_mission","swipeR")
|
||||
else
|
||||
SCN.swapTo("custom_rule","swipeL")
|
||||
end
|
||||
@@ -1477,7 +1477,7 @@ do--custom_draw
|
||||
if kb.isDown("lshift","rshift")then
|
||||
SCN.swapTo("custom_seq","swipeR")
|
||||
else
|
||||
SCN.swapTo("custom_norm","swipeL")
|
||||
SCN.swapTo("custom_mission","swipeL")
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
@@ -1583,6 +1583,156 @@ do--custom_draw
|
||||
end
|
||||
end
|
||||
end
|
||||
do--custom_mission
|
||||
function sceneInit.custom_mission()
|
||||
sceneTemp={
|
||||
input="",
|
||||
cur=#preMission,
|
||||
sure=0,
|
||||
}
|
||||
end
|
||||
|
||||
local clear={
|
||||
Z1=11,Z2=21,Z3=31,
|
||||
S1=12,S2=22,S3=32,
|
||||
J1=13,J2=23,J3=33,
|
||||
L1=14,L2=24,L3=34,
|
||||
T1=15,T2=25,T3=35,
|
||||
O1=16,O2=26,O3=36,O4=46,
|
||||
I1=17,I2=27,I3=37,I4=47,
|
||||
A1=91,A2=92,A3=93,A4=94,
|
||||
_1=01,_2=02,_3=03,_4=04,
|
||||
PC=99,
|
||||
[11]="Z1",[21]="Z2",[31]="Z3",
|
||||
[12]="S1",[22]="S2",[32]="S3",
|
||||
[13]="J1",[23]="J2",[33]="J3",
|
||||
[14]="L1",[24]="L2",[34]="L3",
|
||||
[15]="T1",[25]="T2",[35]="T3",
|
||||
[16]="O1",[26]="O2",[36]="O3",[46]="O4",
|
||||
[17]="I1",[27]="I2",[37]="I3",[47]="I4",
|
||||
[91]="A1",[92]="A2",[93]="A3",[94]="A4",
|
||||
[01]="_1",[02]="_2",[03]="_3",[04]="_4",
|
||||
[99]="PC",
|
||||
}
|
||||
local legalInput={Z=true,S=true,J=true,L=true,T=true,O=true,I=true,A=true,_=true,P=true}
|
||||
function keyDown.custom_mission(key)
|
||||
local S=sceneTemp
|
||||
if key=="left"then
|
||||
S.cur=S.cur-1
|
||||
if S.cur==-1 then
|
||||
S.cur=#preMission
|
||||
end
|
||||
elseif key=="right"then
|
||||
S.cur=S.cur+1
|
||||
if S.cur>#preMission then
|
||||
S.cur=0
|
||||
end
|
||||
elseif key=="ten"then
|
||||
S.cur=min(S.cur+10,#preMission)
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
if #preMission>0 then
|
||||
sys.setClipboardText("Techmino Target:"..copyTarget())
|
||||
LOG.print(text.copySuccess,color.green)
|
||||
end
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p=string.find(str,":")--ptr*
|
||||
if p then str=string.sub(str,p+1)end
|
||||
if not pasteTarget(str)then
|
||||
LOG.print(text.dataCorrupted,color.red)
|
||||
end
|
||||
elseif key=="backspace"then
|
||||
if S.cur>0 then
|
||||
rem(preMission,S.cur)
|
||||
S.cur=S.cur-1
|
||||
end
|
||||
elseif key=="delete"then
|
||||
if S.sure>20 then
|
||||
preMission={}
|
||||
S.cur=0
|
||||
S.sure=0
|
||||
SFX.play("finesseError",.7)
|
||||
else
|
||||
S.sure=50
|
||||
end
|
||||
elseif key=="tab"then
|
||||
if kb.isDown("lshift","rshift")then
|
||||
SCN.swapTo("custom_draw","swipeR")
|
||||
else
|
||||
SCN.swapTo("custom_norm","swipeL")
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
elseif type(key)=="number"then
|
||||
S.cur=S.cur+1
|
||||
ins(preMission,S.cur,key)
|
||||
else
|
||||
if key=="space"then
|
||||
key="_"
|
||||
else
|
||||
key=string.upper(key)
|
||||
end
|
||||
|
||||
local input=S.input
|
||||
input=input..key
|
||||
if clear[input]then
|
||||
input=""
|
||||
ins(preMission,clear[input])
|
||||
elseif #input>1 or not legalInput[input]then
|
||||
input=""
|
||||
end
|
||||
S.input=input
|
||||
end
|
||||
end
|
||||
|
||||
function Tmr.custom_mission()
|
||||
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end
|
||||
end
|
||||
|
||||
function Pnt.custom_mission()
|
||||
local S=sceneTemp
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(drawableText.custom,20,5)
|
||||
gc.setColor(.7,.7,.7)
|
||||
gc.draw(drawableText.mission,585,50)
|
||||
|
||||
--Draw frame
|
||||
gc.setLineWidth(4)
|
||||
gc.setColor(1,1,1)
|
||||
gc.rectangle("line",60,110,1160,170)
|
||||
|
||||
--Draw inputing target
|
||||
setFont(30)
|
||||
gc.setColor(.1,.9,.1)
|
||||
gc.print(S.input,1200,270)
|
||||
|
||||
--Draw targets
|
||||
gc.setColor(1,1,1)
|
||||
setFont(35)
|
||||
local x,y=100,136--Next block pos
|
||||
local cx,cy=100,136--Cursor-center pos
|
||||
for i=1,#preMission do
|
||||
gc.print(clear[preMission[i]],x,y-25)
|
||||
x=x+55
|
||||
if x>1160 then
|
||||
x,y=100,y+50
|
||||
end
|
||||
if i==S.cur then
|
||||
cx,cy=x,y
|
||||
end
|
||||
end
|
||||
|
||||
--Draw cursor
|
||||
gc.setColor(1,1,.4,.6+.4*sin(Timer()*6.26))
|
||||
gc.line(cx-5,cy-20,cx-5,cy+20)
|
||||
|
||||
--Confirm reset
|
||||
if S.sure>0 then
|
||||
gc.setColor(1,1,1,S.sure*.02)
|
||||
gc.draw(drawableText.question,980,570)
|
||||
end
|
||||
end
|
||||
end
|
||||
do--play
|
||||
local function onVirtualkey(x,y)
|
||||
local dist,nearest=1e10
|
||||
|
||||
Reference in New Issue
Block a user