[Command]
Name = "waza1_light"
Command = ~D, DF, F, x
Time = 20
[Command]
Name = "waza1_middle"
Command = ~D, DF, F, y
Time = 20
[Command]
Name = "waza1_hard"
Command = ~D, DF, F, z
Time = 20

[Command]
Name = "waza2_light"
Command = F, ~D, DF, x
Time = 20
[Command]
Name = "waza2_middle"
Command = F, ~D, DF, y
Time = 20
[Command]
Name = "waza2_hard"
Command = F, ~D, DF, z
Time = 20

[Command]
Name = "waza3_light"
Command = ~D, DB, B, a
[Command]
Name = "waza3_middle"
Command = ~D, DB, B, b
[Command]
Name = "waza3_hard"
Command = ~D, DB, B, c
[Command]
Name = "SUPER"
Command = $D, DF, F, D, DF, x
time = 36
[Command]
Name = "SUPER"
Command = $D, DF, F, D, DF, y
time = 36
[Command]
Name = "SUPER"
Command = $D, DF, F, D, DF, z
time = 36

[Command]
Name = "FF"
Command = F, F
[Command]
Name = "BB"
Command = B, B

[Command]
Name = "a"
Command = a
Time = 1
[Command]
Name = "b"
Command = b
Time = 1
[Command]
Name = "c"
Command = c
Time = 1
[Command]
Name = "x"
Command = x
Time = 1
[Command]
Name = "y"
Command = y
Time = 1
[Command]
Name = "z"
Command = z
Time = 1

[Command]
Name = "start"
Command = s
Time = 1

[Command]
Name = "fwd"
Command = F
Time = 1
[Command]
Name = "back"
Command = B
Time = 1
[Command]
Name = "up" 
Command = U
Time = 1
[Command]
Name = "down"
Command = D
Time = 1

[Command]
Name = "holda"
Command = /$a
Time = 1
[Command]
Name = "holdb"
Command = /$b
Time = 1
[Command]
Name = "holdc"
Command = /$c
Time = 1

[Command]
Name = "holdfwd"
Command = /$F
Time = 1
[Command]
Name = "holdback"
Command = /$B
Time = 1
[Command]
Name = "holdup" 
Command = /$U
Time = 1
[Command]
Name = "holddown"
Command = /$D
Time = 1

[Command]
Name = "recovery"
Command = a+b+c+x+y+z+s
Time = 0

