From 1963dc9fb924bd0dee9480b367c71125ece58ad1 Mon Sep 17 00:00:00 2001 From: Fuwuwuwu <72070458+floatwoozy@users.noreply.github.com> Date: Tue, 29 Oct 2024 08:24:10 +0800 Subject: [PATCH] Fix the issue of AI passing Hold parameters in custom mode (#1163) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 自定义游戏传递hold开关的问题 表现:即使holdCount为0,CC依旧会开启hold,导致无法预期运行,场地逐渐混乱 原因:传递了错误的类型(boolean->number) * 非正常hold模式时,AI不启用hold 相关问题#1106 --- parts/modes/custom_clear.lua | 5 +++-- parts/modes/custom_puzzle.lua | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/parts/modes/custom_clear.lua b/parts/modes/custom_clear.lua index 951a1606..74b9814b 100644 --- a/parts/modes/custom_clear.lua +++ b/parts/modes/custom_clear.lua @@ -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 diff --git a/parts/modes/custom_puzzle.lua b/parts/modes/custom_puzzle.lua index 6da31d4c..ddda4752 100644 --- a/parts/modes/custom_puzzle.lua +++ b/parts/modes/custom_puzzle.lua @@ -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()