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

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


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

[Command];flip
name = "sp3"
command = D,D,y
time = 20
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 = "fatal1"
command = B,B,B
time = 40

[Command]
name = "fatal2"
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, airhit2]
type = ChangeState
value = 650
triggerall = stateno=610
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel
trigger1 = command = "a"


[State -1, GUN!]
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 != L && p2stateno != 5120 && var(50) = 1 && random%30 < AILevel
trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
trigger2 = p2name !="motaro"  


[State -1,airthrow b]
type = ChangeState
value = 1050
triggerall = statetype = A
trigger1 = p2stateno != 5120 && p2statetype = A && abs(p2dist y) < 20 && abs(p2bodydist x) < 30
trigger2 =  stateno = 621
trigger2 = time < 6 && p2bodydist x < 50
triggerall = ctrl = 1 || (stateno = [600,621])
trigger1 = command = "blok"
trigger2 = command = "blok"
triggerall = roundstate = 2
triggerall = command != "run"
triggerall = var(50) = 0 || random%12 < AILevel
trigger3 = var(50) = 1 && random%9 < AILevel && p2stateno != 5120 && p2statetype = A
trigger3 = (ctrl && abs(p2dist y) < 20 && abs(p2bodydist x) < 30) || (time < 6 && p2bodydist x < 60 && stateno = [600,621])

;
[State -1,flip]
type = ChangeState
value = 1100
trigger1 = command = "sp3"
triggerall = statetype = S ||  statetype = C
triggerall = ctrl = 1|| stateno = 200||stateno = 220 ||  stateno = 10 ||  stateno = 12
triggerall = var(16) < 2
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel
trigger2 = p2statetype != C && p2statetype != L && p2bodydist x > 12 && p2bodydist x < 70
trigger2 = p2stateno != 5120 && var(50) = 1 && p2movetype != A
trigger2 = p2stateno = 107||p2stateno = 52||p2stateno = 20||enemy,moveguarded > 2||p2statetype = A
trigger2 = random%40 < AILevel && (p2movetype != H || enemy,gethitvar(yvel) < -10)
trigger2 = p2life > 1


[State -1,nunchaks]
type = ChangeState
value = 1150
triggerall = numexplod(140041) = 0;detector
trigger1 = command = "sp4"
triggerall = (statetype = S && ctrl = 1)||(stateno = [200,201])
triggerall = var(16) < 2
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = var(50) = 0 
trigger2 = p2statetype != A && p2statetype != L && p2bodydist x<40
;trigger2 = p2stateno = 107||p2stateno = 20||enemy,moveguarded > 1
trigger2 = var(50) = 1 && random%18 < AILevel && abs(p2dist y) < 90 
trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
trigger2 = time > 7-AILevel && AILevel > 2+random%3
trigger2 =  p2stateno != [120,130];block

[State -1,>>Z stand]
type = null;ChangeState
value = 1200
trigger1 = command = "sp5"
triggerall = (statetype = A && ctrl = 1) || stateno = 610 || stateno = 650
triggerall = var(16) < 2
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel


[State -1, airgun]
type = ChangeState
value = 1250
triggerall = (statetype = A && ctrl = 1) || stateno = 610 || stateno = 650
triggerall = roundstate = 2
trigger1 = var(50) = 0 || random%6 > AILevel
trigger1 = command = "sp1"

[State -1,ftontkick]
type = ChangeState
value = 1300
trigger1 = command = "sp6"
triggerall = (statetype = S && ctrl = 1);|| stateno = 200||stateno = 220
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel
trigger2 = p2statetype != L && p2bodydist x < 80
;trigger2 = p2stateno = 107||p2stateno = 52||p2stateno = 50||p2stateno = 20||enemy,movecontact > 1
trigger2 = var(50) = 1 && random%14 < AILevel && abs(p2dist y) < 90 && p2dist x > 0
trigger2 = time > 14-2*AILevel
trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)

[State -1,airstrike]
type = ChangeState
value = 1400
trigger1 = command = "airstrike"
triggerall = (statetype = S && ctrl = 1);|| stateno = 200||stateno = 220
;triggerall = var(16) < 2
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel
trigger2 = p2statetype != A && inguarddist = 0 
trigger2 = p2bodydist x > 180 || (p2bodydist x > 100 && p2movetype = A)
trigger2 = var(50) = 1 && random%14 < AILevel
trigger2 = p2life > 1 && numhelper(1001) = 0
trigger2 = time > 14-2*AILevel


[State -1,"S"]
type = ChangeState
value = 1750
trigger1 = command = "S"
triggerall = (statetype = S && ctrl = 1);|| stateno = 200||stateno = 220
;triggerall = var(16) < 2
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel


[State -1, roll!]
type = ChangeState
value = 1500
triggerall = roundstate = 2
triggerall = statetype != A && ctrl ||stateno = 10 ||  stateno = 12
trigger1 = command != "run"
trigger1 = var(50) = 0 
trigger1 = command = "sp15"
trigger2 = p2bodydist x > 15 
trigger2 = var(50) = 1 && random%21 < AILevel
trigger2 = p2stateno != [120,159] 
trigger2 = p2statetype != A 
trigger2 = time > 21-3*AILevel



