; Vega's Claw states
;---------------------------------------------------------------------------
; Claw
[Statedef 20000]
movetype = I
ctrl = 0

[State 20000, X Velocity Set]
type = VarSet
trigger1 = Root, Var(11) < 10
v = 10
value = 0

[State 20000, Random X Velocity]
type = VarRandom
trigger1 = Root, Var(11) >= 10
v = 10
range = -2,2

[State 20000, VarAdd]
type = VarAdd
trigger1 = Var(10) = 0
v = 10
value = 1

[State 20000, Y Velocity Set]
type = VarSet
trigger1 = Root, Var(11) < 10
v = 11
value = 0

[State 20000, Random Y Velocity]
type = VarRandom
trigger1 = Root, Var(11) >= 10
v = 11
range = -2,-6

[State 20000, Pause]
type = Pause
trigger1 = Root, StateNo = 900
trigger1 = Root, Anim = 905
trigger1 = Root, AnimElem = 4
movetime = 25
time = 25

[State 20000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 20000, BindToRoot]
type = BindToRoot
trigger1 = 1
facing = 1
pos = 0,0
time = 1

[State 20000, ChangeState]
type = ChangeState
trigger1 = Root, MoveType = H
trigger1 = Root, var(11) >= 20
value = 29000

[State 20000, DestroySelf]
type = null ;DestroySelf
trigger1 = Root, MoveType = H
trigger1 = Root, var(11) >= 20

[State 20000, SprPriority]
type = SprPriority
trigger1 = Root, MoveType != H
value = 3

[State 20000, SprPriority]
type = SprPriority
trigger1 = Root, MoveType = H
value = 2

[State 20000, SprPriority]
type = SprPriority
triggerall = Var(40) = 0
trigger1 = Root, StateNo >= 1100
trigger1 = Root, StateNo < 1110
value = -5

[State 20000, Invisible]
type = AssertSpecial
triggerall = Root, MoveType != H
trigger1 = Root, Anim >= 260
trigger1 = Root, Anim <= 270
trigger2 = Root, Anim > 280
trigger2 = Root, Anim < 290
trigger3 = Root, Anim > 314
trigger3 = Root, Anim < 316
trigger4 = Root, Anim > 700
trigger4 = Root, Anim < 710
trigger5 = Root, Anim > 802
trigger5 = Root, Anim < 804
trigger6 = Root, Anim > 810
trigger6 = Root, Anim < 900
trigger7 = Root, Anim > 1060
trigger7 = Root, Anim < 1065
trigger8 = Root, Anim > 3100
trigger8 = Root, Anim < 3105
trigger9 = Root, Anim > 4000
trigger9 = Root, Anim < 5000
trigger10 = Root, Anim > 5400
flag = invisible

[State 20000, Invisible]
type = AssertSpecial
triggerall = Root, MoveType = H
trigger1 = Root, Anim > 200
trigger1 = Root, Anim < 5000
trigger2 = Root, Anim > 5240
trigger2 = Root, Anim < 5300
trigger3 = Root, Anim > 5400
trigger3 = Root, Anim < 7600
trigger4 = Root, Anim > 7700
trigger4 = Root, Anim < 9990
trigger5 = Root, Anim > 10000
flag = invisible

[State 20000, VarSet]
type = VarSet
trigger1 = AnimTime = 0
trigger2 = Anim != 20000
v = 0
value = 0

[State 20000, VarAdd]
type = VarAdd
trigger1 = Anim = 20000
trigger1 = AnimElem = 4
v = 0
value = 1

[State 20000, Stand]
type = ChangeAnim
triggerall = Var(0) < 4
triggerall = Root, Anim = 0
trigger1 = Anim != 20000
trigger2 = Root, AnimElem = 1
trigger3 = Root, AnimElem = 2
trigger4 = Root, AnimElem = 3
trigger5 = Root, AnimElem = 4
trigger6 = Root, AnimTime = 0
value = 20000
elem = root, animelemno(0)

[State 20000, Stand]
type = ChangeAnim
triggerall = Root, Anim = 0
triggerall = Anim = 20000
trigger1 = var(0) < 4
trigger1 = AnimElem = 5
value = 20000
elem = 1

[State 20000, Crouch]
type = ChangeAnim
trigger1 = Root, Anim = 11
trigger1 = Anim != 20011
value = 20011

[State 20000, Regenerate]
type = ChangeAnim
trigger1 = Root, Anim = 194
trigger1 = Anim != 20194
value = 20194

