; 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
;
[Command]
name = "MS"
command = ~D,F, D, B, a+b
time = 25

[Command]
name = "MS"
command = ~D,F, D, B, b+c
time = 25

[Command]
name = "MS"
command = ~D,F, D, B, a+c
time = 25


[Command]
name = "SC"
command = ~D,B, D, F, x+y
time = 25

[Command]
name = "SC"
command = ~D,B, D, F, y+z
time = 25

[Command]
name = "SC"
command = ~D,B, D, F, x+z
time = 25

[Command]
name = "SC2"
command = ~D,B, D, F, x
time = 25

[Command]
name = "SC2"
command = ~D,B, D, F, y
time = 25

[Command]
name = "SC2"
command = ~D,B, D, F, z
time = 25

[Command]
name = "FG"
command = ~D,B, D, B, x
time = 25

[Command]
name = "FG"
command = ~D,B, D, B, y
time = 25

[Command]
name = "FG"
command = ~D,B, D, B, z
time = 25

[Command]
name = "DS"
command = ~D,B, D, B, a
time = 25

[Command]
name = "DS"
command = ~D,B, D, B, b
time = 25

[Command]
name = "DS"
command = ~D,B, D, B, c
time = 25

[Command]
name = "MCK"
command = ~D,F, D, F, x
time = 25

[Command]
name = "MCK"
command = ~D,F, D, F, y
time = 25

[Command]
name = "MCK"
command = ~D,F, D, F, z
time = 25

[Command]
name = "SSS"
command = ~D,F, D, F, a
time = 20

[Command]
name = "SSS"
command = ~D,F, D, F, b
time = 20

[Command]
name = "SSS"
command = ~D,F, D, F, c
time = 20


[Command]
name = "DP_x"
command = ~F, D, DF, x

[Command]
name = "DP_y"
command = ~F, D, DF, y

[Command]
name = "DP_z"
command = ~F, D, DF, z

[Command]
name = "DP_2p"
command = ~F, D, DF, x+y

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

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


[Command]
name = "DP_a"
command = ~F, D, DF, a

[Command]
name = "DP_b"
command = ~F, D, DF, b

[Command]
name = "DP_c"
command = ~F, D, DF, c

[Command]
name = "DP_2k"
command = ~F, D, DF, a+b

[Command]
name = "DP_2k"
command = ~F, D, DF, b+c

[Command]
name = "DP_2k"
command = ~F, D, DF, a+c

[Command]
name = "QCB_a"
command = ~D, DB, B, a

[Command]
name = "QCB_b"
command = ~D, DB, B, b

[Command]
name = "QCB_c"
command = ~D, DB, B, c

[Command]
name = "QCB_2k"
command = ~D, DB, B, a+b

[Command]
name = "QCB_2k"
command = ~D, DB, B, b+c

[Command]
name = "QCB_2k"
command = ~D, DB, B, a+c

[Command]
name = "QCB_p"
command = ~D, DB, B, x

[Command]
name = "QCB_p"
command = ~D, DB, B, y

[Command]
name = "QCB_p"
command = ~D, DB, B, z

[Command]
name = "QCF_a"
command = ~D, DF, F, a

[Command]
name = "QCF_b"
command = ~D, DF, F, b

[Command]
name = "QCF_c"
command = ~D, DF, F, c

[Command]
name = "QCF_2k"
command = ~D, DF, F, a+b

[Command]
name = "QCF_2k"
command = ~D, DF, F, b+c

[Command]
name = "QCF_2k"
command = ~D, DF, F, a+c

[Command]
name = "AC1"
command = ~B, DB, D, x

[Command]
name = "AC1"
command = ~B, DB, D, y

[Command]
name = "AC1"
command = ~B, DB, D, z

[Command]
name = "AC2"
command = ~B, DB, D, a

[Command]
name = "AC2"
command = ~B, DB, D, b

[Command]
name = "AC2"
command = ~B, DB, D, c

[Command]
name = "KonamiR"
command = U,U,D,D,B,F,B,F,b,a,s
time = 250

[Command]
name = "KonamiL"
command = U,U,D,D,F,B,F,B,b,a,s
time = 250

[Command]
name = "ColorR"
command = U,D,B,F,B
time = 50

[Command]
name = "ColorL"
command = U,D,F,B,F
time = 50

[Command]
name = "RandomR"
command = B,B,F,U,D,U
time = 50

[Command]
name = "RandomL"
command = F,F,B,U,D,U
time = 50

;-| 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

[Command]
name = "sjump"
command = D, $U



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

[Command]
name = "Roll";Required (do not remove)
command = x+a
time = 1

[Command]
name = "Excel";Required (do not remove)
command = y+b
time = 1

[Command]
name = "Max";Required (do not remove)
command = z+c
time = 1

[Command]
name = "2p";Required (do not remove)
command = x+y
time = 1
[Command]
name = "2p";Required (do not remove)
command = y+z
time = 1
[Command]
name = "2p";Required (do not remove)
command = x+z
time = 1

[Command]
name = "2k";Required (do not remove)
command = a+b
time = 1
[Command]
name = "2k";Required (do not remove)
command = b+c
time = 1
[Command]
name = "2k";Required (do not remove)
command = a+c
time = 1
;-| Dir + Button |---------------------------------------------------------
[Command]
name = "down_a"
command = /$D,a
time = 1

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

