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

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

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

[Statedef 1801]   ;kunai itself
type    = S
movetype= A
physics = N
juggle  = 2
velset = 0,0
anim = 1241 + random%3
ctrl = 0
sprpriority = 1

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

[State 0, Explod]
type = Explod
trigger1 = time = 1
anim = 1241 + random%3
ID = 1001
pos = -10,-6
vfacing = 1-2*(random%2)
bindtime = -1
scale = const(size.xscale),const(size.yscale)
sprpriority = 1
ownpal = 1
removetime = -1
random = 6,6

[State 0, Explod]
type = Explod
trigger1 = time = 2
anim = 1241 + random%3
ID = 1001
pos = -20,6
vfacing = 1-2*(random%2)
bindtime = -1
scale = const(size.xscale),const(size.yscale)
sprpriority = 1
ownpal = 1
removetime = -1
random = 6,6

[State 1000, 7]
type = playsnd
trigger1 = Time = 0
value = 20,43

[State 1200, BoltFat]
type = hitdef
trigger1 = !movecontact
attr = S, NP
damage    = 90, 30
animtype = Light
air.animtype = Back
projremove = 1
guardflag = HL
pausetime = 0,0
sparkno = -1
guard.sparkno = -1
hitsound   = -1
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 = 110
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)
p2stateno = 21238
p2facing = 1
ground.cornerpush.veloff = 0

[State 0, Explod]
type = Explod
trigger1 = movecontact
anim = 1245+(moveguarded > 0)
pos = 10,0
facing = 1-2*(random%2)
vfacing = 1-2*(random%2)
bindtime = 9
scale = 0.4,0.7
sprpriority = 3
ownpal = 1
ignorehitpause = 1

[State 1000, 7]
type = changeState
trigger1 = movehit
value = 1802
ignorehitpause = 1

[State 1000, 7]
type = changeState
trigger1 = moveguarded
value = 1803
ignorehitpause = 1

[State 1000, 7]
type = removeexplod
trigger1 = frontedgedist < -180
ID = 1001

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

[Statedef 1802]   ;kunai hits
type    = S
movetype= A
physics = N
juggle  = 2
velset = 1,0
anim = 888
ctrl = 0
sprpriority = -2

[State 1000, 7]
type = removeexplod
trigger1 = 1
ID = 1001

[State sound]
type = PlaySnd
trigger1 = time = 0 || time = 6 || time = 12
value = 20,18 - (random%3 = 0)
volumescale = 200

[State 0, Explod]
type = Explod
trigger1 = time = 1
anim = 1244
pos = -10-10*(target,stateno != [21238,21239]),-96+30*(target,stateno != [21238,21239])
postype = p2
facing = -1
bindtime = -1
scale = const(size.xscale),const(size.yscale)
sprpriority = -2
ownpal = 1
ignorehitpause = 1

[State 1000, 7]
type = helper
trigger1 = time = 0 || time = 6 || time = 12
pos = 20,0
stateno = 7400

[State 1000, 7]
type = posset
trigger1 = time = 0
y = target,pos y - 106

[State 1000, 7]
type = targetbind
trigger1 = time > 0 && time < 12
pos = 0,106


[State 1000, 7]
type = screenbound
trigger1 = 1
value = 1
movecamera = 0,0

[State 1000, 7]
type = destroyself
trigger1 = time = 90

[Statedef 1803]   ;kunai guarded
type    = S
movetype= A
physics = N
juggle  = 2
velset = 0,0
ctrl = 0
anim = 888

[State 1000, 7]
type = playsnd
trigger1 = Time = 0
value = 20,44
volumescale = 60

[State 1000, 7]
type = removeexplod
trigger1 = 1
ID = 1001

[State 1000, 7]
type = destroyself
trigger1 = time = 60

[Statedef 1804]   ;kunai flies back
type    = S
movetype= A
physics = N
juggle  = 2
velset = 0,0
anim = 1241 + random%3
ctrl = 0
sprpriority = 1


[State 0, Explod]
type = Explod
trigger1 = time = 0
anim = 1245
pos = 10,0
facing = 1-2*(random%2)
vfacing = 1-2*(random%2)
bindtime = 1
scale = 0.4,0.7
sprpriority = -2
ownpal = 1
ignorehitpause = 1

[State 1000, 7]
type = turn
trigger1 = time = 0

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

[State 1000, 7]
type = removeexplod
trigger1 = time = 0
ID = 1001

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

[State 0, Explod]
type = Explod
trigger1 = time = 1
anim = 1241 + random%3
ID = 1001
pos = -10,-6
vfacing = 1-2*(random%2)
bindtime = -1
scale = const(size.xscale),const(size.yscale)
sprpriority = 1
ownpal = 1
removetime = -1
random = 6,6

