
;---------------------------------------------------------------------------
; Lose by Time Over
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

[State 170, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
;---------------------------------------------------------------------------
; Win state decider
[Statedef 180]
type = S

[State 180, Victory Quotes(non-specific)]
type=VictoryQuote
trigger1=1
value=random%8

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Andy" || Enemy, Name="Andy Bogard" || Enemy, Name="cvsandy"
value=9

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Athena" || Enemy, Name="Athena Asamiya" || Enemy, Name="cvsathena"
value=11

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Ash" || Enemy, Name="Ash Crimson" 
value=10

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Iori" || Enemy, Name="Iori Yagami" || Enemy, Name="cvsiori"
value=13

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Joe" || Enemy, Name="Joe Higashi" || Enemy, Name="cvsjoe"
value=14

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Kensou" || Enemy, Name="Sie Kensou" 
value=15

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Kim" || Enemy, Name="Kim Kaphwan" || Enemy, Name="cvskim"
value=16

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Kula" || Enemy, Name="Kula Diamond" 
value=17

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Leona" || Enemy, Name="Leona Heidern" 
value=18

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Mature" || Enemy, Name="cvsmature"
value=19

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Maxima" 
value=20

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Raiden" || Enemy, Name="cvsraiden"
value=21

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Robert" || Enemy, Name="Robert Garcia" 
value=22

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Shen" || Enemy, Name="Shen Woo" 
value=23

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Takuma" || Enemy, Name="Takuma Sakazuki" 
value=24

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Terry" || Enemy, Name="Terry Bogard" || Enemy, Name="cvsterry"
value=25

[State 180, Victory Quote vs. Terry Bogard]
type=VictoryQuote
trigger1=Enemy, Name="Yuri" || Enemy, Name="Yuri Sakazuki" || Enemy, Name="cvsyuri"
value=12

[State 180, Perfect]
type = changestate
trigger1 = winperfect
value = 185

[State 180, 1]
type = ChangeState
trigger1 = !Time 
value = 181 + (random%4)

;====================< WIN 1 >====================
[Statedef 181]
type = S
physics = S
anim = 181
ctrl = 0

[State 181,CAMERA]
type = helper
trigger1 = pos X != 0
trigger1 = Time = 0
name = "helper1"
id = 6001
pos = 0,0
postype = p1
stateno = 6001
helpertype = normal
ownpal = 1
keyctrl = 1

[State 181, Assert]
type = assertspecial
trigger1 = time < 300
flag = roundnotover

[State 181, Snd]
type = playsnd
trigger1 = animelem = 14
value = 0, 21
channel = 0

[State 181, Snd]
type = playsnd
trigger1 = animelem = 20
value = 1, 0
channel = 1


;====================< WIN 2 >====================
[Statedef 182]
type = S
physics = S
anim = 182
ctrl = 0

[State 181,CAMERA]
type = helper
trigger1 = pos X != 0
trigger1 = Time = 0
name = "helper1"
id = 6001
pos = 0,0
postype = p1
stateno = 6001
helpertype = normal
ownpal = 1
keyctrl = 1

[State 182, Assert]
type = assertspecial
trigger1 = time < 300
flag = roundnotover

[State 182, Snd]
type = playsnd
trigger1 = animelem = 17
value = 0, 28
channel = 0


;====================< WIN 3 >====================
[Statedef 185]
type = S
physics = S
anim = 183
ctrl = 0

[State 181,CAMERA]
type = helper
trigger1 = pos X != 0
trigger1 = Time = 0
name = "helper1"
id = 6001
pos = 0,0
postype = p1
stateno = 6001
helpertype = normal
ownpal = 1
keyctrl = 1

[State 183, Assert]
type = assertspecial
trigger1 = time < 300
flag = roundnotover

[State 183, Snd]
type = playsnd
trigger1 = animelem = 18
value = 0, 20
channel = 0


;====================< WIN 4 >====================
[Statedef 183]
type = S
physics = S
anim = 184
ctrl = 0

[State 181,CAMERA]
type = helper
trigger1 = pos X != 0
trigger1 = Time = 0
name = "helper1"
id = 6001
pos = 0,0
postype = p1
stateno = 6001
helpertype = normal
ownpal = 1
keyctrl = 1

[State 184, Assert]
type = assertspecial
trigger1 = time < 300
flag = roundnotover

[State 184, Snd]
type = playsnd
trigger1 = animelem = 3
value = 0, 22
channel = 0

[State 181, Snd]
type = playsnd
trigger1 = animelem = 5
value = 1, 0
channel = 1


;====================< WIN 5 >====================
[Statedef 184]
type = S
physics = S
anim = 185
ctrl = 0

[State 181,CAMERA]
type = helper
trigger1 = pos X != 0
trigger1 = Time = 0
name = "helper1"
id = 6001
pos = 0,0
postype = p1
stateno = 6001
helpertype = normal
ownpal = 1
keyctrl = 1

[State 181, Assert]
type = assertspecial
trigger1 = time < 300
flag = roundnotover
;====================< INTRO 1 >====================
[Statedef 191]
type = S
physics = S
anim = 191
[State 191, intro]
type = assertspecial
trigger1 = 1
flag = intro
[State 191, Snd]
type = playsnd
trigger1 = animelem = 8
value = 0, 25
channel = 0
[State 191, Snd]
type = playsnd
trigger1 = animelem = 12
value = 1, 0
channel = 1
[State 191, End]
type = changestate
trigger1 = !animtime
value = 0


;====================< INTRO 2 >====================
[Statedef 192]
type = S
physics = S
anim = 192
[State 192, intro]
type = assertspecial
trigger1 = 1
flag = intro

[State 192, Snd]
type = playsnd
trigger1 = animelem = 7
value = 40, 0
[State 192, Dust]
type = helper
trigger1 = animelem = 7
helpertype = normal
stateno = 8100
ID = 8100
name = "Jump Dust"
postype = p1
ownpal = 1

[State 192, Vel]
type = velset
trigger1 = animelem = 7
y = -6
[State 192, statetype]
type = statetypeset
trigger1 = animelemtime(7) >= 0 && animelemtime(12) < 0
statetype = A
physics = N
[State 192, Accel]
type = veladd
trigger1 = animelemtime(7) >= 0 && animelemtime(12) < 0
y = 0.4

[State 192, End]
type = changeanim
trigger1 = animelemtime(7) >= 0 && animelemtime(12) < 0
trigger1 = vel y > 0 && pos y >= 0
value = 192
elem = 12

[State 192, Vel]
type = velset
trigger1 = animelemtime(12) >= 0
y = 0
[State 192, Pos]
type = posset
trigger1 = animelemtime(12) >= 0
y = 0
[State 192, statetype]
type = statetypeset
trigger1 = animelemtime(12) >= 0
statetype = S
physics = S

[State 192, Snd]
type = playsnd
trigger1 = animelem = 12
value = 0, 3
channel = 0

[State 192, Snd]
type = playsnd
trigger1 = animelem = 12
value = 52, 0
[State 192, Dust]
type = explod
trigger1 = animelem = 12
anim = 8102
sprpriority = -3
postype = p1
scale = 0.5, 0.5
pausemovetime = -1
supermovetime = -1
ownpal = 1

[State 192, End]
type = changestate
trigger1 = !animtime
value = 0


;====================< INTRO 3 >====================
[Statedef 193]
type = S
physics = S
anim = 193
[State 193, intro]
type = assertspecial
trigger1 = 1
flag = intro

[State 193, Snd]
type = playsnd
trigger1 = animelem = 8
value = 0, 30
channel = 0
[State 193, Snd]
type = playsnd
trigger1 = animelem = 12
value = 1, 0
channel = 1

[State 193, End]
type = changestate
trigger1 = !animtime
value = 0


;====================< INTRO 4 >====================
[Statedef 194]
type = S
physics = S
anim = 194
[State 194, intro]
type = assertspecial
trigger1 = 1
flag = intro

[State 194, Snd]
type = playsnd
trigger1 = animelem = 4
value = 0, 2
channel = 0
[State 194, Snd]
type = playsnd
trigger1 = animelem = 8
value = 0, 33
channel = 0

[State 194, Snd]
type = playsnd
trigger1 = animelem = 3
value = 1, 0
channel = 1

[State 194, End]
type = changestate
trigger1 = !animtime
value = 0


;====================< INTRO 5 >====================
[Statedef 195]
type = S
physics = S
anim = 196
[State 196, intro]
type = assertspecial
trigger1 = 1
flag = intro

[State 196, Snd]
type = playsnd
trigger1 = animelem = 10
value = 0, 24
channel = 0

[State 196, Snd]
type = playsnd
trigger1 = animelem = 10 || animelem = 13 || animelem = 16
value = 0, 37
channel = 2

[State 196, End]
type = changestate
trigger1 = !animtime
value = 0


;====================< TURNS INTRO >====================
[Statedef 6900]
type = A
anim = 6900
velset = 0, 0
ctrl = 0
[State 6900, intro]
type = assertspecial
trigger1 = 1
flag = intro

[State 6900, bound]
type = screenbound
trigger1 = 1
value = 0
[State 6900, Camera]
type = helper
trigger1 = !numhelper(8999)
helpertype = normal
stateno = 8999
ID = 8999
name = "Camera"
postype = p1

[State 6900, Pos]
type = posset
trigger1 = !time
x = (-320 + abs(pos x)) * facing

[State 6900, Vel]
type = velset
trigger1 = !time
x = (helper(8999), rootdist x) / -40.0
y = -10.25
[State 6900, Accel]
type = gravity
trigger1 = 1

[State 6900, End]
type = changestate
trigger1 = time && vel y > 0 && pos y >= 0
value = 6901


;--- LAND ---
[Statedef 6901]
type = S
physics = S
anim = 6901
velset = 0, 0
[State 6901, intro]
type = assertspecial
trigger1 = 1
flag = intro

[State 6901, Pos]
type = posset
trigger1 = 1
x = ceil(helper(8999), pos x)

[State 6901, Snd]
type = playsnd
trigger1 = !time
value = 0, 52
[State 6901, Dust]
type = explod
trigger1 = !time
anim = 8102
sprpriority = -3
postype = p1
scale = 0.5, 0.5
pausemovetime = -1
supermovetime = -1
ownpal = 1

[State 6901, End]
type = changestate
trigger1 = !animtime
value = 6902


;====================< TURNS INTRO 1 >====================
[Statedef 6902]
type = S
physics = S
anim = 6902
[State 6902, intro]
type = assertspecial
trigger1 = 1
flag = intro

[State 6900, Snd]
type = playsnd
trigger1 = animelem = 1
value = 6, 6
channel = 0
[State 6902, Snd]
type = playsnd
trigger1 = animelem = 4
value = 1, 0
channel = 1

[State 6902, End]
type = changestate
trigger1 = !animtime
value = 0


;====================< INTRO vs RYO >====================
[Statedef 6910]
type = S
physics = S
anim = 6910
[State 6910, intro]
type = assertspecial
trigger1 = 1
flag = intro

[State 6910, Snd]
type = playsnd
trigger1 = animelem = 2
value = 0, 27
channel = 0
[State 6910, Snd]
type = playsnd
trigger1 = animelem = 16
value = 0, 29
channel = 0

[State 6910, Snd]
type = playsnd
trigger1 = animelem = 9
value = 40, 0
[State 6910, Dust]
type = helper
trigger1 = animelem = 9
helpertype = normal
stateno = 8100
ID = 8100
name = "Jump Dust"
postype = p1
ownpal = 1

[State 6910, Vel]
type = velset
trigger1 = animelem = 9
y = -6
[State 6910, statetype]
type = statetypeset
trigger1 = animelemtime(9) >= 0 && animelemtime(14) < 0
statetype = A
physics = N
[State 6910, Accel]
type = veladd
trigger1 = animelemtime(9) >= 0 && animelemtime(14) < 0
y = 0.4

[State 6910, End]
type = changeanim
trigger1 = animelemtime(9) >= 0 && animelemtime(14) < 0
trigger1 = vel y > 0 && pos y >= 0
value = 6910
elem = 14

[State 6910, Vel]
type = velset
trigger1 = animelemtime(14) >= 0
y = 0
[State 6910, Pos]
type = posset
trigger1 = animelemtime(14) >= 0
y = 0
[State 6910, statetype]
type = statetypeset
trigger1 = animelemtime(14) >= 0
statetype = S
physics = S

[State 6910, Snd]
type = playsnd
trigger1 = animelem = 14
value = 52, 0
[State 6910, Dust]
type = explod
trigger1 = animelem = 14
anim = 8102
sprpriority = -3
postype = p1
scale = 0.5, 0.5
pausemovetime = -1
supermovetime = -1
ownpal = 1

[State 6910, End]
type = changestate
trigger1 = !animtime
value = 0


;====================< INTRO vs SAKURA >====================
[Statedef 6911]
type = S
physics = S
anim = 6911
[State 6911, intro]
type = assertspecial
trigger1 = 1
flag = intro
[State 6911, Snd]
type = playsnd
trigger1 = animelem = 3
value = 0, 26
channel = 0
[State 6911, Snd]
type = playsnd
trigger1 = animelem = 3
value = 1, 0
channel = 1
[State 6911, End]
type = changestate
trigger1 = !animtime
value = 0


;====================< INTRO vs DAN >====================
[Statedef 6912]
type = S
physics = S
anim = 6912
[State 6912, intro]
type = assertspecial
trigger1 = 1
flag = intro
[State 6912, Snd]
type = playsnd
trigger1 = animelem = 3
value = 0, 22
channel = 0
[State 6912, Snd]
type = playsnd
trigger1 = animelem = 5
value = 1, 0
channel = 1
[State 6912, End]
type = changestate
trigger1 = !animtime
value = 0
;-----------------------
; Taunt
[Statedef 196]
type = S
ctrl = 0
anim = 195
velset = 0,0
movetype = I
physics = S
sprpriority = 2

[State 700, SFX]
type = Playsnd
trigger1 = !time
value = 0,24
channel = 0

[State 195, 2]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1
;=========<DODGE>=============
[Statedef 700]
type    = S
movetype= I
physics = S
juggle  = 0
velset = 0,0
ctrl = 0
anim = 710
sprpriority = -1

[State 700, SFX]
type = Playsnd
trigger1 = time = 3
value = 1,3
volume = 255

[State 700, Voice]
type = null;Playsnd
trigger1 = time = 3
value = 0,0
volume = 255
channel = 1

[State 700, PlayerPush]
type = PlayerPush
trigger1 = 1
value = 0

[State 700, HitBy]
type = HitBy
trigger1 = 1
value = SCA,AT
time = 1

[State 700, Attack]
type = ChangeState
trigger1 = Time = [15,25]
trigger1 = command = "x" || command = "y" || command = "z" || command = "a" || command = "b" || command = "c"
value = ifElse((command = "x" || command = "y" || command = "z"), 221, 240)

[State 700, End]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1

;=========<ROLLING>===========
[StateDef 710]
type = S
physics = N
moveType = I
anim = 720
ctrl = 0
velSet = 0,0
sprPriority = 1

[State 710, PlayerPush]
type = PlayerPush
trigger1 = 1
value = 0

[State 710, HitBy]
type = HitBy
trigger1 = 1
value = SCA,AT
time = 1

[State 710, Voice]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0, ifElse(Random < 500, 0, 1)
channel = 0

[State 710, Roll Sound]
type = PlaySnd
trigger1 = Time = 1
value = 110,0
channel = 1

[State 710, Start Roll]
type = VelSet
trigger1 = AnimElem = 1
x = 5

[State 710, End Roll]
type = VelSet
trigger1 = AnimElem = 6
x = 0

[State 710, End]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1

;Roll Back
[StateDef 715]
type = S
physics = N
moveType = I
anim = 725
ctrl = 0
velSet = 0,0
sprPriority = 1

[State 715, PlayerPush]
type = PlayerPush
trigger1 = 1
value = 0

[State 715, HitBy]
type = HitBy
trigger1 = 1
value = SCA,AT
time = 1

[State 715, Voice]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0, ifElse(Random < 500, 0, 1)
channel = 0

[State 715, Roll Sound]
type = PlaySnd
trigger1 = Time = 1
value = 110,0
channel = 1

[State 715, Start Roll]
type = VelSet
trigger1 = AnimElem = 1
x = -5

[State 715, Stop Roll]
type = VelSet
trigger1 = AnimElem = 6
x = 0

[State 715, End]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1

;===========<POWER CHARGE>==================
[StateDef 730]
type = S
physics = S
moveType = I
anim = 730
velSet = 0,0
ctrl = 0

[State 730, PowerAdd]
type = PowerAdd
triggerAll = Power < const(data.power) && Power < PowerMax
trigger1 = (command = "hold_b" && command = "hold_y")
value = 5 + ifElse(time < 60, 0, (time - 60) / 12)

[State 730, Voice]
type = null;PlaySnd
trigger1 = !Time
value = 0,14
channel = 0

[State 730, Character Flash]
type = PalFX
trigger1 = 1
time = 1
add = 75 + ceil(sin(Time / 6.0 * pi) * 75),25 + ceil(sin(Time / 6.0 * pi) * 25),0

[State 730, Power Charge Helper]
type = Helper
trigger1 = !NumHelper(8330)
helperType = Normal
stateNo = 8330
ID = 8330
name = "Power Charge"
posType = P1
pos = 0,0
pauseMoveTime = 65535
superMoveTime = 65535
ownPal = 1

[State 730, Particles]
type = Helper
trigger1 = !NumHelper(8331)
helperType = Normal
stateNo = 8331
ID = 8331
name = "Particles"
postype = P1
pauseMoveTime = 65535
superMoveTime = 65535
ownPal = 1

[State 730, End]
type = ChangeState
trigger1 = Power >= const(data.power) || Power >= PowerMax || RoundState != 2
trigger2 = (command != "hold_b" || command != "hold_y")
value = 731
ctrl = 1


;Power Charge End
[StateDef 731]
type = S
physics = S
moveType = I
anim = 731
velSet = 0,0
ctrl = 1

[State 731, StopSnd]
type = StopSnd
trigger1 = !Time
channel = 0

[State 730, Full Power Voice]
type = null;PlaySnd
trigger1 = !Time && Power >= const(data.power)
value = 0,0
channel = 0
persistent = 0

[State 730, End]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1

;====================<ZERO COUNTER>====================
[StateDef 750]
type = S
physics = S
moveType = I
anim = 750
velSet = 0,0
ctrl = 0
sprPriority = 2
powerAdd = -1000
faceP2 = 1

[State 750, High or Low]
type = VarSet
trigger1 = !Time
var(10) = (command = "412k")
ignoreHitPause = 1

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

[State 750, PosFreeze]
type = PosFreeze
trigger1 = 1
value = 1

[State 750, Voice]
type = PlaySnd
trigger1 = !Time
value = 0,0
channel = 0

[State 750, Zero Counter FX Helper]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 8350
ID = 8350
name = "Zero Counter"
posType = P1
pos = 20, -66
superMoveTime = 255
ownPal = 1

[State 750, SuperPause]
type = SuperPause
trigger1 = !Time
time = 15
moveTime = 15
p2DefMul = 1
anim = -1
sound = s750,0
darken = 0

[State 750, End]
type = ChangeState
trigger1 = Time >= 15
value = ifElse(var(10) = 1, 450, 221)

;====================<CUSTOM COMBO>====================
;Ground Version
[StateDef 900]
type = S
physics = S
moveType = A
anim = 900
velSet = 0,0
ctrl = 0
sprPriority = 2
powerAdd = -1000

[State 900, Corner Push]
type = VarSet
trigger1 = Time = 4
fvar(5) = 0

[State 900, Unguardable]
type = VarSet
trigger1 = Time = 4 && NumEnemy
trigger1 = (EnemyNear, StateNo != [120,155])
var(17) = 30

[State 900, NotHitBy]
type = NotHitBy
trigger1 = !time
value = SCA
time = 38

[State 900, PosFreeze]
type = PosFreeze
trigger1 = 1
value = 1

[State 900, Custom Combo Time]
type = VarSet
trigger1 = Time >= 4
var(20) = 180

[State 900, Voice]
type = PlaySnd
trigger1 = Time = 4
value = 0, 23
channel = 0

[State 900, Custom Combo FX Helper]
type = Helper
trigger1 = Time = 4
helperType = Normal
stateNo = 8400
ID = 8400
name = "Custom Combo FX"
posType = P1
pos = 2,-65
superMoveTime = 255
size.xScale = 1
size.yScale = 1
ownpal = 1

[State 900, SuperPause]
type = SuperPause
trigger1 = Time = 4
time = 30
moveTime = 30
anim = -1
sound = s900,0
p2DefMul = 1
darken = 0

[State 900, AfterImage]
type = AfterImage
trigger1= !AnimTime
time = 2
timeGap = 1
frameGap = 4
length = 13
palBright = 0,0,0
palContrast = 64,128,192
palPostBright = 0,0,0
palAdd = 0,0,0
palMul = 0.75,0.75,0.75
trans = add1

[State 900, End]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1

;Air Version
[Statedef 905]
type = A
physics = N
moveType = A
anim = 905
ctrl = 0
sprPriority = 2
powerAdd = -1000

[State 905, Corner Push]
type = VarSet
trigger1 = Time = 4
fvar(5) = 0

[State 905, Unguardable]
type = VarSet
trigger1 = Time = 4 && NumEnemy
trigger1 = (EnemyNear, StateNo != [120,155])
var(17) = 30

[State 905, NotHitBy]
type = NotHitBy
trigger1 = !Time
value = SCA
time = 38

[State 905, PosFreeze]
type = PosFreeze
trigger1 = 1
value = 1

[State 905, Custom Combo Timer]
type = VarSet
trigger1 = Time >= 4
var(20) = 180

[State 900, Voice]
type = PlaySnd
trigger1 = Time = 4
value = 0, 23
channel = 0

[State 905, Custom Combo FX Helper]
type = Helper
trigger1 = Time = 4
helperType = Normal
stateNo = 8400
ID = 8400
name = "Custom Combo Startup"
posType = P1
pos = -2,-81
superMoveTime = 255
size.xScale = 1
size.yScale = 1
ownPal = 1

[State 905, SuperPause]
type = SuperPause
trigger1 = Time = 4
time = 30
moveTime = 30
anim = -1
sound = s900,0
p2DefMul = 1
darken = 0

[State 905, AfterImage]
type = AfterImage
trigger1 = !AnimTime
time = 2
timeGap = 1
frameGap = 4
length = 13
palBright = 0,0,0
palContrast = 64,128,192
palPostBright = 0,0,0
palAdd = 0,0,0
palMul = 0.75,0.75,0.75
trans = add1

[State 905, ChangeState]
type = ChangeState
trigger1 =!animtime
value =906
ctrl = 0

;Air Version
[Statedef 906]
type = A
physics = A
moveType = I
anim = 906
ctrl = 1
sprPriority = 1

[State 906, ChangeState]
type = ChangeState
trigger1 = Pos Y >= 0 && Vel Y > 0
value =52
ctrl = 0
;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------
;STANDING
[StateDef 0]
type = S
physics = S
moveType = I
velSet = 0,0
sprPriority = 0

[State 0, Remove Explods]
type = RemoveExplod
trigger1 = IsHelper

[State 0, Destroy Helpers]
type = DestroySelf
trigger1 = IsHelper

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && !AnimTime
value = 0

[State 0, Dead]
type = ChangeState
trigger1 = !Alive
value = 5050

;====================<CROUCHING>====================
;Stand to Crouch
[StateDef 10]
type = C
physics = C
moveType = I
velSet = 0,0
sprPriority = 0

[State 10, ChangeAnim]
type = ChangeAnim
trigger1 = !Time && Anim = 12
value = 10
elem = 3 - AnimElemNo(0)

[State 10, ChangeAnim]
type = ChangeAnim
trigger1 = Anim != 10
value = 10

[State 10, End]
type = ChangeState
trigger1 = !AnimTime
value = 11


;Crouching
[StateDef 11]
type = C
physics = C
moveType = I
anim = 11
velSet = 0,0
sprPriority = 0

[State 11, ChangeAnim]
type = ChangeAnim
trigger1 = Anim = 6 && !AnimTime
value = 11


;Crouch to Stand
[StateDef 12]
type = S
physics = S
moveType = I
velSet = 0,0
sprPriority = 0

[State 12, ChangeAnim]
type = ChangeAnim
trigger1 = !Time && Anim = 10
value = 12
elem = 3 - AnimElemNo(0)

[State 12, ChangeAnim]
type = ChangeAnim
trigger1 = Anim != 12
value = 12

[State 12, End]
type = ChangeState
trigger1 = command = "holddown" && command != "holdup"
value = 10

[State 12, End]
type = ChangeState
trigger1 = !AnimTime
value = 0

;-------------
;WALKING
[StateDef 20]
type = S
physics = S
moveType = I
sprPriority = 0

[State 20, VelSet]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)

