; The CMD file.
;
; Two parts: 1. Command definition and  2. State entry
; (state entry is after the commands def section)
;
; 1. Command definition
; ---------------------
; Note: The commands are CASE-SENSITIVE, and so are the command names.
; The eight directions are:
;   B, DB, D, DF, F, UF, U, UB     (all CAPS)
;   corresponding to back, down-back, down, downforward, etc.
; The six buttons are:
;   a, b, c, x, y, z               (all lower case)
;   In default key config, abc are are the bottom, and xyz are on the
;   top row. For 2 button characters, we recommend you use a and b.
;   For 6 button characters, use abc for kicks and xyz for punches.
;
; Each [Command] section defines a command that you can use for
; state entry, as well as in the CNS file.
; The command section should look like:
;
;   [Command]
;   name = some_name
;   command = the_command
;   time = time (optional -- defaults to 15 if omitted)
;
; - some_name
;   A name to give that command. You'll use this name to refer to
;   that command in the state entry, as well as the CNS. It is case-
;   sensitive (QCB_a is NOT the same as Qcb_a or QCB_A).
;
; - command
;   list of buttons or directions, separated by commas.
;   Directions and buttons can be preceded by special characters:
;   slash (/) - means the key must be held down
;          egs. command = /D       ;hold the down direction
;               command = /DB, a   ;hold down-back while you press a
;   tilde (~) - to detect key releases
;          egs. command = ~a       ;release the a button
;               command = ~D, F, a ;release down, press fwd, then a
;          If you want to detect "charge moves", you can specify
;          the time the key must be held down for (in game-ticks)
;          egs. command = ~30a     ;hold a for at least 30 ticks, then release
;   dollar ($) - Direction-only: detect as 4-way
;          egs. command = $D       ;will detect if D, DB or DF is held
;               command = $B       ;will detect if B, DB or UB is held
;   plus (+) - Buttons only: simultaneous press
;          egs. command = a+b      ;press a and b at the same time
;               command = x+y+z    ;press x, y and z at the same time
;   You can combine them:
;     eg. command = ~30$D, a+b     ;hold D, DB or DF for 30 ticks, release,
;                                  ;then press a and b together
;   It's recommended that for most "motion" commads, eg. quarter-circle-fwd,
;   you start off with a "release direction". This matches the way most
;   popular fighting games implement their command detection.
;
; - time (optional)
;   Time allowed to do the command, given in game-ticks. Defaults to 15
;   if omitted
;
; If you have two or more commands with the same name, all of them will
; work. You can use it to allow multiple motions for the same move.
;
; Some common commands examples are given below.
;
; [Command] ;Quarter circle forward + x
; name = "QCF_x"
; command = ~D, DF, F, x
;
; [Command] ;Half circle back + a
; name = "HCB_a"
; command = ~F, DF, D, DB, B, a
;
; [Command] ;Two quarter circles forward + y
; name = "2QCF_y"
; command = ~D, DF, F, D, DF, F, y
;
; [Command] ;Tap b rapidly
; name = "5b"
; command = b, b, b, b, b
; time = 30
;
; [Command] ;Charge back, then forward + z
; name = "charge_B_F_z"
; command = ~60$B, F, z
; time = 10
; 
; [Command] ;Charge down, then up + c
; name = "charge_D_U_c"
; command = ~60$D, U, c
; time = 10
; 

;-| Button Remapping |-----------------------------------------------------
; This section lets you remap the player's buttons (to easily change the
; button configuration). The format is:
;   old_button = new_button
; If new_button is left blank, the button cannot be pressed.
[Remap]
x = x
y = y
z = z
a = a
b = b
c = c
s = s

;-| Default Values |-------------------------------------------------------
[Defaults]
; Default value for the "time" parameter of a Command. Minimum 1.
command.time = 15

; Default value for the "buffer.time" parameter of a Command. Minimum 1,
; maximum 30.
command.buffer.time = 1

;-| Super Motions |--------------------------------------------------------
[Command]
name = "QCF2P"
command = ~D, DF, F, x+y

[Command]
name = "QCF2P2"
command = ~D, DF, F,x+z

[Command]
name = "QCF2P2"
command = ~D, DF, F, y+z

[Command]
name = "QCB2P"
command = ~D, DB, B, x+y

[Command]
name = "QCB2P2"
command = ~D, DB, B, x+z

[Command]
name = "QCB2P2"
command = ~D, DB, B, y+z

;-| Special Motions |------------------------------------------------------





[Command]
name = "QCF_a"
command = ~D, DF, F, a
buffer.time=3
[Command]
name = "QCF_b"
command = ~D, DF, F, b
buffer.time=3
[Command]
name = "QCF_c"
command = ~D, DF, F, c
buffer.time=3

[Command]
name = "QCF_a"
command = ~D, DF, F, ~a
buffer.time=3
[Command]
name = "QCF_b"
command = ~D, DF, F, ~b
buffer.time=3
[Command]
name = "QCF_c"
command = ~D, DF, F, ~c
buffer.time=3

[Command]
name = "QCF_x"
command = ~D, DF, F, x
buffer.time=3
[Command]
name = "QCF_y"
command = ~D, DF, F, y
buffer.time=3
[Command]
name = "QCF_z"
command = ~D, DF, F, z
buffer.time=3

[Command]
name = "QCF_x"
command = ~D, DF, F, ~x
buffer.time=3
[Command]
name = "QCF_y"
command = ~D, DF, F, ~y
buffer.time=3
[Command]
name = "QCF_z"
command = ~D, DF, F, ~z
buffer.time=3


;-| Double Tap |-----------------------------------------------------------
[Command]
name = "FF"     ;Required (do not remove)
command = F, F
time = 10

[Command]
name = "BB"     ;Required (do not remove)
command = B, B
time = 10



