; Attack Priority Order:
;
; QCF x 2
; QCB HCF
; F HCF
;
; DP
; HCF
; DU
; QCF
; DD

;-| Button Remapping |-----------------------------------------------------
[Remap]
x = x
y = y
z = c
a = a
b = b
c = z
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

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

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

;-| Hold Button |----------------------------------------------------------
; Please define Anim 74140108 in your AIR file if AND ONLY IF you place these
; 7 Hold Button commands immediately after the 11 Single Button and Hold Dir
; commands at the very top of your CMD list, as demonstrated here.
; In this version of the AI code, these commands are only used by the XOR
; method, and thus are optional.  But there remains a possibility that a
; future version of the helper method might be helped by having these
; commands placed here, and Anim 74140108 would then be used to indicate
; that a partner character has a compatible CMD.
[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

;--- None of your own command definitions should be above this line. ---

;-| CPU |--------------------------------------------------------------
; Note that if you make any changes to the basic one-button or recovery
; commands, you'll need to make the same changes to their matching commands here
; and/or in the XOR VarSet controller.  That includes things like, for example:
;  * changing the recovery command to use a different combination of buttons.
;  * renaming the b button command as "d", or the start button command as "s".
;  * switching the button names around, e.g. so button y triggers "a" and button a triggers "y".
;  * having more than one way to trigger the same command name.
; If you understand how the XOR method works, the proper changes should be obvious.
; If you don't understand it, then simply disable the lines in the XOR VarSet
; controller that correspond to the commands you've altered.

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

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

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

[Command]
name = "x2"
command = x
time = 1

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

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

[Command]
name = "start2"
command = s
time = 1

[Command]
name = "holdfwd2"
command = /$F
time = 1

[Command]
name = "holdback2"
command = /$B
time = 1

[Command]
name = "holdup2"
command = /$U
time = 1

[Command]
name = "holddown2"
command = /$D
time = 1

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

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

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

[Command]
name = "holdx2"
command = /x
time = 1

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

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

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

[Command]
name = "recovery2"
command = x+y+a+b+z+c
time = 1

;-| Super Motions |--------------------------------------------------------
[Command]
name = "D,HCF_y"
command = D, B, D, F, x
time = 20

[Command]
name = "D,HCF_x"
command = D, B, D, F, y
time = 20

[Command]
name = "D,HCF_a"
command = D, B, D, F, b
time = 20

[Command]
name = "D,HCB_y"
command = D, F, D, B, x
time = 20

[Command]
name = "D,HCB_x"
command = D, F, D, B, y
time = 20

[Command]
name = "D,HCB_a"
command = D, F, D, B, b
time = 20

[Command]
name = "F,HCF_y"
command = F, B, D, F, x
time = 20

[Command]
name = "F,HCF_x"
command = F, B, D, F, y
time = 20

[Command]
name = "F,HCF_a"
command = F, B, D, F, b
time = 20

[Command]
name = "B,HCB_y"
command = B, F, D, B, x
time = 20

[Command]
name = "B,HCB_x"
command = B, F, D, B, y
time = 20

[Command]
name = "B,HCB_a"
command = B, F, D, B, b
time = 20

[Command]
name = "QCFx2_y"
command = D, F, D, F, x
time = 20

[Command]
name = "QCFx2_x"
command = D, F, D, F, y
time = 20

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

[Command]
name = "QCBx2_y"
command = D, B, D, B, x
time = 20

[Command]
name = "QCBx2_x"
command = D, B, D, B, y
time = 20

[Command]
name = "QCBx2_a"
command = D, B, D, B, b
time = 20

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

[Command]
name = "DP_y"
command = ~F, D, $F, x
buffer.time = 8

[Command]
name = "DP_x"
command = ~F, D, $F, y
buffer.time = 8

[Command]
name = "DP_a"
command = ~F, D, $F, b
buffer.time = 8

[Command]
name = "RDP_y"
command = ~B, D, $B, x
buffer.time = 8

[Command]
name = "RDP_x"
command = ~B, D, $B, y
buffer.time = 8

[Command]
name = "RDP_a"
command = ~B, D, $B, b
buffer.time = 8

[Command]
name = "HCF_y"
command = ~B, $D, F, x
time = 20
buffer.time = 8

[Command]
name = "HCF_x"
command = ~B, $D, F, y
time = 20
buffer.time = 8

[Command]
name = "HCF_a"
command = ~B, $D, F, b
time = 20
buffer.time = 8

[Command]
name = "HCB_y"
command = ~F, $D, B, x
time = 20
buffer.time = 8

[Command]
name = "HCB_x"
command = ~F, $D, B, y
time = 20
buffer.time = 8

[Command]
name = "HCB_a"
command = ~F, $D, B, b
time = 20
buffer.time = 8

[Command]
name = "DU_y"
command = ~$D, >$U, x
buffer.time = 8

[Command]
name = "DU_x"
command = ~$D, >$U, y
buffer.time = 8

[Command]
name = "DU_a"
command = ~$D, >$U, b
buffer.time = 8

[Command]
name = "RDU_y"
command = ~$D, >UB, x
buffer.time = 8

[Command]
name = "RDU_x"
command = ~$D, >UB, y
buffer.time = 8

[Command]
name = "RDU_a"
command = ~$D, >UB, b
buffer.time = 8

[Command]
name = "QCF_y"
command = ~$D, F, x
buffer.time = 8

[Command]
name = "QCF_x"
command = ~$D, F, y
buffer.time = 8

[Command]
name = "QCF_a"
command = ~$D, F, b
buffer.time = 8

[Command]
name = "QCB_y"
command = ~$D, B, x
buffer.time = 8

[Command]
name = "QCB_x"
command = ~$D, B, y
buffer.time = 8

[Command]
name = "QCB_a"
command = ~$D, B, b
buffer.time = 8

[Command]
name = "DD_y"
command = D, >~D, >D, x
buffer.time = 8

[Command]
name = "DD_x"
command = D, >~D, >D, y
buffer.time = 8

[Command]
name = "DD_a"
command = D, >~D, >D, b
buffer.time = 8

;-| Double Tap |-----------------------------------------------------------
[Command]
name = "FF"     ;Required (do not remove)
command = F, >~F, /F
time = 12
buffer.time = 2

[Command]
name = "BB"     ;Required (do not remove)
command = B, >~B, /B
time = 12
buffer.time = 2

[Command]
name = "FF2"
command = F, >~F, /F
time = 15

[Command]
name = "BB2"
command = B, >~B, /B
time = 15

[Command]
name = "AFF"
command = F, >~F, /F
time = 12
buffer.time = 8

[Command]
name = "AFF"
command = UF, >~UF, /F
time = 12
buffer.time = 8

[Command]
name = "ABB"
command = B, >~B, /B
time = 12
buffer.time = 8

[Command]
name = "ABB"
command = UB, >~UB, /B
time = 12
buffer.time = 8

;-| 2/3 Button Combination |-----------------------------------------------
[Command]
name = "recovery";Required (do not remove)
command = x+y+a+b+z+c ; You shouldn't be able to recover, but it might get mad if I remove...?
time = 1

[Command]
name = "Throw"
command = x+y
time = 1
buffer.time = 8

[Command]
name = "Throw"
command = x+b
time = 1
buffer.time = 8

[Command]
name = "Throw"
command = y+b
time = 1
buffer.time = 8

[Command]
name = "DC"
command = x+a
time = 1
buffer.time = 2

[Command]
name = "DC"
command = y+a
time = 1
buffer.time = 2

[Command]
name = "DC"
command = b+a
time = 1
buffer.time = 2

[Command]
name = "LY"
command = /c, x
time = 1
buffer.time = 8

[Command]
name = "LX"
command = /c, y
time = 1
buffer.time = 8

[Command]
name = "LA"
command = /c, b
time = 1
buffer.time = 8

;-| Dir + Button |-------------------------------------------
;[Command]
;name = "down_l"
;command = /$D,c
;time = 1

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

;-| More Hold Dir |--------------------------------------------------------------
[Command]
name = "fakedup"
command = $U
time = 1

;-| Press Dir |-------------------------------------------------------------
[Command]
name = "back"
command = ~$B
time = 1

[Command]
name = "forcheck" ; Checks if you pressed back to prevent incorrect fdf's
command = ~$F
time = 1
buffer.time = 12

[Command]
name = "backcheck" ; Checks if you pressed back to prevent incorrect fdf's
command = ~$B
time = 1
buffer.time = 12

;---------------------------------------------------------------------------
; State entry
[Statedef -1]

[State -1, Mugen 1.0 AI]
type = VarSet
trigger1 = AILevel > 0
trigger1 = roundstate = 2
trigger1 = var(0) = 0
v = 0
value = 1

[State -1, Mugen 1.0 AI]
type = VarSet
trigger1 = AILevel > 0
trigger1 = roundstate = 3
trigger1 = var(0) = 1
trigger2 = AILevel = 0
v = 0
value = 0

[State -1, AI Helper Check]
type = ChangeState
trigger1 = IsHelper(9741)
value = 9741

[State -1, AI Helper Check 2]
type = ChangeState
trigger1 = IsHelper(9742)
value = 9742

[State -1, Tick Fix]
type = CtrlSet
trigger1 = !ctrl
trigger1 = (stateno=[200,799]) && !animtime
value = 1

;------------------------------------------------------------------------------
; Custom Commands
;------------------------------------------------------------------------------

[State -1, Down Down Reset]
type = varset
trigger1 = !command = "holddown"
trigger1 = fvar(8) = -1
fvar(8) = 0
ignorehitpause = 1

[State -1, Down Down Increment]
type = varset
;triggerall = ifelse(fvar(8) >= 61, (stateno != [1000,2999]) || (stateno = [1100,1125]), 1)
;trigger1 = movecontact != 1
trigger1 = fvar(8) > 0
fvar(8) = fvar(8) + 1
ignorehitpause = 1

[State -1, Down Down Lock]
type = varset
trigger1 = command = "holddown"
trigger1 = fvar(8) = 20
fvar(8) = -1
ignorehitpause = 1

[State -1, Down Down Reset]
type = varset
;triggerall = movecontact != 1
trigger1 = fvar(8) < 61
trigger1 = Floor(fvar(8)) % 20 = 0
trigger2 = fvar(8) >= 61
trigger2 = Floor((fvar(8) - 10)) % 15 = 0
fvar(8) = 0
ignorehitpause = 1

[State -1, Down Down 1st Down]
type = varset
trigger1 = command = "holddown"
trigger1 = fvar(8) = 0
fvar(8) = 1
ignorehitpause = 1

[State -1, Down Down Release Down/2nd Down]
type = varset
trigger1 = fvar(8) > 0
trigger1 = fvar(8) < 20
trigger1 = command != "holddown"
fvar(8) = fvar(8) + 20
ignorehitpause = 1

[State -1, Down Down Release Down/2nd Down]
type = varset
trigger1 = fvar(8) > 20
trigger1 = fvar(8) < 40
trigger1 = command = "holddown"
fvar(8) = fvar(8) + 20
ignorehitpause = 1

[State -1, Down Down Attack Button]
type = varset
trigger1 = fvar(8) > 40
trigger1 = fvar(8) < 60
trigger1 = command = "x" || command = "y" || command = "b"
fvar(8) = ifelse(command = "b", 91, ifelse(command = "y", 76, 61))
ignorehitpause = 1

[State -1, Right Right Increment]
type = varset
trigger1 = fvar(9) > 0
fvar(9) = fvar(9) + 1
ignorehitpause = 1

[State -1, Right Right Lock]
type = varset
triggerall = (facing = 1 && command = "holdfwd") || (facing = -1 && command = "holdback")
triggerall = command != "holddown"
triggerall = command != "holdup"
trigger1 = fvar(9) < 61
trigger1 = fvar(9) > 0
trigger1 = Floor(fvar(9)) % 15 = 0
fvar(9) = -1
ignorehitpause = 1

[State -1, Right Right Reset]
type = varset
trigger1 = fvar(9) < 61
trigger1 = Floor(fvar(9)) % 15 = 0
trigger2 = fvar(9) > 61
trigger2 = Floor((fvar(9) - 10)) % 15 = 0
trigger3 = fvar(9) = -1
trigger3 = !((facing = 1 && command = "holdfwd") || (facing = -1 && command = "holdback"))
fvar(9) = 0
ignorehitpause = 1

[State -1, Right Right 1st Right]
type = varset
trigger1 = (facing = 1 && command = "holdfwd") || (facing = -1 && command = "holdback")
trigger1 = command != "holddown"
trigger1 = command != "holdup"
trigger1 = fvar(9) = 0
fvar(9) = 1
ignorehitpause = 1

[State -1, Right Right Release Right]
type = varset
trigger1 = fvar(9) > 0
trigger1 = fvar(9) < 15
trigger1 = !((facing = 1 && command = "holdfwd") || (facing = -1 && command = "holdback"))
fvar(9) = fvar(9) + 15
ignorehitpause = 1

[State -1, Right Right 2nd Right]
type = varset
trigger1 = fvar(9) > 15
trigger1 = fvar(9) < 30
trigger1 = (facing = 1 && command = "holdfwd") || (facing = -1 && command = "holdback")
trigger1 = command != "holddown"
trigger1 = command != "holdup"
fvar(9) = 61
ignorehitpause = 1

[State -1, Left Left Increment]
type = varset
trigger1 = fvar(10) > 0
fvar(10) = fvar(10) + 1
ignorehitpause = 1

[State -1, Left Left Lock]
type = varset
triggerall = (facing = -1 && command = "holdfwd") || (facing = 1 && command = "holdback")
triggerall = command != "holddown"
triggerall = command != "holdup"
trigger1 = fvar(10) < 61
trigger1 = fvar(10) > 0
trigger1 = Floor(fvar(10)) % 15 = 0
fvar(10) = -1
ignorehitpause = 1

[State -1, Left Left Reset]
type = varset
trigger1 = fvar(10) < 61
trigger1 = Floor(fvar(10)) % 15 = 0
trigger2 = fvar(10) > 61
trigger2 = Floor((fvar(10) - 10)) % 15 = 0
trigger3 = fvar(10) = -1
trigger3 = !((facing = -1 && command = "holdfwd") || (facing = 1 && command = "holdback"))
fvar(10) = 0
ignorehitpause = 1

[State -1, Left Left 1st Left]
type = varset
trigger1 = (facing = -1 && command = "holdfwd") || (facing = 1 && command = "holdback")
trigger1 = command != "holddown"
trigger1 = command != "holdup"
trigger1 = fvar(10) = 0
fvar(10) = 1
ignorehitpause = 1

[State -1, Left Left Release Left]
type = varset
trigger1 = fvar(10) > 0
trigger1 = fvar(10) < 15
trigger1 = !((facing = -1 && command = "holdfwd") || (facing = 1 && command = "holdback"))
fvar(10) = fvar(10) + 15
ignorehitpause = 1

[State -1, Left Left 2nd Left]
type = varset
trigger1 = fvar(10) > 15
trigger1 = fvar(10) < 30
trigger1 = (facing = -1 && command = "holdfwd") || (facing = 1 && command = "holdback")
trigger1 = command != "holddown"
trigger1 = command != "holdup"
fvar(10) = 61
ignorehitpause = 1

;------------------------------------------------------------------------------
; COMBO VARIABLE SETTINGS
; -----------------------
; When an attack connects with the opponent and a second command is input
; during the first hit, this variable is set to a specific value depending on
; the command for the second attack. If the second command can be chained from
; the first command, as specified in the first command's state definition (CNS
; file), then the second command will activate when a certain amount of time
; has elapsed during the first command (also in CNS file). This allows for
; buffering of combo inputs.
;
; I'm also using this to cancel running to other states so ctrl for running
;  canbe set to 0 (and thus no cancelling it to itself/crouching)
;
; Thank you to 645 for this. :D
;------------------------------------------------------------------------------

