修改/添加bot的api
更新ccBot相关代码(需要修正)
This commit is contained in:
@@ -801,8 +801,8 @@ function draw.norm(P,repMode)
|
||||
end
|
||||
|
||||
--Draw AI's drop destination
|
||||
if P.AI_dest then
|
||||
local L=P.AI_dest
|
||||
if P.destFX then
|
||||
local L=P.destFX
|
||||
local texture=TEXTURE.puzzleMark[21]
|
||||
for i=1,#L,2 do
|
||||
gc_draw(texture,30*L[i],-30*L[i+1]-30)
|
||||
|
||||
@@ -117,6 +117,7 @@ local function _newEmptyPlayer(id,mini)
|
||||
P.keyPressing={}for i=1,12 do P.keyPressing[i]=false end
|
||||
P.clearingRow,P.clearedRow={},{}--Clearing animation height,cleared row mark
|
||||
P.dropFX,P.moveFX,P.lockFX,P.clearFX={},{},{},{}
|
||||
-- P.destFX={}--Normally created by bot
|
||||
P.tasks={}
|
||||
P.bonus={}--Texts
|
||||
|
||||
|
||||
@@ -573,21 +573,6 @@ function Player:freshBlock(mode)--string mode: push/move/fresh/newBlock
|
||||
end
|
||||
end
|
||||
end
|
||||
function Player:checkDest()
|
||||
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.bot then
|
||||
self.bot:lockWrongPlace()
|
||||
end
|
||||
self.AI_dest=nil
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
function Player:lock()
|
||||
local CB=self.cur.bk
|
||||
for i=1,#CB do
|
||||
@@ -888,9 +873,7 @@ function Player:getBlock(id,name,color)--Get a block object
|
||||
end
|
||||
function Player:getNext(id)--Push a block to nextQueue
|
||||
ins(self.nextQueue,self:getBlock(id))
|
||||
if self.bot then
|
||||
self.bot:pushNewNext(id)
|
||||
end
|
||||
if self.bot then self.bot:pushNewNext(id)end
|
||||
end
|
||||
function Player:popNext(ifhold)--Pop nextQueue to hand
|
||||
local ENV=self.gameEnv
|
||||
@@ -1126,9 +1109,6 @@ do--Player.drop(self)--Place piece
|
||||
dospin=dospin+2
|
||||
end
|
||||
|
||||
if self.bot then
|
||||
self:checkDest()
|
||||
end
|
||||
self:lock()
|
||||
|
||||
--Clear list of cleared-rows
|
||||
@@ -1492,6 +1472,13 @@ do--Player.drop(self)--Place piece
|
||||
end
|
||||
end
|
||||
|
||||
--Check bot things
|
||||
if self.bot then
|
||||
self.bot:checkDest()
|
||||
self.bot:updateB2B(self.b2b)
|
||||
self.bot:updateCombo(self.combo)
|
||||
end
|
||||
|
||||
--Check height limit
|
||||
if cc==0 and #self.field>ENV.heightLimit then self:lose()end
|
||||
|
||||
@@ -1665,9 +1652,7 @@ function Player:revive()
|
||||
self.field[_],self.visTime[_]=nil
|
||||
end
|
||||
self.garbageBeneath=0
|
||||
if self.bot then
|
||||
self.bot:revive()
|
||||
end
|
||||
if self.bot then self.bot:revive()end
|
||||
|
||||
self:clearAttackBuffer()
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ function update.alive(P,dt)
|
||||
end
|
||||
P:drop(true)
|
||||
if P.bot then
|
||||
P.bot:unexpectedLock()
|
||||
P.bot:lockWrongPlace()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user