[State -1,>>Z_stand]
type = ChangeState
value = 1600
triggerall = statetype = S
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = command = "sp5"
trigger1 =  ctrl = 1
trigger1 = var(50) = 0
trigger2 = p2statetype != C && p2statetype != L && var(50) = 1
trigger2 = random%14 < AILevel
trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
trigger2 = time > 14-2*AILevel
trigger2 = (p2movetype != H && ctrl)|| AILevel > 2+random%3
trigger2 = p2bodydist x > 32 && p2bodydist x < 250
trigger2 =  ctrl = 1
trigger2 =  p2stateno != [120,130];block

[State -1,>>Z_a]
type = ChangeState
value = 1600
triggerall = statetype = S ||  statetype = a
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = command = "sp5"
trigger1 =  ctrl = 1
trigger1 = var(50) = 0
trigger2 = p2statetype =a && var(50) = 1
trigger2 = random%14 < AILevel
trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
trigger2 = time > 14-2*AILevel
trigger2 = AILevel > 2+random%3
trigger2 = p2bodydist x > 72 && p2bodydist x < 250
trigger2 =  ctrl = 1
trigger2 =  p2stateno != [120,130];block



[State -1, HELTH+++]
type = ChangeState
value = 1700
triggerall = (statetype = S && ctrl = 1);
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel
trigger1 = command = "sp1700"




[State -1,rko]
type = ChangeState
value = 1900
trigger1 = command = "rko"
;trigger1 = stateno = 9010
trigger1 = var(50) = 0
triggerall = stateno  = 9010
triggerall = numexplod(8881888)=0
triggerall = p2stateno != [3000,4999]
triggerall = enemy,var(4) = 0
trigger2 = time = [40,110]
trigger2 = var(50) = 1 && random%60 < AILevel && AILevel > 2+random%3
trigger2 = p2bodydist x < 60
trigger2 = AILevel < 5



;---------------------------------------;
;	-	 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 = 3000
triggerall = p2bodydist X <40
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 =[50,220]
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 = 3200
;triggerall = p2bodydist X=[20,300]
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

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

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


;	-	 Animality

[State -1, a scorpion]
type = ChangeState
value = 3800
triggerall = p2bodydist X = (100,300)
trigger1 = command = "animality"
;triggerall = numexplod(3800) = 1
triggerall = p2stateno = 9010
triggerall = statetype = S
triggerall = ctrl = 1
trigger1 = var(50) = 0
trigger2 = enemy,time > 60
trigger2 = var(50) = 1 && random%28 < AILevel

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

;[State -1, hari kiri]
;type = selfState
;value = 3500
;trigger1 = command = "harakiri"
;triggerall = stateno = 9010
;triggerall = p2stateno != [3000,4999]
;triggerall = enemy,var(4) = 0
;trigger1 = var(50) = 0
;trigger2 = time > 160
;trigger2 = var(50) = 1 && random%60 < AILevel
;=================================================

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

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

; THROW

[State -1, 90932]
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

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

;K O M B O
[State -1, knee]
type = ChangeState
value = 2001
anim = 2010
triggerall = p2bodydist X <= 3
triggerall = roundstate = 2
triggerall = statetype = S 
triggerall = ctrl = 1
triggerall = Vel Y = 0 
triggerall = p2statetype = S || p2statetype = C 
trigger1 = command = "y" || command = "b"
trigger1 = var(50) = 0 ;|| random%6 > AILevel
;trigger2 = random%2 = 0 || AILevel > 5 || p2statetype = C
;trigger2 = var(50) = 1 && (p2movetype != A || p2stateno = [200,420])
;trigger2 = random%20 < AILevel
;trigger2 = p2life > 2
;trigger2 = p2stateno != [120,159]



[State -1, elbow]
type = ChangeState
value = 2001
triggerall = p2bodydist X <= 3
triggerall = statetype = S
triggerall = ctrl = 1
triggerall = Vel Y = 0 
triggerall = p2statetype = S 
triggerall = roundstate = 2
trigger1 = command = "x"
trigger1 = var(50) = 0; || random%6 > AILevel
;trigger2 = var(50) = 1
;trigger2 = random%20 < AILevel 
;trigger2 = p2life > 2 || (p2stateno = 9010 && enemy,time > 30 && random%30 < AILevel)
;trigger2 = p2stateno != [120,159]



[State -1, AI combo]
type = ChangeState
value = 2100
triggerall = p2bodydist X <= 3
triggerall = roundstate = 2
triggerall = statetype = S 
triggerall = ctrl = 1
triggerall = Vel Y = 0 
triggerall = p2statetype != A
triggerall = var(50) = 1 ;|| random%6 > AILevel
trigger1 = random%2 = 0 ;|| AILevel > 5 || p2statetype = C
;trigger2 = var(50) = 1 && (p2movetype != A || p2stateno = [200,420])
;trigger2 = random%20 < AILevel
;trigger2 = p2life > 2
;trigger2 = p2stateno != [120,159]