[State -1, Clear Combo Condition]
type = VarSet
trigger1 = !movecontact
trigger1 = ifelse((stateno = [600,799]) || ((stateno = 52) && time = 0), (var(1) != [100,105]), 1)
var(1) = 0
ignorehitpause = 1

[State -1, Running to Jump]
type = varset
triggerall = Command = "holdup"
trigger1 = StateNo = [100,105]
var(1) = 40
ignorehitpause = 1

[State -1, Land to Run Forward]
type = varset
triggerall = fvar(9) >= 61 || fvar(10) >= 61
trigger1 = StateNo = [600,799]
var(1) = 100
ignorehitpause = 1

[State -1, Running to Guard]
type = varset
triggerall = var(42) != 1
triggerall = Command = "holdz"
trigger1 = StateNo = [100,105]
trigger2 = (StateNo = 856) || (StateNo = 858)
var(1) = 120
ignorehitpause = 1

[State -1, Running to Taunt]
type = varset
triggerall = Command = "start"
trigger1 = StateNo = [100,105]
var(1) = 195
ignorehitpause = 1

[State -1, Combo Into sL]
type = varset
triggerall = Command = "x"
triggerall = command != "holddown"
trigger1 = statetype != A
trigger1 = MoveContact
trigger2 = StateNo = [100,105]
trigger3 = StateNo = [800,805]
trigger3 = statetype != A
var(1) = 200
ignorehitpause = 1

[State -1, Combo Into sM]
type = varset
triggerall = Command = "y"
triggerall = command != "holddown"
trigger1 = statetype != A
trigger1 = MoveContact
trigger2 = StateNo = [100,105]
trigger3 = StateNo = [800,805]
trigger3 = statetype != A
var(1) = 210
ignorehitpause = 1

[State -1, Combo Into sH]
type = varset
triggerall = Command = "b"
triggerall = command != "holddown"
trigger1 = statetype != A
trigger1 = MoveContact
trigger2 = StateNo = [100,105]
trigger3 = StateNo = [800,805]
trigger3 = statetype != A
var(1) = 220
ignorehitpause = 1

[State -1, Combo Into cL]
type = varset
triggerall = Command = "x"
triggerall = command = "holddown"
trigger1 = statetype != A
trigger1 = MoveContact
trigger2 = StateNo = [100,105]
trigger3 = StateNo = [800,805]
trigger3 = statetype != A
var(1) = 400
ignorehitpause = 1

[State -1, Combo Into cM]
type = varset
triggerall = Command = "y"
triggerall = command = "holddown"
trigger1 = statetype != A
trigger1 = MoveContact
trigger2 = StateNo = [100,105]
trigger3 = StateNo = [800,805]
trigger3 = statetype != A
var(1) = 410
ignorehitpause = 1

[State -1, Combo Into cH]
type = varset
triggerall = Command = "b"
triggerall = command = "holddown"
trigger1 = statetype != A
trigger1 = MoveContact
trigger2 = StateNo = [100,105]
trigger3 = StateNo = [800,805]
trigger3 = statetype != A
var(1) = 420
ignorehitpause = 1

[State -1, Combo Into aL]
type = varset
triggerall = var(42) != 1
triggerall = Command = "x"
trigger1 = statetype = A
trigger1 = MoveContact
trigger2 = (StateNo = 856) || (StateNo = 858)
trigger3 = StateNo = [800,805]
trigger3 = statetype = A
var(1) = 600
ignorehitpause = 1

[State -1, Combo Into aM]
type = varset
triggerall = var(42) != 1
triggerall = Command = "y"
trigger1 = statetype = A
trigger1 = MoveContact
trigger2 = (StateNo = 856) || (StateNo = 858)
trigger3 = StateNo = [800,805]
trigger3 = statetype = A
var(1) = 610
ignorehitpause = 1

[State -1, Combo Into aH]
type = varset
triggerall = ifelse(var(42) != 1, command = "b", command = "b" || command = "y" || command = "x")
trigger1 = statetype = A
trigger1 = MoveContact
trigger2 = (StateNo = 856) || (StateNo = 858)
trigger3 = StateNo = [800,805]
trigger3 = statetype = A
var(1) = 620
ignorehitpause = 1

[State -1, Combo Into Shunpo]
type = varset
triggerall = Command = "a"
triggerall = var(13) >= 1
trigger1 = MoveContact
trigger2 = StateNo = [100,105]
trigger3 = StateNo = [800,805]
trigger3 = var(22) >= 11
var(1) = 800
ignorehitpause = 1

[State -1, Air Dash to Air Dash Fwd]
type = varset
triggerall = command = "AFF"
triggerall = var(49) > 0
trigger1 = (StateNo = 856) || (StateNo = 858)
trigger1 = time >= 8
value = 855
ignorehitpause = 1

[State -1, Air Dash to Air Dash Back]
type = varset
triggerall = command = "ABB"
triggerall = var(49) > 0
trigger1 = (StateNo = 856) || (StateNo = 858)
trigger1 = time >= 8
value = 857
ignorehitpause = 1

[State -1, Running to L backward Socchijane!]
type = varset
triggerall = var(42) != 1
triggerall = fvar(8) >= 61
triggerall = command = "holdback"
trigger1 = StateNo = [100,105]
var(1) = 1105

[State -1, Running to L forward Socchijane!]
type = varset
triggerall = var(42) != 1
triggerall = fvar(8) >= 61
triggerall = command != "holdback"
trigger1 = StateNo = [100,105]
var(1) = 1100

[State -1, Running to M backward Socchijane!]
type = varset
triggerall = var(42) != 1
triggerall = fvar(8) >= 76
triggerall = command = "holdback"
trigger1 = StateNo = [100,105]
var(1) = 1115

[State -1, Running to M forward Socchijane!]
type = varset
triggerall = var(42) != 1
triggerall = fvar(8) >= 76
triggerall = command != "holdback"
trigger1 = StateNo = [100,105]
var(1) = 1110

[State -1, Running to RF backward Socchijane!]
type = varset
triggerall = var(42) != 1
triggerall = fvar(8) >= 91
triggerall = command = "holdback"
triggerall = var(11) >= 1
trigger1 = StateNo = [100,105]
var(1) = 1125

[State -1, Running to RF forward Socchijane!]
type = varset
triggerall = var(42) != 1
triggerall = fvar(8) >= 91
triggerall = command != "holdback"
triggerall = var(11) >= 1
trigger1 = StateNo = [100,105]
var(1) = 1120

[State -1, Running to L backward Ame!]
type = varset
triggerall = Command = "QCB_y"
trigger1 = StateNo = [100,105]
var(1) = ifelse(var(42) = 1, 3605, 1005)

[State -1, Running to L forward Ame!]
type = varset
triggerall = Command = "QCF_y"
trigger1 = StateNo = [100,105]
var(1) = ifelse(var(42) = 1, 3600, 1000)

[State -1, Running to M backward Ame!]
type = varset
trigger1 = Command = "QCB_x"
trigger1 = StateNo = [100,105]
trigger2 = Command = "QCB_a"
trigger2 = StateNo = [100,105]
trigger2 = var(11) < 1
var(1) = ifelse(var(42) = 1, 3605, 1015)

