注释首字母大写
This commit is contained in:
29
parts/ai.lua
29
parts/ai.lua
@@ -198,7 +198,7 @@ end
|
||||
return{
|
||||
["9S"]={
|
||||
function(P,ctrl)
|
||||
local Tfield={}--test field
|
||||
local Tfield={}--Test field
|
||||
local field_org=P.field
|
||||
for i=1,#field_org do
|
||||
Tfield[i]=freeRow.get(0)
|
||||
@@ -217,13 +217,17 @@ return{
|
||||
end
|
||||
if not bn then goto CTN end
|
||||
|
||||
for dir=0,dirCount[bn] do--each dir
|
||||
for dir=0,dirCount[bn] do--Each dir
|
||||
local cb=blocks[bn][dir]
|
||||
for cx=1,11-#cb[1]do--each pos
|
||||
for cx=1,11-#cb[1]do--Each pos
|
||||
local cy=#Tfield+1
|
||||
|
||||
--Move to bottom
|
||||
while not ifoverlapAI(Tfield,cb,cx,cy-1)do
|
||||
cy=cy-1
|
||||
end--move to bottom
|
||||
end
|
||||
|
||||
--Simulate lock
|
||||
for i=1,#cb do
|
||||
local y=cy+i-1
|
||||
if not Tfield[y]then Tfield[y]=freeRow.get(0)end
|
||||
@@ -232,7 +236,7 @@ return{
|
||||
Tfield[y][cx+j-1]=1
|
||||
end
|
||||
end
|
||||
end--simulate lock
|
||||
end
|
||||
local score=getScore(Tfield,cb,cy)
|
||||
if score>best.score then
|
||||
best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score}
|
||||
@@ -270,11 +274,11 @@ return{
|
||||
end,
|
||||
},
|
||||
["CC"]={
|
||||
function(P)
|
||||
function(P)--Start thinking
|
||||
BOT.think(P.AI_bot)
|
||||
return 2
|
||||
end,--start thinking
|
||||
function(P,ctrl)
|
||||
end,
|
||||
function(P,ctrl)--Poll keys
|
||||
if BOT.ifDead(P.AI_bot)then ins(ctrl,6)return 3 end
|
||||
local success,hold,move=BOT.getMove(P.AI_bot)
|
||||
if success then
|
||||
@@ -290,10 +294,11 @@ return{
|
||||
ins(ctrl,6)
|
||||
return 3
|
||||
else
|
||||
return 2--stay this stage
|
||||
--Stay this stage
|
||||
return 2
|
||||
end
|
||||
end,--poll keys
|
||||
function(P)
|
||||
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()
|
||||
@@ -301,6 +306,6 @@ return{
|
||||
P:changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
||||
end
|
||||
return 1
|
||||
end,--check if time to change target
|
||||
end,
|
||||
},
|
||||
}--AI think stage
|
||||
@@ -1,5 +1,5 @@
|
||||
setting={
|
||||
--game
|
||||
--Game
|
||||
das=10,arr=2,
|
||||
sddas=0,sdarr=2,
|
||||
ihs=true,irs=true,ims=true,
|
||||
@@ -14,7 +14,7 @@ setting={
|
||||
skin={1,5,8,2,10,3,7,1,5,1,5,8,2,10,3,7,10,7,8,2,8,2,1,5,3},
|
||||
face={},
|
||||
|
||||
--graphic
|
||||
--Graphic
|
||||
ghost=true,center=true,
|
||||
smooth=true,grid=false,
|
||||
bagLine=false,
|
||||
@@ -31,7 +31,7 @@ setting={
|
||||
bg=true,
|
||||
powerInfo=false,
|
||||
|
||||
--sound
|
||||
--Sound
|
||||
sfx=10,
|
||||
spawn=0,
|
||||
bgm=7,
|
||||
@@ -39,15 +39,15 @@ setting={
|
||||
vib=0,
|
||||
voc=0,
|
||||
|
||||
--virtualkey
|
||||
--Virtualkey
|
||||
VKSFX=3,--SFX volume
|
||||
VKVIB=0,--VIB
|
||||
VKSwitch=false,--if disp
|
||||
VKTrack=false,--if tracked
|
||||
VKDodge=false,--if dodge
|
||||
VKSwitch=false,--If disp
|
||||
VKTrack=false,--If tracked
|
||||
VKDodge=false,--If dodge
|
||||
VKTchW=3,--Touch-Pos Weight
|
||||
VKCurW=4,--Cur-Pos Weight
|
||||
VKIcon=true,--if disp icon
|
||||
VKIcon=true,--If disp icon
|
||||
VKAlpha=3,
|
||||
}
|
||||
for i=1,25 do
|
||||
@@ -64,7 +64,7 @@ stat={
|
||||
send=0,recv=0,pend=0,off=0,
|
||||
clear={},spin={},
|
||||
pc=0,hpc=0,b2b=0,b3b=0,score=0,
|
||||
lastPlay="sprint_10",--last played mode ID
|
||||
lastPlay="sprint_10",--Last played mode ID
|
||||
}
|
||||
for i=1,25 do
|
||||
stat.clear[i]={0,0,0,0,0}
|
||||
@@ -73,9 +73,9 @@ end
|
||||
|
||||
keyMap={
|
||||
{"left","right","x","z","c","up","down","space","tab","r"},{},
|
||||
--keyboard
|
||||
--Keyboard
|
||||
{"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","x","leftshoulder"},{},
|
||||
--joystick
|
||||
--Joystick
|
||||
}
|
||||
for i=1,#keyMap do for j=1,20 do
|
||||
if not keyMap[i][j]then keyMap[i][j]=""end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local freeRow={}
|
||||
local L={}--storage
|
||||
local _=0--lenth
|
||||
local L={}--Storage
|
||||
local _=0--Lenth
|
||||
function freeRow.reset(num)
|
||||
if num<_ then
|
||||
for i=_,num+1,-1 do
|
||||
|
||||
@@ -4,7 +4,7 @@ local ZERO={[01]=Zero,[10]=Zero,[03]=Zero,[30]=Zero,[12]=Zero,[21]=Zero,[32]=Zer
|
||||
|
||||
local map={}
|
||||
for x=-3,3 do map[x]={}for y=-3,3 do map[x][y]={x,y}end end
|
||||
local function collect(T)--make all vec point to the same vec
|
||||
local function collect(T)--Make all vec point to the same vec
|
||||
if type(T)=="table"then
|
||||
for _,T in next,T do
|
||||
for k,vec in next,T do
|
||||
@@ -14,11 +14,11 @@ local function collect(T)--make all vec point to the same vec
|
||||
end
|
||||
end
|
||||
|
||||
local function C_sym(L)--use this if the block is centrosymmetry, *PTR!!!
|
||||
local function C_sym(L)--Use this if the block is centrosymmetry, *PTR!!!
|
||||
L[23]=L[01]L[32]=L[10]
|
||||
L[21]=L[03]L[12]=L[30]
|
||||
end
|
||||
local function flipList(O)--use this to copy a symmetry list
|
||||
local function flipList(O)--Use this to copy a symmetry list
|
||||
if not O then return end
|
||||
local L={}
|
||||
for i=1,#O do
|
||||
|
||||
@@ -97,33 +97,33 @@ function SKIN.load()
|
||||
gc.pop()
|
||||
end
|
||||
local L=#list
|
||||
function SKIN.prevSet()--prev skin_set
|
||||
function SKIN.prevSet()--Prev skin_set
|
||||
local _=(setting.skinSet-2)%L+1
|
||||
setting.skinSet=_
|
||||
SKIN.change(_)
|
||||
_=list[_]
|
||||
TEXT.show(_,1100,100,int(300/#_)+5,"fly")
|
||||
end
|
||||
function SKIN.nextSet()--next skin_set
|
||||
function SKIN.nextSet()--Next skin_set
|
||||
local _=setting.skinSet%L+1
|
||||
setting.skinSet=_
|
||||
SKIN.change(_)
|
||||
_=list[_]
|
||||
TEXT.show(_,1100,100,int(300/#_)+5,"fly")
|
||||
end
|
||||
function SKIN.prev(i)--prev skin for [i]
|
||||
function SKIN.prev(i)--Prev skin for [i]
|
||||
local _=setting.skin
|
||||
_[i]=(_[i]-2)%11+1
|
||||
end
|
||||
function SKIN.next(i)--next skin for [i]
|
||||
function SKIN.next(i)--Next skin for [i]
|
||||
local _=setting.skin
|
||||
_[i]=_[i]%11+1
|
||||
end
|
||||
function SKIN.rotate(i)--change direction of [i]
|
||||
function SKIN.rotate(i)--Change direction of [i]
|
||||
setting.face[i]=(setting.face[i]+1)%4
|
||||
SFX.play("rotate")
|
||||
end
|
||||
function SKIN.change(i)--change to skin_set[i]
|
||||
function SKIN.change(i)--Change to skin_set[i]
|
||||
blockSkin=SKIN.lib[i]
|
||||
blockSkinMini=SKIN.libMini[i]
|
||||
end
|
||||
|
||||
@@ -53,8 +53,9 @@ function Tick.throwBadge(data)--{ifAI,Sender,timer}
|
||||
else
|
||||
x2,y2=R.x+66*R.size,R.y+344*R.size
|
||||
end
|
||||
|
||||
--Generate badge object
|
||||
FX_badge[#FX_badge+1]={x1,y1,x2,y2,t=0}
|
||||
--generate badge object
|
||||
|
||||
if not data[1]and data[3]%8==0 then
|
||||
SFX.play("collect")
|
||||
|
||||
Reference in New Issue
Block a user