;---------------------------------------;999999999999999999999999999999999999999999999999999999999

[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 = 220
triggerall = command = "a"
triggerall = command != "holddown"
triggerall = Vel Y = 0
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
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
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

[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


[State -1, sweepdfs]
type = ChangeState
value = 245
triggerall = Var(50) = 1
triggerall = ctrl = 1
triggerall = random%25 < AILevel
triggerall = statetype = S
triggerall = p2bodydist X <= 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

[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
trigger3 = p2stateno = 3213 && p2bodydist x > 20
triggerall = enemy,numexplod(1991) = 0 || AILevel < random%6
ctrl = 1



[State -1, sweep defense]
type = ChangeState
value = 40
triggerall = Var(50) = 1
triggerall = ctrl = 1
triggerall = random%20 < 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
triggerall = enemy,numexplod(1991) = 0 || AILevel < random%6

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

[State -1, uuppercuuuut lp]
type = ChangeState
value = 430 - 10*(random%2)
triggerall = ctrl = 1
triggerall = Var(50) = 1
triggerall = p2bodydist x > 2
triggerall = random%18 < 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 <= 50
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 = 131
triggerall = statetype = C
triggerall = p2movetype != H
triggerall = roundstate = 2

[State -1, uuppercut hk]
type = ChangeState
value = 430 - 220*(random%2)
triggerall = ctrl = 1
triggerall = Var(50) = 1
triggerall = p2bodydist x > 2
triggerall = random%16 < 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 <= 50
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

[State -1, uuppercut rh]
type = ChangeState
value = 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

[State -1, bllll]
type = ChangeState
value = 120
triggerall = Var(50) = 1
trigger2 = p2bodydist X > 100
trigger2 = p2stateno = 1000
trigger1 = p2Movetype = A
trigger1 = p2BodyDist X < 72 + 10*(random%8 < AILevel)
trigger3 = stateno = 5120
trigger3 = p2BodyDist X < 72 + 10*(random%8 < AILevel)
trigger4 = inguarddist
triggerall = p2statetype != C
triggerall = ctrl = 1
triggerall = statetype = S && enemy,p2dist x > 0
triggerall = roundstate = 2
triggerall = random%12 < AILevel
triggerall = enemy,numexplod(1991) = 0 || AILevel < random%6

[State -1, blllccl]
type = ChangeState
value = 120
triggerall = Var(50) = 1
trigger2 = p2bodydist X > 80
trigger2 = p2stateno = 1000
trigger1 = p2Movetype = A
trigger1 = p2BodyDist X < 52 + 10*(random%8 < AILevel)
trigger3 = stateno = 5120
trigger3 = p2BodyDist X < 52 + 10*(random%8 < AILevel)
trigger4 = inguarddist
triggerall = p2statetype != C
triggerall = ctrl = 1
triggerall = statetype = C && enemy,p2dist x > 0
triggerall = roundstate = 2
triggerall = random%12 < AILevel
triggerall = enemy,numexplod(1991) = 0 || AILevel < random%6

[State -1, blllccl]
type = ChangeState
value = 131
triggerall = Var(50) = 1
trigger1 = p2stateno = [245,246]
trigger1 = p2BodyDist X < 101
trigger2 = p2stateno = [400,420]
trigger2 = p2bodydist x < 32
trigger3 = p2statetype = C && p2movetype = A && inguarddist && p2stateno = [700,2999]
triggerall = ctrl = 1 || stateno = [120,150]
triggerall = hitshakeover
triggerall = statetype = C || statetype = S
triggerall = roundstate = 2
triggerall = random%6 < AILevel
triggerall = enemy,numexplod(1991) = 0 || AILevel < random%6


[State -1, AI Jump Kick]
type = ChangeState
value = 620-10*(random%4> AILevel||p2statetype = S)*(p2bodydist x < 40||vel x = 0) -10*(random%4> AILevel||p2statetype = S)*(vel x = 0)
triggerall = Var(50) = 1
triggerall = statetype = A
triggerall = ctrl = 1
trigger1 = time > 6
triggerall = p2life > 2
triggerall = roundstate = 2
trigger1 = p2bodydist X > 0
triggerall = p2bodydist X < 70
triggerall = random%12 < AILevel

[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%12 < AILevel
triggerall = roundstate = 2

[State -1, weep]
type = ChangeState
value = 220-20*((ctrl&&random%2 = 0&&p2bodydist x < 20)||(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 = 130&&ctrl)||(p2stateno = [5000,5001])||p2movetype != A
triggerall = statetype = S && p2statetype = S
triggerall = p2bodydist X <= 24
triggerall = ctrl = 1 || p2stateno != [130,131]
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

[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