;---------------------------------------------------------------------------
;stand parry
[Statedef 902]
type=S
physics=S
movetype=I
anim=902
velset=0,0
ctrl=0
sprpriority=3
facep2 = 1
poweradd=75

[State 4000, posadd]
type = posadd
trigger1 = time = 0
trigger1 = enemynear,hitdefattr = SA, HA
x = -10*const(size.xscale)

[State 4000, Pause]
type = Pause
trigger1 = time = 0
time = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))
movetime = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))

[State 4000, EnvShake]
type = EnvShake
trigger1 = time = 1
persistent = 0
ignorehitpause = 1
time = 10
ampl = 2
freq = 180
phase = 40

[State 4000, nothitby]
type = nothitby
trigger1 = time = 0
value = SCA
time = 16

[State 700, stop]
type=posfreeze
trigger1=time<=10
value=1

[State 700, blueflash]
type=palfx
trigger1=!time&&var(21)>=0
add=0,50,255
sinadd=0,-50,-255,60
time=15

[State 700, redflash]
type=palfx
trigger1=!time&&var(21)<0
add=255,0,0
sinadd=-255,0,0,60
time=15

[State 700, snd]
type=playsnd
trigger1=!time
value=s3,(random<500)
channel=0

[State 700, snd]
type=playsnd
trigger1=!time
value=s2,3

[State 902, 1]
type = Explod
trigger1 = time = 1
anim = 4105
pos = 51, -73
sprpriority = 6
supermove = 1
persistent = 0
ownpal = 1
trans = add
pausemovetime = -1
id = 4105
scale = .5, .5
removeongethit = 1

[State 4000, asserts]
type = assertspecial
trigger1 = animelemtime(4) < 0
flag = nowalk
flag2 = nostandguard
flag3 = nocrouchguard

[State 4000, CtrlSet]
type = CtrlSet
trigger1 = animelemtime(4) = 0
value = 1

[State 4000, sprpriority]
type = sprpriority
trigger1 = animelemtime(4) >= 0
value = 0

[State 700, end]
type=changestate
trigger1=!animtime
value=0
ctrl=1
;---------------------------------------------------------------
;---CROUCHING---
[Statedef 903]
type=C
physics=C
movetype=I
anim=903
velset=0,0
ctrl=0
sprpriority=3
poweradd=75
facep2 = 1

[State 4000, posadd]
type = posadd
trigger1 = time = 0
trigger1 = enemynear,hitdefattr = C, HA
x = -10*const(size.xscale)

[State 4100, Pause]
type = Pause
trigger1 = time = 0
time = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))
movetime = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))


[State 4100, EnvShake]
type = EnvShake
trigger1 = time= 1
persistent = 0
ignorehitpause = 1
time = 12
ampl = 2
freq = 180
phase = 40

[State 4100, nothitby]
type = nothitby
trigger1 = var(0) = 0
trigger1 = time = 0
value = SCA
time = 16

[State 701, stop]
type=posfreeze
trigger1=time<=10
value=1

[State 701, blueflash]
type=palfx
trigger1=!time&&var(21)>=0
add=0,50,255
sinadd=0,-50,-255,60
time=15

[State 701, redflash]
type=palfx
trigger1=!time&&var(21)<0
add=255,0,0
sinadd=-255,0,0,60
time=15

[State 701, snd]
type=playsnd
trigger1=!time
value=3,(random<500)
channel=0

[State 700, snd]
type=playsnd
trigger1=!time
value=s2,3

[State 902, 1]
type = Explod
trigger1 = time = 1
anim = 4105
pos = 43, -32
sprpriority = 6
supermove = 1
persistent = 0
ownpal = 1
trans = add
pausemovetime = -1
id = 4105
scale = .5, .5
removeongethit = 1

[State 4100, asserts]
type = assertspecial
trigger1 = animelemtime(4) < 0
flag = nowalk
flag2 = nostandguard
flag3 = nocrouchguard

[State 4100, CtrlSet]
type = CtrlSet
trigger1 = animelemtime(4) = 0
value = 1

[State 4100, sprpriority]
type = sprpriority
trigger1 = animelemtime(4) >= 0
value = 0
[State 701, end]
type=changestate
trigger1=!animtime
value=11
ctrl=1

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

