; _________________________________________
;| B.B. Hood by Jmorphman                  |
; ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
;==============================================================================================
;=======================================<SYSTEM STATES>========================================
;==============================================================================================

;====================<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, Skywalker]
type = ChangeState
triggerall = pos y < 0
trigger1 = !NumEnemy
trigger2 = NumEnemy = 1
trigger2 = (Enemy, Name = "M -NES Game 1" + Enemy, Name = "M -NES Game 2" + Enemy, Name = "M -GB Game 1" + Enemy, AuthorName = "Bane84") < 2
trigger3 = Numenemy >= 2
trigger3 = (Enemy(0), Name = "M -NES Game 1" + Enemy(0), Name = "M -NES Game 2" + Enemy(0), Name = "M -GB Game 1" + Enemy(0), AuthorName = "Bane84") < 2
trigger3 = (Enemy(1), Name = "M -NES Game 1" + Enemy(1), Name = "M -NES Game 2" + Enemy(1), Name = "M -GB Game 1" + Enemy(1), AuthorName = "Bane84") < 2
value = 50

[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, Reversed Commands: change to jumping]
type = ChangeState
trigger1 = !Time
trigger1 = NumExplod(92828282) || NumExplod(92468246) && command = "holddown"
value = 40

[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

[State 11, Voice]
type = PlaySnd
trigger1 = Anim = 11 && AnimElem = 5
value = 4,11
channel = 0

[State 11, Flowers]
type = Helper
trigger1 = Anim = 11 && AnimElem = 1 && !NumHelper(10011)
helperType = Normal
stateNo = 10011
ID = 10011
posType = P1
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
name = "Flowers (Crouching)"
ownPal = 1


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

[State 12, Reversed Commands: change to "fake" crouch state]
type = ChangeState
trigger1 = !Time
trigger1 = (NumExplod(92828282) || NumExplod(92468246)) && command = "holdup"
value = 13

[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


;"Fake" crouch state (for reversed commands)
[StateDef 13]
type = C
physics = C
moveType = I
velSet = 0,0
sprPriority = 0
ctrl = 1

[State 13, Voice]
type = PlaySnd
trigger1 = Anim = 11 && AnimElem = 5
value = 4,11
channel = 0

[State 13, ChangeAnim]
type = ChangeAnim
trigger1 = Anim != 10 && Anim != 11 && Anim != 141
value = 10

[State 13, ChangeAnim]
type = ChangeAnim
trigger1 = Anim = 10 && !AnimTime
trigger2 = Anim = 141 && !AnimTime
value = 11

[State 13, Flowers]
type = Helper
trigger1 = Anim = 11 && AnimElem = 1 && !NumHelper(10011)
helperType = Normal
stateNo = 10011
ID = 10011
posType = P1
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
name = "Flowers (Crouching)"
ownPal = 1



;====================<WALKING>====================
[StateDef 20]
type = S
physics = N
moveType = I
sprPriority = 0

[State 20, VelSet]
type = VelSet
trigger1 = !NumExplod(94646464) && !NumExplod(92468246)
trigger1 = command = "holdfwd"
trigger2 = NumExplod(94646464) || NumExplod(92468246)
trigger2 = command = "holdback"
x = const(velocity.walk.fwd.x) * const(size.xScale)

[State 20, VelSet]
type = VelSet
trigger1 = !NumExplod(94646464) && !NumExplod(92468246)
trigger1 = command = "holdback"
trigger2 = NumExplod(94646464) || NumExplod(92468246)
trigger2 = command = "holdfwd"
x = const(velocity.walk.back.x) * const(size.xScale)

[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

[State 20, Voice]
type = PlaySnd
trigger1 = Anim = 20 && AnimElem = 4
value = 20,0
channel = 0



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

[State 40, Reversed Commands: change to "fake" crouch state]
type = ChangeState
trigger1 = !Time
trigger1 = (NumExplod(92828282) || NumExplod(92468246)) && command = "holdup"
value = 13

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

[State 40, Direction]
type = VarSet
trigger1 = !AILevel
trigger1 = !NumExplod(94646464) && !NumExplod(92468246)
sysvar(1) = ifElse(!Time, 0, ifElse(command = "holdfwd", 1, ifElse(command = "holdback", -1, sysvar(1))))

[State 40, Direction (Reversed Commands)]
type = VarSet
trigger1 = !AILevel
trigger1 = NumExplod(94646464) || NumExplod(92468246)
sysvar(1) = ifElse(!Time, 0, ifElse(command = "holdback", 1, ifElse(command = "holdfwd", -1, sysvar(1))))

[State 40, Direction (AI)]
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
;ifElse(command = "highjump", 3, 0)
var(3) = 0;ifElse(NumExplod(90000408), 3, 0)

;[State 40, High Jump (AI)]
;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 = !NumExplod(92828282) && !NumExplod(92468246)
;trigger1 = !AILevel && command != "holdup" && (var(3) != [1,2])
;trigger2 = NumExplod(92828282) || NumExplod(92468246)
;trigger2 = !AILevel && command != "holddown" && (var(3) != [1,2])
;var(3) = ifElse((var(3) = 3 && sysvar(1)), 2, 1)

;[State 40, Low Jump (AI)]
;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, Jump Sound]
type = PlaySnd
trigger1 = !AnimTime
value = ifElse((var(3) = [2,3]), 41, 40), 0

[State 40, Dust Helper]
type = Helper
trigger1 = !AnimTime
helperType = Normal
stateNo = 8100
ID = 8100
name = "Jump Dust"
posType = P1
ownPal = 1

[State 40, Velocity: Normal Jump]
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))) * const(size.xScale)
y = ifElse(!sysvar(1), const(velocity.jump.y), ifElse(sysvar(1) = 1, -8.28125, -8.59375))

[State 40, Velocity: Low Jump]
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))) * const(size.xScale)
y = 0.75 * ifElse(!sysvar(1), const(velocity.jump.y), ifElse(sysvar(1) = 1, -8.28125, -8.59375))

[State 40, Velocity: Long Low Jump]
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))) * const(size.xScale)
y = 0.75 * ifElse(!sysvar(1), const(velocity.jump.y), ifElse(sysvar(1) = 1, -8.28125, -8.59375))

[State 40, Velocity: Long Jump]
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))) * const(size.xScale)
y = ifElse(!sysvar(1), const(velocity.runjump.y), ifElse(sysvar(1) = 1, -8.28125, -8.59375))

[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, Double Jump]
type = ChangeState
trigger1 = !var(3) && Time > 1
trigger1 = NumExplod(90000057) || NumExplod(90000058) || NumExplod(90000059)
value = 55

[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
ignoreHitPause = 1

[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, VelAdd]
type = VelAdd
trigger1 = vel x
trigger1 = Time > 1 || PrevStateNo != 40
x = ifElse((var(3) = [2,3]), -0.04577636719, -0.03051757813) * ifElse(vel x < 0, -1, 1) * const(size.xScale)

[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 = Time > 0

[State 51, VelAdd]
type = VelAdd
trigger1 = vel x
trigger1 = Time >= 1 || PrevStateNo != 40
x = ifElse((var(3) = [2,3]), -0.04577636719, -0.03051757813) * ifElse(vel x < 0, -1, 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
;ctrl && command = "holdback"
trigger1 = ctrl && (ifElse(!NumExplod(94646464) && !NumExplod(92468246), ifElse(P2dist x < 0, command = "holdfwd", command = "holdback"), ifElse(P2dist x < 0, command = "holdback", command = "holdfwd")))
trigger1 = InGuardDist && (PrevStateNo != [600,699])
value = 120

[State 52, Assert: NoWalk]
type = AssertSpecial
trigger1 = Anim != 5
flag = NoWalk
ignoreHitPause = 1

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

[State 52, Landing Dust Explod]
type = Explod
trigger1 = !Time
anim = 8102
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



;=================<DOUBLE JUMP>=================
[StateDef 55]
type = A
physics = N
moveType = I
ctrl = 0
sprPriority = 1

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

[State 55, PosFreeze]
type = PosFreeze
trigger1 = Time <= 6
value = 1
ignoreHitPause = 1

[State 55, Direction]
type = VarSet
trigger1 = !AILevel
trigger1 = !NumExplod(94646464) && !NumExplod(92468246)
sysvar(1) = ifElse(!Time, 0, ifElse(command = "holdfwd", 1, ifElse(command = "holdback", -1, sysvar(1))))

[State 55, CtrlSet]
type = CtrlSet
trigger1 = Time = 7
value = 1

[State 55, Velocity: Normal Jump]
type = VelSet
trigger1 = Time = 7
x = ifElse(!sysvar(1), const(velocity.jump.neu.x), ifElse(sysvar(1) = 1, const(velocity.jump.fwd.x), const(velocity.jump.back.x))) * const(size.xScale)
y = ifElse(!sysvar(1), const(velocity.jump.y), ifElse(sysvar(1) = 1, -8.28125, -8.59375))

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

[State 55, Gravity]
type = Gravity
trigger1 = Time > 7

[State 55, VelAdd]
type = VelAdd
trigger1 = vel x
trigger1 = Time > 7
x = ifElse((var(3) = [2,3]), -0.04577636719, -0.03051757813) * ifElse(vel x < 0, -1, 1) * const(size.xScale)

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



;=================<DASH FORWARD>=================
[StateDef 100]
type = S
physics = N
moveType = I
anim = 100
ctrl = 0
sprPriority = 1

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

[State 100, Dash Sound]
type = PlaySnd
trigger1 = !Time
value = 100,1

[State 100, Step Sound]
type = PlaySnd
trigger1 = (AnimElem = 4 || AnimElem = 7)
value = 100, ifElse((AnimElem = 4), 2, 3)

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

[State 100, Dash Lines FX (Top layer)]
type = Explod
trigger1 = !Time
anim = 10100
ID = 10100
sprPriority = 3
posType = P1
scale = const(size.xScale) * 0.5, 0.5
bindTime = -1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 100, Dash Lines FX (Bottom layer)]
type = Explod
trigger1 = !Time
anim = 20100
ID = 20100
sprPriority = 3
posType = P1
scale = const(size.xScale) * 0.5, 0.5
bindTime = -1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 100, VelSet]
type = VelSet
trigger1 = !Time
x = 7.44140625 * const(size.xScale)

[State 100, VelSet]
type = VelAdd
trigger1 = Time > 0
x = -0.0732421875 * const(size.xScale)

[State 100, End]
type = ChangeState
trigger1 = !AnimTime
trigger2 = (Facing = 1 && NumExplod(90000004)) || (Facing = -1 && NumExplod(90000006))
value = 0
ctrl = 1



;========================<DASH BACKWARDS>==========================
[StateDef 105]
type = S
physics = N
moveType = I
velSet = 0,0
anim = 105
ctrl = 0
sprPriority = 1

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

[State 105, Dash Sound]
type = PlaySnd
trigger1 = !TIme
value = 105,1

[State 105, Step Sound]
type = PlaySnd
trigger1 = (AnimElem = 4 || AnimElem = 8)
value = 100, ifElse((AnimElem = 4), 2, 3)

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

[State 105, Dash Lines FX (Top layer)]
type = Explod
trigger1 = !Time
anim = 10105
ID = 10105
sprPriority = 3
posType = P1
scale = const(size.xScale) * 0.5, 0.5
bindTime = -1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 105, Dash Lines FX (Bottom layer)]
type = Explod
trigger1 = !Time
anim = 20105
ID = 20105
sprPriority = 3
posType = P1
scale = const(size.xScale) * 0.5, 0.5
bindTime = -1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 105, VelSet]
type = VelSet
trigger1 = !Time
x = -6.201171875 * const(size.xScale)

