Skip to content

Commit

Permalink
实现教程第五关
Browse files Browse the repository at this point in the history
调整一些教程相关文本
  • Loading branch information
MrZ626 committed Sep 20, 2024
1 parent 8ff8621 commit ff56a15
Show file tree
Hide file tree
Showing 8 changed files with 310 additions and 56 deletions.
2 changes: 1 addition & 1 deletion assets/game/mode/brik/interior/tutorial/1.basic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ return {
"sfx finish_win",

{cmd='say',arg={duration='6.26s',text="@tutorial_pass",size=60,k=2,type='bold',style='beat',c=COLOR.lG,y=-30}},
{cmd=function(P) if P.isMain then PROGRESS.setTutorialPassed(1,1) end end},
{cmd=function(P) PROGRESS.setTutorialPassed(1,1) end},
"finish win",
},
}},
Expand Down
4 changes: 2 additions & 2 deletions assets/game/mode/brik/interior/tutorial/2.sequence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ return {

"jeq extra,extra,true",
{cmd='say',arg={duration='6.26s',text="@tutorial_pass",size=60,k=2,type='bold',style='beat',c=COLOR.lG,y=-30}},
{cmd=function(P) if P.isMain then PROGRESS.setTutorialPassed(2,1) end end},
{cmd=function(P) PROGRESS.setTutorialPassed(2,1) end},
"j end",
"extra:",
{cmd='say',arg={duration='6.26s',text="@tutorial_pass",size=60,k=2,type='bold',style='beat',c=COLOR.lY,y=-30}},
{cmd=function(P) if P.isMain then PROGRESS.setTutorialPassed(2,2) end end},
{cmd=function(P) PROGRESS.setTutorialPassed(2,2) end},
"end:",
"finish win",
},
Expand Down
2 changes: 1 addition & 1 deletion assets/game/mode/brik/interior/tutorial/4.finesseBasic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ return {
script={
{cmd='say',arg={duration='1.5s',text="@tutorial_finesseBasic_1",y=-60}},
-- {cmd='say',arg={duration='6.26s',text="@tutorial_pass",size=60,k=2,type='bold',style='beat',c=COLOR.lG,y=-30}},
-- {cmd=function(P) if P.isMain then PROGRESS.setTutorialPassed(4,1) end end},
-- {cmd=function(P) PROGRESS.setTutorialPassed(4,1) end},
-- "finish win",
},
}},
Expand Down
219 changes: 219 additions & 0 deletions assets/game/mode/brik/interior/tutorial/5.finessePractice.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
local finesseData={
{
{1,2,1,0,1,2,2,1},
{2,2,2,1,1,2,3,2,2},
{1,2,1,0,1,2,2,1},
{2,2,2,1,1,2,3,2,2},
}, -- Z
{
{1,2,1,0,1,2,2,1},
{2,2,2,1,1,2,3,2,2},
{1,2,1,0,1,2,2,1},
{2,2,2,1,1,2,3,2,2},
}, -- S
{
{1,2,1,0,1,2,2,1},
{2,2,3,2,1,2,3,3,2},
{3,4,3,2,3,4,4,3},
{2,3,2,1,2,3,3,2,2},
}, -- J
{
{1,2,1,0,1,2,2,1},
{2,2,3,2,1,2,3,3,2},
{3,4,3,2,3,4,4,3},
{2,3,2,1,2,3,3,2,2},
}, -- L
{
{1,2,1,0,1,2,2,1},
{2,2,3,2,1,2,3,3,2},
{3,4,3,2,3,4,4,3},
{2,3,2,1,2,3,3,2,2},
}, -- T
{
{1,2,2,1,0,1,2,2,1},
{1,2,2,1,0,1,2,2,1},
{1,2,2,1,0,1,2,2,1},
{1,2,2,1,0,1,2,2,1},
}, -- O
{
{1,2,1,0,1,2,1},
{2,2,2,2,1,1,2,2,2,2},
{1,2,1,0,1,2,1},
{2,2,2,2,1,1,2,2,2,2},
}, -- I
}
local function pushFinesseTarget(P,n)
---@cast P Techmino.Player.Brik
local piece=P.nextQueue[n]
---@cast piece Techmino.Piece
local matrix=TABLE.copy(piece.matrix)
local dir=MATH.selectFreq(P:random(),{3,5,2,5})-1
if P:random()*62>P.modeData.finesseCombo then dir=(dir+1)%4 end
for _=1,dir do matrix=TABLE.rotate(matrix,'R') end
local xList=TABLE.copy(finesseData[piece.shape][dir+1])
local freqFinetune=-math.min(unpack(xList))*0.626+math.max(10-P.modeData.finesseCombo/2.6,0)
for i=1,#xList do
xList[i]=xList[i]+freqFinetune
end
local x=MATH.selectFreq(P:random()*MATH.sum(xList),xList)
table.insert(P.modeData.targetPreview,{
x=x,
matrix=matrix,
best=finesseData[piece.shape][dir+1][x]
})
end
local function compMatrix(mat1,mat2)
for y=1,#mat1 do
for x=1,#mat1[y] do
if mat1[y][x] and not mat2[y][x] then
return false
end
end
end
return true
end
---@type Techmino.Mode
return {
initialize=function()
GAME.newPlayer(1,'brik')
GAME.setMain(1)
playBgm('space')
end,
settings={brik={
skin='brik_interior',
clearMovement='teleBack',
particles=false,
shakeness=0,
bufferMove=false,
bufferRotate=false,
dropDelay=1e99,
lockDelay=1e99,
nextSlot=3,
holdSlot=0,
soundEvent={
countDown=NULL,
drop=gameSoundFunc.drop_old,
},
event={
playerInit=function(P)
P.modeData.curKeyCount=0
P.modeData.finesseCombo=0
P.modeData.display=false
P.modeData.correct=true
P.modeData.protect=false

P:switchAction('holdPiece',false)
P:switchAction('softDrop',false)
P.modeData.targetPreview={}
for i=1,3 do pushFinesseTarget(P,i) end

PROGRESS.setInteriorScore('tuto7_score',0)
PROGRESS.setInteriorScore('tuto7_time',2600,'<')
end,
afterResetPos=function(P)
P.modeData.curKeyCount=0
if P.modeData.correct then
pushFinesseTarget(P,3)
P.modeData.correct=false
end
TABLE.clear(P.field._matrix)
P:freshGhost()
end,
beforePress=function(P,act)
P.modeData.curKeyCount=P.modeData.curKeyCount+(
act=='moveLeft' and 1 or
act=='moveRight' and 1 or
act=='rotateCW' and 1 or
act=='rotateCCW' and 1 or
act=='rotate180' and 2 or
0
)
end,
afterDrop=function(P)
local target=P.modeData.targetPreview[1]
-- Position check
local posSucc=P.handX==target.x
if posSucc and not compMatrix(P.hand.matrix,target.matrix) then posSucc=false end

-- Key count check
local keySucc=P.modeData.curKeyCount<=target.best

if posSucc and keySucc then
-- Correct
P.modeData.finesseCombo=P.modeData.finesseCombo+1
PROGRESS.setInteriorScore('tuto5_score',P.modeData.finesseCombo)
if P.modeData.finesseCombo==99 then
PROGRESS.setInteriorScore('tuto5_time',P.modeData.finesseCombo)
P.modeData.display=STRING.time(P.gameTime/1000)
P:finish('win')
end
table.remove(P.modeData.targetPreview,1)
P.modeData.correct=true
P.modeData.protect=false
else
-- Wrong: restore piece & reduce combo
P:restoreBrikState(P.hand)
table.insert(P.nextQueue,1,P.hand)
P.hand=nil
P:playSound(posSucc and 'rotate_failed' or 'move_failed',2)
if not P.modeData.protect then
P.modeData.finesseCombo=math.max(P.modeData.finesseCombo-6,0)
P.modeData.protect=true
end
end
end,
drawBelowBlock=function(P)
local alpha=MATH.interpolate(26,.42,94.2,0,P.modeData.finesseCombo)
GC.setColor(1,1,1,alpha)
GC.line(120,0,120,-888)
GC.line(240,0,240,-888)
GC.setColor(1,1,1,alpha*.126)
GC.rectangle('fill',120,0,120,-888)
end,
drawInField=function(P)
GC.setLineWidth(6)
local dy=0
for i=1,3 do
local p=P.modeData.targetPreview[i]
GC.setColor(1,1,1,.872-.226*i)
for y=1,#p.matrix do
for x=1,#p.matrix[y] do
if p.matrix[y][x] then
GC.rectangle('line',40*(p.x+x-2)+7,-40*(y+dy)+7,40-14,40-14)
end
end
end
dy=dy+#p.matrix+1
end
end,
drawOnPlayer=function(P)
GC.setColor(P.modeData.display and 0.62 or 1,1,1,P.modeData.protect and .5 or 1)
FONT.set(80) GC.mStr(P.modeData.finesseCombo,-300,-70)
FONT.set(30) GC.mStr(Text.target_combo,-300,20)
FONT.set(20)
GC.setColor(1,1,1,.872)
if P.modeData.display then
GC.mStr(P.modeData.display,-300,60)
elseif PROGRESS.getInteriorScore('tuto5_score')<99 then
GC.mStr(PROGRESS.getInteriorScore('tuto5_score'),-300,60)
else
GC.mStr(STRING.time(PROGRESS.getInteriorScore('tuto5_time')),-300,60)
end

if P.modeData.finesseCombo<=62 or P.modeData.protect then
GC.setColor(COLOR.lD)
FONT.set(50)
GC.print(P.modeData.curKeyCount,-340-5,140)
GC.print("/",-305-5,135)
GC.print(P.modeData.targetPreview[1].best,-280-5,140)
FONT.set(30) GC.mStr(Text.tutorial_finessePractice_par,-300,205)
end
end,
},
script={
{cmd='say',arg={duration='4.2s',text="@tutorial_finessePractice_1",size=60,type='bold',y=-80}},
{cmd='say',arg={duration='4.2s',text="@tutorial_finessePractice_2",size=30,y=60}},
},
}},
result=autoBack_interior,
}
23 changes: 13 additions & 10 deletions assets/game/mode/brik/interior/tutorial/7.techrashPractice.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ return {
P.modeData.multiplier=1
P.modeData.protect=false
P.modeData.display=false
PROGRESS.setInteriorScore('tuto_B3_score',0)
PROGRESS.setInteriorScore('tuto_B3_time',2600,'<')
PROGRESS.setInteriorScore('tuto7_score',0)
PROGRESS.setInteriorScore('tuto7_time',2600,'<')
end,
afterClear=function(P,clear)
if clear.line<4 then
Expand All @@ -46,12 +46,11 @@ return {
local s1=P.modeData.score
local s2=math.min(s1+P.modeData.multiplier*math.min(P.combo,10),99)
P.modeData.score=s2
PROGRESS.setInteriorScore('tuto_B3_score',s2)
PROGRESS.setInteriorScore('tuto7_score',s2)
if s2>=99 then
if not P.modeData.display then
PROGRESS.setInteriorScore('tuto_B3_time',P.gameTime/1000,'<')
P.modeData.display=STRING.time(P.gameTime/1000)
end
PROGRESS.setInteriorScore('tuto7_time',P.gameTime/1000,'<')
P.modeData.display=STRING.time(P.gameTime/1000)
P:finish('win')
elseif s1<62 and s2>=62 then
P.settings.holdSlot=0
P.holdQueue[1]=nil
Expand All @@ -71,13 +70,17 @@ return {
GC.setColor(1,1,1,.872)
if P.modeData.display then
GC.mStr(P.modeData.display,-300,60)
elseif PROGRESS.getInteriorScore('tuto_B3_score')<99 then
GC.mStr(PROGRESS.getInteriorScore('tuto_B3_score'),-300,60)
elseif PROGRESS.getInteriorScore('tuto7_score')<99 then
GC.mStr(PROGRESS.getInteriorScore('tuto7_score'),-300,60)
else
GC.mStr(STRING.time(PROGRESS.getInteriorScore('tuto_B3_time')),-300,60)
GC.mStr(STRING.time(PROGRESS.getInteriorScore('tuto7_time')),-300,60)
end
end,
},
script={
{cmd='say',arg={duration='4.2s',text="@tutorial_techrashPractice_1",size=60,type='bold',y=-80}},
{cmd='say',arg={duration='4.2s',text="@tutorial_techrashPractice_2",size=30,y=60}},
},
}},
result=autoBack_interior,
}
52 changes: 34 additions & 18 deletions assets/language/lang_en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ local L={
target_line="Line",
target_time="Time",
target_score="Score",
target_combo="Combo",
target_ac="AC",
target_hc="HC",
target_tss="TSS",
Expand Down Expand Up @@ -121,7 +122,7 @@ local L={
setting_fmod_DSPBufferLength="DSPBufferLength",
setting_apply="Apply",

lang_note="Chinese is the original game language.\nAll translations are contributed by volunteers and it may not be 100% accurate\nThere are some terms not translated directly, please check Zictionary for more information.",
lang_note="Chinese is the original game language.\nAll translations are contributed by volunteers and it may not be 100% accurate\nThere are some terms not translated directly, please check Zictionary for more information",

keyset_title="Keybinds",
keyset_brik_moveLeft= "Move Left",
Expand Down Expand Up @@ -302,35 +303,50 @@ local L={
},

-- Level
tutorial_basic="The Basics (WIP)",
tutorial_sequence="Next & Hold",
tutorial_stackBasic="Basic Stacking",
tutorial_finesseBasic="Basic Finesse (WIP)",
tutorial_finessePractice="Finesse Practice (WIP)",
tutorial_allclearPractice="All Clear Practice (WIP)",
tutorial_techrashPractice="Techrash Only",
tutorial_finessePlus="Elegant Stack (WIP)",
tutorial_basic="1. The Basics (WIP)",
tutorial_sequence="2. Next & Hold",
tutorial_stackBasic="3. Basic Stacking",
tutorial_finesseBasic="4. Basic Finesse (WIP)",
tutorial_finessePractice="5. Finesse Practice",
tutorial_allclearPractice="6. All Clear Practice (WIP)",
tutorial_techrashPractice="7. Techrash Practice",
tutorial_finessePlus="8. Elegant Stack (WIP)",

tutorial_notpass="Failed",
tutorial_pass="PASS",

tutorial_basic_1="Welcome to Techmino!",
tutorial_basic_2="1. The Basics",
tutorial_basic_3="Use the left and right keys to move your current piece.",
tutorial_basic_4="Press the hard drop key to place the piece on the board.",
tutorial_basic_5="You can also rotate the piece with the rotation keys.",
tutorial_basic_3="Use the left and right keys to move your current piece",
tutorial_basic_4="Press the hard drop key to place the piece on the board",
tutorial_basic_5="You can also rotate the piece with the rotation keys",

tutorial_sequence_1="2. Next & Hold",
tutorial_sequence_2="Oops, this piece doesn't seem to fit into the hole…",
tutorial_sequence_3="…but now you can see what pieces are coming next.",
tutorial_sequence_4="Use the Hold key to adjust the order of the pieces.",
tutorial_sequence_3="…but now you can see what pieces are coming next",
tutorial_sequence_4="Use the Hold key to adjust the order of the pieces",

tutorial_stackBasic_1="3. Basic Stacking",
tutorial_stackBasic_2="Try to keep the top levels \"flat\", to make the danger meter on the left low.",
tutorial_stackBasic_3="This is the usual goal for beginners.",
tutorial_stackBasic_4="Pieces are often placed \"lying down\", not \"standing up\".",
tutorial_stackBasic_5="This ensures more choices for future pieces and avoiding making holes.",
tutorial_stackBasic_2="Try to keep the top levels \"flat\", to make the danger meter on the left low",
tutorial_stackBasic_3="This is the usual goal for beginners",
tutorial_stackBasic_4="Pieces are often placed \"lying down\", not \"standing up\"",
tutorial_stackBasic_5="This ensures more choices for future pieces and avoiding making holes",

tutorial_basicFinesse_1="4. Basic Finesse",
tutorial_basicFinesse_2="",
tutorial_basicFinesse_3="",

tutorial_finessePractice_1="5. Finesse Practice",
tutorial_finessePractice_2="Minimize the number of key presses",
tutorial_finessePractice_par="Par",

tutorial_allclearPractice_1="6. All Clear Practice",
tutorial_allclearPractice_2="Do as much All Clear as possible",

tutorial_techrashPractice_1="7. Techrash Practice",
tutorial_techrashPractice_2="Clear as much Techrashes as possible",

tutorial_finessePlus_1="8. Elegant Stack",
tutorial_finessePlus_2="Use as less key-pressing as possible",
}
return L
Loading

0 comments on commit ff56a15

Please sign in to comment.