;-| 2/3 Button Combination |-----------------------------------------------
[Command]
name = "recovery" ;Required (do not remove)
command = x+y
time = 1


[Command]
name = "SJ"
command = $D,$U
time = 15


[Command]
name="2p"
command=x+y
time=5
[Command]
name="2p"
command=x+z
time=5
[Command]
name="2p"
command=y+z
time=5

[Command]
name="2k"
command=a+b
time=5
[Command]
name="2k"
command=a+c
time=5
[Command]
name="2k"
command=b+c
time=5
[Command]
name = "recovery"
command = y+z
time = 1

[Command]
name = "recovery"
command = x+z
time = 1

[Command]
name = "recovery"
command = a+b
time = 1

[Command]
name = "recovery"
command = b+c
time = 1

[Command]
name = "recovery"
command = a+c
time = 1

;-| Dir + Button |---------------------------------------------------------
[Command]
name = "back_x"
command = /$B,x
time = 1

[Command]
name = "back_y"
command = /$B,y
time = 1

[Command]
name = "back_z"
command = /$B,z
time = 1

[Command]
name = "down_x"
command = /$D,x
time = 1

[Command]
name = "down_y"
command = /$D,y
time = 1

[Command]
name = "down_z"
command = /$D,z
time = 1

[Command]
name = "fwd_x"
command = /$F,x
time = 1

[Command]
name = "fwd_y"
command = /$F,y
time = 1

[Command]
name = "fwd_z"
command = /$F,z
time = 1

[Command]
name = "up_x"
command = /$U,x
time = 1

[Command]
name = "up_y"
command = /$U,y
time = 1

[Command]
name = "up_z"
command = /$U,z
time = 1

[Command]
name = "back_a"
command = /$B,a
time = 1

[Command]
name = "back_b"
command = /$B,b
time = 1

[Command]
name = "back_c"
command = /$B,c
time = 1

[Command]
name = "down_a"
command = /$D,a
time = 1

[Command]
name = "down_b"
command = /$D,b
time = 1

[Command]
name = "down_c"
command = /$D,c
time = 1

[Command]
name = "fwd_a"
command = /$F,a
time = 1

[Command]
name = "fwd_b"
command = /$F,b
time = 1

[Command]
name = "fwd_c"
command = /$F,c
time = 1

[Command]
name = "up_a"
command = /$U,a
time = 1

[Command]
name = "up_b"
command = /$U,b
time = 1

[Command]
name = "up_c"
command = /$U,c
time = 1

;-| Single Button |---------------------------------------------------------
[Command]
name = "a"
command = a
time = 1
buffer.time=3
[Command]
name = "b"
command = b
time = 1
buffer.time=3
[Command]
name = "c"
command = c
time = 1
buffer.time=3
[Command]
name = "x"
command = x
time = 1
buffer.time=3
[Command]
name = "y"
command = y
time = 1
buffer.time=3
[Command]
name = "z"
command = z
time = 1
buffer.time=3
[Command]
name = "s"
command = s
time = 1

;-| Single Dir |------------------------------------------------------------
[Command]
name = "fwd" ;Required (do not remove)
command = $F
time = 1

[Command]
name = "downfwd"
command = $DF
time = 1

[Command]
name = "down" ;Required (do not remove)
command = $D
time = 1

[Command]
name = "downback"
command = $DB
time = 1

[Command]
name = "back" ;Required (do not remove)
command = $B
time = 1

[Command]
name = "upback"
command = $UB
time = 1

[Command]
name = "up" ;Required (do not remove)
command = $U
time = 1

[Command]
name = "upfwd"
command = $UF
time = 1

;-| Hold Button |--------------------------------------------------------------
[Command]
name = "hold_x"
command = /x
time = 1

[Command]
name = "hold_y"
command = /y
time = 1

[Command]
name = "hold_z"
command = /z
time = 1

[Command]
name = "hold_a"
command = /a
time = 1

[Command]
name = "hold_b"
command = /b
time = 1

[Command]
name = "hold_c"
command = /c
time = 1

[Command]
name = "hold_s"
command = /s
time = 1

;-| Hold Dir |--------------------------------------------------------------
[Command]
name = "holdfwd" ;Required (do not remove)
command = /$F
time = 1

[Command]
name = "holddownfwd"
command = /$DF
time = 1

[Command]
name = "holddown" ;Required (do not remove)
command = /$D
time = 1

[Command]
name = "holddownback"
command = /$DB
time = 1

[Command]
name = "holdback" ;Required (do not remove)
command = /$B
time = 1

[Command]
name = "holdupback"
command = /$UB
time = 1

[Command]
name = "holdup" ;Required (do not remove)
command = /$U
time = 1

[Command]
name = "holdupfwd"
command = /$UF
time = 1

[Command]
name = "360"
command = ~$F,$D,$B,$U
time = 4

[Command]
name = "360"
command = ~$D,$B,$U,$F
time =4

[Command]
name = "360"
command = ~$B,$U,$F,$D
time =4

[Command]
name = "360"
command = ~$U,$F,$D,$B
time =4

[Command]
name = "360"
command = ~$B,$D,$F,$U
time =4

[Command]
name = "360"
command = ~$D,$F,$U,$B
time =4


[Command]
name = "360"
command = ~$F,$U,$B,$D
time = 4

[Command]
name = "360"
command = ~$U,$B,$D,$F
time = 4

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


; Don't remove the following line. It's required by the CMD standard.
[Statedef -1]
;---------------------------------------------------------------------
[State -1, AIgh]
type = ChangeState
value = 3000
triggerall = AILevel > 0 && roundstate = 2 &&power>=1000
triggerall = (p2stateno!=[120,155])
trigger1 =  ctrl && numhelper(4001) && p2statetype=A
triggerall = ((p2bodydist x=[0,190])&& (p2statetype!=A||p2stateno=441))
triggerall = random < 15*AILevel
triggerall = movetype!=H&&statetype!=A
triggerall = p2stateno!=821&&p2stateno!=841&&p2stateno!=821&&p2stateno!=1001&&p2stateno!=1203
trigger2 = stateno=1050 &&movehit&&frontedgebodydist <50

