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

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


[Command];vilami
name = "sp1"
command = B,F,a
time = 20
buffer.time = 7

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

[Command];zdorovie
name = "sp3"
command =  B,B,c
time = 20
buffer.time = 7

[Command];knife
name = "sp4"
command =  D,F,x
time = 20
buffer.time = 7

[Command]
name = "sp5"
command = D,U
time = 16
buffer.time = 7

[Command];knife
name = "sp6"
command =  D,F,a
time = 20
buffer.time = 7

[Command]
name = "extrapit"
command = ~20c
time = 16
buffer.time = 7
;
;[Command];nunchuki
;name = "sp4"
;;command = B,F,B,F,x
;command = ~80x
;time = 6;40
;buffer.time = 7
;
;[Command];flip forvard
;name = "sp5"
;command = F,F,y
;time = 20
;
;[Command];rolling
;name = "sp15"
;command = B,B,D, x
;time = 48
;buffer.time = 21
;
;[Command];front kick
;name = "sp6"
;command = F,F,b
;time = 20
;buffer.time = 7
;
;[Command];health
;name = "sp1700"
;command = B,B,a
;time = 20
;
;[Command];
;name = "airstrike"
;command = B,B,x
;time = 20
;
;[Command];
;name = "S"
;command = F,F,x
;time = 20
;
;[Command];
;name = "rko"
;command = D,U
;time = 16
;buffer.time = 7

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

[Command]
name = "fatal2"
command = B,B,B
time = 40

[Command]
name = "fatal1"
command = F,F,F
time = 40

[Command]
name = "fatal3"
command = D,D,D
time = 40

;[Command]
;name = "friend"
;command = c,c,c
;time = 40

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

;[Command]
;name = "animality"
;command = B,B,F,F
;time = 50

;[Command]
;name = "mercy"
;command = D,D,D,~c
;time = 50
;buffer.time = 14

;[Command]
;name = "harakiri"
;command = a,a,a
;time = 40

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

;[Command]
;name = "ilbeback"
;command = c,c,D
;time = 40
;
;[Command]
;name = "superpower"
;command = c,c,U
;time = 40

;-| 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 = 
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 = "x"
command = x
time = 1

[Command]
name = "y"
command = y
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

[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]----------------------------------------
; Var Activators
;-----------------------------------

