From cc23869128885aba446f0601cfe051af4d256508 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 22 Aug 2021 15:35:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E6=A3=80=E6=B5=8Bai=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=94=BE=E5=88=B0=E7=9B=AE=E6=A0=87=E4=BD=8D=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=8B=AC=E7=AB=8B=E5=87=BA=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?lock=E6=96=B9=E6=B3=95=EF=BC=8C=E7=95=A5=E5=BE=AE=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/player.lua | 60 ++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/parts/player/player.lua b/parts/player/player.lua index 8ea6e575..4cf56cd1 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -517,44 +517,30 @@ function Player:freshBlock(mode)--string mode: push/move/fresh/newBlock end end end -function Player:lock() - if self.AI_dest then - local dest=self.AI_dest - local CB=self.cur.bk - for i=1,#CB do - local y=self.curY+i-1 - if not self.field[y]then self.field[y],self.visTime[y]=FREEROW.get(0),FREEROW.get(0)end - for j=1,#CB[1]do - if CB[i][j]then - self.field[y][self.curX+j-1]=self.cur.color - self.visTime[y][self.curX+j-1]=self.showTime - local x=self.curX+j-1 - if dest then - for k=1,#dest,2 do - if x==dest[k]+1 and y==dest[k+1]+1 then - rem(dest,k)rem(dest,k) - goto BREAK_success - end - end - dest=nil - ::BREAK_success:: - end - end +function Player:checkAIdest() + if not self.AI_dest then return end + local dest=self.AI_dest + local CB=self.cur.bk + for k=1,#dest,2 do + local r=CB[dest[k+1]-self.curY+2] + if not r or not r[dest[k]-self.curX+2]then + if self.AI_mode=='CC'then + CC.updateField(self) end + self.AI_dest=nil + return end - if not dest and self.AI_mode=='CC'then - CC.updateField(self) - end - else - local CB=self.cur.bk - for i=1,#CB do - local y=self.curY+i-1 - if not self.field[y]then self.field[y],self.visTime[y]=FREEROW.get(0),FREEROW.get(0)end - for j=1,#CB[1]do - if CB[i][j]then - self.field[y][self.curX+j-1]=self.cur.color - self.visTime[y][self.curX+j-1]=self.showTime - end + end +end +function Player:lock() + local CB=self.cur.bk + for i=1,#CB do + local y=self.curY+i-1 + if not self.field[y]then self.field[y],self.visTime[y]=FREEROW.get(0),FREEROW.get(0)end + for j=1,#CB[1]do + if CB[i][j]then + self.field[y][self.curX+j-1]=self.cur.color + self.visTime[y][self.curX+j-1]=self.showTime end end end @@ -1098,7 +1084,7 @@ do--Player.drop(self)--Place piece dospin=dospin+2 end - --Lock block to field + self:checkAIdest() self:lock() --Clear list of cleared-rows