Fix the issue of AI passing Hold parameters in custom mode (#1163)

* 自定义游戏传递hold开关的问题

表现:即使holdCount为0,CC依旧会开启hold,导致无法预期运行,场地逐渐混乱
原因:传递了错误的类型(boolean->number)

* 非正常hold模式时,AI不启用hold

相关问题#1106
This commit is contained in:
Fuwuwuwu
2024-10-29 08:24:10 +08:00
committed by GitHub
parent 396293c8af
commit 1963dc9fb9
2 changed files with 6 additions and 4 deletions

View File

@@ -14,10 +14,11 @@ return {
PLY.newPlayer(1)
local AItype=GAME.modeEnv.opponent:sub(1,2)
local AIlevel=tonumber(GAME.modeEnv.opponent:sub(-1))
local useHold=GAME.modeEnv.holdCount>0 and GAME.modeEnv.holdMode=='hold'
if AItype=='9S' then
PLY.newAIPlayer(2,BOT.template{type='9S',speedLV=2*AIlevel,hold=GAME.modeEnv.holdCount})
PLY.newAIPlayer(2,BOT.template{type='9S',speedLV=2*AIlevel,hold=useHold})
elseif AItype=='CC' then
PLY.newAIPlayer(2,BOT.template{type='CC',speedLV=2*AIlevel-1,next=math.floor(AIlevel*.5+1),hold=GAME.modeEnv.holdCount,node=20000+5000*AIlevel})
PLY.newAIPlayer(2,BOT.template{type='CC',speedLV=2*AIlevel-1,next=math.floor(AIlevel*.5+1),hold=useHold,node=20000+5000*AIlevel})
end
for _,P in next,PLY_ALIVE do

View File

@@ -56,10 +56,11 @@ return {
local AItype=GAME.modeEnv.opponent:sub(1,2)
local AIlevel=tonumber(GAME.modeEnv.opponent:sub(-1))
PLY.newPlayer(1)
local useHold=GAME.modeEnv.holdCount>0 and GAME.modeEnv.holdMode=='hold'
if AItype=='9S' then
PLY.newAIPlayer(2,BOT.template{type='9S',speedLV=2*AIlevel,hold=GAME.modeEnv.holdCount})
PLY.newAIPlayer(2,BOT.template{type='9S',speedLV=2*AIlevel,hold=useHold})
elseif AItype=='CC' then
PLY.newAIPlayer(2,BOT.template{type='CC',speedLV=2*AIlevel-1,next=math.floor(AIlevel*.5+1),hold=GAME.modeEnv.holdCount,node=20000+5000*AIlevel})
PLY.newAIPlayer(2,BOT.template{type='CC',speedLV=2*AIlevel-1,next=math.floor(AIlevel*.5+1),hold=useHold,node=20000+5000*AIlevel})
end
end,
savePrivate=function()