[State 105, VelSet]
type = VelAdd
trigger1 = Time > 0
x = 0.06103515625 * const(size.xScale)

[State 105, End]
type = ChangeState
trigger1 = !AnimTime
trigger2 = (Facing = 1 && NumExplod(90000006)) || (Facing = -1 && NumExplod(90000004))
value = 0
ctrl = 1



;====================<DODGE>====================
[StateDef 700]
type = S
physics = S
moveType = I
anim = 700
ctrl = 0
velSet = 0,0
sprPriority = -2

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

[State 700, Dodge Sound]
type = PlaySnd
trigger1 = !Time
value = 1,3
channel = 1

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

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

[State 700, Attack]
type = ChangeState
trigger1 = !AILevel && Time = [15,25]
;command = "x" || command = "y" || command = "z" || command = "a" || command = "b" || command = "c"
trigger1 = NumExplod(90000200) || NumExplod(90000210) || NumExplod(90000220) || NumExplod(90000230) || NumExplod(90000240) || NumExplod(90000250)
;ifElse((command = "x" || command = "y" || command = "z"), 220, 245)
value = ifElse((NumExplod(90000200) || NumExplod(90000210) || NumExplod(90000220)), 215, 240)

[State 700, Attack (AI)]
type = ChangeState
trigger1 = AILevel && (Time = [15,25]) && NumEnemy
trigger1 = (EnemyNear, MoveType != A) && (P2BodyDist x = [-60,60]) && (P2Dist y >= -60)
value = ifElse(Random < 666, 215, 240)

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



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

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

[State 710, HitBy]
type = HitBy
trigger1 = AnimElemTime(7) < 0
value = SCA,AT
time = 1

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

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

[State 710, VelSet]
type = VelSet
trigger1 = AnimElem = 2
x = 8.125

[State 710, VelSet]
type = VelSet
trigger1 = AnimElem = 9
x = 0

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



;===============<ROLL BACKWARDS>===============
[StateDef 715]
type = S
physics = N
moveType = I
anim = 715
ctrl = 0
velSet = 0,0
sprPriority = 1

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

[State 715, HitBy]
type = HitBy
trigger1 = AnimElemTime(9) < 0
value = SCA,AT
time = 1

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

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

[State 715, VelSet]
type = VelSet
trigger1 = AnimElem = 3
x = -8.125

[State 715, VelSet]
type = VelSet
trigger1 = AnimElem = 10
x = 0

[State 715, 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, Button]
type = VarSet
trigger1 = !Time && !AILevel
;(command = "412k")
var(10) = NumExplod(90000230) || NumExplod(90000235) || NumExplod(90000240) || NumExplod(90000245) || NumExplod(90000250) || NumExplod(90000255)
ignoreHitPause = 1

[State 750, Button (AI)]
type = VarSet
trigger1 = !Time && AILevel
var(10) = ifElse((P2StateType = A), 0, ifElse((P2StateType = C), 1, ifElse(Random < 500, 0, 1)))
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 = 4,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 = 22, -65
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, 2910, 2900)



;====================<LYING DOWN>====================
;MUGEN default lie down state override
[StateDef 5110]
type = L
moveType = H
physics = N

[State 5110, ChangeState]
type = ChangeState
trigger1 = 1
value = 5111
ignoreHitPause = 1


;Actual lie down state to prevent early wakeup
[StateDef 5111]
type = L
moveType = H
physics = N

[State 5111, FallEnvShake]
type = FallEnvShake
trigger1 = !Time

[State 5111, ChangeAnim]
type = ChangeAnim
trigger1 = SelfAnimExist(5110 + (Anim % 10))
trigger1 = Anim = [5081, 5089]
value = 5110 + (Anim % 10)
persistent = 0

[State 5111, ChangeAnim]
type = ChangeAnim
triggerAll = !Time
triggerAll = Anim != [5110, 5119]
trigger1 = Anim != [5161, 5169]
trigger2 = !SelfAnimExist(5170 + (Anim % 10))
value = 5170

[State 5111, ChangeAnim]
type = ChangeAnim
triggerAll = Anim != [5110, 5119]
trigger1 = !Time
trigger1 = Anim = [5161, 5169]
trigger1 = SelfAnimExist(5170 + (Anim % 10))
value = 5170 + (Anim % 10)

[State 5111, HitFallDamage]
type = HitFallDamage
trigger1 = !Time

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

[State 5111, VarSet]
type = VarSet
trigger1 = !Time
trigger1 = GetHitVar(fall.yVel) != 0
sysvar(1) = floor(vel y)

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

[State 5111, Explod]
type = Explod
trigger1 = !Time
trigger1 = !sysvar(0)
anim = F(60 + (sysvar(1) > Const720p(20)) + (sysvar(1) > Const720p(56)))
pos = 0, 0
sprPriority = ifelse (sysvar(1) <= Const720p(56), -10, 10)

[State 5111, VelSet]
type = VelSet
trigger1 = !Time
y = 0

[State 5111, ChangeAnim]
type = ChangeAnim
triggerAll = Anim = [5171, 5179]
triggerAll = SelfAnimExist(5110 + (Anim % 10))
trigger1 = !AnimTime
trigger2 = sysvar(0)
value = 5110 + (Anim % 10)
persistent = 0

[State 5111, ChangeAnim]
type = ChangeAnim
triggerAll = Anim != [5111, 5119]
trigger1 = !AnimTime
trigger2 = sysvar(0)
value = 5110
persistent = 0

[State 5111, Dead]
type = ChangeState
triggerAll = !Alive
trigger1 = !AnimTime
trigger2 = sysvar(0)
trigger3 = Anim = [5110, 5119]
value = 5150

[State 5111, VarSet]
type = VarSet
trigger1 = sysvar(0)
trigger1 = !Time
sysvar(0) = 0

[State 5111, VelMul]
type = VelMul
trigger1 = 1
x = 0.85

[State 5111, VelSet]
type = VelSet
trigger1 = abs(vel x) < const(movement.down.friction.threshold)
x = 0
persistent = 0

[State 5111, Strategic Wake-Up Detection Reset]
type = VarSet
trigger1 = !Time
var(14) = 0

[State 5111, Forward]
type = VarSet
triggerAll = (!var(14) || AILevel)
trigger1 = !AILevel
trigger1 = (Facing = 1 && NumExplod(90000006)) || (Facing = -1 && NumExplod(90000004))
;x / y / z / a / b / c
trigger1 = NumExplod(90000200) || NumExplod(90000205) || NumExplod(90000210) || NumExplod(90000215) || NumExplod(90000220) || NumExplod(90000225) || NumExplod(90000230) || NumExplod(90000235) || NumExplod(90000240) || NumExplod(90000245) || NumExplod(90000250) || NumExplod(90000255)
trigger2 = AILevel
trigger2 = Random < (250 * (AILevel ** 2 / 64.0))
var(14) = 5121

[State 5111, Backward]
type = VarSet
triggerAll = (!var(14) || AILevel)
trigger1 = !AILevel
trigger1 = (Facing = 1 && NumExplod(90000004)) || (Facing = -1 && NumExplod(90000006))
;x / y / z / a / b / c
trigger1 = NumExplod(90000200) || NumExplod(90000205) || NumExplod(90000210) || NumExplod(90000215) || NumExplod(90000220) || NumExplod(90000225) || NumExplod(90000230) || NumExplod(90000235) || NumExplod(90000240) || NumExplod(90000245) || NumExplod(90000250) || NumExplod(90000255)
trigger2 = AILevel
trigger2 = Random < (250 * (AILevel ** 2 / 64.0))
var(14) = 5122

[State 5111, Strategic Wake-Up]
type = ChangeState
triggerAll = Alive
trigger1 = var(14) = [5000,5999]
trigger1 = Time = const(data.lieDown.time)
value = 5121

[State 5111, Get up]
type = ChangeState
triggerAll = Alive
trigger1 = Time = const(data.lieDown.time)
value = 5120



;====================<GET UP FROM LIE DOWN>====================
[StateDef 5120]
type = L
moveType = I
physics = N

[State 5120, ChangeAnim]
type = ChangeAnim
triggerAll = !Time
trigger1 = Anim != [5111,5119]
trigger2 = !SelfAnimExist(5120 + (Anim % 10))
value = 5120

[State 5120, ChangeAnim]
type = ChangeAnim
triggerAll = !Time
trigger1 = Anim = [5111,5119]
trigger1 = SelfAnimExist(5120 + (Anim % 10))
value = 5120 + (Anim % 10)

[State 5120, VelSet]
type = VelSet
trigger1 = !Time
x = 0

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

[State 5120, HitFallSet]
type = HitFallSet
trigger1 = !AnimTime && Anim = 47
value = 1

[State 5120, NotHitBy]
type = NotHitBy
trigger1 = !AnimTime && Anim = 47
value = , NT,ST,HT
time = 12

[State 5120, NotHitBy]
type = NotHitBy
trigger1 = !AnimTime && Anim = 47
value2 = SCA
time = 3

[State 5120, StateTypeSet: Air, Physics: None]
type = StateTypeSet
trigger1 = Anim = 5120
trigger1 = AnimElem = 4
stateType = A
physics = N

[State 5120, Dust Helper]
type = Helper
trigger1 = Anim = 5120
trigger1 = AnimElem = 4
helperType = Normal
stateNo = 8100
ID = 8100
name = "Get Up Dust"
posType = P1
ownPal = 1

[State 5120, VelSet]
type = VelSet
trigger1 = AnimElem = 5
y = -6.666660309

[State 5120, VelAdd]
type = VelAdd
trigger1 = AnimElemTime(5) > 0 && AnimElemTime(9) < 0
y = 0.9259223938

[State 5120, StateTypeSet: Stand, Physics: Stand]
type = StateTypeSet
trigger1 = AnimElem = 9
stateType = S
physics = S

