
; Common state file for M.U.G.E.N 1.0
;
; System variables usage
; ----------------------
; Var name    Type   Purpose
; --------    ----   -------
; sysvar(0)   Temp   Set by state 5081 (HITL_SLIDE) to 1 to prevent
;                    showing ground hit frame in state 5110 (HIT_LIEDOWN).
;                    Used by guarding states.
; sysvar(1)   Temp   Used by state 40 (Jump Start) amd 45 (Air Jump Start)
;                    to keep track of which way to jump.
;                    Used by state 5100 and 5110 to remember downward
;                    velocity of player just before hitting the ground.
;                    Used in state 5080 for storing the anim # to display.

; The following states have special handling within MUGEN, and should be
; overridden with caution:
; Jump Start (40): airjumping bookkeeping at time = 0
; All guard states (120-155): guard handling throughout state
; Hit_trip, shaking (5070): defense increases at time = 0
; Downed get-hit (hit ground from fall) (5100):
;   defense increases at time = 0, player becomes invincible if within 10
;   ticks of getting up
; Hit_liedown (5110): player changes to get-up state (5120) when ready
; Hit_getup (5120): player's defence is restored to normal at time = 0
; Hitfall_recover (5200): player's defence is restored at time = 0
; Hitfall_airrecover (5210): player's defence is restored at time = 0

;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type     = S
movetype = I
physics  = S
sprpriority = 0

;---------------------------------------------------------------------------
;变量使用

[State 0, 变量记录]
type = VarSet
trigger1 = 1
fv = 22
value = 0
ignorehitpause = 1
persistent = 1

[State 0, 坐标修正]
type = PosSet
trigger1 = time = 0
y = 0
ignorehitpause = 1
persistent = 1

[State 0, 可控设置]
type = CtrlSet
trigger1 = PrevStateNo = 101919
trigger2 = PrevStateNo = 108100
value = 1
ignorehitpause = 1
persistent = 1

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

;暘恎僶僌杊巭
[State 0, DestroySelf]
type = DestroySelf
trigger1 = IsHelper

[State 0, 巆憸]
type = AfterImage
trigger1 = time = 0
time = 1

[State 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0

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

[State 0, 4] ;挂了否？
type = ChangeState
trigger1 = !alive
value = 5050
ctrl = 0

;---------------------------------------------------------------------------
; 站立到蹲下
[Statedef 10]
type    = C
physics = C
anim = 10

[State 0, AI跳转]
type = ChangeState
trigger1 = var(59) >= 1
value = 0
ctrl = 1
ignorehitpause = 1
persistent = 1

[State 10, 1]
type = VelMul
trigger1 = Time = 0
x = .75

[State 10, 2] ;如果低速度则停止移动
type = VelSet
trigger1 = abs(vel x) < Const(movement.crouch.friction.threshold)
x = 0

[State 10, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 11

;---------------------------------------------------------------------------
; 蹲下
[Statedef 11]
type    = C
physics = C
anim = 11
sprpriority = 0

[State 0, AI跳转]
type = ChangeState
trigger1 = var(59) >= 1
value = 0
ctrl = 1
ignorehitpause = 1
persistent = 1

[State 0, StopSnd]
type = StopSnd
trigger1 = PrevStateNo = 1300
trigger1 = time = 0
channel = 5

[State 11, 1] ;改变动作
type = ChangeAnim
trigger1 = Anim = 6 && AnimTime = 0
value = 11

[State 11, 2] ;如果低速度则停止移动
type = VelSet
trigger1 = abs(vel x) < Const(movement.crouch.friction.threshold)
x = 0
;---------------------------------------------------------------------------
; 蹲下到站立
[Statedef 12]
type    = S
physics = S
anim = 12

[State 0, AI跳转]
type = ChangeState
trigger1 = var(59) >= 1
value = 0
ctrl = 1
ignorehitpause = 1
persistent = 1

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

;---------------------------------------------------------------------------
; AI行走
[Statedef 19]
type    = S
movetype= I
physics = S
sprpriority = 0
ctrl = 0

;---------------------------------------------------------------------------
; 前进或后退
[State 19, 1]
type = VelSet
trigger1 = var(40) = 1
x = const(velocity.walk.fwd.x)

[State 19, 2]
type = VelSet
trigger1 = var(40) = 2
x = const(velocity.walk.back.x)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

[State 19,前走]
type = PlaySnd
triggerall = anim = 20
trigger1 = (AnimElem = 3,=0) || (AnimElem = 8,=0)
value = s20,random%2
ignorehitpause = 1
persistent = 1

[State 19,后退]
type = PlaySnd
triggerall = anim = 21
trigger1 = (AnimElem = 3,=0) || (AnimElem = 8,=0)
value = s20,random%2
ignorehitpause = 1
persistent = 1

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

[State 19, 5]
type = ChangeState
trigger1 = Vel X = 0
trigger2 = frontedgebodydist < 10 ;离版边太近时停止
trigger3 = roundstate != 2 ;回合结束后停止
trigger4 = inguarddist ;在对面的Inguarddist（这里的意思就是说，对面攻击，你在一定范围内会摆出防御姿势的距离）
trigger5 = Facing*(EnemyNear(var(58)),Pos x-Pos x) <= 60
trigger5 = Vel X > 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type    = S
physics = S
sprpriority = 0

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

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

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

[State 20,前走]
type = PlaySnd
triggerall = anim = 20
trigger1 = (AnimElem = 3,=0) || (AnimElem = 8,=0)
value = s20,random%2
ignorehitpause = 1
persistent = 1

[State 20,后退]
type = PlaySnd
triggerall = anim = 21
trigger1 = (AnimElem = 3,=0) || (AnimElem = 8,=0)
value = s20,random%2
ignorehitpause = 1
persistent = 1

[State 37, 6]
type = ChangeState
triggerall = var(59)
trigger1 = p2bodydist x <= 40
trigger2 = inguarddist
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; AI连段中行动
[Statedef 21]
type    = S
movetype= I
physics = S
sprpriority = 0
ctrl = 0

;---------------------------------------------------------------------------
; 转向
[State 21, Turn]
type = Turn ;转向，走路中如果背对了对面转回去面对对面
trigger1 =!Ctrl
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)) < 0
trigger1 = Anim = 20 || Anim = 21

;---------------------------------------------------------------------------
; 前进和后退

[State 21, AI 前進]
type = VelSet ;前进AI部分
triggerall = var(59)
triggerall = Vel X >= 0
triggerall =(PrevStateNo != [140,155]) ||(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) > 140 ;不能是撤防时或者离对面较远时
trigger1 =((Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) = [20,120]) || enemynear,facing = facing ;看上面的条件，第一个是在20-120距离，不满足上面的P2BodyDist X > 140条件，则必须满足(PrevStateNo != [140,155])条件才会触发，第二个是被对对面时触发
trigger2 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) > 140 ;同上面主条件第二项
trigger3 = EnemyNear(var(58)), facing != facing
trigger3 = EnemyNear(var(58)),Vel X < 0
trigger4 = EnemyNear(var(58)), facing = facing
trigger4 = EnemyNear(var(58)),Vel X > 0
x = const(velocity.walk.fwd.x)

[State 21, AI 後退]
type = VelSet
triggerall = var(59)
triggerall = Vel X <= 0
triggerall = enemynear,facing != facing ;面对对面
triggerall = enemynear,MoveType != H ;对面不能是不被打的情况
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) = [0,60] ;在0-60码的距离
trigger2 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) = [90,160] ;在90-160码的距离
trigger3 = enemynear,MoveType = I || enemynear,StateNo >= 1000 ;对面未作出任何动作或者对面stateno >= 1000（通常是必杀技以上，也有可能是拳脚但概率不大）
trigger4 =(PrevStateNo = [140,155]) &&(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) <= 140 ;刚刚撤防且离对面140码内
trigger5 = EnemyNear(var(58)),facing != facing
trigger5 = EnemyNear(var(58)),Vel X > 0
trigger5 = EnemyNear(var(58)),statetype = A
trigger5 = (Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) < 40
x = const(velocity.walk.back.x)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

[State 21,前走]
type = PlaySnd
triggerall = anim = 20
trigger1 = (AnimElem = 3,=0) || (AnimElem = 8,=0)
value = s20,random%2
ignorehitpause = 1
persistent = 1

[State 21,后退]
type = PlaySnd
triggerall = anim = 21
trigger1 = (AnimElem = 3,=0) || (AnimElem = 8,=0)
value = s20,random%2
ignorehitpause = 1
persistent = 1

;---------------------------------------------------------------------------
;状态转出
[State 21, 5]
type = ChangeState
trigger1 = EnemyNear(var(58)),statetype = L
value = 22
ctrl = 0

;---------------------------------------------------------------------------
;状态转出
[State 21, 6]
type = ChangeState
trigger1 = Vel X = 0
trigger2 = frontedgebodydist < 10 ;离版边太近时停止
trigger3 = roundstate != 2 ;回合结束后停止
trigger4 = inguarddist
trigger4 = EnemyNear(var(58)),facing != facing
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; AI对方倒地时行动
[Statedef 22]
type    = S
movetype= I
physics = S
sprpriority = 0
ctrl = 0

