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

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

[State 40, 4]
type = VelSet
triggerall = p2statetype != A
trigger1 = AnimTime = 0
trigger1 = enemy,vel x = 0
trigger1 = p2bodydist X = [81,100]
x = const(velocity.jump.neu.x)

[State 40, 4]
type = VelSet
triggerall = p2statetype != A
trigger1 = AnimTime = 0
trigger1 = p2movetype != H
trigger1 = p2bodydist X < 50
x = const(velocity.jump.back.x)

[State 40, 4]
type = VelSet
triggerall = p2statetype != A
trigger1 = AnimTime = 0
trigger1 = p2bodydist X = [101,130]
trigger2 = AnimTime = 0
trigger2 = BackEdgeDist < 10
x = const(velocity.jump.fwd.x)

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50321

[Statedef 50321]
type    = A
physics = A
ctrl = 0

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

[State 50, 3]
type = ChangeAnim
trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

[State 40, 6]
type = ChangeState
trigger1 = time = var(11)
value = 610

[State 40, 6]
type = ChangeState
trigger1 = time = 5
value = 610

[Statedef 20321]
type    = S
physics = S
sprpriority = 0
ctrl = 0

[State 20, 1]
type = VelSet
trigger1 = 1
x = const(velocity.walk.fwd.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 -1 , AI]
type = ChangeState
triggerall = var(11) = [1,2]
triggerall = Enemy,HitDefAttr=SCA,NA,NP,HA,HP
triggerall = p2movetype = A
triggerall = P2Life > 0
trigger1 = Enemy,time <= 1
trigger1 = p2bodydist X < 20
trigger2 = Enemy,time <= 3
trigger2 = p2bodydist X = [21,40]
value = 1320


[State -1 , AI]
type = ChangeState
triggerall = var(11) = [2,3]
triggerall = Enemy,HitDefAttr=SCA,SA,SP,HA,HP
triggerall = p2movetype = A
triggerall = P2Life > 0
trigger1 = Enemy,time <= 2
trigger1 = p2bodydist X < 30
trigger2 = Enemy,time <= 4
trigger2 = p2bodydist X = [31,50]
value = 1310


[State -1 , AI]
type = ChangeState
triggerall = var(11) = [3,4]
triggerall = Enemy,HitDefAttr=SCA,NA,NP,SA,SP
triggerall = p2movetype = A
triggerall = P2Life > 0
trigger1 = Enemy,time <= 5
trigger1 = p2bodydist X < 50
trigger2 = p2statetype = A
trigger2 = Enemy,vel Y > 0
trigger2 = Enemy,vel X >= 0
trigger2 = p2bodydist X < 60
trigger3 = p2statetype != A
trigger3 = Enemy,vel X > 0
trigger3 = p2bodydist X = [71,80]
value = 1300


[State -1 , AI]
type = ChangeState
triggerall = p2statetype != L
triggerall = random >= 900 || (gametime%10 = [2,3]) && (random = [700,800]) || (gametime%10 = [4,5]) && (random = [500,600]) || (gametime%10 = [6,7]) && (random = [300,400]) || (gametime%10 = [8,9]) && (random = [100,200])
triggerall = P2Life > 0
trigger1 = p2bodydist X = [80,110]
trigger1 = enemy,vel x < 0
trigger1 = enemy,vel y < 0
trigger2 = p2bodydist X = [111,130]
trigger2 = enemy,vel x = 0
trigger2 = enemy,vel y < 0
trigger3 = p2bodydist X = [131,160]
trigger3 = enemy,pos Y < -150
trigger4 = p2bodydist X = [161,190]
trigger4 = p2stateno < 1000 && p2stateno != 40
trigger5 = p2bodydist X = [191,220]
trigger5 = enemy,vel x = [1,3]
trigger5 = enemy,vel y < 0
trigger6 = p2bodydist X = [221,250]
trigger6 = enemy,vel x = [4,5]
trigger6 = enemy,vel y < 0
value = 221

[State -1 , AI]
type = ChangeState
triggerall = p2statetype != L
triggerall = random >= 950 || gametime%10 = 1 && (random = [750,850]) || gametime%10 = 3 && (random = [550,650]) || gametime%10 = 5 && (random = [350,450]) || gametime%10 = 7 && (random = [150,250]) || gametime%10 = 9 && random <= 50
triggerall = P2Life > 0
trigger1 = p2bodydist X = [31,60]
trigger1 = enemy,vel x = 0
trigger1 = enemy,vel y < 0 || enemy,pos y < -150
trigger2 = p2bodydist X = [61,90]
trigger2 = enemy,vel x > 0
trigger2 = enemy,vel y > 0
trigger2 = p2movetype != A
trigger3 = p2bodydist X = [91,120]
trigger3 = p2stateno = 40
trigger4 = p2bodydist X = [121,150]
trigger4 = enemy,vel x = [1,3]
trigger4 = enemy,vel y < 0
trigger5 = p2bodydist X = [151,160]
trigger5 = enemy,vel x = [4,5]
trigger5 = enemy,vel y < 0
trigger6 = p2bodydist X = [161,175]
trigger6 = enemy,vel x = [6,7]
trigger6 = enemy,vel y < 0
trigger7 = p2bodydist X = [176,200]
trigger7 = enemy,vel x = [8,9]
trigger7 = enemy,time < 5
trigger8 = p2bodydist X > 200
trigger8 = enemy,vel x > 10
trigger8 = enemy,time < 5
value = 222

[State -2]
type = VarSet
triggerall = var(20) = 0
triggerall = time = 0
trigger1 = random <= 1000-life
var(20) = var(11)

[State -2]
type = VarSet
triggerall = var(21) = 0
triggerall = time = 0
trigger1 = random <= 1000-life
var(21) = var(11)

[State 40, 6]
type = ChangeState
trigger1 = p2bodydist X < 5
value = 100

[state -1, AI]
type = ChangeState
value = Ifelse(EnemyNear,StateType = C,131,130)
triggerall = Var(51) = 1
triggerall = Random <= ifelse (StateType = A, 1000-life,ifelse(p2life-life<0,ceil(life/2),p2life-life))
trigger1 = StateType != A && (Enemy, HitDefAttr = SCA, AA, SA ,HA ,AP, SP, HP)
trigger1 = MoveType = I && ((EnemyNear, MoveType = A  && P2BodyDist X <= 80) || (Enemy, NumProj >= 1)) && Ctrl

[State 40, 6]
type = ChangeState
trigger1 = p2movetype = A
trigger1 = time > 20
trigger1 = p2bodydist X < 50
trigger2 = p2movetype = A
trigger2 = time > 30
trigger2 = p2bodydist X = [51,100]
trigger3 = p2movetype = A
trigger3 = time > 40
trigger3 = p2bodydist X > 100
trigger4 = time > 50
trigger5 = roundstate != 2
value = 0
ctrl = 1
