修改/添加bot的api
更新ccBot相关代码(需要修正)
This commit is contained in:
@@ -3,7 +3,9 @@ local ins,rem=table.insert,table.remove
|
||||
local baseBot={
|
||||
pushNewNext=NULL,
|
||||
updateField=NULL,
|
||||
lockWrongPlace=NULL,
|
||||
updateB2B=NULL,
|
||||
updateCombo=NULL,
|
||||
checkDest=NULL,
|
||||
switch20G=NULL,
|
||||
revive=NULL,
|
||||
}
|
||||
@@ -44,7 +46,7 @@ function BOT.template(arg)
|
||||
next=arg.next,
|
||||
hold=arg.hold,
|
||||
delay=AISpeed[arg.speedLV],
|
||||
["args.node"]=arg.node,
|
||||
node=arg.node,
|
||||
}
|
||||
elseif arg.type=='9S'then
|
||||
return{
|
||||
@@ -58,41 +60,41 @@ end
|
||||
function BOT.new(P,data)
|
||||
local bot={P=P,data=data}
|
||||
if data.type=="CC"then
|
||||
-- P:setRS('SRS')
|
||||
-- bot.keys={}
|
||||
-- bot.nexts={}
|
||||
-- bot.delay=data.delay
|
||||
-- bot.delay0=data.delay
|
||||
-- if P.gameEnv.holdCount and P.gameEnv.holdCount>1 then P:setHold(1)end
|
||||
P:setRS('SRS')
|
||||
bot.keys={}
|
||||
bot.nexts={}
|
||||
bot.delay=data.delay
|
||||
bot.delay0=data.delay
|
||||
bot._20G=P._20G
|
||||
if P.gameEnv.holdCount and P.gameEnv.holdCount>1 then P:setHold(1)end
|
||||
|
||||
-- local cc=require"parts.bot.cc_wrapper"
|
||||
-- local opt,wei=cc.getConf()
|
||||
-- wei:fastWeights()
|
||||
-- opt:setHold(P.AIdata.hold)
|
||||
-- opt:set20G(P.AIdata._20G)
|
||||
-- opt:setBag(P.AIdata.bag=='bag')
|
||||
-- opt:setNode(P.AIdata.node)
|
||||
-- bot.ccBot=cc.new(opt,wei)
|
||||
-- local cc_lua=require"parts.bot.bot_cc"
|
||||
-- setmetatable(bot,{__index=function(self,k)
|
||||
-- if self.ccBot[k]then
|
||||
-- self.ccBot[k](self.ccBot)
|
||||
-- elseif cc_lua[k]then
|
||||
-- cc_lua[k](self)
|
||||
-- elseif baseBot[k]then
|
||||
-- baseBot[k](self)
|
||||
-- end
|
||||
-- end})
|
||||
local cc=require"parts.bot.cc_wrapper"
|
||||
local opt,wei=cc.getConf()
|
||||
wei:fastWeights()
|
||||
opt:setHold(P.AIdata.hold)
|
||||
opt:set20G(P.AIdata._20G)
|
||||
opt:setBag(P.AIdata.bag=='bag')
|
||||
opt:setNode(P.AIdata.node)
|
||||
bot.ccBot=cc.new(opt,wei)
|
||||
|
||||
-- for i,B in next,P.gameEnv.nextQueue do
|
||||
-- if i<=data.next then
|
||||
-- bot:addNext(B.id)
|
||||
-- else
|
||||
-- ins(bot.nexts,B.id)
|
||||
-- end
|
||||
-- end
|
||||
-- bot.runningThread=coroutine.wrap(cc_lua.thread)
|
||||
-- bot.runningThread(bot)
|
||||
local cc_lua=require"parts.bot.bot_cc"
|
||||
setmetatable(bot,{__index=function(self,k)
|
||||
return
|
||||
self.ccBot[k]and function(_,...)self.ccBot[k](self.ccBot,...)end or
|
||||
cc_lua[k]and function(_,...)cc_lua[k](self,...)end or
|
||||
baseBot[k]or
|
||||
error("No action called "..k)
|
||||
end})
|
||||
|
||||
for i,B in next,P.gameEnv.nextQueue do
|
||||
if i<=data.next then
|
||||
bot:addNext(B.id)
|
||||
else
|
||||
ins(bot.nexts,B.id)
|
||||
end
|
||||
end
|
||||
bot.runningThread=coroutine.wrap(cc_lua.thread)
|
||||
bot.runningThread(bot)
|
||||
setmetatable(bot,botMeta)
|
||||
elseif data.type=="9S"or true then--9s or else
|
||||
TABLE.cover(baseBot,bot)
|
||||
|
||||
Reference in New Issue
Block a user