;---------------------------------------------------------------------------
; 转向
[State 22, Turn]
type = Turn ;转向，走路中如果背对了对面转回去面对对面
trigger1 =!Ctrl
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)) < 0
trigger1 = Anim = 20 || Anim = 21

;---------------------------------------------------------------------------
; 前进和后退

[State 22, 前进]
type = VelSet
triggerall = var(59)
triggerall = Enemynear(var(58)),stateno != 5120
trigger1 =Facing*(EnemyNear(var(58)),Pos x-Pos x) >= 65
x = const(velocity.walk.fwd.x)

[State 22, 后退]
type = VelSet
triggerall = var(59)
trigger1 = Enemynear(var(58)),stateno = 5120
trigger1 =Facing*(EnemyNear(var(58)),Pos x-Pos x) < 65
x = const(velocity.walk.back.x)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

[State 22,前走]
type = PlaySnd
triggerall = anim = 20
trigger1 = (AnimElem = 3,=0) || (AnimElem = 8,=0)
value = s20,random%2
ignorehitpause = 1
persistent = 1

[State 22,后退]
type = PlaySnd
triggerall = anim = 21
trigger1 = (AnimElem = 3,=0) || (AnimElem = 8,=0)
value = s20,random%2
ignorehitpause = 1
persistent = 1

;---------------------------------------------------------------------------
;状态转出
[State 22, 5]
type = ChangeState
trigger1 = Vel X = 0
trigger2 = frontedgebodydist < 10 ;离版边太近时停止
trigger3 = roundstate != 2 ;回合结束后停止
trigger4 = inguarddist
trigger4 = EnemyNear(var(58)),facing != facing
trigger5 = Enemynear(var(58)),Vel X = 0
trigger5 = Enemynear(var(58)),stateno != 5120
trigger5 = Facing*(EnemyNear(var(58)),Pos x-Pos x) <= 50
trigger6 = Enemynear(var(58)),stateno = 5120
trigger6 = Facing*(EnemyNear(var(58)),Pos x-Pos x) > 80
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;前跳
[Statedef 30]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 0, 保护]
type = NotHitBy
trigger1 = (helper(40100),var(15) >= 1)
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 10
ignorehitpause = 1
persistent = 1

[State 30, 1];跑跳
type = VelSet
trigger1 = AnimTime = 0
x = 3.5
y = -8.4

[State 30, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;前小跳
[Statedef 31]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 0, 保护]
type = NotHitBy
trigger1 = (helper(40100),var(15) >= 1)
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 10
ignorehitpause = 1
persistent = 1

[State 30, 1];跑跳
type = VelSet
trigger1 = AnimTime = 0
x = 4
y = -6

[State 30, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;前影跳
[Statedef 32]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 0, 保护]
type = NotHitBy
trigger1 = (helper(40100),var(15) >= 1)
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 10
ignorehitpause = 1
persistent = 1

[State 30, 1];跑跳
type = VelSet
trigger1 = AnimTime = 0
x = 6.0
y = -8.4

[State 残影]
type = AfterImage
Trigger1 = AnimTime = 0
time = 25
trans = add1
timegap = 1
framegap = 1
length = 6
palbright = 2,2,2
palcontrast = 60,60,60
palpostbright = 0,0,0
paladd = 0,0,0
palmul = 0.9,0.9,0.9

[State 30, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;前低空远跳
[Statedef 33]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 0, 保护]
type = NotHitBy
trigger1 = (helper(40100),var(15) >= 1)
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 10
ignorehitpause = 1
persistent = 1

[State 30, 1];跑跳
type = VelSet
trigger1 = AnimTime = 0
x = 6.5
y = -6

[State 30, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;后影跳
[Statedef 34]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 0, 保护]
type = NotHitBy
trigger1 = (helper(40100),var(15) >= 1)
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 10
ignorehitpause = 1
persistent = 1

[State 30, 1];跑跳
type = VelSet
trigger1 = AnimTime = 0
x = -6.8
y = -6

[State 残影]
type = AfterImage
Trigger1 = AnimTime = 0
time = 25
trans = add1
timegap = 1
framegap = 1
length = 6
palbright = 2,2,2
palcontrast = 60,60,60
palpostbright = 0,0,0
paladd = 0,0,0
palmul = 0.9,0.9,0.9

[State 30, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;前近高影跳
[Statedef 35]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 0, 保护]
type = NotHitBy
trigger1 = (helper(40100),var(15) >= 1)
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 10
ignorehitpause = 1
persistent = 1

[State 30, 1];跑跳
type = VelSet
trigger1 = AnimTime = 0
x = 3
y = -10

[State 残影]
type = AfterImage
Trigger1 = AnimTime = 0
time = 25
trans = add1
timegap = 1
framegap = 1
length = 6
palbright = 2,2,2
palcontrast = 60,60,60
palpostbright = 0,0,0
paladd = 0,0,0
palmul = 0.9,0.9,0.9

[State 30, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;前远高影跳
[Statedef 36]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 0, 保护]
type = NotHitBy
trigger1 = (helper(40100),var(15) >= 1)
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 10
ignorehitpause = 1
persistent = 1

[State 30, 1];跑跳
type = VelSet
trigger1 = AnimTime = 0
x = 6
y = -10

[State 残影]
type = AfterImage
Trigger1 = AnimTime = 0
time = 25
trans = add1
timegap = 1
framegap = 1
length = 6
palbright = 2,2,2
palcontrast = 60,60,60
palpostbright = 0,0,0
paladd = 0,0,0
palmul = 0.9,0.9,0.9

[State 30, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 0, AI跳转]
type = ChangeState
trigger1 = var(59) >= 1
value = 0
ctrl = 1
ignorehitpause = 1
persistent = 1

[State 40, 1]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 1

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

[State 40, 2]
type = VarSet
trigger1 = Time = 0
sysvar(1) = (command = "holdfwd") - (command = "holdback")

[State 40, 3]
type = VarSet
trigger1 = Time = 0
var(15) = 0

[State 40, 3]
type = VarSet
triggerall = Time = 0
triggerall = sysvar(1)
trigger1 = (PrevStateNo = 100 || PrevStateNo = 101) && sysvar(1) = 1
trigger2 = Command = "jump"
trigger3 = Command = "jump" && Command = "holdfwd"
trigger4 = Command = "jump" && Command = "holdback"
var(15) = 1

[State 40, v4];彫僕儍儞僾
type = VarSet
trigger1 = Time = 0
var(16) = 0

[State 40, v4]
type = VarSet
trigger1 = command != "holdup"
var(16) = 1

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = !var(15)
x = ifelse(sysvar(1)=0, 0, ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)*0.65

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = var(15)
x = ifelse(sysvar(1)=0, 0, ifelse(sysvar(1)=1, const(velocity.runjump.fwd.x), const(velocity.runjump.back.x)))
y = const(velocity.jump.y)

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
y = const(velocity.jump.y)*IfElse(var(16),0.65,1)

[State 2100, 残像]
type = AfterImage
triggerall = Time = 0
trigger1 = var(15)
time = 40
length = 6
timegap = 2
framegap = 2
palbright = 1, 1, 1
palcontrast = 128, 128, 128
paladd = -128, -128, -128
palmul = 1, 1, 1

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;Jump fwd
[Statedef 41]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 40, 1]
type = VarSet
trigger1 = 1
sysvar(1) = 1

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
x = const(velocity.jump.fwd.x)
y = const(velocity.jump.y)

[State 40, 5]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;Jump u
[Statedef 42]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 40, 1]
type = VarSet
trigger1 = 1
sysvar(1) = 0

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
x = const(velocity.jump.neu.x)
y = const(velocity.jump.y)

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

; (Ai)Jump Start
[Statedef 43]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1
facep2 = 1

[State 40, 1]
type = VarSet
trigger1 = time = 0
var(4) = 0

[State 40, 1];小ジャンプ
type = VarSet
trigger1 = command != "holdup"
trigger1 = !var(59)
trigger2 = var(59) && var(28) <= 0 && p2bodydist x < 90
var(4) = 1

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

[State 40, 2]
type = VarSet
Trigger1 = var(59) = 0
Trigger1 = command = "holdfwd"
Trigger2 = var(59) > 0 && var(27) = 2 && (var(28) = [6,8])
Trigger3 = var(59) > 0 && var(27) = 11 && (var(28) = [5,6])
Trigger4 = var(59) > 0 && var(27) = 11 && (var(28) = [15,16])
trigger5 = var(59) > 0 
sysvar(1) = 1

[State 40, 3]
type = VarSet
Trigger1 = var(59) = 0
Trigger1 = command = "holdback"
Trigger2 = var(59) < 0
Trigger2 = EnemyNear,StateType != L
Trigger2 = EnemyNear,MoveType != H
Trigger2 = BackEdgeBodyDist>60
Trigger2 = Random <= 500 || p2bodydist x < 0
sysvar(1) = -1

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = Var(4) = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)

[State 40, 4];小ジャンプ
type = VelSet
trigger1 = AnimTime = 0
trigger1 = Var(4) = 1
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = -6

[State 40, 5]
type = null;VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 5]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = var(4) = 0 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
; AirJump Start
[Statedef 45]
type    = A
physics = N
ctrl = 0
velset = 0,0