[State 5120, VelSet]
type = VelSet
trigger1 = AnimElem = 9
y = 0

[State 5120, PosSet]
type = PosSet
trigger1 = AnimElem = 9
y = 0

[State 5120, Landing Dust Explod]
type = Explod
trigger1 = AnimElem = 9
anim = 8102
sprPriority = -3
posType = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1

[State 5120, Landing Sound]
type = PlaySnd
trigger1 = AnimElem = 9
value = 52,0
channel = 1

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



;====================<STRATEGIC WAKE-UP>====================
[StateDef 5121]
type = L
moveType = I
physics = N
anim = var(14)

[State 5121, VelSet]
type = VelSet
trigger1 = !Time
x = 0

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

[State 5121, PlayerPush]
type = PlayerPush
trigger1 = Anim = [5121,5122]
value = 0
ignoreHitPause = 1

[State 5121, HitFallSet]
type = HitFallSet
trigger1 = !AnimTime && AnimElemTime(8) >= 0
value = 1

[State 5121, NotHitBy]
type = NotHitBy
trigger1 = !AnimTime && AnimElemTime(8) >= 0
value = , NT,ST,HT
time = 12

[State 5121, NotHitBy]
type = NotHitBy
trigger1 = !AnimTime && AnimElemTime(8) >= 0
value2 = SCA
time = 3

[State 5121, StateTypeSet: Air, Physics: None]
type = StateTypeSet
trigger1 = Anim = [5121,5122]
trigger1 = AnimElem = 2
stateType = A
physics = N

[State 5121, Dust Helper]
type = Helper
trigger1 = Anim = [5121,5122]
trigger1 = AnimElem = 2
helperType = Normal
stateNo = 8100
ID = 8100
name = "Get Up Dust"
posType = P1
ownPal = 1

[State 5121, VelSet]
type = VelSet
trigger1 = Anim = [5121,5122]
trigger1 = AnimElem = 2
x = ifElse(var(14) = 5121, 7.5, -7.5) * const(size.xScale)
y = -4.583339691

[State 5121, VelAdd]
type = VelAdd
trigger1 = Anim = [5121,5122]
trigger1 = AnimElemTime(2) > 0 && AnimElemTime(8) < 0
y = 0.520825386

[State 5121, StateTypeSet: Stand, Physics: Stand]
type = StateTypeSet
trigger1 = AnimElem = 8
stateType = S
physics = S

[State 5121, VelSet]
type = VelSet
trigger1 = AnimElem = 8
x = 0
y = 0

[State 5121, PosSet]
type = PosSet
trigger1 = AnimElem = 8
y = 0

[State 5121, Landing Dust Explod]
type = Explod
trigger1 = AnimElem = 8
anim = 8102
sprPriority = -3
posType = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1

[State 5121, Landing Sound]
type = PlaySnd
trigger1 = AnimElem = 8
value = 52,0
channel = 1

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



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

[State 5205, ChangeAnim]
type = ChangeAnim
trigger1 = !AnimTime
trigger1 = Anim = 5035
value = 5050

[State 5205, VelAdd]
type = VelAdd
trigger1 = Time > 0
y = GetHitVar(yAccel)

[State 5205, SelfState (Ground)]
type = SelfState
trigger1 = vel y > 0
trigger1 = pos y >= const(movement.air.getHit.groundRecover.ground.threshold)
value = 5200

[State 5205, SelfState (Air)]
type = SelfState
trigger1 = Time >= 60
value = 5210



;==========<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 = Time > 0
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 = !Time
y = 0

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

[State 5201, Spring sound]
type = PlaySnd
trigger1 = AnimElem = 3
value = 5200,1
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,-20
size.xScale = 1
size.yScale = 1
ownpal = 1

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

[State 5201, VelSet]
type = VelSet
trigger1 = Anim = 5200
trigger1 = AnimElem = 3
x = -5
y = -6.666660309

[State 5201, VelAdd]
type = VelAdd
trigger1 = Anim = 5200
trigger1 = AnimElemTime(3) > 0
y = 0.9259223938

[State 5201, ChangeAnim]
type = ChangeAnim
trigger1 = pos y > -vel y
value = 47

[State 5201, VelSet]
type = VelSet
trigger1 = Anim = 47 && AnimElem = 1
y = 0

[State 5201, PosSet]
type = PosSet
trigger1 = Anim = 47 && AnimElem = 1
y = 0

[State 5201, Landing Dust Explod]
type = Explod
trigger1 = Anim = 47 && AnimElem = 1
anim = 8102
sprPriority = -3
posType = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1

[State 5201, Landing Sound]
type = PlaySnd
trigger1 = Anim = 47 && AnimElem = 1
value = 52,0
channel = 3

[State 5201, End]
type = ChangeState
trigger1 = !AnimTime && Anim = 47
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 = Time > 0
y = 0.6

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

[State 5210, VelSet (Reversed commands)]
type = VelSet
trigger1 = !Time
trigger1 = NumExplod(92828282) || NumExplod(92468246)
x = ifElse((command = "holdback" && command != "holdfwd"), 4, ifElse((command != "holdback" && command = "holdfwd"), -4, 0))
y = -7.55

[State 5210, Voice]
type = PlaySnd
trigger1 = !Time
value = 4,4
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,-66
size.xScale = 1
size.yScale = 1
ownPal = 1

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

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

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



;===================<GUARD>================
;Guard Start
[StateDef 120]
type = U
physics = U
anim = 120 + (StateType = C) + (StateType = A) * 2

[State 120, StateTypeSet: Standing]
type = StateTypeSet
trigger1 = !Time && StateType = S
physics = S

[State 120, StateTypeSet: Crouching]
type = StateTypeSet
trigger1 = !Time && StateType = C
physics = C

[State 120, StateTypeSet: Jumping]
type = StateTypeSet
trigger1 = !Time && StateType = A
physics = A

[State 120, VelSet]
type = VelSet
trigger1 = !Time && StateType != A
x = 0
y = 0

[State 120, Stand to Crouching]
type = StateTypeSet
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = !AILevel && StateType = S && command = "holddown"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = !AILevel && StateType = S && command = "holdup"
trigger3 = AILevel && StateType = S && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
stateType = C
physics = C

[State 120, Crouching to Stand]
type = StateTypeSet
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = !AILevel && StateType = C && command != "holddown"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = !AILevel && StateType = C && command != "holdup"
trigger3 = AILevel && StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S

[State 120, AI Fix]
type = CtrlSet
trigger1 = AILevel && NumEnemy
value = (EnemyNear, Time >= 120 || Time >= 180)

[State 120, Change to Guard State]
type = ChangeState
trigger1 = !AnimTime || AILevel
value = 130 + (StateType = C) + (StateType = A) * 2

[State 120, Stop Guarding]
type = ChangeState
trigger1 = !AILevel && (ifElse(!NumExplod(94646464) && !NumExplod(92468246), ifElse(P2dist x < 0, command != "holdfwd", command != "holdback"), ifElse(P2dist x < 0, command != "holdback", command != "holdfwd")))
trigger2 = !InGuardDist
trigger3 = AILevel && NumEnemy
trigger3 = EnemyNear, HitDefAttr = SCA, AT
value = 140


;Standing Guard
[StateDef 130]
type = S
physics = S

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

[State 130, AI Fix]
type = CtrlSet
trigger1 = AILevel && NumEnemy
value = (EnemyNear, Time >= 120 || Time >= 180)

[State 130, Standing to Crouch]
type = ChangeState
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = !AILevel && StateType = S && command = "holddown"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = !AILevel && StateType = S && command = "holdup"
trigger3 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
trigger3 = (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = !AILevel && (ifElse(!NumExplod(94646464) && !NumExplod(92468246), ifElse(P2dist x < 0, command != "holdfwd", command != "holdback"), ifElse(P2dist x < 0, command != "holdback", command != "holdfwd")))
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

[State 130, Landing Dust Expod]
type = Explod
trigger1 = !Time
trigger1 = PrevStateNo = 132 || (PrevStateNo = [154,155])
anim = 8102
sprpriority = -3
posType = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1


;Crouch Guarding
[StateDef 131]
type = C
physics = C

[State 131, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 131
value = 131

[State 131, Crouching to Standing]
type = ChangeState
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = !AILevel && StateType = C && command != "holddown"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = !AILevel && StateType = C && command != "holdup"
trigger3 = AILevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger3 = (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
value = 130

[State 131, AI Fix]
type = CtrlSet
trigger1 = AILevel && NumEnemy
value = (EnemyNear, Time >= 120 || Time >= 180)

[State 131, Stop Guarding]
type = ChangeState
trigger1 = !AILevel && (ifElse(!NumExplod(94646464) && !NumExplod(92468246), ifElse(P2dist x < 0, command != "holdfwd", command != "holdback"), ifElse(P2dist x < 0, command != "holdback", command != "holdfwd")))
trigger2 = !InGuardDist
trigger3 = AILevel && NumEnemy
trigger3 = EnemyNear, HitDefAttr = SCA, AT
value = 140


;Air Guard
[StateDef 132]
type = A
physics = N

[State 132, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 132
value = 132

[State 132, VelAdd]
type = VelAdd
trigger1 = Time > 0
y = const(movement.yAccel)

[State 132, VarSet]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y >= 0 && vel y > 0)

[State 132, VelSet]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 132, PosSet]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 132, AI Fix]
type = CtrlSet
trigger1 = AILevel && NumEnemy
value = (EnemyNear, Time >= 120 || Time >= 180)

[State 132, Jumping to Standing]
type = ChangeState
trigger1 = sysvar(0) && InGuardDist
trigger1 = (!AILevel && (ifElse(!NumExplod(94646464) && !NumExplod(92468246), ifElse(P2dist x < 0, command = "holdfwd", command = "holdback"), ifElse(P2dist x < 0, command = "holdback", command = "holdfwd")))) || AILevel
value = 130

[State 132, Change to Falling]
type = ChangeState
trigger1 = sysvar(0)
value = 52

[State 132, Stop Guarding]
type = ChangeState
trigger1 = !AILevel && (ifElse(!NumExplod(94646464) && !NumExplod(92468246), ifElse(P2dist x < 0, command != "holdfwd", command != "holdback"), ifElse(P2dist x < 0, command != "holdback", command != "holdfwd")))
trigger2 = !InGuardDist
trigger3 = AILevel && NumEnemy
trigger3 = EnemyNear, HitDefAttr = SCA, AT
value = 140


;Guard End
[StateDef 140]
type = U
physics = U
ctrl = 1

[State 140, ChangeAnim]
type = ChangeAnim
trigger1 = !Time
value = 140 + (StateType = C) + (StateType = A) * 2

[State 140, StateTypeSet: Standing]
type = StateTypeSet
trigger1 = !Time && StateType = S
physics = S

[State 140, StateTypeSet: Crouching]
type = StateTypeSet
trigger1 = !Time && StateType = C
physics = C

[State 140, StateTypeSet: Jumping]
type = StateTypeSet
trigger1 = !Time && StateType = A
physics = A

[State 140, Standing to Crouching]
type = StateTypeSet
trigger1 = !AILevel && StateType = S && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))
trigger2 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
trigger2 = StateType = S && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
stateType = C
physics = C