[StateDef -1]
[State -1]
Type = ChangeState
Value = 2000
Triggerall = Command = "SUPER"
Triggerall = Power >= 1000
Trigger1 = StateType != A
Trigger1 = Ctrl
Trigger2 = Stateno = 201 && Movehit
Trigger3 = Stateno = 211 && Movehit
Trigger4 = Stateno = 300 && Movehit
Trigger5 = Stateno = 310 && Movehit
Trigger6 = Stateno = 320 && Movehit
Trigger7 = Stateno = 330 && Movehit
Trigger8 = Stateno = 340 && Movehit
Trigger9 = Stateno = 350 && Movehit
[State -1]
Type = ChangeState
Trigger1 = (Command="waza3_light"||Command="waza3_middle"||Command="waza3_hard") && (StateType!=A||(Var(13)&&!Var(10))) && (Ctrl||(Time<2&&StateNo=[200,399])||Var(6)>0||(Var(12)=-2&&MoveType=H&&HitShakeOver&&Pos Y<=0)) && Var(30) != 1 && RoundState = 2
Value = IFelse(Command="waza3_light", 1200, IFelse(Command="waza3_middle", 1201, 1202))
[State -1]
Type = ChangeState
Trigger1 = (Command="waza3_light"||Command="waza3_middle"||Command="waza3_hard")&&StateType=A&&(Ctrl||Var(6)>0||(Var(12)=-2&&MoveType=H&&HitShakeOver&&Pos Y<=0))&&Pos Y<-55&&Var(30)!=1&&RoundState=2
Value = IFelse(Command="waza3_light", 1203, IFelse(Command="waza3_middle", 1204, 1205))
[State -1]
Type = ChangeState
Trigger1 = (Command="waza2_light"||Command="waza2_middle"||Command="waza2_hard") && (StateType!=A||Var(13)) && (Ctrl||(Time<2&&StateNo=[200,399])||Var(6)>0||(Var(12)=-2&&MoveType=H&&HitShakeOver&&Pos Y<=0)) && Var(30) != 1 && RoundState = 2
Value = IFelse(Command="waza2_light", 1100, IFelse(Command="waza2_middle", 1101, 1102))
[State -1]
Type = ChangeState
Trigger1=(Command="waza1_light"||Command="waza1_middle"||Command="waza1_hard")&&!NumProjID(1)&&(StateType!=A||Var(13))&&(Ctrl||(Time<2&&StateNo=[200,399])||Var(6)>0||(Var(12)=-2&&MoveType=H&&HitShakeOver&&Pos Y<=0))&&Var(30)!=1&&RoundState=2
Value = IFelse(Command="waza1_light", 1000, IFelse(Command="waza1_middle", 1001, 1002))
[State -1]
Type = ChangeState
Trigger1 = StateNo = 20 && (Command = "y" || Command = "z" || Command = "b" || Command = "c" || (Var(10) = 2 && Command = "a")) && P2BodyDist X<(65*Const(Size.XScale)) && Var(30) != 1 && RoundState = 2
Value = IFelse(Command = "y", 504, IFelse(Command = "z", 500, IFelse(Command = "b", 510, 514)))
[State -1]
Type = ChangeState
Trigger1 = (Command = "x" || Command = "y" || Command = "z") && StateType = S && (Ctrl||(Var(12)=-2&&MoveType=H&&HitShakeOver)) && Var(30) != 1 && RoundState = 2
Value = IFelse(Command="x", 200+(P2BodyDist X<(35*Const(Size.XScale))), IFelse(Command="y", 210+(P2BodyDist X<(42*Const(Size.XScale))), 220+(P2BodyDist X<(46*Const(Size.XScale)))))
[State -1]
Type = ChangeState
Trigger1 = (Command = "a" || Command = "b" || Command = "c") && StateType = S && (Ctrl||(Var(12)=-2&&MoveType=H&&HitShakeOver)) && Var(30) != 1 && RoundState = 2
Value = IFelse(P2BodyDist X>(29*Const(Size.XScale)), IFelse(Command = "a", 230, IFelse(Command = "b", 240, IFelse(P2BodyDist X<(45*Const(Size.XScale)), 251, 250))), IFelse(Command = "a", 231, IFelse(Command = "b", 241, 251)))
[State -1]
Type = ChangeState
Trigger1 = (Command = "x" || Command = "y" || Command = "z" || Command = "a" || Command = "b" || Command = "c") && StateType = C && (Ctrl||(Var(12)=-2&&MoveType=H&&HitShakeOver)) && Var(30) != 1 && RoundState = 2
Value = IFelse(Command = "x", 300, IFelse(Command = "y", 310, IFelse(Command = "z", 320, IFelse(Command = "a", 330, IFelse(Command = "b", 340, 350)))))
[State -1]
Type = ChangeState
Trigger1 = (Command = "x" || Command = "y" || Command = "z") && StateType = A && (Ctrl||(Var(12)=-2&&MoveType=H&&HitShakeOver&&Pos Y<=0)) && Var(30) != 1 && RoundState = 2
Value = IFelse(Command = "x", 400, IFelse(Command = "y", 410, 420))
[State -1]
Type = ChangeState
Trigger1 = (Command = "a" || Command = "b" || Command = "c") && StateType = A && (Ctrl||(Var(12)=-2&&MoveType=H&&HitShakeOver&&Pos Y<=0)) && Var(30) != 1 && RoundState = 2
Value = IFelse(Command = "a", 430, IFelse(Command = "b", 440, 450))
[State -1]
Type = ChangeState
Trigger1 = Command = "a" && AnimElem = 2,>1 && (Command="x"||Command="y"||Command="z"||Command="holdup") && ((StateNo=231&&Command="holddown") || (Command!="holddown"&&StateNo=330)) && RoundState = 2
Value=IFelse(Command="holdup",40,IFelse(Command="holddown",IFelse(Command="x",300,IFelse(Command="y",310,320)),IFelse(P2Dist X<60*Const(Size.XScale),IFelse(Command="x",201,IFelse(Command="y",211,221)),IFelse(Command="x",200,IFelse(Command="y",210,220)))))
[State -1]
Type = ChangeState
Trigger1 = (Command="x"&&((StateNo=[200,201])||StateNo=300)&&AnimElem=2,>1) || ((Command = "holddown" || P2Dist X < 60*Const(Size.XScale)) && Command = "a" && ((StateNo = 231 && AnimElem = 2,>1) || (StateNo = 330 && AnimElem = 2,>1)))&&RoundState=2
Value = IFelse(Command="x", IFelse(Command="holddown", 300, IFelse(P2Dist X>59*Const(Size.XScale),200,201)), IFelse(Command="holddown", 330, IFelse(StateNo=330||P2Dist X<60*Const(Size.XScale), 231, 230)))
[State -1]
Type = ChangeState
Trigger1 = (Command="a"&&((StateNo=230||StateNo=330)&&AnimElem=2,>0)) && RoundState = 2
Value = IFelse(Command="holddown", 330, 230)


