; 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
;               command = ~30
;   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 engine.
;
; - 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 are given below. Delete, adD, or modify as you wish.


;-| super motions |--------------------------------------------------------
[command]
name = "dp_2p"
command = ~F, D, DF, x+y

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

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

[command]
name = "qcf_2p"
command = ~D, F, x+y

[command]
name = "qcf_2p"
command = ~D, F, x+z

[command]
name = "qcf_2p"
command = ~D, F, y+z

[command]
name = "qcb_2k"
command = ~D, B, a+b

[command]
name = "qcb_2k"
command = ~D, B, a+c

[command]
name = "qcb_2k"
command = ~D, B, b+c


;the Following two have the same name, but Different motion.
;either one will be Detected by a "command = triplekfpalm" trigger.
;time is set to 20 (instead of Default of 15) to make the move
;easier to Do.
;
[command]
name = "triplekfpalm"
command = ~D, DF, F, D, DF, F, x
time = 20

[command] 
name = "triplekfpalm"   ;same name as above
command = ~D, DF, F, D, DF, F, y
time = 20

;-| special motions |------------------------------------------------------
[command]
name = "hcb_a"
command = ~D, B, a

[command]
name = "hcb_b"
command = ~D, B, b

[command]
name = "hcb_c"
command = ~D, B, c

[command]
name = "hcb_x"
command = ~F, D, B, x

[command]
name = "hcb_y"
command = ~F, D, B, y

[command]
name = "hcb_z"
command = ~F, D, B, z


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

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

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

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

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

[Command]
name = "RecoveryRoll"
command = B, DB, D, x
time = 20
[Command]
name = "RecoveryRoll"
command = B, DB, D, y
time = 20
[Command]
name = "RecoveryRoll"
command = B, DB, D, z
time = 20
[Command]
name = "RecoveryRoll2"
command = B, DB, D, a
time = 20
[Command]
name = "RecoveryRoll2"
command = B, DB, D, b
time = 20
[Command]
name = "RecoveryRoll2"
command = B, DB, D, c
time = 20

[Command]
name = "RecoveryRoll"
command = F, DF, D, x
time = 20
[Command]
name = "RecoveryRoll"
command = F, DF, D, y
time = 20
[Command]
name = "RecoveryRoll"
command = F, DF, D, z
time = 20
[Command]
name = "RecoveryRoll2"
command = F, DF, D, a
time = 20
[Command]
name = "RecoveryRoll2"
command = F, DF, D, b
time = 20
[Command]
name = "RecoveryRoll2"
command = F, DF, D, c
time = 20

[Command]
name = "nage"
command = x+a
time = 2

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

[Command]
name = "VC1"
command = x+a
time = 1

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

[Command]
name = "VC2"
command = y+b
time = 1

[Command]
name = "VC3"
command = B, DB, D, z
time = 20

[Command]
name = "VC3"
command = z+c
time = 1

;-| DoUBle tap |-----------------------------------------------------------
[command]
name = "ff"     ;required (do not remove)
command = F, F
time = 18

[command]
name = "DS"     ;required (do not remove)
command = x+y
time = 1

[command]
name = "bb"     ;required (do not remove)
command = B, B
time = 18

;-| 2/3 button combination |-----------------------------------------------
[command]
name = "recovery";required (do not remove)
command = x+y
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 = "holdp"
command = /$x
time = 1

[command]
name = "holdp"
command = /$y
time = 1

[command]
name = "holdp"
command = /$z
time = 1

[command]
name = "holdk"
command = /$a
time = 1

[command]
name = "holdk"
command = /$B
time = 1

[command]
name = "holdk"
command = /$c
time = 1
 
[command]
name = "sjump"
command = $D, $U
time = 15

;[command]
;name = "sjump"
;command = $UF
;time = 5

;[command]
;name = "sjump"
;command = $UB
;time = 5

[command]
name = "sjump"
command = a+b
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

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


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

;===========================================================================

;heavily armed birdie
[state -1, wpx]
type = changestate
value = 2000
triggerall = var(42)=0
triggerall = numhelper(0) = 0 && power >= 1000
triggerall = command = "qcb_2k" && command != "holddown"
triggerall = statetype !=A
trigger1 =  ctrl
trigger2 = stateno  = [200,305]