[State 140, Crouching to Standing]
type = StateTypeSet
trigger1 = !AILevel && StateType = C && (!NumExplod(90000002) && !NumExplod(90000001) && !NumExplod(90000003))
trigger2 = AILevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger2 = StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S

[State 140, End]
type = ChangeState
trigger1 = !AnimTime
value = (StateType = C) * 11 + (StateType = A) * 51


;Hit while Guarding (Standing)
[StateDef 150]
type = S
movetype = H
physics = N
velSet = 0,0

[State 150, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 150

[State 150, End]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2 * ((!AILevel && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))) || (AILevel && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)))

[State 150, Standing to Crouching]
type = StateTypeSet
trigger1 = !AILevel && StateType = S && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))
trigger2 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
stateType = C
physics = C

[State 150, Crouching to Standing]
type = StateTypeSet
trigger1 = !AILevel && StateType = C && (!NumExplod(90000002) && !NumExplod(90000001) && !NumExplod(90000003))
trigger2 = AIlevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger2 = StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S


;Knocked Back while Guarding (Standing)
[StateDef 151]
type = S
moveType = H
physics = S
anim = 150

[State 151, HitVelSet]
type = HitVelSet
trigger1 = !Time
x = 1

[State 151, VelSet]
type = VelSet
trigger1 = Time = GetHitVar(SlideTime)
trigger2 = HitOver
x = 0

[State 151, CtrlSet]
type = CtrlSet
trigger1 = time = GetHitVar(CtrlTime)
value = 1

[State 151, Standing to Crouching]
type = StateTypeSet
trigger1 = !AILevel && StateType = S && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))
trigger2 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
trigger2 = StateType = S && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
stateType = C
physics = C

[State 151, Crouching to Standing]
type = StateTypeSet
trigger1 = !AILevel && StateType = C && (!NumExplod(90000002) && !NumExplod(90000001) && !NumExplod(90000003))
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


;Hit while Guarding (Crouching)
[StateDef 152]
type = C
moveType = H
physics = N
velSet = 0,0

[State 152, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 151

[State 152, End]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2 * ((!AILevel && ((!NumExplod(92828282) && !NumExplod(92468246) && command = "holddown") || ((NumExplod(92828282) || NumExplod(92468246)) && command = "holdup"))) || (AILevel && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)))

[State 152, Standing to Crouching]
type = StateTypeSet
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = !AILevel && StateType = S && command = "holddown"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = !AILevel && StateType = S && command = "holdup"
trigger3 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
trigger3 = StateType = S && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
stateType = C
physics = C

[State 152, Crouching to Standing]
type = StateTypeSet
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = !AILevel && StateType = C && command != "holddown"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = !AILevel && StateType = C && command != "holdup"
trigger3 = AILevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger3 = StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S


;Knocked Back while Guarding (Crouching)
[StateDef 153]
type = C
moveType = H
physics = C
anim = 151

[State 153, HitVelSet]
type = HitVelSet
trigger1 = !Time
x = 1

[State 153, VelSet]
type = VelSet
trigger1 = Time = GetHitVar(SlideTime)
trigger2 = HitOver
x = 0

[State 153, CtrlSet]
type = CtrlSet
trigger1 = Time = GetHitVar(CtrlTime)
value = 1

[State 153, Standing to Crouching]
type = StateTypeSet
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = !AILevel && StateType = S && command = "holddown"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = !AILevel && StateType = S && command = "holdup"
trigger3 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
trigger3 = StateType = S && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
stateType = C
physics = C

[State 153, Crouching to Standing]
type = StateTypeSet
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = !AILevel && StateType = C && command != "holddown"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = !AILevel && StateType = C && command != "holdup"
trigger3 = AILevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger3 = StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S

[State 153, End]
type = ChangeState
trigger1 = HitOver
value = 131
ctrl = 1


;Hit while Guarding (Jumping)
[StateDef 154]
type = A
moveType = H
physics = N
velSet = 0,0

[State 154, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 152

[State 154, End]
type = ChangeState
trigger1 = HitShakeOver
value = 155


;Knocked Back while Guarding (Jumping)
[StateDef 155]
type = A
moveType = H
physics = N
anim = 152

[State 155, HitVelSet]
type = HitVelSet
trigger1 = !Time
x = 1
y = 1

[State 155, VelAdd]
type = VelAdd
trigger1 = Time > 0
y = const(movement.yAccel)

[State 155, CtrlSet]
type = CtrlSet
trigger1 = Time = GetHitVar(CtrlTime)
value = 1

[State 155, VarSet]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y >= 0 && vel y > 0)

[State 155, VelSet]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 155, PosSet]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 155, End]
type = ChangeState
trigger1 = sysvar(0) && InGuardDist
trigger1 = (!AILevel && (ifElse(!NumExplod(94646464) && !NumExplod(92468246), ifElse(P2dist x < 0, command != "holdfwd", command != "holdback"), ifElse(P2dist x < 0, command != "holdback", command != "holdfwd")))) || AILevel
value = 130

[State 155, End]
type = ChangeState
trigger1 = sysvar(0)
value = 52



;====================<LOSE>====================
[StateDef 170]
type = S
ctrl = 0
anim = 170 + (Random % 2)
velSet = 0,0

[State 170, Voice ("Once upon a time...")]
type = PlaySnd
trigger1 = Anim = 170 && !Time
value = 170,0
channel = 0

[State 170, Voice (crying)]
type = PlaySnd
trigger1 = Anim = 171 && AnimElem = 4
value = 3110,0
channel = 0

[State 170, Assert: RoundNotOver]
type = AssertSpecial
trigger1 = Time < 200
flag = RoundNotOver



;====================<DRAW GAME>====================
[StateDef 175]
type = S
ctrl = 0
velSet = 0,0

[State 175, ChangeState]
type = ChangeState
trigger1 = !Time
value = 170




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

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



;====================<INITIALIZE>====================
[StateDef 5901]
type = S

[State 5901, RemapPal: A Palettes]
type = RemapPal
trigger1 = 1
source = 1,1
dest = var(0),1

[State 5901, RemapPal: B Palettes]
type = RemapPal
trigger1 = 1
source = 1,2
dest = var(0),2

[State 5901, Darkside Master Deactivation Flag]
type = VarSet
trigger1 = 1
var(55) = 0

[State 5901, Turns Intro]
type = ChangeState
trigger1 = TeamMode = Turns
trigger1 = !RoundsExisted && RoundNo >= 2
value = 6900

[State 5901, Intro vs Jon Talbain]
type = ChangeState
triggerAll = NumEnemy
triggerAll = RoundNo = 1 || (((!(Enemy, RoundsExisted) || !RoundsExisted) && !(TeamMode = Simul) && !(Enemy, TeamMode = Simul)))
trigger1 = Enemy, Name = "Jon Talbain" || Enemy, Name = "J. Talbain" || Enemy, Name = "J.Talbain" || Enemy, Name = "Gallon" || Enemy, Name = "cvsgallon"
value = 193

;[State 5901, Intro vs Hibiki Takane]
;type = ChangeState
;triggerAll = NumEnemy
;triggerAll = RoundNo = 1 || (((!(Enemy, RoundsExisted) || !RoundsExisted) && !(TeamMode = Simul) && !(Enemy, TeamMode = Simul)))
;trigger1 = Enemy, Name = "Hibiki Takane" && EnemyNear, AuthorName = "Mouser"
;trigger2 = Enemy, Name = "ZeroHibiki"
;value = 194

[State 5901, Intro Decider]
type = ChangeState
trigger1 = RoundNo = 1
value = 190 + (Random % 3)

[State 5901, End]
type = ChangeState
trigger1 = 1
value = 0



;====================<INTRO 1>====================
[StateDef 190]
type = S
physics = N
anim = 190

[State 190, Assert: Intro]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 190, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 0
moveCamera = 0,0
ignoreHitPause = 1

[State 190, Camera Helper]
type = Helper
trigger1 = !NumHelper(8999)
helpertype = Normal
stateNo = 8999
ID = 8999
name = "Camera"
posType = P1

[State 190, PosSet]
type = PosAdd
trigger1 = !Time
x = const(velocity.walk.fwd.x) * const(size.xScale) * (AnimTime + 5)

[State 190, VelSet]
type = VelSet
trigger1 = Time = 5
x = const(velocity.walk.fwd.x) * const(size.xScale)

[State 190, Voice]
type = PlaySnd
trigger1 = AnimElem = 4
value = 20,0
channel = 0

[State 190, Musical Notes]
type = Explod
trigger1 = AnimElem = 4
trigger2 = AnimElemTime(4) = 16
trigger3 = !AnimTime
anim = ifElse(Random < 500, 20184, 21184)
sprPriority = 5
posType = P1
pos = 0, -65
random = 0, 25
vel = 0,-3.5
accel = 0, 0.2
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 190, PosSet]
type = PosSet
trigger1 = !AnimTime
x = Helper(8999), pos x
y = 0

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



;====================<INTRO 2>====================
[StateDef 191]
type = S
physics = N
anim = 191

[State 191, Assert: Intro]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 191, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 0
moveCamera = 0,0
ignoreHitPause = 1

[State 191, Camera Helper]
type = Helper
trigger1 = !NumHelper(8999)
helpertype = Normal
stateNo = 8999
ID = 8999
name = "Camera"
posType = P1

[State 191, Voice ("Once upon a time...")]
type = PlaySnd
trigger1 = !Time
value = 170,0
channel = 0

[State 191, Flowers (Back)]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 11191
ID = 11191
posType = P1
pos = ceil(-23 * const(size.xScale)), 12
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
size.shadowOffset = 15
name = "Flowers (Back)"
ownPal = 1

[State 191, Flowers (Front)]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 11191
ID = 12191
posType = P1
pos = ceil(-23 * const(size.xScale)), 12
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
size.shadowOffset = 10
name = "Flowers (Front)"
ownPal = 1

[State 191, Dust Helper]
type = Helper
trigger1 = AnimElem = 22
helperType = Normal
stateNo = 8100
ID = 8100
name = "Get Up Dust"
posType = P1
ownPal = 1

[State 191, VelSet]
type = VelSet
trigger1 = AnimElem = 22
y = -6.666660309