[State 20, VelSet]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)

[State 20, ChangeAnim]
type = ChangeAnim
triggerAll = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimElemTime(1) >= 1
value = 20

[State 20, ChangeAnim]
type = ChangeAnim
triggerAll = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimElemTime(1) >= 1
value = 21

;====================<Jumping>====================
[StateDef 40]
type = S
physics = S
moveType = I
anim = 40
ctrl = 0
velSet = 0,0
sprPriority = 1
faceP2 = 1

[State 40, Direction]
type = varset
trigger1 = !AIlevel
sysvar(1) = ifelse(!time, 0, ifelse(command = "holdfwd", 1, ifelse(command = "holdback", -1, sysvar(1))))
[State 40, Direction]
type = varset
trigger1 = AIlevel
sysvar(1) = ifelse((enemynear, movetype != A || backedgebodydist <= 10), 1, ifelse((enemynear, movetype = A), -1, 0))

[State 40, High Jump]
type = varset
trigger1 = !time && !AIlevel
var(3) = ifelse(command = "highjump", 3, 0)
[State 40, High Jump]
type = varset
trigger1 = !time && AIlevel
var(3) = ifelse((p2bodydist x >= 160 || random < (125 * (AIlevel ** 2 / 64.0))), 3, 0)
[State 40, High Jump]
type = varset
trigger1 = !time && prevstateno = 100
var(3) = 3

