;----------------------------------------------------------------------------------------
;Bukuu Jutsu (Flying Start)
[Statedef 1999]
type=A
movetype=I
physics=A
ctrl=0
facep2=!(prevstateno=9010)

[State 450100];animtime管理
type=varset
trigger1=time=0
trigger1=var(26)!=stateno
var(25)=0
ignorehitpause=1

[State 450100]
type=varset
trigger1=time=0
trigger1=stateno!=var(26)
var(27)=101999
ignorehitpause=1

[State 1070];state管理
type=varset
trigger1=var(26)!=stateno
var(26)=stateno
ignorehitpause=1

[state 1070];ステ抜け時のanimelem
type=changeanim
trigger1=var(27)=101999
value=var(27)
elem=(var(25)>=0)*1
ignorehitpause=1

[State ]
type = VelSet
trigger1=var(25)=0
y=-8

[State 1999, 2]
type=AfterImage
Trigger1=var(25)=1
length=10
PalColor=0
TimeGap=1
FrameGap=3
Trans=Add1
time=10

;This makes the jump sound effect.
[State 1999, JumpSnd]
type=PlaySnd
trigger1=var(25)=0
value=0,2

;will go to state 2000 as soon as the move has ended.
[State 1999, Fly]
type=ChangeState
trigger1=var(25)>24
value=2000
ctrl=1
;---------------------------------------------------------------------------
;Bukuu Jutsu
[Statedef 2000]
type = S
movetype = I
physics = N
ctrl=1
anim = 2000
velset = (prevstateno = 9010)* 0,(prevstateno = 9010)* 0

[State 450100];animtime管理
type = varset
trigger1 = time=0
trigger1 = var(26)!=stateno
var(25) = 0
ignorehitpause = 1

[State 450100];anim管理,分けたほうが安定する？
type = varset
trigger1 = time=0
trigger1 = stateno!=var(26)
var(27)=2000
ignorehitpause = 1
[State 450100];anim管理
type = varset
triggerall = palno=12&&ishelper||NumHelper(1008)&&ishelper
trigger1 = time = 0
trigger1 = stateno!=var(26)
var(27)=102000
ignorehitpause = 1

[State 1070];state管理
type = varset
trigger1 = var(26)!=stateno
var(26) = stateno
ignorehitpause = 1

[state 1070];ステ抜け時のanimelem
type = changeanim
trigger1 = var(27)=2000
trigger2 = var(27)=102000
value = var(27)
elem=(var(25)%14=[0,13])*floor(var(25)%14/7+1)
ignorehitpause = 1

[State 2000, VarSet]
type = VarSet
trigger1 = var(25)=0
var(3) = 1

[State 2000, MakeDust1]
type = MakeDust
triggerall = Pos Y >= -80 && Pos Y <= -70
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
pos = -5, 75
spacing = 3

[State 2000, MakeDust2]
type = MakeDust
triggerall = Pos Y >= -70 && Pos Y <= -60
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
pos = -5, 60
spacing = 3

[State 2000, MakeDust3]
type = MakeDust
triggerall = Pos Y >= -60 && Pos Y <= -50
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
pos = -5, 50
spacing = 3

[State 2000, MakeDust4]
type = MakeDust
triggerall = Pos Y >= -50 && Pos Y <= -40
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
pos = -5, 40
spacing = 3

[State 2000, MakeDust5]
type = MakeDust
triggerall = Pos Y >= -40 
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
pos = -5, 30
spacing = 3

[State 2000, Guard]
type = ChangeState
triggerall = P2MoveType = A
triggerall = P2BodyDist X <= 120
trigger1 = Command = "holdback"
trigger2 = Command = "BB"
value = 130

[State 2000, RunSnd]
type = PlaySnd
trigger1 = command = "FF"
trigger2 = command = "BB"
trigger3 = command = "DD"
trigger4 = command = "UU"
value = 21, 0

;停止
[State 2000, Stop1]
type = VelSet
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger1 = var(2) = 0
trigger2 = Pos Y < -400
x = 0
y = 0

[State 2000, Stop2]
type = ChangeAnim
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger1 = Anim != 2000
value = 2000

;フワフワ
[State 2000,fuwavar(1)]
type = VarSet
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger1 = var(2) != 2
trigger2 = var(2) = 2
trigger2 = Vel Y >= 3
v = 2
value = 1

[State 2000,fuwavar(2)]
type = VarSet
triggerall = var(2) = 1
trigger1 = Vel Y <= -3
trigger2 = P2BodyDist Y > 400
trigger2 = Vel Y < 0
v = 2
value = 2

[State 2000,fuwaUp]
type = VelAdd
trigger1 = var(2) = 1
y = -1

[State 2000,fuwaDown]
type = VelAdd
trigger1 = var(2) = 2
y = 1

[State 2000,fuwaEnd]
type = VelSet
triggerall = var(2) != 0
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
trigger3 = command = "holdup"
trigger4 = command = "holddown"
y = 0

[State 2000,fuwaEndVar]
type = VarSet
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
trigger3 = command = "holdup"
trigger4 = command = "holddown"
v = 2
value = 0

;高さの限界
[State 2000, UpBorder1]
type = PosSet
trigger1 = Pos Y < -400
y = -400

[State 2000, UpBorder2a]
type = PosAdd
trigger1 = P2BodyDist Y > 400
trigger1 = Vel Y < 0
y = 1

[State 2000, UpBorder2b]
type = VelSet
trigger1 = P2BodyDist Y > 400
trigger1 = Vel Y < 0
y = 0