[State 191, VelAdd]
type = VelAdd
trigger1 = AnimElemTime(22) > 0 && AnimElemTime(26) < 0
y = 0.9259223938

[State 191, VelSet]
type = VelSet
trigger1 = AnimElem = 26
y = 0

[State 191, PosSet]
type = PosSet
trigger1 = AnimElem = 26
y = 0

[State 191, Landing Dust Explod]
type = Explod
trigger1 = AnimElem = 26
anim = 8102
sprPriority = -3
posType = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1

[State 191, Landing Sound]
type = PlaySnd
trigger1 = AnimElem = 26
value = 52,0
channel = 1

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



;====================<INTRO 3>====================
[StateDef 192]
type = S
physics = N
anim = 192

[State 192, Assert: Intro]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 192, Voice 1]
type = PlaySnd
trigger1 = AnimElem = 3
value = 195,0
channel = 0

[State 192, Voice 2]
type = PlaySnd
trigger1 = AnimElem = 12
value = 182,1
channel = 0

[State 192, Sparkle sound]
type = PlaySnd
trigger1 = AnimElem = 12
value = 193,1
channel = 1

[State 191, Question mark]
type = Explod
trigger1 = AnimElem = 9
anim = ifElse(Facing = 1, 10192, 11192)
sprPriority = 1
posType = P1
pos = ceil(-15 * const(size.xScale)), -57
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 191, Exclamation point]
type = Explod
trigger1 = AnimElem = 12
anim = 20192
sprPriority = 1
posType = P1
pos = ceil(16 * const(size.xScale)), -95
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

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



;====================<INTRO VS JON TALBAIN>====================
[StateDef 193]
type = S
physics = N
anim = 193

[State 193, Assert: Intro]
type = AssertSpecial
trigger1 = 1
flag = Intro

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

[State 193, Sparkle sound]
type = PlaySnd
trigger1 = AnimElem = 16
value = 193,1
channel = 1

[State 193, Eye glare]
type = Explod
trigger1 = AnimElem = 16
anim = 10193
sprPriority = 1
posType = P1
pos = ceil(-15 * const(size.xScale)), 3
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

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



;====================<INTRO VS HIBKI>====================
[StateDef 194]
type = S
physics = N
anim = 194

[State 194, Assert: Intro]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 194, Voice]
type = PlaySnd
trigger1 = AnimElem = 2
value = 3200,0
channel = 0

[State 194, Sparkle sound]
type = PlaySnd
trigger1 = AnimElem = 6
value = 193,1
channel = 1

[State 194, Apple]
type = Explod
trigger1 = !Time
anim = 10194
sprPriority = 1
posType = P1
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 194, Eye glare]
type = Explod
trigger1 = AnimElem = 6
anim = 10193
sprPriority = 1
posType = P1
pos = ceil(-15 * const(size.xScale)), 3
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

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



;====================<TURNS INTRO>====================
[StateDef 6900]
type = A
anim = 42
velSet = 0,0
ctrl = 0

[State 6900, Assert: Intro]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 6900, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 0
moveCamera = 0,0
ignoreHitPause = 1

[State 6900, Camera Helper]
type = Helper
trigger1 = !NumHelper(8999)
helpertype = Normal
stateNo = 8999
ID = 8999
name = "Camera"
posType = P1

[State 6900, PosSet]
type = PosSet
trigger1 = !Time
x = (-320 + abs(pos x)) * Facing

[State 6900, VelSet]
type = VelSet
trigger1 = !Time
x = (Helper(8999), RootDist x) / -40.0
y = -10.25

[State 6900, VelAdd]
type = VelAdd
trigger1 = 1
y = 0.5

[State 6900, End]
type = ChangeState
trigger1 = Time
trigger1 = pos y > -vel y
value = 6901


;Landing
[StateDef 6901]
type = S
physics = S
anim = 47
velSet = 0,0

[State 6901, Assert: Intro]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 6901, PosSet]
type = PosSet
trigger1 = !Time && NumHelper(8999)
x = ceil(Helper(8999), pos x)

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

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

[State 6901, ChangeAnim]
type = ChangeAnim
trigger1 = Anim = 47 && !AnimTime
value = 6901

[State 6901, PlaySnd]
type = PlaySnd
trigger1 = Anim = 6901 && AnimElem = 7
value = 181,0
channel = 0

[State 6901, End]
type = ChangeState
trigger1 = Anim = 6901 && !AnimTime
value = 0



;====================<WIN POSE DECIDER>====================
[StateDef 180]
type = S

[State 180, Generic Victory Quote]
type = VictoryQuote
trigger1 = 1
value = (Random % 21)

[State 180, Victory Quote vs. Darkstalkers characters]
type = VictoryQuote
trigger1 = Enemy, Name = "B.B. Hood" || Enemy, Name = "Bulleta" || Enemy, Name = "Baby Bonnie Hood" || Enemy, Name = "B.B.Hood" || Enemy, Name = "BB Hood"
trigger2 = Enemy, Name = "Anakaris"
trigger3 = Enemy, Name = "Bishamon" || Enemy, Name = "Oboro Bishamon"
trigger4 = Enemy, Name = "Demitri" || Enemy, Name = "Demitri Maximoff" || Enemy, Name = "Demitri Maximov" || Enemy, Name = "Demitri(DS)"
trigger5 = Enemy, Name = "Donovan" || Enemy, Name = "Donovan Baine" || Enemy, Name = "Dee"
trigger6 = Enemy, Name = "Felicia" || Enemy, Name = "cvsfelicia"
trigger7 = Enemy, Name = "Hsien-Ko" || Enemy, Name = "Lei-Lei" || Enemy, Name = "Lei Lei" || Enemy, Name = "LeiLei"
trigger8 = Enemy, Name = "Huitzil" || Enemy, Name = "Phobos"
trigger9 = Enemy, Name = "Jedah" || Enemy, Name = "Jedah Dohma"
trigger10 = Enemy, Name = "Jon Talbain" || Enemy, Name = "J. Talbain" || Enemy, Name = "J.Talbain" || Enemy, Name = "Gallon" || Enemy, Name = "cvsgallon"
trigger11 = Enemy, Name = "Lilith"
trigger12 = Enemy, Name = "Lord Raptor" || Enemy, Name = "L. Raptor" || Enemy, Name = "L.Raptor" || Enemy, Name = "Zabel" || Enemy, Name = "Zabel Zarock"
trigger13 = Enemy, Name = "Morrigan" || Enemy, Name = "Morrigan Aensland" || Enemy, Name = "cvsmorrigan"
trigger14 = Enemy, Name = "Pyron"
trigger15 = Enemy, Name = "Q-Bee" || Enemy, Name = "Q.Bee" || Enemy, Name = "Q Bee"
trigger16 = Enemy, Name = "Rikuo" || Enemy, Name = "Aulbath"
trigger17 = Enemy, Name = "Sasquatch"
trigger18 = Enemy, Name = "Victor" || Enemy, Name = "Victor von Gerdenheim"
value = (Random % 22)

[State 180, Win 1]
type = ChangeState
trigger1 = command = "holdx"
value = 181

[State 180, Win 2]
type = ChangeState
trigger1 = command = "holda"
value = 182

[State 180, Win 3]
type = ChangeState
trigger1 = command = "holdy"
value = 183

[State 180, Win 4]
type = ChangeState
trigger1 = command = "holdz"
value = 184

[State 180, Win 5]
type = ChangeState
trigger1 = command = "holdb"
value = 185

[State 180, Win 6]
type = ChangeState
trigger1 = command = "holdc"
value = 186

[State 180, Win Decider]
type = ChangeState
trigger1 = 1
value = 181 + (Random % 6)



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

[State 181, Assert: RoundNotOver]
type = AssertSpecial
trigger1 = Time < 200
flag = RoundNotOver

[State 181, Voice]
type = PlaySnd
trigger1 = AnimElem = 7
value = 181,0
channel = 0



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

[State 182, Assert: RoundNotOver]
type = AssertSpecial
trigger1 = Time < 245
flag = RoundNotOver

[State 182, Voice 1/2]
type = PlaySnd
trigger1 = AnimElem = 7
trigger2 = AnimElem = 17
value = 181,0
channel = 0

[State 182, Voice 3]
type = PlaySnd
trigger1 = AnimElem = 27
value = 182,0
channel = 0

[State 182, Voice 4]
type = PlaySnd
trigger1 = AnimElemTime(30) = 36
value = 182,1
channel = 0


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

[State 183, Assert: RoundNotOver]
type = AssertSpecial
trigger1 = Time < 250
flag = RoundNotOver

[State 183, Mr. K]
type = Explod
trigger1 = !Time
anim = 10183
sprPriority = 0
posType = P1
pos = ceil(-64 * const(size.xScale)), 0
scale = const(size.xScale), 1
shadow = -1,0,0
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 183, Money overlay]
type = Explod
trigger1 = !Time
anim = 11183
sprPriority = 2
posType = P1
pos = ceil(-64 * const(size.xScale)), 0
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 183, Mr. K voice]
type = PlaySnd
trigger1 = Time = 24
value = 10183,0
channel = 1

[State 183, Voice]
type = PlaySnd
trigger1 = AnimElem = 10
value = 183,0
channel = 0
persistent = 0



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

[State 184, Assert: RoundNotOver]
type = AssertSpecial
trigger1 = Time < 400
flag = RoundNotOver

[State 184, Assert: NoMusic]
type = AssertSpecial
trigger1 = 1
flag = NoMusic

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

[State 184, Microphone]
type = Explod
trigger1 = !Time
ID = 10184
anim = 10184
sprPriority = 2
posType = P1
pos = 0, -472
vel = 0,4
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 184, ModifyExplod]
type = ModifyExplod
trigger1 = Time >= 118
ID = 10184
posType = P1
pos = 0,0
vel = 0,0

[State 184, Flowers (Back)]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 11184
ID = 11184
posType = P1
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
size.shadowOffset = 15
name = "Flowers (Back)"
ownPal = 1

[State 184, Flowers (Front)]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 11184
ID = 12184
posType = P1
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
size.shadowOffset = 10
name = "Flowers (Front)"
ownPal = 1

[State 184, Musical Notes]
type = Explod
trigger1 = Time >= 145
trigger1 = Time % 18 = 1
anim = ifElse(Random < 500, 20184, 21184)
sprPriority = ifElse(Random < 500, 5, -5)
posType = P1
pos = 0, -50
random = 60, 25
vel = 0,-3.5
accel = 0, 0.2
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0



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

[State 185, Assert: RoundNotOver]
type = AssertSpecial
trigger1 = Time < 443
flag = RoundNotOver

[State 185, Assert: NoMusic]
type = AssertSpecial
trigger1 = 1
flag = NoMusic

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

