[Statedef 1000]   ;Sai shot
type    = S
movetype= A
physics = S
juggle  = 2
velset = 0,0
anim = 1003
ctrl = 0
sprpriority = 0

[State 0, Helper]
type = Helper
trigger1 = animelem = 8
helpertype = normal ;player
stateno = 1301
ID = 1001
pos = 100*const(size.xscale),-100*const(size.yscale)
ownpal = 1

[State 1000, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

[Statedef 1301]   ;sai itself
type    = S
movetype= A
physics = N
juggle  = 2
velset = 0,0
anim = 1004
ctrl = 0
sprpriority = 2

[State 1000, 7]
type = velset
trigger1 = time > 3
x = 11

[State 0, Explod]
type = Explod
trigger1 = time > 3 && time%2 = 0
anim = 1007
bindtime = -1
sprpriority = 1
removetime = 2
ownpal = 1
shadow = -1,-1,-1

[State 1000, 7]
type = playsnd
trigger1 = Time = 0
value = 4,20
volumescale = 120 

[State 1200, BoltFat]
type = hitdef
trigger1 = !movecontact
attr = S, NP
damage    = 160, 20
animtype = Light
air.animtype = Back
projremove = 1
guardflag = HL
pausetime = 0,0
sparkno = -1
guard.sparkno = -1
hitsound   = s20,18
guardsound = 5,14
ground.type = High
ground.slidetime = 20
ground.hittime  = 15
ground.velocity = -4,0
air.velocity = -4,-5
yaccel = 0.5
guard.dist = 120
air.fall = 1
fall.recover = 0
air.juggle = 3
kill       = (root,Var(9) = 0)
fall.kill  = (root,Var(9) = 0)
guard.kill = (root,Var(9) = 0)
ground.cornerpush.veloff = 0
p2stateno = 21238
p2facing = 1

[State 181, DIED]
type = Explod
trigger1 = time%3 = 2
anim = 1223
sprpriority = -2
pos = -20,0
facing = 1-2*(random%2)
vfacing = 1-2*(random%2)
scale = 0.3*const(size.xscale),0.5*const(size.yscale)
ownpal = 1
bindtime = 1

[State 1000, 7]
type = changeState
trigger1 = movecontact
value = 1302
ignorehitpause = 1

[State 1000, 7]
type = destroyself
trigger1 = frontedgedist < -160

[Statedef 1302]   ;sai hits
type    = S
movetype= A
physics = N
juggle  = 2
velset = 0,0
anim = 1005
ctrl = 0
sprpriority = 3

[State sound]
type = PlaySnd
trigger1 = time = 0
value = 4,21
volumescale = 200
channel = 1

[State 1000, 7]
type = targetvelset
trigger1 = target,stateno = 21239
x = -4
ignorehitpause = 1

[State 1000, 7]
type = posadd
trigger1 = time = 0
x = 10

[State 1000, 7]
type = destroyself
trigger1 = animtime = 0


;--

[Statedef 1303]   ;sai flies back
type    = S
movetype= A
physics = N
juggle  = 2
velset = 0,0
anim = 1006
ctrl = 0
sprpriority = 2

[State 1000, 7]
type = turn
trigger1 = anim = 1006 && animtime = 0

[State 1000, 7]
type = changeanim
trigger1 = anim = 1006 && animtime = 0
value = 1004
elem = 2

[State 1000, 7]
type = posadd
trigger1 = anim = 1004
x = 20
persistent = 0

[State 181, DIED]
type = Explod
trigger1 = anim = 1004 && time%3 = 2
anim = 1223
sprpriority = -2
pos = -20,0
facing = 1-2*(random%2)
vfacing = 1-2*(random%2)
scale = 0.3*const(size.xscale),0.5*const(size.yscale)
ownpal = 1
bindtime = 1

[State 1000, 7]
type = velset
trigger1 = anim = 1004
x = 11

[State 0, Explod]
type = Explod
trigger1 = anim = 1004 && time%2 = 0
anim = 1007
bindtime = -1
sprpriority = 1
removetime = 2
ownpal = 1
shadow = -1,-1,-1

[State 1200, BoltFat]
type = hitdef
trigger1 = !movecontact && time > 6
attr = S, HP
affectteam = F
damage    = 160, 20
animtype = Light
air.animtype = Back
projremove = 1
guardflag = HL
pausetime = 0,0
sparkno = -1
guard.sparkno = -1
hitsound   = s20,18
guardsound = 5,14
ground.type = High
ground.slidetime = 20
ground.hittime  = 15
ground.velocity = -15,0
air.velocity = -4,-5
yaccel = 0.5
guard.dist = 120
air.fall = 1
fall.recover = 0
air.juggle = 3
kill       = (enemy,Var(9) = 0)
fall.kill  = (enemy,Var(9) = 0)
guard.kill = (enemy,Var(9) = 0)
p2stateno = 21238
ground.cornerpush.veloff = 0
p2facing = 1

[State 1000, 7]
type = changeState
trigger1 = movecontact
value = 1302
ignorehitpause = 1

[State 1000, 7]
type = destroyself
trigger1 = frontedgedist < -160


;---------

[Statedef 1310]   ;sai aerial 
type    = A
movetype= A
physics = N
juggle  = 2
velset = 0,0
anim = 1011
ctrl = 0
sprpriority = 0

[State 0, Helper]
type = Helper
trigger1 = animelem = 3
helpertype = normal ;player
stateno = 1301
ID = 1001
pos = 47*const(size.xscale),-105*const(size.yscale)
ownpal = 1

[State 1000, 7]
type = veladd
trigger1 = animelemtime(3) = 16
y = 1.5

[State 1000, 7]
type = veladd
trigger1 = animelemtime(3) > 16
y = 0.5

[State 1000, 7]
type = selfState
trigger1 = pos y > var(57) && vel y > 0
value = 52

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

[Statedef 1400]; roll sweep
type    = C
movetype= A
physics = N
juggle  = 1
anim = 1300
Velset = 0, 0
ctrl = 0

[State 2000, 2]
type = Veladd
trigger1 = time = 3
x = 10

[State 2000, 2]
type = Velset
trigger1 = anim = 5120
trigger2 = anim = 1302 && animelemtime(4) > 0
x = 0

[State 2000, 0.5]
type = Playsnd
trigger1 = time = 0
value = 4,17
channel = 0

[State 2000, 0.5]
type = Playsnd
trigger1 = time = 6
value = 4,16
volumescale = 60

[State 1050, 4]
type = HitDef
trigger1 = !movecontact
attr = C, ST
damage    = 160,30
animtype  = back
air.animtype  = Back
hitflag = MAFD
guardflag = L
priority = 7
pausetime = 0, 2
sparkno = -1
guard.sparkno = -1
sparkxy = 18,-60
hitsound   = 5,1
guardsound = 5,14
ground.type = High
ground.slidetime = 12
ground.hittime  = 12
guard.velocity = 0
ground.velocity = 3.5,-8
air.velocity = 3.5,-8
yaccel = 0.375
guard.slidetime = 10              ;Values for guarded attack (def: ground.slidetime)
guard.ctrltime = 5               ;Time to regain control after guard (def: guard.slidetime)
guard.dist = 140
kill       = (Var(9) = 0)
fall.kill  = (Var(9) = 0)
guard.kill = (Var(9) = 0)
p2stateno = 1410

[State 181, DIED]
type = playerpush
trigger1 = 1
value = 0


[State 181, DIED]
type = Explod
trigger1 = movehit
anim = 888
ID = 12000
removetime = 300-140*(numexplod(12000) = 1)
removeongethit = 1
ignorehitpause = 1
persistent = 0

[State 1040, 0.erf7]
type = targetvelset
trigger1 = moveguarded
x = 0
ignorehitpause = 1

[State 1040, 0.erf7]
type = selfstate
trigger1 = moveguarded
value = 1401
ignorehitpause = 1

[State 181, DIED]
type = statetypeset
trigger1 = p2dist x < 0
movetype = I

[State 181, DIED]
type = changeanim
trigger1 = movehit
value = 1302
ignorehitpause = 1
persistent = 0

[State 181, DIED]
type = changeanim
triggerall = animtime = 0
trigger1 = !movecontact && time > 30
value = 5120
elem = 5
persistent = 0

[State 1050, 7]
type = selfstate
trigger1 = anim = 5120 && animtime = 0
trigger2 = anim = 1302 && animtime = 0
value = 0
ctrl = 1


[Statedef 1401]     ;roll guarded
type    = A
movetype= I
physics = N
anim = 1301
velset = -0.625, -11
ctrl = 0

[State 181, DIED]
type = playerpush
trigger1 = time < 3
value = 0

[State 1050, 7]
type = posadd
trigger1 = time = 0
x = 10

[State 1050, 7]
type = veladd
trigger1 = time > 0
y = 0.375

[State 2000, 0.5]
type = Playsnd
trigger1 = time = 0
value = 5,12

[State 1050, 7]
type = selfstate
trigger1 = pos y > var(57) -6 && vel y > 0
value = 52


[Statedef 1410]     ;hit by roll
type    = U
movetype= H
physics = N
sprpriority = 1
ctrl = 0

[State 10000, open]
type = playsnd
trigger1 = time = 3
value = 3,11
channel = 3

[State 10000, open]
type = posadd
trigger1 = time = 0
trigger1 = statetype = A || statetype = L
y = -20

[State 10000, open]
type = selfstate
trigger1 = time = 0
trigger1 = statetype = A || statetype = L
value = 21240

[State 10000, open]
type = statetypeset
trigger1 = time = 0
value = A

[State 10000, open]
type = hitvelset
trigger1 = time = 0 
x = 1
y = 1

[State 0, throw-up]
type = Explod
trigger1 = numexplod(118) = 0
anim = 888
ID = 118
removetime = -1
removeongethit = 0
ignorehitpause = 1

[state 0, throw up protection]
type = defencemulset
trigger1 = 1
value = 0.5

[state 0, p]
type = playerpush
trigger1 = 1
value = 0

[State 10000, open]
type = selfstate
trigger1 = name = "goro"
trigger2 = name = "motaro"
trigger3 = name = "kintaro"
trigger4 = name = "shao kahn"
value = 5050

[State 10000, open]
type = changeanim2
trigger1 = time = 0
value = 5070

[State 1000, 7]
type = veladd
trigger1 = time > 0
y = 0.375

[State 1000, 7]
type = selfstate
trigger1 = pos y > var(57) && vel y > 0
value = 5110

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

[Statedef 1420]; teleport
type    = A
movetype= I
physics = N
juggle  = 1
anim = 1310
velset = 0, 5
ctrl = 0

[State 2000, 0.5]
type = Playsnd
trigger1 = time = 0
value = 4,18
volumescale = 200
channel = 0

[State 181, DIED]
type = Explod
trigger1 = time = 4
anim = anim
scale = const(size.xscale),const(size.yscale)
removetime = 30
bindtime = 1
pos = 0,-15
ownpal = 0
removeongethit = 1
ignorehitpause = 1
persistent = 0

[State 2000, 2]
type = posadd
trigger1 = time = 0
y = -60

[State 2000, 2]
type = Veladd
trigger1 = time > 0
y = 0.375

[State 2000, 0.5]
type = Playsnd
trigger1 = time = 0
value = 20,999
volumescale = 60

[State 2000, 0.5]
type = selfstate
trigger1 = pos y >= var(57)
value = 1421

[Statedef 1421]; kick
type    = A
movetype= A
physics = N
juggle  = 1
anim = 1311
Velset = 0, 4
ctrl = 0

[State 2000, 0.5]
type = Playsnd
trigger1 = time = 0
value = 5,13

[State 2000, 2]
type = Veladd
trigger1 = time > 0 && !movecontact
y = 0.375

[State 181, DIED]
type = posadd
trigger1 = time = 0
x = p2dist x -80
y = -240

[State 1050, 4]
type = HitDef
trigger1 = !movecontact
attr = A, NA
damage    = 240,30
animtype  = back
air.animtype  = Back
hitflag = MAF
guardflag = HL
priority = 7
pausetime = 0, 2
sparkno = -1
guard.sparkno = -1
sparkxy = 18,-60
hitsound   = 5,0
guardsound = 5,14
ground.type = High
ground.slidetime = 12
ground.hittime  = 12
guard.velocity = 0
ground.velocity = -3.5,-6
air.velocity = -3.5,-6
yaccel = 0.5
guard.slidetime = 10              ;Values for guarded attack (def: ground.slidetime)
guard.ctrltime = 5               ;Time to regain control after guard (def: guard.slidetime)
guard.dist = 80
kill       = (Var(9) = 0)
fall.kill  = (Var(9) = 0)
guard.kill = (Var(9) = 0)
p2stateno = 21238

[State 2000, 0.5]
type = helper
trigger1 = movehit
stateno = 30
persistent = 0
ignorehitpause = 1

[State 181, DIED]
type = Explod
trigger1 = movehit
anim = 888
ID = 12000
removetime = 60
removeongethit = 1
ignorehitpause = 1
persistent = 0

[State 1040, 0.erf7]
type = changeanim
trigger1 = movecontact > 12
trigger2 = pos y > var(57) -60
value = 620
elem = 4
persistent = 0

[State 1040, 0.erf7]
type = velset
trigger1 = movecontact
x = 0
y = 0
persistent = 0

[State 1040, 0.erf7]
type = veladd
trigger1 = movecontact
x = -1
y = -5-(moveguarded)
persistent = 0

[State 1040, 0.erf7]
type = posset
trigger1 = movecontact
y = -80 - var(57)
persistent = 0

[State 1040, 0.erf7]
type = veladd
trigger1 = movecontact
y = ifelse(movehit > 0, 0.625, 0.3125)

[State 181, DIED]
type = statetypeset
trigger1 = moveguarded
movetype = I

[State 1050, 7]
type = selfstate
trigger1 = pos y > var(57) && vel y > 0
value = 52

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

[StateDef 1999]
type    = U
movetype= H
physics = N
ctrl = 0

[State 1000, BounceOff]
type = selfState
trigger1 = prevstateno != 1999
value = 1999



[State 1000, sai]
type = selfState
trigger1 = anim = 1004
value = 1303

[State 1000, BounceOff]
type = destroyself
trigger1 = ishelper && root,stateno >= 0

[State 1000, BounceOff]
type = selfState
trigger1 = time = 30 || animtime = 0
value = 0
ctrl = 1

;--

[Statedef 2111];fake jump
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 40, jumpup]
type = PlaySnd
trigger1 = time = 2 && numexplod(7082) = 0
value = 3, 9
channel = 3

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
x = const(velocity.jump.fwd.x)
y = const(velocity.jump.y)

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;--
[StateDef 2112]; fake walk
type    = S
movetype= I
physics = N
ctrl = 0
anim = 20
velset = 3.25,0

[State -1]
type = selfState
value = 220
trigger1 = var(50) = 1 && p2life > 2
triggerall = roundstate = 2
triggerall = p2bodydist x < 40 && p2stateno != 1410 && random%12 < AILevel
triggerall = numexplod(1300) = 0


[State -1]
type = selfState
value = 240
trigger1 = var(50) = 1 && p2life > 2
triggerall = roundstate = 2
triggerall = p2bodydist x < 30 && frontedgedist < 90 && random%12 < AILevel


[State -1]
type = selfState
value = 210
trigger1 = var(50) = 1 && p2life > 2
triggerall = roundstate = 2
triggerall = p2bodydist x < 85 && random%12 < AILevel

[State -1]
type = selfState
value = 225
trigger1 = var(50) = 1 && p2life > 2
triggerall = roundstate = 2
triggerall = p2bodydist x < 105 && random%12 < AILevel

[State -1]
type = selfState
value = 20
trigger1 = var(50) != 1
trigger2 = roundstate != 2
trigger3 = time = 40
trigger4 = p2statetype != A || p2movetype != H
ctrl = 1