[Remap]
c = y
z = b
b = c
y = z

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

[Command]
name = "sp31"
command = B,B,a
time = 32
buffer.time = 7

[Command]
name = "sp1"
command =F,F,a
time = 30
buffer.time = 7

[Command]
name = "sp2"
command = B,F,x
time = 20
buffer.time = 7

[Command]
name = "sp3"
command = F,B,x
time = 20
buffer.time = 7

[Command]
name = "sp4"
command = a+b
time = 1
buffer.time = 7

[Command]
name = "sp5"
command = D,F,b
time = 20
buffer.time = 7

[Command]
name = "sp6"
command = F,F,y
time = 20
buffer.time = 7

[Command]
name = "sp7"
command = F,B,F,x
time = 30
buffer.time = 12

[Command]
name = "sp8"
command = D,y
time = 30
buffer.time = 7

[Command]
name = "sp9"
command = c,c
time = 20
buffer.time = 14

[Command]
name = "sp10"
command = a,a
time = 20
buffer.time = 14

[Command]
name = "extrapit"
command = ~20c
time = 16
buffer.time = 7

;-[Finishers]----------------------------------------------------

[Command]
name = "fatal1"
command = B,B,B,B
time = 50
buffer.time = 11

[Command]
name = "fatal2"
command = F,F,F,F
time = 50
buffer.time = 11


[Command]
name = "fatal3"
command = D,D,D,D
time = 50
buffer.time = 11


[Command]
name = "mercy"
command = D,D,c
time = 30

[Command]
name = "friend"
command = z,z,z
time = 50
buffer.time = 7



[Command]
name = "babality"
command = ~60a
time = 30


;[Command]
;name = "babality"
;command = D,D,F,b
;time = 50
;buffer.time = 7

[Command]
name = "harakiri"
command = a,a,a
time = 50

[Command]
name = "stage"
command = /$D,x
time = 50

[Command]
name = "stage"
command = F,F,D,x
time = 50
buffer.time = 7

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

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

;-| 2/3 Button Combination |-----------------------------------------------
[Command]
name = "recovery";Required (do not remove)
command = c+z
time = 1
buffer.time = 12

[Command]
name = "recovery"
command = /c,z
time = 1
buffer.time = 12

[Command]
name = "recovery"
command = /z,c
time = 1
buffer.time = 12

;-| Dir + Button |---------------------------------------------------------
[Command]
name = "down_a"
command = /$D,a
time = 1
buffer.time = 7

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

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

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

;-| Single Button |---------------------------------------------------------
[Command]
name = "a"
command = a
time = 1

[Command]
name = "b"
command = b
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 = "combo a"
command = a
time = 1
buffer.time = 3

[Command]
name = "combo b"
command = b
time = 1
buffer.time = 3

[Command]
name = "combo x"
command = x
time = 1
buffer.time = 3

[Command]
name = "combo y"
command = y
time = 1
buffer.time = 3

[Command]
name = "combo z"
command = z
time = 1
buffer.time = 3

