;---------------------------------------------------------------------------
; Downed get-hit (lying down)
[Statedef 15110]
type    = L
movetype= H
physics = N

[State 15110, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 15110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

[State 15110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [15110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170

[State 15110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [15110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5171)
value = 5171

[State 15110, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 15110, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 15110, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 15110, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > Const720p(20)) + (sysvar(1) > Const720p(56))

;[State 15110, 7]
;type = Null
;trigger1 = Time = 0
;trigger1 = !SysVar(0)
;anim = F(60 + (sysvar(1) > Const720p(20)) + (sysvar(1) > Const720p(56)))
;pos = 0, 0
;sprpriority = ifelse (sysvar(1) <= Const720p(56), -10, 10)

[State 15110, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 15110, 9] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = anim = [5171,5179]
triggerall = SelfAnimExist(5111)
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5111

[State 15110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 15110, 11] ;If just died
type = ChangeState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [15110,5119]
value = 5150

[State 15110, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 15110, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 15110, 14] ;Friction
type = VelSet
trigger1 = abs(Vel x) < Const(movement.down.friction.threshold)
persistent = 0
x = 0

[State 15110, 15]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 15110, 16]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine

[State 15110, ChangeState]
type = ChangeState
trigger1 = Time = 30
value = 5120
ctrl = 0
;---------------------------------------------------------------------------
; One-Two Puncher (1)
[Statedef 50202]
type    = S
movetype= H
physics = N
velset = 0,0

[State 50202, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(groundtype) = 1),5000+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000),5010+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000)) + GetHitVar(animtype)

[State 50202, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000)

[State 50202, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 50202, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 50202, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 50202, 7]
type = ChangeState
trigger1 = HitShakeOver
value = stateno + 1

[State 50202, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 50202, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 50202, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140
;---------------------------------------------------------------------------
; One-Two Puncher (2)
[Statedef 50203]
type    = L
movetype= H
physics = N

[State 50203, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

[State 50203, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 50203, PlaySnd]
type = PlaySnd
trigger1 = Time = 1
value = F7, 1 ;Hit ground

[State 50203, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
sysvar(1) = floor(vel y)

[State 50203, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = !SelfAnimExist(5100+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000) + (anim % 10))
value = 5100+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000)

[State 50203, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = SelfAnimExist(5100+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000) + (anim % 10))
value = 5100+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000) + (anim % 10)

[State 50203, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 50203, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 50203, 6] ;Reduce speed
type = VelMul
trigger1 = Time = 0
x = 0.75

[State 50203, 7]
type = SelfState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;HIT_LIEDOWN

[State 50203, 9]
type = HitFallDamage
trigger1 = Time = 3

[State 50203, 11]
type = PosFreeze
trigger1 = 1

[State 50203, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = stateno + 1;5101

[State 50203, 13]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20
;---------------------------------------------------------------------------
; One-Two Puncher (3)
[Statedef 50204]
type    = L
movetype= H
physics = N

[State 50204, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger1 = anim != [105101,105109]
trigger2 = !SelfAnimExist(5160+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000) + (anim % 10))
value = 5160+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000)

[State 50204, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 50204, 3] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [105101,105109]
trigger1 = SelfAnimExist(5160+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000) + (anim % 10))
value = 5160+((Name = "Gill" && AuthorName = "GM" && Facing = -1)*100000) + (anim % 10)

[State 50204, VelSet]
type = VelSet
trigger1 = time = 0
y = -4.5

[State 50204, 4]
type = PosSet
trigger1 = Time = 0
y = 20

