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

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

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

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

[Command];flip
name = "sp3"
command = D,U
time = 16
buffer.time = 7

[Command];sweep
name = "sp4"
command = B,F,b
time = 16
buffer.time = 7

[Command];fire!!!
name = "sp5"
command =  F,B,a
time = 16
buffer.time = 7

[Command];catchfire!!!
name = "sp6"
command =  B,F,x
time = 16
buffer.time = 7


[Command]
name = "extrapit"
command = ~20c
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 = "mercy"
command = D,D,c
time = 30

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

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

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

[Command]
name = "doa"
command = c,c,F
time = 30


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

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

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

[Command];Sheborg
name = "run2"
command = ~c
time = 1

[Command];Sheborg
name = "holdup2" ;Required (do not remove)
command = ~U
time = 1

[Command];Sheborg
name = "holddown2" ;Required (do not remove)
command = ~D
time = 1

[Command];Sheborg
name = "holdback2" ;Required (do not remove)
command = ~B
time = 1

[Command];Sheborg
name = "holdfwd2" ;Required (do not remove)
command = ~F
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
value = 4000

; Stand Block
[State -1, Block]
type = ChangeState
value = 120
triggerall = command = "blok"
triggerall = ctrl && stateno != 10 && stateno != 180
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 = var(47) > 0
triggerall = var(50) = 0
triggerall = stateno != 107 && stateno != 10 && stateno != 180
triggerall = statetype = S
triggerall = ctrl

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

[State -1, 111]; en stand
type = ChangeState
value =  ifelse(random>500,1000,1100)
triggerall = var(50) = 1 && stateno =111 
trigger1 = p2statetype = S && p2bodydist x > 60&& time>11

[State -1, 111]; en sit
type = ChangeState
value =   ifelse(random>500,1400,1300)
triggerall = var(50) = 1 && stateno =111
trigger1 = p2statetype = C && p2bodydist x > 20 && time>12
trigger2 =  time>15

[State -1, spear];scorpion_girl
type = ChangeState
value = 1000
trigger1 = command = "sp1"
triggerall = statetype = S
triggerall = ctrl||(stateno = [200,201])||(stateno = [220,221])||stateno = 229
triggerall = numhelper(1010) = 0 && enemy,var(21) < 5+(movehit = [1,2])
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel
trigger2 = p2statetype != C && p2statetype != L && p2stateno != [120,159]
trigger2 = (p2bodydist x > 90&&!inguarddist)||(movehit&&p2statetype = A)||enemy,numexplod(1188) > 0||enemy,moveguarded > 3
trigger2 = p2statetype = S || p2movetype = H || enemy,numexplod(1188) > 0
trigger2 = random%21 < AILevel&&var(50) = 1&&p2stateno != 1000&&(p2stateno != [220,221])&&(p2stateno != [5100,5120])
trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 120)
trigger2 = time > 14-2*AILevel && prevstateno != 1000
trigger2 = var(51) > 0
trigger2 = (enemy,statetype != A && ctrl) || AILevel > 2+random%3
ignorehitpause = 1

[State -1,teleport]; scorpion_girl
type = ChangeState
value = 1100
triggerall = statetype != L
triggerall = var(16) < 2
triggerall = ctrl = 1||(stateno = [10,13])||(stateno = [200,201])||(stateno = [220,221])||(stateno = [600,621])
trigger1 = command = "sp2"
;triggerall = NumExplod(12000) = 0
triggerall = roundstate = 2
triggerall = numexplod(1992) = 0
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel
trigger2 = (p2bodydist x > 60&&inguarddist)||(p2bodydist x > 50&&p2stateno = [200,240])||p2stateno = 1000
trigger2 = (p2bodydist x > 30&&inguarddist)||p2movetype != A
trigger2 = statetype != A || stateno = 621 || abs(p2dist y) < 20
trigger2 = random%12 < AILevel 
trigger2 = var(50) = 1 && p2stateno != 5120
trigger2 = p2life > 1 || (p2stateno = 9010 && enemy,time > 60)
trigger2 = time > 14-2*AILevel
trigger2 = (statetype != A && ctrl) || AILevel > 2+random%3

[State -1,flip];scorpion_girl
type = ChangeState
value = 1200
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,podsek];scorpion_girl
type = ChangeState
value = 1300
trigger1 = command = "sp4"
triggerall = statetype = S ||  statetype = A
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 = var(50) = 1 && p2dist x > 60 && p2bodydist x < 250 && p2statetype != A && random%14 < AILevel 
trigger2 = (p2stateno != [220,226]) && (p2stateno != [120,159])
trigger2 = (p2stateno = [107,241])||(p2bodydist x > 60&&(p2stateno = [5100,5119]))||enemy,numexplod(1188) > 0
trigger2 = (enemy,numexplod(118) = 0 && p2statetype != L && ctrl) || AILevel > 2+random%3
trigger2 = time > 14-2*AILevel && p2life > 1