;---AERIAL---
[Statedef 904]
type=A
physics=A
movetype=I
anim=904
ctrl=0
sprpriority=0
poweradd=75

[State 4200, velset]
type = velset
trigger1 = time = 0
x = (vel X)*ifelse(p2dist X < 0,-1,1)
y = ifelse(vel Y<-1.0,vel Y,-1.0)

[State 4200, turn]
type = turn
trigger1 = time = 0
trigger1 = p2dist X < 0

[State 4200, Pause]
type = Pause
trigger1 = time = 0
time = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))
movetime = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))

[State 4200, EnvShake]
type = EnvShake
trigger1 = time = 1
persistent = 0
ignorehitpause = 1
time = 12
ampl = 2
freq = 180
phase = 40

[State 4200, nothitby]
type = nothitby
trigger1 = var(0) = 0
trigger1 = Time = 0
value = SCA
time = 16

[State 702, sts]
type=statetypeset
trigger1=time<=10
physics=N

[State 4200, turn]
type = posfreeze
trigger1 = 1

[State 702, sts]
type=statetypeset
trigger1=time>10
physics=A

[State 702, blueflash]
type=palfx
trigger1=!time&&var(21)>=0
add=0,50,255
sinadd=0,-50,-255,60
time=15

[State 702, redflash]
type=palfx
trigger1=!time&&var(21)<0
add=255,0,0
sinadd=-255,0,0,60
time=15

[State 702, snd]
type=playsnd
trigger1=!time
value=3,(random<500)
channel=0

[State 700, snd]
type=playsnd
trigger1=!time
value=s2,3

[State 902, 1]
type = Explod
trigger1 = time = 1
anim = 4105
pos = 20, -80
sprpriority = 6
supermove = 1
persistent = 0
ownpal = 1
trans = add
pausemovetime = -1
id = 4105
scale = .5, .5
removeongethit = 1

[State 4200, asserts]
type = assertspecial
trigger1 = 1
flag = noairguard

[State 702, ctrl]
type=ctrlset
trigger1=time>12
value=1

[State 4200, ChangeState]
type = ChangeState
trigger1 = animtime = 0
value = 950
;----------------------------------------
;land parry air
[Statedef 950]
type = A
movetype = I
physics = N
anim = 950
;velset = fvar(37)*var(6),ifelse(fvar(38)<-1.0,fvar(38),-1.0)
sprpriority = 0
ctrl = 1

[State 4250, VelAdd]
type = VelAdd
trigger1 = 1
y = .50

[State 4250, ChangeState]
type = ChangeState
trigger1 = Pos Y >= 0
trigger1 = Vel Y > 0
trigger1 = Anim != 52
value = 52
;==========================Parry===========================
;---------------------------------------------------------------------------
;stand parry
;---STANDING---
[Statedef 10902]
type=S
physics=S
movetype=I
anim=902
velset=0,0
ctrl=0
sprpriority=3
facep2 = 1
poweradd=75

[State 4000, posadd]
type = posadd
trigger1 = time = 0
trigger1 = enemynear,hitdefattr = SA, HA
x = -10*const(size.xscale)

[State 4000, Pause]
type = Pause
trigger1 = time = 0
time = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))
movetime = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))

[State 4000, EnvShake]
type = EnvShake
trigger1 = time = 1
persistent = 0
ignorehitpause = 1
time = 10
ampl = 2
freq = 180
phase = 40

[State 4000, nothitby]
type = nothitby
trigger1 = time = 0
value = SCA
time = 16

[State 700, stop]
type=posfreeze
trigger1=time<=10
value=1

[State 700, blueflash]
type=palfx
trigger1=!time&&var(21)>=0
add=0,50,255
sinadd=0,-50,-255,60
time=15

[State 700, redflash]
type=palfx
trigger1=!time&&var(21)<0
add=255,0,0
sinadd=-255,0,0,60
time=15

[State 700, snd]
type=playsnd
trigger1=!time
value=s3,(random<500)
channel=0

[State 700, snd]
type=playsnd
trigger1=!time
value=s2,3