[State -1, Running to M forward Ame!]
type = varset
trigger1 = Command = "QCF_x"
trigger1 = StateNo = [100,105]
trigger2 = Command = "QCF_a"
trigger2 = StateNo = [100,105]
trigger2 = var(11) < 1
var(1) = ifelse(var(42) = 1, 3600, 1010)

[State -1, Running to RF backward Ame!]
type = varset
triggerall = Command = "QCB_a"
triggerall = var(11) >= 1
trigger1 = StateNo = [100,105]
var(1) = ifelse(var(42) = 1, 3605, 1025)

[State -1, Running to RF forward Ame!]
type = varset
triggerall = Command = "QCF_a"
triggerall = var(11) >= 1
trigger1 = StateNo = [100,105]
var(1) = ifelse(var(42) = 1, 3600, 1020)

[State -1, Running to L backward Mikireruka!]
type = varset
triggerall = var(42) != 1
triggerall = Command = "RDU_y"
trigger1 = StateNo = [100,105]
var(1) = 1205

[State -1, Running to L forward Mikireruka!]
type = varset
triggerall = var(42) != 1
triggerall = Command = "DU_y"
trigger1 = StateNo = [100,105]
var(1) = 1200

[State -1, Running to M backward Mikireruka!]
type = varset
triggerall = var(42) != 1
trigger1 = Command = "RDU_x"
trigger1 = StateNo = [100,105]
trigger2 = Command = "RDU_a"
trigger2 = StateNo = [100,105]
trigger2 = var(11) < 1
var(1) = 1215

[State -1, Running to M forward Mikireruka!]
type = varset
triggerall = var(42) != 1
trigger1 = Command = "DU_x"
trigger1 = StateNo = [100,105]
trigger2 = Command = "DU_a"
trigger2 = StateNo = [100,105]
trigger2 = var(11) < 1
var(1) = 1210

[State -1, Running to RF backward Mikireruka!]
type = varset
triggerall = var(42) != 1
triggerall = Command = "RDU_a"
triggerall = var(11) >= 1
trigger1 = StateNo = [100,105]
var(1) = 1225

[State -1, Running to RF forward Mikireruka!]
type = varset
triggerall = var(42) != 1
triggerall = Command = "DU_a"
triggerall = var(11) >= 1
trigger1 = StateNo = [100,105]
var(1) = 1220

[State -1, Running to L backward Shineyo!]
type = varset
triggerall = var(42) != 1
triggerall = Command = "RDP_y"
triggerall = Command != "forcheck"
trigger1 = StateNo = [100,105]
var(1) = 1305

[State -1, Running to L forward Shineyo!]
type = varset
triggerall = var(42) != 1
triggerall = Command = "DP_y"
triggerall = Command != "backcheck"
trigger1 = StateNo = [100,105]
var(1) = 1300

[State -1, Running to M backward Shineyo!]
type = varset
triggerall = var(42) != 1
triggerall = Command != "forcheck"
trigger1 = Command = "RDP_x"
trigger1 = StateNo = [100,105]
trigger2 = Command = "RDP_a"
trigger2 = StateNo = [100,105]
trigger2 = var(11) < 1
var(1) = 1315

[State -1, Running to M forward Shineyo!]
type = varset
triggerall = var(42) != 1
triggerall = Command != "backcheck"
trigger1 = Command = "DP_x"
trigger1 = StateNo = [100,105]
trigger2 = Command = "DP_a"
trigger2 = StateNo = [100,105]
trigger2 = var(11) < 1
var(1) = 1310

[State -1, Running to RF backward Shineyo!]
type = varset
triggerall = var(42) != 1
triggerall = Command = "RDP_a"
triggerall = Command != "forcheck"
triggerall = var(11) >= 1
trigger1 = StateNo = [100,105]
var(1) = 1325

[State -1, Running to RF forward Shineyo!]
type = varset
triggerall = var(42) != 1
triggerall = Command = "DP_a"
triggerall = Command != "backcheck"
triggerall = var(11) >= 1
trigger1 = StateNo = [100,105]
var(1) = 1320

;------------------------------------------------------------------------------
; JUMP ATTACK BUFFER VARIABLE SETTINGS
; -----------------------
; Like the combo one but for jump cancels.
;------------------------------------------------------------------------------

[State -1, Clear Jump Cancel Condition]
type = VarSet
trigger1 = StateNo != [45,50]
var(2) = 0

[State -1, Jump Cancel Into aL]
type = varset
trigger1 = command = "x"
trigger1 = StateNo = [45,50]
var(2) = 600

[State -1, Jump Cancel Into aM]
type = varset
trigger1 = command = "y"
trigger1 = StateNo = [45,50]
var(2) = 610

[State -1, Jump Cancel Into aH]
type = varset
trigger1 = command = "b"
trigger1 = StateNo = [45,50]
var(2) = 620

[State -1, Jump Cancel Into aSlide]
type = varset
trigger1 = command = "a"
trigger1 = command = "holdback"
trigger1 = StateNo = [45,50]
var(2) = 800

;===========================================================================
[State -1, Shunpo Direction Reset]
type = VarSet
trigger1 = stateno != [800,801]
var(23) = 0

[State -1, DF Combo Condition Reset]
type = VarSet
trigger1 = 1
var(2) = 0

[State -1, DD Combo Condition Reset]
type = VarSet
trigger1 = 1
var(3) = 0

[State -1, DU Combo Condition Reset]
type = VarSet
trigger1 = 1
var(4) = 0

[State -1, FDF Combo Condition Reset]
type = VarSet
trigger1 = 1
var(5) = 0

[State -1, SU-A Combo Condition Reset]
type = VarSet
trigger1 = 1
var(7) = 0

[State -1, SU-B Combo Condition Reset]
type = VarSet
trigger1 = 1
var(8) = 0

[State -1, Ame! Combo Condition Check]
type = VarSet
trigger1 = ctrl || (StateNo = 40)
trigger2 = (stateno = [200,799])
trigger2 = movecontact
trigger3 = (stateno = [800,801])
trigger3 = pos y >= 0
var(2) = 1

[State -1, Socchijyane! Combo Condition Check]
type = VarSet
trigger1 = ctrl || (StateNo = 40)
trigger2 = (stateno = [200,799])
trigger2 = movecontact
trigger3 = (stateno = [800,801])
trigger3 = pos y >= 0
var(3) = 1

[State -1, Mikireruka! Combo Condition Check]
type = VarSet ; Change to VarSet when DU is added
trigger1 = ctrl || (StateNo = 40)
trigger2 = (stateno = [200,799])
trigger2 = movecontact
trigger3 = (stateno = [800,801])
trigger3 = pos y >= 0
var(4) = 1

[State -1, Shineyo! Combo Condition Check]
type = VarSet
trigger1 = ctrl || (StateNo = 40)
trigger2 = (stateno = [200,799])
trigger2 = movecontact
trigger3 = (stateno = [800,801])
trigger3 = pos y >= 0
var(5) = 1

[State -1, HCF Combo Condition Check]
type = Null ; Change to VarSet when HCF is added
trigger1 = ctrl || (StateNo = 40)
trigger2 = (stateno = [200,799])
trigger2 = movecontact
trigger3 = (stateno = [800,801])
trigger3 = pos y >= 0
var(6) = 1

[State -1, SU-A Combo Condition Check]
type = VarSet ; Change to VarSet when SU-A is added
trigger1 = ctrl || (StateNo = 40)
trigger2 = (stateno = [200,799])
trigger2 = movecontact
trigger3 = (stateno = [1000,1325])
trigger3 = movecontact < 9
trigger3 = movecontact != 0
trigger4 = (stateno = [800,801])
trigger4 = pos y >= 0
var(7) = 1

[State -1, SU-B Combo Condition Check]
type = VarSet
trigger1 = ctrl  || (StateNo = 40)
trigger2 = (stateno = [200,799])
trigger2 = movecontact
trigger3 = (stateno = [1000,1325])
trigger3 = movecontact < 9
trigger3 = movecontact != 0
trigger4 = (stateno = [800,801])
trigger4 = pos y >= 0
var(8) = 1

[State -1, Bankai end :<]
type = ChangeState
triggerall = var(0) ; is this necessary
triggerall = var(42)
triggerall = var(43) = 0
triggerall = (ctrl && statetype != A) || StateNo = 40
trigger1 = fvar(37) >= 900
value = 3150

;===========================================================================
;---------------------------------------------------------------------------
; AI Controls
;---------------------------------------------------------------------------

[State -1, AI Shunpo to avoid parries]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = var(13) >= 1
triggerall = stateno = [200, 799]
triggerall = MoveHit >= 2
triggerall = numtarget = 0
trigger1 = random % 10 < 8 || MoveHit >= 5
trigger1 = MoveHit < 10
trigger1 = enemynear, movetype = A
trigger1 = var(23) := ifelse(random % 2 = 0, 13, ifelse(abs(pos x - enemynear, pos x) > 45, 13, 2))
value = ifelse(power >= 3000 && (abs((enemynear, pos x) - pos x) < (80 + enemynear, Const(size.ground.front))) && random % 4 < 3, 3100, 800)

[State -1, AI Damage Taken Check]
type = VarSet
trigger1 = movetype != H
fvar(21) = life

[State -1, AI Taunt]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = life > Const(data.life) / 2
triggerall = statetype != A
triggerall = ctrl || stateno = [100, 105]
triggerall = numtarget > 0
triggerall = abs(enemynear, pos x - pos x) >= 200
triggerall = random % 20 = 0
trigger1 = numenemy = 1
trigger1 = life > ((enemynear, life * Const(data.life)) / enemynear, Const(data.life)) * 2
trigger2 = numenemy = 2
trigger2 = var(35) != 0 && var(36) != 0
trigger2 = abs(PlayerId(var(35)), pos x - pos x) >= 184
trigger2 = abs(PlayerId(var(36)), pos x - pos x) >= 184
trigger2 = PlayerId(var(35)), movetype != A
trigger2 = PlayerId(var(36)), movetype != A
trigger2 = life > ((PlayerId(var(35)), life * Const(data.life)) / PlayerId(var(35)), Const(data.life)) * 2 && life > ((PlayerId(var(36)), life * Const(data.life)) / PlayerId(var(36)), Const(data.life)) * 2
value = 195

[State -1, AI Damage Cancel]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = power >= 1000
triggerall = alive
triggerall = movetype = H
triggerall = (stateno = [5000,5040]) || (stateno = [5070,5081]) || (stateno = 5050 && time < 10)
triggerall = var(14) = 1
triggerall = GetHitVar(hitcount) >= 3
; maybe check for rounds won here, if behind then DC at lower health
trigger1 = numenemy = 1
trigger1 = PlayerId(var(35)), movetype = A
trigger1 = ifelse(PlayerId(var(35)), AILevel > 0, power = 3000 && life > Const(data.life) / 2 && random % 12 = 0, 1)
trigger1 = (fvar(21) - life) > (Const(data.life) / 8) && life > (Const(data.life) / 6)
trigger1 = random % (((life * 15) / Const(data.life)) * (5 - ((power - 1000) / 500)) + 1)
trigger2 = numenemy = 2
trigger2 = var(36) != 0
trigger2 = PlayerId(var(35)), movetype = A || PlayerId(var(36)), movetype = A
trigger2 = ifelse(PlayerId(var(35)), AILevel > 0 && PlayerId(var(36)), AILevel > 0, power = 3000 && life > Const(data.life) / 2 && random % 12 = 0, 1)
trigger2 = (fvar(21) - life) > (Const(data.life) / 8) && life > (Const(data.life) / 6)
trigger2 = random % (((life * 15) / Const(data.life)) * (5 - ((power - 1000) / 500)) + 1)
value = 950