[State 0, Explod]
type = Explod
trigger1 = time = 2
anim = 1241 + random%3
ID = 1001
pos = -20,6
vfacing = 1-2*(random%2)
bindtime = -1
scale = const(size.xscale),const(size.yscale)
sprpriority = 1
ownpal = 1
removetime = -1
random = 6,6

[State 1200, BoltFat]
type = hitdef
trigger1 = !movecontact && time > 3
attr = S, HP
damage    = 90, 30
affectteam = F
animtype = Light
air.animtype = Back
projremove = 1
guardflag = HL
pausetime = 0,0
sparkno = -1
guard.sparkno = -1
hitsound   = -1
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 = 110
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
p2facing = 1
ground.cornerpush.veloff = 0


[State 0, Explod]
type = Explod
trigger1 = movecontact
anim = 1245+(moveguarded > 0)
pos = 10,0
facing = 1-2*(random%2)
vfacing = 1-2*(random%2)
bindtime = 9
scale = 0.4,0.7
sprpriority = 3
ownpal = 1
ignorehitpause = 1

[State 1000, 7]
type = changeState
trigger1 = movehit
value = 1805
ignorehitpause = 1

[State 1000, 7]
type = changeState
trigger1 = moveguarded
value = 1803
ignorehitpause = 1

[State 1000, 7]
type = removeexplod
trigger1 = frontedgedist < -180
ID = 1001

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

[Statedef 1805]   ;kunai hits p1
type    = S
movetype= A
physics = N
juggle  = 2
velset = 1,0
anim = 888
ctrl = 0
sprpriority = -2

[State 1000, 7]
type = removeexplod
trigger1 = 1
ID = 1001

[State sound]
type = PlaySnd
trigger1 = time = 0 || time = 6 || time = 12
value = 20,18 - (random%3 = 0)
volumescale = 200

[State 7100, lluvia de sangre]
type = Explod
trigger1 = time = 0 || time = 6 || time = 12
anim = F7214
pos = 20,0
bindtime = 1
facing = 1
postype = p1
sprpriority = 4

[State 0, Explod]
type = Explod
trigger1 = time = 1
anim = 1244
pos = 20,10
postype = p1
bindtime = -1
scale = const(size.xscale),const(size.yscale)
sprpriority = -2
ownpal = 1
ignorehitpause = 1


[State 1000, 7]
type = posset
trigger1 = time = 0
y = target,pos y - 106

[State 1000, 7]
type = targetbind
trigger1 = time > 0 && time < 12
pos = 0,106

[State 1000, 7]
type = posset
trigger1 = time > 12
x = target,pos x
y = target,pos y - 106

[State 1000, 7]
type = screenbound
trigger1 = 1
value = 1
movecamera = 0,0

[State 1000, 7]
type = destroyself
trigger1 = time = 30



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

[Statedef 1810]; red dash
type    = S
movetype= I
physics = N
juggle  = 1
anim = 1247
Velset = 8, 0
sprpriority = 2
ctrl = 0

[State 10000, open]
type = PlaySnd
trigger1 = time = 0
value = 20,45
volumescale = 66

[State 181, DIED]
type = explod
trigger1 = time = 0
anim = 888
ID = 1800
removeongethit = 1
removetime = 72+30*(numexplod(1800) = 0)

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

[State 181, DIED]
type = nothitby
trigger1 = time < 16 && p2stateno != 245 && p2stateno != 400
value = SCA
time = 1

[State 181, DIED]
type = explod
trigger1 = time = 0
anim = anim
pos = -16,0
scale = const(size.xscale),const(size.yscale)
bindtime = -1
removetime = 16
ID = 616
removeongethit = 1
trans = add
alpha = 200,60

[State 181, DIED]
type = explod
trigger1 = time = 0
anim = anim
pos = -32,0
scale = const(size.xscale),const(size.yscale)
bindtime = -1
removetime = 16
ID = 616
removeongethit = 1
trans = add
alpha = 150,120

[State 181, DIED]
type = explod
trigger1 = time = 0
anim = anim
pos = -48,0
scale = const(size.xscale),const(size.yscale)
bindtime = -1
removetime = 16
ID = 616
removeongethit = 1
trans = add
alpha = 100,180

[State 181, DIED]
type = explod
trigger1 = time = 0
anim = anim
pos = -64,0
scale = const(size.xscale),const(size.yscale)
bindtime = -1
removetime = 16
ID = 616
removeongethit = 1
trans = add
alpha = 50,240


[State 1050, 7]
type = palfx
trigger1 = numexplod(1991) = 0
add = 60,-120,-120
sinadd = -60,120,120,48
color = 60
time = 12
ignorehitpause = 1

[State 1050, 7]
type= null;turn
trigger1 = time = 16 && p2dist x < -25

[State 181, DIED]
type = nothitby
trigger1 = p2stateno != 245 && p2stateno != 400 && time = 16
value = SCA
time = 9