[State 20000, Anim]
type = ChangeAnim
triggerall = Root, Anim != 0
triggerall = Root, Anim != 11
triggerall = Root, Anim != 194
triggerall = Root, MoveType != H
trigger1 = Root, Anim >= 0
trigger1 = Root, Anim < 260
trigger2 = Root, Anim >= 290
trigger2 = Root, Anim <= 314
trigger3 = Root, Anim >= 316
trigger3 = Root, Anim <= 700
trigger4 = Root, Anim >= 800
trigger4 = Root, Anim <= 802
trigger5 = Root, Anim >= 804
trigger5 = Root, Anim <= 1060
trigger6 = Root, Anim >= 1065
trigger6 = Root, Anim <= 3100
trigger7 = Root, Anim >= 3105
trigger7 = Root, Anim <= 4000
trigger8 = Root, Anim >= 5000
trigger8 = Root, Anim <= 5400
value = root, Anim + 20000
elem = root, animelemno(0)

[State 20000, Anim]
type = ChangeAnim
triggerall = Root, Anim != 0
triggerall = Root, Anim != 11
triggerall = Root, Anim != 194
triggerall = Root, MoveType = H
trigger1 = Root, Anim >= 0
trigger1 = Root, Anim <= 200
trigger2 = Root, Anim >= 5000
trigger2 = Root, Anim < 5250
trigger3 = Root, Anim >= 5300
trigger3 = Root, Anim <= 5400
trigger4 = Root, Anim >= 7600
trigger4 = Root, Anim < 8500
trigger5 = Root, Anim > 8500
trigger5 = Root, Anim < 8510
trigger6 = Root, Anim > 8510
trigger6 = Root, Anim < 9000
trigger7 = Root, Anim = 9999
value = root, Anim + 20000
elem = root, animelemno(0)

[State 20000, Guard Sound]
type = PlaySnd
triggerall = Root, Time <= 1
;triggerall = !Root, HitShakeOver
trigger1 = Root, StateNo = 150
trigger2 = Root, StateNo = 152
trigger3 = Root, StateNo = 154
value = 2, 10

[State 20000, Swoosh 1 Sound]
type = PlaySnd
triggerall = Root, HitPauseTime = 0
trigger1 = Root, Anim = 195
trigger1 = Root, AnimElem = 4
trigger2 = Root, Anim = 200
trigger2 = Root, AnimElem = 2
trigger3 = Root, Anim = 400
trigger3 = Root, AnimElem = 2
trigger4 = Root, Anim = 1110
trigger4 = Root, AnimElem = 1,2
trigger5 = Root, Anim = 1120
trigger5 = Root, AnimElem = 2
value = 1, 4
channel = 1

[State 20000, Swoosh 2 Sound]
type = PlaySnd
triggerall = Root, HitPauseTime = 0
trigger1 = Root, Anim = 210
trigger1 = Root, AnimElem = 3
trigger2 = Root, Anim = 410
trigger2 = Root, AnimElem = 2
trigger3 = Root, Anim = 610
trigger3 = Root, AnimElem = 2
value = 1, 5
channel = 1

[State 20000, Swoosh 3 Sound]
type = PlaySnd
triggerall = Root, HitPauseTime = 0
trigger1 = Root, Anim = 220
trigger1 = Root, AnimElem = 3
trigger2 = Root, Anim = 420
trigger2 = Root, AnimElem = 2
trigger3 = Root, Anim = 620
trigger3 = Root, AnimElem = 2
trigger4 = Root, Anim = 900
trigger4 = Root, AnimElem = 3
trigger5 = Root, Anim = 901
trigger5 = Root, AnimElem = 3
trigger6 = Root, Anim = 902
trigger6 = Root, AnimElem = 3
trigger7 = Root, Anim = 990
trigger7 = Root, AnimElem = 2
trigger8 = Root, Anim = 990
trigger8 = Root, AnimElem = 7
trigger9 = Root, Anim = 990
trigger9 = Root, AnimElem = 10
value = 1, 6
channel = 1

[State 20000, Claw Sound]
type = PlaySnd
trigger1 = Root, Anim = 194
trigger1 = Root, AnimElem = 6
value = 2, 10
channel = 1

[State 20000, Claw]
type = Helper
triggerall = Time > 5
trigger1 = Root, Anim = 194
trigger1 = Root, AnimElem = 1
helpertype = normal
name = "Claw"
id = 20
facing = 1
pos = 0,0
postype = P1
stateno = 28000
keyctrl = 0

;---------------------------------------------------------------------------
; Claw Flying
[Statedef 28000]
movetype = I
sprpriority = 0
anim = 29000
velset = -2,-4
ctrl = 0

[State 28000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 28000, Width]
type = Width
trigger1 = 1
value = -10,-10