[State 902, 1]
type = Explod
trigger1 = time = 1
anim = 4105
pos = 20, -70
sprpriority = 6
supermove = 1
persistent = 0
ownpal = 1
trans = add
pausemovetime = -1
id = 4105
scale = .5, .5
removeongethit = 1

[State 4000, asserts]
type = assertspecial
trigger1 = animelemtime(4) < 0
flag = nowalk
flag2 = nostandguard
flag3 = nocrouchguard

[State 4000, CtrlSet]
type = CtrlSet
trigger1 = animelemtime(4) = 0
value = 1

[State 4000, sprpriority]
type = sprpriority
trigger1 = animelemtime(4) >= 0
value = 0

[State 0, Shoryuuken]
type = ChangeState
triggerall = p2bodydist x <= 60
triggerall = Var(59)>=1
trigger1 = animelem >= 2
trigger1 = p2bodydist y <= -41
value = 1102
ctrl = 0

;[State 0, Roll]
;type = ChangeState
;triggerall = Var(58) = 1
;triggerall = p2bodydist x <= 15
;trigger1 = animelem >= 2
;trigger1 = p2bodydist y >= -30
;trigger1 = power >= 1000
;value = 400
;ctrl = 0

[State 0, Roll]
type = ChangeState
triggerall = Var(59)>=1
triggerall = p2bodydist x <=60;[16,60]
triggerall = ctrl
trigger1 = p2bodydist y >= -30
;trigger1 = power >= 1000
value = 900
ctrl = 0

[State 0, AI Stand Strong punch]
type = ChangeState
triggerall = ctrl
triggerall = statetype != A
;triggerall = ctrl = 1
triggerall = Var(59)>=1
triggerall = p2bodydist x <= 60
;triggerall = P2Movetype != A
;trigger1 = p2bodydist x = [-22,13]
trigger1 = p2bodydist y = [-40,-30]
value = ifelse(p2bodydist X < 9,225,220)

[State 0, AI Teleport fwd]
type = ChangeState
triggerall = ctrl
triggerall = statetype != A
;triggerall = ctrl = 1
triggerall = Var(59)>=1
trigger1 = p2bodydist x >= 61
value = 900

[State 700, end]
type=changestate
trigger1=!animtime
value=0
ctrl=1
;---------------------------------------------------------------------------
[Statedef 10903]
type=C
physics=C
movetype=I
anim=903
velset=0,0
ctrl=0
sprpriority=3
poweradd=75
facep2 = 1

[State 4000, posadd]
type = posadd
trigger1 = time = 0
trigger1 = enemynear,hitdefattr = C, HA
x = -10*const(size.xscale)

[State 4100, Pause]
type = Pause
trigger1 = time = 0
time = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))
movetime = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))


[State 4100, EnvShake]
type = EnvShake
trigger1 = time= 1
persistent = 0
ignorehitpause = 1
time = 12
ampl = 2
freq = 180
phase = 40

[State 4100, nothitby]
type = nothitby
trigger1 = var(0) = 0
trigger1 = time = 0
value = SCA
time = 16

[State 701, stop]
type=posfreeze
trigger1=time<=10
value=1

[State 701, blueflash]
type=palfx
trigger1=!time&&var(21)>=0
add=0,50,255
sinadd=0,-50,-255,60
time=15

[State 701, redflash]
type=palfx
trigger1=!time&&var(21)<0
add=255,0,0
sinadd=-255,0,0,60
time=15

[State 701, snd]
type=playsnd
trigger1=!time
value=3,(random<500)
channel=0

[State 700, snd]
type=playsnd
trigger1=!time
value=s2,3

[State 902, 1]
type = Explod
trigger1 = time = 1
anim = 4105
pos = 20, -40
sprpriority = 6
supermove = 1
persistent = 0
ownpal = 1
trans = add
pausemovetime = -1
id = 4105
scale = .5, .5
removeongethit = 1

[State 4100, asserts]
type = assertspecial
trigger1 = animelemtime(4) < 0
flag = nowalk
flag2 = nostandguard
flag3 = nocrouchguard

[State 4100, CtrlSet]
type = CtrlSet
trigger1 = animelemtime(4) = 0
value = 1

