make cc update field when block placement is wrong
This commit is contained in:
@@ -275,11 +275,17 @@ return{
|
|||||||
return 2
|
return 2
|
||||||
end,--start thinking
|
end,--start thinking
|
||||||
function(P,ctrl)
|
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
|
if success == 2 then
|
||||||
ins(ctrl,6)
|
ins(ctrl,6)
|
||||||
return 3
|
return 3
|
||||||
elseif success == 0 then
|
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
|
if hold then ctrl[1]=8 end--Hold
|
||||||
while move[1]do
|
while move[1]do
|
||||||
local m=rem(move,1)
|
local m=rem(move,1)
|
||||||
|
|||||||
@@ -1273,6 +1273,7 @@ function player.freshLockDelay(P)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function player.lock(P)
|
function player.lock(P)
|
||||||
|
local dest = P.AI_dest
|
||||||
for i=1,P.r do
|
for i=1,P.r do
|
||||||
local y=P.curY+i-1
|
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
|
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
|
if P.cur.bk[i][j]then
|
||||||
P.field[y][P.curX+j-1]=P.cur.color
|
P.field[y][P.curX+j-1]=P.cur.color
|
||||||
P.visTime[y][P.curX+j-1]=P.showTime
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user