[State -1,hellfire];scorpion_girl
type = ChangeState
value = 1400
trigger1 = command = "sp5"
triggerall = statetype = S ||  statetype = C
triggerall = ctrl = 1
triggerall = var(16) < 2
triggerall = roundstate = 2
trigger1 = command != "run"
trigger1 = var(50) = 0 || random%6 > AILevel
trigger2 = p2bodydist x > 90&&inguarddist = 0&&p2stateno != 5120&&p2stateno != 40
trigger2 = p2statetype != A && p2stateno != 5120 && prevstateno != 2002
trigger2 = var(50) = 1 && random%30 < AILevel && (statetype != A || time > 21)
trigger2 = p2life > 1 && var(51) > 0
trigger2 = time > 7-AILevel


[State -1, its-a-trap]
type = selfState
value = 1500
triggerall = statetype = S
triggerall = ctrl = 1 
trigger1 = command = "sp6" && var(50) = 0
triggerall = roundstate = 2
trigger1 = command != "run"
trigger2 = var(50) = 1
trigger2 = numexplod(8877665544)=0
trigger2 = p2statetype != C&&p2statetype != L&&inguarddist = 0&&p2stateno != 12001
trigger2= (p2movetype != H&&p2bodydist x > 120)||(p2movetype = H&&abs(p2dist y) > 30&&p2bodydist x > 30)||(enemy,moveguarded)
trigger2 = p2stateno != 5120 && var(50) = 1 && random%12 < AILevel
trigger2 = p2life > 1
trigger2 = p2bodydist x < 160


[State -1, airthrowAIR]
type = selfState
value = 1700
triggerall = statetype = A
triggerall = ctrl = 1 || stateno=[600,621]
trigger1 = command = "sp6" && var(50) = 0
triggerall = roundstate = 2
trigger1 = command != "run"
trigger2 = var(50) = 1
trigger2 = random%14 < AILevel||(random%7 < AILevel && vel x = 0)
trigger2 = time > 14-AILevel && AILevel > 1+random%3
trigger2 = enemy,authorname != "boss"
trigger2 = (p2bodydist X = [-20,65])
 trigger2 = p2statetype = A

[State -1];????
type = ChangeState
value = 240 - 200*(AILevel < random%5)
triggerall =  fvar(10) = 1 
triggerall = statetype = S
triggerall = ctrl = 1
triggerall = p2statetype = A && p2movetype = H && p2bodydist x < 60
trigger1 = prevstateno = 1202 || numexplod(12000) > 0 || enemy,gethitvar(yvel) < -10
triggerall = roundstate = 2
triggerall = var(50) = 1 && random%8 < AILevel


;--------
[State -1];????
type = ChangeState
value = 220 + 90*(random%6 > AILevel)
triggerall = statetype = S
triggerall = ctrl = 1
trigger1 = p2stateno = 32 && prevstateno = 35
triggerall = roundstate = 2
triggerall = var(50) = 1 && random%12 < AILevel

[State -1];????
type = ChangeState
value = 107 + (p2bodydist x < 3)*ifelse(p2statetype = A, 323, 1894)
triggerall = statetype = S
triggerall = ctrl = 1
trigger1 = p2stateno = 1303
triggerall = roundstate = 2
triggerall = var(50) = 1 && random%8 < AILevel
triggerall = var(47) > 10 
triggerall = stateno != 107 && enemy,numhelper(7003) = 0 && inguarddist = 0

[State -1];????
type = ChangeState
value = 24 + 96*(p2movetype = A)
triggerall = statetype = S || statetype = C
triggerall = ctrl = 1
trigger1 = prevstateno = 1401 && facing != enemy,facing && p2bodydist x < 3
triggerall = roundstate = 2
triggerall = var(50) = 1 && random%8 < AILevel

[State -1];????
type = ChangeState
value = 20
triggerall = stateno = 40 && time < 2
trigger1 = p2statetype = A && p2movetype = H && numhelper(1700) > 0
triggerall = roundstate = 2
triggerall = var(50) = 1 && random%8 < AILevel
ctrl = 1


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

[State -1];???
type = ChangeState
value = 200 +20*(p2bodydist x > 18 ||abs(p2dist y) < 18)
triggerall =   fvar(10) = 3 
triggerall = var(50) = 1 && p2life > 2
trigger1 = ctrl = 1
triggerall = statetype = S
triggerall = p2stateno != 5120
triggerall = roundstate = 2
triggerall = abs(p2dist y) > 3 && abs(p2dist y) < 90 && p2bodydist x < 40 && random%6 < AILevel
triggerall = p2statetype = A && p2movetype = H

