;----------------------------------------------------------------------------------------------------
;Stand
[StateDef 10000]
type = S
physics = S
movetype = I
ctrl = 0

[State 10000]
type = PosSet
trigger1 = Pos Y != 0
ignorehitpause = 1
y = 0

[State 10000]
type = Turn
trigger1 = P2Dist X < 0
trigger1 = NumHelper(10400) = 0
ignorehitpause = 1
value = 1

;----------------------------------------------------------------------------------------------------
;Walk
[StateDef 10020]
type = S
physics = N
movetype = I
ctrl = 0

[State 10020]
type = PosSet
trigger1 = Time >= 0
ignorehitpause = 1
y = 0

[State 10020]
type = VelSet
trigger1 = !Var(59)
ignorehitpause = 1
x = IfElse(Command = "holdfwd", 2+Var(58)*2, IfElse(Command = "holdback", -1.6-Var(58)*2, Vel X))
y = 0

[State 10020]
type = VelSet
trigger1 = Var(59)
trigger1 = NumHelper(10400) = 0
ignorehitpause = 1
x = IfElse((P2Dist X>=250)||((P2StateType = C)&&(P2Dist X<=60)), 2+Var(58)*2, IfElse(P2Dist X<=100, -1.6-Var(58)*2, Vel X))
y = 0

[State 10020]
type = VelSet
trigger1 = Var(59)
trigger1 = NumHelper(10400) = 1
ignorehitpause = 1
x = -1.6-Var(58)*2
y = 0

[State 10020]
type = EnvShake
trigger1 = Helper(90000), Pos Y = [-5,0]
time = 12
ampl = 12
freq = 60

[State 10020]
type = PlaySnd
trigger1 = Helper(90000), Pos Y = [-5,0]
value = 1010,0
channel = 3

[State 10020]
type = ChangeState
triggerall = Helper(90000), Pos Y = [-5,5]
trigger1 = !Var(59)
trigger1 = Command != "holdfwd"
trigger1 = Command != "holdback"
trigger2 = Var(59)
trigger2 = Helper(10400), StateNo != 10500
trigger2 = P2StateType != C
trigger2 = P2Dist X = (100,250)
trigger3 = Var(59)
trigger3 = Helper(10400), StateNo != 10500
trigger3 = (BackEdgeDist < 100)||(FrontEdgeDist <= 10)
trigger4 = Var(59)
trigger4 = Helper(10400), StateNo != 10500
trigger4 = P2StateType = C
trigger4 = (P2Dist X > 60)||(P2Dist X< 0)
trigger5 = Var(59)
trigger5 = NumHelper(10400) = 1
trigger5 = Helper(10400), StateNo = 10500
trigger5 = (P2Dist X >= 120) || (BackEdgeDist < 100)
ignorehitpause = 1
value = 10000
ctrl = 0

;----------------------------------------------------------------------------------------------------
;GetHit
[StateDef 15000]
type = S
physics = S
movetype = H
ctrl = 0

[State 15000]
type = PosSet
trigger1 = Pos Y != 0
ignorehitpause = 1
y = 0

[State 15000]
type = VarAdd
trigger1 = Time = 0 
ignorehitpause = 1
var(1) = 12

[State 15000]
type = NotHitBy
trigger1 = Time >= 0
ignorehitpause = 1
value = SCA

[State 15000]
type = ChangeState
trigger1 = Time >= 1
ignorehitpause = 1
value = Var(0)

;----------------------------------------------------------------------------------------------------
;Face
[StateDef 90000]
type = S
physics = N
movetype = I
anim = 10000
ctrl = 0

[State 10000]
type = AssertSpecial
trigger1 = Parent, StateNo = [190,194]
trigger2 = Parent, StateNo = [180,184]
flag = invisible

[State 10000]
type = Turn
trigger1 = Facing != Parent, Facing
ignorehitpause = 1
value = 1

[State 90000]
type = NotHitBy
trigger1 = 1
value  SCA

[State 90000]
type = SprPriority
trigger1 = 1
value = -110

[State 90000]
type = BindToParent
trigger1 = Parent, StateNo != 10020
pos = 0,-Parent, Pos Y

[State 90000]
type = BindToParent
trigger1 = Parent, StateNo = 10020
pos = 0,-abs(sin(Parent, Time*Pi/60.0))*25.0

[State 90000]
type = ChangeAnim
triggerall = (Parent, StateNo != 0) || (Parent, Life > 0 )
trigger1 = (Parent, StateNo = 10000) || (Parent, StateNo = 0)
trigger1 = Anim != 10000 
trigger1 = Anim != 10200
trigger1 = Anim != 10203
trigger2 = Anim = 10203
trigger2 = AnimTime = 0
value = 10000

;Fire Start
[State 90000]
type = ChangeAnim
triggerall = RoundState = 2
triggerall = Parent, Power >= 1000
triggerall = Anim != 10200
triggerall = Anim != [10300,10301]
triggerall = (Parent,Var(58)) || (Parent,NumHelper(10400)=0)
triggerall = (Parent,Var(58)) || (Parent,StateNo!=10600)
triggerall = (Parent,Var(58)) || (Parent,StateNo!=10300)
trigger1 = Parent, Command = "holda"
trigger2 = Var(59)
trigger2 = P2Dist X >= 60
value = 10200

;Fire End
[State 90000]
type = ChangeAnim
triggerall = Anim = 10200
triggerall = AnimElem = 1,>=26
trigger1 = !Var(59)
trigger1 = Parent, Command != "holda"
trigger2 = Parent, Power < 100
value = 10203

;Shout Start
[State 90000]
type = ChangeAnim
trigger1 = Parent, StateNo = 10300
trigger1 = Anim != 10300
trigger1 = Anim != 10301
value = 10300

;Shout End
[State 90000]
type = ChangeAnim
trigger1 = Anim = 10300
trigger1 = AnimTime = 0
value = 10301

;Die
[State 90000]
type = ChangeAnim
trigger1 = MatchOver
trigger1 = Parent, StateNo = 5150
trigger1 = Parent, Life = 0
trigger1 = Anim != 5150
value = 5150