;---------------------------------------------------------------------------
;weapon x
[state -1, wpx]
type = changestate
value = 1000
triggerall = command = "dp_2p" && power >= 1000
triggerall = var(42)!=1
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]
;---------------------------------------------------------------------------
;berserker claw x
[state -1, bcx]
type = changestate
value = 3000
triggerall = command = "qcf_2p" && power >= 1000
triggerall = var(42)!=1
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]
;---------------------------------------------------------------------------
;short birdie call
[state -1, sbc]
type = changestate
value = 892
triggerall = numhelper(0) = 0
triggerall = command = "hcb_a"
triggerall = var(42)!=1
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]
;---------------------------------------------------------------------------
;forward birdie call
[state -1, Fbc]
type = changestate
value = 890
triggerall = var(42)=0
triggerall = numhelper(0) = 0
triggerall = command = "hcb_b"
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]
;---------------------------------------------------------------------------
;roundhouse birdie call
[state -1, rbc]
type = changestate
value = 891
triggerall = var(42)!=1
triggerall = numhelper(0) = 0
triggerall = command = "hcb_c"
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]

;---------------------------------------------------------------------------
;jab wild Fang
[state -1, jwf]
type = changestate
value = 800
triggerall = var(42)!=1
triggerall = command = "hcb_x"
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]
;---------------------------------------------------------------------------
;strong wild Fang
[state -1, swf]
type = changestate
value = 801
triggerall = var(42)!=1
triggerall = command = "hcb_y"
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]
;---------------------------------------------------------------------------
;fierce wild Fang
[state -1, Fwf]
type = changestate
value = 802
triggerall = var(42)!=1
triggerall = command = "hcb_z"
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]
;---------------------------------------------------------------------------
;jab berserker claw
[state -1, jbc]
type = changestate
value = 700
triggerall = var(42)!=1
triggerall = command = "qcf_x"
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]
;---------------------------------------------------------------------------
;strong berserker claw
[state -1, sbc]
type = changestate
value = 701
triggerall = var(42)!=1
triggerall = command = "qcf_y"
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]
;---------------------------------------------------------------------------
;fierce berserker claw
[state -1, Fbc]
type = changestate
value = 702
triggerall = var(42)!=1
triggerall = command = "qcf_z"
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = stateno  = [200,305]


;---------------------------------------------------------------------------
;===========================================================================
;---------------------------------------------------------------------------
; アドガ (Stand)
[State -1]
type = ChangeState
value = 1230
triggerall = (command = "x" && command = "y") || (command = "y" && command = "z") || (command = "x" && command = "y" && command = "z")
trigger1 = stateno = [150,151]

;アドガ (crouching)
[State -1]
type = ChangeState
value = 1240
triggerall = (command = "x" && command = "y") || (command = "y" && command = "z") || (command = "x" && command = "y" && command = "z")
trigger1 = stateno = [152,153]

;アドガ (aerial)
[State -1]
type = ChangeState
value = 1250
triggerall = (command = "x" && command = "y") || (command = "y" && command = "z") || (command = "x" && command = "y" && command = "z")
trigger1 = stateno = 154
trigger2 = stateno = 155
trigger2 = Time <= 10


;---------------------------------------------------------------------------
; カウンター
[State -1]
type = ChangeState
value = 3100
triggerall = power > 1000
triggerall = command = "VC1"
trigger1 = stateno = [150,153]

; カウンター中
[State -1]
type = ChangeState
value = 3101
triggerall = power > 1000
triggerall = command = "VC2"
trigger1 = stateno = [150,153]

; カウンター大
[State -1]
type = ChangeState
value = 3102
triggerall = power > 1000
triggerall = command = "VC3"
trigger1 = stateno = [150,153]
;---------------------------------------------------------------------------

;---------------------------------------------------------------------------
; Super Jump
[State -1, ]
type = ChangeState
value = 10023
triggerall = var(42)!=1
triggerall = command = "sjump"
trigger1 = statetype != A
trigger1 = ctrl
trigger2 = StateNo = 200 || stateno = 201 || stateno = 202 || stateno = 203 || stateno = 204 || stateno = 205
trigger2 = movehit
trigger3 = StateNo = 300 || stateno = 301 || stateno = 302 || stateno = 303 || stateno = 304 
trigger3 = movehit

;---------------------------------------------------------------------------
;run back
[state -1, run back]
type = changestate
value = 105
triggerall = var(42)!=1
trigger1 = command = "bb" && statetype = s && ctrl
trigger2 = command = "holdback" && statetype = s && command = "DS" && ctrl
;---------------------------------------------------------------------------
;run Fwd
[state -1, run Fwd]
type = changestate
value = 100
triggerall = var(42)!=1
trigger1 = command = "ff" && statetype = s && ctrl && stateno != 100
trigger2 = command = "DS" && statetype = s && ctrl && stateno != 100
trigger3 = command = "DS" && stateno=10