[State 28000, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = 5, 0

[State 28000, BindToRoot]
type = BindToRoot
trigger1 = Time <= 0
facing = 1
pos = 0,-90
time = 1

[State 28000, 2]
type = VelAdd
trigger1 = 1
y = .25

[State 28000, 3]
type = ChangeState
trigger1 = Time > 10
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 28001

;---------------------------------------------------------------------------
; Claw Bounce
[Statedef 28001]
movetype = I
sprpriority = 0
velset = -2,-2
ctrl = 0

[State 28000, PosSet]
type = PosSet
trigger1 = Time = 0
y = 0

[State 28000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 28000, Width]
type = Width
trigger1 = 1
value = -10,-10

[State 28000, 2]
type = VelAdd
trigger1 = 1
y = .2

[State 28000, 3]
type = AssertSpecial
trigger1 = TimeMod = 3,0
flag = invisible

[State 28000, DestroySelf]
type = DestroySelf
trigger1 = Time > 10
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0

;---------------------------------------------------------------------------
; Claw Flying
[Statedef 29000]
movetype = I
sprpriority = 0
anim = 29000
velset = Var(10),Var(11)
ctrl = 0

[State 29000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 29000, Width]
type = Width
trigger1 = 1
value = -10,-10

[State 29000, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = 5, 0

[State 29000, BindToRoot]
type = BindToRoot
trigger1 = Time <= 0
trigger1 = Root, StateType = S
facing = 1
pos = 0,-80
time = 1

[State 29000, BindToRoot]
type = BindToRoot
trigger1 = Time <= 0
trigger1 = Root, StateType = C
facing = 1
pos = 0,-50
time = 1

[State 29000, BindToRoot]
type = BindToRoot
trigger1 = Time <= 0
trigger1 = Root, StateType = A
facing = 1
pos = 0,-90
time = 1

[State 29000, Claw off]
type = ParentVarSet
trigger1 = 1
ignorhitpause = 1
v = 2
value = 1

[State 29000, Claw Hit Reset]
type = ParentVarSet
trigger1 = 1
ignorehitpause = 1
v = 11
value = 0

[State 29000, 2]
type = VelAdd
trigger1 = 1
y = .25

[State 29000, ChangeState]
type = ChangeState 
trigger1 = Root, Anim = 194
value = 20000

[State 29000, 3]
type = ChangeState
trigger1 = Time > 10
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 29001

;---------------------------------------------------------------------------
; Claw Bounce
[Statedef 29001]
movetype = I
sprpriority = 0
velset = var(10),-3
ctrl = 0

[State 29000, PosSet]
type = PosSet
trigger1 = Time = 0
y = 0

[State 29000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 29000, Width]
type = Width
trigger1 = 1
value = -10,-10

[State 29000, 2]
type = VelAdd
trigger1 = 1
y = .2

[State 29000, ChangeState]
type = ChangeState 
trigger1 = Root, Anim = 194
value = 20000

[State 29000, 3]
type = ChangeState
trigger1 = Time > 10
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 29010

;---------------------------------------------------------------------------
; Claw Idle
[Statedef 29010]
movetype = I
sprpriority = -4
velset = 0,0
ctrl = 0

[State 20000, Idle 1]
type = ChangeAnim
triggerall = Anim = 29000
trigger1 = AnimElem = 3, > 0
value = 29010

[State 20000, Idle 2]
type = ChangeAnim
triggerall = Anim = 29000
trigger1 = AnimElem = 3, < 5
value = 29020

[State 29010, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 29010, Width]
type = Width
trigger1 = 1
value = -10,-10

[State 29010, PosSet]
type = PosSet
trigger1 = Time = 0
y = 0

[State 29010, ParentVarSet]
type = ParentVarSet
triggerall = Root, MoveType != H
triggerall = Root, StateType != L
triggerall = Root, MoveType = I
trigger1 = RootDist X = [-30, 30]
trigger1 = RootDist Y = 0
v = 2
value = 0

[State 29010, PlaySnd]
type = PlaySnd
triggerall = Root, Var(2) = 0
trigger1 = RootDist X = [-30, 30]
trigger1 = RootDist Y = 0
value = 2, 10
freqmul = 1.5
channel = 5

[State 29010, ChangeState]
type = ChangeState 
trigger1 = Root, Anim = 194
value = 20000

[State 29010, ChangeState]
type = ChangeState
triggerall = Root, Var(2) = 0
trigger1 = RootDist X = [-30, 30]
trigger1 = RootDist Y = 0
value = 20000

[State 29010, DestroySelf]
type = null ;DestroySelf
triggerall = Root, Var(2) = 0
trigger1 = RootDist X = [-30, 30]
trigger1 = RootDist Y = 0

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