[State 50204,, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .4

[State 50204,, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = SelfState
value = 5110
;---------------------------------------------------------------------------
; Opponent Grabbed
[Statedef 50801]
type    = A
movetype= H
physics = N
velset = 0,0
poweradd = 0

[State 50801, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 0,0

[State 50801, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 50801
;---------------------------------------------------------------------------
; Opponent Thrown
[Statedef 50802]
type    = A
movetype= H
physics = N
velset = -4.5,-7.5
poweradd = 0

[State 50802, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 1,1

[State 50802, HitFallSet]
type = HitFallSet
trigger1 = 1
value = 1

[State 50802, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 50802

[State 50802, 1] ;Gravity
type = VelAdd
Trigger1 = 1
y = .5

[State 50802, end] ;Hit ground
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;Hit ground
;---------------------------------------------------------------------------
[StateDef 51008]
type = A
movetype = H
physics = N
ctrl = 0
sprpriority = 2
velset = 0,0

[State 51008, HitFallSet]
type = HitFallSet
trigger1 = !Time
value = 1

[State 51008, ChangeAnim2]
type = ChangeAnim2
trigger1 = !Time
value = 51008
elem = 1

[State 51008, VelSet]
type = VelSet
trigger1 = HitShakeOver = 1
x = -4.5
y = -7.5
persistent = 0

[State 51008, VelAdd]
type = VelAdd
trigger1 = HitShakeOver = 1
trigger1 = Time > 4
y = 0.45

[State 51008, ChangeState]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Vel Y >= -Pos Y
value = 51009

;----------------------------------------------------------------------------
[StateDef 51009]
type = L
movetype = H
physics = N
ctrl = 0
sprpriority = 2
velset = Vel X,0

[State 51009, ChangeAnim2]
type = ChangeAnim2
trigger1 = !Time
value = 51009
elem = 1

[State 51009, PosSet]
type = PosSet
trigger1 = !Time
y = 0
persistent = 0

[State 51009, VelAdd]
type = VelMul
trigger1 = 1
x = 0.9

[State 51009, SelfState]
type = SelfState
trigger1 = AnimTime = 0
value = IfElse(Alive, 5120, 5150)
;---------------------------------------------------------------------------
; Wallbounce (till 51020)
[Statedef 51017]
type = S
movetype= H
physics = N
velset = 0,0

[State 51017, Anim] ;Custom animation
type = ChangeAnim2
trigger1 = 1
value = 51017

[State 51017, State]
type = ChangeState
trigger1 = HitShakeOver = 1
value = 51018

;---------------------------------------------------------------------------
[Statedef 51018]
type    = A
movetype= H
physics = N
velset = -12, -6

[State 51018, Gravity]
type = VelAdd
trigger1 = 1
y = .5

[State 51018, No scroll]
type = ScreenBound
triggerall = Pos y < -15
trigger1 = BackEdgeBodyDist < 65
trigger2 = FrontEdgeBodyDist < 65
value = 1
movecamera = 0,1

[State 51018, Hit wall]
type = ChangeState
triggerall = Pos y < -15
trigger1 = BackEdgeBodyDist <= 20
trigger2 = FrontEdgeBodyDist <= 20
value = 51019

[State 51018, Hit ground]
type = SelfState
trigger1 = (Vel y > 0) && (Pos y >= 0)
value = 5100

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

[Statedef 51019]
type    = A
movetype= H
physics = N

[State 51019, Turn]
type = Turn
trigger1 = (Time = 0) && (FrontEdgeBodyDist <= 30)

[State 51019, Pos]
type = PosAdd
trigger1 = Time = 0
x = 15 - BackEdgeBodyDist

[State 51019, Stop moving]
type = PosFreeze
trigger1 = 1
x = 1
y = 1

[State 51019, No scroll]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 0,1

[State 51019, Spark]
type = Explod
trigger1 = Time = 0
anim = F70
pos = 0, floor (screenpos y) - 50
postype = back
sprpriority = 3

[State 51019, Anim]
type = ChangeAnim2
trigger1 = Time = 0
value = 51019

[State 51019, Sound]
type = PlaySnd
trigger1 = Time = 0
value = F7,0

[State 51019, State]
type = ChangeState
trigger1 = AnimTime = 0
value = 51020

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

[Statedef 51020]
type    = A
movetype= H
physics = N

[State 51020, Vel Y]
type = VelSet
trigger1 = Time = 0
y = -12

[State 51020, Vel X]
type = VelSet
trigger1 = Time = 0
x = 1

[State 51020, Turn]
type = Turn
trigger1 = (Time = 0) && (BackEdgeDist < 30)

[State 51020, Gravity]
type = VelAdd
trigger1 = 1
y = .6

[State 51020, Anim 5050] ;Self falling animation
type = ChangeAnim
trigger1 = Time = 0
trigger1 = !SelfAnimExist(5052)
value = 5050

[State 51020, Anim 5052] ;Self falling animation (diagup type)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5052)
value = 5052

[State 51020, Anim 5060] ;Coming down - normal
type = ChangeAnim
trigger1 = Vel Y > -2
trigger1 = Anim = 5050
trigger1 = SelfAnimExist(5060)
persistent = 0
value = 5060

[State 51020, Anim 5062] ;Coming down - diagup type
type = ChangeAnim
trigger1 = Vel Y > -2
trigger1 = Anim = 5052
trigger1 = SelfAnimExist(5062)
persistent = 0
value = 5062

[State 51020, Hit ground]
type = SelfState
trigger1 = (Vel y > 0) && (Pos y >= 0)
value = 5100

;--------------------------------------------------------------
[Statedef 53000]
type = S
physics = N
movetype = H
ctrl = 0
velset = 0,0

[State 53000, HitBy]
type = HitBy
trigger1 = 1
value = SCA,HA

[State 53000, HitFallSet]
type = HitFallSet
trigger1 = 1
value = 0

[State 53000, PosSet]
type = posset
trigger1 = time = 0
y = 0

[State 53000, 2]
type = Velset
trigger1 = !gethitvar(isbound)
x = 0

[State 53000, ChangeAnim2]
type = ChangeAnim
trigger1 = time = 0
value = 5002

[State 53000, ChangeAnim]
type = ChangeAnim
trigger1 = anim = 5002 && !animtime
value = 5007

[State 53000, SelfState]
type = SelfState
trigger1 = time = 150
value = 0

;--------------------------------------------------------------
[Statedef 53001]
type = S
physics = N
movetype = H
ctrl = 0
velset = 0,0

[State 53001, HitBy]
type = HitBy
trigger1 = 1
value = S,HA

[State 53001, ChangeAnim2]
type = ChangeAnim2
trigger1 = !Time
value = 53001

[State 53001, SelfState]
type = SelfState
trigger1 = time = 150
value = 0

;--------------------------------------------------------------
[Statedef 53002]
type = A
physics = N
movetype = H
ctrl = 0
velset = 0,0

[State 53002, ChangeAnim2]
type = ChangeAnim2
trigger1 = !Time
value = 53002

[State 53002, ChangeAnim2]
type = ChangeAnim2
triggerall = Anim = 53002
trigger1 = HitShakeOver = 1
value = 53003

[State 53002, 1] ;Gravity
type = VelAdd
trigger1 = Pos Y != 0
y = .4

[State 53002, VelSet]
type = VelSet
trigger1 = Anim = 53003
x = -2.5
y = -12.8
persistent = 0

[State 53002, end] ;Hit ground
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;Hit ground

;--------------------------------------------------------------
[Statedef 53012]
type = S
physics = N
movetype = H
ctrl = 0
velset = 0,0

[State 53012, HitBy]
type = HitBy
trigger1 = 1
value = SCA,HA,HP

[State 53012, HitFallSet]
type = HitFallSet
trigger1 = 1
value = 0

[State 53012, PosSet]
type = posset
trigger1 = time = 0
y = 0

[State 53012, 2]
type = Velset
trigger1 = !gethitvar(isbound)
x = 0

[State 53012, ChangeAnim2]
type = ChangeAnim
trigger1 = time = 0
value = 5012

[State 53012, ChangeAnim]
type = ChangeAnim
trigger1 = anim = 5012 && !animtime
value = 5017

[State 53012, SelfState]
type = SelfState
trigger1 = time = 150
value = 0
;---------------------------------------------------------------------------
; Opponent Grabbed
[Statedef 53016]
type = S
movetype= H
physics = N
velset = 0,0
poweradd = 0

[State 53016, HitBy]
type = HitBy
trigger1 = 1
value = SCA,HA

[State 53016, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 53016

;--------------------------------------------------------------
[Statedef 53020]
type = A
physics = N
movetype = H
ctrl = 0
velset = 0,0

[State 53020, ChangeAnim2]
type = ChangeAnim2
trigger1 = !Time
value = 53002

[State 53020, ChangeAnim2]
type = ChangeAnim2
triggerall = Anim = 53002
trigger1 = Time = 15
value = 53003

[State 53020, 1] ;Gravity
type = VelAdd
trigger1 = Pos Y != 0
y = .4

[State 53020, VelSet]
type = VelSet
trigger1 = Anim = 53003
x = -4.5
y = -7.5
persistent = 0

[State 53020, end] ;Hit ground
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;Hit ground