[State 1050, 7]
type= selfstate
trigger1 = time = 16
value = 0
ctrl = 1

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


[StateDef 1820]; upper-cut
type    = A
movetype= A
physics = N
juggle  = 4
ctrl = 0
anim = 1350

[State 1000, Bounf]
type = veladd
trigger1 = animelem = 6
x = 5
y = -2

[State 1000, Bounf]
type = velset
trigger1 = animelem = 8
x = 7
y = -11

[State 1000, Bounf]
type = veladd
trigger1 = animelemno(0) = [6,7]
y = -0.75

[State 1000, Bounf]
type = veladd
trigger1 = animelemno(0) = 8
y = 0.675

[State 1000, Bounf]
type = velset
trigger1 = animelemno(0) = 9
y = 0
x = 0

[State 1000, bber]
type = PlaySnd
trigger1 = time = 0
value = 4, 18
volumescale = 80
channel = 0

[State 1000, bber]
type = PlaySnd
trigger1 = animelem = 6
value = 20, 46
volumescale = 200

[State 1000, 10]
type = HitDef
trigger1 = !movecontact
attr = S, SA
animtype  = back
damage    = 160, 30
guardflag = HL
hitflag = HAF
pausetime = 1,1
sparkno = -1
guard.sparkno = -1
hitsound   = 5,0
guardsound = 5,14 
ground.type = High
ground.slidetime = 12
ground.hittime  = 12
ground.velocity = -4,-8
air.velocity = -4,-8
air.hittime = 12
yaccel = 0.375
fall = 1
fall.recover = 0
kill       = (Var(9) = 0)
fall.kill  = (Var(9) = 0)
guard.kill = (Var(9) = 0)

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

[State 1000, BounceOff]
type = selfState
trigger1 = Time = 22
value = 1821


[StateDef 1821]
type    = A
movetype= I
physics = N
juggle  = 4
ctrl = 0

[State 1000, Bounf]
type = veladd
trigger1 = time > 0
y = 0.75

[State 1000, BounceOff]
type = selfState
trigger1 = pos y > var(57)
value = 52

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

[Statedef 1830] ;Blood ball
type    = S
movetype= I
physics = S
juggle  = 2
velset = 0,0
anim = 1120
sprpriority = 0
ctrl = 0

[State 10000, open]
type = PlaySnd
trigger1 = time = 0 
value = 20,47
volumescale = 200
channel = 0

[State 10000, open]
type = statetypeset
trigger1 = time = 16
movetype = A

[State 0, Explod]
type = Explod
trigger1 = animelem = 2
anim = 1121
pos = 49, -67
bindtime = -1
scale = const(size.xscale), const(size.yscale)
sprpriority = 2
ownpal = 1
removeongethit = 1
persistent = 0


[State 0, Explod]
type = null;Explod
trigger1 = animelem = 2
anim = 1121
bindtime = -1
scale = const(size.xscale), const(size.yscale)
sprpriority = 1
ownpal = 1
removeongethit = 1
persistent = 0

[State 0, Explod]
type = palfx
trigger1 = time = 0 && numexplod(1991) = 0
sinadd = 120,-90,-90,80
time = 32

[State 9251, net]
type = lifeset
trigger1 = animelem = 2
value = ifelse(life > 201, (life - 200), 2)

[State 9251, net]
type = Helper
trigger1 = animelem = 4 && life > 2
ID = 1001
postype = p1
pos = 49,-67
stateno = 1831
ownpal = 1
size.xscale = 0.8
size.yscale = 0.8


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


[Statedef 1831]     ;blood ball itself
type    = A
movetype= A
physics = N
juggle  = 2
velset = 0,0
anim = 1122
sprpriority = 1
ctrl = 0

[State 1000, 7]
type = angledraw
trigger1 = 1
scale = 1.2-0.2*(random%4),1

[State 0, Explod]
type = Explod
trigger1 = gametime%2 = 0
anim = 1123
bindtime = -1
scale = 0.76, 0.76
sprpriority = -1
ownpal = 1
removeongethit = 1
removetime = 2

[State 1000, 7]
type = velset
trigger1 = time > 0
x = 4

[State 10000, open]
type = PlaySnd
trigger1 = time%90 = 0 
value = 20,48
channel = 3

[State 800, 1]
type = HitDef
Trigger1 = !movecontact && p2stateno != 9010
damage = 420, 70
pausetime = 0,2
attr = S, NP          ;Attributes: Standing, Normal Throw
hitflag = MAF          ;Affect only ground people who are not being hit
guardflag = HL
priority = 7, hit    ;
hitsound = 5,21
guardsound = 5,14
sparkno = -1          ;No spark
p2facing = 1       ;Force p2 to face KFM
p2stateno = 1840
guard.dist = 70        ;This prevents p2 from going into a guard state if close
ground.hittime = 30
ground.slidetime = 12
ground.velocity = 3.5,-8
air.velocity = 3.5,-8
yaccel = 0.375
fall = 1
kill       = (root,Var(9) = 0)
fall.kill  = (root,Var(9) = 0)
guard.kill = (root,Var(9) = 0)