[State 185, Microphone]
type = Explod
trigger1 = !Time
ID = 10184
anim = 10184
sprPriority = 2
posType = P1
pos = 0, -472
vel = 0,4
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 185, ModifyExplod]
type = ModifyExplod
trigger1 = Time >= 118
ID = 10184
posType = P1
pos = 0,0
vel = 0,0

[State 185, Flowers (Back)]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 11184
ID = 11184
posType = P1
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
size.shadowOffset = 15
name = "Flowers (Back)"
ownPal = 1

[State 185, Flowers (Front)]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 11184
ID = 12184
posType = P1
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
size.shadowOffset = 10
name = "Flowers (Front)"
ownPal = 1

[State 185, Musical Notes]
type = Explod
trigger1 = Time >= 116 && Time < 338
trigger1 = Time % 18 = 8
trigger2 = Time = 375
anim = ifElse(Random < 500, 20184, 21184)
sprPriority = ifElse(Random < 500, 5, -5)
posType = P1
pos = 0, ifElse(Time = 375, -15, -50)
random = 60, 25
vel = 0,-3.5
accel = 0, 0.2
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0



;====================<WIN 6>====================
[StateDef 186]
type = S
physics = S
anim = 186
ctrl = 0

[State 186, Assert: RoundNotOver]
type = AssertSpecial
trigger1 = Time < 384
flag = RoundNotOver

[State 186, Assert: NoMusic]
type = AssertSpecial
trigger1 = 1
flag = NoMusic

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

[State 186, Microphone]
type = Explod
trigger1 = !Time
ID = 10184
anim = 10184
sprPriority = 2
posType = P1
pos = 0, -472
vel = 0,4
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0

[State 186, ModifyExplod]
type = ModifyExplod
trigger1 = Time >= 118
ID = 10184
posType = P1
pos = 0,0
vel = 0,0

[State 186, Flowers (Back)]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 11184
ID = 11184
posType = P1
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
size.shadowOffset = 15
name = "Flowers (Back)"
ownPal = 1

[State 186, Flowers (Front)]
type = Helper
trigger1 = !Time
helperType = Normal
stateNo = 11184
ID = 12184
posType = P1
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
size.shadowOffset = 10
name = "Flowers (Front)"
ownPal = 1

[State 186, Musical Notes]
type = Explod
trigger1 = Time >= 109 && Time < 313
trigger1 = Time % 18 = 1
anim = ifElse(Random < 500, 20184, 21184)
sprPriority = ifElse(Random < 500, 5, -5)
posType = P1
pos = 0, -50
random = 60, 25
vel = 0,-3.5
accel = 0, 0.2
scale = const(size.xScale), 1
ownPal = 1
removeOnGetHit = 1
ignoreHitPause = 0



;==========<TAUNT>==========
[StateDef 195]
type = S
moveType = I
physics = S
anim = 195
velSet = 0,0
sprPriority = 1
ctrl = 0

[State 195, ChangeAnim]
type = ChangeAnim
triggerAll = !Time
trigger1 = command = "holdfwd"
value = 196

[State 195, Voice]
type = PlaySnd
trigger1 = !Time && Anim != 196
value = 195,0
channel = 0

[State 195, Harry's bark]
type = PlaySnd
trigger1 = Anim = 195 && AnimElem = 7
value = 195,1
channel = 12

[State 196, Voice (Taunt 2)]
type = PlaySnd
trigger1 = !Time && Anim = 196
value = 196,0
channel = 0

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



;====================<STANDING GET HIT (HITSHAKE)>====================
[StateDef 5000]
type = S
moveType = H
physics = N
velSet = 0,0

[State 5000, ChangeAnim]
type = ChangeAnim
trigger1 = !Time
trigger1 = GetHitVar(AnimType) != [3,5]
value = ifElse((GetHitVar(GroundType) = 1), 5000, 5010) + GetHitVar(AnimType)

[State 5000, ChangeAnim: Hit Back]
type = ChangeAnim
trigger1 = !Time
trigger1 = GetHitVar(AnimType) = [3,5]
value = 5030

[State 5000, ChangeAnim: Hit Up/Diagonal Up]
type = ChangeAnim
trigger1 = !Time
trigger1 = (GetHitVar(AnimType) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(AnimType)))
value = 5047 + GetHitVar(AnimType)

[State 5000, Freeze Anim]
type = ChangeAnim
trigger1 = Time > 0 && Anim != [5010,5012]
value = Anim

[State 5000, Stop animating through HitPause]
type = ChangeAnim
trigger1 = AnimElemTime(4) >= 0 && Anim = 5012
value = Anim
elem = 4

[State 5000, StateTypeSet: Aerial]
type = StateTypeSet
trigger1 = !Time
trigger1 = GetHitVar(yVel) != 0 || GetHitVar(fall)
trigger2 = pos y != 0
StateType = A

[State 5000, ForceFeedback Light]
type = ForceFeedback
trigger1 = Anim = 5000
trigger2 = Anim = 5010
persistent = 0
time = 6
waveForm = square

[State 5000, ForceFeedback Medium]
type = ForceFeedback
trigger1 = Anim = 5001
trigger2 = Anim = 5011
persistent = 0
time = 8
waveForm = sineSquare
ampl = 110,-1,-.3

[State 5000, ForceFeedback Hard]
type = ForceFeedback
trigger1 = Anim = 5012
trigger2 = Anim = 5002
trigger3 = Anim = 5030
persistent = 0
time = 15
waveForm = sineSquare
ampl = 140

[State 5000, ChangeState]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yVel) = 0 && !GetHitVar(fall)
value = 5001

[State 5000, ChangeState]
type = ChangeState
trigger1 = HitShakeOver
value = 5030



;====================<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 = 18
value = F7,0

[State 5950, Hitting the Floor Explod]
type = Explod
trigger1 = AnimElem = 18
anim = F60
posType = P1
pos = 0,0
sprPriority = -3

[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 = Time > 0
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



;===========================================================================
;===============================<-2 STATES>=================================
;===========================================================================
[StateDef -2]

[State -2, Hit Detection]
type = VarSet
trigger1 = MoveContact = 1 && var(30) < 0
var(30) = HitPauseTime
ignoreHitPause = 1

[State -2, Hit Sound]
type = PlaySnd
trigger1 = MoveContact = 1 && var(30) = HitPauseTime
trigger1 = MoveHit = 1 && var(31) >= 0
value = 2, var(31)
channel = 2
ignoreHitPause = 1

[State -2, Guard Sound]
type = PlaySnd
trigger1 = MoveContact = 1 && var(30) = HitPauseTime
trigger1 = MoveGuarded = 1 && var(32) >= 0
value = 3, var(32)
channel = 2
ignoreHitPause = 1

[State -2, Hit Sparks]
type = Helper
triggerAll = StateNo != 1501 && (StateNo != [1531,1532]) && (StateNo != [3412,3413])
triggerAll = MoveContact = 1 && var(30) = HitPauseTime
trigger1 = MoveHit = 1 && NumEnemy
trigger1 = var(33) = 8010 || var(33) = 8011 || var(33) = 8012 || var(33) = 8013 || var(33) = 8014 || var(33) = 8015 || var(33) = 8016 || var(33) = 8017 || var(33) = 8018 || var(33) = 8019 || var(33) = 8020 || var(33) = 8001
trigger2 = MoveGuarded = 1 && NumEnemy
trigger2 = var(34) = 8000 || var(34) = 8001
helperType = Normal
stateNo = ifElse(MoveGuarded, var(34), var(33))
ID = 8000
name = "Spark"
postype = P1
pos = ceil(ifElse(P2Dist x < 0, 0, ifElse(P2Dist x < var(35), ceil(P2Dist x), var(35))) * const(size.xScale)), ceil(var(36) * const(size.yScale))
facing = -1
ownPal = 1
pauseMoveTime = 65535
superMoveTime = 65535
ignoreHitPause = 1

[State -2, Hit Sparks (Pursuit)]
type = Helper
triggerAll = StateNo = 1501 || StateNo = 1531 || StateNo = 1532 || StateNo = 3412 || StateNo = 3413
triggerAll = MoveContact = 1 && var(30) = HitPauseTime
trigger1 = MoveHit = 1 && NumEnemy
trigger1 = var(33) = 8010 || var(33) = 8011 || var(33) = 8012 || var(33) = 8013 || var(33) = 8014 || var(33) = 8015 || var(33) = 8016 || var(33) = 8017 || var(33) = 8018 || var(33) = 8019 || var(33) = 8020 || var(33) = 8001
trigger2 = MoveGuarded = 1 && NumEnemy
trigger2 = var(34) = 8000 || var(34) = 8001
helperType = Normal
stateNo = ifElse(MoveGuarded, var(34), var(33))
ID = 8000
name = "Spark"
postype = P1
pos = ceil(var(35) * const(size.xScale)), ceil(P2Dist y)
facing = -1
ownPal = 1
pauseMoveTime = 65535
superMoveTime = 65535
ignoreHitPause = 1

[State -2, Counter FX]
type = Helper
triggerAll = MoveHit = 1 && var(30) = HitPauseTime
triggerAll = NumEnemy && var(9)
trigger1 = !(HitDefAttr = SCA, AT) && (EnemyNear, MoveReversed != 1)
helperType = Normal
stateNo = 8290
ID = 8290
name = "Counter FX"
posType = P1
pos = ceil(ifElse(P2Dist x < 0, 0, ifElse(P2Dist x < var(35), ceil(P2Dist x), var(35))) * const(size.xScale)), ceil(var(36) * const(size.yScale))
facing = -1
ownPal = 1
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 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 >= -48 && 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 = !IsHelper
trigger1 = MoveHit = 1
trigger1 = !HitPauseTime
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 = !IsHelper
trigger1 = MoveHit = 1
trigger1 = !HitPauseTime
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, 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)
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)
var(16) = 0
ignoreHitPause = 1

[State -2, Dark Force End Flag]
type = VarSet
trigger1 = var(20) = 1
trigger2 = RoundState != 2 && var(20)
var(55) = 1
ignoreHitPause = 1

[State -2, Dark Force End]
type = VarSet
trigger1 = var(20) < 0
trigger2 = RoundState != 2
var(20) = 0
ignoreHitPause = 1

[State -2, Dark Force Timer Decrement]
type = VarAdd
trigger1 = var(20) > 0
var(20) = -1
ignoreHitPause = 1

[State -2, Dark Force Timer]
type = Helper
triggerAll = !NumHelper(8450)
trigger1 = StateNo = 3300 && AnimElem = 11
trigger2 = var(20) > 0
helperType = normal
stateNo = 8450
ID = 8450
name = "Dark Force Timer"
posType = P1
ownPal = 1
ignoreHitPause = 1