[State -1, AI BANKAO]
type = ChangeState
triggerall = roundstate != 3
triggerall = var(0)
triggerall = statetype != A
triggerall = power >= 3000
triggerall = var(42) != 1
; Low random odds when meter is full
trigger1 = ctrl
trigger1 = (random % 500) = 0
trigger1 = var(42) := 1
; From Sp-D in ground combo
trigger2 = stateno = 1300
trigger2 = MoveHit >= 2
trigger2 = AnimElem = 9, < 0
trigger2 = var(13) > 1
trigger2 = var(42) := 1
; Low health
trigger3 = ctrl
trigger3 = TeamMode != simul
trigger3 = (life < Const(data.life) / 6)
trigger3 = random % 1 / (((life * 1000) / Const(data.life)) + 1) = 0
trigger3 = var(42) := 1
; Guard cancel
trigger4 = TeamMode != simul || (life > (Const(data.life) * 4) / 10)
trigger4 = stateno = [150,155]
trigger4 = abs((enemynear, pos x) - pos x) < (80 + enemynear, Const(size.ground.front))
trigger4 = (random % 10) = 0
trigger4 = var(42) := 1
value = 3100

[State -1, AI Bankai aH Whee]
type = ChangeState
triggerall = var(0)
triggerall = var(42) = 1
triggerall = statetype = A
trigger1 = ctrl
trigger1 = StateNo != 620 ; :<
trigger1 = pos y < 10
trigger1 = enemynear, alive
trigger1 = abs((enemynear, pos x) - pos x) < (50 + enemynear, Const(size.ground.front))
value = 620

[State -1, AI Throw Enemy 1]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = (stateno != 100) && (stateno != 105) && (stateno != [855,858])
triggerall = ctrl
triggerall = PlayerID(var(35)), alive
triggerall = var(20) = 0
triggerall = random % 9 = 0
trigger1 = PlayerID(var(35)), statetype != A && statetype != A
trigger1 = abs(PlayerID(var(35)), pos x - pos x) < 35 + PlayerID(var(35)), Const(size.ground.front)
trigger1 = abs(PlayerID(var(35)), pos y - pos y) < 30
trigger1 = var(23) := ifelse(backedgedist < frontedgedist, 4, 6)
trigger2 = PlayerID(var(35)), statetype = A && statetype = A
trigger2 = abs(PlayerID(var(35)), pos x - pos x) < 35 + PlayerID(var(35)), Const(size.air.front)
trigger2 = abs(PlayerID(var(35)), pos y - pos y) < 30
trigger2 = 1 || var(23) := 0
value = 900

[State -1, AI Throw Enemy 2]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = (stateno != 100) && (stateno != 105) && (stateno != [855,858])
triggerall = var(36) != 0
triggerall = ctrl
triggerall = PlayerID(var(36)), alive
triggerall = var(21) = 0
triggerall = random % 9 = 0
trigger1 = PlayerID(var(36)), statetype != A && statetype != A
trigger1 = abs(PlayerID(var(36)), pos x - pos x) < 35 + PlayerID(var(36)), Const(size.ground.front)
trigger1 = abs(PlayerID(var(36)), pos y - pos y) < 30
trigger1 = var(23) := ifelse(backedgedist < frontedgedist, 4, 6)
trigger2 = PlayerID(var(36)), statetype = A && statetype = A
trigger2 = abs(PlayerID(var(36)), pos x - pos x) < 35 + PlayerID(var(36)), Const(size.air.front)
trigger2 = abs(PlayerID(var(36)), pos y - pos y) < 30
trigger2 = 1 || var(23) := 0
value = 900

[State -1, AI OTG sL/Blade Spin]
type = ChangeState
triggerall = var(0)
triggerall = var(42) = 1
trigger1 = stateno = 0
trigger1 = ifelse(fvar(37) >= 850, 1, time >= 4)
trigger1 = enemynear, stateno = 923
trigger1 = enemynear, movetype = H
value = ifelse(fvar(37) >= 850, 3600, 200)

[State -1, AI Bankai Dash]
type = ChangeState
triggerall = var(0)
triggerall = var(42) = 1
triggerall = fvar(37) < 900
trigger1 = ctrl
trigger1 = prevstateno != 3600
trigger1 = statetype != A
trigger1 = (enemynear, pos x - 80 >= pos x) || (enemynear, pos x + 80 <= pos x)
value = ifelse((pos x - enemynear, pos x) * facing < 0, 100, 105)

[State -1, AI Run]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = !(enemynear, HitFall || enemynear, stateno = [5100,5110])
; Enemy too far away
trigger1 = ctrl
trigger1 = statetype != A
trigger1 = abs(enemynear, pos x - pos x) >= 128 || (abs(enemynear, pos x - pos x) >= 64 && random % 30 = 0)
; Combing enemy, just finished TAFS
trigger2 = stateno = 52
trigger2 = numtarget > 0
trigger2 = (prevstateno = [600,620]) || ((target, statetype = S || target, statetype = C) && (target, GetHitVar(hittime) > 12))
; Have a grounded target
trigger3 = ctrl
trigger3 = statetype != A
trigger3 = numtarget > 0
trigger3 = ((target, statetype = S || target, statetype = C) && target, GetHitVar(hittime) > 12)
value = ifelse((pos x - enemynear, pos x) * facing < 0, 100, 105)

[State -1, AI Airdash]
type = ChangeState
triggerall = var(0)
triggerall = var(49) > 0
triggerall = (statetype = A) && stateno != 45
triggerall = ifelse((prevstateno = [40,45]), (time >= 6), 1)
triggerall = !(enemynear, HitFall || enemynear, stateno = [5100,5110])
trigger1 = ctrl
trigger1 = (enemynear, pos x - 56 >= pos x) || (enemynear, pos x + 56 <= pos x)
trigger1 = enemynear, HitFall || abs(enemynear, pos x - pos x) < 56
trigger1 = enemynear, statetype != A || abs(enemynear, pos x - pos x) > 96
trigger1 = random % 15 = 0
value = ifelse(facing * (pos x - enemynear, pos x) > 0, 857, 855)

[State -1, AI Stop Run]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = stateno = 100
triggerall = time > 29
trigger1 = (enemynear, pos x - 45 <= pos x) && (enemynear, pos x + 45 >= pos x) || abs(pos x) = 145
trigger2 = (pos x - enemynear, pos x) * facing > 0
value = 0
ctrl = 1

[State -1, AI Stop Run by Guard]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = stateno = 100
triggerall = enemynear, movetype = A
triggerall = random % 15 = 0
trigger1 = (enemynear, pos x - 45 <= pos x) && (enemynear, pos x + 45 >= pos x) || abs(pos x) = 145
trigger2 = (pos x - enemynear, pos x) * facing > 0
value = 120

[State -1, AI Jump]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = statetype != A
; Not attacking, enemy is high up
trigger1 = ctrl
trigger1 = numtarget = 0
trigger1 = abs(enemynear, pos x - pos x) < 80
trigger1 = pos y - enemynear, pos y < 200
trigger1 = enemynear, movetype != A
trigger1 = random % ifelse(pos y - enemynear, pos y < 80, 20, 60) = 0
trigger1 = 1 || var(23) := 0
; Not attacking, enemy is close to the ground
trigger2 = ctrl
trigger2 = numtarget = 0
trigger2 = abs(enemynear, pos x - pos x) < 80
trigger2 = pos y - enemynear, pos y < 30
trigger2 = enemynear, movetype != A
trigger2 = random % 60 = 0
trigger2 = 1 || var(23) := 0
; Planning to IAD
trigger3 = (ctrl && statetype != A) || stateno = 100
trigger3 = numtarget = 0
trigger3 = enemynear, movetype != A
trigger3 = enemynear, pos y - pos y < 30
trigger3 = abs(enemynear, pos x - pos x) < 40 * 4.5
trigger3 = abs(enemynear, pos x - pos x) >= 16 * 4.5
trigger3 = random % 64 = 0; random % floor(abs(enemynear, pos x - pos x) / 4.5) = 0 ; this doesn't quite work right but close enough
trigger3 = var(23) := 6
trigger3 = var(18) := 1
value = 40
ctrl = 1

[State -1, AI Double Jump]
type = ChangeState
triggerall = var(0)
triggerall = statetype = A
triggerall = var(48) = 1
; Not attacking, enemy is very high up
trigger1 = ctrl
trigger1 = numtarget = 0
trigger1 = vel y > 0.5
trigger1 = abs(enemynear, pos x - pos x) < 80
trigger1 = enemynear, pos y < -150
trigger1 = enemynear, pos y - pos y < 80
trigger1 = enemynear, movetype != A
trigger1 = random % 4 = 0
trigger1 = 1 || var(23) := 0
value = 45
ctrl = 1

[State -1, AI IAD]
type = ChangeState
triggerall = var(0)
triggerall = (statetype = A) && stateno != 45
triggerall = var(49) > 0
triggerall = ifelse((prevstateno = [40,45]), (time >= 6), 1)
trigger1 = var(18)
trigger1 = ctrl
trigger1 = random % 10 < 8 || time >= 8
value = 855

[State -1, AI Ground Turn]
type = ChangeAnim
triggerall = var(0)
triggerall = stateno = 0 || stateno = 11
; One enemy, he's behind
trigger1 = numenemy = 1
trigger1 = (pos x - enemynear, pos x) * facing > 0
; Two enemies alive, nearest is behind
trigger2 = numenemy = 2
trigger2 = (var(35) != 0) && (var(36) != 0)
trigger2 = (playerID(var(35)), alive) && (playerID(var(36)), alive)
trigger2 = (pos x - enemynear, pos x) * facing > 0
; Two enemies, first is alive and behind
trigger3 = numenemy = 2
trigger3 = (var(35) != 0) && (var(36) != 0)
trigger3 = (playerID(var(35)), alive) && !(playerID(var(36)), alive)
trigger3 = (pos x - playerID(var(35)), pos x) * facing > 0
; Two enemies, second is alive and behind
trigger4 = numenemy = 2
trigger4 = (var(35) != 0) && (var(36) != 0)
trigger4 = !(playerID(var(35)), alive) && (playerID(var(36)), alive)
trigger4 = (pos x - playerID(var(36)), pos x) * facing > 0
value = ifelse(stateno = 0, 5, 6)

[State -1, AI Ground Turn]
type = Turn
triggerall = var(0)
triggerall = stateno = 0 || stateno = 11 || (ctrl && statetype != A)
; One enemy, he's behind
trigger1 = numenemy = 1
trigger1 = (pos x - enemynear, pos x) * facing > 0
; Two enemies alive, nearest is behind
trigger2 = numenemy = 2
trigger2 = (var(35) != 0) && (var(36) != 0)
trigger2 = (playerID(var(35)), alive) && (playerID(var(36)), alive)
trigger2 = (pos x - enemynear, pos x) * facing > 0
; Two enemies, first is alive and behind
trigger3 = numenemy = 2
trigger3 = (var(35) != 0) && (var(36) != 0)
trigger3 = (playerID(var(35)), alive) && !(playerID(var(36)), alive)
trigger3 = (pos x - playerID(var(35)), pos x) * facing > 0
; Two enemies, second is alive and behind
trigger4 = numenemy = 2
trigger4 = (var(35) != 0) && (var(36) != 0)
trigger4 = !(playerID(var(35)), alive) && (playerID(var(36)), alive)
trigger4 = (pos x - playerID(var(36)), pos x) * facing > 0