;-| Single Button |---------------------------------------------------------
[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 = "tap"
command = x
time = 1

[Command]
name = "tap"
command = y
time = 1

[Command]
name = "tap"
command = z
time = 1

[Command]
name = "tap"
command = a
time = 1

[Command]
name = "tap"
command = b
time = 1

[Command]
name = "tap"
command = c
time = 1

[Command]
name = "tap"
command = F
time = 1

[Command]
name = "tap"
command = DF
time = 1

[Command]
name = "tap"
command = D
time = 1

[Command]
name = "tap"
command = DB
time = 1

[Command]
name = "tap"
command = B
time = 1

[Command]
name = "tap"
command = UB
time = 1

[Command]
name = "tap"
command = U
time = 1

[Command]
name = "tap"
command = UF
time = 1

[Command]
name = "back"
command = B
time = 1

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

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

[Command]
name = "parry"
command = F
time = 1

[Command]
name = "parry2"
command = D
time = 1

[Command]
name = "up"
command = U
time = 1

[Command]
name = "down"
command = D
time = 1

[Command]
name = "justdef"
command = $B
time = 1

[Command]
name = "raise"
command = U
time = 1

[Command]
name = "lower"
command = D
time = 1

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

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

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

[Command]
name = "holddown";Required (do not remove)
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 = "holdx"
command = /x
time = 1
[Command]
name = "holdy"
command = /y
time = 1
[Command]
name = "holdz"
command = /z
time = 1
[Command]
name = "holdstart"
command = /s
time = 1
;---------------------------------------------------------------------------
; 2. State entry
; --------------
; This is where you define what commands bring you to what states.
;
; Each state entry block looks like:
;   [State -1, Label]           ;Change Label to any name you want to use to
;                               ;identify the state with.
;   type = ChangeState          ;Don't change this
;   value = new_state_number
;   trigger1 = command = command_name
;   . . .  (any additional triggers)
;
; - new_state_number is the number of the state to change to
; - command_name is the name of the command (from the section above)
; - Useful triggers to know:
;   - statetype
;       S, C or A : current state-type of player (stand, crouch, air)
;   - ctrl
;       0 or 1 : 1 if player has control. Unless "interrupting" another
;                move, you'll want ctrl = 1
;   - stateno
;       number of state player is in - useful for "move interrupts"
;   - movecontact
;       0 or 1 : 1 if player's last attack touched the opponent
;                useful for "move interrupts"
;
; Note: The order of state entry is important.
;   State entry with a certain command must come before another state
;   entry with a command that is the subset of the first.
;   For example, command "fwd_a" must be listed before "a", and
;   "fwd_ab" should come before both of the others.
;
; For reference on triggers, see CNS documentation.
;
; Just for your information (skip if you're not interested):
; This part is an extension of the CNS. "State -1" is a special state
; that is executed once every game-tick, regardless of what other state
; you are in.


; Don't remove the following line. It's required by the CMD standard.

[Statedef -1]

[State -1, Light Kung Fu Palm]
type = ChangeState
value = 3100
triggerall = !AIlevel && fvar(27)
triggerall = command = "MS" && var(54)
triggerall = ((power >= 2000 && !fvar(10) && var(10)) || (var(19) && fvar(10) = 1)) || (power >=3000 && fvar(10)=2)
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = statetype != A && fvar(10) = 2
trigger3 = (stateno = [1000,1999]) && (movecontact = [1,20])

[State -1, Light Kung Fu Palm]
type = ChangeState
value = 3070
triggerall = !AIlevel
triggerall = command = "SC2" && ((power >= 1000 && !fvar(10) && fvar(25) && var(10)) || (fvar(25) && var(19) && fvar(10) = 1))
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,220]) || (stateno = [230,245]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact


[State -1, Light Kung Fu Palm]
type = ChangeState
value = 3070
triggerall = !AIlevel
triggerall = command = "SC" && (power >= 3000 && fvar(10)=2)
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,220]) || (stateno = [230,245]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact
trigger3 = statetype != A
trigger3 = (stateno = [1000,1999]) && (movecontact = [1,20])

[State -1, Light Kung Fu Palm]
type = ChangeState
value = 666
triggerall = fvar(26)
triggerall = statetype != A
triggerall = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2) || (stateno = [200,499])
trigger1 = (facing = 1) && Command = "KonamiR"
trigger2 = (facing = -1) && command = "KonamiL"




[State -1, Light Kung Fu Palm]
type = ChangeState
value = ifelse(statetype = A,3060,3050)
triggerall = !AIlevel
triggerall = command = "FG" && ((power >= 1000 && var(10) && fvar(10) !=1) || (var(19) && fvar(10) = 1) || (power >=2000 && fvar(10)=2))
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,220]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450]) || (stateno = [600,640])
trigger2 = movecontact
trigger3 = fvar(10) = 2 && (stateno !=[3050,3059])
trigger3 = (stateno = [1000,3999]) && (movecontact = [1,20])


