diff --git a/parts/ai.lua b/parts/ai.lua index 30623400..49e673aa 100644 --- a/parts/ai.lua +++ b/parts/ai.lua @@ -275,11 +275,17 @@ return{ return 2 end,--start thinking function(P,ctrl) - local success,hold,move=BOT.getMove(P.AI_bot) + local success,dest,hold,move=BOT.getMove(P.AI_bot) if success == 2 then ins(ctrl,6) return 3 elseif success == 0 then + for i=1,#dest do + for j=1,#dest[i] do + dest[i][j] = dest[i][j] + 1 + end + end + P.AI_dest = dest if hold then ctrl[1]=8 end--Hold while move[1]do local m=rem(move,1) diff --git a/parts/player.lua b/parts/player.lua index 28b257a6..970f57e3 100644 --- a/parts/player.lua +++ b/parts/player.lua @@ -1273,6 +1273,7 @@ function player.freshLockDelay(P) end end function player.lock(P) + local dest = P.AI_dest for i=1,P.r do local y=P.curY+i-1 if not P.field[y]then P.field[y],P.visTime[y]=freeRow.get(0),freeRow.get(0)end @@ -1280,6 +1281,20 @@ function player.lock(P) if P.cur.bk[i][j]then P.field[y][P.curX+j-1]=P.cur.color P.visTime[y][P.curX+j-1]=P.showTime + local x = P.curX+j-1 + if dest then + local original_length = #dest + for k=1,original_length do + if x == dest[k][1] and y == dest[k][2] then + rem(dest, k) + break + end + end + if #dest ~= original_length - 1 then + CC_updateField(P) + dest = nil + end + end end end end