[State 4100, sprpriority]
type = sprpriority
trigger1 = animelemtime(4) >= 0
value = 0

[State 0, Roll]
type = ChangeState
triggerall = Var(59)>=1
triggerall = p2bodydist x <= 60;[16,60]
triggerall = ctrl = 1
trigger1 = p2bodydist y >= -30
;trigger1 = power >= 1000
value = 900
ctrl = 0

[State 0, AI Teleport fwd]
type = ChangeState
triggerall = statetype != A
triggerall = ctrl = 1
triggerall = Var(59)>=1
trigger1 = p2bodydist x >= 61
value = 900

[State 701, end]
type=changestate
trigger1=!animtime
value=11
ctrl=1

;-----------------------------------------------------------------
;---AERIAL---
[Statedef 10904]
type=A
physics=A
movetype=I
anim=904
ctrl=0
sprpriority=0
poweradd=75

[State 4200, velset]
type = velset
trigger1 = time = 0
x = (vel X)*ifelse(p2dist X < 0,-1,1)
y = ifelse(vel Y<-1.0,vel Y,-1.0)

[State 4200, turn]
type = turn
trigger1 = time = 0
trigger1 = p2dist X < 0

[State 4200, Pause]
type = Pause
trigger1 = time = 0
time = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))
movetime = 20-ifelse((GetHitVar(animtype)=[3,5]),4,GetHitVar(animtype))-ifelse(GetHitVar(hitshaketime)>16,16,GetHitVar(hitshaketime))

[State 4200, EnvShake]
type = EnvShake
trigger1 = time = 1
persistent = 0
ignorehitpause = 1
time = 12
ampl = 2
freq = 180
phase = 40

[State 4200, nothitby]
type = nothitby
trigger1 = var(0) = 0
trigger1 = Time = 0
value = SCA
time = 16

[State 702, sts]
type=statetypeset
trigger1=time<=10
physics=N

[State 4200, turn]
type = posfreeze
trigger1 = 1

[State 702, sts]
type=statetypeset
trigger1=time>10
physics=A

[State 702, blueflash]
type=palfx
trigger1=!time&&var(21)>=0
add=0,50,255
sinadd=0,-50,-255,60
time=15

[State 702, redflash]
type=palfx
trigger1=!time&&var(21)<0
add=255,0,0
sinadd=-255,0,0,60
time=15

[State 702, snd]
type=playsnd
trigger1=!time
value=3,(random<500)
channel=0

[State 700, snd]
type=playsnd
trigger1=!time
value=s2,3

[State 902, 1]
type = Explod
trigger1 = time = 1
anim = 4105
pos = 20, -80
sprpriority = 6
supermove = 1
persistent = 0
ownpal = 1
trans = add
pausemovetime = -1
id = 4105
scale = .5, .5
removeongethit = 1

[State 4200, asserts]
type = assertspecial
trigger1 = 1
flag = noairguard

[State 702, ctrl]
type=ctrlset
trigger1=time>12
value=1

[State 0, Air strong punch]
type = ChangeState
triggerall = Var(59)>=1
trigger1 = animelem >= 2
trigger1 = P2bodydist y <=20
trigger1 = P2bodydist x <=60
value = 620
ctrl = 0

[State 4200, ChangeState]
type = ChangeState
trigger1 = animtime = 0
value = 950

;[State 0, AI Air tatzumaki2]
;type = changestate
;triggerall = Var(58) = 1
;triggerall = statetype = A
;triggerall = p2statetype = A
;trigger1 = animelem >= 2
;trigger1 = P2bodydist y >=3
;value = 1221
;ctrl = 0

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

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

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

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

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
x = const(velocity.jump.back.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 = 10050
ctrl = 1

;---------------------------------------------------------------------------
; Jump Up
[Statedef 10050]
type    = A
physics = A

[State 50, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 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
triggerall = (vel x) != 0
trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

;---------------------------------------------------------------------------
; 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 52, 1]
type = VelSet
trigger1 = Time = 0
y = 0

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

[State 52, 3]
type = CtrlSet
trigger1 = Time = 3
value = 1

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