;---------------------------------------------------------------------
[State -1, AIgh]
type = ChangeState
value = 3050+numhelper(4001)
triggerall = AILevel > 0 && roundstate = 2 &&power>=1000
triggerall = (p2stateno!=[120,155])
trigger1 =  ctrl && p2bodydist x >70
trigger2 = stateno=1050 && moveguarded
trigger3 = (stateno=610 || stateno=640) && movehit && numhelper(4001)
trigger4 = (stateno=210 || stateno=240 || stateno=410 || stateno=240) && moveguarded &&  !numhelper(4001)
triggerall = ((p2bodydist x=[0,150])&& numhelper(4001))|| !numhelper(4001)
triggerall = random < 13*AILevel
triggerall = stateno != [800,3999]
triggerall = p2statetype!=L
triggerall = movetype!=H
triggerall = statetype!=A ||numhelper(4001)
triggerall = p2stateno!=821&&p2stateno!=841&&p2stateno!=821&&p2stateno!=1001&&p2stateno!=1203


 ;--------------------------------------------
[State -1, Guard]
type = ChangeState
value = 120
triggerall = movetype !=H
triggerall = roundstate = 2
triggerall = stateno!=[120,155]
triggerall=AILevel>0
triggerall = (p2bodydist x <100||( enemynear,hitdefattr=SCA,NP,SP,HP || enemynear,hitdefattr = SCA,AA)|| enemy,numproj >0) || p2statetype!=S
;triggerall = (statetype!=A)||(statetype=A && p2bodydist x >5)
triggerall =(StateNo !=[200,3999])&&(StateNo != 105)
Triggerall =  Random < (113*AILevel)
triggerall =InGuardDist||((EnemyNear, movetype=A)||( enemynear,hitdefattr=SCA,NP,SP,HP || enemynear,hitdefattr = SCA,AA))|| enemy,numproj >0
trigger1 = (ctrl || stateno=100) ||stateno=20


;------------------------------------------------------
[State -1, AI Throw]
type = ChangeState
value = ifelse(statetype!=A,ifelse(random<250,800,830),840)
triggerall = random <= 35*AILevel
triggerall = AILevel >0
triggerall = statetype != A||(p2statetype=A&&statetype=A)
triggerall= ((p2statetype != A)&&statetype!=A)||p2statetype=A
triggerall = ctrl || stateno=20|| stateno=50
triggerall = stateno != [200,9999]
Triggerall = (RoundState = 2)
triggerall = movetype!=H
triggerall = p2statetype!=L
triggerall = (enemy,ctrl)|| p2movetype!=H
trigger1 = p2bodydist X < 25 && (p2bodydist y = [-50,40]) && ctrl
trigger2 = (p2stateno =[120,150]) &&(p2bodydist X < 25 && (p2bodydist y = [-50,40]))

;------------------------------------------------------
[State -1, SLPAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [0,70])&&(P2BodyDist Y = [-40,0] )
Triggerall = Random <=50*AILEvel
triggerall = p2statetype != L 
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
triggerall = p2statetype !=C
triggerall=p2stateno!=821&&p2stateno!=841&&p2stateno!=821&&p2stateno!=1001&&p2stateno!=1203
trigger1 = (ctrl || stateno=100||stateno=105)
value = 200
;------------------------------------------------------
[State -1, CLPAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [0,95])&&(P2BodyDist Y = [-40,0] )
Triggerall = Random <=50*AILEvel
triggerall = p2statetype != L 
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
triggerall=p2stateno!=821&&p2stateno!=841&&p2stateno!=821&&p2stateno!=1001&&p2stateno!=1203
trigger1 = (ctrl || stateno=100||stateno=105)
value = 400
;------------------------------------------------------
[State -1, CLKAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [0,60])&&(P2statetype!=A||(p2stateno=821||p2stateno=841||p2stateno=821||p2stateno=10001||p2stateno=1203))
Triggerall = Random <=50*AILEvel
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
triggerall = p2statetype =S || p2statetype=L && p2stateno!=10613
trigger1 = (ctrl || stateno=100||stateno=105)
value = 430


;------------------------------------------------------
[State -1, CMKAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [0,70])&&(P2statetype!=A )
Triggerall = Random <=50*AILEvel
triggerall = p2statetype != L  || movecontact
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
trigger1 = (ctrl && var(57)=0&&p2statetype=S) || ((stateno = 200 || stateno=230 || stateno = 400 || stateno=430) && movecontact&& var(57)=1&&p2statetype=S)
value = 435
;------------------------------------------------------
[State -1, SMKAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [0,80])&&(P2BodyDist Y = [-40,0] )
Triggerall = Random <=50*AILEvel
triggerall = p2statetype != L 
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
triggerall = p2statetype !=C
trigger1 = (ctrl && var(57)=0) || ((stateno = 200 || stateno=230 || stateno = 400 || stateno=430) && movecontact&& var(57)=1)
value = 235
;------------------------------------------------------
[State -1, CMPAI ]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [0,85])&&(P2BodyDist Y = [-40,0] )
Triggerall = Random <=50*AILEvel
triggerall = p2statetype != L 
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
triggerall = p2statetype !=A
trigger1 = (ctrl && var(57)=0) || ((stateno = 200 || stateno=230 || stateno = 400 || stateno=430) && movecontact&& var(57)=1)
value = 405