[State 40, Low Jump]
type = varset
trigger1 = !AIlevel && command != "holdup" && (var(3) != [1, 2])
var(3) = ifelse((var(3) = 3 && sysvar(1)), 2, 1)
[State 40, Low Jump]
type = varset
trigger1 = AIlevel && (var(3) != [1, 2])
trigger1 = (enemynear, statetype = C) && random < 500
var(3) = ifelse((var(3) = 3 && sysvar(1)), 2, 1)

[State 40, Snd]
type = playsnd
trigger1 = !animtime
value = ifelse((var(3) = [2, 3]), 41, 40), 0
[State 40, Dust]
type = helper
trigger1 = !animtime
helpertype = normal
stateno = 8100
ID = 8100
name = "Jump Dust"
postype = p1
ownpal = 1

[State 40, Vel Normal]
type = velset
trigger1 = !animtime
x = ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1) = 1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)
[State 40, Vel Short]
type = velset
trigger1 = !animtime && var(3) = 1
x = ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1) = 1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = 0.76 * const(velocity.jump.y)
[State 40, Vel Medium]
type = velset
trigger1 = !animtime && var(3) = 2
x = ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1) = 1, const(velocity.runjump.fwd.x), const(velocity.runjump.back.x)))
y = 0.76 * const(velocity.jump.y)
[State 40, Vel Long]
type = velset
trigger1 = !animtime && var(3) = 3
x = ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1) = 1, const(velocity.runjump.fwd.x), const(velocity.runjump.back.x)))
y = ifelse(!sysvar(1), const(velocity.runjump.y), const(velocity.jump.y))
[State 40, End]
type = ChangeState
trigger1 = !AnimTime
value = 50
ctrl = 1


;In Air
[StateDef 50]
type = A
physics = N
moveType = I
sprPriority = 1

[State 50, ChangeAnim]
type = ChangeAnim
trigger1 = !Time
value = ifElse(!vel x , 41, ifElse(vel x > 0, 42, 43)) + 10 * (var(3) = [1,2])
persistent = 0

[State 50, Assert: No Guard]
type = AssertSpecial
trigger1 = var(3) = [1,2]
flag = NoAirGuard

[State 50, Grounded Frame]
type = PosFreeze
trigger1 = Time < 1 && PrevStateNo = 40
value = 1

[State 50, Gravity]
type = Gravity
trigger1 = Time >= 1 || PrevStateNo != 40

[State 50, Landing]
type = ChangeState
trigger1 = pos y > -vel y
value = 52


[StateDef 51]
type = A
physics = N
moveType = I
sprPriority = 1

[State 51, Gravity]
type = Gravity
trigger1 = 1

[State 51, Landing]
type = ChangeState
trigger1 = pos y > -vel y
value = 52


;Landing
[StateDef 52]
type = S
physics = S
moveType = I
anim = 47
ctrl = 0
velSet = 0,0
sprPriority = 1

[State 52, ChangeAnim]
type = ChangeAnim
trigger1 = !Time && (var(3) = 1 || var(3) = 2)
trigger1 = (PrevStateNo = [600,699])
value = 57

[State 52, PosSet]
type = PosSet
trigger1 = 1
y = 0

[State 52, CtrlSet]
type = CtrlSet
trigger1 = !Time && (PrevStateNo != [600,699])
trigger2 = Time = 1 && Anim != 57
value = 1

[State 52, ChangeState to Guarding]
type = ChangeState
trigger1 = ctrl && command = "holdback"
trigger1 = InGuardDist && (PrevStateNo != [600,699])
value = 120

[State 52, Assert: NoWalk]
type = AssertSpecial
trigger1 = anim != 5
flag = NoWalk

[State 52, Landing Sound]
type = PlaySnd
trigger1 = !Time
value = 52,0

[State 52, Landing Dust Explod]
type = Explod
trigger1 = !Time
anim = 8106
sprPriority = -3
posType = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1

[State 52, ChangeAnim to Turning]
type = ChangeAnim
trigger1 = ctrl && P2Dist x < 0
trigger1 = Anim != 5
value = 5

[State 52, Turn]
type = Turn
trigger1 = Anim = 5 && AnimElem = 1

[State 52, End]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1

;=============<Running>====================
[Statedef 100]
type    = S
movetype = I
physics = S
ctrl = 0
VelSet = 0,0

[State 100, ChangeAnim]
type = ChangeAnim
trigger1 = !Time
value = 100

[State 103, PosSet]
type = PosSet
trigger1 =1
y = 0

[State 100, Velocity]
type = VelSet
trigger1 = AnimElem = 2 >= 0
x = Const(velocity.run.fwd.x)

[State 100, Change to Run Stop]
type=ChangeState
trigger1=!AILevel&&Command != "holdfwd" && Time >= 10
trigger2=AIlevel && (p2movetype = A || p2dist x < 80)
value=101
ctrl=0

[State 100, Able to Jump]
type=ChangeState
trigger1=!AILevel&&(Command="holdupfwd" || Command="holdup")
value=40

[State 110, Dust Helper]
type = Helper
trigger1 = AnimElem = 2
helperType = Normal
stateNo = 8103
ID = 8100
name = "Dash Dust"
posType = P1
pauseMoveTime = 255
superMoveTime = 255
ownPal = 1

[State 105, Starting Step snd]
type = PlaySnd
trigger1 = !Time
value = 102, 0
channel = 5

[State 105, Step snd]
type = PlaySnd
trigger1 = AnimElem = 4 || AnimElem = 7
value = 100,Ifelse((AnimElem = 7),1,0)
channel = 5

[State 100, No Walk During Run]
type = AssertSpecial
trigger1 = 1
flag = NoWalk

;Run Stop
[Statedef 101]
type = S
movetype = I
physics = S

[State 101, Skid Snd]
type = PlaySnd
trigger1 = !Time
value = 101,0

[State 101, Skid Dust]
type = Explod
trigger1 = !Time
anim = 8104
sprPriority=3
posType = P1
pos = -10,0
vel = 0,0
scale = 0.5,0.5
pauseMovetime = -1
superMoveTime = -1
ownpal = 1

[State 101, ChangeAnim]
type = ChangeAnim
trigger1 = !Time
value = 101

[State 101, End]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1
;======================< DASH >===========================
;Dash
[Statedef 102]
type = S
physics = N
movetype = I
anim = 102
ctrl = 0
sprpriority = 1

[State 102, StateTypeSet]
type = StateTypeSet
trigger1 = animelem = 2
statetype = A
[State 102, Vel]
type = velset
trigger1 = animelem = 2
x = 6
y =-3.5
[State 102, VelAdd]
type = VelAdd
trigger1 =animelemtime(2)>=0
y = .4


[State 102, Snd]
type = playsnd
trigger1 = !time
value = 102,0
[State 102, Dust]
type = helper
trigger1 = animelem = 2
helpertype = normal
stateno = 8103
ID = 8100
name = "Dash Dust"
postype = p1
pausemovetime = 255
supermovetime = 255
ownpal = 1

[State 102, Run]
type = varset
trigger1 = !time
sysvar(1) = 1
[State 102, Run]
type = varset
triggerall = time <= 5
trigger1 = !AIlevel && command != "holdfwd"
trigger2 = AIlevel && p2bodydist x<55
sysvar(1) = 0
[State 102, Run]
type = changestate
trigger1 = time = 5 && sysvar(1)
value = 100

[State 102, End]
type = changestate
trigger1 = Pos y>=0 && vel y> 0
value = 103


;--- Land ---
[Statedef 103]
type = S
physics = S
ctrl = 0
anim = 103
velset = 0, 0

[State 103, PosSet]
type = PosSet
trigger1 =1
y = 0

[State 103, Snd]
type = playsnd
trigger1 = !time
value = 100,0
[State 103, Dust]
type = explod
trigger1 = !time
anim = 8106
sprpriority = -3
postype = p1
scale = 0.65, 0.65
pausemovetime = -1
supermovetime = -1
ownpal = 1

[State 103, End]
type = changestate
trigger1 = !animtime
value = 0
ctrl = 1

;------------------------ 
;Hop Back
[Statedef 105]
type = S
movetype = I
physics = S
anim = 105
ctrl = 0
velset = 0, 0

[State 105, StateTypeSet];Air, no physics
type = StateTypeSet
trigger1 = AnimElem = 2
statetype = A
physics = N

[State 105, Dust Helper]
type = Helper
trigger1 = AnimElem = 2
helperType = Normal
stateNo = 8103
ID = 8100
name = "Dash Dust"
posType = P1
facing = -1
pauseMoveTime = 255
superMoveTime = 255
ownPal = 1

[State 105, 1]
type = VelSet
trigger1 = AnimElem = 2
x = -6.8
y = -5

[State 105, 1]
type = VelMul
trigger1 = AnimElemTime(2) > 0
x = .98

[State 105, 1]
type = VelAdd
trigger1 = AnimElemTime(2) > 0
y = .65

[State 105, Dash Back Snd]
type = PlaySnd
trigger1 = AnimElem = 2
value = 105, 0

[State 105, On Ground]
type = PosSet
trigger1 = AnimElem = 2 > 0
trigger1 = Vel Y > 0 && Pos Y >= 0
y = 0

[State 105, End]
type = ChangeState
trigger1 = AnimElem = 2 > 0
trigger1 = Vel Y > 0 && Pos Y >= 0
value = 106