[State -1, Light Kung Fu Palm]
type = ChangeState
value = ifelse(var(10) || var(19),3002,3000)
triggerall = !AIlevel
triggerall = command = "MCK" && ((power >= 1000 && fvar(10) !=1) || (var(19) && fvar(10) = 1))
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,220]) || (stateno = [230,245]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact
trigger3 = fvar(10) = 2 && (stateno !=[3000,3001]) && statetype != A
trigger3 = (stateno = [1000,3999]) && (movecontact = [1,20])

[State -1, Light Kung Fu Palm]
type = ChangeState
value = ifelse(var(10) || var(19),3042,3040)
triggerall = !AIlevel
triggerall = command = "DS" && ((power >= 1000 && (fvar(10) = 2 || (fvar(25) && fvar(10)!=1))) || (fvar(25) && var(19) && fvar(10) = 1))
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,220]) || (stateno = [230,245]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact
trigger3 = fvar(10) = 2 && (stateno !=[3040,3041]) && statetype != A
trigger3 = (stateno = [1000,3999]) && (movecontact = [1,20])

[State -1, Light Kung Fu Palm]
type = ChangeState
value = ifelse(var(10) || var(19),3030,3010)
triggerall = !AIlevel
triggerall = command = "SSS" && ((power >= 1000 && fvar(10) !=1) || (var(19) && fvar(10) = 1))
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,220]) || (stateno = [230,245]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact
trigger3 = fvar(10) = 2 && (stateno !=[3010,3014]) && statetype != A
trigger3 = (stateno = [1000,3999]) && (movecontact = [1,20])

[State EX Lightning Knee]
type = ChangeState
value = 2010
triggerall = !AIlevel
triggerall = fvar(10) = 2 && power > 500 && !var(30)
triggerall = command = "DP_2k"
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact

[State Lightning Knee]
type = ChangeState
value = ifelse(command="DP_b",1011,ifelse(command="DP_c",1012,1010))
triggerall = !AIlevel
triggerall = command = "DP_a" || command = "DP_b" || command = "DP_c"
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact
trigger3= var(26) && statetype != A

[State EX Shoot Upper]
type = ChangeState
value = 2030
triggerall = !AIlevel
triggerall = fvar(10) = 2 && power > 500 && !var(30)
triggerall = command = "DP_2p"
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact


[State Shoot Upper]
type = ChangeState
value = ifelse(command="DP_y",1031,ifelse(command="DP_z",1032,1030))
triggerall = !AIlevel
triggerall = command = "DP_x" || command = "DP_y" || command = "DP_z"
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact
trigger3= var(26) && statetype != A

[State EX Sliding Arrow]
type = ChangeState
value = 2020
triggerall = !AIlevel
triggerall = fvar(10) = 2 && power > 500 && !var(30)
triggerall = command = "QCF_2k"
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact

[State Sliding Arrow]
type = ChangeState
value = ifelse(command="QCF_b",1021,ifelse(command="QCF_c",1022,1020))
triggerall = !AIlevel
triggerall = command = "QCF_a" || command = "QCF_b" || command = "QCF_c"
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact
trigger3= var(26) && statetype != A

[State EX Shoot Kick]
type = ChangeState
value = 2000
triggerall = !AIlevel
triggerall = fvar(10) = 2 && power > 500 && !var(30)
triggerall = command = "QCB_2k"
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact


[State Shoot Kick]
type = ChangeState
value = 1000
triggerall = !AIlevel
triggerall = command = "QCB_a" || command = "QCB_b" || command = "QCB_c"
trigger1 = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101 || stateno = 40 || (stateno = 52 && anim = 57 && time >= 2)
trigger2 = (stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = movecontact
trigger3= var(26) && statetype != A


[State Crescent Wrench Kick]
type = ChangeState
value = 2040
triggerall = !AIlevel
triggerall = fvar(10) = 2 && power > 500
triggerall = command = "QCB_2k"
trigger1 = statetype = A
trigger1 = ctrl
trigger2 = (stateno = [600,640])
trigger2 = movecontact

[State Crescent Wrench Kick]
type = ChangeState
value = 1040
triggerall = !AIlevel
triggerall = command = "QCB_a" || command = "QCB_b" || command = "QCB_c"
trigger1 = statetype = A
trigger1 = ctrl 
trigger2 = (stateno = [600,640]) 
trigger2 = movecontact
trigger3 = var(30) && (Stateno = [1010,1019]) && Statetype = A
trigger3 = movecontact

;===========================================================================
;---------------------------------------------------------------------------
;Run Back
;後退ダッシュ
[State -1, Run Back]
type = ChangeState
value = ifelse(command="holdback"&&(fvar(10)=2 || fvar(18)),198,ifelse((fvar(10)=2 || fvar(18))&&!(command="holdfwd" || command="holdback"),197,199))
triggerall = !AIlevel
triggerall = command = "Roll" && fvar(10) !=1
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = (stateno =[200,499]) && time < 2

;Run Back
[State -1]
type = ChangeState
value = 900
triggerall = !AIlevel
triggerall = roundstate = 2
triggerall = Power >= 1000 && !fvar(10)
triggerall = Command = "Roll" && command != "holddown" && Command = "holdfwd"
trigger1 = stateno = [150,153]

;---------------------------------------------------------------------------
;Run Back
[State -1]
type = ChangeState
value = 901
triggerall = !AIlevel
triggerall = roundstate = 2
triggerall = Power >= 1000 && !fvar(10)
triggerall = Command = "Roll" && command != "holddown" && Command = "holdback"
trigger1 = stateno = [150,153]

;Run Back
[State -1]
type = ChangeState
value = 910
triggerall = !AIlevel
triggerall = roundstate = 2
triggerall = Power >= 1000 && !fvar(10)
triggerall = Command = "Excel" && command != "holddown" && Command = "holdfwd"
trigger1 = stateno = [150,153]

[State -1, Zero Counter]
type = ChangeState
value = 970
triggerall = !AIlevel
trigger1 = stateno = 150 || stateno = 152
trigger1 = command = "AC1" || command = "AC2"
trigger1 = roundstate = 2 && statetype != A
trigger1 = power >= ifelse(var(56),500,1000) && fvar(10) = 2

[State -1, Excel Combo]
type = ChangeState
value = ifelse(statetype=A,965,960)
triggerall = !AIlevel
trigger1 = fvar(10) = 2
trigger1 = command = "Excel"
trigger1 = roundstate = 2 && power >= 1000 && !var(30)
trigger1 = ctrl || (stateno=[100,101])

[State -1, Run Back]
type = ChangeState
value = 196
triggerall = !AIlevel
triggerall = command = "Max"
triggerall = power >= 1000 && !fvar(10) && !var(10)
trigger1 = statetype != A 
trigger1 = ctrl

[State -1, Run Back]
type = ChangeState
value = 981
triggerall = !AIlevel && fvar(27)
triggerall = command = "Max"
triggerall = !var(19) && fvar(31) && fvar(10) = 1 && var(54)
trigger1 = statetype != A
trigger1 = ctrl

[State -1, Power Charge]
type = changestate
value = 998
triggerall = !AIlevel
trigger1 = fvar(10) = 2
trigger1 = command = "holdz" && command = "holdc"
trigger1 = roundstate = 2 && statetype != A
trigger1 = power < const(data.power) && power < powermax && !var(30)
trigger1 = ctrl || (stateno = [100, 101])


;Body Slam
[State -1, Kung Fu Throw]
type = ChangeState
value = 800
triggerall = !AIlevel
triggerall = statetype = S
triggerall = ctrl
triggerall = stateno != 100
triggerall = command = "holdfwd" || command = "holdback"
trigger1 = !fvar(14) && command = "z"
trigger1 = p2bodydist X < 6
trigger1 = (p2statetype = S) || (p2statetype = C)
trigger1 = p2movetype != H
trigger2 = fvar(14) && command = "2p"

;Body Slam
[State -1, Kung Fu Throw]
type = ChangeState
value = 810
triggerall = !AIlevel
triggerall = command = "holdfwd" || command = "holdback"
triggerall = statetype = S
triggerall = ctrl
triggerall = stateno != 100
trigger1 = !fvar(14) && command = "c"
trigger1 = p2bodydist X < 6
trigger1 = (p2statetype = S) || (p2statetype = C)
trigger1 = p2movetype != H
trigger2 = fvar(14) && command = "2k"

;Body Slam
[State -1, Kung Fu Throw]
type = ChangeState
value = 850
triggerall = !AIlevel
triggerall = statetype = A
triggerall = ctrl
triggerall = stateno != 100
triggerall = command = "holdfwd" || command = "holdback"
trigger1 = !fvar(14) && command = "z"
trigger1 = (P2bodydist X = [-4,17]) && (P2bodydist Y = [-78,-enemynear,const(size.head.pos.y)-70])
trigger1 = (p2statetype = A)
trigger1 = p2movetype != H
trigger2 = fvar(14) && command = "2p"

;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 200
triggerall = !AIlevel
triggerall = command = "x"
triggerall = command != "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2 = stateno = 200 && time > 5
trigger3 = stateno = 400 && time > 4
trigger4= var(26)

;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 210
triggerall = !AIlevel
triggerall = command = "y"
triggerall = command != "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2 = var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 220
triggerall = !AIlevel
triggerall = command = "z"
triggerall = command != "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 230
triggerall = !AIlevel
triggerall = command = "a"
triggerall = command != "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = ifelse(command = "holdfwd",245,240)
triggerall = !AIlevel
triggerall = command = "b"
triggerall = command != "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 250
triggerall = !AIlevel
triggerall = command = "c"
triggerall = command != "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2= var(26)
;Taunt
;挑発
[State -1, Taunt]
type = ChangeState
value = 195
triggerall = !AIlevel
triggerall = command = "start"
trigger1 = statetype != A
trigger1 = ctrl

;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 400
triggerall = !AIlevel
triggerall = command = "x"
triggerall = command = "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2 = stateno = 200 && time > 5
trigger3 = stateno = 400 && time > 4
trigger4= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 410
triggerall = !AIlevel
triggerall = command = "y"
triggerall = command = "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 420
triggerall = !AIlevel
triggerall = command = "z"
triggerall = command = "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 430
triggerall = !AIlevel
triggerall = command = "a"
triggerall = command = "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2 = (stateno = 200 || stateno = 400) && time > 5
trigger3 = (stateno = 430 && time > 4) 
trigger4 = fvar(10) =2 && stateno = 410 && (AnimElemtime(4) =[0,3])
trigger5= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 440
triggerall = !AIlevel
triggerall = command = "b"
triggerall = command = "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2 = fvar(10) =2 && stateno = 410 && (AnimElemtime(4) =[0,3])
trigger3= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 450
triggerall = !AIlevel
triggerall = command = "c"
triggerall = command = "holddown"
triggerall = statetype != A
trigger1 = ctrl || (stateno = 100 && time > 5) || stateno = 101
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 600
triggerall = !AIlevel
triggerall = command = "x"
triggerall = statetype = A
trigger1 = ctrl
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 610
triggerall = !AIlevel
triggerall = command = "y"
triggerall = statetype = A
trigger1 = ctrl
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 620
triggerall = !AIlevel
triggerall = command = "z"
triggerall = statetype = A
trigger1 = ctrl
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 630
triggerall = !AIlevel
triggerall = command = "a"
triggerall = statetype = A
trigger1 = ctrl
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 640
triggerall = !AIlevel
triggerall = command = "b"
triggerall = statetype = A
trigger1 = ctrl
trigger2= var(26)
;Stand Light Punch
;立ち弱パンチ
[State -1, Stand Light Punch]
type = ChangeState
value = 650
triggerall = !AIlevel
triggerall = command = "c"
triggerall = statetype = A
trigger1 = ctrl
trigger2= var(26)

;Run Fwd
;ダッシュ
[State -1, Run Fwd]
type = ChangeState
value = 100
triggerall = !AIlevel
trigger1 = command = "FF"
trigger1 = statetype = S
trigger1 = ctrl

;---------------------------------------------------------------------------
;Run Back
;後退ダッシュ
[State -1, Run Back]
type = ChangeState
value = 105
triggerall = !AIlevel
trigger1 = command = "BB"
trigger1 = statetype = S
trigger1 = ctrl

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



[State -1, run]
type = changestate
value = 100
trigger1 = AIlevel && numenemy
trigger1 = statetype = S && roundstate = 2 && ctrl && random < (ifelse(fvar(10)<2,300,ifelse((enemynear,anim=5300),750,50)) * (AIlevel ** 2 / 64.0))
trigger1 = (stateno != [100, 105]) && enemynear, movetype != A && p2bodydist x > 120

[State -1, dash]
type = changestate
value = 105
triggerall = AIlevel && numenemy
triggerall = statetype = S && roundstate = 2 && ctrl
triggerall = (p2bodydist x = [0, 80]) && backedgebodydist > 80 && (stateno != [100, 105])
trigger1 = enemynear, movetype = A && random < (50 * (AIlevel ** 2 / 64.0))
trigger2 = (enemynear, stateno = 5120 || enemynear, statetype = L) && p2bodydist X < 50 && random < (400 * (AIlevel ** 2 / 64.0))

[State -1, roll / dodge]
type = changestate
value = ifelse((backedgebodydist > 60 && random < 200 && (fvar(10)=2 || fvar(18))), 197, ifelse(random < 600 && (fvar(10)=2 || fvar(18)), 198, 199))
trigger1 = AIlevel && numenemy && fvar(10) != 1 && !var(30)
trigger1 = roundstate = 2 && statetype != A && ctrl && random < (ifelse(var(10) || var(19),20,50+floor((lifemax-life)*.3)) * (AIlevel ** 2 / 64.0))
trigger1 = enemynear, movetype = A && p2bodydist x < 80 && !(facing = enemynear, facing) && (enemynear, time <=10)

[State -1, jump]
type = changestate
value = 40
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2 && ctrl
trigger1 = ctrl && p2bodydist x > 160 && p2dist y < -100 && random < (200 * (AIlevel ** 2 / 64.0))
trigger2 = enemynear, movetype = A && p2bodydist x < 160 && enemynear, hitdefattr = SC, AT

[State -1, Guard]
type = changestate
value = 120
trigger1 = AIlevel && numenemy
trigger1 = roundstate = 2 && inguarddist
trigger1 = ctrl && (stateno != [120, 155]) && !var(30)
trigger1 = !(enemynear, hitdefattr = SCA, AT) && (enemynear, time < 120)
trigger1 = statetype != A || p2statetype = A
trigger1 = random < (ifelse((p2stateno = [200, 699]), 300+floor((lifemax-life)*.4), ifelse((p2stateno = [1000, 2999]), 433+floor((lifemax-life)*.3), 1000)) * (AIlevel ** 2 / 64.0))

[State -1, Zero Counter]
type = changestate
value = 970
trigger1 = AIlevel && numenemy && fvar(10) = 2
trigger1 = (p2dist x = [-90, 90]) && stateno = 150 || stateno = 152
trigger1 = roundstate = 2 && power >= ifelse(life < lifemax*.25,ifelse(var(56),500,1000),2000) && !var(30) && life < 500 && random < (150+floor((500-life)*.2) * (AIlevel ** 2 / 64.0))

[State -1, powercharge]
type = changestate
value = 998
trigger1 = AIlevel && numenemy && fvar(10) = 2
trigger1 = roundstate = 2 && statetype != A && ctrl
trigger1 = power < const(data.power) && power < powermax && !var(30)
trigger1 = random < (50 * (AIlevel ** 2 / 64.0)) && !inguarddist && p2movetype != A && p2dist x >= 160

[State MAX boost]
type = changestate
value = 196
trigger1 = AIlevel && numenemy && !fvar(10)
trigger1 = roundstate = 2 && statetype != A && ctrl
trigger1 = power >= 2000 && !var(10)
trigger1 = random < (500 * (AIlevel ** 2 / 64.0)) && !inguarddist && p2movetype != A && p2dist x >= 120

[State MAX boost]
type = changestate
value = 981
trigger1 = AIlevel && numenemy && fvar(10) = 1 && fvar(27)
trigger1 = roundstate = 2 && statetype != A && ctrl
trigger1 = fvar(31) > 2400 && !var(19) && var(54)
trigger1 = random < (500 * (AIlevel ** 2 / 64.0)) && !inguarddist && p2movetype != A && p2dist x >= 120

[State -1, Custom Combo]
type = ChangeState
value = ifElse(StateType = A, 965, 960)
trigger1 = AILevel && NumEnemy && fvar(10)=2
trigger1 = RoundState = 2 && (StateType != A || (vel x > 0 && vel y >= 0))
trigger1 = Power >= 1000 && !var(30)
trigger1 = (ctrl || StateNo = 52 || (StateNo = [100, 101]))
trigger1 = (EnemyNear, MoveType = A) && (P2BodyDist x = [0,40]) && (P2Dist y = [-60,60]) && (EnemyNear, vel y >= 0)
trigger1 = (EnemyNear, StateNo = [200,699]) && Random < (250 * (AILevel ** 2 / 64.0))

[State -1, Fall Recovery]
type = changestate
value = 5210
trigger1 = AIlevel && numenemy
trigger1 = roundstate = 2 && alive
trigger1 = stateno = 5050 && canrecover
trigger1 = vel y > 0 && pos y < -20
trigger1 = random < (25 * (AIlevel ** 2 / 64.0))

[State -1, Fall Recovery]
type = changestate
value = 5200
trigger1 = AIlevel && numenemy && fvar(10) !=1
trigger1 = roundstate = 2 && alive
trigger1 = stateno = 5050 && gethitvar(fall.recover)
trigger1 = vel y > 0 && pos y >= -20
trigger1 = random < (100 * (AIlevel ** 2 / 64.0))

[State -1, taunt]
type = changestate
value = 195
trigger1 = AIlevel && numenemy
trigger1 = roundstate = 2 && statetype != A && life >= (enemynear, life)
trigger1 = p2dist x > 160 && (enemynear, vel y > 0) && ctrl && random < (100 * (AIlevel ** 2 / 64.0))
trigger1 = !(enemynear, ctrl) && (enemynear, movetype = H)

[State -1, airthrow]
type = changestate
value = 850
trigger1 = AIlevel && numenemy
trigger1 = roundstate = 2 && statetype = A && var(9) != 2 && ctrl
trigger1 = p2statetype = A && p2movetype != H && (pos y <= -42 || vel y < 0)
trigger1 = (p2bodydist x = [0, 36]) && (p2bodydist y = [ -25, 25]) && random < (250 * (AIlevel ** 2 / 64.0))

[State -1, throw]
type = changestate
value = ifelse(random < 500,810,800)
triggerall = AIlevel && numenemy
triggerall = roundstate = 2 && statetype = S && stateno != 100 && ctrl
triggerall = p2statetype != A && p2statetype != L && p2movetype != H
trigger1 = (p2bodydist x = [0, 31]) && (p2bodydist y = [ -25, 25]) && random < (250 * (AIlevel ** 2 / 64.0))
trigger2 = (p2stateno = [120, 155]) && (p2bodydist x = [0, 31]) && (p2bodydist y = [ -25, 25]) && random < (700 * (AIlevel ** 2 / 64.0))
trigger3 = (StateNo = 5120 || StateNo = 5201) && !AnimTime && (p2bodydist x = [0, 31]) && Random < (250+floor((lifemax-life)*.2) * (AILevel ** 2 / 64.0))
[State -1, SLP]
type = changestate
value = 200
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, 34]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && !(enemynear, hitfall)
triggerall = (enemynear, const(size.head.pos.y) <= -40) || (enemynear, statetype = A)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (20 * (AIlevel ** 2 / 64.0))

[State -1, SMP]
type = changestate
value = 210
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, 49]) && (p2bodydist y = [ -50, 50]) && p2statetype = S && !(enemynear, hitfall)
triggerall = (enemynear, const(size.head.pos.y) <= -40) || (enemynear, statetype = A)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (20 * (AIlevel ** 2 / 64.0))