[State -1, AI sL/cL]
type = ChangeState
triggerall = var(0)
triggerall = prevstateno != 3600
; From idle, standing opponent
trigger1 = numtarget = 0
trigger1 = ctrl || stateno = [100,105]
trigger1 = statetype != A
trigger1 = enemynear, statetype = S
trigger1 = (enemynear, pos x - ifelse(var(42) = 1, 90, 80) <= pos x) || P2BodyDist x <= 80
trigger1 = (enemynear, pos x + ifelse(var(42) = 1, 90, 80) >= pos x) || P2BodyDist x <= 80
trigger1 = random % 4 = 0
; From idle, standing combo'd opponent
trigger2 = numtarget > 0
trigger2 = ctrl || stateno = [100,105]
trigger2 = statetype != A
trigger2 = enemynear, statetype = S
trigger2 = (enemynear, pos x - ifelse(var(42) = 1, 90, 95) <= pos x) || P2BodyDist x <= 80
trigger2 = (enemynear, pos x + ifelse(var(42) = 1, 90, 95) >= pos x) || P2BodyDist x <= 80
trigger2 = target, GetHitVar(hittime) <= 12
trigger2 = random % ifelse((target, GetHitVar(hittime)) >= 8, ((target, GetHitVar(hittime)) - 7), 1) = 0
; Normal shunpo
trigger3 = stateno = 801
trigger3 = var(42) != 1
trigger3 = pos y = 0
trigger3 = abs(enemynear, pos x - pos x) < 35
trigger3 = ifelse(var(23) / 10 = 0, 1, ifelse(var(23) / 10 = 1, facing * (pos x - enemynear, pos x) > 4, facing * (pos x - enemynear, pos x) < 4))
trigger3 = ifelse(enemynear, movetype = A && facing != enemynear, facing && enemynear, facing * (enemynear, pos x - pos x) < 0 && ((var(23) % 10) = [2,4]), (22 - var(22)) * ifelse(var(23) = 3, 13.5, 6.75 * (2**(.5))) < abs(enemynear, pos x - pos x), 1) ; If opponent is attacking and facing us and we're facing them, only attack if we can't BOFS
trigger3 = random % 3 = 0
trigger3 = time >= 4
; Bankai shunpo
trigger4 = stateno = 801
trigger4 = var(42) = 1
trigger4 = pos y = 0
trigger4 = random % 3 = 0
value = ifelse((enemynear, Const(size.height) < 35 || enemynear, Const(size.head.pos.y) > -35), 400, ifelse(random % 2, 200, 400))
;value = ifelse(var(42) = 1, 200, ifelse(random % 2, 200, 400))

[State -1, AI sL/cL crouching]
type = ChangeState
triggerall = var(0)
; From idle, crouching opponent
trigger1 = numtarget = 0
trigger1 = ctrl || stateno = [100,105]
trigger1 = statetype != A
trigger1 = enemynear, statetype = C
trigger1 = (enemynear, pos x - ifelse(var(42) = 1, 90, 80) <= pos x) || P2BodyDist x <= 80
trigger1 = (enemynear, pos x + ifelse(var(42) = 1, 90, 80) >= pos x) || P2BodyDist x <= 80
trigger1 = random % 4 = 0
; From idle, crouching combo'd opponent
trigger2 = numtarget > 0
trigger2 = ctrl || stateno = [100,105]
trigger2 = statetype != A
trigger2 = enemynear, statetype = C
trigger2 = (enemynear, pos x - ifelse(var(42) = 1, 90, 90) <= pos x) || P2BodyDist x <= 80
trigger2 = (enemynear, pos x + ifelse(var(42) = 1, 90, 90) >= pos x) || P2BodyDist x <= 80
trigger2 = target, GetHitVar(hittime) <= 12
trigger2 = random % ifelse((target, GetHitVar(hittime)) >= 8, ((target, GetHitVar(hittime)) - 7), 1) = 0
value = ifelse((enemynear, Const(size.height) < 35 || enemynear, Const(size.head.pos.y) > -35), 400, ifelse(random % 10, 400, 200))

[State -1, AI sL air]
type = ChangeState
triggerall = var(0)
; From idle, standing opponent
trigger1 = numtarget = 0
trigger1 = ctrl || stateno = [100,105]
trigger1 = statetype != A
trigger1 = enemynear, statetype = A
trigger1 = enemynear, movetype != A || !inguarddist
trigger1 = (enemynear, pos x - ifelse(var(42) = 1, 90, 80) <= pos x) || P2BodyDist x <= 80
trigger1 = (enemynear, pos x + ifelse(var(42) = 1, 90, 80) >= pos x) || P2BodyDist x <= 80
trigger1 = pos y - enemynear, pos y < 40
trigger1 = random % 4 = 0
value = 200

[State -1, AI cH air]
type = ChangeState
triggerall = var(0)
; From idle, standing opponent
trigger1 = numtarget = 0
trigger1 = ctrl || stateno = [100,105]
trigger1 = statetype != A
trigger1 = enemynear, statetype = A
trigger1 = enemynear, movetype != A || !inguarddist
trigger1 = (enemynear, pos x - ifelse(var(42) = 1, 90, 80) <= pos x) || P2BodyDist x <= 80
trigger1 = (enemynear, pos x + ifelse(var(42) = 1, 90, 80) >= pos x) || P2BodyDist x <= 80
trigger1 = pos y - enemynear, pos y < 80
trigger1 = random % 10 = 0
value = 420

[State -1, AI cH]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = power != 3000
; Out of shunpo, not planning to super
trigger1 = stateno = 220
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = var(13) = 0
trigger1 = ifelse(power >= 2000, random % 4 = 0, ifelse(power >= 1000, random % 2, 1))
; Airborne opponent
trigger2 = stateno = 220
trigger2 = MoveHit >= 2
trigger2 = numtarget > 0
trigger2 = target, statetype = A
value = 420

[State -1, AI Blade Spin]
type = ChangeState
triggerall = var(0)
triggerall = var(42) = 1
; cM and out of shunpo
trigger1 = stateno = 410
trigger1 = MoveHit >= 2
trigger1 = var(13) = 0
; sM, target is airborne
trigger2 = stateno = 210
trigger2 = MoveHit >= 2
trigger2 = numtarget > 0
trigger2 = target, statetype = A
; someone attacking nearby in the air, hahano
trigger3 = ctrl
trigger3 = statetype != A
trigger3 = (inguarddist || enemynear, movetype = A)
trigger3 = enemynear, statetype = A || enemynear, pos y < 0
trigger3 = pos y - enemynear, pos y < 120
trigger3 = random % 15 = 0
value = 3600

[State -1, AI Jump Cancel]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
trigger1 = stateno = 420
trigger1 = MoveHit >= 3
trigger1 = numtarget > 0
trigger1 = var(23) := ifelse(abs(pos x - target, pos x) > 32, 6, 5)
value = 40
ctrl = 1

[State -1, AI aL]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
; Jumpin
trigger1 = ctrl || StateNo = 856 || StateNo = 858
trigger1 = statetype = A
trigger1 = (enemynear, pos x - 95 <= pos x) && (enemynear, pos x + 95 >= pos x)
trigger1 = ((enemynear, pos y) - pos y) > -100
trigger1 = ((enemynear, pos y) - pos y) < 15
trigger1 = ifelse((enemynear, movetype = H), 1, random % 4 = 0)
; Set up an air combo
trigger2 = ctrl
trigger2 = statetype = A
trigger2 = numtarget > 0
trigger2 = enemynear, stateno = [5000,5030]
trigger2 = time >= 2
trigger2 = random % 4
; Shunpo
trigger3 = stateno = 801
trigger3 = statetype = A
trigger3 = numtarget > 0
trigger3 = target, statetype = A
trigger3 = enemynear, stateno = [5000,5030]
trigger3 = pos y + 30 < enemynear, pos y || abs((pos y - Const(size.height)) - fvar(22)) < 2
value = 600

[State -1, AI aL/aM]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
trigger1 = stateno = 600
trigger1 = MoveContact >= 2
;trigger1 = numtarget > 0
;value = ifelse(((enemynear, pos y + 10) >= pos y) || (vel y < -1.5), 600, 610)
value = ifelse((pos y + vel y * 15 + (Const(movement.yaccel) ** 15) / 2 < enemynear, pos y - 35) || (vel y < -1.5) || abs((pos y - Const(size.height)) - fvar(22)) < 15 && var(13) > 0 && var(13) >= var(11) - 1, 600, 610)

[State -1, AI Air Shunpo Up]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = statetype = A
trigger1 = stateno = 610
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = target, statetype = A
trigger1 = var(48) = 0
trigger1 = var(13) >= 1 && var(13) >= var(11) - 1
trigger1 = var(23) := 1
value = 800

[State -1, AI aH]
type = ChangeState
triggerall = var(0)
triggerall = !var(42)
; Combo off aM
trigger1 = stateno = 610
trigger1 = MoveContact >= 2
trigger1 = var(48) = 0 || target, statetype != A
; Randomly when opponent is close
trigger2 = numtarget = 0
trigger2 = statetype = A
trigger2 = ctrl || StateNo = 856 || StateNo = 858
;trigger2 = (enemynear, pos x - 50 <= pos x) && (enemynear, pos x + 50 >= pos x)
;trigger2 = ((enemynear, pos y) - pos y) < 15
trigger2 = P2BodyDist x < 100 && P2BodyDist x > -10 && P2BodyDist y  > -100 && (P2BodyDist y < 72 + vel y * 8 + (Const(movement.yaccel) ** 8) / 2) && (pos y + vel y * 8 + (Const(movement.yaccel) ** 8) / 2 < 0)
trigger2 = ifelse(enemynear, movetype = A, random % 10 = 0, 1)
trigger2 = random % 7 = 0
value = 620

[State -1, AI air turn]
type = ChangeState
triggerall = var(0)
triggerall = !var(42)
triggerall = var(49) > 0
triggerall = (statetype = A) && stateno != 45
triggerall = ifelse((prevstateno = [40,45]), (time >= 6), 1)
trigger1 = ctrl
trigger1 = P2Dist x < -10 && P2Dist x > -100 && P2BodyDist y  > -120 && (P2BodyDist y < 120 + vel y * 8 + (Const(movement.yaccel) ** 8) / 2) && (pos y + vel y * 12 + (Const(movement.yaccel) ** 12) / 2 < 0)
trigger1 = random % 4 = 0
value = 859

[State -1, AI Double Jump Cancel]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = statetype = A
trigger1 = stateno = 610
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = target, statetype = A
trigger1 = var(48) = 1
trigger1 = var(23) := ifelse(abs(pos x - target, pos x) > 32, 6, 5)
value = 45
ctrl = 1

[State -1, AI sH before launcher]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = power != 3000
; From sL/cL, no shunpo, going for launcher
trigger1 = stateno = 200 || stateno = 400
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = var(13) = 0
; further than 54
trigger1 = 54 < abs(pos x - (target, pos x + ifelse(facing = 1, -1, 1) * ifelse((facing = target, facing), (target, Const(size.ground.back)), (target, Const(size.ground.front))))) ; too far away for the combo to work with the medium hit
trigger1 = ifelse(power >= 2000, random % 4 = 0, ifelse(power >= 1000, random % 2, 1))
value = 220

[State -1, AI sM/cM off sL/cL]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = stateno = 200 || stateno = 400
triggerall = MoveHit >= 2
trigger1 = numtarget > 0
; closer than 66
trigger1 = 66 > abs(pos x - (target, pos x + ifelse(facing = 1, -1, 1) * ifelse((facing = target, facing), (target, Const(size.ground.back)), (target, Const(size.ground.front)))))
trigger1 = target, statetype != A
value = ifelse((enemynear, Const(size.height) < 35 || enemynear, Const(size.head.pos.y) > -35), 410, ifelse(random % 2, 210, 410))

