自定义ai等级有文字指示

This commit is contained in:
MrZ626
2021-01-25 23:29:33 +08:00
parent d812b74f36
commit fa6f945eb2
5 changed files with 31 additions and 27 deletions

View File

@@ -197,7 +197,7 @@ CUSTOMENV={--gameEnv for cutsom game
visible="show", visible="show",
target=1e99, target=1e99,
freshLimit=1e99, freshLimit=1e99,
opponent=0, opponent="X",
life=0, life=0,
garbageSpeed=1, garbageSpeed=1,
pushSpeed=3, pushSpeed=3,

View File

@@ -50,24 +50,28 @@ return{
env={}, env={},
load=function() load=function()
applyCustomGame() applyCustomGame()
GAME.modeEnv.dropPiece=PLY.check_lineReach
local ENV=GAME.modeEnv
ENV.dropPiece=PLY.check_lineReach
for y=1,20 do for y=1,20 do
if notAir(FIELD[1][y])then if notAir(FIELD[1][y])then
--Switch clear sprint mode on --Switch clear sprint mode on
GAME.modeEnv.dropPiece=checkClear ENV.dropPiece=checkClear
break break
end end
end end
PLY.newPlayer(1) PLY.newPlayer(1)
local L=GAME.modeEnv.opponent local AItype=ENV.opponent:sub(1,2)
if L~=0 then local AIlevel=tonumber(ENV.opponent:sub(-1))
GAME.modeEnv.target=nil if AItype=="9S"then
if L<6 then ENV.target=nil
PLY.newAIPlayer(2,AIBUILDER("9S",2*L)) PLY.newAIPlayer(2,AIBUILDER("9S",2*AIlevel))
else elseif AItype=="CC"then
PLY.newAIPlayer(2,AIBUILDER("CC",2*L-11,int(L*.5-1.5),true,4000*L)) ENV.target=nil
end PLY.newAIPlayer(2,AIBUILDER("CC",2*AIlevel-1,int(AIlevel*.5+1),true,20000+5000*AIlevel))
end end
for _,P in next,PLAYERS.alive do for _,P in next,PLAYERS.alive do
setField(P,1) setField(P,1)
end end

View File

@@ -40,14 +40,14 @@ return{
load=function() load=function()
applyCustomGame() applyCustomGame()
PLY.newPlayer(1) PLY.newPlayer(1)
local L=GAME.modeEnv.opponent local AItype=ENV.opponent:sub(1,2)
if L~=0 then local AIlevel=tonumber(ENV.opponent:sub(-1))
GAME.modeEnv.target=nil if AItype=="9S"then
if L<6 then ENV.target=nil
PLY.newAIPlayer(2,AIBUILDER("9S",2*L)) PLY.newAIPlayer(2,AIBUILDER("9S",2*AIlevel))
else elseif AItype=="CC"then
PLY.newAIPlayer(2,AIBUILDER("CC",2*L-11,int(L*.5-1.5),true,4000*L)) ENV.target=nil
end PLY.newAIPlayer(2,AIBUILDER("CC",2*AIlevel-1,int(AIlevel*.5+1),true,20000+5000*AIlevel))
end end
end, end,
mesDisp=function(P) mesDisp=function(P)

View File

@@ -34,14 +34,14 @@ end
function scene.keyDown(key) function scene.keyDown(key)
if key=="return"or key=="return2"then if key=="return"or key=="return2"then
if CUSTOMENV.opponent>0 then if CUSTOMENV.opponent~="X"then
if CUSTOMENV.opponent>5 and CUSTOMENV.sequence=="fixed"then if CUSTOMENV.opponent:sub(1,2)=="CC"and CUSTOMENV.sequence=="fixed"then
LOG.print(text.ai_fixed,"warn") LOG.print(text.ai_fixed,"warn")
return return
elseif CUSTOMENV.opponent>0 and #BAG>0 then elseif #BAG>0 then
LOG.print(text.ai_prebag,"warn") LOG.print(text.ai_prebag,"warn")
return return
elseif CUSTOMENV.opponent>0 and #MISSION>0 then elseif #MISSION>0 then
LOG.print(text.ai_mission,"warn") LOG.print(text.ai_mission,"warn")
return return
end end

View File

@@ -31,11 +31,11 @@ scene.widgetList={
WIDGET.newSwitch{name="easyFresh", x=910, y=620, font=20,disp=lnk_CUSval("easyFresh"),code=lnk_CUSrev("easyFresh")}, WIDGET.newSwitch{name="easyFresh", x=910, y=620, font=20,disp=lnk_CUSval("easyFresh"),code=lnk_CUSrev("easyFresh")},
WIDGET.newSelector{name="RS", x=410, y=370, w=260,color="sea", list={"TRS","SRS","C2","C2sym","Classic","None"},disp=lnk_CUSval("RS"),code=lnk_CUSsto("RS")}, WIDGET.newSelector{name="RS", x=410, y=370, w=260,color="sea", list={"TRS","SRS","C2","C2sym","Classic","None"},disp=lnk_CUSval("RS"),code=lnk_CUSsto("RS")},
WIDGET.newSelector{name="visible", x=840, y=60, w=260,color="lBlue",list={"show","easy","slow","medium","fast","none"},disp=lnk_CUSval("visible"), code=lnk_CUSsto("visible")}, WIDGET.newSelector{name="visible", x=840, y=60, w=260,color="lBlue",list={"show","easy","slow","medium","fast","none"},disp=lnk_CUSval("visible"),code=lnk_CUSsto("visible")},
WIDGET.newSelector{name="target", x=840, y=160, w=260,color="green",list={10,20,40,100,200,500,1000,1e99}, disp=lnk_CUSval("target"), code=lnk_CUSsto("target")}, WIDGET.newSelector{name="target", x=840, y=160, w=260,color="green",list={10,20,40,100,200,500,1000,1e99}, disp=lnk_CUSval("target"),code=lnk_CUSsto("target")},
WIDGET.newSelector{name="freshLimit",x=840, y=260, w=260,color="purple",list={0,8,15,1e99}, disp=lnk_CUSval("freshLimit"),code=lnk_CUSsto("freshLimit")}, WIDGET.newSelector{name="freshLimit",x=840, y=260, w=260,color="purple",list={0,8,15,1e99}, disp=lnk_CUSval("freshLimit"),code=lnk_CUSsto("freshLimit")},
WIDGET.newSelector{name="opponent", x=1120, y=60, w=260,color="red", list={0,1,2,3,4,5,6,7,8,9,10}, disp=lnk_CUSval("opponent"),code=lnk_CUSsto("opponent")}, WIDGET.newSelector{name="opponent", x=1120, y=60, w=260,color="red", list={"X","9S Lv.1","9S Lv.2","9S Lv.3","9S Lv.4","9S Lv.5","CC Lv.1","CC Lv.2","CC Lv.3","CC Lv.4","CC Lv.5"},disp=lnk_CUSval("opponent"),code=lnk_CUSsto("opponent")},
WIDGET.newSelector{name="life", x=1120, y=160, w=260,color="red", list={0,1,2,3,5,10,15,26,42,87,500}, disp=lnk_CUSval("life"), code=lnk_CUSsto("life")}, WIDGET.newSelector{name="life", x=1120, y=160, w=260,color="red", list={0,1,2,3,5,10,15,26,42,87,500}, disp=lnk_CUSval("life"),code=lnk_CUSsto("life")},
WIDGET.newSelector{name="pushSpeed",x=1120, y=260, w=260,color="red", list={1,2,3,5,15}, disp=lnk_CUSval("pushSpeed"),code=lnk_CUSsto("pushSpeed")}, WIDGET.newSelector{name="pushSpeed",x=1120, y=260, w=260,color="red", list={1,2,3,5,15}, disp=lnk_CUSval("pushSpeed"),code=lnk_CUSsto("pushSpeed")},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80, font=40,code=backScene}, WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80, font=40,code=backScene},