[State 45, 1]
type = ChangeAnim
trigger1 = SelfAnimExist(44)
value = 44

[State 45, 2]
type = ChangeAnim
trigger1 = !SelfAnimExist(44)
value = 41

[State 45, 3]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 45, 4]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 45, 5]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 45, 6]
type = VelSet
trigger1 = Time = 2
x = ifelse(sysvar(1)=0, const(velocity.airjump.neu.x), ifelse(sysvar(1)=1, const(velocity.airjump.fwd.x), const(velocity.airjump.back.x)))
y = const(velocity.airjump.y)

[State 45, 7]
type = ChangeState
trigger1 = Time = 2
value = 50
ctrl = 1

; Jump Startai
[Statedef 46]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 40, 4];小ジャンプ
type = VelSet
trigger1 = AnimTime = 0
x = 4.8
y = -8.4

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 47
ctrl = 1

; Jump Up
[Statedef 47]
type    = A
physics = A
anim = 42

[State velset]
type = velAdd
trigger1 = 1
y = .36

[State 40, 6]
type = ChangeState
trigger1 = p2bodydist x = [-12,12]
trigger1 = p2bodydist y = [30,55]
trigger1 = vel y > 0
value = 660
;---------------------------------------------------------------------------
; Jump Up
[Statedef 50]
type     = A
movetype = I
physics  = A

[State 0, 保护]
type = NotHitBy
trigger1 = (helper(40100),var(15) >= 1)
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 10
ignorehitpause = 1
persistent = 1

[State 0, 阻止空防]
type = AssertSpecial
trigger1 = var(59) >= 1
flag = noairguard
ignorehitpause = 1
persistent = 1

[State 50, 1]
type = Turn
trigger1 = AnimElem = 1,=1
trigger1 = (((enemynear(var(58)),pos X)-pos X)*facing) < -20

[State 50, 1]
type = VarSet
trigger1 = AnimElem = 1,=1
sysvar(1) = 0

[State 40, v4]
type = VarSet
trigger1 = !var(16)
var(16) = 0

[State 40, v4]
type = VarSet
trigger1 = var(16)
var(16) = 1

[State 50, 2]
type = PlaySnd
trigger1 = var(16)
trigger1 = AnimElem = 1,=1
value = S50,0

[State 50, 2]
type = PlaySnd
trigger1 = var(16) = 0
trigger1 = AnimElem = 1,=1
value = S50,1

[State 50, 2]
type = ChangeAnim
trigger1 = Anim != [41,43]
value = ifelse(var(16),41,ifelse((vel x)=0, 41, ifelse((vel x)>0, 42, 43)))

[State 50, end]
type = ChangeState
trigger1 = Pos Y >= 0 && Vel Y > 0
value = 52

;---------------------------------------------------------------------------
; Jump Down (empty state for compatibility)
[Statedef 51]
type    = A
physics = A

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

;---------------------------------------------------------------------------
; Jump Land
[Statedef 52]
type    = S
physics = S
ctrl = 0
anim = 47

[State 0, CtrlSet]
type = CtrlSet
trigger1 = AnimElem = 2
value = 1

[State 5110, fall]
type = Explod
trigger1 = Time = 0
anim = 8430
pos = -10,0
postype = p1
facing = 1
sprpriority = -100
bindtime = 1
ownpal = 1
scale = 0.5,0.5

[State 5110, fall]
type = Explod
trigger1 = Time = 0
anim = 8430
pos = 10,0
postype = p1
facing = -1
sprpriority = -100
bindtime = 1
ownpal = 1
scale = 0.5,0.5

[State 52, 1]
type = VelSet
trigger1 = Time = 0
y = 0

[State 100, 1]
type = VelSet
trigger1 = time = 6
x = 0

[State 100, 1]
type = VelMul
trigger1 = 1
x = .85

[State 52, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 52, snd]
type = PlaySnd
trigger1 = Time = 0
value = S52,0

[State 52, 4]
type = ChangeState
trigger1 = var(59) <= 0
trigger1 = command = "holddown"
trigger1 = AnimTime = 0
value = 11
ctrl = 1

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

;---------------------------------------------------------------------------
;近抓取
[Statedef 80]
type    = S                      ;状态: S-站立, C-蹲, A-空中, L-倒地
movetype= I                      ;招式种类: A-攻击, I-非攻击, H-受击
physics = S                      ;物理: S-站立, C-蹲, A-空中
;常用的控制器:
velset = 0,0                     ;设定速度 (x,y) (不写这行则不改变速度)
ctrl = 0                         ;设定可控与否 (不写这行则不改变ctrl)
anim = 80                       ;改变动作 (不写这行则不改变anim)
sprpriority = 5                  ;设定p1的贴图优先度到2 (在前面)
facep2 = 1

