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

[State 5050, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 5050, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5050, 3] ;Gravity
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -40
triggerall = alive
Triggerall = backedgebodydist > 82
trigger1 = var(59) <= 0
trigger1 = Command = "recovery" || command = "z"
Trigger1 = Command != "holdfwd"
trigger2 = var(59)>0&&Random<var(59)*21
Trigger2=P2BodyDist X>=50
trigger3 = var(59)>0&&Random<var(59)*21
Trigger3=P2BodyDist X<=180
value = 5125 ;HITFALL_RECOVER

[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -40
triggerall = alive
trigger1 = var(59) <= 0
trigger1 = Command = "recovery" || command = "z"
Trigger1 = Command = "holdfwd"
trigger2 = var(59)>0&&Random<var(59)*21
Trigger2=P2BodyDist X<=50
trigger3 = var(59)>0&&Random<var(59)*21
Trigger3=P2BodyDist X>=180
value = 5126 ;HITFALL_RECOVER

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > -1
triggerall = alive
triggerall = CanRecover
trigger1 = var(59) <= 0
trigger1 = Command = "recovery" || command = "z"
trigger2 = var(59)>0&&Random<var(59)*101
value = 5210 ;HITFALL_AIRRECOVER

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5100 ;HIT_BOUNCE

[State 0, DestroySelf]
Type = DestroySelf
Trigger1 = !ishelper(8500)


[Statedef 5120]
type    = L
movetype= I
physics = N

[State 5120, ChangeState]
Type = ChangeState
TriggerAll = Time = 0
trigger1 = var(59) <= 0
Trigger1 = Command = "holdback"
Trigger2 = BackEdgeBodyDist >= 40
trigger2 = var(59)>0&&Random<var(59)*41
Trigger2=P2BodyDist X<=150
Trigger4 = frontEdgeBodyDist <= 40
trigger4 = var(59)>0&&Random<var(59)*41
Trigger4=P2BodyDist X<=150
value = 5125 ;HITFALL_RECOVER

[State 5120, ChangeState]
Type = ChangeState
TriggerAll = Time = 0
trigger1 = var(59) <= 0
Trigger1 = Command = "holdfwd"
Trigger2 = frontEdgeBodyDist >= 40
trigger2 = var(59)>0&&Random<var(59)*41
Trigger2=P2BodyDist X<=150
Trigger3 = BackEdgeBodyDist <= 40
trigger3 = var(59)>0&&Random<var(59)*41
Trigger3=P2BodyDist X<=150
value = 5126 ;HITFALL_RECOVER


[State 5120, 1a] ;Get up anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5111,5119]
trigger2 = !SelfAnimExist(5120 + (anim % 10))
value = 5120

[State 5120, 1b] ;Get up anim (for hit up/diag-up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5111,5119]
trigger1 = SelfAnimExist(5120 + (anim % 10))
value = 5120 + (anim % 10)

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

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

[State 5120, 4]
type = HitFallSet
trigger1 = AnimTime = 0
value = 1

[State 5120, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 12

[State 5120, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = 0
value2 = SCA
time = 3

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


[Statedef 5125]
type = S
physics = S
velset = 0,0
movetype = I
anim = 5201
ctrl = 0

[State 100, 4]
type           = Explod
trigger1 = animelem = 1
anim           = 6202
postype        = p1
pos            = 0,5 
bindtime       = 1
ownpal         = 1
ignorehitpause = 1
removeongethit = 1
trans = sub
sprpriority = 5

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElemtime(1) = 0
value = 1080,0
freqmul = 1

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElemtime(1) = 0
value = 1080,0
freqmul = 0.9

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElemtime(1) = 0
value = 1080,0
freqmul = 0.8

[State 840,0]
type = PlayerPush
trigger1=Time >= 0
value = 0

[State 4000, BGPalFX]
type = PalFX
trigger1 = time = 0
time = 1
add = 0,0,0
ignorehitpause = 1

[State 100, 2]
type = posadd
trigger1 = Time >= 19
x = -190

[State 5201,3]
type = PosSet
trigger1 = time = 0
y = 0

[State 5201,4]
type = NotHitBy
trigger1 = time >= 0
value = SCA
time = 2

[State 5201,5]
type = ChangeState
trigger1 = Time >= 20
value = 5127

[State -1]
Type           = AfterImage
Trigger1       = Time = 0
Time           = 100
Trans          = sub
Length         = 25
TimeGap        = 1
FrameGap       = 1
PalBright      = 0 , 0 , 0
PalContrast    = 200 , 200 , 200
PalAdd         = 0 , 0 , 0
PalMul      = .70,.70,.70

[Statedef 5126]
type = S
physics = S
velset = 0,0
movetype = I
anim = 5201
ctrl = 0

[State 100, 4]
type           = Explod
trigger1 = animelem = 1
anim           = 6202
postype        = p1
pos            = 0,5 
bindtime       = 1
ownpal         = 1
ignorehitpause = 1
removeongethit = 1
trans = sub
sprpriority = 5

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElemtime(1) = 0
value = 1080,0
freqmul = 1

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElemtime(1) = 0
value = 1080,0
freqmul = 0.9

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElemtime(1) = 0
value = 1080,0
freqmul = 0.8

[State 840,0]
type = PlayerPush
trigger1=Time >= 0
value = 0

[State 4000, BGPalFX]
type = PalFX
trigger1 = time = 0
time = 1
add = 0,0,0
ignorehitpause = 1

[State 100, 2]
type = posadd
trigger1 = time >= 19
x = 190

[State 5201,3]
type = PosSet
trigger1 = time = 0
y = 0

[State 5201,4]
type = NotHitBy
trigger1 = time >= 0
value = SCA
time = 2

[State 5201,5]
type = ChangeState
trigger1 = Time >= 20
value = 5127

[State -1]
Type           = AfterImage
Trigger1       = Time = 0
Time           = 100
Trans          = sub
Length         = 25
TimeGap        = 1
FrameGap       = 1
PalBright      = 0 , 0 , 0
PalContrast    = 200 , 200 , 200
PalAdd         = 0 , 0 , 0
PalMul      = .70,.70,.70

[Statedef 5127]
type = S
ctrl = 0
anim = 5203
velset = 0,0
facep2 = 1

[State 100, 4]
type           = Explod
trigger1 = animelem = 2
anim           = 6202
postype        = p1
pos            = 0,5 
bindtime       = 1
ownpal         = 1
ignorehitpause = 1
removeongethit = 1
trans = sub
sprpriority = 5

[State -1]
Type           = AfterImage
Trigger1 = animelemtime(10) = 4
Time           = 1
PalContrast    = 0 , 0 , 0

[State 191, ステート変更];アニメーションが終われば「通常立ち」のステートに変更する
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElemtime(2) >= 0
trigger1 = AnimElemtime(9) <= 2
trigger1 = time%6 = 1
value = 21,0

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElemtime(2) = 0
value = 1080,0
freqmul = 1

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElemtime(2) = 0
value = 1080,0
freqmul = 0.9

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElemtime(2) = 0
value = 1080,0
freqmul = 0.8