[State -2, Dark Force BGPalFX]
type = BGPalFX
trigger1 = var(20) > 1 && var(20) < 355 && !var(40)
trigger2 = StateNo = 3300 && AnimElemTime(11) >= -1 && !var(40)
time = 1
mul = 128 + ceil(cos(GameTime / 20.0) * 128), 128 + ceil(sin(GameTime / 20.0) * 128), 128 + ceil(-cos(GameTime / 20.0) * 128)
ignoreHitPause = 1

[State -2, Throws Allowed]
type = VarSet
trigger1 = EnemyNear, MoveType != H
trigger1 = EnemyNear, StateNo != 140
trigger1 = (EnemyNear, ctrl && EnemyNear, Time >= 1) || (EnemyNear, Time >= 8)
trigger2 = EnemyNear, MoveType = A
trigger3 = (EnemyNear, StateNo != [0,52]) && (EnemyNear, StateNo != [120,155]) && (EnemyNear, StateNo != [5000,5120])
trigger3 = (EnemyNear, StateNo != [51005,51006])
var(38) = 0

[State -2, Throws Disallowed]
type = VarSet
triggerAll = NumEnemy
trigger1 = EnemyNear, StateNo = [150,155]
trigger2 = (EnemyNear, StateNo = 51 || EnemyNear, StateNo = 140) && (EnemyNear, PrevStateNo = [150, 155])
trigger3 = EnemyNear, MoveType = H && EnemyNear, StateType != A && !var(21) && !var(22)
trigger4 = (EnemyNear, StateNo = [5020,5040]) && EnemyNear, HitFall = 0
trigger5 = EnemyNear, StateNo = 40 && EnemyNear, PrevStateNo != 52 && (EnemyNear, Anim != [0, 29])
var(38) = 1
ignoreHitPause = 1

[State -2, Dampener]
type = VarSet
trigger1 = 1
fvar(10) = ifElse(var(13) < 2, 24, ifElse(var(13) >= 23, 1, 25 - var(13))) / 24.0
ignoreHitPause = 1

[State -2, Dampener - Supers]
type = VarSet
trigger1 = (StateNo = [3000,4999])
fvar(10) = ifElse(var(22), 0.6, ifElse(var(21), 0.8, 1.0))
ignoreHitPause = 1

[State -2, Dampener Limit]
type = VarSet
trigger1 = fvar(10) < 0
fvar(10) = 0
ignoreHitPause = 1

[State -2, Root Dampener]
type = VarSet
trigger1 = 1
fvar(11) = fvar(10) * ifElse(var(9), 1.2, 1)
ignoreHitPause = 1

[State -2, Voice Position]
type = SndPan
trigger1 = 1
channel = 0
pan = 0
ignoreHitPause = 1

[State -2, Collapse Sound]
type = PlaySnd
trigger1 = StateNo != 5950
trigger1 = Anim = 5950 || Anim = 5955
trigger1 = AnimElem = 18
value = F7,0

[State -2, Collapse FX]
type = Explod
trigger1 = StateNo != 5950
trigger1 = Anim = 5950 || Anim = 5955
trigger1 = AnimElem = 18
anim = F60
posType = P1
sprpriority = -3

[State -2, Guard Crush/Throw Escape voice]
type = PlaySnd
trigger1 = Anim = 5910 || Anim = 5920 || Anim = 5930
trigger1 = AnimElemTime(1) = 1
trigger2 = Anim = 5940 || Anim = 5945
trigger2 = AnimElem = 2 && StateNo != 890
value = 5000,0
channel = 0
ignoreHitPause = 1

[State -2, Dash -> Normals movement end]
type = VelSet
triggerAll = (StateNo = [200,240]) || (var(20) && (StateNo = 1000 || StateNo = 1050))
trigger1 = PrevStateNo = 100
trigger1 = vel x <= 0
trigger2 = PrevStateNo = 105
trigger2 = vel x > 0
x = 0

[State -2, Forward Dash -> Normals VelAdd]
type = VelAdd
trigger1 = PrevStateNo = 100
trigger1 = (StateNo = [200,240]) || (var(20) && (StateNo = 1000 || StateNo = 1050))
trigger1 = vel x > 0
x = -0.2197265625 * const(size.xScale)

[State 100, Back Dash -> Normals VelAdd]
type = VelAdd
trigger1 = PrevStateNo = 105
trigger1 = (StateNo = [200,240]) || (var(20) && (StateNo = 1000 || StateNo = 1050))
trigger1 = vel x < 0
x = 0.1831054688 * const(size.xScale)

[State -2, Remove Gunfire Explod]
type = RemoveExplod
triggerAll = NumExplod(225)
triggerAll = StateNo != 220 && StateNo != 420 && StateNo != 620 && StateNo != 621
trigger1 = PrevStateNo = 220
trigger2 = PrevStateNo = 420
trigger3 = PrevStateNo = 620
trigger4 = PrevStateNo = 621
id = 225
ignoreHitPause = 1

[State -2, Burned Knife]
type = Helper
trigger1 = Anim = 7697 && AnimElemTime(1) = 13
;don't appear during Cool Hunting gun hits
trigger1 = !(EnemyNear, Name = "B.B. Hood" && EnemyNear, AuthorName = "Jmorphman" && (GetHitVar(chainID) = [3000,3001]))
helperType = Normal
stateNo = 17697
ID = 17697
name = "Burned Knife"
posType = P1
pos = ceil(const(size.xScale) * 29), -64
size.xScale = const(size.xScale)
size.yScale = 1
ownPal = 1

[State -2, Burned Grenade]
type = Helper
trigger1 = Anim = 7697 && AnimElemTime(1) = 13
;don't appear during Cool Hunting gun hits
trigger1 = !(EnemyNear, Name = "B.B. Hood" && EnemyNear, AuthorName = "Jmorphman" && (GetHitVar(chainID) = [3000,3001]))
helperType = Normal
stateNo = 17697
ID = 27697
name = "Burned Grenade"
posType = P1
pos = ceil(const(size.xScale) * -21), -50
size.xScale = const(size.xScale)
size.yScale = 1
ownPal = 1

[State -2, Sealed by Chizuru's Reigi no Ishizue]
type = PalFX
trigger1 = NumProjID(131035)
trigger1 = GameTime % 2 = 1
time = 1
add = 0,0,92
sinAdd = 0,0,0,0
color = 0
invertAll = 0
color = 256
ignoreHitPause = 1

[State -2, EXPLODsive Buffering Helper]
type = Helper
trigger1 = !NumHelper(90000005)
helpertype = Normal
stateNo = 90000005
ID = 90000005
name = "EXPLODsive Buffering helper"
posType = P1
facing = ifElse(Facing = 1, 1, -1)
keyCtrl = 1
ignoreHitPause = 1

[State -2, Harry]
type = Helper
trigger1 = !NumHelper(18000) && StateNo != 5900
helperType = Normal
stateNo = 18000
ID = 18000
posType = P1
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
name = "Harry"
ownPal = 1

[State -2, Lower forward butterfly]
type = Helper
trigger1 = !NumHelper(19000) && StateNo != 5900
helperType = Normal
stateNo = 19000
ID = 19000
posType = P1
pos = ceil(32.5 * const(size.xScale)), -47
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
name = "Lower forward Butterfly"
ownPal = 1

[State -2, Lower rear butterfly]
type = Helper
trigger1 = !NumHelper(19001) && StateNo != 5900
helperType = Normal
stateNo = 19000
ID = 19001
posType = P1
pos = ceil(-40.5 * const(size.xScale)), -51
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
name = "Lower rear Butterfly"
ownPal = 1

[State -2, Top butterfly]
type = Helper
trigger1 = !NumHelper(19002) && StateNo != 5900
helperType = Normal
stateNo = 19000
ID = 19002
posType = P1
pos = ceil(-10 * const(size.xScale)), -74
size.xScale = const(size.xScale)
size.yScale = const(size.yScale)
name = "Top Butterfly"
ownPal = 1

[State -2, Debug]
type = DisplayToClipboard
trigger1 = 1
text = "AI = %d Attack = %f Hits = %d Juggle = %d"
params = AILevel, fvar(11), var(13), var(15)
ignoreHitPause = 1

[State -2, Debug]
type = AppendToClipboard
trigger1 = 1
text = "\nBy Jmorphman"
ignoreHitPause = 1



;===========================================================================
;===============================<-3 STATES>=================================
;===========================================================================
[StateDef -3]

[State -3, GameTime]
type = VarSet
trigger1 = 1
var(58) = GameTime
ignoreHitPause = 1

[State -3, ProjContact Reset]
type = VarSet
triggerAll = var(18)
trigger1 = StateNo != 1000 && StateNo != 1030 && StateNo != 1050 && StateNo != 1080 && StateNo != 1100 && StateNo != 1130 && StateNo != 1150 && StateNo != 3000 && StateNo != 3050
var(18) = 0

[State -3, Projectile Flag Reset]
type = VarSet
trigger1 = var(39) < 0
var(39) = 0
ignoreHitPause = 1

[State -3, Projectile Flag Off]
type = VarSet
trigger1 = !NumHelper(1005)
trigger1 = !NumHelper(1035)
trigger1 = !NumHelper(1105)
trigger1 = !NumHelper(1135)
trigger1 = !NumHelper(3005) && !NumHelper(13005)
trigger1 = !NumHelper(3055) && !NumHelper(13055)
var(39) = 0
ignoreHitPause = 1

[State -3, Cool Hunting/Apple & Bomb Projectile Hit Count Reset]
type = VarSet
trigger1 = !NumHelper(3005) && !NumHelper(13005)
trigger1 = !NumHelper(3055) && !NumHelper(13055)
trigger1 = !NumHelper(13405) && !NumHelper(13406)
trigger1 = !NumHelper(13425)
var(41) = 0
ignoreHitPause = 1

[State -3, Chain Combo Reset]
type = VarSet
trigger1 = 1
var(4) = 0
ignoreHitPause = 1

[State -3, Chain Combo Check]
type = VarSet
trigger1 = (StateNo = [200,699]) && (PrevStateNo = [200,699])
trigger1 = StateNo != PrevStateNo
var(4) = 1
ignoreHitPause = 1

[State -3, Chain Combo Reset]
type = VarSet
triggerAll = var(4)
trigger1 = (StateNo = [200,205]) && PrevStateNo = 400
trigger2 = StateNo = 400 && (PrevStateNo = [200,205])
trigger3 = (StateNo = [230,235]) && PrevStateNo = 430
trigger4 = StateNo = 430 && (PrevStateNo = [230,235])
var(4) = 0
ignoreHitPause = 1

[State -3, Cancel Reset]
type = VarSet
trigger1 = 1
var(6) = 0
ignoreHitPause = 1

[State -3, Cancel Check]
type = VarSet
triggerAll = !var(4)
trigger1 = (StateNo = [200,699]) && Time <= 2 && StateNo != 250 && StateNo != 439 && StateNo != 459 && StateNo != 650
trigger2 = StateNo = [200,205]
trigger3 = StateNo = 210 && AnimElemTime(5) < 0
trigger4 = StateNo = 215 && AnimElemTime(8) < 0
trigger5 = StateNo = [230,235]
trigger6 = StateNo = 240 && AnimElemTime(4) < 0
trigger7 = StateNo = 400
trigger8 = StateNo = 410 && AnimElemTime(5) < 0
trigger9 = StateNo = 430
trigger10 = StateNo = 440 && AnimElemTime(5) < 0
var(6) = 1
ignoreHitPause = 1

[State -3, Super Cancel Reset]
type = VarSet
trigger1 = 1
var(7) = 0
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, Super Cancel Check]
type = VarSet
triggerAll = !var(4)
trigger1 = (StateNo = [200,699]) && Time <= 2 && StateNo != 250 && StateNo != 439 && StateNo != 459 && StateNo != 650
trigger2 = StateNo = [200,205]
trigger3 = StateNo = 210 && (AnimElemTime(5) < 0 || (MoveContact = [1,8]))
trigger4 = StateNo = 215 && (AnimElemTime(8) < 0 || (MoveContact = [1,8]))
trigger5 = StateNo = [230,235]
trigger6 = StateNo = 240 && (AnimElemTime(4) < 0 || (MoveContact = [1,8]))
trigger7 = StateNo = 400
trigger8 = StateNo = 410 && (AnimElemTime(5) < 0 || (MoveContact = [1,8]))
trigger9 = StateNo = 430
trigger10 = StateNo = 440 && (AnimElemTime(5) < 0 || (MoveContact = [1,8]))
trigger11 = StateNo = 1301 && AnimElemTime(8) < 0 && MoveContact
trigger12 = StateNo = 1330 && AnimElemTime(13) < 0 && MoveContact
;no point in cancelling out of moves that set p2 on fire...
;trigger11 = (StateNo = [1000,1080]) && (AnimElemTime(8) = [1,8])
;trigger12 = StateNo = 1200 && AnimElemTime(16) < 0 && MoveContact = [1,12]
;trigger13 = StateNo = 1230 && AnimElemTime(25) < 0 && MoveContact = [1,12]
;trigger14 = StateNo = 1250 && AnimElemTime(16) < 0 && MoveContact = [1,12]
;trigger15 = StateNo = 1280 && AnimElemTime(22) < 0 && MoveContact = [1,12]
var(7) = 1
ignoreHitPause = 1