;ダッシュ分身
[State 2000, Runeffect]
type = AfterImage
trigger1 = Command = "FF"
trigger1 = Vel X < 9
trigger2 = Command = "BB"
trigger2 = Vel X > -9
trigger3 = Command = "DD"
trigger3 = Vel Y < 9
trigger4 = Command = "UU"
trigger4 = Vel Y > -9
length = 13
PalBright   =  30, 30,  0
PalContrast =  70, 70, 20
PalAdd      = -10,-10,-10
PalMul      = .85,.85,.50
TimeGap  = 1
FrameGap = 2
Trans = Add
time = 10

;ダッシュ前
[State 2000, RunFwd]
type = VelSet
trigger1 = Command = "FF"
trigger1 = Vel X < 9
x = 9

;ダッシュ後
[State 2000, RunBack]
type = VelSet
trigger1 = Command = "BB"
trigger1 = Vel X > -9
x = -9

;ダッシュ下
[State 2000, RunDown]
type = VelSet
trigger1 = Command = "DD"
trigger1 = Vel Y < 9
y = 9

;ダッシュ上
[State 2000, RunUp]
type = VelSet
trigger1 = Command = "UU"
trigger1 = Vel Y > -9
y = -9

;下降
[State 2000, GoDown1]
type = VelAdd
trigger1 = PalNo = [1, 12]
trigger1 = command = "holddown"
trigger2 = Var(30) = 59
trigger2 = P2Dist Y > 0
y = 1

[State 2000,GoDown2]
type = VelSet
trigger1 = PalNo = [1, 12]
trigger1 = command = "holddown"
trigger1 = Vel Y < 0 
trigger2 = Var(30) = 59
trigger2 = P2Dist Y > 0
trigger2 = Vel Y < 0
y = 0

;上昇
[State 2000, GoUp1]
type = VelAdd
trigger1 = PalNo = [1, 12]
trigger1 = command = "holdup"
trigger2 = Var(30) = 59
trigger2 = P2Dist Y < 0
y = -1

[State 2000,GoUp2]
type = VelSet
trigger1 = PalNo = [1, 12]
trigger1 = command = "holdup"
trigger1 = Vel Y > 0 
trigger2 = Var(30) = 59
trigger2 = P2Dist Y < 0
trigger2 = Vel Y > 0
y = 0

[State 2000, GoUpAnim]
type = ChangeAnim
trigger1 = Anim != 1999
trigger1 = command = "holdup"
trigger2 = Var(30) = 59
trigger2 = Anim != 100
trigger2 = P2Dist Y < 0
trigger3 = Anim != 1999
trigger3 = command = "holddown"
trigger4 = Var(30) = 59
trigger4 = Anim != 1999
trigger4 = P2Dist Y < 0
value = 101999

;後退
[State 2000, GoBack1]
type = VelAdd
trigger1 = PalNo = [1, 12]
trigger1 = command = "holdback"
trigger2 = Var(30) = 59
trigger2 = P2Dist X < 0 
x = -1

[State 2000,GoBack2]
type = VelSet
trigger1 = PalNo = [1, 12]
trigger1 = command = "holdback"
trigger1 = Vel X > 0 
trigger2 = Var(30) = 59
trigger2 = P2Dist X < 0
trigger2 = Vel X > 0
x = 0

[State 2000, GoBackAnim]
type = ChangeAnim
trigger1 = Anim != 105
trigger1 = command = "holdback"
trigger2 = Var(30) = 59
trigger2 = Anim != 105
trigger2 = P2Dist X < -10
value = 100105

;前進
[State 2000, GoFwd1]
type = VelAdd
trigger1 = PalNo = [1, 12]
trigger1 = command = "holdfwd"
trigger2 = Var(30) = 59
trigger2 = P2Dist X > 0
x = 1

[State 2000,GoFwd2]
type = VelSet
trigger1 = PalNo = [1, 12]
trigger1 = command = "holdfwd"
trigger1 = Vel X < 0 
trigger2 = Var(30) = 59
trigger2 = P2Dist X > 0
trigger2 = Vel X < 0
x = 0

[State 2000, GoFwdAnim]
type = ChangeAnim
trigger1 = Anim != 100
trigger1 = command = "holdfwd"
trigger2 = Var(30) = 59
trigger2 = Anim != 100
trigger2 = P2Dist X > 0
value = 100100

;方向転換
[State 2000, Turn]
type = Turn
trigger1 = P2Dist X < 0

;着地
[State 2000, Land1]
type = ChangeState
trigger1 = Pos Y >= 0
value = 52
ctrl = 1

;This ends the flying action if the command is used.
[State 2000, Land2]
type=ChangeState
triggerall=Var(30)!=59
triggerall=PalNo=[1,12]
triggerall=Command="holdx"
triggerall=Command="holdy"
trigger1=Command="holdup"
trigger2=Command="holddown"
trigger3=Command="holdback"
trigger4=Command="holdfwd"
value=50
ctrl=1

[State 2000, AI]
type=ChangeState
triggerall=var(30)=59
trigger1=fvar(14)>40
trigger2=random<100
value=50
[State 2000, AI]
type=ChangeState
triggerall=var(9)!=1
triggerall=IsHelper(1001)||IsHelper(1002)||IsHelper(1003)||IsHelper(1004)
trigger1=fvar(14)>40
trigger2=random<100
value=50

[State 2000, Kod While Flying]
type = changestate
;triggerall = stateno = 2000
trigger1 = life <=0
trigger2 = loseko
value = 5050

[State 2000, WinLose]
type = ChangeState
trigger1 = Win
trigger2 = Lose
value = 50
;---------------------------------------------------------------------------
;==========================================================================