;---------------------------------------------------------------------------
;ground throw
[state -1, throw]
type = changestate
value = 600
triggerall = command = "z" && statetype = s && ctrl && stateno != 100
trigger1 = command = "holdfwd" && p2bodydist x < 63 && p2movetype != h
trigger1 = (p2statetype = s) || (p2statetype = c)
trigger2 = command = "holdback" && p2bodydist x < 63 && p2movetype != h
trigger2 = (p2statetype = s) || (p2statetype = c)


;ground throw
[state -1, throw]
type = changestate
value = 600
triggerall = statetype = s && ctrl && stateno != 100
trigger1 = command = "nage" && p2movetype != h && p2bodydist x < 63
trigger1 = (p2statetype = s) || (p2statetype = c)
;---------------------------------------------------------------------------


;air throw
[state -1, throw]
type = changestate
value = 919
triggerall = enemynear,movetype = H
triggerall = command = "z" && statetype = A && ctrl 
trigger1 = command = "holdfwd" && p2bodydist x < 58
trigger1 = p2bodydist Y=[-55,70] 
trigger1 = (p2statetype = A) 
trigger2 = command = "holdback" && p2bodydist x < 58
trigger2 = p2bodydist Y=[-55,70]
trigger2 = (p2statetype = A) 


;air throw
[state -1, throw]
type = changestate
value = 920
triggerall = command = "z" && statetype = A && ctrl 
triggerall = enemynear,movetype != H
trigger1 = command = "holdfwd" && p2bodydist x < 60
trigger1 = p2bodydist Y=[-55,70] 
trigger1 = (p2statetype = A) 
trigger2 = command = "holdback" && p2bodydist x < 60
trigger2 = p2bodydist Y=[-55,70]
trigger2 = (p2statetype = A) 


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

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