[State -3, Corner Push]
type = VarSet
trigger1 = fvar(5)
trigger1 = NumTarget
trigger1 = Target, HitOver || (Target, GetHitVar(HitShakeTime) > 0 && Target, Time <= 0)
fvar(5) = 0

[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) <= 0
triggerAll = (Target, StateType = S || Target, StateType = C) && !(Target, GetHitVar(yvel)) && !(Target, HitFall)
trigger1 = Target, FrontEdgeBodyDist <= abs(Target, vel x)
trigger1 = (Target, GetHitVar(xvel) * Target, Facing) > 0
trigger2 = Target, BackEdgeBodyDist <= abs(target, vel x)
trigger2 = (Target, GetHitVar(xvel) * Target, Facing) < 0
x = ifElse(Target, FrontEdgeBodyDist <= 0, -1, 1) * (Target, Facing) * fvar(5)

[State -3, Corner Push]
type = VarSet
trigger1 = fvar(5)
trigger1 = abs(fvar(5)) < 1.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, EX FX Decrement]
type = VarAdd
trigger1 = var(24) > 0
var(24) = -1

[State -3, EX FX Reset]
type = VarSet
trigger1 = (StateNo != [3000,4999]) || MoveType = H
var(24) = 0

[State -3, EX Flash]
type = PalFX
trigger1 = var(24)
time = 1
mul = 256 + ceil(cos(GameTime / 10.0 * pi) * 128), 256 + ceil(sin(GameTime / 10.0 * pi) * 128), 256 + ceil(-cos(GameTime / 10.0 * pi) * 128)
color = 0
ignoreHitPause = 1

[State -3, EX Flash Blink]
type = PalFX
trigger1 = ((GameTime % 14) = 0 || (GameTime % 14) = 13) && var(24)
time = 1
ignoreHitPause = 1

[State -3, ES FX Decrement]
type = VarAdd
trigger1 = var(25) > 0
var(25) = -1

[State -3, ES FX Reset]
type = VarSet
trigger1 = (StateNo != [1000,2999]) || MoveType = H
var(25) = 0

[State -3, ES Flash]
type = PalFX
trigger1 = var(25)
time = 1
add = 8 * (GameTime % 8), 8 * (GameTime % 8), 8 * (GameTime % 8)
mul = 128, 256, 512
color = 0
ignoreHitPause = 1

[State -3, ES Flash Blink]
type = PalFX
trigger1 = ((GameTime % 8) = 0 || (GameTime % 8) = 7) && var(25)
time = 1
ignoreHitPause = 1

[State -3, Movement AfterImage]
type = AfterImage
triggerAll = Time = 1
trigger1 = StateNo = 50 && (var(3) = 2 || var(3) = 3)
trigger2 = (StateNo = [700,715])
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 || StateNo = 3100 || StateNo = 3200 || StateNo = 3300) && Time = 4 && var(40)
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 = 4 && var(40)
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 = 1 && var(40)
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 || var(3) = 3) && vel y < -1
trigger2 = StateNo = [700,715]
trigger3 = (StateNo = [3000,4999]) && var(40)
time = 2

[State -3, AfterImage Off]
type = AfterImageTime
triggerAll = Time <= 1 && var(40)
trigger1 = StateNo = 3000 || StateNo = 3050 || StateNo = 3100 || StateNo = 3200 || StateNo = 3300
trigger2 = StateNo = 3400
time = 0

[State -3, Underground Juggle Prevention]
type = TargetBind
trigger1 = MoveContact = 1
trigger1 = NumTarget && NumEnemy
trigger1 = (Target, Time = 0) && (Target, ID = EnemyNear, ID)
trigger1 = !(Target, HitShakeOver) && (Target, pos y > 0)
pos = ceil(P2Dist x), ceil(-pos y)
ignoreHitPause = 1

[State -3, Prevent Crossup]
type = Width
trigger1 = MoveType != H
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) - 34)
trigger2 = P2StateType = C
trigger2 = P2Dist y >= (EnemyNear, const(size.height) - 50)
trigger3 = P2StateType = L
trigger3 = P2Dist y >= 12
value = 0
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 * (AILevel ** 2 / 64.0))
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, (Random % 2)
channel = 0
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, Stop Guarding Voice]
type = StopSnd
trigger1 = StateNo = [120,155]
channel = 0

[State -3, The Killing Time Finish]
type = Helper
triggerAll = WinKO && var(20)
triggerAll = RoundState = 3 && !NumHelper(8600)
trigger1 = MoveHit = [1,4]
trigger2 = StateNo = 810 && (AnimElemTime(11) = [0, 1])
trigger3 = StateNo = 820 && (AnimElemTime(15) = [19, 20])
trigger4 = StateNo = 860 && (AnimElemTime(12) = [0, 1])
trigger5 = NumHelper(1005)
trigger5 = (Helper(1005), StateNo = [1005,1007]) && (Helper(1005), var(18))
trigger6 = NumHelper(1035)
trigger6 = ((Helper(1035), StateNo = [1035,1036]) || Helper(1035), StateNo = 1007) && (Helper(1035), var(18))
trigger7 = NumHelper(1105)
trigger7 = ((Helper(1105), StateNo = [1006,1007]) || Helper(1105), StateNo = 1105) && (Helper(1035), var(18))
trigger8 = NumHelper(1135)
trigger8 = (Helper(1135), StateNo = 1036 || Helper(1135), StateNo = 1007 || Helper(1105), StateNo = 1135) && (Helper(1035), var(18))
trigger9 = StateNo = 1410 && (AnimElemTime(56) = [0, 1])
trigger10 = StateNo = 1440 && (AnimElemTime(101) = [0, 1])
trigger11 = NumHelper(21535)
trigger11 = (Helper(21535), StateNo = [21535,21537]); && (Helper(21535), var(18))
helperType = Normal
stateNo = 8600
ID = 8600 + 0 * (var(23) := 3300)
name = "Super Finish"
posType = Left
pos = 160, -120
ownPal = 1
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
trigger2 = var(23) := 3000
trigger3 = NumHelper(3005)
trigger3 = ((Helper(3005), StateNo = [3006,3007]) || Helper(3005), StateNo = 21537) && Helper(3005), var(18)
trigger3 = var(23) := 3000
trigger4 = NumHelper(3006)
trigger4 = ((Helper(3006), StateNo = [3006,3007]) || Helper(3006), StateNo = 21537) && Helper(3006), var(18)
trigger4 = var(23) := 3000
trigger5 = StateNo = 3050
trigger5 = var(23) := 3050
trigger6 = NumHelper(3055)
trigger6 = (Helper(3055), StateNo = 3056 || Helper(3055), StateNo = 1007) && Helper(3055), var(18)
trigger6 = var(23) := 3050
trigger7 = NumHelper(13055)
trigger7 = ((Helper(13055), StateNo = [3006,3007]) || Helper(13055), StateNo = 21537) && Helper(13055), var(18)
trigger7 = var(23) := 3050
trigger8 = NumHelper(13065)
trigger8 = ((Helper(13065), StateNo = [3006,3007]) || Helper(13065), StateNo = 21537) && Helper(13065), var(18)
trigger8 = var(23) := 3050
trigger9 = NumHelper(23055)
trigger9 = ((Helper(23055), StateNo = [3006,3007]) || Helper(23055), StateNo = 21537) && Helper(23055), var(18)
trigger9 = var(23) := 3050
trigger10 = NumHelper(23065)
trigger10 = ((Helper(23065), StateNo = [3006,3007]) || Helper(23065), StateNo = 21537) && Helper(23065), var(18)
trigger10 = var(23) := 3050
trigger11 = StateNo = [3100,3111]
trigger11 = var(23) := 3100
trigger12 = StateNo = 3210
trigger12 = var(23) := 3200
trigger13 = StateNo = [3400,3414]
trigger13 = var(23) := 3400
helperType = Normal
stateNo = 8600
ID = 8600
name = "Super Finish"
posType = left
pos = 160,-120
ownPal = 1
pauseMoveTime = 255
superMoveTime = 255
ignoreHitPause = 1