;---------------------------------------------------------------------------
;无敌
[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 4
ignorehitpause = 1
persistent = 1

;---------------------------------------------------------------------------
;弹幕攻击判定
[State 80]
type = Projectile
trigger1 = time = [0,5]
projID = 81
projanim = 81
projremove = 1
projpriority = 50
projhitanim = 81
projremanim = 81
projsprpriority = 5
projshadow = 0,0,0
projremovetime = 1
offset = 0,0
velocity = 0, 0
attr = S, SP
animtype = Hard
damage = 10,0
hitflag = MAFD
guardflag = 
hitsound = -1
guardsound = -1
pausetime = 0,0
sparkno = -1
guard.sparkno = -1
sparkxy = 20,-45
ground.type = Low
ground.hittime = 23
ground.slidetime = 23
ground.velocity = 0
air.velocity = 0,0
p2stateno = 85
air.fall = 1
numhits = 0
kill = 1

;---------------------------------------------------------------------------
;攻击反弹
[State 0, ReversalDef]
type = ReversalDef
trigger1 = Abs((enemynear,pos X)-pos X) <= 80
trigger2 = Numtarget
reversal.attr = SCA,NA,SA,HA,NT,ST,HT
pausetime = 0,0
sparkno = -1
hitsound = -1
p2stateno = 85
numhits = 0
ignorehitpause = 1
persistent = 1

;---------------------------------------------------------------------------
;当身跳转
[State 0, 当身跳转]
type = ChangeState
trigger1 = Numtarget
trigger1 = EnemyNear(var(58)),movetype = H
trigger1 = EnemyNear(var(58)),stateno = 85
value = 960
ctrl = 0

;---------------------------------------------------------------------------
;准神用
[State -1, -1]
type = SelfState
triggerall = palno >= 6
triggerall = var(59) >= 1
trigger1 = random%4 = 1
trigger1 = animtime = 0
value = 3800
ctrl = 0

;---------------------------------------------------------------------------
;准神用
[State -1, -1]
type = SelfState
triggerall = palno <= 5
triggerall = var(59) >= 1
trigger1 = animtime = 0
value = 710
ctrl = 0

;---------------------------------------------------------------------------
;普通跳转
[State 80, 1]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;近抓取
[Statedef 81]
type    = S                      ;状态: S-站立, C-蹲, A-空中, L-倒地
movetype= I                      ;招式种类: A-攻击, I-非攻击, H-受击
physics = S                      ;物理: S-站立, C-蹲, A-空中
;常用的控制器:
velset = 0,0                     ;设定速度 (x,y) (不写这行则不改变速度)
ctrl = 0                         ;设定可控与否 (不写这行则不改变ctrl)
anim = 80                       ;改变动作 (不写这行则不改变anim)
sprpriority = 5                  ;设定p1的贴图优先度到2 (在前面)
facep2 = 1

;---------------------------------------------------------------------------
;无敌
[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 4
ignorehitpause = 1
persistent = 1

;---------------------------------------------------------------------------
;弹幕攻击判定
[State 80]
type = Projectile
trigger1 = time = [0,5]
projID = 81
projanim = 81
projremove = 1
projpriority = 50
projhitanim = 81
projremanim = 81
projsprpriority = 5
projshadow = 0,0,0
projremovetime = 1
offset = 0,0
velocity = 0, 0
attr = S, SP
animtype = Hard
damage = 10,0
hitflag = MAFD
guardflag = 
hitsound = -1
guardsound = -1
pausetime = 0,0
sparkno = -1
guard.sparkno = -1
sparkxy = 20,-45
ground.type = Low
ground.hittime = 23
ground.slidetime = 23
ground.velocity = 0
air.velocity = 0,0
p2stateno = 85
air.fall = 1
numhits = 0
kill = 1

;---------------------------------------------------------------------------
;攻击反弹
[State 0, ReversalDef]
type = ReversalDef
trigger1 = Abs((enemynear,pos X)-pos X) <= 80
trigger2 = Numtarget
reversal.attr = SCA,NA,SA,HA,NT,ST,HT
pausetime = 0,0
sparkno = -1
hitsound = -1
p2stateno = 85
numhits = 0
ignorehitpause = 1
persistent = 1

;---------------------------------------------------------------------------
;当身跳转
[State 0, 当身跳转]
type = ChangeState
trigger1 = Numtarget
trigger1 = EnemyNear(var(58)),movetype = H
trigger1 = EnemyNear(var(58)),stateno = 85
value = 960
ctrl = 0

;---------------------------------------------------------------------------
;准神用
[State -1, -1]
type = SelfState
triggerall = palno >= 6
triggerall = var(59) >= 1
trigger1 = random%4 = 1
trigger1 = animtime = 0
value = 3800
ctrl = 0

;---------------------------------------------------------------------------
;准神用
[State -1, -1]
type = SelfState
triggerall = palno <= 5
triggerall = var(59) >= 1
trigger1 = animtime = 0
value = 710
ctrl = 0

;---------------------------------------------------------------------------
;普通跳转
[State 80, 1]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;抓取前置p2
[statedef 85, 地面p2]
type    = U
movetype= H
physics = N
poweradd = 0
VelSet = 0,0
ctrl = 0
sprpriority = -2
facep2 = 1

;---------------------------------------------------------------------------
;helper销毁
[State 0, DestroySelf]
type = DestroySelf
trigger1 = ishelper
ignorehitpause = 1
persistent = 1

;---------------------------------------------------------------------------
[State 0, 位置修正]
type = PosSet
trigger1 = time = 0
y = 0
ignorehitpause = 1
persistent = 1

[State 0, HitFallSet]
type = HitFallSet
trigger1 = 1
value = 0
ignorehitpause = 1
persistent = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = time < 2
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1
ignorehitpause = 1
persistent = 1

[State 0, HitBy]
type = HitBy
trigger1 = time >= 2
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1
ignorehitpause = 1
persistent = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = time >= 120
value = 24935
ctrl = 0

;---------------------------------------------------------------------------
; Run forward
[Statedef 100]
type    = S
physics = S
anim = 100
sprpriority = 1
ctrl = !var(59)

[State 0, Y轴速度归零]
type = VelSet
trigger1 = 1
y = 0
ignorehitpause = 1
persistent = 0

[State 0, Y轴坐标修复]
type = PosSet
trigger1 = 1
y = 0
ignorehitpause = 1
persistent = 1 

[State -2, 消除特效]
type = removeexplod
triggerall = !Ishelper
trigger1 = 1
ID = 1040
ignorehitpause = 1
persistent = 1

[State -2, 消除特效]
type = removeexplod
triggerall = !Ishelper
trigger1 = 1
ID = 1041
ignorehitpause = 1
persistent = 1

[State 306,灰尘特效]
type = Explod
ownpal = 1
trigger1 = Time = 3
anim = 8400
postype = P1
pos = 10,0
sprpriority = 10
scale = 0.5,0.5
ownpal = 1

[State 306,灰尘特效]
type = Explod
ownpal = 1
trigger1 = Animelem = 3
anim = 8410
postype = P1
pos = 0,0
sprpriority = 10
scale = 0.8,0.8
ownpal = 1

[State 306,灰尘特效]
type = Explod
ownpal = 1
trigger1 = Animelem = 6
anim = 8410
postype = P1
pos = 0,0
sprpriority = 10
scale = 0.8,0.8
ownpal = 1

[State 100, playsnd]
type = playsnd
trigger1 = animelem = 2,=1
value = s100,0
volumescale = 100
ignorehitpause = 1
persistent = 1

[State 100, playsnd]
type = playsnd
trigger1 = animelem = 7,=0
value = s100,1
volumescale = 100
ignorehitpause = 1
persistent = 1


[State 100, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, 4]
type = ChangeState
triggerall = var(59) <= 0
trigger1 = command = "holdup"
value = 40 ;跑步中跳可以出现残影跳

[State 100, 4]
Type = ChangeState
TriggerAll = var(59) <= 0
Trigger1 = command != "holdfwd"
value = ifelse(Time < 14,0,101)

[State 100, AI]
type = ChangeState
triggerall = var(59) >= 1
triggerall = Time >= 10
trigger1 = Facing*(EnemyNear(var(58)),pos x-pos x) <= 40
trigger1 = EnemyNear(var(58)),pos y-pos y >= -120 ;X方向（横向）离40码以内，Y方向（纵向）离120码以内
trigger1 = EnemyNear(var(58)),MoveType != H ;对面不是被打状态
trigger1 = EnemyNear(var(58)),Facing != Facing ||(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) < 0 ;面对对面或者对面逆向停止跑动
trigger2 = EnemyNear(var(58)),MoveType = A ;对面处于攻击状态
trigger2 = EnemyNear(var(58)),Facing != Facing ;面对对面
trigger2 = InGuardDist ;处在inguarddist范围内（之前有说过，inguarddist也就是对面攻击给自己产生的防御距离）
trigger3 = EnemyNear(var(58)),StateType = L ;对面倒地了
trigger3 = Facing*(EnemyNear(var(58)),pos x-pos x) <= 60 ;60个距离点内停止跑动
trigger4 = InGuardDist ;处在inguarddist范围内（之前有说过，inguarddist也就是对面攻击给自己产生的防御距离）
trigger4 = EnemyNear(var(58)),Facing != Facing ;面对对面
trigger5 = Enemy,NumProj ;对面有飞行道具停止跑动
trigger6 = EnemyNear(var(58)),MoveType = H ;对面是被打状态
trigger6 = facing*(EnemyNear(var(58)),pos x-pos x)-15 <= 40 ;X方向（横向）离60码以内
trigger7 = roundstate != 2
value = 0
anim = 0
ctrl = 1

[State 100, AI]
type = ChangeState
triggerall = var(59) >= 1
triggerall = Time >= 1
trigger1 = EnemyNear(var(58)),StateType != L
trigger1 = facing*(EnemyNear(var(58)),pos x-pos x)-40 < 0
trigger2 = EnemyNear(var(58)),MoveType = A ;对面处于攻击状态
trigger2 = EnemyNear(var(58)),Facing != Facing ;面对对面
trigger2 = facing*(EnemyNear(var(58)),pos x-pos x)-50 < 0
value = 0
anim = 0
ctrl = 1

[Statedef 101]
type    = S
physics = S
anim = 101
sprpriority = 1
ctrl = 0

[State 100, 1]
type = VelSet
trigger1 = Animtime = 0
x = 0

[State 100, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; 特殊跑步
[Statedef 102]
type    = S
physics = S
anim = 100
sprpriority = 1
ctrl = !var(59)

[State 0, Y轴速度归零]
type = VelSet
trigger1 = 1
y = 0
ignorehitpause = 1
persistent = 0

[State 0, Y轴坐标修复]
type = PosSet
trigger1 = 1
y = 0
ignorehitpause = 1
persistent = 1 

[State -2, 消除特效]
type = removeexplod
triggerall = !Ishelper
trigger1 = 1
ID = 1040
ignorehitpause = 1
persistent = 1

[State -2, 消除特效]
type = removeexplod
triggerall = !Ishelper
trigger1 = 1
ID = 1041
ignorehitpause = 1
persistent = 1

[State 306,灰尘特效]
type = Explod
ownpal = 1
trigger1 = Time = 3
anim = 8400
postype = P1
pos = 10,0
sprpriority = 10
scale = 0.5,0.5
ownpal = 1

[State 306,灰尘特效]
type = Explod
ownpal = 1
trigger1 = Animelem = 3
anim = 8410
postype = P1
pos = 0,0
sprpriority = 10
scale = 0.8,0.8
ownpal = 1

[State 306,灰尘特效]
type = Explod
ownpal = 1
trigger1 = Animelem = 6
anim = 8410
postype = P1
pos = 0,0
sprpriority = 10
scale = 0.8,0.8
ownpal = 1

[State 100, playsnd]
type = playsnd
trigger1 = animelem = 2,=1
value = s100,0
volumescale = 100
ignorehitpause = 1
persistent = 1

[State 100, playsnd]
type = playsnd
trigger1 = animelem = 7,=0
value = s100,1
volumescale = 100
ignorehitpause = 1
persistent = 1


[State 100, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, AI]
type = ChangeState
triggerall = var(59) >= 1
triggerall = Time >= 10
trigger1 = EnemyNear(var(58)),StateType = L
trigger2 = roundstate != 2
value = 0
anim = 0
ctrl = 1

[State 100, AI]
type = ChangeState
triggerall = var(59) >= 1
triggerall = Time >= 1
trigger1 = EnemyNear(var(58)),StateType != L
trigger1 = facing*(EnemyNear(var(58)),pos x-pos x)-20 < 0
value = 0
anim = 0
ctrl = 1

;---------------------------------------------------------------------------
; Hop backwards
[Statedef 105]
type    = S
physics = N
ctrl = 0
anim = 105
sprpriority = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SC,AT

[state a]
type = statetypeset
trigger1 = animelem = 2
Statetype = A

[State 105, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 2
value = s105,0

[State 306,灰尘特效]
type = Explod
trigger1 = Animelem = 2
anim = 8410
postype = P1
pos = -10,5
sprpriority = 10
facing = -1
ownpal = 1

[State 105, VelSet]
type = VelSet
trigger1 = AnimElem = 2
x = const(velocity.run.back.x)
y = const(velocity.run.back.y)

[State 105, End]
type = ChangeState
trigger1 = !AnimTime
value = 106

;---------------------------------------------------------------------------
; Hop backwards (land)
[Statedef 106]
type    = S
physics = S
ctrl = 0
anim = 106

[State 0, 保护]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 2
ignorehitpause = 1
persistent = 1

[State playsnd]
type = playsnd
trigger1 = AnimElem = 1
value = s52,0

[State 5110, fall]
type = Explod
trigger1 = Time = 0
anim = 8430
pos = -10,0
postype = p1
facing = 1
sprpriority = -100
bindtime = 1
ownpal = 1
scale = 0.5,0.5

[State 5110, fall]
type = Explod
trigger1 = Time = 0
anim = 8430
pos = 10,0
postype = p1
facing = -1
sprpriority = -100
bindtime = 1
ownpal = 1
scale = 0.5,0.5

[State 106, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 106, 3]
type = MakeDust
trigger1 = Time = 2
pos = 0, 0
spacing = 1

[State 106, CtrlSet]
type = CtrlSet
trigger1 = Time >= 2
value = 1

[State 100, 4]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; 防御开始
[Statedef 120]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged

[State 0, 特殊P数跳转]
type = SelfState
triggerall = !ishelper
triggerall = var(59) >= 1
trigger1 = palno >= 5 
value = cond(random%2,700,81)
ctrl = 0
ignorehitpause = 1
persistent = 1

[State 0, 阻止空防]
type = SelfState
triggerall = !ishelper
triggerall = var(59) >= 1
trigger1 = statetype = A
value = 50
ctrl = 1
ignorehitpause = 1
persistent = 1

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

[State 120, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 120 + (statetype = C) + (statetype = A)*2

[State 120, 2]
type = StateTypeSet
triggerall = !var(59)
trigger1 = Time = 0 && statetype = S
physics = S

[State 120, 3]
type = StateTypeSet
triggerall = !var(59)
trigger1 = Time = 0 && statetype = C
physics = C

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) >= 1
trigger1 = var(48) = 1 ;var(48) = 1为蹲防，2为站防，下面有一样的就不多讲了
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) >= 1
trigger1 = var(48) = 2
statetype = S
physics = S

[State 120, 4]
type = statetypeset
trigger1 = Time = 0 && statetype = A
physics = A

[State 120, Hi to Lo]
type = statetypeset
triggerall = !var(59)
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 120, Lo to Hi]
type = statetypeset
triggerall = !var(59)
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 120, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 130 + (statetype = C) + (statetype = A)*2

[State 120, AITurn]
type = turn
triggerall = var(59)
trigger1 = !ctrl
trigger1 = anim = 120 || anim = 121
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)) < 0

