调整ai对多hold的支持
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
local AISpeed={60,50,40,30,20,14,10,6,4,3}
|
||||
return function(type,speedLV,next,hold,node)
|
||||
if type=="CC"then
|
||||
if not hold then hold=false else hold=true end
|
||||
return{
|
||||
type="CC",
|
||||
nextCount=next,
|
||||
hold=hold>0,
|
||||
holdCount=hold,
|
||||
delta=AISpeed[speedLV],
|
||||
node=node,
|
||||
}
|
||||
@@ -12,6 +13,7 @@ return function(type,speedLV,next,hold,node)
|
||||
return{
|
||||
type="9S",
|
||||
delta=math.floor(AISpeed[speedLV]),
|
||||
holdCount=hold,
|
||||
}
|
||||
end
|
||||
end
|
||||
11
parts/ai.lua
11
parts/ai.lua
@@ -8,7 +8,6 @@
|
||||
]]
|
||||
local int,ceil,min,abs,rnd=math.floor,math.ceil,math.min,math.abs,math.random
|
||||
local ins,rem=table.insert,table.remove
|
||||
local Timer=love.timer.getTime
|
||||
-- controlname:
|
||||
-- 1~5:mL,mR,rR,rL,rF,
|
||||
-- 6~10:hD,sD,H,A,R,
|
||||
@@ -270,10 +269,7 @@ return{
|
||||
return 2
|
||||
end,
|
||||
function(P)
|
||||
P.AI_delay=P.AI_delay0
|
||||
if Timer()-P.modeData.point>P.modeData.event then
|
||||
P.modeData.point=Timer()
|
||||
P.modeData.event=P.AI_delay0+rnd(5,15)
|
||||
if P:RND()<.00126 then
|
||||
P:changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
||||
end
|
||||
return 1
|
||||
@@ -322,10 +318,7 @@ return{
|
||||
end
|
||||
end,
|
||||
function(P)--Check if time to change target
|
||||
P.AI_delay=P.AI_delay0
|
||||
if Timer()-P.modeData.point>P.modeData.event then
|
||||
P.modeData.point=Timer()
|
||||
P.modeData.event=P.AI_delay0+rnd(5,15)
|
||||
if P:RND()<.00126 then
|
||||
P:changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
||||
end
|
||||
return 1
|
||||
|
||||
@@ -77,7 +77,7 @@ return{
|
||||
if L<6 then
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("9S",2*L))
|
||||
else
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",2*L-11,int(L*.5-1.5),MODEENV.hold,4000*L))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",2*L-11,int(L*.5-1.5),true,4000*L))
|
||||
end
|
||||
end
|
||||
for _,P in next,PLAYERS.alive do
|
||||
|
||||
@@ -58,7 +58,7 @@ return{
|
||||
if L<6 then
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("9S",2*L))
|
||||
else
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",2*L-11,int(L*.5-1.5),MODEENV.hold,4000*L))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",2*L-11,int(L*.5-1.5),true,4000*L))
|
||||
end
|
||||
end
|
||||
MODEENV.bg=CUSTOMENV.bg
|
||||
|
||||
@@ -323,7 +323,7 @@ function PLY.newDemoPlayer(id,x,y,size)
|
||||
nextCount=5,
|
||||
hold=true,
|
||||
delay=30,
|
||||
delta=4,
|
||||
delta=6,
|
||||
bag="bag",
|
||||
node=100000,
|
||||
})
|
||||
|
||||
@@ -1280,43 +1280,46 @@ do--Player.drop(P)--Place piece
|
||||
if _ then _(P)end
|
||||
end
|
||||
end
|
||||
function Player.loadAI(P,AIdata)--Load AI params
|
||||
P.AI_mode=AIdata.type
|
||||
function Player.loadAI(P,data)--Load AI params
|
||||
P.AI_mode=data.type
|
||||
P.AI_stage=1
|
||||
P.AI_keys={}
|
||||
P.AI_delay=AIdata.delay or min(int(P.gameEnv.drop*.8),AIdata.delta*rnd()*4)
|
||||
P.AI_delay0=AIdata.delta
|
||||
P.AI_delay=min(int(P.gameEnv.drop*.8),data.delta*rnd()*4)
|
||||
P.AI_delay0=data.delta
|
||||
P.AIdata={
|
||||
type=AIdata.type,
|
||||
delay=AIdata.delay,
|
||||
delta=AIdata.delta,
|
||||
type=data.type,
|
||||
delay=data.delay,
|
||||
delta=data.delta,
|
||||
|
||||
nextCount=AIdata.nextCount,
|
||||
hold=AIdata.hold,
|
||||
nextCount=data.nextCount,
|
||||
holdCount=data.holdCount,
|
||||
_20G=P._20G,
|
||||
bag=AIdata.bag,
|
||||
node=AIdata.node,
|
||||
bag=data.bag,
|
||||
node=data.node,
|
||||
}
|
||||
if P.gameEnv.holdCount==0 then
|
||||
P.AIdata.holdCount=false
|
||||
end
|
||||
if not CC then
|
||||
P.AI_mode="9S"
|
||||
P.AI_delay0=int(P.AI_delay0*.26)
|
||||
P.AI_delay0=int(P.AI_delay0*.3)
|
||||
end
|
||||
if P.AI_mode=="CC"then
|
||||
P:setHold(1)
|
||||
P:setHold(P.AIdata.holdCount)
|
||||
P:setRS("SRS")
|
||||
local opt,wei=CC.getConf()
|
||||
CC.fastWeights(wei)
|
||||
CC.setHold(opt,P.AIdata.hold)
|
||||
CC.setHold(opt,P.AIdata.holdCount)
|
||||
CC.set20G(opt,P.AIdata._20G)
|
||||
CC.setBag(opt,P.AIdata.bag=="bag")
|
||||
CC.setNode(opt,P.AIdata.node)
|
||||
P.AI_bot=CC.new(opt,wei)
|
||||
CC.free(opt)CC.free(wei)
|
||||
for i=1,AIdata.nextCount do
|
||||
for i=1,data.nextCount do
|
||||
CC.addNext(P.AI_bot,P.nextQueue[i].id)
|
||||
end
|
||||
else
|
||||
P:setHold(1)
|
||||
P:setHold(P.AIdata.holdCount)
|
||||
P:setRS("TRS")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user