[State -1, SHP]
type = changestate
value = 220
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, 95]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && !(enemynear, hitfall)
triggerall = (enemynear, const(size.head.pos.y) <= -40) || (enemynear, statetype = A)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (20 * (AIlevel ** 2 / 64.0))
trigger2 = var(30) && (stateno = 1000 && animelem = 21, 3 && movecontact) && enemy, statetype = S

[State -1, SLK]
type = changestate
value = 230
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, 47]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && p2statetype != A && !(enemynear, hitfall)
triggerall = (enemynear, const(size.head.pos.y) <= -40) || (enemynear, statetype = A)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (20 * (AIlevel ** 2 / 64.0))

[State -1, SMK2]
type = changestate
value = 240
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, ifelse(enemynear, anim=5300, 37,80)]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && !(enemynear, hitfall)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (ifelse(var(10) || var(19),500,150) * (AIlevel ** 2 / 64.0))

[State -1, SHK]
type = changestate
value = 250
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, 83]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && p2statetype != C && !(enemynear, hitfall)
triggerall = (enemynear, const(size.head.pos.y) <= -40) || (enemynear, statetype = A)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (20 * (AIlevel ** 2 / 64.0))

[State -1, CLP]
type = changestate
value = 400
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, 35]) && (p2bodydist y = [ -50, 50]) && p2statetype != A && !(enemynear, hitfall)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (20 * (AIlevel ** 2 / 64.0))
trigger2 = stateno = 200 && (movecontact = [1, 24]) && random < (50 * (AIlevel ** 2 / 64.0))