;[State -1];????
;type = ChangeState
;value = 2100;2001
;trigger1 = stateno = 40 && time < 2
;trigger2 = statetype = S && ctrl = 1
;triggerall = p2stateno = 1603 && p2bodydist x < 6
;triggerall = roundstate = 2
;triggerall = var(50) = 1 && random%8 < AILevel

;-------

[State -1];????
type = ChangeState
value = 225 - 5*(p2bodydist x < 40)
triggerall = statetype = S
triggerall = ctrl = 1
triggerall = roundstate = 2
triggerall = p2stateno = 252 && p2bodydist x < 90
trigger1 = var(50) = 1 && random%8 < AILevel

[State -1];?????
type = ChangeState
value = 107 + (p2bodydist x < 3)*ifelse(p2statetype = A, (323-190*(random%2)), (1894+100*(p2statetype = C)))
triggerall = statetype = S
trigger1 = p2statetype != L
triggerall = ctrl = 1
trigger1 = p2stateno = 12001
triggerall = roundstate = 2
triggerall = var(50) = 1 && random%6 < AILevel
triggerall = var(47) > 10 
triggerall = stateno != 107 && enemy,numhelper(7003) = 0 && inguarddist = 0



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

[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

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

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

[State -1,fatal]
type = ChangeState
value = 3200
triggerall = p2bodydist X =[50,200]
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%40 < AILevel

[State -1,fatal]
type = ChangeState
value = 3100
triggerall = p2bodydist X <140
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%30 < AILevel

[State -1,fatal]
type = ChangeState
value = 3000
triggerall = p2bodydist X <150
trigger1 = command = "fatal3"
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%30 < AILevel

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

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


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

;----------------------------
;[State -1,animal]
;type = ChangeState
;value = 3800
;triggerall = p2bodydist X = [30,310]
;trigger1 = command = "animality"
;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,animal]
type = ChangeState
value = 3050
triggerall = p2bodydist X <15
trigger1 = command = "doa"
triggerall = p2stateno = 9010
triggerall = statetype = S
triggerall = ctrl = 1
trigger1 = var(50) = 0
trigger2 = enemy,time > 60
trigger2 = var(50) = 1 && random%28 < AILevel


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

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

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



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

[State -1, 90932]
type = selfState
value = 24
triggerall = p2bodydist X <= 1
triggerall = command = "a"
trigger1 = ctrl = 1
triggerall = p2statetype = S || p2statetype = C || p2stateno = 5120
triggerall = statetype = S 
triggerall = p2name != "shao kahn"
triggerall = p2name != "kintaro"
triggerall = p2name != "goro"
triggerall = p2name != "motaro"
triggerall = enemy,numexplod(24) = 0

;-----------------------------------------;
;	- KOMBOS -	;
;-----------------------------------------;
;K O M B O
[State -1, knee]
type = ChangeState
value = 2001
anim = 2030
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 


[State -1, elbow]
type = ChangeState
value = 2001
anim = 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

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

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

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

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

[State -1, MKUppercut]
type = ChangeState
value = 430
triggerall = command = "x"
triggerall = command = "holddown"
trigger1 = statetype = C
trigger1 = ctrl = 1; && stateno != 10
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 && 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 && stateno != 180
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
triggerall = statetype = S
triggerall = ctrl && prevstateno != 1101 && enemy,prevstateno != 1102
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
triggerall = roundstate = 2
triggerall = enemy,numexplod(24) = 0
triggerall = random%14 < AILevel
triggerall = p2statetype = S || p2statetype = C || p2stateno = 5120
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 = time > 3-AILevel

[State -1, sweepdfs]
type = ChangeState
value = 245
triggerall = Var(50) = 1
triggerall = ctrl = 1
triggerall = random%21 < AILevel
triggerall = statetype = S
triggerall = p2dist x > 60 && p2bodydist X <= 60
triggerall = roundstate = 2
triggerall = p2stateno != 245
trigger1 = p2stateno = 11 
trigger2 = p2stateno = 240
trigger3 = p2stateno = 420
trigger4 = p2stateno = 410
trigger5 = p2stateno = 20
trigger6 = p2stateno = 107
trigger7 = p2stateno = 210
trigger8 = p2stateno = 225
trigger9 = p2stateno = 130
trigger10 = p2stateno = [200,221]
trigger11 = p2stateno = 430
triggerall = time > 3-AILevel

[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


[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

[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

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

[State -1, uuppercut hk]
type = ChangeState
value = 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 = 430 - 190*(statetype != C&& random%2 = 0)
triggerall = ctrl = 1
triggerall = roundstate = 2
triggerall = Var(50) = 1 && p2stateno != 32
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 > 3-AILevel

[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

[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

[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%7 > 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 = 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

[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 = [5000,5001])||p2movetype != A||backedgebodydist < 6
triggerall = statetype = S && p2statetype = S
triggerall = p2bodydist X <= 34
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
triggerall = time > 3-AILevel

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