[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

[Command]
name = "run"  ;Required (do not remove)
command = /c
time = 1

[Command]
name = "blok"  ;Required (do not remove)
command = /z
time = 1
;---------------------------------------------------------------------------
; 2. State entry
; --------------
; Don't remove the following line. It's required by the CMD standard.
[Statedef -1]
;===========================================================================
;-[AI]----------------------------------------
;-----------------------------------
[State -1, IA]
type = VarSet
v = 50
value = 1
trigger1 = Var(50) != 1
triggerall = enemy,var(17) != 1
trigger1 = AIlevel > 0

[State -3, can not see]
type = varset
trigger1 = var(50) = 1 && AILevel = 0
v = 50
value = 0
ignorehitpause = 1
persistent = 1

[State -1, stage]
type = selfstate
triggerall = roundstate = 2
triggerall = statetype = S || statetype = C
triggerall = ctrl
triggerall = p2bodydist x < 10 && p2stateno = 9010 && numhelper(6969) > 0
trigger1 = var(50) = 0 && command = "stage"
trigger2 = var(50) = 1 && random%30 < AILevel&& AILevel > 1+random%2
trigger2 = time > 21-AILevel
value = 4000

; Stand Block
[State -1, Block]
type = ChangeState
value = 120
triggerall = command = "blok"
triggerall = ctrl && stateno != 180
trigger1 = statetype = S
trigger2 = statetype = C && stateno != 10
triggerall = stateno != [120,140]
triggerall = Var(50) != 1



[State -1, 111]; close
type = ChangeState
value =   ifelse(random>500,1500,1800)
trigger1 = var(50) = 1 && stateno =111


;---------------------------------------;
;	-extra pit	 -	;
;---------------------------------------;
[State -1,fatal]
type = ChangeState
value = 3340
trigger1 = var(50) = 0 && command = "extrapit" 
triggerall = statetype = C
triggerall = p2bodydist X <40
triggerall = p2stateno = 9010
triggerall = ctrl = 1
trigger2 = enemy,time > 90
trigger2 = var(50) = 1 && random%56 < AILevel && gametime%2 = 0

[State -1, sit Y ROLL]
type = ChangeState
value = 90
trigger1 = command = "run"
trigger1 = command = "holddown"
triggerall = statetype = C || statetype = S
trigger1 = var(50) = 0
trigger2 = var(50) = 1
trigger2 = enemy,numproj > 0 || inguarddist
trigger2 = p2bodydist x > 90
trigger2 = random%4 = 1
triggerall = ctrl = 1 && p2stateno!=9010
triggerall = Vel Y = 0

[State -1, Special BACKFLIP]
type = ChangeState
value = 95
trigger1 = command = "run"
trigger1 = command = "holdback"
trigger1 = var(50) = 0
trigger2 = var(50) = 1
trigger2 = p2bodydist x < 30
trigger2 = p2movetype = A || (p2stateno = 5245 && prevstateno = 245)
trigger2 = random%4 = 0
triggerall = statetype = S
triggerall= ctrl = 1
triggerall = Vel Y = 0

;Taunt
[State -1, taunt]
type = ChangeState
value = 176
trigger1 = command = "sp31"
triggerall = Vel Y = 0
triggerall = statetype = S
triggerall = ctrl
trigger2 = var(50) = 1
trigger2 = random%7 = 0 && (p2stateno = 5110 || p2stateno = 21238)
;---------------------------------------------------------------------------
;correr
[State -1, RunMk]
type = ChangeState
value = 107
trigger1 = command = "run"
trigger1 = command = "holdfwd"
trigger1 = command != "holddown"
trigger1 = command != "holdup"
trigger2 = stateno = [200,201] 
trigger3 = stateno = [220,221] 
triggerall = var(47) > 0
triggerall = var(50) = 0
triggerall = stateno != 107 && stateno != 10 && stateno != 180
triggerall = statetype = S
triggerall = ctrl

;--[Special Moves]-----------------------------------------------------------
;--[Special Moves]-----------------------------------------------------------




[State -1, ! SP spear]
type = ChangeState
value = 1700
trigger1 = command = "sp9"
triggerall = statetype = S
trigger1 = var(50) = 0
triggerall = stateno = 107


[State -1, ! SP spear AI]
type = ChangeState
value = 1700
triggerall = p2bodydist X > 10
triggerall = statetype = S
triggerall = p2name != "shao kahn"
triggerall = p2name != "kintaro"
triggerall = p2name != "goro"
triggerall = p2name != "motaro"
triggerall = stateno = 107
triggerall = var(50) = 1
triggerall = time > 12
trigger1 = gametime < 300



;airthrow
[State -1, airthrow]
type = selfState
value = 1400
triggerall = (p2bodydist X = [-20,35])
trigger1 = command = "z" && var(50) = 0
triggerall = ctrl||target,numexplod(1188) = 0||target,numexplod(118) > 0|| ((stateno = [600,621]))
triggerall = p2statetype = A && p2stateno != 5120
triggerall = statetype = A
triggerall = roundstate = 2
triggerall = enemy,authorname != "boss"
trigger2 = var(50) = 1
trigger2 = random%14 < AILevel||(random%7 < AILevel && vel x = 0)
trigger2 = time > 14-AILevel && AILevel > 1+random%3

[State -1, ! (AI) sp air B]      ;ai lomaet letashih
type = ChangeState
value = 1400
triggerall = var(50) = 1 && p2bodydist x < 20 && abs(p2dist y) < 10
trigger1 = stateno = 50 && vel x >= 0
trigger2 = stateno = 612
trigger2 = ctrl = 0
triggerall = p2name != "motaro"
triggerall = roundstate = 2 && enemy,pos y < 0

[State -1, ! sp bomb]
type = ChangeState
value = 1500
triggerall = statetype = S
triggerall = ctrl = 1
trigger1 = var(50) = 0
trigger1 = command = "sp1"
trigger1 = command != "run"
trigger2 = NumHelper(1501) = 0
trigger2 = var(50) = 1
trigger2 = p2bodydist x > 80 && p2bodydist x < 200 && random%12 = 1
trigger2 = roundstate = 2

[State -1, ! sp gun-3]
type = ChangeState
value = 1610
trigger1 = statetype = S
trigger1 = ctrl = 1
trigger1 = command = "sp7"
triggerall = command != "run"

[State -1, ! sp gun]
type = ChangeState
value = 1600
trigger1 = statetype = S
trigger1 = ctrl = 1
trigger1 = command = "sp2"
triggerall = command != "run"

[State -1, ! (AI) sp gun]
type = ChangeState
value = 1600 + 10*(random%3 = 0)
trigger1 = statetype = S
trigger1 = ctrl = 1
trigger1 = var(50) = 1
trigger1 = p2bodydist x > 30 && p2statetype != C && p2statetype != L && p2stateno != 5120 && random%30 = 2
trigger1 = roundstate = 2

[State -1, ! (AI) sp gun]
type = ChangeState
value = 1600
triggerall = Var(50) = 1
triggerall = p2stateno != 9010
triggerall = p2bodydist X >= 150
triggerall = ctrl = 1
triggerall = statetype = S
triggerall = Vel Y = 0
;trigger1 = p2statetype = S
trigger2 = p2statetype = A && p2movetype != H
trigger1 = p2stateno = [200,220]
triggerall = p2stateno != [1020,1040]


[State -1, ! sp thor]
type = ChangeState
value = 1800
triggerall = statetype = S
triggerall = ctrl = 1
trigger1 = command = "sp6"
trigger1 = command != "run"
trigger2 = var(50) = 1
trigger2 = p2bodydist x > 60 && p2bodydist x < 160 && p2stateno != 5120 && random%30 = 1
trigger2 = roundstate = 2

;[State -1, extra all]
;type = ChangeState
;value = 1000 + (random%2 = 1)*ifelse(random%2 = 0, 1111, 1112)
;triggerall = statetype = S
;triggerall = ctrl = 1
;triggerall = roundstate = 2
;trigger1 = prevstateno = 2002
;trigger1 = var(50) = 1 && random%12 < AILevel && enemy,gethitvar(yvel) < -10
;trigger1 = p2statetype = A && p2movetype = H
;triggerall = time > 14-2*AILevel && AILevel > 1+random%3 && p2life > 1
;triggerall = p2name != "motaro"
;
;;rings
;[State -1]
;type = ChangeState
;value = 1000
;trigger1 = command = "sp1"
;triggerall = statetype = S||statetype = C
;triggerall = ctrl||stateno = 10||(stateno = [200,201])||(stateno = [220,221])||stateno = 229||stateno = 111||stateno = 157
;triggerall = roundstate = 2
;trigger1 = command != "run"
;trigger1 = var(50) = 0 || random%6 > AILevel
;trigger2 = p2statetype != C && p2statetype != L && p2bodydist x > 100 && inguarddist = 0 && p2stateno != 1000
;trigger2 = (p2movetype != H && p2bodydist x > 120)||(p2movetype = H && abs(p2dist y) > 60)
;trigger2 = var(50) = 1 && random%24 < AILevel && p2stateno != 26 && p2stateno != [1102,1103]
;trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
;trigger2 = time > 14-2*AILevel
;trigger2 = var(51) > 0 && random%3 = 0 && enemy,ctrl = 0
;trigger2 = (enemy,numexplod(118) = 0 && ctrl) || AILevel > 1+random%3
;trigger2 = p2name != "motaro"
;trigger3 = stateno = 111&&time > 11-AILevel&&p2bodydist x > 60
;trigger3 = (var(11) = 0 && random%8 = 0)||random%90 = 0
;trigger4 = stateno = 157&&anim = 0&&random%8 = 0
;trigger4 = p2bodydist x > 40&&p2statetype != C
;
;;Grab
;[State -1, throw]
;type = ChangeState
;value = 1100
;trigger1 = (command = "holddown" && command = "sp2")||(command = "blok" && command = "down_a")
;triggerall = (statetype = S&&ctrl)||(stateno = [10,12])||(stateno = [200,201])||(stateno = [220,221])||stateno = 10||(stateno = [111,131])||stateno = 229||stateno = 157
;triggerall = roundstate = 2
;trigger1 = command != "run"
;trigger1 = var(50) = 0 || random%6 > AILevel
;trigger2 = p2statetype != A&&p2statetype != L&&p2bodydist x > 30&&p2bodydist x < 100&&p2stateno != 131&&p2dist x > 0
;trigger2 = p2stateno = 107||enemy,movecontact > 1||(p2statetype != C&&(p2stateno = [120,159]))
;trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
;trigger2 = var(50) = 1 && ifelse(enemy,movecontact > 1, (random%28 < AILevel), (random%42 < AILevel)) 
;trigger2 = time > 10-AILevel && random%3 > 0
;trigger2 = (enemy,moveguarded = 0 && ctrl) || AILevel > 2+random%3
;trigger2 = enemy,authorname != "boss"
;trigger3 = stateno = 111&&time > 11-AILevel&&p2bodydist x = [30,100]
;trigger3 = (var(11) = 0 && random%8 = 0)||random%90 = 0
;trigger3 = p2stateno != 131||random%12 > AILevel
;trigger4 = stateno = 157&&anim = 0&&random%8 = 0
;trigger4 = p2bodydist x < 80&&p2statetype != A
;
;[State -1, square wave punch]
;type = ChangeState
;value = 1200
;trigger1 = command = "sp3"
;triggerall = statetype = S
;triggerall = ctrl = 1||(stateno = [200,201])||(stateno = [220,221])||stateno = 229
;triggerall = numexplod(1992) = 0
;triggerall = roundstate = 2
;trigger1 = command != "run"
;trigger1 = var(50) = 0 || random%6 > AILevel
;trigger2 = (p2bodydist x > 70&&p2bodydist x < 220&&!inguarddist)||(stateno = 200&&movehit > 1&&numexplod(1444)>0)
;trigger2 = p2movetype = H||p2stateno = 50||random%7 = 0
;trigger2 = var(50) = 1 && (p2stateno != [5050,5120]) && random%32 < AILevel
;trigger2 = p2life > 1 && p2statetype = A && p2stateno != 26 && p2stateno != [1102,1103]
;trigger2 = time > 14-2*AILevel && AILevel > 1+random%3 && random%3 = 0
;
;; bicycle kick
;[State -1, bckl]
;type = ChangeState
;value = 1300
;trigger1 = command = "sp4"
;triggerall = statetype = S || statetype = C
;triggerall = ctrl||stateno = 10||(stateno = [200,201])||(stateno = [220,221])||stateno = 229||stateno = 111||stateno = 157
;triggerall = roundstate = 2
;trigger1 = command != "run"
;trigger1 = var(50) = 0
;trigger2 = ifelse(p2statetype != A, 1, (abs(p2dist y) > 6)) || movehit
;trigger2 = p2statetype != L && p2statetype != C && !inguarddist && p2stateno != 26 && p2stateno != [1102,1103]
;trigger2 = var(50) = 1 && p2stateno != 5120 && p2stateno != [120,159]
;trigger2 = enemy,vel x >= 0 || movehit > 7
;trigger2 = ifelse(enemy,vel x > 0, (p2bodydist x = [20,70]), (p2bodydist x = [0,50]))
;trigger2 = ifelse(p2statetype = A, (random%32 < AILevel), (random%42 < AILevel))
;trigger2 = p2stateno = 107||p2stateno = 20||enemy,movecontact > 1||movehit||p2statetype = A
;trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
;trigger2 = time > 21-3*AILevel && random%3 = 0
;trigger2 = (p2statetype != A && ctrl) || AILevel > 1+random%3
;trigger3 = stateno = 111&&time > 11-AILevel&&p2bodydist x < 50
;trigger3 = (var(11) = 0 && random%8 = 0)||random%90 = 0
;trigger3 = (p2stateno != [120,159])||random%12 > AILevel
;trigger4 = stateno = 157&&anim = 0&&random%8 = 0
;trigger4 = p2bodydist x < 40&&p2statetype != C
;----------------------------

[State -1,mercy]
type = ChangeState
value = 3997
triggerall = ctrl = 1||stateno = [10,12]
trigger2 = RoundNo >= 3
trigger2 = numexplod(3800) = 0
triggerall = p2stateno = 9010
triggerall = statetype = S || statetype = C
trigger1 = command = "mercy"
triggerall = p2bodydist X >= 100
trigger2 = enemy,time > 60
trigger2 = var(50) = 1 && random%21 < AILevel&& AILevel > 1+random%2
trigger2 = random + 600 < life || random%6 > AILevel

;-------------------------------
;finishers
;------------------------------

[State -1,fatal]
type = ChangeState
value = 3000
triggerall = p2bodydist X <100
trigger1 = command = "fatal2"
triggerall = p2stateno = 9010
triggerall = statetype = S
triggerall = ctrl = 1||(stateno = [120,159])
trigger1 = var(50) = 0
trigger2 = enemy,time > 60
trigger2 = var(50) = 1 && random%70 < AILevel && AILevel > 1+random%2

[State -1,fatal]
type = ChangeState
value = 3100
triggerall = p2bodydist X =[ 40,300]
trigger1 = command = "fatal1"
triggerall = p2stateno = 9010
triggerall = statetype = S
triggerall = ctrl = 1||stateno = 120
trigger1 = command != "run"
trigger1 = var(50) = 0
trigger2 = enemy,time > 60
trigger2 = var(50) = 1 && random%40 < AILevel && AILevel > 1+random%2

[State -1,fatal]
type = ChangeState
value = 3400
triggerall = p2bodydist X = [30,320]
trigger1 = command = "fatal3"
triggerall = p2stateno = 9010
triggerall = (statetype = S&&ctrl)||(stateno = [10,12])||(stateno = [120,131])||stateno = 47||stateno=40||statetype = C
trigger1 = command != "run"
trigger1 = var(50) = 0
trigger2 = enemy,time > 60
trigger2 = var(50) = 1 && random%50 < AILevel && AILevel > 1+random%2

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

[State -1,fatal]
type = ChangeState
value = 3600
triggerall = p2bodydist X = (0,300]
trigger1 = command = "babality"
triggerall = p2stateno = 9010
triggerall = statetype = S ||statetype = C
triggerall = ctrl = 1 || stateno = [10,12]
trigger1 = var(50) = 0
trigger2 = enemy,time > 90
trigger2 = var(50) = 1 && random%88 < AILevel && gametime%2 = 0&& AILevel > 1+random%2


;----------------------------
[State -1,friedship]
type = ChangeState
value = 3700
triggerall = p2bodydist X = (0,320]
trigger1 = command = "friend"
triggerall = p2stateno = 9010
triggerall = (statetype = S&&ctrl = 1)||stateno = 10||(stateno = [120,159])
;triggerall = var(54) = 0; never blocked
trigger1 = var(50) = 0
trigger2 = enemy,time > 90
trigger2 = var(50) = 1 && random%76 < AILevel && gametime%2 = 0&& AILevel > 1+random%2

;----------------------------
;[State -1,animal]
;type = ChangeState
;value = 3800
;triggerall = p2bodydist X = (60,160)
;trigger1 = command = "animality"
;triggerall = numexplod(3800) = 1
;triggerall = p2stateno = 9010
;triggerall = statetype = S
;triggerall = ctrl = 1||(stateno = [120,159])
;trigger1 = var(50) = 0
;trigger2 = enemy,time > 60
;trigger2 = var(50) = 1 && random%28 < AILevel&& AILevel > 1+random%2

;--[MK Holdback, closeup moves]-----------------------------------------------

[State -1]
type = Changestate
value = 240
triggerall = command = "y"
triggerall = command = "holdback"
trigger1 = statetype = S
triggerall = Vel Y = 0
trigger1 = ctrl = 1 && stateno != 180

[State -1, dropkick]
type = ChangeState
value = 630
triggerall = statetype = A
trigger1 = ctrl = 1
triggerall = command = "sp8"
trigger2 = stateno =615  ; После вторго удара рукой


;--[Regular moves]----------------------------------------------------------------------
; THROW

[State -1, 90932]
type = selfState
value = 24
triggerall = p2bodydist X <= 1 && backedgebodydist > 30
triggerall = command = "a"
trigger1 = ctrl = 1
triggerall = p2statetype = S || p2statetype = C || p2stateno = 5120
triggerall = statetype = S 
triggerall = enemy,numexplod(24) = 0
triggerall = var(50) = 0

;-----------------------------------------;
;	- KOMBOS -	;
;-----------------------------------------;

[State -1, 2]
type = ChangeState
value = 2001
anim = 2030
triggerall = p2dist X <= 60
trigger1 = command = "y" || command = "b"
trigger1 = var(50) = 0 || random%6 > AILevel
triggerall = statetype = S 
triggerall = ctrl || stateno = 107
triggerall = p2statetype != A
trigger2 = random%2 = 0 || AILevel > 5 || p2statetype = C
trigger2 = var(50) = 1 && (p2movetype != A || p2stateno = [200,420])
trigger2 = random%20 < AILevel
trigger2 = time > 7-AILevel && random%3 > 0
trigger2 = (p2stateno != [120,159])||enemy,backedgebodydist > 10
trigger3 = stateno = 111&& random%7 = 0
trigger4 = stateno = 157&& random%7 = 0 && anim = 0
trigger2 = p2life > 2
trigger2 = p2stateno != 120 && p2statetype != L
triggerall = roundstate = 2


[State -1, 3]
type = ChangeState
value = 2001
anim = 2001
triggerall = p2dist X <= 60
trigger1 = command = "x"
trigger1 = var(50) = 0 || random%6 > AILevel
triggerall = statetype = S
triggerall = ctrl || stateno = 107
triggerall = p2statetype != A
trigger2 = var(50) = 1
trigger2 = random%20 < AILevel
trigger2 = time > 7-AILevel && random%3 > 0
trigger2 = (p2stateno != [120,159])||enemy,backedgebodydist > 10
trigger3 = stateno = 111&& random%7 = 0
trigger4 = stateno = 157&& random%7 = 0 && p2statetype != C && anim = 0
trigger2 = p2life > 2 || (p2stateno = 9010 && enemy,time > 30 && random%30 < AILevel&& AILevel > 1+random%2)
trigger2 = p2stateno != 120 && p2statetype = S
triggerall = roundstate = 2

;Sweep
[State -1]
type = Changestate
value = 245
trigger1 = command = "b"
trigger1 = command = "holdback"
trigger1 = statetype = S && p2dist x > 60
triggerall = Vel Y = 0
trigger1 = ctrl = 1 && stateno != 180



[State -1, Duck LK]
type = ChangeState
value = 400
triggerall = command = "down_b"
;triggerall = command = "holddown"
trigger1 = statetype = C
trigger1 = ctrl = 1
triggerall = Vel Y = 0

[State -1, Duck HK]
type = ChangeState
value = 411
triggerall = command = "down_y"
;triggerall = command = "holddown"
trigger1 = statetype = C
trigger1 = ctrl = 1
triggerall = Vel Y = 0

[State -1, Duck LP]
type = ChangeState
value = 420
triggerall = command = "down_a"
;triggerall = command = "holddown"
trigger1 = statetype = C
trigger1 = ctrl = 1
triggerall = Vel Y = 0

[State -1, MKUppercut]
type = ChangeState
value = 430
triggerall = command = "down_x"
;triggerall = command = "holddown"
trigger1 = statetype = C
trigger1 = ctrl = 1
triggerall = Vel Y = 0


;Jump Kick
[State -1, NKick]
type = ChangeState
value = 600
triggerall = statetype = A
triggerall = ctrl = 1
triggerall = Vel X = 0 
trigger1 = command = "y"
trigger2 = command = "b"


;Jump Punch
[State -1, Punch]
type = ChangeState
value = 610
triggerall = statetype = A
triggerall = ctrl = 1
trigger1 = command = "x"
triggerall = var(50) = 0

[State -1, !]
type = ChangeState
value =615
trigger1 = command = "a"
triggerall = statetype = A
trigger1 = var(50) = 0
triggerall = ctrl = 1


;Jump Side kick
[State -1, SideKick]
type = ChangeState
value = 620
triggerall = statetype = A
triggerall = ctrl = 1
triggerall = Vel X != 0 
triggerall = var(50) = 0
trigger1 = command = "y"
trigger2 = command = "b"

;LP
[State -1, Stand SPunch1]
type = ChangeState
value = 220
triggerall = command = "a"
triggerall = command != "holddown"
triggerall = Vel Y = 0 && stateno != 180
trigger1 = statetype = S
trigger1 = ctrl
trigger1 = var(50) = 0 || (p2life > 2 && random%12 > AILevel)

;HP
[State -1, Stand LPunch1]
type = ChangeState
value = 200
triggerall = command = "x"
triggerall = command != "holddown"
triggerall = Vel Y = 0
trigger1 = statetype = S
trigger1 = ctrl
trigger1 = var(50) = 0 || (p2life > 2 && random%12 > AILevel)

;High Kick
[State -1]
type = ChangeState
value = 210
triggerall = command = "y"
triggerall = command != "holddown"
triggerall = Vel Y = 0 && stateno != 180
trigger1 = statetype = S
trigger1 = ctrl = 1
trigger1 = var(50) = 0 || (p2life > 2 && random%12 > AILevel)

;Low Kick
[State -1]
type = ChangeState
value = 225
triggerall = command = "b"
triggerall = command != "holddown"
triggerall = Vel Y = 0 && stateno != 180
trigger1 = statetype = S
trigger1 = ctrl = 1
trigger1 = var(50) = 0 || (p2life > 2 && random%12 > AILevel)

;--------AIIIIIIIIII
[State -1, RunMk]
type = ChangeState
value = 107
trigger1 = var(50) = 1 && p2bodydist x > 2 && random%30 < AILevel
triggerall = var(47) > 10 
triggerall = stateno != 107 && enemy,numhelper(7003) = 0 && inguarddist = 0 && p2stateno != [26,39]
triggerall = statetype = S
triggerall = ctrl
triggerall = roundstate = 2 && p2stateno != 9010 && p2life > 1
trigger1 = p2movetype = H || (p2stateno = [120,159]) || random%12 > AILevel
triggerall = time > 3-AILevel


[State -1, thhep]
type = selfState
value = 24
triggerall = Var(50) = 1
triggerall = ctrl = 1
triggerall = statetype = S
triggerall = p2bodydist X <= 1 && backedgebodydist > 30
triggerall = roundstate = 2
triggerall = enemy,numexplod(24) = 0
triggerall = random%14 < AILevel
triggerall = p2statetype = S || p2statetype = C || p2stateno = 5120
trigger1 = p2stateno = [0,431] 
trigger2 = p2stateno = 52
trigger3 = p2stateno != 5120 && random%7 = 0
triggerall = time > 3-AILevel

[State -1, sweepdfs]
type = ChangeState
value = 245
triggerall = Var(50) = 1
triggerall = ctrl = 1
triggerall = random%14 < AILevel
triggerall = statetype = S
triggerall = p2dist x > 60 && p2bodydist X <= 70
triggerall = roundstate = 2
triggerall = p2stateno != 245
trigger1 = (p2stateno = [0,120))||(p2stateno = [200,240])||p2stateno = 430
trigger1 = random%7 = 0
trigger2 = p2stateno = 130 && enemy,time > 3
triggerall = time > 3-AILevel

[State -1, sweep defense]
type = ChangeState
value = 40
triggerall = Var(50) = 1
triggerall = ctrl && random%3 > 0
triggerall = random%8 < AILevel
triggerall = statetype = S
trigger1 = p2bodydist X <= 80 && backedgedist > 40
triggerall = roundstate = 2
trigger1 = p2bodydist x > 40
trigger1 = p2stateno = 245
trigger2 = p2bodydist x < 12 && p2stateno = 24

[State -1, sweep defense]
type = ChangeState
value = 400
triggerall = Var(50) = 1
triggerall = ctrl = 1
triggerall = random%8 < AILevel
triggerall = statetype = S || statetype = C
triggerall = p2bodydist X <= 40
triggerall = roundstate = 2 && random%3 > 0
triggerall = p2bodydist x > 10
trigger1 = p2stateno = 245
trigger1 = time > 3-AILevel

[State -1, uuppercut rh]
type = ChangeState
value = 430 - 190*(statetype != C&& random%2 = 0&&p2statetype != C&&p2stateno!= 430)
triggerall = ctrl && random%3 > 0
triggerall = roundstate = 2
triggerall = Var(50) = 1
trigger1 = p2bodydist x >= 0+10*(enemy,vel x > 0)
triggerall = random%8 < AILevel
trigger1 = p2bodydist X <= 20+10*(enemy,vel x > 0)
trigger1 = p2statetype = A
trigger1 = p2movetype != A
trigger1 = abs(p2dist y) > 40 && enemy,vel y > 0
triggerall = statetype = S || statetype = C
trigger2 = p2stateno = 9010 && enemy,time > 60
trigger2 = p2bodydist X <= 10
trigger3 = enemy,moveguarded > 3 || gethitvar(guarded) > 3
trigger3 = p2bodydist X <= 30 && p2statetype != C
trigger4 = p2bodydist x >= 0
trigger4 = p2bodydist X <= 20
trigger4 = enemy,anim = 430
triggerall = time > 3-AILevel

[State -1, blllccl]
type = ChangeState
value = 120
triggerall = Var(50) = 1
trigger1 = p2Movetype = A
trigger1 = p2BodyDist X < 54 + 10*(random%8 < AILevel)
trigger2 = stateno = 5120
trigger2 = p2BodyDist X < 54 + 10*(random%8 < AILevel)
trigger3 = inguarddist
triggerall = p2statetype != C
triggerall = ctrl = 1
triggerall = statetype != A && enemy,p2dist x > 0
triggerall = roundstate = 2 && prevstateno != 120
triggerall = random%8 < AILevel
triggerall = time > 3-AILevel

[State -1, blllccl]
type = ChangeState
value = 131
triggerall = Var(50) = 1
trigger1 = p2stateno = [245,246]
trigger1 = p2BodyDist X < 100 && random%3 > 0
triggerall = ctrl = 1 || stateno = [120,150]
triggerall = hitover
triggerall = statetype = C || statetype = S
triggerall = roundstate = 2
triggerall = random%6 < AILevel
triggerall = time > 3-AILevel
anim = 10+111*(stateno != 130)

[State -1, AI Jump Kick]
type = ChangeState
value = 620 -ifelse(vel x = 0, 10+10*(random%2 = 0||random%14 > AILevel), 10*(random%4 > 0&&p2statetype != A))
triggerall = Var(50) = 1
triggerall = statetype = A
triggerall = ctrl = 1
trigger1 =  pos y < var(57)-20 || vel y < 0
triggerall = p2life > 2
triggerall = roundstate = 2
trigger1 = p2dist X > 0 && p2statetype != L
triggerall = p2bodydist X < 70
triggerall = random%8 < AILevel
triggerall = time > 12-AILevel

[State -1, weep]
type = ChangeState
value = 220-20*((ctrl&&random%2 = 0&&p2bodydist x < 10)||(stateno = [200,201])) + 1*(stateno = 200||stateno = 220)
trigger1 = ctrl = 1
trigger2 = (stateno = [200,201]) || (stateno = [220,221])
trigger2 = time > 9 && time < 12
triggerall = Var(50) = 1
triggerall = (p2stateno = [200,241])||(p2stateno = [5000,5001])||p2movetype != A||backedgebodydist < 6
triggerall = statetype = S && p2statetype = S
triggerall = p2bodydist X <= 20
triggerall = ctrl = 1 || movecontact
triggerall = roundstate = 2
triggerall = ifelse(((p2stateno != [200,201])&&(p2stateno != [220,221])), 1, (enemy,time > 10))
triggerall = random%6 < AILevel || movecontact
triggerall = p2bodydist x > 3 && p2life > 1
triggerall = random%8 < AILevel
triggerall = time > 3-AILevel