;---------------------------------------------------------------------------
; CPU AI System
;---------------------------------------------------------------------------
; Random AI
[State -1, Random]
type = VarRandom
trigger1 = Ctrl
trigger1 = AILevel > 0
trigger1 = RoundState = 2
ignorehitpause = 1
v = 33
range = 0,100

[State -1, VarSet]
type = VarSet
trigger1 = AILevel <= 0
trigger2 = RoundState != 2
ignorehitpause = 1
v = 33
value = 0

;---------------------------------------------------------------------------
; [SF2'リュウ/SF2'ケン AI SYSTEM]
;---------------------------------------------------------------------------
; ShoSF2'リュウSF2'ケン
[State -1, State]
type = ChangeState
value = 1102
triggerall = Ctrl
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
triggerall = P2MoveType != H
trigger1 = P2BodyDist X > 25
trigger1 = P2BodyDist X < 50
trigger1 = Var(33) >= 70
trigger1 = Var(33) < 80
trigger2 = P2StateType = A
trigger2 = P2BodyDist X > 25
trigger2 = P2BodyDist X < 150
trigger2 = EnemyNear, Pos Y < 0
trigger2 = EnemyNear, Vel Y >= 0
;trigger3 = Life <= (LifeMax / 4)

; Tatsumaki Senpukyaku
[State -1, State]
type = ChangeState
value = 1202
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
triggerall = P2MoveType != H
trigger1 = P2BodyDist X > 100
trigger1 = P2BodyDist X < 150
trigger1 = Var(33) >= 80
trigger1 = Var(33) < 90
trigger1 = Ctrl

; HadoSF2'ケン
[State -1, State]
type = ChangeState
value = 1002
triggerall = RoundState = 2
triggerall = NumHelper(1000) <= 0
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
triggerall = P2MoveType != H
trigger1 = P2BodyDist X >= 150
trigger1 = Var(33) >= 90
trigger1 = Var(33) < 100
trigger1 = Ctrl

; Stand Light Punch
[State -1, State]
type = ChangeState
value = 200
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 0
trigger1 = Var(33) < 5
trigger1 = Ctrl

; Stand Medium Punch
[State -1, State]
type = ChangeState
value = 210
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 5
trigger1 = Var(33) < 10
trigger1 = Ctrl

; Stand Strong Punch
[State -1, State]
type = ChangeState
value = 220
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 10
trigger1 = Var(33) < 15
trigger1 = Ctrl

; Stand Light Kick
[State -1, State]
type = ChangeState
value = 230
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 15
trigger1 = Var(33) < 20
trigger1 = Ctrl

; Stand Medium Kick
[State -1, State]
type = ChangeState
value = 240
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 20
trigger1 = Var(33) < 25
trigger1 = Ctrl

; Stand Strong Kick
[State -1, State]
type = ChangeState
value = 250
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 25
trigger1 = Var(33) < 30
trigger1 = Ctrl

; Crouch Light Punch
[State -1, State]
type = ChangeState
value = 300
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 30
trigger1 = Var(33) < 35
trigger1 = Ctrl