[State -1, AI sH off sL/cL]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = stateno = 200 || stateno = 400
triggerall = MoveHit >= 2
trigger1 = numtarget > 0
value = 220

[State -1, AI Bankai sM]
type = ChangeState
triggerall = var(0)
triggerall = var(42)
; From sL/cL
trigger1 = stateno = 200 || stateno = 400
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
value = 210

[State -1, AI sM/cM]
type = Null;ChangeState
triggerall = var(0)
; From sL/cL, 
trigger1 = stateno = 200 || stateno = 400
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = ifelse(var(42), 1, (var(13) >= 1))
trigger1 = ifelse(var(42), 1, P2BodyDist x <= 64)
;trigger1 = ifelse(var(42), 1, abs((enemynear, pos x) - pos x) < (90 + enemynear, Const(size.ground.front)))
;trigger1 = (target, BackEdgeBodyDist <= 25) || (var(13) = 0)
trigger1 = ifelse(var(42) = 1, 1, random % floor(((64 - P2BodyDist x) / 4) + 2) = 0)
;trigger1 = ifelse(var(42) = 1, 1, random % 3)
value = ifelse((enemynear, Const(size.height) < 35 || enemynear, Const(size.head.pos.y) > -35) && !var(42), 410, ifelse(var(42) = 1, 210, ifelse(random % 2, 210, 410)))

[State -1, AI Bankai cM]
type = ChangeState
triggerall = var(0)
triggerall = var(42) = 1
trigger1 = stateno = 210
trigger1 = MoveHit >= 7 || (MoveHit >= 6 && random % 2)
;trigger1 = AnimTime > -18
trigger1 = random % 2
value = 410

[State -1, AI sH]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
; Shunpo remaining, from sM/cM or sL/cL if at least one stock
;trigger1 = (var(13) >= 1) || (power >= 1000)
trigger1 = stateno = 210 || stateno = 410; || ((stateno = 200 || stateno = 400) && (power >= 1000))
trigger1 = MoveHit >= 3
trigger1 = numtarget > 0
; Shunpo remaining, sL/cL and at least one stock, target is not in the corner
trigger2 = 0
trigger2 = (var(13) >= 1) || (power >= 1000)
trigger2 = stateno = 200 || stateno = 400
trigger2 = MoveHit >= 3
trigger2 = numtarget > 0
trigger2 = target, BackEdgeBodyDist > 25
value = 220

[State -1, AI LS-B]
type = ChangeState
triggerall = var(0)
trigger1 = var(42) != 1
trigger1 = stateno = 220
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = P2BodyDist x <= 30
trigger1 = target, BackEdgeBodyDist <= 5
value = 1100

[State -1, AI LS-A]
type = ChangeState
triggerall = var(0)
trigger1 = var(42) != 1
trigger1 = stateno = 220
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = P2BodyDist x <= 80
value = 1000

[State -1, AI Shunpo from sH]
type = ChangeState
triggerall = var(0)
trigger1 = var(42) != 1
trigger1 = stateno = 220
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = var(13) >= 1
trigger1 = var(23) := 3
value = 800

[State -1, AI LS-A from B]
type = VarSet
triggerall = var(0)
trigger1 = var(42) != 1
trigger1 = stateno = 1100
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
fvar(27) = 1000

[State -1, AI LS-D from A]
type = VarSet
triggerall = var(0)
trigger1 = var(42) != 1
trigger1 = stateno = 1000
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = !(enemynear, Const(size.height) < 35 || enemynear, Const(size.head.pos.y) > -35)
fvar(27) = 1300

[State -1, AI SU-A]
type = ChangeState
triggerall = roundstate != 3
triggerall = var(0)
triggerall = var(42) != 1
triggerall = power >= 1000
trigger1 = stateno = 1300
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = AnimElem = 9, >= 0 && AnimElem = 9, <= 1
trigger1 = abs(target, pos x - pos x) < 90
trigger2 = var(13) = 0
trigger2 = stateno = 1000
trigger2 = MoveHit >= 2
trigger2 = numtarget > 0
trigger2 = (enemynear, Const(size.height) < 35 || enemynear, Const(size.head.pos.y) > -35)
value = 3000

[State -1, AI Shunpo from Sp-D/A]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = var(13) >= 1
trigger1 = stateno = 1300
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = AnimElem = 9, < 0
trigger1 = var(23) := 2
trigger2 = stateno = 1000
trigger2 = MoveHit >= 2
trigger2 = numtarget > 0
trigger2 = (enemynear, Const(size.height) < 35 || enemynear, Const(size.head.pos.y) > -35)
trigger2 = var(23) := 2
value = 800

[State -1, AI aH from shunpo]
type = ChangeState
triggerall = var(0)
triggerall = !var(42)
triggerall = stateno = 801
triggerall = statetype = A
; Combo
trigger1 = numtarget > 0
trigger1 = target, statetype != A
trigger1 = ifelse(var(23) / 10 = 0, 1, ifelse(var(23) / 10 = 1, facing * (pos x - enemynear, pos x) > 4, facing * (pos x - enemynear, pos x) < 4))
trigger1 = pos y <= -15
trigger1 = ifelse(pos y > -24, random % 3 = 0, ifelse((pos y <= -24 && pos y > -30), random % 2, 1))
; Non-combo
trigger2 = abs(enemynear, pos x - pos x) < 85 && facing * (pos x - enemynear, pos x) < 4
trigger2 = numtarget = 0
trigger2 = ifelse(var(23) / 10 = 0, 1, ifelse(var(23) / 10 = 1, facing * (pos x - enemynear, pos x) > 4, facing * (pos x - enemynear, pos x) < 4))
trigger2 = pos y <= -15
trigger2 = enemynear, pos y > pos y
trigger2 = ifelse(pos y > -48, random % 6 = 0, ifelse((pos y <= -48 && pos y > -60), random % 3, 1))
value = ifelse(numtarget = 0, ifelse(enemynear, statetype = A, 600, 620), 620)

[State -1, AI Shunpo]
type = ChangeState
triggerall = var(0)
triggerall = var(13) >= 1
trigger1 = 0 ; NULL
trigger1 = var(42) != 1
trigger1 = stateno = 220
trigger1 = MoveHit >= 2
trigger1 = numtarget > 0
trigger1 = var(23) := 3
; Bankai
trigger2 = var(42) = 1
trigger2 = stateno = 410
trigger2 = MoveHit >= 7 || (MoveHit >= 6 && random % 2)
trigger2 = var(23) := 3
; Guard Cancel
trigger3 = stateno = [150,155]
trigger3 = facing * (pos x - enemynear, pos x) < 0
trigger3 = random % 10 = 0
trigger3 = var(23) := ifelse(abs(pos x - enemynear, pos x) < 80, ifelse(random % 2, 13, 2), 3)
; Guard Cancel (turned around)
trigger4 = stateno = [150,155]
trigger4 = facing * (pos x - enemynear, pos x) > 0
trigger4 = random % 10 = 0
trigger4 = var(23) := ifelse(abs(pos x - enemynear, pos x) < 80, ifelse(random % 2, 17, 6), 7)
; Nearby enemy is trying to grab
trigger5 = ctrl || (stateno = [100, 105]) || ((stateno = [200, 799]) && MoveContact >= 2)
trigger5 = abs(pos x - enemynear, pos x) < 64 && abs(pos y - enemynear, pos y) < 64
trigger5 = enemynear, HitDefAttr = SCA, NT, ST, HT
trigger5 = random % 5 = 0
trigger5 = var(23) := ifelse(facing * (pos x - enemynear, pos x) < 0, 2, 6)
value = 800

[State -1, AI Start guarding]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = inguarddist && !enemynear, HitDefAttr = SCA, NT, ST, HT
triggerall = ctrl || stateno = [100,105]
trigger1 = random % 20 < 18
trigger1 = !TeamMode = simul || numtarget = 0
trigger1 = !TeamMode = simul || (enemynear, facing * (pos x - enemynear, pos x) > 0)
value = 120

[State -1, AI Stop guarding]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = stateno = [130,132]
triggerall = playerID(var(35)), movetype != A || playerID(var(35)), HitDefAttr = SCA, NT, ST, HT
; Single enemy is not attacking or trying to throw
trigger1 = !inguarddist || playerID(var(35)), HitDefAttr = SCA, NT, ST, HT
trigger1 = numenemy = 1
trigger1 = random % 3 = 0
; Multiple enemies either not attacking or trying to throw
trigger2 = numenemy = 2
trigger2 = var(36) != 0
trigger2 = playerID(var(36)), movetype != A || playerID(var(36)), HitDefAttr = SCA, NT, ST, HT
trigger2 = !inguarddist || playerID(var(35)), HitDefAttr = SCA, NT, ST, HT || playerID(var(36)), HitDefAttr = SCA, NT, ST, HT
value = 140

[State -1, AI Stop guarding]
type = ChangeState
triggerall = var(0)
triggerall = var(42) != 1
triggerall = stateno = [130,132]
; Nearby enemy is probably wrapping up their attack
trigger1 = !inguarddist || random % 10 = 0
trigger1 = numenemy = 1
trigger1 = abs(enemynear, animtime) * 3 < enemynear, time
trigger1 = random % 10 = 0
; Been blocking for 1.25 seconds with nothing happening
trigger2 = var(17) > 75
trigger2 = random % 4 = 0
; Simul mode and any attacking opponents are not facing this way
trigger3 = TeamMode = simul
trigger3 = numenemy = 2
trigger3 = var(36) != 0
trigger3 = playerID(var(35)), movetype != A || playerID(var(35)), HitDefAttr = SCA, NT, ST, HT || playerID(var(35)), facing * (pos x - playerID(var(35)), pos x) > 0
trigger3 = playerID(var(36)), movetype != A || playerID(var(36)), HitDefAttr = SCA, NT, ST, HT || playerID(var(36)), facing * (pos x - playerID(var(35)), pos x) > 0
trigger3 = random % 3 = 0
value = 140

[State -1, AI Stop guarding]
type = ChangeState
triggerall = var(0)
triggerall = stateno = [130,132]
trigger1 = var(42) = 1
value = 0
ctrl = 1

[State -1, AI Jump Toward Wake Up]
type = Null;ChangeState
triggerall = var(0)
triggerall = stateno = 5110
triggerall = alive
triggerall = Anim != [5111,5119]
trigger1 = time >= 20
trigger1 = random % 10
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger2 = random % 5
value = 850

;---------------------------------------------------------------------------
; Human Controls
;---------------------------------------------------------------------------

;---------------------------------------------------------------------------
;Throw
[State -1, Throw]
type = ChangeState
value = 900
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = command = "Throw"
triggerall = (stateno != 100) && (stateno != 105) && (stateno != [855,858])
trigger1 = ctrl

;---------------------------------------------------------------------------
;Reverse Buttobe! (Uses one super stock)
[State -1, Reverse Buttobe!]
type = ChangeState
value = 3005
triggerall = roundstate != 3
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = power >= 1000
triggerall = statetype != A
triggerall = stateno != [100,105]
trigger1 = command = "QCBx2_y"
trigger1 = var(7) = 1
trigger2 = command = "QCBx2_x"
trigger2 = var(7) = 1
trigger3 = command = "QCBx2_a"
trigger3 = var(7) = 1
trigger4 = (command = "LY")
trigger4 = (var(45) = 0)
trigger4 = command = "holdback"
trigger4 = var(7) = 1
trigger5 = command = "QCBx2_y"
trigger5 = StateNo = [150,155]
trigger6 = command = "QCBx2_x"
trigger6 = StateNo = [150,155]
trigger7 = command = "QCBx2_a"
trigger7 = StateNo = [150,155]

