diff --git a/parts/ai.lua b/parts/ai.lua index 2da01a06..6bd2db01 100644 --- a/parts/ai.lua +++ b/parts/ai.lua @@ -18,7 +18,7 @@ local Timer=love.timer.getTime local blockPos={4,4,4,4,4,5,4} local scs={{0,1},{0,1},{0,1},{0,1},{0,1},{.5,.5},{-.5,1.5}} -------------------------------------------------Cold clear -local CCblockID={4,3,6,5,1,2,0} +local CCblockID={6,5,4,3,2,1,0} if system=="Windows"then require("CCloader") BOT={ @@ -29,12 +29,12 @@ if system=="Windows"then addNext= cc.add_next_piece_async ,--(bot,piece) update= cc.reset_async ,--(bot,field,b2b,combo) think= cc.request_next_move ,--(bot) - getMove= cc.poll_next_move ,--(bot)success,hold,move - ifDead= cc.is_dead_async ,--(bot)dead + getMove= cc.poll_next_move ,--(bot)success,dest,hold,move destroy= cc.destroy_async ,--(bot) setHold= cc.set_hold ,--(opt,bool) set20G= cc.set_20g ,--(opt,bool) + setPCLoop= cc.set_pcloop ,--(opt,bool) setBag= cc.set_bag7 ,--(opt,bool) setNode= cc.set_max_nodes ,--(opt,bool) free= cc.free ,--(opt/wei) @@ -282,9 +282,17 @@ return{ return 2 end, function(P,ctrl)--Poll keys - if BOT.ifDead(P.AI_bot)then ins(ctrl,6)return 3 end - local success,hold,move=BOT.getMove(P.AI_bot) - if success then + 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 94b25bde..b24fb97f 100644 --- a/parts/player.lua +++ b/parts/player.lua @@ -87,7 +87,7 @@ local finesseList={ finesseList[1][3],finesseList[1][4],finesseList[7][3],finesseList[7][4]=finesseList[1][1],finesseList[1][2],finesseList[7][1],finesseList[7][2]--"2-phase" SZI finesseList[2]=finesseList[1]--S=Z finesseList[4],finesseList[5]=finesseList[3],finesseList[3]--J=L=T -local CCblockID={4,3,6,5,1,2,0} +local CCblockID={6,5,4,3,2,1,0} local freshPrepare={ none=NULL, bag=function(P) @@ -1427,6 +1427,8 @@ function player.freshBlock(P,keepGhost,control,system) end end function player.lock(P) + local dest = P.AI_dest + local has_dest = (dest ~= nil) 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 @@ -1434,9 +1436,25 @@ 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 + dest = nil + end + end end end end + if has_dest and not dest then + CC_updateField(P) + end end function player.spin(P,d,ifpre) local iki=P.RS[P.cur.id]