;Hop Back Landing
[Statedef 106]
type = S
movetype = I
physics = S
anim = 106
velset = 0, 0

[State 106, Landing Sound]
type = PlaySnd
trigger1 = !Time
value = 52,0

[State 106, Landing Dust Explod]
type = Explod
trigger1 = !Time
anim = 8106
sprpriority = -3
postype = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1

[State 106, End]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1
;-------------------------------------------------------------------------------
;Super Jump
[Statedef 123]
type = A
movetype = I
physics = N
anim = 40
velset = 0,0
ctrl = 0

[State 123, reset]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 123, Direction]
type = varset
trigger1 = !AILevel
sysvar(1) = Ifelse(!time, 0, Ifelse(command = "holdfwd", 1, Ifelse(command = "holdback", -1, sysvar(1))))
[State 123, Direction]
type = varset
trigger1 = AILevel
sysvar(1) = Ifelse((enemynear, movetype != A || backedgebodydist <= 10), 1, Ifelse((enemynear, movetype = A), -1, 0))

[state 123, playsnd]
type = playsnd
trigger1 = !AnimTime
value = s110,0
channel = 4
[State 123, Jump Sound]
type = PlaySnd
trigger1 = !AnimTime
value = Ifelse((sysvar(1) = 0), 40, 41), 0
[State 123, Dust Helper]
type = Helper
trigger1 = !AnimTime
helperType = Normal
stateNo = 8100
ID = 8100
name = "Jump Dust"
posType = P1
ownPal = 1

[State 123, velset]
type = VelSet
trigger1 =!animtime
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.runjump.y)*1.0


[State 123, Change]
type = ChangeState
trigger1 = !animtime
value = 50
ctrl = 1
;=====================<HIT GROUND(BOUNCE)>===================
[Statedef 5100]
type    = L
movetype= H
physics = N

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

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

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