;---------------------------------------------------------------------------
;Reverse Buttobe! while running (Uses one super stock)
[State -1, Reverse Buttobe! Running]
type = ChangeState
value = 3005
triggerall = roundstate != 3
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = power >= 1000
triggerall = stateno = [100,105]
trigger1 = command = "QCBx2_y"
trigger2 = command = "QCBx2_x"
trigger3 = command = "QCBx2_a"
trigger4 = (command = "LY")
trigger4 = (var(45) = 0)
trigger4 = command = "holdback"

;---------------------------------------------------------------------------
;Buttobe! (Uses one super stock)
[State -1, Buttobe!]
type = ChangeState
value = 3000
triggerall = roundstate != 3
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = power >= 1000
triggerall = statetype != A
triggerall = stateno != [100,105]
trigger1 = command = "QCFx2_y"
trigger1 = var(7) = 1
trigger2 = command = "QCFx2_x"
trigger2 = var(7) = 1
trigger3 = command = "QCFx2_a"
trigger3 = var(7) = 1
trigger4 = (command = "LY")
trigger4 = (var(45) = 0)
trigger4 = command != "holdback"
trigger4 = var(7) = 1
trigger5 = command = "QCFx2_y"
trigger5 = StateNo = [150,155]
trigger6 = command = "QCFx2_x"
trigger6 = StateNo = [150,155]
trigger7 = command = "QCFx2_a"
trigger7 = StateNo = [150,155]

;---------------------------------------------------------------------------
;Buttobe! while running (Uses one super stock)
[State -1, Buttobe! Running]
type = ChangeState
value = 3000
triggerall = roundstate != 3
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = power >= 1000
triggerall = stateno = [100,105]
trigger1 = command = "QCFx2_y"
trigger2 = command = "QCFx2_x"
trigger3 = command = "QCFx2_a"
trigger4 = (command = "LY")
trigger4 = (var(45) = 0)
trigger4 = command != "holdback"

;---------------------------------------------------------------------------
;Reverse Ryuumon Hoozukimaru (Uses three super stocks)
[State -1, Reverse SU-B]
type = ChangeState
value = 3105
triggerall = roundstate != 3
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = power >= 3000
triggerall = statetype != A
triggerall = stateno != [100,105]
trigger1 = command = "B,HCB_y"
trigger1 = var(8) = 1
trigger2 = command = "B,HCB_x"
trigger2 = var(8) = 1
trigger3 = command = "B,HCB_a"
trigger3 = var(8) = 1
trigger4 = (command = "LA")
trigger4 = (var(47) = 0)
trigger4 = command = "holdback"
trigger4 = var(8) = 1
trigger5 = command = "B,HCB_y"
trigger5 = StateNo = [150,155]
trigger6 = command = "B,HCB_x"
trigger6 = StateNo = [150,155]
trigger7 = command = "B,HCB_a"
trigger7 = StateNo = [150,155]

;---------------------------------------------------------------------------
;Reverse Ryuumon Hoozukimaru while running (Uses three super stocks)
[State -1, Reverse SU-B Running]
type = ChangeState
value = 3105
triggerall = roundstate != 3
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = power >= 3000
triggerall = stateno = [100,105]
trigger1 = command = "B,HCB_y"
trigger2 = command = "B,HCB_x"
trigger3 = command = "B,HCB_a"
trigger4 = (command = "LA")
trigger4 = (var(47) = 0)
trigger4 = command = "holdback"

;---------------------------------------------------------------------------
;Ryuumon Hoozukimaru (Uses three super stocks)
[State -1, SU-B]
type = ChangeState
value = 3100
triggerall = roundstate != 3
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = power >= 3000
triggerall = statetype != A
triggerall = stateno != [100,105]
trigger1 = command = "F,HCF_y"
trigger1 = var(8) = 1
trigger2 = command = "F,HCF_x"
trigger2 = var(8) = 1
trigger3 = command = "F,HCF_a"
trigger3 = var(8) = 1
trigger4 = (command = "LA")
trigger4 = (var(47) = 0)
trigger4 = command != "holdback"
trigger4 = var(8) = 1
trigger5 = command = "F,HCF_y"
trigger5 = StateNo = [150,155]
trigger6 = command = "F,HCF_x"
trigger6 = StateNo = [150,155]
trigger7 = command = "F,HCF_a"
trigger7 = StateNo = [150,155]

;---------------------------------------------------------------------------
;Ryuumon Hoozukimaru while running (Uses three super stocks)
[State -1, SU-B Running]
type = ChangeState
value = 3100
triggerall = roundstate != 3
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = power >= 3000
triggerall = stateno = [100,105]
trigger1 = command = "F,HCF_y"
trigger2 = command = "F,HCF_x"
trigger3 = command = "F,HCF_a"
trigger4 = (command = "LA")
trigger4 = (var(47) = 0)
trigger4 = command != "holdback"

;---------------------------------------------------------------------------
;Reverse RF Shineyo!
[State -1, Reverse RF Shineyo!]
type = ChangeState
value = 1325
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = var(11) >= 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = Command != "forcheck"
trigger1 = command = "RDP_a"
trigger1 = var(5) = 1
trigger2 = command = "RDP_a"
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;RF Shineyo!
[State -1, RF Shineyo!]
type = ChangeState
value = 1320
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = var(11) >= 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = Command != "backcheck"
trigger1 = command = "DP_a"
trigger1 = var(5) = 1
trigger2 = command = "DP_a"
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Reverse Medium Shineyo!
[State -1, Reverse Medium Shineyo!]
type = ChangeState
value = 1315
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = Command != "forcheck"
trigger1 = command = "RDP_x"
trigger1 = var(5) = 1
trigger2 = command = "RDP_a"
trigger2 = var(5) = 1
trigger2 = var(11) < 1
trigger3 = command = "RDP_x"
trigger3 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = command = "RDP_a"
trigger4 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = var(11) < 1

;---------------------------------------------------------------------------
;Medium Shineyo!
[State -1, Medium Shineyo!]
type = ChangeState
value = 1310
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = Command != "backcheck"
trigger1 = command = "DP_x"
trigger1 = var(5) = 1
trigger2 = command = "DP_a"
trigger2 = var(5) = 1
trigger2 = var(11) < 1
trigger3 = command = "DP_x"
trigger3 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = command = "DP_a"
trigger4 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = var(11) < 1

;---------------------------------------------------------------------------
;Light Shineyo! From other specials
[State -1, Light Shineyo!]
type = ChangeState
value = 1300 ;1301
;triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = fvar(27) = 1300
trigger1 = StateNo = [1000,1005]
trigger1 = AnimTime <= -48
trigger1 = AnimTime > -58
trigger2 = StateNo = [1010,1025]
trigger2 = AnimTime <= -20
trigger2 = AnimTime > -30
trigger3 = StateNo = [1100,1105]
trigger3 = AnimTime <= -43
trigger3 = AnimTime > -53
trigger4 = StateNo = [1110,1125]
trigger4 = AnimTime <= -15
trigger4 = AnimTime > -25
trigger5 = StateNo = [1200,1205]
trigger5 = AnimTime <= -42
trigger5 = AnimTime > -52
trigger6 = StateNo = [1210,1225]
trigger6 = AnimTime <= -14
trigger6 = AnimTime > -24

;---------------------------------------------------------------------------
;Reverse Light Shineyo!
[State -1, Reverse Light Shineyo!]
type = ChangeState
value = 1305
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = Command != "forcheck"
trigger1 = command = "RDP_y"
trigger1 = var(5) = 1
trigger2 = command = "RDP_y"
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Light Shineyo!
[State -1, Light Shineyo!]
type = ChangeState
value = 1300
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = Command != "backcheck"
trigger1 = command = "DP_y"
trigger1 = var(5) = 1
trigger2 = command = "DP_y"
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Reverse HCF
[State -1, Reverse HCF]
type = Null
value = 1405
triggerall = !var(0)
triggerall = StateNo != [100,105]
triggerall = statetype != A ; was commented out for a reason?
triggerall = var(11) >= 1
trigger1 = (command = "HCB_y") || (command = "HCB_x") || (command = "HCB_a")
trigger1 = var(6) = 1
trigger2 = (command = "HCB_y") || (command = "HCB_x") || (command = "HCB_a")
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;HCF
[State -1, HCF]
type = Null
value = 1400
triggerall = !var(0)
triggerall = StateNo != [100,105]
triggerall = statetype != A ; was commented out for a reason?
triggerall = var(11) >= 1
trigger1 = (command = "HCF_y") || (command = "HCF_x") || (command = "HCF_a")
trigger1 = var(6) = 1
trigger2 = (command = "HCF_y") || (command = "HCF_x") || (command = "HCF_a")
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Reverse RF Mikireruka!
[State -1, Reverse RF Mikireruka!]
type = ChangeState
value = 1225
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
triggerall = command = "RDU_a"
trigger1 = var(4) = 1
trigger1 = var(11) >= 1
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger2 = var(11) >= 1

;---------------------------------------------------------------------------
;RF Mikireruka!
[State -1, RF Mikireruka!]
type = ChangeState
value = 1220
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
triggerall = command = "DU_a"
trigger1 = var(4) = 1
trigger1 = var(11) >= 1
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger2 = var(11) >= 1

;---------------------------------------------------------------------------
;Reverse Medium Mikireruka!
[State -1, Reverse Medium Mikireruka!]
type = ChangeState
value = 1215
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
trigger1 = command = "RDU_x"
trigger1 = var(4) = 1
trigger2 = command = "RDU_a"
trigger2 = var(4) = 1
trigger2 = var(11) < 1
trigger3 = command = "RDU_x"
trigger3 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = command = "RDU_a"
trigger4 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = var(11) < 1

;---------------------------------------------------------------------------
;Medium Mikireruka!
[State -1, Medium Mikireruka!]
type = ChangeState
value = 1210
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
trigger1 = command = "DU_x"
trigger1 = var(4) = 1
trigger2 = command = "DU_a"
trigger2 = var(4) = 1
trigger2 = var(11) < 1
trigger3 = command = "DU_x"
trigger3 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = command = "DU_a"
trigger4 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = var(11) < 1

;---------------------------------------------------------------------------
;Light Mikireruka! From other specials
[State -1, Light Mikireruka!]
type = ChangeState
value = 1200
;triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = fvar(27) = 1200
trigger1 = StateNo = [1000,1005]
trigger1 = AnimTime <= -48
trigger1 = AnimTime > -58
trigger2 = StateNo = [1010,1025]
trigger2 = AnimTime <= -20
trigger2 = AnimTime > -30
trigger3 = StateNo = [1100,1105]
trigger3 = AnimTime <= -43
trigger3 = AnimTime > -53
trigger4 = StateNo = [1110,1125]
trigger4 = AnimTime <= -15
trigger4 = AnimTime > -25

;---------------------------------------------------------------------------
;Reverse Light Mikireruka!
[State -1, Reverse Light Mikireruka!]
type = ChangeState
value = 1205
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
trigger1 = (command="RDU_y")
trigger1 = var(4) = 1
trigger2 = (command="RDU_y")
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Light Mikireruka!
[State -1, Light Mikireruka!]
type = ChangeState
value = 1200
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
trigger1 = (command="DU_y")
trigger1 = var(4) = 1
trigger2 = (command="DU_y")
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Reverse RF Ame!
[State -1, Reverse RF Ame!]
type = ChangeState
value = 1025
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
triggerall = command = "QCB_a"
trigger1 = var(2) = 1
trigger1 = var(11) >= 1
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger2 = var(11) >= 1

