From 12c808f798a75d3514436316a66142804d2ef866 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Sat, 30 Nov 2024 07:10:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=85=E8=83=BD=E6=A0=BC=E5=AD=90=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/game/mechanicLib/brik/chargeLimit.lua | 43 +++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/assets/game/mechanicLib/brik/chargeLimit.lua b/assets/game/mechanicLib/brik/chargeLimit.lua index dbbe8114..4eaeec32 100644 --- a/assets/game/mechanicLib/brik/chargeLimit.lua +++ b/assets/game/mechanicLib/brik/chargeLimit.lua @@ -126,13 +126,36 @@ end do -- spin function chargeLimit.spin_event_playerInit(P) P.modeData.spinClear=0 + P:addEvent('beforeClear',{-1,chargeLimit.spin_event_beforeClear}) P:addEvent('afterClear',{-1e99,chargeLimit.spin_event_afterClear}) + P:addEvent('drawBelowMarks',chargeLimit.spin_event_drawBelowMarks) + end + function chargeLimit.spin_event_beforeClear(P) + if P.lastMovement.immobile then + local CB=P.hand.matrix + for y=1,#CB do for x=1,#CB[1] do + local C=CB[y][x] + if C then + C.spin_charge=true + end + end end + end end function chargeLimit.spin_event_afterClear(P,clear) if P.lastMovement.immobile then P.modeData.spinClear=P.modeData.spinClear+clear.line end end + function chargeLimit.spin_event_drawBelowMarks(P) + gc_setColor(1,1,1,.42) + local mat=P.field._matrix + for y=1,#mat do for x=1,#mat[1] do + local C=mat[y][x] + if C and C.spin_charge then + gc_rectangle('fill',40*(x-1)+10,-40*(y-1)-10,20,-20) + end + end end + end local styles={ {name='I',id=7,x=-300,y=-60-40*3,w=160,h=30,color=RGB9 [488], colorDanger=RGB9 [233]}, @@ -189,7 +212,6 @@ do -- spin P:addEvent('always',chargeLimit.spin_piece_event_always) P:addEvent('beforeClear',{-1,chargeLimit.spin_piece_event_beforeClear}) P:addEvent('drawOnPlayer',chargeLimit.spin_piece_event_drawOnPlayer) - P:addEvent('drawBelowMarks',chargeLimit.spin_piece_event_drawBelowMarks) end function chargeLimit.spin_piece_event_always(P) ---@type Techmino.Mech.Brik.PieceDevice[] @@ -209,15 +231,6 @@ do -- spin end end function chargeLimit.spin_piece_event_beforeClear(P,fullLines) - if P.lastMovement.immobile then - local CB=P.hand.matrix - for y=1,#CB do for x=1,#CB[1] do - local C=CB[y][x] - if C then - C.spin_charge=true - end - end end - end ---@type Techmino.Mech.Brik.PieceDevice[] local devices=P.modeData.spin_powDevice local mainDev=devices[Brik.getID(P.hand.name)] @@ -258,16 +271,6 @@ do -- spin mainDev.display=false end end - function chargeLimit.spin_piece_event_drawBelowMarks(P) - gc_setColor(1,1,1,.42) - local mat=P.field._matrix - for y=1,#mat do for x=1,#mat[1] do - local C=mat[y][x] - if C and C.spin_charge then - gc_rectangle('fill',40*(x-1)+10,-40*(y-1)-10,20,-20) - end - end end - end function chargeLimit.spin_piece_event_drawOnPlayer(P) ---@type Techmino.Mech.Brik.PieceDevice[] local devices=P.modeData.spin_powDevice