[State 1000, 7]
type = Changestate
trigger1 = movecontact
value = 1832
persistent = 0

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

[Statedef 1832]     ;blood ball hits
type    = S
movetype= A
physics = N
juggle  = 2
velset = 0,0
anim = 888
ctrl = 0

[State 10000, open]
type = PlaySnd
trigger1 = time = 3 
value = 20,49
channel = 3
volumescale = 200

[State 10000, open]
type = envshake
trigger1 = time = 0 
time = 22
freq = 90
ampl = 5

[State 1000, 7]
type = targetvelset
trigger1 = target,stateno = [150,159]
x = -2

[State 10000, open]
type = helper
trigger1 = time < 7
stateno = 1834
facing = 1-2*(time%2 = 0)

[State 0, Explod]
type = Explod
trigger1 = 1
anim = 1124
bindtime = 1
scale = 0.67, 0.67
sprpriority = 3
facing = 1-2*(random%2)
vfacing = 1-2*(random%2)
random = 50,60
ownpal = 1

[State 1000, 7]
type = destroyself
trigger1 = time = 11

[Statedef 1833]     ;blood ball flies back
type    = A
movetype= A
physics = N
juggle  = 2
velset = 0,0
sprpriority = 1
ctrl = 0

[State 10000, open]
type = PlaySnd
trigger1 = time%90 = 0 
value = 20,48
channel = 3

[State 1000, 7]
type = turn
trigger1 = time = 0

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

[State 1000, 7]
type = angledraw
trigger1 = 1
scale = 1.2-0.2*(random%4),1

[State 0, Explod]
type = Explod
trigger1 = gametime%2 = 0
anim = 1123
bindtime = -1
scale = 0.76, 0.76
sprpriority = -1
ownpal = 1
removeongethit = 1
removetime = 2

[State 1000, 7]
type = velset
trigger1 = time > 0
x = 4

[State 10000, open]
type = PlaySnd
trigger1 = time = 0 
value = 20,49
channel = 3
volumescale = 200

[State 800, 1]
type = HitDef
Trigger1 = !movecontact && time > 3
damage = 420, 70
affectteam = F
pausetime = 0,2
attr = S, HP          ;Attributes: Standing, Normal Throw
hitflag = MAF          ;Affect only ground people who are not being hit
guardflag = HL
priority = 7, hit    ;
hitsound = 5,21
guardsound = 5,14
sparkno = -1          ;No spark
p2facing = 1       ;Force p2 to face KFM
p2stateno = 1840
guard.dist = 70        ;This prevents p2 from going into a guard state if close
ground.hittime = 30
ground.slidetime = 12
ground.velocity = 3.5,-8
air.velocity = 3.5,-8
yaccel = 0.375
fall = 1
kill       = (enemy,Var(9) = 0)
fall.kill  = (enemy,Var(9) = 0)
guard.kill = (enemy,Var(9) = 0)

[State 1000, 7]
type = Changestate
trigger1 = movecontact
value = 1832
persistent = 0

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


[Statedef 1834]     ;blood flies
type    = S
movetype= I
physics = N
juggle  = 2
velset = 0,0
anim = 1125
sprpriority = 2
ctrl = 0

[State 10000, open]
type = changeanim
trigger1 = time = 0 
value = anim
elem = 1+random%4

[State 10000, open]
type = veladd
trigger1 = time = 0
x = -0.3-0.1*(random%21)
y = -7-0.3*(random%21)

[State 0, Explod]
type = veladd
trigger1 = time > 0
y = 0.5

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

[Statedef 1835]     ;blood lands
type    = S
movetype= A
physics = N
juggle  = 2
velset = 0,0
anim = 1126
sprpriority = -2
ctrl = 0

[State 430, 1]
type = PlaySnd
trigger1 = Time = 0 && random%3 > 0
value = F5, 190+random%3
volumescale = 40


[State 10000, open]
type = Posset
trigger1 = time = 0
y = root,var(57) + (random%4-random%4)

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











[Statedef 1840]     ;hit by ball
type    = A
movetype= H
physics = N
sprpriority = 1
ctrl = 0

[State 10000, open]
type = playsnd
trigger1 = time = 0 
value = 3,0 + 2 *(random%2)
channel = 3

[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 1999]
type    = U
movetype= H
physics = N
ctrl = 0

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



[State 1000, dagger]
type = selfState
trigger1 = anim = [1241,1243]
value = 1804

[State 1000, blood ball]
type = selfState
trigger1 = anim = 1122
value = 1833


[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