;---------------------------------------------------------------------------
;RF Ame!
[State -1, RF Ame!]
type = ChangeState
value = 1020
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
triggerall = command = "QCF_a"
trigger1 = var(2) = 1
trigger1 = var(11) >= 1
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger2 = var(11) >= 1

;---------------------------------------------------------------------------
;Reverse Medium Ame!
[State -1, Reverse Medium Ame!]
type = ChangeState
value = 1015
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
trigger1 = command = "QCB_x"
trigger1 = var(2) = 1
trigger2 = command = "QCB_a"
trigger2 = var(2) = 1
trigger2 = var(11) < 1
trigger3 = command = "QCB_x"
trigger3 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = command = "QCB_a"
trigger4 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = var(11) < 1

;---------------------------------------------------------------------------
;Medium Ame!
[State -1, Medium Ame!]
type = ChangeState
value = 1010
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
trigger1 = command = "QCF_x"
trigger1 = var(2) = 1
trigger2 = command = "QCF_a"
trigger2 = var(2) = 1
trigger2 = var(11) < 1
trigger3 = command = "QCF_x"
trigger3 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = command = "QCF_a"
trigger4 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)
trigger4 = var(11) < 1

;---------------------------------------------------------------------------
;Light Ame! From other specials
[State -1, Light Ame!]
type = ChangeState
value = 1000 ;1001
;triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = fvar(27) = 1000
trigger1 = StateNo = [1100,1105]
trigger1 = AnimTime <= -43
trigger1 = AnimTime > -53
trigger2 = StateNo = [1110,1125]
trigger2 = AnimTime <= -15
trigger2 = AnimTime > -25
trigger3 = StateNo = [1200,1205]
trigger3 = AnimTime <= -42
trigger3 = AnimTime > -52
trigger4 = StateNo = [1210,1225]
trigger4 = AnimTime <= -14
trigger4 = AnimTime > -24

;---------------------------------------------------------------------------
;Reverse Light Ame!
[State -1, Reverse Light Ame!]
type = ChangeState
value = 1005
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
triggerall = command = "QCB_y"
trigger1 = var(2) = 1
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Light Ame!
[State -1, Light Ame!]
type = ChangeState
value = 1000
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
triggerall = command = "QCF_y"
trigger1 = var(2) = 1
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Reverse Spin Ur Bladez
[State -1, Reverse Spin Ur Bladez]
type = ChangeState
value = 3605
triggerall = !var(0)
triggerall = var(42) = 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
triggerall = ((command = "QCB_y") ||(command = "QCB_x") ||(command = "QCB_a")) || ifelse(var(46) = 0, command = "LX" && command = "holdback", 0)
trigger1 = var(4) = 1
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Spin Ur Bladez
[State -1, Spin Ur Bladez]
type = ChangeState
value = 3600
triggerall = !var(0)
triggerall = var(42) = 1
triggerall = statetype != A
triggerall = StateNo != [100,105]
triggerall = ((command = "QCF_y") ||(command = "QCF_x") ||(command = "QCF_a")) || ifelse(var(46) = 0, command = "LX" && command != "holdback", 0)
trigger1 = var(2) = 1
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Reverse RF Socchijane!
[State -1, Reverse RF Socchijyane!]
type = ChangeState
value = 1125
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = (fvar(8) >= 91); 76, 61
trigger1 = var(11) >= 1
trigger1 = command = "holdback"
trigger1 = var(3) = 1
trigger2 = command = "holdback"
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;RF Socchijane!
[State -1, RF Socchijyane!]
type = ChangeState
value = 1120
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = (fvar(8) >= 91); 76, 61
triggerall = var(11) >= 1
trigger1 = command != "holdback"
trigger1 = var(3) = 1
trigger2 = command != "holdback"
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Reverse Medium Socchijane!
[State -1, Reverse Medium Socchijyane!]
type = ChangeState
value = 1115
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = (fvar(8) >= 76)
trigger1 = command = "holdback"
trigger1 = var(3) = 1
trigger2 = command = "holdback"
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Medium Socchijane!
[State -1, Medium Socchijyane!]
type = ChangeState
value = 1110
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = (fvar(8) >= 76)
trigger1 = command != "holdback"
trigger1 = var(3) = 1
trigger2 = command != "holdback"
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Light Socchijane! From other specials
[State -1, Light Socchijyane!]
type = ChangeState
value = 1100 ;1101
;triggerall = !var(0)
triggerall = var(42) != 1
triggerall = statetype != A
triggerall = fvar(27) = 1100
trigger1 = StateNo = [1000,1005]
trigger1 = AnimTime <= -48
trigger1 = AnimTime > -58
trigger2 = StateNo = [1010,1025]
trigger2 = AnimTime <= -20
trigger2 = AnimTime > -30
trigger3 = StateNo = [1200,1205]
trigger3 = AnimTime <= -42
trigger3 = AnimTime > -52
trigger4 = StateNo = [1210,1225]
trigger4 = AnimTime <= -14
trigger4 = AnimTime > -24

;---------------------------------------------------------------------------
;Reverse Light Socchijane!
[State -1, Reverse Light Socchijyane!]
type = ChangeState
value = 1105
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = (fvar(8) >= 61)
trigger1 = command = "holdback"
trigger1 = var(3) = 1
trigger2 = command = "holdback"
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Light Socchijane!
[State -1, Light Socchijyane!]
type = ChangeState
value = 1100
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = StateNo != [100,105]
triggerall = statetype != A
triggerall = (fvar(8) >= 61)
trigger1 = command != "holdback"
trigger1 = var(3) = 1
trigger2 = command != "holdback"
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;===========================================================================
;---------------------------------------------------------------------------
;Run Fwd
[State -1, Run Fwd]
type = ChangeState
value = 100
triggerall = !var(0)
triggerall = fvar(9) >= 61 || fvar(10) >= 61
trigger1 = statetype = S
trigger1 = ctrl


;===========================================================================
;---------------------------------------------------------------------------
;Taunt
[State -1, Taunt]
type = ChangeState
value = 195
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = command = "start"
trigger1 = statetype != A
trigger1 = ctrl

;---------------------------------------------------------------------------
;Standing Heavy
[State -1, Standing Heavy]
type = ChangeState
value = 220
triggerall = !var(0)
triggerall = command = "b"
triggerall = command != "holddown"
trigger1 = statetype = S
trigger1 = ctrl

;---------------------------------------------------------------------------
;Standing Medium
[State -1, Standing Medium]
type = ChangeState
value = 210
triggerall = !var(0)
triggerall = command = "y"
triggerall = command != "holddown"
trigger1 = statetype = S
trigger1 = ctrl

;---------------------------------------------------------------------------
;Standing Light
[State -1, Standing Light]
type = ChangeState
value = 200
triggerall = !var(0)
triggerall = command = "x"
triggerall = command != "holddown"
trigger1 = statetype = S
trigger1 = ctrl

;---------------------------------------------------------------------------
;Crouching Heavy
[State -1, Crouching Heavy]
type = ChangeState
value = 420
triggerall = !var(0)
triggerall = command = "b"
triggerall = command = "holddown"
trigger1 = statetype = C || var(42) ; Maybe I shouldn't actually be using the statetype = C
trigger1 = ctrl

;---------------------------------------------------------------------------
;Crouching Medium
[State -1, Crouching Medium]
type = ChangeState
value = 410
triggerall = !var(0)
triggerall = command = "y"
triggerall = command = "holddown"
trigger1 = statetype = C || var(42)
trigger1 = ctrl

;---------------------------------------------------------------------------
;Crouching Light
[State -1, Crouching Light]
type = ChangeState
value = 400
triggerall = !var(0)
triggerall = command = "x"
triggerall = command = "holddown"
trigger1 = statetype = C || var(42)
trigger1 = ctrl

;---------------------------------------------------------------------------
;Jumping Heavy
[State -1, Jumping Heavy]
type = ChangeState
value = 620
triggerall = !var(0)
triggerall = ifelse(var(42) != 1, command = "b", command = "b" || command = "y" || command = "x")
trigger1 = statetype = A
trigger1 = ctrl
;trigger1 = vel X >= 0

;---------------------------------------------------------------------------
;Jumping Medium
[State -1, Jumping Medium]
type = ChangeState
value = 610
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = command = "y"
trigger1 = statetype = A
trigger1 = ctrl

;---------------------------------------------------------------------------
;Jumping Light
[State -1, Jumping Light]
type = ChangeState
value = 600
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = command = "x"
trigger1 = statetype = A
trigger1 = ctrl
;trigger1 = vel X >= 0

;---------------------------------------------------------------------------
;Crouching
[State -1, Crouching]
type = ChangeState
value = 10
triggerall = !var(0)
triggerall = statetype = S
triggerall = command = "holddown"
trigger1 = StateNo != [100,105]
trigger1 = ctrl

;---------------------------------------------------------------------------
;Guarding
[State -1, Guarding]
type = ChangeState
value = 120
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = command = "holdz"
trigger1 = ctrl

;---------------------------------------------------------------------------
;Forward Shunpo
[State -1, Shunpo Fwd]
type = ChangeState
value = 800
triggerall = !var(0)
triggerall = command = "a"
triggerall = command != "holdback"
triggerall = statetype != A
triggerall = var(13) >= 1
trigger1 = ctrl
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Backward Shunpo
[State -1, Shunpo Back]
type = ChangeState
value = 800
triggerall = !var(0)
triggerall = command = "a"
triggerall = statetype != A
triggerall = var(13) >= 1
triggerall = command = "holdback"
trigger1 = ctrl
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Forward Air Shunpo
[State -1, Air Shunpo Fwd]
type = ChangeState
value = 800
triggerall = !var(0)
triggerall = command = "a"
triggerall = command != "holdback"
triggerall = statetype = A
triggerall = var(13) >= 1
trigger1 = ctrl
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Backward Air Shunpo
[State -1, Air Shunpo Back]
type = ChangeState
value = 800
triggerall = !var(0)
triggerall = command = "a"
triggerall = statetype = A
triggerall = command = "holdback"
triggerall = var(13) >= 1
trigger1 = ctrl
trigger2 = StateNo = [150,155] ;(Stateno = 151) || (Stateno = 153) || (Stateno = 155)

;---------------------------------------------------------------------------
;Air Dash
[State -1, Air Dash Fwd]
type = ChangeState
value = 855
triggerall = !var(0)
triggerall = ifelse(facing = 1, fvar(9) >= 61, fvar(10) >= 61 ) ;command = "AFF"
triggerall = (statetype = A) && stateno != 45
triggerall = var(49) > 0
triggerall = ifelse((prevstateno = [40,45]), (time >= 6), 1)
trigger1 = ctrl

;---------------------------------------------------------------------------
;Air Dash Back
[State -1, Air Dash Back]
type = ChangeState
value = 857
triggerall = !var(0)
triggerall = ifelse(facing = 1, fvar(10) >= 61, fvar(9) >= 61 ) ;command = "ABB"
triggerall = (statetype = A) && stateno != 45
triggerall = var(49) > 0
triggerall = ifelse((prevstateno = [40,45]), (time >= 6), 1)
trigger1 = ctrl

;---------------------------------------------------------------------------
;Damage Cancel
[State -1, Damage Cancel]
type = ChangeState
value = 950
triggerall = !var(0)
triggerall = var(42) != 1
triggerall = command = "DC"
triggerall = power >= 1000
triggerall = alive
triggerall = movetype = H
trigger1 = (stateno = [5000,5040]) || (stateno = [5070,5081]) || (stateno = 5050 && time < 10)
trigger1 = var(14) = 1