[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = (anim != [5051,5059]) && (anim != [5061,5069])
trigger2 = !SelfAnimExist(5100 + (anim % 10))
value = 5100

[State 5100, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = (anim = [5051,5059]) || (anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (anim % 10))
value = 5100 + (anim % 10)

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

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

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

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

[State 5100, 8]
type = GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

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

[State 5100, 10] ;Thud sound for when char hits ground
type = PlaySnd
trigger1 = Time = 1
value = 5000,11

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

[State 5100, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 5101

[State 5100, 13]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20

;================<HIT LIEDOWN>====================
[Statedef 5110]
type    = L
movetype= H
physics = N

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

[State 5110, 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 5110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170

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

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

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

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

[State 5110, 6] ;Thud sound for when char hits ground
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 5000,11

[State 5110, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

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

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

[State 5110, 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 5110, 11] ;If just died
type = ChangeState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

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

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

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

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

;==========< GUARD >==========
;--- START ---
[Statedef 120]
type = U
physics = U
[State 120, Vel]
type = velset
trigger1 = !time && statetype != A
x = 0
y = 0
[State 120, Anim]
type = changeanim
trigger1 = !time
value = 120 + (statetype = C) + (statetype = A) * 2
[State 120, Type]a
type = statetypeset
trigger1 = !time && statetype = S
physics = S
[State 120, Type]
type = statetypeset
trigger1 = !time && statetype = C
physics = C
[State 120, Type]
type = statetypeset
trigger1 = !time && statetype = A
physics = A
[State 120, High to Low]
type = statetypeset
trigger1 = !AIlevel && statetype = S && command = "holddown"
trigger2 = AIlevel && statetype = S && (enemynear, movetype = A) && (enemynear, statetype = C)
statetype = C
physics = C
[State 120, Low to High]
type = statetypeset
trigger1 = !AIlevel && statetype = C && command != "holddown"
trigger2 = AIlevel && statetype = C && (enemynear, movetype = A) && (enemynear, statetype != C)
statetype = S
physics = S
[State AI fix]
type = ctrlset
trigger1 = AIlevel && numenemy
value = (enemynear, time >= 120 || time >= 180)
[State 120, End]
type = changestate
trigger1 = !animtime || AIlevel
value = 130 + (statetype = C) + (statetype = A) * 2
[State 120, Stop]
type = changestate
trigger1 = (!AIlevel && command != "holdback")
trigger2 = !inguarddist
trigger3 = AIlevel && numenemy
trigger3 = enemynear, hitdefattr = SCA, AT
value = 140


;--- STAND GUARD (guarding) ---
[Statedef 130]
type = S
physics = S
[State 130, Anim]
type = changeanim
trigger1 = anim != 130
value = 130
[State AI fix]
type = ctrlset
trigger1 = AIlevel && numenemy
value = (enemynear, time >= 120 || time >= 180)
[State 130, High to Low]
type = changestate
trigger1 = !AIlevel && command = "holddown"
trigger2 = AIlevel && random < (250 * (AIlevel ** 2 / 64.0))
trigger2 = (enemynear, movetype = A) && (enemynear, statetype = C)
value = 131
[State 130, Stop Guarding]
type = changestate
trigger1 = (!AIlevel && command != "holdback")
trigger2 = !inguarddist
trigger3 = AIlevel && numenemy
trigger3 = enemynear, hitdefattr = SCA, AT
value = 140

;--- CROUCH GUARD (guarding) ---
[Statedef 131]
type = C
physics = C
[State 131, Anim]
type = changeanim
trigger1 = anim != 131
value = 131
[State AI fix]
type = ctrlset
trigger1 = AIlevel && numenemy
value = (enemynear, time >= 120 || time >= 180)
[State 131, Low to High]
type = changestate
trigger1 = !AIlevel && command != "holddown"
trigger2 = AIlevel && random < (125 * (AIlevel ** 2 / 64.0))
trigger2 = (enemynear, movetype = A) && (enemynear, statetype != C)
value = 130
[State 131, Stop Guarding]
type = changestate
trigger1 = (!AIlevel && command != "holdback")
trigger2 = !inguarddist
trigger3 = AIlevel && numenemy
trigger3 = enemynear, hitdefattr = SCA, AT
value = 140
[State 130, Landing Sound]
type = PlaySnd
trigger1 = !Time
trigger1 = PrevStateNo = 132 || (PrevStateNo = [154,155])
value = 52,0
persistent=0
[State 130, Landing Dust Expod]
type = Explod
trigger1 = !Time
trigger1 = PrevStateNo = 132 || (PrevStateNo = [154,155])
anim = 8106
sprpriority = -3
posType = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1
persistent=0

;--- AIR GUARD (guarding) ---
[Statedef 132]
type = A
physics = N
[State 132, Anim]
type = changeanim
trigger1 = anim != 132
value = 132
[State 132, Accel]
type = veladd
trigger1 = 1
y = const(movement.yaccel)
[State 132, Var]
type = varset
trigger1 = 1
sysvar(0) = (pos y >= 0) && (vel y > 0)
[State 132, Vel]
type = velset
trigger1 = sysvar(0)
y = 0
[State 132, Pos]
type = posset
trigger1 = sysvar(0)
y = 0
[State AI fix]
type = ctrlset
trigger1 = AIlevel && numenemy
value = (enemynear, time >= 120 || time >= 180)
[State 132, End]
type = changestate
trigger1 = sysvar(0) && inguarddist
trigger1 = (!AIlevel && command = "holdback") || AIlevel
value = 130
[State 132, End]
type = changestate
trigger1 = sysvar(0)
value = 52
[State 132, stop guarding]
type = changestate
trigger1 = (!AIlevel && command != "holdback")
trigger2 = !inguarddist
trigger3 = AIlevel && numenemy
trigger3 = enemynear, hitdefattr = SCA, AT
value = 140


;--- GUARD (end) ---
[Statedef 140]
type = U
physics = U
ctrl = 1
[State 140, Anim]
type = changeanim
trigger1 = !time
value = 140 + (statetype = C) + (statetype = A) * 2
[State 140, Type]
type = statetypeset
trigger1 = !time && statetype = S
physics = S
[State 140, Type]
type = statetypeset
trigger1 = !time && statetype = C
physics = C
[State 140, Type]
type = statetypeset
trigger1 = !time && statetype = A
physics = A
[State 140, High to Low]
type = statetypeset
trigger1 = !AIlevel && statetype = S && command = "holddown"
trigger2 = AIlevel && random < (250 * (AIlevel ** 2 / 64.0))
trigger2 = statetype = S && (enemynear, movetype = A) && (enemynear, statetype = C)
statetype = C
physics = C
[State 140, Low to High]
type = statetypeset
trigger1 = !AIlevel && statetype = C && command != "holddown"
trigger2 = AIlevel && random < (125 * (AIlevel ** 2 / 64.0))
trigger2 = statetype = C && (enemynear, movetype = A) && (enemynear, statetype != C)
statetype = S
physics = S
[State 140, 5]
type = changestate
trigger1 = !animtime
value = (statetype = C) * 11 + (statetype = A) * 51

;--- SGUARDHIT (shaking) ---
[Statedef 150]
type = S
movetype = H
physics = N
velset = 0, 0
[State 150, Anim]
type = changeanim
trigger1 = 1
value = 150
[State 150, End]
type = changestate
trigger1 = hitshakeover
value = 151 + 2 * ((!AIlevel && command = "holddown") || (AIlevel && (enemynear, movetype = A) && (enemynear, statetype = C)))
[State 150, High to Low]
type = statetypeset
trigger1 = !AIlevel && statetype = S && command = "holddown"
trigger2 = AIlevel && random < (250 * (AIlevel ** 2 / 64.0))
trigger2 = statetype = S && (enemynear, movetype = A) && (enemynear, statetype = C)
statetype = C
physics = C
[State 150, Low to High]
type = statetypeset
trigger1 = !AIlevel && statetype = C && command != "holddown"
trigger2 = AIlevel && random < (125 * (AIlevel ** 2 / 64.0))
trigger2 = statetype = C && (enemynear, movetype = A) && (enemynear, statetype != C)
statetype = S
physics = S

;--- SGUARDHIT2 (knocked back) ---
[Statedef 151]
type = S
movetype = H
physics = S
anim = 150
[State 151, Vel]
type = hitvelset
trigger1 = !time
x = 1
[State 151, Vel]
type = velset
trigger1 = time = gethitvar(slidetime)
trigger2 = hitover
x = 0
[State 151, Ctrl]
type = ctrlset
trigger1 = time = gethitvar(ctrltime)
value = 1
[State 151, High to Low]
type = statetypeset
trigger1 = !AIlevel && statetype = S && command = "holddown"
trigger2 = AIlevel && random < (250 * (AIlevel ** 2 / 64.0))
trigger2 = statetype = S && (enemynear, movetype = A) && (enemynear, statetype = C)
statetype = C
physics = C
[State 151, Low to High]
type = statetypeset
trigger1 = !AIlevel && statetype = C && command != "holddown"
trigger2 = AIlevel && random < (125 * (AIlevel ** 2 / 64.0))
trigger2 = statetype = C && (enemynear, movetype = A) && (enemynear, statetype != C)
statetype = S
physics = S
[State 151, End]
type = changestate
trigger1 = hitover
value = 130
ctrl = 1

;--- CGUARDHIT (shaking) ---
[Statedef 152]
type = C
movetype = H
physics = N
velset = 0, 0
[State 152, Anim]
type = changeanim
trigger1 = 1
value = 151
[State 152, End]
type = changestate
trigger1 = hitshakeover
value = 151 + 2 * ((!AIlevel && command = "holddown") || (AIlevel && (enemynear, movetype = A) && (enemynear, statetype = C)))
[State 152, High to Low]
type = statetypeset
trigger1 = !AIlevel && statetype = S && command = "holddown"
trigger2 = AIlevel && random < (250 * (AIlevel ** 2 / 64.0))
trigger2 = statetype = S && (enemynear, movetype = A) && (enemynear, statetype = C)
statetype = C
physics = C
[State 152, Low to High]
type = statetypeset
trigger1 = !AIlevel && statetype = C && command != "holddown"
trigger2 = AIlevel && random < (125 * (AIlevel ** 2 / 64.0))
trigger2 = statetype = C && (enemynear, movetype = A) && (enemynear, statetype != C)
statetype = S
physics = S

;--- CGUARDHIT2 (knocked back) ---
[Statedef 153]
type = C
movetype = H
physics = C
anim = 151
[State 153, Vel]
type = hitvelset
trigger1 = !time
x = 1
[State 153, Vel]
type = velset
trigger1 = time = gethitvar(slidetime)
trigger2 = hitover
x = 0
[State 153, Ctrl]
type = ctrlset
trigger1 = time = gethitvar(ctrltime)
value = 1
[State 153, High to Low]
type = statetypeset
trigger1 = !AIlevel && statetype = S && command = "holddown"
trigger2 = AIlevel && random < (250 * (AIlevel ** 2 / 64.0))
trigger2 = statetype = S && (enemynear, movetype = A) && (enemynear, statetype = C)
statetype = C
physics = C
[State 153, Low to High]
type = statetypeset
trigger1 = !AIlevel && statetype = C && command != "holddown"
trigger2 = AIlevel && random < (125 * (AIlevel ** 2 / 64.0))
trigger2 = statetype = C && (enemynear, movetype = A) && (enemynear, statetype != C)
statetype = S
physics = S
[State 153, End]
type = changestate
trigger1 = hitover
value = 131
ctrl = 1

;--- AGUARDHIT (shaking) ---
[Statedef 154]
type = A
movetype = H
physics = N
velset = 0, 0
[State 154, Anim]
type = changeanim
trigger1 = 1
value = 152
[State 154, End]
type = changestate
trigger1 = hitshakeover
value = 155

;--- AGUARDHIT2 (knocked away) ---
[Statedef 155]
type = A
movetype = H
physics = N
anim = 152
[State 155, Vel]
type = hitvelset
trigger1 = !time
x = 1
y = 1
[State 155, Vel]
type = veladd
trigger1 = 1
y = const(movement.yaccel)
[State 155, Ctrl]
type = ctrlset
trigger1 = time = gethitvar(ctrltime)
value = 1
[State 155, Var]
type = varset
trigger1 = 1
sysvar(0) = (pos y >= 0) && (vel y > 0)
[State 155, Vel]
type = velset
trigger1 = sysvar(0)
y = 0
[State 155, Pos]
type = posset
trigger1 = sysvar(0)
y = 0
[State 155, End]
type = changestate
trigger1 = sysvar(0) && inguarddist
trigger1 = (!AIlevel && command = "holdback") || AIlevel
value = 130
[State 155, End]
type = changestate
trigger1 = sysvar(0)
value = 52
;==========<FORCED P2 RECOVERY>==========
[StateDef 5025]
type = A
moveType = H
physics = N
velSet = 0,0
faceP2 = 1

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

[State 5025, End]
type = SelfState
trigger1 = 1
value = ifElse(pos y, 5020, 5000)

;==========<TARGET SAFE FALL>==========
[StateDef 5205]
type = A
physics = N
moveType = H

[State 5205, End]
type = SelfState
trigger1 = 1
value = ifElse(pos y < -20, 5210, 5200)

;==========<FALL RECOVERY>==========
[StateDef 5200]
type = A
moveType = H
physics = N

[State 5200, ChangeAnim]
type = ChangeAnim
trigger1 = anim = 5035 && !AnimTime
value = 5050

[State 5200, VelAdd]
type = VelAdd
trigger1 = 1
y = GetHitVar(yAccel)

[State 5200, End]
type = SelfState
trigger1 = vel y > 0 && pos y >= 10
value = 5201

[StateDef 5201]
type = S
moveType = I
physics = N
anim = 5200
ctrl = 0
faceP2 = 1

[State 5201, PosSet]
type = PosSet
trigger1 = 1
y = 0

[State 5201, VelSet]
type = VelSet
trigger1 = !Time
x = -8
y = 0

[State 5201, VelMul]
type = VelMul
trigger1 = 1
x = 0.9

[State 5201, Voice]
type = PlaySnd
trigger1 = !Time
value = 0,0
channel = 0

[State 5201, Recover Sound]
type = PlaySnd
trigger1 = !Time
value = 5200,0
channel = 1

[State 5201, Flash]
type = PalFX
trigger1 = !Time
add = 255,255,255
sinAdd = -255,-255,-255,40
time=10

[State 5201, Recover FX]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 8200
ID = 8200
name = "Recover FX"
posType = P1
pos = 0, ceil(-18 * const(size.yScale))
size.xScale = 1
size.yScale = 1
ownpal = 1

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

[State 5201, End]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1


;Air Recover
[StateDef 5210]
type = A
moveType = I
physics = N
anim = 5210
ctrl = 0
faceP2 = 1

[State 5210, VelAdd]
type = VelAdd
trigger1 = 1
y = 0.6

[State 5210, VelSet]
type = VelSet
trigger1 = !Time
x = ifElse((command = "holdfwd" && command != "holdback"), 0, ifElse((command != "holdfwd" && command = "holdback"), -4, -2))
y = -7.55

[State 5210, Voice]
type = PlaySnd
trigger1 = !Time
value = 0,0
channel = 0

[State 5210, Recover Sound]
type = PlaySnd
trigger1 = !Time
value  = 5200,0
channel = 1

[State 5210, Flash]
type = PalFX
trigger1 = !Time
add = 255,255,255
sinAdd = -255,-255,-255,40
time = 10

[State 5210, Recover FX]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 8200
ID = 8200
name = "Recover FX"
posType = P1
pos = 0, ceil(-66 * const(size.yScale))
size.xScale = 1
size.yScale = 1
ownPal = 1

[State 5210, NotHitBy]
type = NotHitBy
trigger1 = AnimElemTime(8) < 0
value = SCA
time = 1

[State 5210, CtrlSet]
type = CtrlSet
trigger1 = AnimElemTime(8) >= 0
value = 1

[State 5210, Land]
type = ChangeState
trigger1 = pos y > -vel y
value = 52

;============<CONTINUE?>==============
[Statedef 5500]
type = S
anim = 5300
velset = 0,0
ctrl = 0

[State 5500, Anim]
type = ChangeAnim
trigger1 = !Time
value = 5500

;=============<CHEAP K.O.>=============
[StateDef 5950]
type = S
moveType = H
physics = S
anim = 5950
velSet = 0,0

[State 5950, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State 5950, PosSet]
type = PosSet
trigger1 = 1
y = 0

[State 5950, Assert: NoKOsnd]
type = AssertSpecial
trigger1 = 1
flag = NoKOsnd

[State 5950, StopSnd]
type = StopSnd
trigger1 = !Time && !Alive
channel = 0

[State 5950, KO Sound]
type = PlaySnd
trigger1 = AnimElem = 2 && !Alive
value = 11,0

[State 5950, Hitting the Floor Sound]
type = PlaySnd
trigger1 = AnimElem = 5
value = 5000,11
volume = 200

[State 5950, Hitting the Floor Explod]
type = Explod
trigger1 = AnimElem = 5
anim = 8106
sprpriority = -3
postype = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1

[State 5950, End]
type = ChangeState
trigger1= !AnimTime
value = ifElse(Alive, 5110, 5150)

;================<AIR HIT TRANSITION>=================
[Statedef 5035]
type = A
movetype = H
physics = N

[State 5035, ChangeAnim]
type = ChangeAnim
trigger1 = !Time
trigger1 = SelfAnimExist(5035)
trigger1 = Anim = [5000,5029]
value = 5035

[State 5035, VelAdd]
type = VelAdd
trigger1 = 1
y = GetHitVar(yAccel)

[State 5035, Recover]
type = ChangeState
triggerAll = !HitFall
trigger1 = HitOver
trigger2 = !AnimTime
trigger3 = vel y > 0 && pos y >= 10
trigger4 = !Time
trigger4 = Anim != 5035
value = 5040

[State 5035, Fall]
type = ChangeState
triggerAll = HitFall
trigger1 = HitOver
trigger2 = !AnimTime
trigger3 = vel y > 0 && pos y >= 10
trigger4 = !Time
trigger4 = Anim != 5035
value = 5050

;---------------------------------------------------------------------------
;Standing Parry
[StateDef 6080]
type = S
movetype = I
physics = S
anim = 6080
velset = 0,0
ctrl = 0
sprpriority = 2
poweradd = 72

[State 6080, EnvShake]
type = EnvShake
trigger1 = time = 1
persistent = 0
ignorehitpause = 1
time = 10
ampl = 5

[State 6080, Pause]
type = Pause
trigger1 = !Time
time = 12
movetime = 12

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

[State 6080, Voice]
type = PlaySnd
trigger1 = Time=0
value = S0,0
channel=0
[State 6080, Parry Sound]
type = PlaySnd
trigger1 = Time=0
value = S6080,0

[State 6080, blueflash]
type=palfx
trigger1=!time
add=0,50,255
sinadd=0,-50,-255,60
time=15
[State 6080, Spark]
type=explod
trigger1= !time
anim=8360
sprpriority=5
postype=p1
pos=ceil(12*const(size.xscale)),ceil(-71*const(size.yscale))
pausemovetime=-1
supermovetime=-1
scale=.5,.5
ownpal=1

[State 6080, RemoveExplod]
type = RemoveExplod
trigger1 =animelem!=2
id =8065

[State 6080, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nowalk
flag2 = nostandguard
flag3 = nocrouchguard
[State 6080, sprpriority]
type = sprpriority
trigger1 = animelemtime(3) >= 0
value = 0
[State 6080, CtrlSet]
type = CtrlSet
trigger1 = Time > 10
value = 1

[State 6080, ChangeState]
type = ChangeState
trigger1 = AnimTime=0
value = 0
ctrl = 1
;----------------------------------------------------------------------
;Crouching Parry
[StateDef 6081]
type = C
movetype = I
physics = C
anim = 6081
velset = 0,0
ctrl = 0
sprpriority = 2
poweradd = 72

[State 6081, Pause]
type = Pause
trigger1 = !Time
time = 10
movetime = 10
[State 6081, EnvShake]
type = EnvShake
trigger1 = time = 1
persistent = 0
ignorehitpause = 1
time = 10
ampl = 5
[State 6081, HitBy]
type = NotHitBy
trigger1=1
time=1
value=SCA
[State 6081, blueflash]
type=palfx
trigger1=!time
add=0,50,255
sinadd=0,-50,-255,60
time=15
[State 6081, Voice]
type = PlaySnd
trigger1 = Time=0
value = S0,0
channel=0
[State 6081, Parry Sound]
type = PlaySnd
trigger1= Time=0
value=S6080,0

[State 6081, Spark]
type=explod
trigger1= !time
anim=8360
sprpriority=5
postype=p1
pos=ceil(7*const(size.xscale)),ceil(-48*const(size.yscale))
pausemovetime=-1
supermovetime=-1
scale=.5,.5
ownpal=1

[State 6081, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nowalk
flag2 = nostandguard
flag3 = nocrouchguard
[State 6081, sprpriority]
type = sprpriority
trigger1 = animelemtime(3) >= 0
value = 0
[State 6081, CtrlSet]
type = CtrlSet
trigger1 = Time > 10
value = 1

[State 6081, ChangeState]
type = ChangeState
trigger1 = !AnimTime
value = 11
ctrl = 1
;--------------------------------------------------------------
;Aerial Parry
[Statedef 6082]
type = A
movetype = I
physics = A
anim = 6082
ctrl = 0
sprpriority = 2
poweradd = 72

[State 6080, Pause]
type = Pause
trigger1 = !Time
time = 10
movetime = 10
[State 6082, EnvShake]
type = EnvShake
trigger1 = time = 1
persistent = 0
ignorehitpause = 1
time = 10
ampl = 5
[State 6082, HitBy]
type = HitBy
trigger1 = Time <=10
time = 1
value = SCA,AT
[State 6082, blueflash]
type=palfx
trigger1=!time
add=0,50,255
sinadd=0,-50,-255,60
time=15
[State 6082, StateTypeSet]
type = StateTypeSet
trigger1 = Time <= 10
physics = N

[State 6082, sts]
type = StateTypeSet
trigger1 = time > 10
physics = A

[State 6082, PosFreeze]
type = PosFreeze
trigger1 = Time <= 10
value = 1
[State 6082, Voice]
type = PlaySnd
trigger1 = Time=0
value = S0,0
channel=0
[State 6082, Parry Sound]
type = PlaySnd
trigger1 = !Time
value = S6080,0

[State 880, Spark]
type=explod
trigger1= !time
anim=8360
sprpriority=5
postype=p1
pos=ceil(21*const(size.xscale)),ceil(-84*const(size.yscale))
pausemovetime=-1
supermovetime=-1
scale=.5,.5
ownpal=1

[State 6082, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noairguard
[State 6082, sprpriority]
type = sprpriority
trigger1 = animelemtime(3) >= 0
value = 0
[State 6082, CtrlSet]
type = CtrlSet
trigger1 = time > 10
value = 1
;-------------------------------------------------------------------
;Stand by
[Statedef 7827]
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
facep2=1

[State 0, ScreenBound]
type = ScreenBound
trigger1 =1
value =0
ignorehitpause =1
[State 7827]
type = PosSet
trigger1=!time
y = 0
ignorehitpause=1
[State 7827]
type = ChangeState
trigger1 = NumEnemy = [1,2]
trigger1 = Enemy(0),statetype = L || Enemy(0),movetype != H
value = 7828
[State 7827]
type = ChangeState
trigger1 = NumEnemy = 2
trigger1 = Enemy(1),statetype = L || Enemy(1),movetype != H
value = 7828
;-------------------------------------------------------------------------------
[Statedef 7828]
type    = S
physics = S
anim = 100
ctrl = 0
facep2=1

[State 7828, FX]
type = Explod
trigger1 = (time%2) = 1
ID = 2221
anim = 2221
postype = p1
facing = 1
vfacing = 1
pos = -26,-55
bindtime = 1
removetime = 6
ontop = 1
vel = 0,0
ownpal = 1
random = 30,70
sprpriority = 3
scale = .4,.14
removeongethit = 1
ignorehitpause = 1
persistent = 1
[State 7828, SND]
type = playsnd
trigger1 = (animelem = 3 || animelem = 6)
value = 0, 100

[State 7828]
type = PosSet
trigger1 = !Time
y = 0
ignorehitpause=1
[State 7828]
type = VelSet
trigger1 = AnimElem = 1
x = 7
ignorehitpause=1
[State 7828]
type = VelSet
trigger1 = AnimElemNo(0) = [1,2]
x = 9
ignorehitpause=1
[State 7828]
type = AssertSpecial
trigger1 = 1
flag = NoWalk
ignorehitpause=1
[State 7828]
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn
ignorehitpause=1

[State 7828]
type = ChangeState
trigger1= time>=20
value = 7829
ctrl = 0
;-------------------------------------------------------------------------------
[Statedef 7829]
type    = S
physics = S
anim = 101
ctrl = 0

[State 0, VelMul]
type = VelMul
trigger1 =time=2
x = .5
[State 0,Dust]
type = MakeDust
trigger1=time%6
pos = 30, 0

[State 7829, SND]
type = playsnd
trigger1 =!time
value = 0, 101
persistent = 0
[State 7829,END]
type = ChangeState
trigger1=!animtime
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------
[Statedef -2]

[State -2, Finish]
type = ScreenBound
triggerall = (Life <= 0) || (!Alive) || (Lose)
trigger1 = (StateNo = 5150) && (RoundState = 4)
value = 0
MoveCamera = 0,0
IgnoreHitPause = 1

[State -2, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nojugglecheck
IgnoreHitPause = 1

[state -2, No Clones]
type = remappal
triggerall=numenemy && (var(26)=[1,115])
trigger1=var(27)&&!numhelper(256)&&matchno=1&&roundno=1
trigger1=enemy,authorname="Infinite"&&enemy,name="El Stingray"&&enemy,var(26)=var(26) 
source = 1, 1
dest = 1, Ifelse(teamside!=1 && enemynear,Numhelper(256)=0,enemy,var(26)+teamside,var(26))
ignorehitpause = 1
[state -2, Palette]
type = varset
trigger1 = numhelper(256)
trigger1=helper(256),var(26)=[1,115]
var(26)= helper(256),var(26)
ignorehitpause = 1
[state -2, Palette Selection]
type = remappal
trigger1 = numhelper(256)
trigger1=helper(256),var(26)=[1,115]
source = 1, 1
dest = 1, var(26)
ignorehitpause = 1
[state -2, Continue Palette]
type = remappal
trigger1=var(27)&&matchno>1
source = 1, 1
dest = 1, var(26)
ignorehitpause = 1

[State -2, Hit Detection]
type=varset
trigger1= movecontact=1 && var(30)<0
var(30)= hitpausetime
ignorehitpause=1

[State -2, Hit Sparks]
type = Helper
triggerAll = MoveContact = 1 && var(30) = HitPauseTime
trigger1 = MoveHit = 1 && NumEnemy
trigger1 = var(33) = [8010,8024]
trigger2 = MoveGuarded = 1 && NumEnemy
trigger2 = var(34) = 8000 || var(34) = 8001
helperType = Normal
stateNo = Ifelse(MoveGuarded, var(34), Ifelse(var(33) < 8020,8010,8020))
ID = 8000
name = "Spark"
postype = P1
pos = Ifelse(P2Dist x < 0, 0, Ifelse(P2Dist x < var(35), ceil(P2Dist x), var(35))), var(36)
facing = -1
ownPal = 1
size.xscale =1.0
size.yscale =1.0
pauseMoveTime = 65535
superMoveTime = 65535
ignoreHitPause = 1

[State -2, Counter FX]
type = Helper
trigger1= movehit=1 && var(30)=hitpausetime
trigger1= numenemy && var(9)
trigger1= !(hitdefattr=SCA,AT) && (stateno!=[3200,3251])
helperType = Normal
stateNo = 8290
ID = 8290
name = "Counter FX"
posType = P1
pos = ifElse(P2Dist x < 0, 0, ifElse(P2Dist x < var(35), ceil(P2Dist x), var(35))), var(36)
facing = -1
ownPal = 1
size.xscale =1.0
size.yscale =1.0
pauseMoveTime = 255
superMoveTime = 255
ignoreHitPause = 1

[State -2, Counter Flag]
type = VarSet
trigger1 = NumEnemy
var(9) = (EnemyNear, MoveType = A)
ignoreHitPause = 1

[State -2, Hit Detection]
type=varset
trigger1= 1
var(30)=-1
[State -2, Hit Detection]
type=varrangeset
trigger1= movetype=I 
trigger2= movetype=H && time
first=30
last=36
value=-1
ignorehitpause=1

[State -2, P2 Recovery]
type = TargetState
trigger1 = NumTarget(200)
trigger1 = (Target(200), StateNo = 5020) && (Target(200), Alive) && (Target(200), HitFall)
ID = 200
value = 5025
ignoreHitPause = 1
[State -2, P2 Facing]
type = TargetFacing
trigger1 = MoveContact = 1 && NumTarget
trigger1 = !(Target, HitShakeOver) && !(Target, HitFall) && (Target, Time <= 1)
value = ifElse(P2Dist x >= 0, -1, 1)
ignoreHitPause = 1

[State -2, P2 Safe Fall]
type = TargetState
trigger1 = NumTarget = 1
trigger1 = Target, command = "recovery"
trigger1 = Target, pos y >= -20 && Target, vel y > 0
trigger1 = Target, Alive && Target, HitFall && Target, GetHitVar(fall.recover)
trigger1 = Target, StateNo = 5030 || Target, StateNo = 5035 || Target, StateNo = 5050 || Target, StateNo = 5071
value = 5205
ignoreHitPause = 1

[State -2, Assert: UnGuardable]
type = AssertSpecial
trigger1 = var(17) > 0
trigger1 = var(17) := (var(17) - 1)
flag = UnGuardable
ignoreHitPause = 1

[State -2, Hit Count]
type = VarAdd
trigger1 = MoveHit = 1
trigger1 = !(HitDefAttr = SCA, AT)
var(13) = 1
[State -2, Hit Count Reset]
type = VarSet
trigger1 = NumEnemy && var(13)
trigger1 = (EnemyNear, MoveType != H) && (EnemyNear, StateNo != 5300)
var(13) = 0
ignoreHitPause = 1

[State -2, Juggle Count]
type=varadd
trigger1= movehit=1
trigger1= !(hitdefattr=SCA,AT)
var(15)=1
[State -2, Juggle Reset Single]
type=varset
triggerall= numenemy=1 && var(15)
trigger1= (enemy,statetype!=A) && ((enemy,stateno!=[5100,5109])||(enemy,statetype!=L)) && (enemy,time>=1)
trigger2= (enemy,movetype!=H) || (enemy,stateno=[120,155]) || (enemy,ctrl)
var(15)=0
ignorehitpause=1
[State -2, Juggle Reset Simul]
type=varset
triggerall= numenemy>=2 && var(15)
trigger1= (enemynear(0),statetype!=A) && (enemynear(0),time>=1)
trigger2= (enemynear(0),movetype!=H) || (enemynear(0),stateno=[120,155]) || (enemynear(0),ctrl)
trigger3= (enemynear(1),statetype!=A) && (enemynear(0),time>=1)
trigger4= (enemynear(1),movetype!=H) || (enemynear(0),stateno=[120,155]) || (enemynear(0),ctrl)
var(15)=0
ignorehitpause=1
[State -2, Free Juggling]
type=varset
trigger1= roundstate!=2
var(15)=0
ignorehitpause=1

[State -2, Juggle Flag]
type=varset
trigger1= numenemy && !var(16)
trigger1= (enemynear,stateno=5040) && !(enemynear,ctrl)
var(16)=1
ignorehitpause=1
[State -2, Juggle Flag Reset Single]
type=varset
triggerall= numenemy=1 && var(16)
trigger1= (enemy,movetype!=H) && (enemy,stateno!=5040)
trigger2= !(enemy,hitshakeover) || (enemy,statetype=L) || (enemy,ctrl)
trigger3= (enemy,movetype!=H) || (enemy,stateno=[120,155]) || (enemy,ctrl)
var(16)=0
ignorehitpause=1
[State -2, Juggle Flag Reset Simul]
type=varset
triggerall= numenemy>=2 && var(16)
trigger1= (enemynear(0),movetype!=H) && (enemynear(0),stateno!=5040)
trigger2= !(enemynear(0),hitshakeover) || (enemynear(0),statetype=L) || (enemynear(0),ctrl)
trigger3= (enemynear(1),movetype!=H) && (enemynear(1),stateno!=5040)
trigger4= !(enemynear(1),hitshakeover) || (enemynear(1),statetype=L) || (enemynear(1),ctrl)
trigger5= (enemynear,movetype!=H) || (enemynear,stateno=[120,155]) || (enemynear,ctrl)
var(16)=0
ignorehitpause=1

[State -2, Juggle Limit Single]
type=varadd
triggerall= (numenemy=1||numtarget=1) && Ifelse(var(22),time>50,time>2)
trigger1= ((enemy, stateno=5030)||(enemy, stateno=5071))&&(enemy, hitfall)&&(enemy,time=1)
trigger2= (enemy, stateno=5100)&&(enemy, prevstateno!=5050)&&(enemy, statetype=L)&&(enemy,time=1)
trigger4= (enemy, stateno=5110)&&(enemy, prevstateno!=5071)&&(enemy, statetype=L)&&(enemy,time=1)
trigger5= (enemy,movetype=H)&&(enemy, stateno!=[5000,5300])&&(enemy, vel y !=0)&&(enemy,time=1)
trigger6= (enemy,statetype=L)&&(enemy, stateno!=[5000,5300])&&(enemy,time=1)
fvar(8)=1
ignorehitpause=1
[State -2, Juggle Limit Simul]
type=varadd
triggerall= ((numenemy>=2)||(teammode=simul)||(enemy,teammode=simul)) && Ifelse(var(22),time>50,time>2)
trigger1= ((enemynear, stateno=5030)||(enemynear, stateno=5071))&&(enemynear, hitfall)&&(enemynear,time=1)
trigger2= (enemynear, stateno=5100)&&(enemynear, prevstateno!=5050)&&(enemynear, statetype=L)&&(enemynear,time=1)
trigger4= (enemynear, stateno=5110)&&(enemynear, prevstateno!=5071)&&(enemynear, statetype=L)&&(enemynear,time=1)
trigger5= (enemynear,movetype=H)&&(enemynear, stateno!=[5000,5300])&&(enemynear, vel y !=0)&&(enemynear,time=1)
trigger6= (enemynear,statetype=L)&&(enemynear, stateno!=[5000,5300])&&(enemynear,time=1)
fvar(8)=.5
ignorehitpause=1
[State -2, Juggle Limit Reset]
type=varset
triggerall= numenemy=1
trigger1= (enemynear,movetype!=H)&&(enemynear,statetype!=A||enemynear,statetype!=L) && (enemy,ctrl) && (enemy,time>=1)
trigger2= moveguarded
fvar(8)=0
ignorehitpause=1
[State -2, Juggle Limit Simul]
type=varset
triggerall= ((numenemy>=2)||(teammode=simul)||(enemy,teammode=simul))
trigger1= (enemynear,movetype!=H)&&(enemynear,statetype!=A||enemynear,statetype!=L) && (enemy,ctrl) && (enemy,time>=1)
trigger2= moveguarded
fvar(8)=0
ignorehitpause=1

[State -2, Custom Combo End]
type = VarSet
trigger1 = var(20) < 0
trigger2 = MoveType = H
trigger3 = RoundState != 2
trigger4 = (StateNo = [3000,4999])
var(20) = 0
ignoreHitPause=1
[State -2, Custom Combo Time]
type = VarAdd
trigger1 = var(20) > 0
var(20) = -1
ignoreHitPause = 1
[State -2, Custom Combo Asserts]
type = AssertSpecial
trigger1 = var(20) > 0
flag = NoStandGuard
flag2 = NoCrouchGuard
flag3 = NoAirGuard
ignoreHitPause = 1
[State -2, Custom Combo PalFX]
type = PalFX
trigger1 = var(20) > 60
time = 2
add = 32 + ceil(sin(var(20) / 16.0 * pi) * 32), 32 + ceil(sin(var(20) / 16.0 * pi) * 32), 32 + ceil(sin(var(20) / 16.0 * pi) * 32)
ignoreHitPause = 1
[State -2, Custom Combo PalFX]
type = PalFX
trigger1 = var(20) = [1,60]
time = 2
add = 64 + ceil(sin(var(20) / 8.0 * pi) * 64), 64 + ceil(sin(var(20) / 8.0 * pi) * 64), 64 + ceil(sin(var(20) / 8.0 * pi) * 64)
ignoreHitPause = 1

[State -2, Throws Disallowed]
type=varset
trigger1= 1
var(38)= 0
[State -2, Throws Disallowed]
type=varset
trigger1= (enemynear,stateno=[150,155])
trigger2= (enemynear,movetype=H && enemynear,statetype!=A) && !var(20) && !var(21) && !var(22)
trigger3= (enemynear,stateno=[5020,5040]) && !(enemynear,hitfall)
trigger4= ((enemynear,stateno=0) || (enemynear,stateno=52)) && (enemynear,prevstateno=[5000,5040]) && ((enemynear,time<=0) || !(enemynear,ctrl))
trigger5= (enemynear,stateno=0) && (enemynear,prevstateno=52) && ((enemynear,time<=0) || !(enemynear,ctrl))
trigger6= (enemynear,stateno=40) && (enemynear,time>=1 || enemynear,prevstateno=0 || enemynear,prevstateno=52)
trigger7= var(20)||Numhelper(3205)
var(38)= 1
;-------------------------------------------------------------------
[State -2, Voice Position]
type = SndPan
trigger1 = 1
channel = 0
pan = 0
ignoreHitPause = 1
;P2 wall hit---------------------------------------------------------------
[state -2,Bounce SND]
type = playsnd
trigger1 = (gametime%3 = 0) && P2movetype=H && p2stateno = 9060
trigger2 = (gametime%4 = 0) && P2movetype=H && p2stateno = 1227
trigger3 = P2movetype=H && p2stateno = 4061 && enemy,time=1
persistent = 0
ignorehitpause = 1
value = 669,0
volume = 255 - (13*time)
channel = 22

[State -2,screen]
type = ScreenBound
trigger1 = p2stateno=4020&&p2movetype=H
value = p2bodydist x < 30 && BackEdgeDist < 30
[State -2,screen]
type = ChangeState
triggerall = roundstate = 2
triggerall = Movetype != H && Stateno != 7827
trigger1 = BackEdgeDist < -10 -const(size.ground.front)-const(size.ground.back)
trigger1 = StateType != A
value = 7827

[State -2,SND]
type = PlaySnd
trigger1 = P2movetype=H && p2stateno = 4021 && enemynear,animelemtime(1)=1
value =5000,11
persistent = 0
ignorehitpause = 1

[State -2, Wall Impact Dust]
type = Helper
triggerall=!numhelper(8111) && numenemy
trigger1=P2movetype=H && p2stateno=1127 && enemy,time=1
trigger2=P2movetype=H && p2stateno=4061 && enemy,time=1
helperType = Normal
stateNo = 8111
ID = 8111
name = "Wall Impact Dust"
posType = P2
facing = -1
pos= floor(-5*const(size.xscale)),ceil(-70*const(size.yscale))
ownPal = 1
ignorehitpause=1

[State -2, Ground Impact Dust];Not used, but still added just incase...
type = null;Helper
trigger1 = NumTarget(635)
trigger1 = (Target(635), StateNo = 636) && !NumHelper(8110)
helperType = Normal
stateNo = 8110
ID = 8110
name = "Ground Impact Dust"
posType = P2
facing = -1
pos = 0,0
ownPal = 1
ignorehitpause=1
;=========================================================================
;Dampener
;=========================================================================
[State -2, Damage based on hits]
type=varset
triggerall= numenemy
trigger1= MoveHit = 1
trigger1=!moveguarded
trigger2=enemynear,movetype=H||enemynear,Statetype=L
fvar(12)=1
ignorehitpause=1
[State -2, Reset var when the opponent recovers]
type=varset
triggerall=numenemy
trigger1=enemynear,hitover && enemynear,hitshakeover && enemynear,ctrl=1
trigger1=enemynear,movetype!=H || enemynear,Statetype!=L || (enemynear,stateno!=[5000,5120])
trigger2= moveguarded
trigger3=(stateno=[810,860]) && movetype!=H
fvar(12)=0
ignorehitpause=1

[State -2, Control]
type = Varset
trigger1 = (ctrl||stateno=[0,110])&&fvar(12)
fvar(9) = 1
ignoreHitPause =1
[State -2, Control]
type = Varset
trigger1 = fvar(12)=0
fvar(9) = 0
ignoreHitPause =1

[State -2, combo]
type=varset
trigger1 = (stateno = [200,4999])&& movehit 
fvar(13)=Ifelse(fvar(12)=0,0,Ifelse((stateno = [200,999]),1,Ifelse((stateno = [1000,2999]),2,3)))
ignorehitpause=1

[State -2, Dampener - Normals]
type=varset
trigger1 = (stateno = [200,599]) && fvar(12) && (fvar(13)=[0,1])
fvar(10)= 0.8 * (Ifelse(var(13)<5,1.0,(1.00-(var(13)*.0125))))
ignorehitpause=1
[State -2, Dampener - Normals]
type=varset
trigger1 = (stateno = [600,999]) && fvar(12) && (fvar(13)=[0,1])
fvar(10)= 0.5 * (Ifelse(var(13)<5,1.0,(1.00-(var(13)*.025))))
ignorehitpause=1
[State -2, Dampener - Specials]
type=varset
trigger1 = (stateno = [1000,2999]) && fvar(12) && (fvar(13)=[0,2])
fvar(10)= Ifelse((prevstateno=[3000,4999]),0.5,Ifelse((prevstateno=[200,999])||fvar(10)!=1,0.75,1.0)) * (Ifelse(var(13)<12,1.0,(1.00-(var(13)*.025))))
ignorehitpause=1
[State -2, Dampener for Supers]
type = VarSet
trigger1 = (StateNo = [3000,4999])
fvar(10) = Ifelse(var(22),0.6,Ifelse(var(21), 0.75,Ifelse((prevstateno=[200,999]),.8, Ifelse(fvar(10)=1.0,1.0,fvar(10)))))* (Ifelse(var(13)<22,1.0,(1.00-(var(13)*.025))))
ignoreHitPause = 1

[State -2, Dampener - Custom Combo]
type=varset
trigger1= var(20)
fvar(10)= .72 * (10 - ifelse(var(13)>=12, 10, var(13))) / 10.0
ignorehitpause=1

[State -2, Dampener - Backup reset]
type=varset
trigger1=fvar(12)=0||var(20)
fvar(11)=0
ignorehitpause=1
[State -2, Backup Dampener]
type=varset
trigger1=fvar(9) && fvar(10)=1 && fvar(12) 
fvar(11)=1
ignorehitpause=1
[State -2, Backup Dampener - supers]
type=varset
trigger1 = fvar(11)
fvar(10)=0.6 * (Ifelse(var(13)<20,1.0,(1.00-(var(13)*.025))))
ignorehitpause=1

[State -2, Dampener for Safety]
type=varset
triggerall = numenemy
trigger1=fvar(9) && fvar(12)
trigger1=(enemynear,Statetype=L||(enemynear,stateno=[5100,5120]))
fvar(10)= Ifelse(fvar(10)>=0.7,0.7,0.6) * (Ifelse(var(13)<25,1.0,(1.00-(var(13)*.025))))
ignorehitpause=1

[State -2, Dampener Reset]
type = VarSet
trigger1 = fvar(12)=0
fvar(10) = 1
ignoreHitPause = 1
[State -2, Dampener Limit]
type=varset
trigger1= fvar(10)<0
fvar(10)=0
ignorehitpause=1
[State -2, Dampener itself]
type=attackmulset
trigger1= 1
value=fvar(10)
ignorehitpause=1
;----------------------------------------------------------
[State -2, Debug]
trigger1 = 1
type = DisplayToClipboard
ignorehitpause = 1
text = "Damp = %d Limit = %d juggle = %d hit = %d  Front =%d Back = %d"
params = fvar(10) , fvar(8), var(15) , var(13) , frontedgebodydist , backedgebodydist
ignorehitpause=1
[State -2, Debug 2]
type = AppendToClipboard
trigger1 = 1
text = "\nBy QuickFist"
ignoreHitPause = 1
;---------------------------------------------------------------------------
; States that are executed when in self's state file (use statedef -3)
;---------------------------------------------------------------------------

[Statedef -3]

[State -3,veladd]
type = Veladd
triggerall= !AILevel&&roundstate=2&&command = "holdfwd"&& prevstateno = 123
trigger1 = stateno = 50
x = .1
[State state-3,veladd]
type = Veladd
triggerall= !AILevel&&roundstate=2&&command = "holdback"&& prevstateno = 123
trigger1 = stateno = 50
x = -.1
[State -3,veladd]
type = Veladd
triggerall = (AILevel)&& prevstateno = 123&&(enemy,vel y < -1)&&(p2bodydist x >= 45)&& p2movetype != A
trigger1 = p2statetype = A
x = .2

[State -3, Corner Push]
type=VarSet
triggerAll=fvar(5)
trigger1=abs(fvar(5)) <= (1 / 0.85)
trigger2=NumTarget
trigger2=Target, GetHitVar(HitTime) <= 0 || (Target, GetHitVar(HitShakeTime) > 0 && Target, Time <= 0)
fvar(5)=0
[State -3, Corner Push]
type=VarSet
trigger1=NumTarget
trigger1=Target, GetHitVar(HitShakeTime) <= 0
fvar(5)=fvar(5) * 0.85
[State -3, Corner Push]
type=VarSet
triggerall=movetype != H
trigger1=MoveContact=1 && NumTarget
fvar(5)=Target, GetHitVar(xVel)
ignoreHitPause=1
[State -3, Corner Push]
type=PosAdd
triggerAll=fvar(5)
triggerAll=(StateType=S || StateType=C) && NumTarget
triggerAll=!HitPauseTime && Target, GetHitVar(HitShakeTime) <= 1
triggerAll=(Target, StateType=S || Target, StateType=C) && !(Target, GetHitVar(yVel)) && !(Target, HitFall)
trigger1=Target, FrontEdgeBodyDist <= 0 && (Target, GetHitVar(xVel) * Target, Facing) > 0
trigger2=Target, BackEdgeBodyDist <= 0 && (Target, GetHitVar(xVel) * Target, Facing) < 0
x=ifElse(Target, FrontEdgeBodyDist <= 0, -1, 1) * (Target, Facing) * fvar(5)

[State -3, Chain Combo Reset]
type=VarSet
trigger1=1
var(4)=0
ignoreHitPause=1
[State -3, Chain Combo Check]
type=VarSet
trigger1=var(20) && (StateNo=[200,699]) && MoveContact
trigger2=var(20) && (StateNo=[1000,2999]) && MoveContact
var(4)=1
ignoreHitPause=1

[State -3, Cheap KO]
type=ChangeState
trigger1=!Alive && (StateNo=[5000,5010])
trigger1=(PrevStateNo=[130,131]) || (PrevStateNo=[140,141]) || (PrevStateNo=[150,153])
value=5950
ignoreHitPause=1
[State -3, Assert: NoKOsnd (Cheap KO)]
type=AssertSpecial
trigger1=(StateNo=[5000,5010])
trigger1=(PrevStateNo=[130,131]) || (PrevStateNo=[140,141]) || (PrevStateNo=[150,153])
flag=NoKOsnd
ignoreHitPause=1

[State -3, Get Hit Sound]
type=PlaySnd
triggerAll=Alive && Time=1
triggerAll=StateNo=5000 || StateNo=5010
trigger1=GetHitVar(AnimType) >= 2 && Random < 500
trigger2=GetHitVar(AnimType)=1 && Random < 375
trigger3=GetHitVar(AnimType)=0 && Random < 250
value=5000,(Random % 2)
channel=0
ignoreHitPause=1
[State -3, Get Hit Sound]
type =PlaySnd
triggerAll=Alive && Time=1
trigger1=(StateNo=5000 || StateNo=5010) && NumEnemy
trigger1=GetHitVar(fall) || (EnemyNear, HitDefAttr=SCA,SA,HA)
trigger2=(StateNo=5020 || StateNo=5070 || StateNo=5080)
trigger3=(StateNo=5050 || StateNo=5100) && (PrevStateNo != [5000,5199])
value=5000,2
channel=0
ignoreHitPause=1

[State -3, Special Cancel Reset]
type=VarSet
trigger1=1
var(5)=0
ignoreHitPause=1
[State -3, Special Cancel Check]
type=VarSet
trigger1 = (stateno = [200,699]) && Time <= 2
trigger2 = (stateno = [200, 250]) && movecontact && stateno!=221 && var(55)
trigger3 = (stateno = [400, 440]) && movecontact
trigger4 = var(20) && stateno = 1000 && animelemtime(12) > 1
trigger5 = var(20) && stateno = 1010 && animelemtime(1) > 1
trigger6 = var(20) && stateno = 1050 && animelemtime(6) > 1
trigger7 = var(20) && stateno = 1100 && movecontact
trigger8 = var(20) && (stateno =  [1200,1300]) && movecontact
trigger9 = var(20) && (stateno = 450) && movecontact
trigger10 = (stateno = [200, 250]) && movecontact && stateno!=221 && !var(55)
trigger10 = anim!=220
var(5)=1
ignoreHitPause=1

[State -3, Super Cancel Reset]
type=VarSet
trigger1=1
var(6)=0
ignoreHitPause=1
[State -3, Super Cancel Check]
type=VarSet
trigger1 = (stateno = [200,699]) && Time <= 2
trigger2 = (stateno = [200,450]) && movecontact
trigger3 = ((stateno = 1100)||(stateno = 1150)) && movecontact
trigger4 = ((stateno = 1200)||(stateno = 1250)) && movecontact
var(6)=1
ignoreHitPause=1

[State -3, MAX Cancel Reset]
type=VarSet
trigger1=1
var(7)=0
ignoreHitPause=1
[State -3, MAX Cancel Check]
type=VarSet
trigger1 = stateno = 3000 && animelemtime(19) > 1 
trigger2 = stateno = 3100 && animelemtime(15) > 1 
trigger3 = stateno = 3200 && animelemtime(14) > 0 && (movehit = [1, 16])
var(7)=1
ignoreHitPause=1

[State -3, Super Cancel Flag Reset]
type = varset
trigger1 = var(21)
trigger1 = (stateno != [3000, 4999]) || movetype = H
var(21) = 0
ignorehitpause = 1
[State -3, Hyper Cancel Flag Reset]
type = varset
trigger1 = var(22)
trigger1 = (stateno != [3000, 4999]) || movetype = H
var(22) = 0
ignorehitpause = 1


[State -3, TargetBind]
type=TargetBind
trigger1=MoveHit=1
trigger1=NumTarget && NumEnemy
trigger1=(Target, Time <= 1) && (Target, ID=EnemyNear, ID)
trigger1=!(Target, HitShakeOver) && (Target, HitFall) && (Target, pos y > 0)
pos=ceil(p2Dist x), 0
ignoreHitPause=1
[State -3, Prevent Crossup]
type=Width
trigger1=1
edge=8,0
ignoreHitPause=1
[State -3, Variable Height]
type=PlayerPush
triggerAll=StateType=A && MoveType != H && NumEnemy
triggerAll=P2BodyDist x=[-(EnemyNear, const(size.ground.back) + EnemyNear, const(size.ground.front)), 0]
trigger1=P2StateType=S
trigger1=P2Dist y >= (EnemyNear, const(size.height) - 12)
trigger2=P2StateType=C
trigger2=P2Dist y >= (EnemyNear, const(size.height) - 28)
trigger3=P2StateType=L
trigger3=P2Dist y >= 12
value=0
ignoreHitPause=1

[State -3, EX FX Decrement]
type=VarAdd
trigger1=var(25) > 0
var(25)=-1
[State -3, EX FX Reset]
type=VarSet
trigger1=(StateNo != [1000,2999]) || MoveType=H
var(25)=0
[State -3, EX Flash]
type=PalFX
trigger1=!(GameTime % 2) && var(25)
time=1
color=0
mul=256, 224, 0
add=128, 128, 128
ignoreHitPause=1

[State -3, Movement AfterImage]
type=AfterImage
triggerAll=Time=1 && !var(20)
trigger1=StateNo=50 && (var(3)=2 || var(3)=3) && PrevStateNo!=123
trigger2=(StateNo=[700,715])
trigger3=StateNo=5950
trigger4=StateNo=50 && PrevStateNo=123
time=2
timeGap=1
frameGap=4
length=9
palBright=0,0,0
palContrast=128,128,128
palPostBright=0,0,0
palAdd=0,0,0
palMul=0.9,0.9,0.9
trans=Add1

[State -3, Level 1 Super AfterImage]
type=AfterImage
trigger1=StateNo=3000 && Time=43
trigger2=(StateNo=[3100,3110]) && Time=3
trigger3=(StateNo=3200) && Time=43
trigger4=(StateNo=[3300,3310]) && Time=3
time=2
timeGap=1
frameGap=10
length=21
palBright=0,0,0
palContrast=128,128,128
palPostBright=0,0,0
palAdd=0,0,0
palMul=0.75,0.75,0.75
trans=Add1

[State -3, Level 2 Super AfterImage]
type=AfterImage
trigger1=StateNo=3050 && Time=43
trigger2=(StateNo=[3150,3160])&& Time=3
trigger3=(StateNo=3250) && Time=43
trigger4=(StateNo=[3350,3360]) && Time=43
time=2
timeGap=1
framegap=10
length=21
palBright=0,0,0
palContrast=32,32,160
palPostBright=0,0,0
palAdd=0,0,0
palMul=0.75,0.75,0.75
trans=Add1

[State -3, Level 3 Super AfterImage]
type=AfterImage
trigger1=StateNo=3400 && Time=43
trigger2=StateNo=3500 && Time=43
time=2
timeGap=1
frameGap=10
length=21
palBright=0,0,0
palContrast=160,32,32
palPostBright=0,0,0
palAdd=0,0,0
palMul= 0.75,0.75,0.75
trans=Add1

[State -3, AfterImage Persist]
type=AfterImageTime
trigger1=StateNo=50 || (StateNo=[600,699])
trigger1=(var(3)=2 || prevstateno=123 || var(3)=3) && vel y < -1
trigger2=var(20)
trigger3=StateNo=[700,715]
trigger4=(StateNo=[3000,4999])
time=2

[State -3, AfterImage Off]
type=AfterImageTime
triggerAll=Time <= 1
trigger1=StateNo=3000 || StateNo=3050 ||Stateno=3100 || StateNo=3101 
trigger2=Stateno=3200 
time=0

[State -3, Special Finish]
type = Helper
triggerall = roundstate >= 2
triggerall = WinKo && NumHelper(8600)=0 &&!var(20)
trigger1 = (stateno = [1000, 2999])&&movetype!=H
ID = 8600
stateno = 8600
postype = back
pos = 0,0
pausemovetime = 999999
supermovetime = 999999
ignorehitpause = 1
ownpal = 1
persistent=0

[State -3, Custom Combo Finish]
type = Helper
triggerAll = WinKO && var(20)
triggerAll = RoundState = 3 && !NumHelper(8600)
trigger1 = MoveHit = [1,4]
trigger2 = NumHelper(1305)
trigger2 = (Helper(1305), StateNo = [1305,1307]) && (Helper(1305), var(18))
trigger3 = (StateNo = [200,1999])
helperType = Normal
stateNo = 8605
ID = 8600 + 0 * (var(23) := 900)
name = "Super Finish"
posType = left
pos = 160, -120
ownPal = 1
size.xscale =1.0
size.yscale =1.0
pauseMoveTime = 255
superMoveTime = 255
ignoreHitPause = 1

[State -3, Super Finish]
type = Helper
triggerAll = WinKO
triggerAll = RoundState = 3 && !NumHelper(8600)
trigger1 = MoveHit = 1 && (StateNo = [3000,4999])
trigger1 = var(23) := StateNo
trigger2 = (StateNo = [3000,3099])
trigger2 = var(23) := 3000
trigger3 = (StateNo = [3100,3199])
trigger3 = var(23) := 3100
trigger4 = (StateNo = [3200,3299])
trigger4 = var(23) := 3200
trigger5 = (StateNo = [3300,3399])
trigger5 = var(23) := 3300
trigger6 = StateNo = [3400,3499]
trigger6 = var(23) := 3400
trigger7 = (StateNo = [3500,3599])
trigger7 = var(23) := 3500
helperType = Normal
stateNo = 8605
ID = 8600
name = "Super Finish"
posType = left
pos = 160,-120
ownPal = 1
size.xscale =1.0
size.yscale =1.0
pauseMoveTime = 255
superMoveTime = 255
ignoreHitPause = 1