; Crouch Medium Punch
[State -1, State]
type = ChangeState
value = 310
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 35
trigger1 = Var(33) < 40
trigger1 = Ctrl

; Crouch Strong Punch
[State -1, State]
type = ChangeState
value = 320
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 40
trigger1 = Var(33) < 45
trigger1 = Ctrl

; Crouch Light Kick
[State -1, State]
type = ChangeState
value = 330
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 45
trigger1 = Var(33) < 50
trigger1 = Ctrl

; Crouch Medium Kick
[State -1, State]
type = ChangeState
value = 340
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 50
trigger1 = Var(33) < 55
trigger1 = Ctrl

; Crouch Strong Kick
[State -1, State]
type = ChangeState
value = 350
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType != A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 55
trigger1 = Var(33) < 60
trigger1 = Ctrl

; Jump Light Punch
[State -1, State]
type = ChangeState
value = 400
triggerall = RoundState = 2
triggerall = Vel Y >= 0
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType = A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 75
trigger1 = Var(33) >= 0
trigger1 = Var(33) < 10
trigger1 = Ctrl

; Jump Medium Punch
[State -1, State]
type = ChangeState
value = 410
triggerall = RoundState = 2
triggerall = Vel Y >= 0
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType = A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 75
trigger1 = Var(33) >= 10
trigger1 = Var(33) < 20
trigger1 = Ctrl

; Jump Strong Punch
[State -1, State]
type = ChangeState
value = 420
triggerall = RoundState = 2
triggerall = Vel Y >= 0
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType = A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 75
trigger1 = Var(33) >= 20
trigger1 = Var(33) < 30
trigger1 = Ctrl

; Jump Light Kick
[State -1, State]
type = ChangeState
value = 430
triggerall = RoundState = 2
triggerall = Vel Y >= 0
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType = A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 75
trigger1 = Var(33) >= 30
trigger1 = Var(33) < 40
trigger1 = Ctrl

; Jump Medium Kick
[State -1, State]
type = ChangeState
value = 440
triggerall = RoundState = 2
triggerall = Vel Y >= 0
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType = A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 75
trigger1 = Var(33) >= 40
trigger1 = Var(33) < 50
trigger1 = Ctrl

; Jump Strong Kick
[State -1, State]
type = ChangeState
value = 450
triggerall = RoundState = 2
triggerall = Vel Y >= 0
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType = A
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 75
trigger1 = Var(33) >= 50
trigger1 = Var(33) < 60
trigger1 = Ctrl

; Throw
[State -1, State]
type = ChangeState
value = 500
triggerall = RoundState = 2
triggerall = AILevel > 0
triggerall = StateNo < 120
triggerall = StateType = S
triggerall = P2StateType != L
trigger1 = P2BodyDist X <= 50
trigger1 = Var(33) >= 60
trigger1 = Var(33) < 70
trigger1 = Ctrl
;---------------------------------------------------------------------------
; [GUARD AI SYSTEM]
;---------------------------------------------------------------------------
; Crouch Guard
[State -1, Guard]
type = ChangeState
value = 131
triggerall = Ctrl
triggerall = AILevel > 0
triggerall = StateNo < 160
triggerall = RoundState = 2
triggerall = StateType != A
triggerall = P2Dist X <= 100
trigger1 = EnemyNear, MoveType = A
trigger1 = EnemyNear, HitDefAttr = C, AA, AP

; Stand Guard
[State -1, Guard]
type = ChangeState
value = 130
triggerall = Ctrl
triggerall = AILevel > 0
triggerall = StateNo < 160
triggerall = RoundState = 2
triggerall = StateType != A
triggerall = P2Dist X <= 100
trigger1 = P2StateType = A
trigger1 = EnemyNear, MoveType != H
trigger2 = EnemyNear, MoveType = A
trigger2 = EnemyNear, HitDefAttr = S, AA, AP
trigger3 = P2StateNo >= 1000
trigger3 = P2StateNo < 3000
trigger3 = P2MoveType != H
trigger3 = P2MoveType = A

;---------------------------------------------------------------------------