;stand jab punch
[state -1, stand jab punch]
type = changestate
value = 200
triggerall = command = "x" && command != "holddown"
trigger1 = statetype = s && ctrl
;---------------------------------------------------------------------------
;stand strong punch
[state -1, stand strong punch]
type = changestate
value = 201
triggerall = command = "y" && command != "holddown"
trigger1 = statetype = s && ctrl
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 203 && movecontact
trigger4 = stateno = 300 && movecontact
trigger5 = stateno = 303 && movecontact
;---------------------------------------------------------------------------
;stand Fierce punch
[state -1, stand Fierce punch]
type = changestate
value = 202
triggerall = command = "z" && command != "holddown"
trigger1 = statetype = s && ctrl
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 203 && movecontact
trigger4 = stateno = 300 && movecontact
trigger5 = stateno = 303 && movecontact
trigger6 = stateno = 204 && movecontact
;---------------------------------------------------------------------------
;stand short kick
[state -1, stand short kick]
type = changestate
value = 203
triggerall = command = "a" && command != "holddown"
trigger1 = statetype = s && ctrl
;---------------------------------------------------------------------------
;stand Forward kick
[state -1, stand Forward kick]
type = changestate
value = 204
triggerall = command = "b" && command != "holddown"
trigger1 = statetype = s && ctrl
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 203 && movecontact
trigger4 = stateno = 300 && movecontact
trigger5 = stateno = 303 && movecontact
;---------------------------------------------------------------------------
;stand roundhouse kick
[state -1, stand roundhouse kick]
type = changestate
value = 205
triggerall = command = "c" && command != "holddown"
trigger1 = statetype = s && ctrl
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 203 && movecontact
trigger4 = stateno = 300 && movecontact
trigger5 = stateno = 303 && movecontact
;---------------------------------------------------------------------------
;taunt
[state -1, taunt]
type = changestate
value = 195
triggerall = command = "start"
trigger1 = statetype != a && ctrl
;---------------------------------------------------------------------------
;crouching light punch
[state -1, crouching jab punch]
type = changestate
value = 300
triggerall = command = "x" && command = "holddown"
trigger1 = statetype = c && ctrl
;---------------------------------------------------------------------------
;crouching strong punch
[state -1, crouching strong punch]
type = changestate
value = 301
triggerall = command = "y" && command = "holddown"
trigger1 = statetype = c && ctrl
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 203 && movecontact
trigger4 = stateno = 300 && movecontact
trigger5 = stateno = 303 && movecontact
;---------------------------------------------------------------------------
;crouching Fierce punch
[state -1, crouching Fierce punch]
type = changestate
value = 302
triggerall = command = "z" && command = "holddown"
trigger1 = statetype = c && ctrl
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 203 && movecontact
trigger4 = stateno = 300 && movecontact
trigger5 = stateno = 303 && movecontact
trigger6 = stateno = 204 && movecontact
;---------------------------------------------------------------------------
;crouching short kick
[state -1, crouching short kick]
type = changestate
value = 303
triggerall = command = "a" && command = "holddown"
trigger1 = statetype = c && ctrl
;---------------------------------------------------------------------------
;crouching Forward kick
[state -1, crouching Forward kick]
type = changestate
value = 304
triggerall = command = "b" && command = "holddown"
trigger1 = statetype = c && ctrl
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 203 && movecontact
trigger4 = stateno = 300 && movecontact
trigger5 = stateno = 303 && movecontact
;---------------------------------------------------------------------------
;crouching roundhouse kick
[state -1, crouching roundhouse kick]
type = changestate
value = 305
triggerall = command = "c" && command = "holddown"
trigger1 = statetype = c && ctrl
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 203 && movecontact
trigger4 = stateno = 300 && movecontact
trigger5 = stateno = 303 && movecontact
trigger6 = stateno = 204 && movecontact
;---------------------------------------------------------------------------
;jump light punch
[state -1, jump jab punch]
type = changestate
value = 400
triggerall = command = "x"
trigger1 = ctrl && statetype = a
;---------------------------------------------------------------------------
;jump strong punch
[state -1, jump strong punch]
type = changestate
value = 401
triggerall = command = "y"
trigger1 = ctrl && statetype = a
trigger2 = stateno = 400 && movecontact
trigger3 = stateno = 403 && movecontact
;---------------------------------------------------------------------------
;jump Fierce punch
[state -1, jump Fierce punch]
type = changestate
value = 402
triggerall = command = "z"
trigger1 = ctrl && statetype = a
trigger2 = stateno = 400 && movecontact
trigger3 = stateno = 403 && movecontact
trigger4 = stateno = 401 && movecontact
trigger5 = stateno = 404 && movecontact
;---------------------------------------------------------------------------
;jump short kick
[state -1, jump short kick]
type = changestate
value = 403
triggerall = command = "a"
trigger1 = ctrl && statetype = a
trigger2 = stateno = 400 && movecontact
;---------------------------------------------------------------------------
;jump Forward kick
[state -1, jump Forward kick]
type = changestate
value = 404
triggerall = command = "b"
trigger1 = ctrl && statetype = a
trigger2 = stateno = 400 && movecontact
trigger3 = stateno = 403 && movecontact
trigger4 = stateno = 401 && movecontact
;---------------------------------------------------------------------------
;jump roundhouse kick
[state -1, jump roundhouse kick]
type = changestate
value = 405
triggerall = command = "c"
trigger1 = ctrl && statetype = a
trigger2 = stateno = 400 && movecontact
trigger3 = stateno = 403 && movecontact
trigger4 = stateno = 401 && movecontact
trigger5 = stateno = 404 && movecontact
trigger6 = stateno = 402 && movecontact


;---------------------------------------------------------------------------
;ダウン回避
----------------------------------------------------------------------------------------
; Recovery Roll
[State -1, Falling]
type = VarSet
triggerall = alive
triggerall = (StateNo = 5035) || (StateNo = 5050) || (StateNo = 5071)
triggerall = Stateno != 5040
trigger1 = (Command = "RecoveryRoll")
var(57) = 1

[State -1, Rolling]
type = ChangeState
value = 11111
triggerall = Var(57) = 1 
triggerall = (StateNo = 5035) || (StateNo = 5050) || (StateNo = 5071)
trigger1 = (Pos Y >= 0) && (Vel Y > 0)

; Recovery Roll
[State -1, Falling]
type = VarSet
triggerall = alive
triggerall = (StateNo = 5035) || (StateNo = 5050) || (StateNo = 5071)
triggerall = Stateno != 5040
trigger1 = (Command = "RecoveryRoll2")
var(57) = 2

[State -1, Rolling]
type = ChangeState
value = 11112
triggerall = Var(57) = 2
triggerall = (StateNo = 5035) || (StateNo = 5050) || (StateNo = 5071)
trigger1 = (Pos Y >= 0) && (Vel Y > 0)

;---------------------------------------------------------------------------
[State -1, Rolling]
type       = ChangeState
triggerall = stateno=5100||stateno=5110||stateno=5120
trigger1   = command="RecoveryRoll"
value      = 11111

[State -1, Rolling]
type       = ChangeState
triggerall = stateno=5100||stateno=5110||stateno=5120
trigger1   = command="RecoveryRoll2"
value      = 11112