[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
value = 4000

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


;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 = power > 0
triggerall = var(50) = 0
triggerall = stateno != 107
triggerall = statetype = S
triggerall = ctrl

;---------------------------------------;
;	-	 specials	 -	;
;---------------------------------------;


[State -1, Jason_AXE]
type = ChangeState
value = 1000
triggerall = (statetype = S&&ctrl)||stateno = 10||(stateno = [200,201])||(stateno = [220,221])
triggerall = roundstate = 2
triggerall = var(16) < 2; num hits in AAAAAA
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel
trigger1 = command = "sp1"
trigger2 = abs(p2dist y) < 12 && p2stateno != 1000 && (p2bodydist x = (90,240)) && (p2stateno != [120,159])
trigger2 = p2bodydist x > 120||p2stateno = 107||(p2stateno = [0,20])||p2stateno = 2020||prevstateno = 1100
trigger2 = (p2statetype = S||p2statetype = A) && p2stateno != 5120 && var(50) = 1 && random%30 < AILevel
trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
trigger2 = p2name !="motaro"  



;
[State -1,plechikom]
type = ChangeState
value = 1200
trigger1 = command = "sp2"
triggerall = statetype = S 
triggerall = ctrl = 1
triggerall = var(16) < 2
triggerall = roundstate = 2
triggerall = var(50) = 0


[State -1,plechikom_AI]
type = ChangeState
value = 1200
triggerall = var(50) = 1&& ctrl = 1
triggerall = statetype = S
triggerall = var(16) < 2
triggerall = p2statetype!=c && p2movetype!=I
trigger1 = roundstate = 2 && p2stateno != [120,159]
trigger1 = (abs(p2dist y < 12) && p2bodydist x = (60,400))||(enemy,numexplod(1181) > 0)||(enemy,numexplod(118) > 0)
;triggerall = p2stateno = 107||p2stateno = 21239||enemy,moveguarded > 3||(p2stateno = 5050&&prevstateno = 52)
;triggerall = var(50) = 1; && ifelse(prevstateno = 52, (random%8 < AILevel), (random%14 < AILevel))
trigger1 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
trigger1 = time > 14-2*AILevel && AILevel > 2+random%3
trigger2 =  p2bodydist x < 160 && p2stateno != 1000
trigger2 = p2statetype != A || (abs(p2dist y) < 40 && enemy,vel y > 0) || abs(p2dist y) < 10
trigger2 = p2bodydist x > 30 || gethitvar(guarded) > 1 ||enemy,movecontact > 3
trigger2 = p2stateno != 5120 
trigger2 = p2stateno = 107||(p2stateno = [0,50])||enemy,movecontact > 1||p2stateno = 21239||prevstateno = 1310||prevstateno = 140
trigger2 = random%40 < AILevel && var(51) > 0
trigger2 = p2life > 1



[State -1,++++]
type = ChangeState
value = 1300
trigger1 = command = "sp3"
triggerall = statetype = S 
triggerall = ctrl = 1|| stateno = 200||stateno = 220
triggerall = var(16) < 2
triggerall = roundstate = 2

[State -1,++++]
type = ChangeState
value = 1300
trigger1 = command = "sp3"
triggerall = statetype = S 
triggerall = ctrl = 1|| stateno = 200||stateno = 220
triggerall = var(16) < 2
triggerall = roundstate = 2
trigger2 = p2life > 1 && p2statetype != L && p2statetype != A && (p2stateno!= [120,159])
trigger2 = p2bodydist x > 80  && inguarddist = 0
trigger2 = var(50) = 1 && random%14 < AILevel && life < 1.5*random
trigger2 = time > 14-2*AILevel && AILevel > 2+random%3; && var(51) > 0
trigger5 = ((p2stateno = 1302||(p2stateno = 1303&&enemy,time < 50))&&random%5 > 1)||(p2bodydist x > 120&&p2stateno = 21239)||prevstateno = 2002||prevstateno = 2102
trigger5 = var(50) = 1&&random%30 < AILevel&&p2life > 1&&Life > 0.0625*p2life*AILevel && p2movetype = H
trigger3 = p2bodydist x > 180 && target,stateno = [5100,5111]
trigger3 = var(50) = 1 && random%12 > AILevel && p2life > 1 && AILevel > 0 && Life > 0.125*p2life*AILevel
trigger4 =  p2bodydist x > 50 && random%5 = 0 && random < 332
trigger4 = var(50) = 1 && random%12 > AILevel && p2life > 1 && AILevel > 0 && Life > 0.5*p2life*AILevel






[State -1,axe-nitro]
type = ChangeState
value = 231
anim=236
trigger1 = command = "sp4"
triggerall = statetype = S 
triggerall = ctrl = 1
trigger1 = roundstate = 2
trigger2 = enemy,prevstateno != 1102 && frontedgedist > 50
trigger2 = p2statetype = A||abs(p2dist y) > 60||(p2stateno = [0,20])||p2stateno = 210||p2stateno = 240||p2stateno = 5120
trigger2 = p2movetype = I||p2statetype = A||((stateno = [200,221]) && movehit && p2statetype = A)
trigger2 = var(50) = 1 && random%21 < AILevel && p2statetype != L && p2stateno != 32 && p2stateno != [120,159]
trigger2 = time > 14-2*AILevel
trigger2 = (enemy,numexplod(118) = 0 && ctrl) || AILevel > 2+random%3
trigger2 = prevstateno != 2002 && prevstateno != 2103
trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
trigger2 = p2bodydist x = [71,105]

[State -1,knife-nitro]
type = ChangeState
value = 231
anim=242
trigger1 = command = "sp6"
triggerall = statetype = S 
triggerall = ctrl = 1
trigger1 = roundstate = 2
trigger2 = enemy,prevstateno != 1102 && frontedgedist > 50
trigger2 = p2statetype = A||abs(p2dist y) > 60||(p2stateno = [0,20])||p2stateno = 210||p2stateno = 240||p2stateno = 5120
trigger2 = p2movetype = I||p2statetype = A||((stateno = [200,221]) && movehit && p2statetype = A)
trigger2 = var(50) = 1 && random%21 < AILevel && p2statetype != L && p2stateno != 32 && p2stateno != [120,159]
trigger2 = time > 14-2*AILevel
trigger2 = (enemy,numexplod(118) = 0 && ctrl) || AILevel > 2+random%3
trigger2 = prevstateno != 2002 && prevstateno != 2103
trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
trigger2 =  p2bodydist x = [71,100]

[State -1,AIRknife1];me
type = ChangeState
anim=ifelse(statetype=A,1502,1500)
value = 1500
triggerall =  stateno != [1500,1501]
triggerall = command = "sp5"
triggerall = roundstate = 2
trigger1 = statetype = S
trigger1 = ctrl = 1
trigger1 = var(16) < 2
trigger2 =  statetype = A && ctrl = 1
trigger3 =  stateno = 600 || stateno = 610 || stateno = 620||stateno = 601 || stateno = 611 || stateno = 621
triggerall = var(50) = 0

[State -1,AIRknife1];ai
type = ChangeState
anim=ifelse(statetype=A,1502,1500)
value = 1500
triggerall =  stateno != [1500,1501]
triggerall = var(50) = 1
triggerall = roundstate = 2
triggerall = p2stateno != [120,159]
trigger1 = statetype = S
trigger1 = ctrl = 1
trigger1 =   p2statetype!=A && AILevel > 2+random%3&&p2bodydist x >100
trigger1 = time > 12-2*AILevel
trigger2 =  statetype = A && p2bodydist x <70 && random>800 && ctrl = 1
trigger3 =  stateno = 601 || stateno = 611 || stateno = 621
trigger3 =  movehit = 3 && AILevel > 2+random%3


[State -1,airAXE1];me
type = ChangeState
value = 1600
triggerall = command = "sp1"
triggerall = roundstate = 2
trigger1 =  statetype = A && ctrl
trigger2 =  stateno = 600 || stateno = 610 || stateno = 620||stateno = 601 || stateno = 611 || stateno = 621
triggerall = var(50) = 0

[State -1, airAXE1];ai
type = ChangeState
value = 1600
triggerall = statetype = A
triggerall = roundstate = 2
trigger1 = abs(p2dist y) < 20 || p2stateno = 50 ||stateno = 621||p2stateno = [5020,5030]
trigger1 = (p2movetype != H && p2bodydist x > 90)||(p2movetype = H && p2statetype = A && stateno = [600,621])
trigger1 = p2life > 1 && p2stateno != 5120 && var(50) = 1
trigger1 = random%16 < AILevel || (random%8 < AILevel && stateno = 621)
trigger1 = ctrl = 1 || (stateno = [600,621])
trigger1 = time > 7 || ctrl = 0
trigger1 = time > 14-AILevel*(2-(stateno = 50))
trigger1 = (p2movetype != H && ctrl)|| AILevel > 2+random%3

;---------------------------------------;
;	-	 Fatalities!!!	 -	;
;---------------------------------------;

;[State -1,mercy]
;type = ChangeState
;value = 3997
;triggerall = ctrl = 1||(stateno = [10,12])
;triggerall = RoundNo >= 3
;triggerall = 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


;---------------------------------------;
;	-	 ilbeback -	;
;---------------------------------------;
;
;[State -1,fatal]
;type = ChangeState
;value = 3900
;trigger1 = command = "ilbeback"
;triggerall = p2stateno = 9010
;triggerall = statetype = S
;triggerall = ctrl = 1
;trigger1 = command != "run"
;trigger1 = var(50) = 0
;trigger2 = enemy,time > 60
;trigger2 = var(50) = 1 && random%50 < AILevel


;---------------------------------------;
;	-	 super power;
;---------------------------------------;

;[State -1,fatal]
;type = ChangeState
;value = 3900
;anim=3920
;trigger1 = command = "superpower"
;triggerall = p2stateno = 9010
;triggerall = statetype = S
;triggerall = ctrl = 1
;trigger1 = command != "run"
;trigger1 = var(50) = 0
;trigger2 = enemy,time > 60
;trigger2 = var(50) = 1 && random%50 < AILevel




;---------------------------------------;
;	-	 Fatality 1	 -	;
;---------------------------------------;

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


;---------------------------------------;
;	-	 Fatality 2	 -	;
;---------------------------------------;

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

;---------------------------------------;
;	-	 Fatality 3	 -	;
;---------------------------------------;

[State -1,fatal]
type = ChangeState
value = 3220
triggerall = p2bodydist X<140
trigger1 = command = "fatal3"
triggerall = p2stateno = 9010
triggerall = statetype != A && ctrl ||stateno = 10 ||  stateno = 12
trigger1 = command != "run"
trigger1 = var(50) = 0
trigger2 = enemy,time > 60
trigger2 = var(50) = 1 && random%40 < AILevel
triggerall = StageVar(info.name)!="1cep1t"
triggerall = StageVar(info.name)!="w1nd_w0rld"

;---------------------------------------;
;	-BABALITY, Mazafaka!	 -	;
;---------------------------------------;
[State -1,fatal]
type = ChangeState
value = 3600
triggerall = p2bodydist X = (30,300]
trigger1 = var(50) = 0 && command = "babality"
triggerall = p2stateno = 9010
triggerall = statetype = S
triggerall = ctrl = 1
trigger2 = enemy,time > 90
trigger2 = var(50) = 1 && random%76 < AILevel && gametime%2 = 0


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



;Sweep
[State -1]
type = Changestate
value = 237
trigger1 = command = "b"
trigger1 = command = "holdback"
trigger1 = statetype = S
trigger1 = ctrl = 1

;roundhouse
[State -1]
type = Changestate
value = 234
triggerall = command = "y"
triggerall = command = "holdback"
trigger1 = statetype = S
trigger1 = ctrl = 1

;aniAir
[State -1]
type = Changestate
value = 236
triggerall = command = "a" 
triggerall = command = "holdback"
trigger1 = statetype = S
trigger1 = ctrl = 1

; THROW

[State -1, THROW]
type = selfState
value = 24
triggerall = p2bodydist X <= 1
triggerall = command = "a"
trigger1 = ctrl = 1
triggerall = p2statetype != A && p2statetype != L
triggerall = statetype = S 
triggerall = p2name != "shao kahn,"
triggerall = p2name != "kintaro"
triggerall = p2name != "goro"
triggerall = p2name != "motaro"
triggerall = backedgedist > 30
triggerall = enemy,numexplod(24) = 0




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

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

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

[State -1, MKUppercut]
type = ChangeState
value = 430
triggerall = command = "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 = "a"
trigger2 = command = "x"
triggerall = var(50) = 0

;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 = 230
triggerall = command = "a"
triggerall = command != "holddown"
triggerall = Vel Y = 0
trigger1 = statetype = S
trigger1 = ctrl
trigger1 = var(50) = 0 || (p2life > 2 && random%12 > AILevel)
anim=230

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

;Kick
[State -1]
type = ChangeState
value = 232
triggerall = command = "b" ||  command = "y"
triggerall = command != "holddown"
triggerall = Vel Y = 0
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 = power > 10 
triggerall = stateno != 107 && enemy,numhelper(7003) = 0 && inguarddist = 0
triggerall = statetype = S
triggerall = ctrl
triggerall = roundstate = 2 && p2stateno != 9010 && p2life > 1
trigger1 = p2movetype = H || (p2stateno = [120,159]) || random%12 > AILevel

;throw
[State -1, thhep]
type = selfState
value = 24
triggerall = Var(50) = 1
triggerall = ctrl = 1
triggerall = statetype = S
triggerall = p2bodydist X <= 1 && backedgedist > 30
triggerall = roundstate = 2
triggerall = enemy,numexplod(24) = 0
triggerall = random%20 < AILevel
triggerall = p2statetype != A && p2statetype != L
trigger1 = p2stateno = 11 
trigger2 = p2stateno = 52
trigger3 = p2stateno = 245
trigger4 = p2stateno = 420
trigger5 = p2stateno = 410
trigger6 = p2stateno = 20
trigger7 = p2stateno = 107
trigger8 = p2stateno = [120,159]
trigger9 = p2stateno != 5120 && random%7 = 0
triggerall = p2name != "shao kahn"
triggerall = p2name != "kintaro"
triggerall = p2name != "goro"
triggerall = p2name != "motaro"
triggerall = enemy,numexplod(1991) = 0 || AILevel < random%6


;AI bak C
[State -1, sweepdfs]
type = ChangeState
value = 237;245
triggerall = Var(50) = 1
triggerall = ctrl = 1
triggerall = random%25 < AILevel
triggerall = statetype = S
triggerall = p2bodydist X <= 200;40
triggerall = roundstate = 2
triggerall = p2stateno != 245
trigger1 = p2stateno = 11 
trigger2 = p2stateno = 245
trigger3 = p2stateno = 420
trigger4 = p2stateno = 410
trigger5 = p2stateno = 20
trigger6 = p2stateno = 107
trigger7 = p2stateno = 210
trigger8 = p2stateno = 225
trigger9 = p2stateno = 130
trigger10 = p2stateno = 140
trigger11 = p2stateno = 150
triggerall = enemy,numexplod(1991) = 0 || AILevel < random%6


; AI walk
[State -1, anti-air defense]
type = ChangeState
value = 0 + 20*(random%2)
triggerall = Var(50) = 1
triggerall = random%9 < AILevel
triggerall = stateno = 40 && time = 0
trigger1 = p2bodydist X <= 30 && p2stateno = [600,620]
triggerall = roundstate = 2
trigger2 = p2stateno = 9010 && p2bodydist x > 20
ctrl = 1


; AI jump
[State -1, sweep defense]
type = ChangeState
value = 40
triggerall = Var(50) = 1
triggerall = ctrl = 1
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


;AI sit C
[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
triggerall = p2bodydist x > 10
trigger1 = p2stateno = 245
trigger1 = time > 3-AILevel

;AI Uppercut / bakZ
[State -1, uuppercuuuut lp]
type = ChangeState
value = 234;430 - 10*(random%2)
triggerall = ctrl = 1
triggerall = Var(50) = 1
triggerall = p2bodydist x > 2
triggerall = random%8 < AILevel
trigger1 = p2bodydist X <= 10
trigger1 = p2stateno = 0
trigger2 = p2bodydist X <= 10
trigger2 = p2stateno = 200
trigger3 = p2stateno = 620
trigger3 = p2bodydist X <= 40
trigger5 = p2stateno = 2002
trigger5 = p2name = "johnny cage"
trigger6 = p2stateno = 20
trigger6 = p2bodydist X <= 30
trigger7 = p2stateno = 107
trigger7 = p2bodydist X <= 40
trigger8 = p2stateno = 50
trigger8 = p2bodydist X <= 20
trigger9 = p2stateno = 210
trigger9 = p2bodydist X <= 90
trigger10 = p2stateno = 225
trigger10 = p2bodydist X <= 90
trigger11 = p2stateno = 430
trigger11 = p2bodydist X <= 30
trigger11 = stateno = 131
triggerall = statetype = C
triggerall = p2movetype != H
triggerall = roundstate = 2
triggerall = time > 3-AILevel

;AI Uppercut / Z
[State -1, uuppercut hk]
type = ChangeState
value = 234;430 - 220*(random%2)
triggerall = ctrl = 1
triggerall = Var(50) = 1
triggerall = p2bodydist x > 2
triggerall = random%8 < AILevel
trigger1 = p2bodydist X <= 10
trigger1 = p2stateno = 0
trigger2 = p2bodydist X <= 10
trigger2 = p2stateno = 200
trigger3 = p2stateno = 620
trigger3 = p2bodydist X <= 40
trigger5 = p2stateno = 2002
trigger5 = p2name = "johnny cage"
trigger6 = p2stateno = 20
trigger6 = p2bodydist X <= 10
trigger7 = p2stateno = 107
trigger7 = p2bodydist X <= 40
trigger8 = p2stateno = 50
trigger8 = p2bodydist X <= 10
trigger9 = p2stateno = 210
trigger9 = p2bodydist X <= 90
trigger10 = p2stateno = 225
trigger10 = p2bodydist X <= 90
trigger11 = p2stateno = 430
trigger11 = p2bodydist X <= 30
trigger11 = stateno = 130
triggerall = statetype = S
triggerall = p2movetype != H
triggerall = roundstate = 2
triggerall = time > 3-AILevel
[State -1, uuppercut rh]
type = ChangeState
value = 234
triggerall = ctrl = 1
triggerall = roundstate = 2
triggerall = Var(50) = 1
trigger1 = p2bodydist x > 2
triggerall = random%8 < AILevel
trigger1 = p2bodydist X <= 20
trigger1 = p2statetype = A
trigger1 = p2movetype != A
trigger1 = abs(p2dist y) > 10
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
triggerall = time > 3-AILevel

[State -1, uuppercut challenge]
type = ChangeState
value = 430
triggerall = ctrl = 1
triggerall = roundstate = 2
triggerall = Var(50) = 1
trigger1 = p2bodydist x > 2
triggerall = random%8 < AILevel
trigger1 = p2bodydist X <= 10
trigger1 = enemy,anim = 430
triggerall = statetype = S || statetype = C
triggerall = time > 7-AILevel

;AI Uppercut / bakZ
[State -1, uuppercut rh]
type = ChangeState
value = 234;430 - 190*(random%2)
triggerall = ctrl = 1
triggerall = roundstate = 2
triggerall = Var(50) = 1
trigger1 = p2bodydist x > 2
triggerall = random%14 < AILevel
trigger1 = p2bodydist X <= 15
trigger1 = p2statetype = A
trigger1 = p2movetype != A
trigger1 = abs(p2dist y) > 10
triggerall = statetype = S || statetype = C
trigger2 = p2stateno = 9010 && enemy,time > 60
trigger2 = p2bodydist X <= 25
trigger3 = enemy,moveguarded > 3 || gethitvar(guarded) > 3
trigger3 = p2bodydist X <= 30


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

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

;AI sit B
[State -1, blllccl]
type = ChangeState
value = 131
triggerall = Var(50) = 1
trigger1 = p2stateno = [245,246]
trigger1 = p2BodyDist X < 100
;trigger2 = p2statetype = C && p2movetype = A && inguarddist && p2stateno = [700,2999]
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

;AI sit Z
[State -1, weep]
type = ChangeState
value = 410
triggerall = ctrl = 1
triggerall = Var(50) = 1
trigger1 = p2stateno = [200,221]
trigger2 = p2stateno = [130,135]
trigger3 = p2stateno = 245
triggerall = statetype = C
triggerall = p2bodydist X <= 10
triggerall = random%8 < AILevel
triggerall = time > 3-AILevel
triggerall = roundstate = 2

;Jason
; AI C/Z
[State -1, kik]; AI
type = ChangeState
value = 232
trigger1 = ctrl = 1
triggerall = Var(50) = 1
triggerall = statetype = S && p2statetype != A
triggerall = p2bodydist X <= 55
triggerall = roundstate = 2
triggerall = p2bodydist x > 3 && p2life > 1
triggerall = random%8 < AILevel
triggerall = numexplod(232)=0;aiblocker

;AI  A
[State -1, weep]
type = ChangeState
value = 230
anim = 230
triggerall = numexplod(230)=0;aiblocker
trigger1 = ctrl = 1
triggerall = Var(50) = 1
triggerall = (p2stateno = [200,241])||(p2stateno = 130&&ctrl)||(p2stateno = [5000,5001])||p2movetype != A
triggerall = statetype = S && p2statetype = S
triggerall = ctrl = 1 || p2stateno != [130,131]
triggerall = roundstate = 2
triggerall = p2bodydist x > 3 && p2life > 1
triggerall = random%8 < AILevel
triggerall = p2bodydist X <= 60


;AI  X
[State -1, weep]
type = ChangeState
value = 230
anim = 236
triggerall = numexplod(236)=0;aiblocker
trigger1 = ctrl = 1
triggerall = Var(50) = 1
;triggerall = (p2stateno = [200,241])||(p2stateno = 130&&ctrl)||(p2stateno = [5000,5001])||p2movetype != A
triggerall = statetype = S 
triggerall = ctrl = 1 || p2stateno != [130,131]
triggerall = roundstate = 2
triggerall = p2bodydist x > 3 && p2life > 1
triggerall = random%7 < AILevel
triggerall = p2bodydist X <= 70

;AI aniAir
[State -1,<A]
type = Changestate
value = 236
triggerall = Var(50) = 1
trigger1 = statetype = S
trigger1 = ctrl = 1
triggerall = p2bodydist X <= 50
triggerall = p2statetype = A
triggerall = p2movetype != H
triggerall = random%7 < AILevel

;AI sit C
[State -1, weep1]
type = ChangeState
value = 400
triggerall = ctrl = 1
triggerall = random%12 < AILevel
triggerall = Var(50) = 1
trigger1 = p2stateno = [200,221]
trigger2 = p2stateno = [130,135]
trigger3 = p2stateno = 245
triggerall = statetype = C
triggerall = p2bodydist X <= 40
triggerall = roundstate = 2

[State -1, weep1]
type = ChangeState
value = 420
triggerall = ctrl = 1
triggerall = random%8 < AILevel
triggerall = Var(50) = 1
trigger1 = p2statetype = A && p2movetype = H && frontedgedist < 90
triggerall = statetype = C
triggerall = p2bodydist X <= 20
triggerall = roundstate = 2
triggerall = time > 3-AILevel

[State -1, bloqueo]
type = ChangeState
value =232; ifelse(random%3 = 0||p2statetype = C, 220+5*(random%2), 200+10*(random%2))
triggerall = ctrl = 1 && statetype = S
triggerall = ifelse(enemy,numexplod(24) > 0, random%8 < AILevel, random%21 < AILevel)
triggerall = Var(50) = 1
trigger1 = p2dist X <= 90 && p2stateno = [120,131]
triggerall = roundstate = 2
triggerall = time > 3-AILevel