[State -1,AI]
type = ChangeState
triggerall = var(59)
triggerall = !inguarddist
trigger1 = enemynear(var(58)),movetype != A || (var(59) = 1)
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) < 0
trigger2 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) >= 0
trigger2 = numhelper(31000+id)
trigger2 = !helper(31000+id),inguarddist || (var(59) = 1)
value = 140
ignorehitpause = 1

[State -1,AI]
type = ChangeState
triggerall = var(59)
triggerall = inguarddist
trigger1 = enemynear(var(58)),facing = facing
trigger1 = Facing*(EnemyNear(var(58)),Pos x-Pos x) > 0
trigger1 = enemynear(var(58)),animtime > -3
trigger1 = enemynear(var(58)),numproj = 0
value = 140
ignorehitpause = 1

[State 120, Stop Guarding]
type = ChangeState
triggerall = !var(59)
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; 防御中
[Statedef 130]
type    = S
physics = S

[State 130, AITurn]
type = changestate
triggerall = var(59)
trigger1 = !ctrl
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)) < 0
value = 120

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

[State 130, Hi to Lo]
type = ChangeState
trigger1 = var(59) < 1
trigger1 = command = "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 1
value = 131

[State 130, Hi to Lo]
type = ChangeState
triggerall = !var(59)
trigger1 = command = "holddown"
value = 131

[State -1,AI]
type = ChangeState
triggerall = var(59)
triggerall = !inguarddist
trigger1 = enemynear(var(58)),movetype != A || (var(59) = 1)
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) < 0
trigger2 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) >= 0
trigger2 = numhelper(31000+id)
trigger2 = !helper(31000+id),inguarddist || (var(59) = 1)
value = 140
ignorehitpause = 1

[State 130, Stop Guarding]
type = ChangeState
triggerall = var(59) < 1
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State 130, Stop Guarding]
type = ChangeState
triggerall = var(59) >= 1
triggerall = !inguarddist
trigger1 = enemynear(var(58)),movetype != A ;不处于攻击状态并且背对自己
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) < 0
trigger2 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) >= 0
trigger2 = numhelper(31000+ID)
trigger2 = !helper(31000+ID),inguarddist ;确认helper不在guarddist内撤销防御
value = 140
ignorehitpause = 1

;---------------------------------------------------------------------------
; 蹲防中
[Statedef 131]
type    = C
physics = C

[State 131, AITurn]
type = changestate
triggerall = var(59)
trigger1 = !ctrl
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)) < 0
value = 120

[State 131, 1]
type = ChangeAnim
trigger1 = Anim != 131
value = 131

[State 131, Lo to Hi]
type = ChangeState
trigger1 = var(59) < 1
trigger1 = command != "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 2
value = 130

[State 131, Stop Guarding]
type = ChangeState
triggerall = var(59) < 1
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State 131, Stop Guarding]
type = ChangeState
triggerall = var(59) >= 1
triggerall = !inguarddist
trigger1 = enemynear(var(58)),movetype != A
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) < 0
trigger2 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) >= 0
trigger2 = numhelper(31000+ID)
trigger2 = !helper(31000+ID),inguarddist
value = 140
ignorehitpause = 1

[State 131, Lo to Hi]
type = ChangeState
triggerall = !var(59)
trigger1 = command != "holddown"
value = 130

[State 131, Stop Guarding]
type = ChangeState
triggerall = !var(59)
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; 空防中
[Statedef 132]
type    = A
physics = N

[State 132, 1]
type = ChangeAnim
trigger1 = Anim != 132
value = 132

[State 132, 2]
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)

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

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

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

[State 132, 6]
type = ChangeState
triggerall = sysvar(0)
triggerall = inguarddist
trigger1 = var(59) < 1
trigger1 = command = "holdback"
trigger2 = var(59) >= 1
value = 130

[State 132, 7]
type = ChangeState
trigger1 = sysvar(0)
value = 52

[State 132, Stop Guarding]
type = ChangeState
triggerall = var(59) < 1
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State 132, Stop Guarding]
type = ChangeState
triggerall = var(59) >= 1
triggerall = !inguarddist
trigger1 = enemynear(var(58)),movetype != A
trigger1 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) < 0
trigger2 =(Facing*(EnemyNear(var(58)),Pos x-Pos x)-30) >= 0
trigger2 = numhelper(31000+ID)
trigger2 = !helper(31000+ID),inguarddist
value = 140
ignorehitpause = 1

;---------------------------------------------------------------------------
; 防御结束
[Statedef 140]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged
ctrl = 1