[State -1, CMP]
type = changestate
value = 410
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, 41]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && p2statetype != A && !(enemynear, hitfall)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (20 * (AIlevel ** 2 / 64.0))

[State -1, CHP]
type = changestate
value = 420
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, 50]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && !(enemynear, hitfall)
triggerall = (enemynear, const(size.head.pos.y) <= -40) || (enemynear, statetype = A)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (20 * (AIlevel ** 2 / 64.0))

[State -1, CLK]
type = changestate
value = 430
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, 43]) && (p2bodydist y = [ -50, 50]) && p2statetype = S && !(enemynear, hitfall)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (20 * (AIlevel ** 2 / 64.0))

[State -1, CMK]
type = changestate
value = 440
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, ifelse(enemynear, anim=5300, 30,88)]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && !(enemynear, hitfall)
trigger1 = (ctrl || (Stateno = [100,101])) && p2statetype = S && random < (ifelse(var(10) || var(19),500,150) * (AIlevel ** 2 / 64.0))


[State -1, CHK]
type = changestate
value = 450
triggerall = AIlevel && numenemy
triggerall = statetype != A && roundstate = 2
triggerall = (p2bodydist x = [0, 72]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && p2statetype = S && !(enemynear, hitfall)
trigger1 = (ctrl || (Stateno = [100,101])) && random < (20 * (AIlevel ** 2 / 64.0))

[State -1, ALP]
type = changestate
value = 600
triggerall = AIlevel && numenemy
triggerall = statetype = A && roundstate = 2
triggerall = (p2bodydist x = [0, 36]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && !(enemynear, hitfall)
trigger1 = ctrl && random < (100 * (AIlevel ** 2 / 64.0))

[State -1, AMP]
type = changestate
value = 610
triggerall = AIlevel && numenemy
triggerall = statetype = A && roundstate = 2
triggerall = (p2bodydist x = [0, 58]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && !(enemynear, hitfall)
trigger1 = ctrl && random < (100 * (AIlevel ** 2 / 64.0))

[State -1, AHP]
type = changestate
value = 620
triggerall = AIlevel && numenemy
triggerall = statetype = A && roundstate = 2
triggerall = (p2bodydist x = [0, 53]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && !(enemynear, hitfall)
trigger1 = ctrl && random < (100 * (AIlevel ** 2 / 64.0))

[State -1, ALK]
type = changestate
value = 630
triggerall = AIlevel && numenemy
triggerall = statetype = A && roundstate = 2
triggerall = (p2bodydist x = [0, 69]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && !(enemynear, hitfall)
trigger1 = ctrl && random < (50 * (AIlevel ** 2 / 64.0))

[State -1, AMK]
type = changestate
value = 640
triggerall = AIlevel && numenemy
triggerall = statetype = A && roundstate = 2
triggerall = (p2bodydist x = [ -63, 63]) && (p2bodydist y = [ -50, 50]) && p2statetype != L 
trigger1 = ctrl && random < (200 * (AIlevel ** 2 / 64.0))

[State -1, AHK]
type = changestate
value = 650
triggerall = AIlevel && numenemy
triggerall = statetype = A && roundstate = 2
triggerall = (p2bodydist x = [0, 47]) && (p2bodydist y = [ -50, 50]) && p2statetype != L && !(enemynear, hitfall)
trigger1 = ctrl && random < (200 * (AIlevel ** 2 / 64.0))

[State Shoot Kick]
type = changestate
value = ifelse((fvar(10)=2 && power >= 500 && var(30) <= 60 && random < 133), 2000, 1000)
triggerall = AIlevel && numenemy
triggerall = roundstate = 2 && statetype != A
triggerall = (p2stateno != [120, 155]) && p2statetype != L
triggerall = (p2bodydist x = [0, 62]) && (enemynear, statetype !=A) && (enemynear, vel y > -1) && (enemynear, vel x > -2)
triggerall = (enemynear, const(size.head.pos.y) <= -40) || (enemynear, statetype = A)
trigger1 = ctrl && p2bodydist x < 80 && random < (50 * (AIlevel ** 2 / 64.0))
trigger2 = ((stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])) && (movehit = [1, 6]) && random < (450 * (AIlevel ** 2 / 64.0))
trigger3 = ctrl && var(30) && (EnemyNear, MoveType = A) && (P2BodyDist x = [0,40]) && (Enemynear, statetype !=A)
trigger3 = (EnemyNear, StateNo = [200,499]) && Random < (50 * (AILevel ** 2 / 64.0))
trigger4 = var(30) && ((stateno = [200,499]) && movecontact)

[State Crescent Wrench Kick]
type = changestate
value = ifelse((fvar(10)=2 && power >= 500 && var(30) <= 60 && random < 100), 2040, 1040)
triggerall = AIlevel && numenemy
triggerall = roundstate = 2 && statetype = A && var(9) != 2 && vel y > -5
trigger1 = (stateno = [600, 640]) && (movehit = [1, 5]) && random < (ifelse(pos Y < -50,550,50) * (AIlevel ** 2 / 64.0))

[State Sliding Arrow]
type = changestate
value = ifelse((fvar(10)=2 && power >= 500 && var(30) <= 60 && random < 100), 2020, 1020+(p2bodydist X > 40)+(p2bodydist X > 70))
triggerall = AIlevel && numenemy
triggerall = roundstate = 2 && statetype != A
triggerall = (p2stateno != [120, 155]) && p2statetype != L && !(enemynear, hitfall)
triggerall = (p2bodydist x = [0, 120]) && (p2bodydist y >= -240) && (enemynear, vel y > -1) && (enemynear, vel x > -2)
trigger1 = ctrl && random < (50 * (AIlevel ** 2 / 64.0)) && enemynear, statetype = S
trigger2 = ((stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])) && (movehit = [1, 14]) && random < (50 * (AIlevel ** 2 / 64.0))
trigger3 = ((stateno = [200,210]) || (stateno = [230,240])) && (moveguarded) && (enemynear, statetype = S) && random < (100 * (AIlevel ** 2 / 64.0))
[State Lightning Knee]
type = ChangeState
value = ifElse(fvar(10)=2 && Power >= 500 && var(30) <= 60 && Random < 133, 2010, 1012)
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType != A
triggerall = P2StateType != L && (P2Dist y = [-32,32])
triggerall = ((P2BodyDist x = [-48,58]) && P2StateType != A) || ((P2BodyDist x = [-140,140]) && P2StateType = A)
trigger1 = (ctrl || StateNo = 52 || (StateNo = [100,101])) && Random < (25 * (AILevel ** 2 / 64.0))
trigger2 = ((stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])) && MoveHit && Random < (25 * (AILevel ** 2 / 64.0))
trigger2 = EnemyNear, GetHitVar(HitTime) >= 3

[State Lightning Knee - Juggle Attempt]
type = ChangeState
value = ifElse(fvar(10)=2 && Power >= 500 && var(30) <= 60 && Random < 133, 2010, 1012)
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType != A
triggerall = P2StateType != L && (P2Dist y = [-120,-60])
triggerall = ((P2BodyDist x = [0,80]) && P2StateType = A)
trigger1 = ctrl && enemynear, hitfall && Random < (500 * (AILevel ** 2 / 64.0))

[State Shoot Upper - Juggle Attempt]
type = ChangeState
value = ifElse(fvar(10)=2 && Power >= 500 && var(30) <= 60 && Random < 133, 2030, 1032)
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType != A
triggerall = P2StateType != L && (P2Dist y = [-90,-50])
triggerall = ((P2BodyDist x = [0,68]) && P2StateType = A)
trigger1 = ctrl && enemynear, hitfall && Random > (500 * (AILevel ** 2 / 64.0))

[State Lightning Knee 2]
type = ChangeState
value = ifElse(fvar(10)=2 && Power >= 500 && var(30) <= 60 && Random < 133, 2010, 1010)
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType != A
triggerall = P2StateType != L && (P2Dist y = [-80,0])
triggerall = ((P2BodyDist x = [-48,68]) && P2StateType != A) || ((P2BodyDist x = [-80,80]) && P2StateType = A)
trigger1 = (StateNo = 5120 || StateNo = 5201) && !AnimTime && Random < (450+floor((lifemax-life)*.2) * (AILevel ** 2 / 64.0))
trigger2 = (StateNo = [100,101]) && enemynear, movetype = A && Random < (150+floor((lifemax-life)*.2) * (AILevel ** 2 / 64.0))

[State Shoot Upper]
type = ChangeState
value = ifElse(fvar(10)=2 && Power >= 500 && var(30) <= 60 && Random < 133, 2030, 1032)
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType != A
triggerall = P2StateType != L && (P2Dist y = [-80,0])
triggerall = ((P2BodyDist x = [0,68]) && P2StateType != A) || ((P2BodyDist x = [-30,60]) && P2StateType = A)
trigger1 = ((stateno = [200,210]) || (stateno = [230,240]) || (stateno = [400,420]) || (stateno = [430,450])) && MoveHit && Random < (15 * (AILevel ** 2 / 64.0))
trigger1 = EnemyNear, GetHitVar(HitTime) >= 3
trigger1 = ctrl && enemynear, vel X >= 0 && enemynear, vel Y > 0  && Random < (150 * (AILevel ** 2 / 64.0))
trigger1 = EnemyNear, GetHitVar(HitTime) >= 3

[State Mirage Symphony]
type = ChangeState
value = 3100
triggerall = AILevel && NumEnemy && fvar(27)
triggerall = RoundState = 2 && StateType != A && var(54)
triggerall = (Power >= 3000 && fvar(10) = 2) || (power >= 2000 && !fvar(10) && var(10)) || (var(19) && fvar(10) = 1)
triggerall = !(EnemyNear, ctrl) && P2StateNo != 5201
triggerall = P2Dist x >= 0 && P2BodyDist x <= 78
triggerall = (EnemyNear, HitOver || !(EnemyNear, MoveType = H)) && !(EnemyNear, StateNo = [150,155]) && EnemyNear, Anim != 5040
triggerall = !(EnemyNear, StateNo = 40 && EnemyNear, Time >= 1) && !(EnemyNear, StateNo = 52 && !(EnemyNear, ctrl) && EnemyNear, PrevStateNo = [5020,5040])
triggerall = P2StateType != A && P2StateType != L && (P2Dist y = [-18,90])
trigger1 = (ctrl || StateNo = 52 || (StateNo = [100,101])) && Random < (500+floor((lifemax-life)*.4) * (AILevel ** 2 / 64.0))

[State Shuttle Combination]
type = ChangeState
value = 3070
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType != A && (var(30) < 60)
triggerall = (Power >= 3000 && fvar(10) = 2) || (power >= 1000 && !fvar(10) && fvar(25) && var(10)) || (fvar(25) && var(19) && fvar(10) = 1)
triggerall = !(EnemyNear, ctrl) && P2StateNo != 5201
triggerall = P2Dist x >= 0 && P2BodyDist x <= 78
triggerall = (EnemyNear, HitOver || !(EnemyNear, MoveType = H)) && !(EnemyNear, StateNo = [150,155]) && EnemyNear, Anim != 5040
triggerall = !(EnemyNear, StateNo = 40 && EnemyNear, Time >= 1) && !(EnemyNear, StateNo = 52 && !(EnemyNear, ctrl) && EnemyNear, PrevStateNo = [5020,5040])
triggerall = P2StateType != A && P2StateType != L && (P2Dist y = [-18,40])
trigger1 = (ctrl || StateNo = 52 || (StateNo = [100,101])) && Random < (500+floor((lifemax-life)*.4) * (AILevel ** 2 / 64.0))


[State Fairy Gift]
type = ChangeState
value = 3050
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType != A && (var(30) < 60)
triggerall = (Power >= 2000 && fvar(10) = 2) || (power >= 1000 && !fvar(10) && var(10)) || (var(19) && fvar(10) = 1)
triggerall = !(EnemyNear, ctrl) && P2StateNo != 5201
triggerall = P2Dist x >= 0 && P2BodyDist x <= 68
triggerall = (EnemyNear, HitOver || !(EnemyNear, MoveType = H)) && !(EnemyNear, StateNo = [150,155]) && EnemyNear, Anim != 5040
triggerall = !(EnemyNear, StateNo = 40 && EnemyNear, Time >= 1) && !(EnemyNear, StateNo = 52 && !(EnemyNear, ctrl) && EnemyNear, PrevStateNo = [5020,5040])
triggerall = P2StateType != A && P2StateType != L && (P2Dist y = [-28,60])
trigger1 = (ctrl || StateNo = 52 || (StateNo = [100,101])) && Random < (500+floor((lifemax-life)*.4) * (AILevel ** 2 / 64.0))

[State Aerial Fairy Gift]
type = ChangeState
value = 3060
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType = A && (var(30) < 60)
triggerall = (Power >= 2000 && fvar(10) = 2) || (power >= 1000 && !fvar(10) && var(10)) || (var(19) && fvar(10) = 1)
triggerall = !(EnemyNear, ctrl) && ((EnemyNear, StateNo != [120,155]) || EnemyNear, StateType = A)
triggerall = P2Dist x >= 0 && P2BodyDist x <= 48
triggerall = P2StateType != L && (P2Dist y = [-88,40])
trigger1 = (stateno = [600,640]) 
trigger1 = MoveHit && Random < (ifelse(var(10) || var(19),500+floor((lifemax-life)*.4),100+floor((lifemax-life)*.2)) * (AILevel ** 2 / 64.0))
trigger1 = EnemyNear, GetHitVar(HitTime) >= 4
trigger2 = fvar(10) = 2 && ((stateno = 1040) || (stateno = [1010,1012]))
trigger2 = MoveHit && Random < (300+floor((lifemax-life)*.4) * (AILevel ** 2 / 64.0))
trigger2 = EnemyNear, GetHitVar(HitTime) >= 4

[State Mirage Combo Kick]
type = ChangeState
value = ifelse(var(10) || var(19),3002,3000)
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType != A && (var(30) < 60)
triggerall = ((power >= 1000 && fvar(10) !=1) || (var(19) && fvar(10) = 1))
triggerall = !(EnemyNear, ctrl) && ((EnemyNear, StateNo != [120,155]) || EnemyNear, StateType = A)
triggerall = (P2BodyDist x = [-48,48]) && (P2Dist y = [-32,32])
triggerall = P2StateType != A && P2StateType != L && P2MoveType != A
trigger1 = (ctrl || StateNo = 52 || (StateNo = [100,101])) && Random < (100 * (AILevel ** 2 / 64.0))
trigger2 = (stateno = [200,220]) || (stateno = [230,245]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = MoveHit && Random < (ifelse(var(10) || var(19),500+floor((lifemax-life)*.4),100+floor((lifemax-life)*.2)) * (AILevel ** 2 / 64.0))
trigger2 = EnemyNear, GetHitVar(HitTime) >= 4
trigger3 = fvar(10) = 2 && ((stateno = 1001) || (stateno = 3011 && AnimElem = 5))
trigger3 = MoveHit && Random < (50+floor((lifemax-life)*.4) * (AILevel ** 2 / 64.0))
trigger3 = EnemyNear, GetHitVar(HitTime) >= 4

[State Spin Side Shoot]
type = ChangeState
value = ifelse(var(10) || var(19),3030,3010)
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType != A && (var(30) < 60)
triggerall = ((power >= 1000 && fvar(10) !=1) || (var(19) && fvar(10) = 1))
triggerall = !(EnemyNear, ctrl) && ((EnemyNear, StateNo != [120,155]) || EnemyNear, StateType = A)
triggerall = (P2BodyDist x = [-70,70]) && (P2Dist y = [-32,32])
triggerall = P2StateType = S && P2StateType != L && P2MoveType != A
trigger1 = (ctrl || StateNo = 52 || (StateNo = [100,101])) && Random < (100 * (AILevel ** 2 / 64.0))
trigger2 = (stateno = [200,220]) || (stateno = [230,245]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = MoveHit && Random < (ifelse(var(10) || var(19),500+floor((lifemax-life)*.4),100+floor((lifemax-life)*.2)) * (AILevel ** 2 / 64.0))
trigger2 = EnemyNear, GetHitVar(HitTime) >= 4
trigger3 = fvar(10) = 2 && ((stateno = 1001) || (stateno = 3000 && AnimElem = 26))
trigger3 = MoveHit && Random < (50 * (AILevel ** 2 / 64.0))
trigger3 = EnemyNear, GetHitVar(HitTime) >= 4

[State Dame Special]
type = ChangeState
value = ifelse(var(10) || var(19),3042,3040)
triggerall = AILevel && NumEnemy
triggerall = RoundState = 2 && StateType != A && (var(30) < 60)
triggerall = ((power >= 1000 && (fvar(10) = 2 || (fvar(25) && fvar(10)!=1))) || (fvar(25) && var(19) && fvar(10) = 1))
triggerall = !(EnemyNear, ctrl) && ((EnemyNear, StateNo != [120,155]) || EnemyNear, StateType = A)
triggerall = (P2BodyDist x = [-50,50]) && (P2Dist y = [-64,0])
triggerall = P2StateType = S && P2StateType != L && P2MoveType != A
trigger1 = (ctrl || StateNo = 52 || (StateNo = [100,101])) && Random < (100 * (AILevel ** 2 / 64.0))
trigger2 = (stateno = [200,220]) || (stateno = [230,245]) || (stateno = [400,420]) || (stateno = [430,450])
trigger2 = MoveHit && Random < (ifelse(var(10) || var(19),500+floor((lifemax-life)*.4),100+floor((lifemax-life)*.2)) * (AILevel ** 2 / 64.0))
trigger2 = EnemyNear, GetHitVar(HitTime) >= 4
trigger3 = fvar(10) = 2 && ((stateno = 1001) || (stateno = 3011 && AnimElem = 5) || (stateno = 3000 && AnimElem = 26))
trigger3 = MoveHit && Random < (50 * (AILevel ** 2 / 64.0))
trigger3 = EnemyNear, GetHitVar(HitTime) >= 4

[State Shoot Upper - Juggle Attempt]
type = ChangeState
value = ifelse(var(10) || var(19),3042,3040)
triggerall = AILevel && NumEnemy
triggerall = ((power >= 1000 && (fvar(10) = 2 || (fvar(25) && fvar(10)!=1))) || (fvar(25) && var(19) && fvar(10) = 1))
triggerall = RoundState = 2 && StateType != A
triggerall = P2StateType != L && (P2Dist y = [-90,-40])
triggerall = ((P2BodyDist x = [0,55]) && P2StateType = A)
trigger1 = (ctrl || StateNo = 52 || (StateNo = [100,101])) && enemynear, hitfall && Random > (500 * (AILevel ** 2 / 64.0))