;------------------------------------------------------
[State -1, SMPAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [0,70])&&(P2BodyDist Y = [-40,0] )
Triggerall = Random <=50*AILEvel
triggerall = p2statetype != L 
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
triggerall = p2statetype !=C
trigger1 = (ctrl && var(57)=0) || ((stateno = 200 || stateno=230 || stateno = 400 || stateno=430) && movecontact&& var(57)=1)
value = 205
;------------------------------------------------------
[State -1, SHKAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [0,70])&&(P2BodyDist Y = [-65,0] )
Triggerall = Random <=50*AILEvel
triggerall = p2statetype != L || movecontact
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
triggerall=p2stateno!=821&&p2stateno!=841&&p2stateno!=821&&p2stateno!=1001&&p2stateno!=1203
trigger1=  (stateno=400||stateno=230||stateno=430||stateno=200)&&movecontact && (numhelper(4001) || AIlevel <=4)
trigger2 = ctrl && p2statetype=A
trigger3 = stateno=430 &&movehit && p2statetype=L
value = 240
;------------------------------------------------------
[State -1, SHPAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [0,100])&&(P2BodyDist Y = [-40,0] )
Triggerall = Random <=30*AILEvel
triggerall = p2statetype != L 
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
trigger1= ctrl && (numhelper(4001)|| p2bodydist x >80)
value = 210
;-----------------------------------------
[State -1, CHPAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (numhelper(4001) && p2bodydist x <100||P2BodyDist X = [80,125])&&((P2BodyDist Y = 0 ))
Triggerall = Random <=50*AILEvel||(stateno=430&&movehit)
triggerall=p2stateno!=821&&p2stateno!=841&&p2stateno!=821&&p2stateno!=1001&&p2stateno!=1203
triggerall = p2statetype != L
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
trigger1 = ctrl &&numhelper(4001)
trigger2= (stateno=430||stateno=440||stateno=400) && movecontact && (numhelper(4001) || AIlevel <=4)
value = 410
;------------------------------------------------------
[State -1,CHKAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [70,110])&&(P2statetype!=A )
Triggerall = Random <=50*AILEvel
triggerall = p2statetype != L 
triggerall=p2stateno!=821&&p2stateno!=841&&p2stateno!=821&&p2stateno!=1001&&p2stateno!=1203
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
triggerall = p2statetype =S 
trigger1 = ctrl 
trigger2 = (stateno=400||stateno=230||stateno=430||stateno=200)&&movecontact
value =440
;------------------------------------------------------
[State -1, SLKAI]
Type = ChangeState
Triggerall = (RoundState = 2) && (AILevel >0)
Triggerall = StateType !=A
triggerall = roundstate = 2
triggerall = stateno != [800,3999]
Triggerall = (P2BodyDist X = [0,60])&&(P2BodyDist Y = [-40,0] )
Triggerall = Random <= 200
triggerall = p2statetype != L 
triggerall=p2stateno!=821&&p2stateno!=841&&p2stateno!=821&&p2stateno!=1001&&p2stateno!=1203
triggerall = p2stateno !=[120,150]
triggerall = enemy,anim!=5120
triggerall = p2statetype !=C
trigger1 = (ctrl || stateno=100||stateno=105)
value = 230
;---------------------------------------------------------------------------
;Jump Light Punch
;空中弱パンチ
[State -1, AI9]
type = ChangeState
value = 600
triggerall = AILevel >0
triggerall = statetype = A
triggerall = stateno !=610
triggerall = stateno !=640
triggerall = var(50) =1
triggerall = vel y >0 || p2statetype=A
Triggerall = (P2BodyDist X = [0,70])
Triggerall = (P2BodyDist y = [-25,65])
Triggerall = Random <= 500 || (var(9)&&AILevel >6)
triggerall = roundstate = 2
trigger1 = (ctrl || stateno=100||stateno=105)


;---------------------------------------------------------------------------
;Jump Light Kick
[State -1, AI9]
type = ChangeState
value = 630
triggerall = AILevel >0
triggerall = statetype = A
triggerall = stateno !=610
triggerall = stateno !=640
triggerall = var(50) =1
triggerall = vel y >0 || p2statetype=A
Triggerall = (P2BodyDist X = [-5,40])
Triggerall = (P2BodyDist y = [-35,65])
Triggerall = Random <= 500
triggerall = roundstate = 2
trigger1 = (ctrl || stateno=100||stateno=105)
trigger2 = stateno = 600 && movecontact


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

[State -1, AI9]
type = ChangeState
value = 640
triggerall = AILevel >0
triggerall = statetype = A
triggerall = stateno !=610
triggerall = stateno !=640
triggerall = var(50) =1
Triggerall = (P2BodyDist X = [0,70])
Triggerall = (P2BodyDist y = [-35,65])
Triggerall = Random <= 500
triggerall = roundstate = 2
trigger1 = (ctrl && var(57)=0) || ((stateno = 600 || stateno=630||stateno = 610) && movecontact&& var(57)=1)
trigger2 = stateno = 600 && movecontact
trigger3 = stateno = 630 && movecontact
trigger4 = stateno = 610&& movecontact
;---------------------------------------------------------------------------
;Jump Light Punch
;空中弱パンチ
[State -1, AI9]
type = ChangeState
value = 610
triggerall = AILevel >0
triggerall = statetype = A
triggerall = stateno !=610
triggerall = stateno !=640
triggerall = var(50) =1

Triggerall = (P2BodyDist X = [0,65])
Triggerall = (P2BodyDist y = [-35,45])
Triggerall = Random <= 500
triggerall = roundstate = 2
trigger1 = (ctrl && var(57)=0) || ((stateno = 600 || stateno=630) && movecontact&& var(57)=1)
trigger2 = stateno = 600 && movecontact
trigger3 = stateno = 630 && movecontact

;---------------------------------------------------------------------
[State -1, AIgh]
type = ChangeState
value = 1000
triggerall = AILevel > 0 && roundstate = 2
triggerall = (p2stateno!=[120,155])

triggerall = ((p2bodydist x=[-10,110])) 
triggerall = random < 25*AILevel  || (movehit&&(stateno=620||stateno=650))
triggerall = stateno != [800,3999]
triggerall = movetype!=H
triggerall = p2stateno!=821&&p2stateno!=841&&p2stateno!=821&&p2stateno!=1001&&p2stateno!=1203
trigger1 =  ctrl && numhelper(4001)
trigger2 = ((stateno=650||stateno=620||stateno=435 && p2bodydist x >80)&& movehit)&&p2statetype!=A
trigger3 = stateno=210 && (moveguarded&&AIlevel >5||movecontact&&AIlevel<=5)
trigger4 = stateno=410 && (movehit&&AIlevel >5||movecontact&&AIlevel<=5) && p2bodydist x <20
;------------------------------------------------------------------------------
[State -1, AI]
type = ChangeState
value = 1050
triggerall = AILevel >0
triggerall = roundstate = 2
triggerall =p2bodydist y=[-135,150]
triggerall = movecontact||numhelper(4001) && p2bodydist x <160||(p2statetype=A && p2bodydist x= [85,130]) || p2bodydist x=[85,170]
triggerall = stateno !=[800,4999]
triggerall = p2statetype != L
triggerall = movetype != H
triggerall = var(9) || Statetype!=A  || p2movetype!=H ||movecontact
triggerall = random < 25*AILevel
triggerall = p2movetype!=A || numhelper(4001) || movecontact
trigger1= (ctrl|| stateno=20 || stateno=100|| stateno=105) && (p2movetype!=I||numhelper(4001))
trigger2 = ((stateno=610||stateno=640)&&(movehit&&AIlevel >5||movecontact&&AIlevel<=5))
trigger3 = ((stateno=405||stateno=635||stateno=205 ||stateno=235||stateno=435)&&(movehit&&AIlevel >5||movecontact&&AIlevel<=5))
triggerall = p2stateno !=[120,150]
;---------------------------------------------------------------------------
;Jump Strong Punch
[State -1, AI9]
type = ChangeState
value = 621
triggerall = AILevel >0
triggerall = statetype = A
triggerall = var(50) =1
Triggerall = (P2BodyDist X = [0,100])
Triggerall = (P2BodyDist y = [-35,55])
Triggerall = Random <= 44*AILEvel
triggerall = vel y >0 || p2statetype=A
triggerall = roundstate = 2
triggerall = movecontact|| p2statetype!=A
trigger1 = ctrl 
trigger2 = stateno = 610 && movecontact
trigger3 = stateno = 640 && movecontact
;---------------------------------------------------------------------------
;Jump Strong Punch
[State -1, AI9]
type = ChangeState
value = 620
triggerall = AILevel >0
triggerall = statetype = A
triggerall = var(50) =1
Triggerall = (P2BodyDist X = [0,75])
Triggerall = (P2BodyDist y = [-35,65])
Triggerall = Random <= 44*AILEvel
triggerall = vel y >0 || p2statetype=A
triggerall = roundstate = 2
triggerall = movecontact|| p2statetype!=A
trigger1 = ctrl 
trigger2 = stateno = 610 && movecontact
trigger3 = stateno = 640 && movecontact
;---------------------------------------------------------------------------
[State -1, AI9]
type = ChangeState
value = 650
triggerall = AILevel >0
triggerall = statetype = A
triggerall = stateno !=615
triggerall = stateno !=640
triggerall = vel y >0 || p2statetype=A
triggerall = var(50) =1
Triggerall = (P2BodyDist X = [-20,65])
Triggerall = (P2BodyDist y = [-35,75])
Triggerall = Random <= 500
triggerall = roundstate = 2
triggerall = movecontact||  p2statetype!=A
trigger1 = ctrl 
trigger2 = stateno = 610 && movecontact
trigger3 = stateno = 640 && movecontact


;------------------------------------------------------------------------
[State -1, AIgp]
type = ChangeState
value = 1600
triggerall = AILevel >0 && StateType != A
triggerall= statetype = S
triggerall = roundstate = 2
trigger1 = stateno = 150 || stateno = 151
triggerall = p2bodydist x < 25
trigger1 = random < 499
;------------------------------------------------------------------------
[State -1, AIgp]
type = ChangeState
value = 1601
triggerall = AILevel >0 && StateType != A
triggerall= statetype = C
triggerall = roundstate = 2
trigger1 = stateno = 152 || stateno = 153
triggerall = p2bodydist x < 25
triggerall = random < 499
;------------------------------------------------------------------------
[State -1, AIgp]
type = ChangeState
value = 1602
triggerall = AILevel >0
triggerall= statetype = A
triggerall = roundstate = 2
trigger1 = stateno = 153 || stateno = 154
triggerall = p2bodydist x < 25
triggerall = random < 499
;-------------------------------------------------------------------
[State -1, AISuper Jump]
type = ChangeState
value = 55
triggerall = AILevel >0
triggerall = statetype != A
triggerall = roundstate = 2
trigger1 = stateno = 240 && movehit && !moveguarded  && p2stateno=411
;trigger1= ctrl
[state -1, AI jump]
type = changestate
triggerall=AILevel>0
triggerall = roundstate = 2
trigger1 =var(30)=1&&ctrl
value = 40


[State -1, AI run]
type=changestate
value=100
triggerall = roundstate = 2
triggerall=AILevel >0 && statetype=S && ctrl
triggerall = p2bodydist y =[-150,0]
trigger1= (stateno!=[100,105]) && p2movetype!=A && (p2bodydist x=[100,788])&& random < 199
trigger2= (p2stateno=821||p2stateno=841||p2stateno=821||p2stateno=1001||p2stateno=1203) && ctrl && p2bodydist x >40&& (random<249||AIlevel >5)
trigger3= p2movetype=H && p2statetype=A && p2bodydist x>40&& random < 399

[State -1, AI run]
type=changestate
value=20
triggerall = roundstate = 2
triggerall=AILevel >0 && statetype=S && ctrl && random < 249
triggerall = p2movetype!=H
triggerall=p2statetype!=L
trigger1= (stateno!=[20,105]) && p2movetype!=A && (p2bodydist x=[0,50])

[State -1, AIRun Back]
type = ChangeState
value = 105
triggerall = AILevel >0
triggerall = stateno !=105
triggerall = statetype != A
triggerall = random < 149
triggerall = roundstate = 2
triggerall = p2stateno!=821&&p2stateno!=841&&p2stateno!=821&&p2stateno!=1001&&p2stateno!=1203
triggerall = ctrl
trigger1 = (p2statetype =L || p2movetype = A) && (p2bodydist x=[-99,10])
;===========================================================================
[State -1, QCB2P]
type = ChangeState
value = 3050+numhelper(4001)
triggerall = command = "QCB2P" || (command="QCB2P2"&&var(57)=0)
triggerall = power >= 1000
triggerall = AILevel=0
triggerall = statetype!=A || numhelper(4001)
triggerall = var(50)=1
triggerall = roundstate=2
trigger1 = (ctrl || stateno=100||stateno=105)
trigger2 = ((stateno = [200,440]) && movecontact) || (stateno = [200,440])
trigger3 = (((stateno = [600,650]) && movecontact) || (stateno = [600,650])) && numhelper(4001)
trigger4 = (stateno=1050 && movecontact && movetype=A)||(anim=[1050,1051])
trigger5= stateno=1000
;===========================================================================
[State -1, QCF2P]
type = ChangeState
value = 3000
triggerall = command = "QCF2P"|| (command="QCF2P2"&&var(57)=0)
triggerall = power >= 1000
triggerall = AILevel=0
triggerall = roundstate=2
triggerall = var(50)=1
trigger1 = (ctrl || stateno=100||stateno=105)
trigger2 = ((stateno = [200,440]) && movecontact) || (stateno = [200,440])
trigger3 = (stateno=1050 && movecontact && movetype=A)||(anim=[1050,1051])
trigger4 = ((stateno = [200,440]) && movecontact) || (stateno = [200,440])
trigger5 = ((stateno = [600,650]) && movecontact) || (stateno = [600,650])
trigger6= stateno=1000


;===========================================================================
[State -1, Cannon_Spike_a]
type = ChangeState
value = 1050
triggerall = command = "QCF_a" || command="QCF_b" || (command="QCF_c"&&var(57)=0)
triggerall = var(50)=1
triggerall = AILevel=0
trigger1 = (ctrl || stateno=100||stateno=105)
trigger2 = ((stateno = [200,435]) && movecontact) || (stateno = [200,435])
trigger3 = ((stateno = [200,440]) && movecontact) || (stateno = [200,440])
trigger4 = ((stateno = [600,650]) && movecontact) || (stateno = [600,650])
;===========================================================================

;---------------------------------------------------------------------------
[State -1, Axel_Spin_Knuckle]
type = ChangeState
value = 1000
triggerall = command = "QCF_x"||command ="QCF_y"||(command ="QCF_z"&&var(57)=0)
triggerall = var(50)=1
triggerall = AILevel=0
trigger1 = (ctrl || stateno=100||stateno=105)
trigger2 = ((stateno = [200,435]) && movecontact) || (stateno = [200,435])
trigger3 = ((stateno = [200,440]) && movecontact) || (stateno = [200,440])
trigger4 = ((stateno = [600,650]) && movecontact) || (stateno = [600,650])
;===========================================================================
;-------------------------------------------------------------------------
[State -1, guard push]
type = ChangeState
value = 1600
triggerall =command = "2p"
triggerall= statetype = S
triggerall = var(50)=1
triggerall = AILevel = 0
trigger1 = stateno = 150 || stateno = 151
;-------------------------------------------------------------------------
[State -1, guard push]
type = ChangeState
value = 1601
triggerall =command = "2p"
triggerall= statetype = C
triggerall = var(50)=1
triggerall = AILevel = 0
trigger1 =  stateno =  152 || stateno = 153
;-------------------------------------------------------------------------
[State -1, guard push]
type = ChangeState
value = 1602
triggerall = command = "2p"
triggerall= statetype = A
triggerall = var(50)=1
triggerall = AILevel = 0
trigger1 = stateno =  154 || stateno = 155


;--------------------------------------------------------------------------
[State -1, roll]
type=changestate
value=702
triggerall = command = "holdfwd" && command = "2p"
triggerall = alive
triggerall = var(50)=1
triggerall = AILevel = 0
trigger1 = stateno = 5120
;--------------------------------------------------------------------------
[State -1, roll]
type=changestate
value=703
triggerall = command = "holdback" && command = "2p"
triggerall = alive
triggerall = var(50)=1
triggerall = AILevel = 0
trigger1 = stateno = 5120

;===========================================================================
[State -1, Super Jump]
type = ChangeState
value = 55
triggerall = AILevel = 0
triggerall = var(50)=1
triggerall = stateno !=[3000,4999]
trigger1 = command = "SJ"
trigger1 = statetype != A
trigger1 = (ctrl || stateno=100||stateno=105)
trigger2= stateno = 240 && command = "holdup" && movecontact && p2stateno=411
trigger3= stateno = 410 && command = "holdup" && movecontact  && p2stateno=411
[State -1, Jump]
type = changestate
value = 40
triggerall = AILevel = 0
triggerall = statetype != A
triggerall = command = "up"
triggerall = var(50)=1
trigger1 = (ctrl || stateno=100||stateno=105)
;[State -1, SUPAH JAWMP]
;type = ChangeState
;value = 45
;triggerall = AILevel =0
;triggerall = var(50)=1
;triggerall = stateno!=45
;triggerall = stateno=50 && time >6|| stateno!=50
;triggerall= var(6)=0
;trigger1 = statetype = A&&command = "up"
;trigger1 = (ctrl || stateno=100||stateno=105)

;Run Fwd
;ダッシュ
[State -1, Run Fwd]
type = ChangeState
value = 100
triggerall=AILevel = 0
triggerall = var(50)=1
triggerall = stateno!=100
trigger1 = command = "FF"||(command="2p"&&command!="holdback")
trigger1 = statetype = S
trigger1 = (ctrl || stateno=100||stateno=105)


;---------------------------------------------------------------------------
;Run Back
;後退ダッシュ
[State -1, Run Back]
type = ChangeState
value = 105
triggerall = AILevel = 0
triggerall = var(50)=1
triggerall = stateno!=100
triggerall = stateno!=105
trigger1 = command = "BB"||(command="2p"&&command="holdback")
trigger1 = statetype = S
trigger1 = (ctrl || stateno=100||stateno=105)

;---------------------------------------------------------------------------
; Throw
[State -1, Throw]
type = ChangeState
value = ifelse(statetype=A,840,800)
triggerall = (command = "z" && var(57)=0) || (command="y" && var(57)=1)
triggerall = ctrl
triggerall = AILevel=0
triggerall = statetype!=C
triggerall = var(50)=1
triggerall = stateno!=100
trigger1 = command = "holdfwd"  ||command = "holdback"
triggerall = p2bodydist X <25
triggerall = p2movetype != H
;---------------------------------------------------------------------------
; Throw
[State -1, Throw]
type = ChangeState
value = 830
triggerall = (command = "c" && var(57)=0) || (command="b" && var(57)=1)
triggerall = ctrl
triggerall = AILevel=0
triggerall = stateno!=100
triggerall = statetype=S
triggerall = var(50)=1
trigger1 = command = "holdfwd"  ||command = "holdback"
triggerall = p2bodydist X <25
triggerall = p2movetype != H

;===========================================================================
;---------------------------------------------------------------------------
; Taunt
[State -1, Taunt]
type = ChangeState
value = 195
triggerall = command = "s"
triggerall = AILevel=0
trigger1 = statetype != A
trigger1 = (ctrl || stateno=100||stateno=105)

;---------------------------------------------------------------------------
; Stand Light Punch
[State -1, Stand Light Punch]
type = ChangeState
value = 200
triggerall = command = "x"
triggerall = command != "holddown"
triggerall = AILevel=0
triggerall = var(50)=1
triggerall = statetype = S
trigger1 = (ctrl || stateno=100||stateno=105)
triggerall  = stateno !=405


;---------------------------------------------------------------------------
; Stand Medium Punch
[State -1, Stand Medium Punch]
type = ChangeState
value = 205
triggerall = (var(57)=0 && command = "y") || (var(57)=1 && command = "x")
triggerall = command != "holddown"
triggerall = statetype != A
triggerall = var(50)=1
triggerall = AILevel=0
trigger1 = ( (ctrl || stateno=100||stateno=105) && var(57)=0) || ((stateno = 200 || stateno=230 || stateno = 400 || stateno=430) && movecontact&& var(57)=1)
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 230 && movecontact
trigger6 = stateno = 400 && movecontact
trigger7 = stateno = 430 && movecontact

;---------------------------------------------------------------------------
; Stand Strong Punch
[State -1, Stand Strong Punch]
type = ChangeState
value = 210
triggerall =(var(57)=0 && command = "z") || (var(57)=1 && command = "y")
triggerall = command != "holddown"
triggerall = AILevel=0
triggerall = var(50)=1
triggerall = statetype != A
trigger1 =(ctrl || stateno=100||stateno=105)
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 230 && movecontact
trigger4 = stateno = 400 && movecontact
trigger5 = stateno = 430 && movecontact
;---------------------------------------------------------------------------
; Stand Light Kick
[State -1, Stand Light Kick]
type = ChangeState
value = 230
triggerall = command = "a"
triggerall = command != "holddown"
triggerall = AILevel=0
triggerall = var(50)=1
triggerall = statetype = S
trigger1 =(ctrl || stateno=100||stateno=105)

;---------------------------------------------------------------------------
; Standing Medium Kick
[State -1, Standing Medium Kick]
type = ChangeState
value = 235
triggerall = (var(57)=0 && command = "b") || (var(57)=1 && command = "a")
triggerall = command != "holddown"
triggerall = AILevel=0
triggerall = statetype != A
triggerall = var(50)=1
trigger1 = ( (ctrl || stateno=100||stateno=105) && var(57)=0) || ((stateno = 200 || stateno=230 || stateno = 400 || stateno=430) && movecontact&& var(57)=1)
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 230 && movecontact
trigger4 = stateno = 400 && movecontact
trigger5 = stateno = 430 && movecontact
;---------------------------------------------------------------------------
; Standing Strong Kick
[State -1, Standing Strong Kick]
type = ChangeState
value = 240
triggerall =(var(57)=0 && command = "c") || (var(57)=1 && command = "b")
triggerall = command != "holddown" || (command = "holddown"&& command="holdfwd")
triggerall = AILevel=0
triggerall = var(50)=1
triggerall = statetype != A
trigger1 = (ctrl)
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 230 && movecontact
trigger4 = stateno = 400 && movecontact
trigger5 = stateno = 430 && movecontact
;---------------------------------------------------------------------------
; Crouching Light Punch
[State -1, Crouching Light Punch]
type = ChangeState
value = 400
triggerall = command = "x"
triggerall = var(50)=1
triggerall = command = "holddown"
triggerall = AILevel=0
trigger1 = statetype != A
trigger1 = (ctrl || stateno=100||stateno=105)

;---------------------------------------------------------------------------
; Crouching Medium Punch
[State -1, Crouching Medium Punch]
type = ChangeState
value = 405
triggerall =(var(57)=0 && command = "y") || (var(57)=1 && command = "x")
triggerall = command = "holddown"
triggerall = AILevel=0
triggerall = var(50)=1
triggerall = statetype != A
trigger1 = ( (ctrl || stateno=100||stateno=105) && var(57)=0) || ((stateno = 200 || stateno=230 || stateno = 400 || stateno=430) && movecontact&& var(57)=1)
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 230 && movecontact
trigger4 = stateno = 400 && movecontact
trigger5 = stateno = 430 && movecontact
;---------------------------------------------------------------------------
; Crouching Strong Punch
[State -1, Crouching Strong Punch]
type = ChangeState
value = 410
triggerall = (var(57)=0 && command = "z") || (var(57)=1 && command = "y")
triggerall = command = "holddown"
triggerall = AILevel=0
triggerall = var(50)=1
triggerall = statetype != A
trigger1 = (ctrl || stateno=100||stateno=105)
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 230 && movecontact
trigger4 = stateno = 400 && movecontact
trigger5 = stateno = 430 && movecontact
;---------------------------------------------------------------------------
; Crouching Light Kick
[State -1, Crouching Light Kick]
type = ChangeState
value = 430
triggerall = command = "a"
triggerall = command = "holddown"
triggerall = AILevel=0
triggerall = var(50)=1
triggerall = statetype = C
trigger1 = (ctrl || stateno=100||stateno=105)

;---------------------------------------------------------------------------
; Crouching Medium Kick
[State -1, Crouching Medium Kick]
type = ChangeState
value = 435
triggerall = (var(57)=0 && command = "b") || (var(57)=1 && command = "a")
triggerall = command = "holddown"
triggerall = AILevel=0
triggerall = var(50)=1
triggerall =  statetype != A
trigger1 = ( (ctrl || stateno=100||stateno=105) && var(57)=0) || ((stateno = 200 || stateno=230 || stateno = 400 || stateno=430) && movecontact&& var(57)=1)
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 230 && movecontact
trigger4 = stateno = 400 && movecontact
trigger5 = stateno = 430 && movecontact
;---------------------------------------------------------------------------
; Crouching Strong Kick
[State -1, Crouching Strong Kick]
type = ChangeState
value = 440
triggerall =(var(57)=0 && command = "c") || (var(57)=1 && command = "b")
triggerall = command = "holddown" && command!="holdfwd"
triggerall = AILevel=0
triggerall = var(50)=1
triggerall =  statetype != A
trigger1 = (ctrl || stateno=100||stateno=105)
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 230 && movecontact
trigger4 = stateno = 400 && movecontact
trigger5 = stateno = 430 && movecontact
;---------------------------------------------------------------------------
; Jump Light Punch
[State -1, Jump Light Punch]
type = ChangeState
value = 600
triggerall = command = "x"
triggerall = AILevel=0
triggerall = var(50)=1&&stateno!=105
triggerall = statetype = A
trigger1 = (ctrl )
;---------------------------------------------------------------------------
; Jump Medium Punch
[State -1, Jump Medium Punch]
type = ChangeState
value = 610
triggerall = (var(57)=0 && command = "y") || (var(57)=1 && command = "x")
triggerall = AILevel=0
triggerall = statetype = A&&stateno!=105
trigger1 = ( (ctrl ) && var(57)=0) || ((stateno = 600 || stateno=630) && movecontact&& var(57)=1)
trigger2 = (StateNo = 600) && (MoveContact)
trigger3 = (StateNo = 630) && (MoveContact)
;---------------------------------------------------------------------------
; Jump Strong Punch
[State -1, Jump Strong Punch]
type = ChangeState
value = ifelse( command="holdfwd",621,620)
triggerall = (var(57)=0 && command = "z") || (var(57)=1 && command = "y")
triggerall = AILevel=0
triggerall = var(50)=1&&stateno!=105
triggerall = statetype = A
trigger1 = (ctrl )
trigger2 = (stateno = 600) && movecontact
trigger3 = (stateno = 610) && movecontact
trigger4 = (stateno = 630) && movecontact
trigger5 = (stateno = 640) && movecontact

;---------------------------------------------------------------------------
; Jump Light Kick
[State -1, Jump Light Kick]
type = ChangeState
value = 630
triggerall = command = "a"
triggerall = AILevel=0
triggerall = var(50)=1&&stateno!=105
triggerall = statetype = A
triggerall = stateno!=105
trigger1 = (ctrl )
trigger2 = (stateno = 600) && movecontact
;---------------------------------------------------------------------------
; Jump Medium Kick
[State -1, Jump Medium Kick]
type = ChangeState
value = 640
triggerall = (var(57)=0 && command = "b") || (var(57)=1 && command = "a")
triggerall = AILevel=0
triggerall = statetype = A&&stateno!=105
triggerall = stateno!=105
trigger1 = ( (ctrl) && var(57)=0) || ((stateno = 610 || stateno=630) && movecontact&& var(57)=1)
trigger2 = (stateno = 600) && movecontact
trigger3 = (stateno = 610) && movecontact
trigger4 = (stateno = 630) && movecontact
;---------------------------------------------------------------------------
; Jump Strong Kick
[State -1, Jump Strong Kick]
type = ChangeState
value = 650
triggerall = (var(57)=0 && command = "c") || (var(57)=1 && command = "b")
triggerall = AILevel=0
triggerall = stateno!=105
triggerall = statetype = A&&stateno!=105
trigger1 = (ctrl)
trigger2 = (stateno = 600) && movecontact
trigger3 = (stateno = 610) && movecontact
trigger4 = (stateno = 630) && movecontact
trigger5 = (stateno = 640) && movecontact
trigger6=(stateno = 620) && movecontact && var(29)=0