[State 140, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 140 + (statetype = C) + (statetype = A)*2

[State 140, 2]
type = StateTypeSet
triggerall = !var(59)
trigger1 = Time = 0 && statetype = S
physics = S

[State 140, 3]
type = StateTypeSet
triggerall = !var(59)
trigger1 = Time = 0 && statetype = C
physics = C

[State 140, 4]
type = StateTypeSet
trigger1 = Time = 0 && statetype = A
physics = A

[State 140, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) < 1
trigger1 = command = "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 1
statetype = C
physics = C

[State 140, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) < 1
trigger1 = command != "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 2
statetype = S
physics = S

;[State 140, 5] ;引擎内部完成了这部分代码
;type = ChangeState
;trigger1 = AnimTime = 0
;value = (statetype = C)*11 + (statetype = A)*51

;---------------------------------------------------------------------------
; 防御受击
[Statedef 150]
type    = S
movetype= H
physics = N
VelSet = 0,0

;---------------------------------------------------------------------------
; 防御受击和硬直中免疫投技7f

[State 0, 免疫投技]
type = NotHitBy
trigger1 = 1
value = ,NT,ST,HT
time = 7
ignorehitpause = 1
persistent = 1

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

[State 150, 2]
type = ChangeState
triggerall = !var(59)
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

[State 150, 3]
type = ChangeState
triggerall = var(59)
triggerall = HitShakeOver
trigger1 = enemynear(var(58)),animtime <= 0
trigger2 = enemynear(var(58)),movetype = H
value = 151 + 2*(enemynear(var(58)),statetype = C || enemynear(var(58)),time < 20 && enemynear(var(58)),statetype = S)

[State 150, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) < 1
trigger1 = command = "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 1
statetype = C
physics = C

[State 150, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) < 1
trigger1 = command != "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 2
statetype = S
physics = S

[State 150, 3]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 3

;---------------------------------------------------------------------------
; 防御硬直
[Statedef 151]
type    = S
movetype= H
physics = S
anim = 150

;---------------------------------------------------------------------------
; 防御受击和硬直中免疫投技7f

[State 0, 免疫投技]
type = NotHitBy
trigger1 = 1
value = ,NT,ST,HT
time = 7
ignorehitpause = 1
persistent = 1

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

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

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

[State 151, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
value = 1

[State 151, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) < 1
trigger1 = command = "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 1
statetype = C
physics = C

[State 151, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) < 1
trigger1 = command != "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 2
statetype = S
physics = S

[State -1,AI]
type = changeState
triggerall = var(59)
trigger1 = HitOver
value = 130
ctrl = 1
ignorehitpause = 1

[State 151, 4]
type = changeState
triggerall = !var(59)
trigger1 = HitOver
value = 130
ctrl = 1

;---------------------------------------------------------------------------
; 蹲防受击
[Statedef 152]
type    = C
movetype= H
physics = N
VelSet = 0,0

;---------------------------------------------------------------------------
; 防御受击和硬直中免疫投技7f

[State 0, 免疫投技]
type = NotHitBy
trigger1 = 1
value = ,NT,ST,HT
time = 7
ignorehitpause = 1
persistent = 1

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

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

[State 152, 2]
type = ChangeState
triggerall = !var(59)
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

[State 152, 3]
type = ChangeState
triggerall = var(59)
triggerall = HitShakeOver
trigger1 = enemynear(var(58)),animtime <= 0
trigger2 = enemynear(var(58)),movetype = H
value = 151 + 2*(p2statetype = C || enemynear(var(58)),time < 20 && enemynear(var(58)),statetype = S)

[State 152, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) < 1
trigger1 = command = "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 1
statetype = C
physics = C

[State 152, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) < 1
trigger1 = command != "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 2
statetype = S
physics = S

[State 152, 4]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 4

;---------------------------------------------------------------------------
; 蹲防硬直
[Statedef 153]
type    = C
movetype= H
physics = C
anim = 151

;---------------------------------------------------------------------------
; 防御受击和硬直中免疫投技7f

[State 0, 免疫投技]
type = NotHitBy
trigger1 = 1
value = ,NT,ST,HT
time = 7
ignorehitpause = 1
persistent = 1

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

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

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

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

[State 153, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) < 1
trigger1 = command = "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 1
statetype = C
physics = C

[State 153, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) < 1
trigger1 = command != "holddown"
trigger2 = var(59) >= 1
trigger2 = var(48) = 2
statetype = S
physics = S

[State -1,AI]
type = changeState
triggerall = var(59)
trigger1 = HitOver
value = 131
ctrl = 1
ignorehitpause = 1

[State 153, 4]
type = changeState
triggerall = !var(59)
trigger1 = HitOver
value = 131
ctrl = 1

;---------------------------------------------------------------------------
; 空防受击
[Statedef 154]
type    = A
movetype= H
physics = N
velset = 0,0

;---------------------------------------------------------------------------
; 防御受击和硬直中免疫投技7f

[State 0, 免疫投技]
type = NotHitBy
trigger1 = 1
value = ,NT,ST,HT
time = 7
ignorehitpause = 1
persistent = 1

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

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

[State 154, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 155 ;AGUARDHIT2

[State 154, 3]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 4

;---------------------------------------------------------------------------
; 空防硬直
[Statedef 155]
type    = A
movetype= H
physics = N
anim = 152

;---------------------------------------------------------------------------
; 防御受击和硬直中免疫投技7f

[State 0, 免疫投技]
type = NotHitBy
trigger1 = 1
value = ,NT,ST,HT
time = 7
ignorehitpause = 1
persistent = 1

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

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

[State 155, 2]
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)

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

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

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

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

[State 155, 6]
type = ChangeState
triggerall = sysvar(0)
triggerall = inguarddist
trigger1 = var(59) < 1
trigger1 = command = "holdback"
trigger2 = var(59) >= 1
value = 130

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

;---------------------------------------------------------------------------
; Draw game (time over)
[Statedef 175]
type = S
ctrl = 0
velset = 0,0

[State 175, 1] ; If no anim, use go to lose state.
type = ChangeState
trigger1 = Time = 0
trigger1 = !SelfAnimExist(175)
value = 170

[State 175, 2]
type = ChangeAnim
trigger1 = Time = 0
value = 175

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

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

[Statedef 4480]
type = U
physics = U
movetype = H
ctrl = 0

[State 0]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 3
ignorehitpause = 1
persistent = 1

[State 自毁]
type = DestroySelf
trigger1 = ishelper
ignorehitpause = 1

[State 4450]
type = ChangeState
Trigger1 = time >= 0
trigger1 = !hitfall
Trigger1 = StateType = S
value = 24500

[State 4450]
type = ChangeState
Trigger1 = time >= 0
trigger1 = !hitfall
Trigger1 = StateType = C
value = 24500

[State 4450]
type = ChangeState
Triggerall = time >= 0
triggerall = statetype != L
Trigger1 = StateType = A
trigger2 = hitfall
value = 24710

[State 4450]
type = ChangeState
Trigger1 = time >= 0
Trigger1 = StateType = L
value = 5080

;---------------------------------------------------------------------------
; Stand get-hit (shaking)
[Statedef 5000]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(groundtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5000, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5000, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5000, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5000, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5000, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5000, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5000, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

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

;---------------------------------------------------------------------------
; Stand get-hit (knocked back)
[Statedef 5001]
type    = S
movetype= H
physics = S

[State 5001, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5001, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5005 + GetHitVar(animtype) + (GetHitVar(groundtype)=2)*10

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5001, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5001, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5001, 6]
type = ChangeState
trigger1 = HitOver
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Crouch get-hit (shaking)
[Statedef 5010]
type    = C
movetype= H
physics = N
velset = 0,0

[State 5010, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = 5020 + GetHitVar(animtype)

[State 5010, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5010, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5010, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5010, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
triggerall = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5010, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5011 ;Crouch get-hit (knocked back)

[State 5010, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5010, FFB Light]
type = ForceFeedback
trigger1 = anim = 5020
persistent = 0
time = 6
waveform = square

[State 5010, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5021
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5010, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5022
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; Crouch get-hit (knocked back)
[Statedef 5011]
type    = C
movetype= H
physics = C

[State 5011, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5011, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5025 + GetHitVar(animtype)

[State 5011, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5011, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5011, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5011, 6]
type = ChangeState
trigger1 = HitOver
value = 11
ctrl = 1

;---------------------------------------------------------------------------
; Air get-hit (shaking)
[Statedef 5020]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5020, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5020, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5020, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5020, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5020, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
trigger4 = anim = [5051,5059]
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; Air get-hit (knocked away)
[Statedef 5030]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = ChangeAnim
trigger1 = Anim != [5000, 5199]
trigger1 = SelfAnimExist(5030)
value = 5030

[State 5030, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5030, 3]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5030, 4]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= Const(movement.air.gethit.groundlevel)
value = 5040 ;HITA_RECOV

[State 5030, 5]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= Const(movement.air.gethit.groundlevel)
value = 5050 ;HITA_FALL

[State 5030, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 5035 ;Air get-hit (transition)

;---------------------------------------------------------------------------
; Air get-hit (transition)
[Statedef 5035]
type    = A
movetype= H
physics = N

[State 5035, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

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

[State 5035, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;Air get-hit (recovering in air, not falling)

[State 5035, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5050 ;Air get-hit (falling)

;---------------------------------------------------------------------------
; Air get-hit (recovering in air, not falling)
[Statedef 5040]
type    = A
movetype= H
physics = N

[State 5040, 1]
type = ChangeState
trigger1 = !Alive
value = 5050
ctrl = 0

[State 5040, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim != 5040
trigger2 = Time = 0
trigger2 = Anim != 5035
value = 5040

[State 5040, 3]
type = CtrlSet
trigger1 = HitOver
value = 1

[State 5040, 4]
type = StateTypeSet
trigger1 = HitOver
movetype = I

[State 5040, 5]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5040, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;Jump land

;---------------------------------------------------------------------------
; Air get-hit (falling)
[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, Const720p(4), Const720p(-8))
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 >= Const(movement.air.gethit.groundrecover.ground.threshold)
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;Air get-hit (fall recovery on ground)

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > Const(movement.air.gethit.airrecover.threshold)
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;Air get-hit (fall recovery in air)

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, Const(movement.air.gethit.groundlevel))
value = 5100 ;Downed get-hit (hit ground from fall)

;---------------------------------------------------------------------------
; Tripped get-hit (shaking)
[Statedef 5070]
type    = A
movetype= H
physics = N
velset = 0,0

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

[State 5070, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 5071

[State 5070, 3]
type = ForceFeedback
trigger1 = time = 0
time = 12
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; Tripped get-hit (knocked away)
[Statedef 5071]
type    = A
movetype= H
physics = N

[State 5071, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5071, 2] ;Acceleration
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5071, 3] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Const(movement.air.gethit.trip.groundlevel)
type = ChangeState
value = 5110

;---------------------------------------------------------------------------
; Downed get-hit (shaking)
[Statedef 5080]
type    = L
movetype= H
physics = N
velset = 0,0

;[State 5080, 1] ;Set default anim
;type = VarSet
;trigger1 = time = 0
;sysvar(2) = ifelse (GetHitVar(yvel) = 0, 5080, 5090)

;[State 5080, 2]
;type = VarAdd
;trigger1 = time = 0
;trigger1 = (anim = [5081,5089]) || (anim = [5111,5119])
;trigger1 = SelfAnimExist(sysvar(2) + (anim % 10))
;sysvar(2) = anim % 10

;[State 5080, 3] ;If 5090 doesn't exist, default to 5030
;type = VarSet
;trigger1 = time = 0
;trigger1 = sysvar(2) = 5090
;trigger1 = !SelfAnimExist(5090)
;sysvar(2) = 5030

;[State 5080, 3] ;Freeze
;type = ChangeAnim
;trigger1 = 1
;value = sysvar(2)

[State 5080, 3] ;Freeze
type = ChangeAnim
trigger1 = SelfAnimExist(5080)
value = 5080
ignorehitpause = 1
persistent = 1

[State 0, ChangeAnim2]
type = ChangeAnim2
trigger1 = !SelfAnimExist(5080)
value = 24530
ignorehitpause = 1
persistent = 1

[State 5080, 4]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0
value = 5081 ;Downed get-hit (knocked back)

[State 5080, 5]
type = SelfState
triggerall = (name = "Hotaru-Futaba") && (EnemyNear,name != "Hotaru-Futaba")
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) != 0
value = 5030 ;Air get-hit (knocked away)

[State 5080, 5]
type = ChangeState
triggerall = (name != "Hotaru-Futaba") || (EnemyNear,name = "Hotaru-Futaba")
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) != 0
value = 24935 ;Air get-hit (knocked away)

;---------------------------------------------------------------------------
; Downed get-hit (knocked back)
[Statedef 5081]
type    = L
movetype= H
physics = C

[State 5081, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5081, 2]
type = VelSet
trigger1 = HitOver
x = 0

;[State 5081, 3] ;Don't show hit ground frame
;type = VarSet
;trigger1 = Time = 0
;sysvar(0) = 1

[State 5081, 4]
type = ChangeState
trigger1 = HitOver
value = 24950 ;Downed get-hit (lying down)

;---------------------------------------------------------------------------
; Downed get-hit (hit ground from fall)
[Statedef 5100]
type    = L
movetype= H
physics = N

[State 5100, 2004.04.14 behavior]
type = null;VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x < -1
x = -1

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

[State 5100, ]
Type = VarSet
Trigger1 = Time = 0
sysvar(1) = floor(vel y)

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

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

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

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

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

[State 5100, 7]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;Downed get-hit (lying down)

[State 5100, fall]
type = Explod
trigger1 = anim = 5100
trigger1 = Time = 0
anim = 8430
pos = 0,0
postype = p1
facing = 1
sprpriority = -100
bindtime = 1
ownpal = 1
scale = 1.1,1.1

[State 5100, fall]
type = Explod
trigger1 = anim = 5100
trigger1 = Time = 0
anim = 8430
pos = 0,0
postype = p1
facing = -1
sprpriority = -100
bindtime = 1
ownpal = 1
scale = 1.1,1.1

[State 5100, fall]
type = Explod
trigger1 = anim = 5101
trigger1 = Time = 0
anim = 8300
pos = 0,0
postype = p1
sprpriority = 10
bindtime = 1
ownpal = 1
scale = 1.1,1.1

[State 5100, 10]
type = PlaySnd
trigger1 = anim = 5100
trigger1 = Time = 1
value = s5110,0

[State 5100, 10]
type = PlaySnd
trigger1 = anim = 5101
trigger1 = Time = 1
value = s810,1

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

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

[State 5100, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 5101 ;Downed get-hit (bounce off ground)

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

;---------------------------------------------------------------------------
; Downed get-hit (bounce off ground)
[Statedef 5101]
type    = L
movetype= H
physics = N

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 5101, 3]
type = HitFallVel
trigger1 = Time = 0

[State 5101, 4]
type = PosSet
trigger1 = Time = 0
y = Const(movement.down.bounce.offset.y)

[State 5101, 5]
type = PosAdd
trigger1 = Time = 0
x = Const(movement.down.bounce.offset.x)

[State 5101, 6] ;Acceleration
type = VelAdd
trigger1 = 1
y = Const(movement.down.bounce.yaccel)

[State 5101, 7] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Const(movement.down.bounce.groundlevel)
type = ChangeState
value = 5110

;---------------------------------------------------------------------------
; Downed get-hit (lying down)
[Statedef 5110]
type    = L
movetype= H
physics = N

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

[State 5100, EnvShake]
type = EnvShake
Trigger1 = GetHitVar(fall.envshake.time) = 0
Trigger1 = prevstateno != 5081
trigger1 = Time = 0
Trigger1 = Vel Y > 1
time = ifelse(Vel Y > 23,6,4)
freq = 30
ampl = ifelse(Vel Y > 19,ifelse(Vel Y > 23,-7,-5),-4)
phase = 0

[State 5110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

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

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

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

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

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

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

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

[State 5110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

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

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

[State 5110, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = s5110,0

[State 5110, fall]
type = Explod
trigger1 = Time = 0
trigger1 = !SysVar(0)
anim = 8430
pos = 0,0
postype = p1
facing = 1
sprpriority = -100
bindtime = 1
ownpal = 1
scale = 1.1,1.1

[State 5110, fall]
type = Explod
trigger1 = Time = 0
trigger1 = !SysVar(0)
anim = 8430
pos = 0,0
postype = p1
facing = -1
sprpriority = -100
bindtime = 1
ownpal = 1
scale = 1.1,1.1

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

[State 5110, 14] ;Friction
type = VelSet
trigger1 = abs(Vel x) < Const(movement.down.friction.threshold)
persistent = 0
x = 0

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

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

;---------------------------------------------------------------------------
; Downed get-hit (getting up)
[Statedef 5120]
type    = L
movetype= I
physics = N

[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

;---------------------------------------------------------------------------
; Downed get-hit (lying defeated)
[Statedef 5150]
type    = L
movetype= H
physics = N
sprpriority = -3
ctrl = 0

[State 0, 特殊击杀隐藏]
type = AssertSpecial
trigger1 = PrevStateNo = [3218,3219]
flag = invisible
ignorehitpause = 1
persistent = 1

[State 5150, 1] ;Normal anim
type = ChangeAnim
triggerall = Time = 0
triggerall = SelfAnimExist(5140)
trigger1 = (anim != [5111,5119]) && (anim != [5171,5179])
trigger2 = !SelfAnimExist(5140 + (anim % 10))
value = 5140

[State 5150, 3] ;Hit up type anim
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (anim = [5111,5119]) || (anim = [5171,5179])
trigger1 = SelfAnimExist(5140 + (anim % 10))
value = 5140 + (anim % 10)

[State 5150, 4] ;Match over anim
type = ChangeAnim
persistent = 0
;trigger1 = Time = 0
trigger1 = MatchOver = 1
trigger1 = Anim = [5140,5149]
trigger1 = SelfAnimExist(anim+10)
value = anim+10

[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != [5140,5159]
trigger1 = Anim != [5110,5119]
value = 5110

[State 5150, 6] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5150, 7] ;Friction
type = VelSet
trigger1 = abs(Vel x) < Const(movement.down.friction.threshold)
persistent = 0
x = 0

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

;---------------------------------------------------------------------------
; Air get-hit (fall recovery on ground; still falling)
[Statedef 5200]
type    = A
movetype= H
physics = N

[State 5200, 1] ;Change anim if done with transition
type = ChangeAnim
trigger1 = Anim = 5035
trigger1 = AnimTime = 0
value = 5050

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

[State 5200, 3]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Const(movement.air.gethit.groundrecover.groundlevel)
value = 5201

;---------------------------------------------------------------------------
; Air get-hit (fall recovery on ground)
[Statedef 5201]
type     = S
movetype = I
physics  = S
velset   = 0,0
anim     = 5200
ctrl     = 0
sprpriority = 2

[State 5201, 1] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -5

[State 5201, 1] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -5

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

[State 200, 壒傪柭傜偡]
type = PlaySnd
trigger1 = AnimElem = 1
value = s810,0
channel = 10

[State 5201, 5] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128 

[State 2110, 柍揋]
type = NotHitBy
trigger1 = 1
value = SCA

[State 2110, 堏摦検]
type = VelSet
trigger1 = AnimElemtime(1) >= 0 && AnimElemtime(6) <= 0
x = -3.0

[state 300,]
type = Veladd
trigger1 = AnimElemtime(2) >= 0 && AnimElemtime(6) <= 0
x = .021

[State 2110, 堏摦廔椆]
type = VelSet
trigger1 = AnimElem = 7
x = 0

[State 2110, 憡庤偲廳側偭偨帪偺張棟]
type = PlayerPush
trigger1 = AnimElemTime(1) > 0
value = 0

[State 2110, 廔椆]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Air get-hit (fall recovery in air)
[Statedef 5210]
type    = A
movetype= I
physics = N
anim = 5210
ctrl = 0

[State 5210, 1] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128

[State 5210, 1]
type = PosFreeze
trigger1 = Time < 4

[State 5210, 2] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < Const720p(-80)

[State 5210, 1.0 behavior 1]
type = VelMul
trigger1 = Time = 4
x = Const(velocity.air.gethit.airrecover.mul.x)
y = Const(velocity.air.gethit.airrecover.mul.y)

[State 5210, 1.0 behavior 2]
type = VelAdd
trigger1 = Time = 4
x = Const(velocity.air.gethit.airrecover.add.x)
y = Const(velocity.air.gethit.airrecover.add.y)

[State 5210, 2002.04.14 behavior 1]
type = null;VelMul
trigger1 = Time = 4
x = .8
y = .8

[State 5210, 2002.04.14 behavior 2]
type = null;VelAdd
trigger1 = Time = 4
x = 0 
y = -4.5

[State 5210, 2002.04.14 behavior 3]
type = null;VelMul
trigger1 = Time = 4
trigger1 = Vel Y > 0
y = .5

[State 5210, 2002.04.14 behavior 4]
type = null;VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -3
y = -2

[State 5210, 2002.04.14 behavior 5]
type = null;VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -2
y = -1

[State 5210, 2] ;Go up
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdup"
y = Const(velocity.air.gethit.airrecover.up)

[State 5210, 2] ;Go down
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holddown"
y = Const(velocity.air.gethit.airrecover.down)

[State 5210, 2] ;Go fwd
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdfwd"
x = Const(velocity.air.gethit.airrecover.fwd)

[State 5210, 2] ;Go back
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdback"
x = Const(velocity.air.gethit.airrecover.back)

[State 5210, 3]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 15

[State 5210, 4]
type = CtrlSet
trigger1 = Time = 20
value = 1

[State 5210, 5]
type = VelAdd
trigger1 = Time >= 4
y = Const(movement.air.gethit.airrecover.yaccel)

[State 5210, 5] ;Land on ground
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;Jump land
ctrl = 1

;---------------------------------------------------------------------------
; Continue screen animation
[Statedef 5500]
type = S
ctrl = 0
anim = 5300
velset = 0,0

[State 5500, 1] ;Use continue animation if available
type = ChangeAnim
trigger1 = time = 0
trigger1 = SelfAnimExist(5500)
value = 5500

;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S

;[State 5900, 1] ;Clear all int variables
;type = VarRangeSet
;trigger1 = roundsexisted = 0
;value = 0

;[State 5900, 2] ;Clear all float variables
;type = VarRangeSet
;trigger1 = roundsexisted = 0
;fvalue = 0

[State 0, 色表设置]
type = RemapPal
trigger1 = 1
source = 1,1
dest = 1,palno

[State 5900, 3] ;Intro for round 1
type = ChangeState
triggerall = TeamMode != turns
trigger1 = RoundsExisted = 0
value = 190

[State 5900, 3] ;Intro for round 1
type = ChangeState
triggerall = TeamMode = turns
triggerall = RoundsExisted = 0
trigger1 = roundno > 0
value = 190

[State 5900, 5] ;All other rounds
type = ChangeState
trigger1 = 1
value = 0
ctrl = 0

;---------------------------------------------------------------------------
;搳偘敳偗(憡庤)
[Statedef 5940]
type = S
movetype= H
physics = N
sprpriority = 1
velset = 0,0
ctrl = 0

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

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

[State 5940, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
trigger1 = selfanimexist(5940)
value = 5940

[State 5940, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
trigger1 = !selfanimexist(5940)
value = 120

[State 5940, ChangeAnim]
type = ChangeAnim
trigger1 = anim = 120 && animtime = 0
value = 130

[State 5940, SelfState]
type = SelfState
trigger1 = animtime = 0
trigger2 = time = 35
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;搳偘敳偗(帺暘)
[Statedef 5945]
type     = S
movetype = H
physics  = N
velset   = 0,0
anim     = 5945
ctrl     = 0
sprpriority = 1
facep2 = 1

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

[State 901, TargetBind]
type = TargetBind
trigger1 = time = 0
pos = 60,0

[State 5945, VelSet]
type = VelSet
trigger1 = animelem = 2
x = -5

[State 5945, VelMul]
type = VelMul
trigger1 = animelem = 2,> 0
x = .93

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

[State 5945, PlaySnd]
type = PlaySnd
trigger1 = animelem = 2,= 1
value = s6,1

[State 5945, AssertSpecial]
type = AssertSpecial
trigger1 = animelem = 2,= 1
flag = nofg

[State 5945, EnvColor]
type = EnvColor
trigger1 = animelem = 2,= 1
value = 255,255,255
under = 1

[State 5945, 僗僥乕僩曄峏]
type = ChangeState
trigger1 = animtime = 0
trigger2 = time = 35
value = 0
ctrl = 1

[Statedef 82000]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1270]
type = DestroySelf
trigger1 = ishelper
ignorehitpause = 1

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5020, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5020, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 82001

[State 820, 1]
type = selfstate
trigger1 = time > 444
value = 5030

[State 5020, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5020, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5020, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
trigger4 = anim = [5051,5059]
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 82001]
type    = A
movetype= H
physics = N
ctrl = 0

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

[State 5030, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5030, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 82003 ;HITA_FALL

[State 5030, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 82002 ;HITA_UP (transition)

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 82002]
type    = A
movetype= H
physics = N

[State 5035, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

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

[State 5035, 4]
type = ChangeState
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 82003 ;HITA_FALL

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 82003]
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, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 82004 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 82004]
type    = L
movetype= H
physics = N

[State 1274]
type = DestroySelf
trigger1 = ishelper
ignorehitpause = 1

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

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

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

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

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

[State 5100, fall]
type = Explod
trigger1 = Time = 0
anim = 8300
pos = 0,0
postype = p1
sprpriority = 10
bindtime = 1
ownpal = 1
scale = 1.1,1.1

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

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

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

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

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

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

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

;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 82005]
type    = A
movetype= H
physics = N

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim2
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5642

[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 5101, 3]
type = HitFallVel
trigger1 = Time = 0

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

[State 5101] ;Reduce speed
type = VelMul
trigger1 = time = 0
x = 0.25

[State 5101, 4]
type = velset
trigger1 = Time = 0
y = -8

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .3

[State 5101, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = SelfState
value = 5110

;流燕脚2P空中受击
[Statedef 83000]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1270]
type = DestroySelf
trigger1 = ishelper
ignorehitpause = 1

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5020, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5020, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 83001

[State 820, 1]
type = selfstate
trigger1 = time > 444
value = 5030

[State 5020, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5020, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5020, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
trigger4 = anim = [5051,5059]
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 83001]
type    = A
movetype= H
physics = N
ctrl = 0

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

[State 5030, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5030, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 83003 ;HITA_FALL

[State 5030, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 83002 ;HITA_UP (transition)

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 83002]
type    = A
movetype= H
physics = N

[State 5035, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

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

[State 5035, 4]
type = ChangeState
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 83003 ;HITA_FALL

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 83003]
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, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 83004 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 83004]
type    = L
movetype= H
physics = N

[State 1274]
type = DestroySelf
trigger1 = ishelper
ignorehitpause = 1

[state -2]
type = LifeAdd
trigger1 = time = 0
value = -EnemyNear,lifemax*.1
kill = 1
absolute = 0

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

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

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

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

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

[State 5100, fall]
type = Explod
trigger1 = Time = 0
anim = 8300
pos = 0,0
postype = p1
sprpriority = 10
bindtime = 1
ownpal = 1
scale = 1.1,1.1

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

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

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

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

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

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

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

;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 83005]
type    = A
movetype= H
physics = N

[State ,Hiver Laurant]
Type = Width
Trigger1 = 1
Edge = 25,25

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim2
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5642

[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 5101, 3]
type = HitFallVel
trigger1 = Time = 0

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

[State 5101] ;Reduce speed
type = VelMul
trigger1 = time = 0
x = 0.3

[State 5101, 4]
type = velset
trigger1 = Time = 0
y = -6

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .3

[State 5101, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = SelfState
value = 5110

;流燕脚2P地面受击
[Statedef 84000]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1270]
type = DestroySelf
trigger1 = ishelper
ignorehitpause = 1

[state -2]
type = LifeAdd
trigger1 = time = 0
value = -EnemyNear,lifemax*.15
kill = 1
absolute = 0

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5020, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5020, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 84001

[State 820, 1]
type = selfstate
trigger1 = time > 444
value = 5030

[State 5020, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5020, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5020, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
trigger4 = anim = [5051,5059]
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 84001]
type    = A
movetype= H
physics = N
ctrl = 0

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

[State 5030, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5030, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 84003 ;HITA_FALL

[State 5030, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 83002 ;HITA_UP (transition)

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 84002]
type    = A
movetype= H
physics = N

[State 5035, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

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

[State 5035, 4]
type = ChangeState
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 84003 ;HITA_FALL

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 84003]
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, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 84004 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 84004]
type    = L
movetype= H
physics = N

[State 1274]
type = DestroySelf
trigger1 = ishelper
ignorehitpause = 1

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

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

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

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

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

[State 5100, fall]
type = Explod
trigger1 = Time = 0
anim = 8300
pos = 0,0
postype = p1
sprpriority = 10
bindtime = 1
ownpal = 1
scale = 1.1,1.1

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

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

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

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

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

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

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

;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 84005]
type    = A
movetype= H
physics = N

[State ,Hiver Laurant]
Type = Width
Trigger1 = 1
Edge = 25,25

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim2
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5642

[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 5101, 3]
type = HitFallVel
trigger1 = Time = 0

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

[State 5101] ;Reduce speed
type = VelMul
trigger1 = time = 0
x = -0.1

[State 5101, 4]
type = velset
trigger1 = Time = 0
y = -8

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .3

[State 5101, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = SelfState
value = 5110

;この下、一行以上空ける事！







