; _______________________________________
;| Edmond Honda by Phantom.of.the.Server |
; ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
;==============================================================================================
;=======================================<SYSTEM STATES>========================================
;==============================================================================================
;--------------------- Variable List ----------------------

; Var(0) - random snd
; Var(1) - Sabaori/FUJI tap
; Var(2) - Sabaori/time
; Var(3) - height
; Var(4) - chain (excel)
; Var(5) - enemynear
; Var(6) - cancel
; Var(7) - super-cancel
; Var(8) - hyper-cancel
; Var(9) - 
; Var(10) - StateDef 750, 800, 1000, 1100, 1200, 1300, 22222, stageedgeright
; Var(11) - StateDef 1010
; Var(12) - Sabaori/MAX-FUJI
; Var(13) - hitcount
; Var(14) - Parry
; Var(15) - juggle
; Var(16) - juggle
; Var(17) - unguardable
; Var(18) - Shield Contact
; Var(19) - StateDef 800, 805, 810, 820, 821
; Var(20) - StateDef 900, 905, -2, 1030, 1130, 1230, 1330, 3000, 3050, 3100, 3200, 3250
; Var(21) - StateDef 3000, 3050, 3100, 3200, 3250
; Var(22) - StateDef 3000, 3050, 3100, 3200, 3250
; Var(23) - StateDef -3
; Var(24) - throw miss
; Var(25) - StateDef -3, 1030, 1130, 1230, 1330
; Var(26) - tap
; Var(27) - tap
; Var(28) - counter
; Var(29) - counter
; Var(30) - movehit
; Var(31) - hitsound
; Var(32) - hitsound
; Var(33) - hitsound
; Var(34) - hitsound
; Var(35) - hitsound
; Var(36) - holdback flag
; Var(37) - backcharge
; Var(38) - holddown
; Var(39) - downcharge
; Var(40) -
; Var(41) -
; Var(42) - 
; Var(43) -
; Var(44) - 
; Var(45) - 
; Var(46) - 
; Var(47) - 
; Var(48) - 
; Var(49) - 
; Var(50) - 
; Var(51) - AI hansei
; Var(52) -
; Var(53) - parryed
; Var(54) - playerid
; Var(55) - hadouid
; Var(56) - AI-mode
; Var(57) - roundtime
; Var(58) - gametime
; Var(59) - AI

;--------------------- Float Variable List ----------------------

; fVar(0) - Damage
; fVar(1) - 
; fVar(2) - calc
; fVar(3) - action ID
; fVar(4) - 
; fVar(5) - CornerPush
; fVar(6) - 
; fVar(7) - 
; fVar(8) - excel-cal
; fVar(9) - 
; fVar(10) - attack
; fVar(11) - attackmul
; fVar(12) - 
; fVar(13) - 
; fVar(14) - 
; fVar(15) - 
; fVar(16) - 
; fVar(17) - 
; fVar(18) - 
; fVar(19) -
; fVar(20) - 
; fVar(22) - 
; fVar(23) - 
; fVar(29) -
; fvar(39) - p2dist y fix

;====================<STANDING>====================
[Statedef 0]
type=S
physics=S
movetype=I
velset=0,0
sprpriority=0

[State 0, Anim]
type=changeanim
trigger1= anim!=0 && anim!=5
trigger2= anim=5 && !animtime
value= 0

[State 0, Dead]
type=changestate
trigger1= !alive
value=5050

;====================<STANDING>====================
[Statedef 1]
type=S
physics=S
movetype=I
velset=0,0
sprpriority=0
ctrl=0

[State 0, Anim]
type=changeanim
trigger1= anim!=0 && anim!=5
trigger2= anim=5 && !animtime
value= 0

[State 0, Dead]
type=changestate
trigger1= !alive
value=5050

[State -1, okizeme];S-Jump:26,N-Jump:35,L-Jump:38+2
type=changestate
value=41
triggerall= roundstate=2 && statetype!=A
triggerall= enemynear,stateno=[5100,5120]
;triggerall= (sysvar(4) || random<333) && (helper(33333),var(59)>=10 || enemynear,stateno=5120)
triggerall= !inguarddist && helper(55555),var(50)=0 && enemy,numproj=0
trigger1= fvar(3)=640
trigger1= (abs(helper(ifelse(facing=1,22222,33333)),pos x-enemynear,pos x)>44)
trigger1= ifelse(enemynear,stateno<5120,helper(33333),var(59)-helper(33333),var(56),-enemynear,animtime)=[20+3-3-1,28+3-3-1]
trigger1= fvar(2):=ceil(fvar(35)/const(velocity.jump.fwd.x)) || 1
trigger1= fvar(2)<35;(-const(velocity.jump.y)/const(movement.yaccel))*2
trigger1= const(velocity.jump.y)*fvar(2)+const(movement.yaccel)*0.5*fvar(2)*(fvar(2)+1)<-enemynear,const(size.height) || fvar(2)+1<ifelse(enemynear,stateno<5120,helper(33333),var(59)-enemynear,time,-animtime)
trigger1= fvar(35)-const(velocity.jump.fwd.x)*20>=-30-enemynear,const(size.ground.back)
trigger1= fvar(35)-const(velocity.jump.fwd.x)*28<0
trigger1= fvar(3):=640 || 1
trigger1= var(3):=0 || 1
trigger1= fvar(1):=1 || 1
;trigger2=0
trigger2= fvar(3)=640
trigger2= (abs(helper(ifelse(facing=1,22222,33333)),pos x-enemynear,pos x)>44)
trigger2= ifelse(enemynear,stateno<5120,helper(33333),var(59)-helper(33333),var(56),-enemynear,animtime)=[11+3-3-1,19+3-3-1]
trigger2= fvar(2):=ceil(fvar(35)/const(velocity.jump.fwd.x)) || 1
trigger2= fvar(2)<26;(-7.066/const(movement.yaccel))*2
trigger2= -7.066*fvar(2)+const(movement.yaccel)*0.5*fvar(2)*(fvar(2)+1)<-enemynear,const(size.height); || fvar(2)+1<ifelse(enemynear,stateno=5110,helper(33333),var(59)-enemynear,time,-animtime)
trigger2= fvar(35)-const(velocity.jump.fwd.x)*11>=-30-enemynear,const(size.ground.back)
trigger2= fvar(35)-const(velocity.jump.fwd.x)*19<0
trigger2= fvar(3):=640 || 1
trigger2= var(3):=1 || 1
trigger2= fvar(1):=1 || 1
trigger3= fvar(3)=600
trigger3= ifelse(enemynear,stateno<5120,helper(33333),var(59)-helper(33333),var(56),-enemynear,animtime)=[11+3-3-1,19+3-3-1]
trigger3= fvar(37)<=59+24*const(velocity.jump.fwd.x);[40+15*const(velocity.jump.fwd.x),59+25*const(velocity.jump.fwd.x)]
trigger3= var(3):=1 || 1
trigger3= fvar(1):=1 || 1
trigger3= fvar(3):=600
;fake
trigger4= fvar(3)=640
trigger4= (abs(helper(ifelse(facing=1,22222,33333)),pos x-enemynear,pos x)>44)
trigger4= ifelse(enemynear,stateno<5120,helper(33333),var(59)-helper(33333),var(56),-enemynear,animtime)>=(3+35+1)*2+1
trigger4= fvar(2):=ceil(fvar(35)/const(velocity.jump.fwd.x)) || 1
trigger4= fvar(2)<35;(-const(velocity.jump.y)/const(movement.yaccel))*2
trigger4= const(velocity.jump.y)*fvar(2)+const(movement.yaccel)*0.5*fvar(2)*(fvar(2)+1)<-enemynear,const(size.height) || fvar(2)+1<ifelse(enemynear,stateno<5120,helper(33333),var(59)-enemynear,time,-animtime)
trigger4= fvar(35)-const(velocity.jump.fwd.x)*20>=-30-enemynear,const(size.ground.back)
trigger4= fvar(35)-const(velocity.jump.fwd.x)*28<0
trigger4= random<500
trigger4= fvar(3):=640 || 1
trigger4= var(3):=0 || 1
trigger4= fvar(1):=1 || 1

[State 1, ctrl]
type=ctrlset
triggerall= !ctrl
trigger1= var(59)>=1
trigger1= !sysvar(4) || ((enemynear,stateno!=[5100,5120]) && enemynear,statetype!=L)
trigger2= var(59)<=0
value=1

;====================<CROUCHING>====================
[Statedef 10]
type=C
physics=C
movetype=I
velset=0,0
sprpriority=0

[State 10, AI]
type=changestate
trigger1= var(59)>=1; && (enemynear,movetype=A && !(enemynear,statetype=C))
value=0
ctrl=1

[State 10, Anim]
type=changeanim
trigger1= !time && anim=12
value=10
elem=3-animelemno(0)
[State 10, Anim]
type=changeanim
trigger1= anim!=10
value=10

[State 10, NoWalk]
type=assertspecial
trigger1= 1
flag=nowalk

[State 10, End]
type=changestate
trigger1= !animtime
value=11


[Statedef 11]
type=C
physics=C
movetype=I
anim=11
velset=0,0
sprpriority=0

[State 11, NoWalk]
type=assertspecial
trigger1= 1
flag=nowalk

[State 11, Anim]
type=changeanim
trigger1= anim=6 && !animtime
value=11


[Statedef 12]
type=S
physics=S
movetype=I
velset=0,0
sprpriority=0

[State 12, Anim]
type=changeanim
trigger1= !time && anim=10
value=12
elem=3-animelemno(0)
[State 12, Anim]
type=changeanim
trigger1= anim!=12
value=12

[State 12, NoWalk]
type=assertspecial
trigger1= 1
flag=nowalk

[State 12, End]
type=changestate
trigger1= command="holddown" && command!="holdup"
value=10
[State 12, End]
type=changestate
trigger1= !animtime
value=0


;====================<WALKING>====================
[Statedef 20]
type=S
physics=S
movetype=I
sprpriority=0

[State 20, AI]
type=changestate
trigger1= var(59)>=1
value=0
ctrl=1

[State 20, Vel]
type=velset
trigger1= command="holdfwd" && var(59)<=0
x=const(velocity.walk.fwd.x)

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

[State 20, Anim]
type=changeanim
triggerall= vel x>0
trigger1= anim!=20 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=20

[State 20, Anim]
type=changeanim
triggerall= vel x<0
trigger1= anim!=21 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=21


;====================<WALKING>====================
[Statedef 21]
type=S
physics=S
movetype=I
sprpriority=0
ctrl=0

[State 21, turn]
type=turn
trigger1= p2dist x<0
trigger1= var(1):=-1*var(1) || 1

[State 21, Vel]
type=velset
trigger1= var(1)=1
x=const(velocity.walk.fwd.x)

[State 21, Vel]
type=velset
trigger1= var(1)=-1
x=const(velocity.walk.back.x)

[State 21, Anim]
type=changeanim
triggerall= vel x>0
trigger1= anim!=20 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=20

[State 21, Anim]
type=changeanim
triggerall= vel x<0
trigger1= anim!=21 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=21

;====================<WALKING_Fwd>====================
[Statedef 22]
type=S
physics=S
movetype=I
sprpriority=0
ctrl=0

[State 22, direction]
type=varset
trigger1=1
var(1)=1

[State 22, turn]
type=turn
trigger1= p2dist x<0
trigger1= var(1):=-1*var(1) || 1

[State 22, Vel]
type=velset
trigger1= var(1)=1
x=const(velocity.walk.fwd.x)

[State 22, Vel]
type=velset
trigger1= var(1)=-1
x=const(velocity.walk.back.x)

[State 22, Anim]
type=changeanim
triggerall= vel x>0
trigger1= anim!=20 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=20

[State 22, Anim]
type=changeanim
triggerall= vel x<0
trigger1= anim!=21 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=21

;====================<WALKING_Back>====================
[Statedef 23]
type=S
physics=S
movetype=I
sprpriority=0
ctrl=0

[State 23, direction]
type=varset
trigger1=1
var(1)=-1

[State 21, turn]
type=turn
trigger1= p2dist x<0

[State 21, Vel]
type=velset
trigger1= var(1)=1
x=const(velocity.walk.fwd.x)

[State 21, Vel]
type=velset
trigger1= var(1)=-1
x=const(velocity.walk.back.x)

[State 21, Anim]
type=changeanim
triggerall= vel x>0
trigger1= anim!=20 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=20

[State 21, Anim]
type=changeanim
triggerall= vel x<0
trigger1= anim!=21 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=21

;====================<OKIZEME WALK>====================
[Statedef 24]
type=S
physics=S
movetype=I
sprpriority=0
ctrl=0

[State 21, turn]
type=turn
trigger1= p2dist x<0
trigger1= var(1):=-1*var(1) || 1

[State -1, direction fwd]
type=varset
triggerall= numenemy
triggerall= roundstate=2 && statetype!=A
triggerall= fvar(35)>=0
;triggerall= enemynear,statetype=L || (enemynear,stateno=[5100,5120]) || enemynear,hitfall
;triggerall= (abs(helper(22222),pos x-enemynear,pos x)>44 && facing=1) || (abs(helper(33333),pos x-enemynear,pos x)>44 && facing=-1)
trigger1= fvar(3)=640 && sysvar(4)
trigger1= var(1)=-1
trigger1= fvar(2):=ceil(fvar(35)/const(velocity.jump.fwd.x)) || 1
trigger1= const(velocity.jump.y)*fvar(2)+const(movement.yaccel)*fvar(2)*(fvar(2)+1)*0.5>-enemynear,const(size.height) || fvar(2)>=28
trigger2= fvar(3)=600 && sysvar(4)
trigger2= var(1)=-1
trigger2= fvar(37)>59+24*const(velocity.jump.fwd.x)
var(1)=1
[State -1, direction back]
type=varset
triggerall= numenemy
triggerall= roundstate=2 && statetype!=A
triggerall= fvar(35)>=0
;triggerall= enemynear,statetype=L || (enemynear,stateno=[5100,5120]) || enemynear,hitfall
;triggerall= (abs(helper(22222),pos x-enemynear,pos x)>44 && facing=1) || (abs(helper(33333),pos x-enemynear,pos x)>44 && facing=-1)
trigger1= fvar(3)=640
trigger1= var(1)=1
trigger1= fvar(35)-const(velocity.jump.fwd.x)*20<-30-vel x-enemynear,const(size.ground.back) || fvar(37)<=0
trigger2= fvar(3)=600 && sysvar(4)
trigger2= var(1)=1
trigger2= fvar(37)<40-vel x+19*const(velocity.jump.fwd.x)
trigger3= var(1)=1 && fvar(37)<=0
trigger4= helper(33333),var(59)-helper(33333),var(56)<=10
trigger5= enemynear,stateno=[5110,5120]
trigger5= !sysvar(4)
trigger6= fvar(37)<=11 && var(1)=1
var(1)=-1

[State 21, Vel]
type=velset
trigger1= var(1)=1
x=const(velocity.walk.fwd.x)

[State 21, Vel]
type=velset
trigger1= var(1)=-1
x=const(velocity.walk.back.x)

[State 21, Anim]
type=changeanim
triggerall= vel x>0
trigger1= anim!=20 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=20

[State 21, Anim]
type=changeanim
triggerall= vel x<0
trigger1= anim!=21 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=21

[State -1, okizeme];S-Jump:26,N-Jump:35,L-Jump:38+2
type=changestate
value=41
;triggerall= var(59)>=1 && numenemy
triggerall= roundstate=2 && statetype!=A
triggerall= enemynear,stateno=[5100,5120]
;triggerall= (sysvar(4) || random<333) && (helper(33333),var(59)>=10 || enemynear,stateno=5120)
triggerall= !inguarddist && helper(55555),var(50)=0 && enemy,numproj=0
trigger1= fvar(3)=640
trigger1= (abs(helper(ifelse(facing=1,22222,33333)),pos x-enemynear,pos x)>44)
trigger1= (helper(33333),var(59)-helper(33333),var(56)=[20+3-3-1,28+3-3-1]) || (enemynear,stateno=5120 && (-enemynear,animtime=[20+3-3-1,28+3-3-1]))
trigger1= fvar(2):=ceil(fvar(35)/const(velocity.jump.fwd.x)) || 1
trigger1= fvar(2)<35;(-const(velocity.jump.y)/const(movement.yaccel))*2
trigger1= const(velocity.jump.y)*fvar(2)+const(movement.yaccel)*0.5*fvar(2)*(fvar(2)+1)<-enemynear,const(size.height) || fvar(2)+1<ifelse(enemynear,stateno<5120,helper(33333),var(59)-enemynear,time,-animtime)
trigger1= fvar(35)-const(velocity.jump.fwd.x)*20>=-30-enemynear,const(size.ground.back)
trigger1= fvar(35)-const(velocity.jump.fwd.x)*28<0
trigger1= fvar(3):=640 || 1
trigger1= var(3):=0 || 1
trigger1= fvar(1):=1 || 1
;trigger2=0
trigger2= fvar(3)=640
trigger2= (abs(helper(ifelse(facing=1,22222,33333)),pos x-enemynear,pos x)>44)
trigger2= (helper(33333),var(59)-helper(33333),var(56)=[11+3-3-1,19+3-3-1]) || (enemynear,stateno=5120 && (-enemynear,animtime=[11+3-3-1,19+3-3-1]))
trigger2= fvar(2):=ceil(fvar(35)/const(velocity.jump.fwd.x)) || 1
trigger2= fvar(2)<26;(-7.066/const(movement.yaccel))*2
trigger2= -7.066*fvar(2)+const(movement.yaccel)*0.5*fvar(2)*(fvar(2)+1)<-enemynear,const(size.height); || fvar(2)+1<ifelse(enemynear,stateno=5110,helper(33333),var(59)-enemynear,time,-animtime)
trigger2= fvar(35)-const(velocity.jump.fwd.x)*11>=-30-enemynear,const(size.ground.back)
trigger2= fvar(35)-const(velocity.jump.fwd.x)*19<0
trigger2= fvar(3):=640 || 1
trigger2= var(3):=1 || 1
trigger2= fvar(1):=1 || 1
trigger3= fvar(3)=600
trigger3= (helper(33333),var(59)-helper(33333),var(56)=[11+3-3-1,19+3-3-1]) || (enemynear,stateno=5120 && (-enemynear,animtime=[11+3-3-1,19+3-3-1]))
trigger3= fvar(37)<=59+24*const(velocity.jump.fwd.x);[40+15*const(velocity.jump.fwd.x),59+25*const(velocity.jump.fwd.x)]
trigger3= var(3):=1 || 1
trigger3= fvar(1):=1 || 1
trigger3= fvar(3):=600
;fake
trigger4=0
trigger4= fvar(3)=640
trigger4= (abs(helper(ifelse(facing=1,22222,33333)),pos x-enemynear,pos x)>44)
trigger4= ifelse(enemynear,stateno<5120,helper(33333),var(59)-helper(33333),var(56),-enemynear,animtime)>=(3+35+1)*2+1
trigger4= fvar(2):=ceil(fvar(35)/const(velocity.jump.fwd.x)) || 1
trigger4= fvar(2)<35;(-const(velocity.jump.y)/const(movement.yaccel))*2
trigger4= const(velocity.jump.y)*fvar(2)+const(movement.yaccel)*0.5*fvar(2)*(fvar(2)+1)<-enemynear,const(size.height) || fvar(2)+1<ifelse(enemynear,stateno<5120,helper(33333),var(59)-enemynear,time,-animtime)
trigger4= fvar(35)-const(velocity.jump.fwd.x)*20>=-30-enemynear,const(size.ground.back)
trigger4= fvar(35)-const(velocity.jump.fwd.x)*28<0
trigger4= random<500
trigger4= fvar(3):=640 || 1
trigger4= var(3):=0 || 1
trigger4= fvar(1):=1 || 1

[State -1, standing]
type=null;changestate
value=1
triggerall= numenemy
triggerall= roundstate=2 && statetype!=A
triggerall= fvar(35)>=0
triggerall= enemynear,statetype=L || (enemynear,stateno=[5100,5120])
triggerall= fvar(3)=640
trigger1= fvar(35)=[const(velocity.jump.fwd.x)*20-30-enemynear,const(size.ground.back),const(velocity.jump.fwd.x)*28]
;trigger2= fvar(37)<=11 && var(1)=1
ctrl=0

[State 21, ctrl]
type=changestate
trigger1= (enemynear,stateno!=[5000,5120]) || (!sysvar(4) && enemynear,stateno=5120)
trigger2= enemynear,stateno=5120 && enemynear,animtime>=-11
trigger3= (enemynear,stateno=[5110,5120)) && helper(33333),var(59)>0 && helper(33333),var(59)-helper(33333),var(56)<=11
value=0
ctrl=23
[State 21, ctrl]
type=changestate
trigger1= (enemynear,stateno!=[5000,5120]) || (!sysvar(4) && enemynear,stateno=5120)
value=0
ctrl=1

;====================<WALKING>====================
[Statedef 13000]
type=S
physics=S
movetype=I
sprpriority=0
ctrl=0

[State 21, turn]
type=turn
trigger1= p2dist x<0

[State 21, Vel]
type=velset
trigger1= 1
x=const(velocity.walk.fwd.x)

[State 21, Anim]
type=changeanim
triggerall= vel x>0
trigger1= anim!=20 && anim!=5
trigger2= anim=5 && animelemtime(1)>=1
value=20

[State -1, Throw]
type=changestate
value=800
triggerall= var(59)>=1 && numenemy
triggerall= roundstate=2 && statetype!=A
triggerall= p2statetype!=L
triggerall= fvar(35)>=enemynear,vel x*2*(enemynear,statetype=A || enemynear,vel x<0)*(-1*facing*enemynear,facing)
triggerall= (helper(55555),var(50)=0 && enemy,numproj=0) || (facing=enemynear,facing && helper(55555),var(59)=0)
triggerall= p2movetype!=H || (enemynear,stateno=[150,155])
triggerall= enemynear,hitfall=0
;enemy landing front
trigger1= !var(24) || var(24)=1;var(24)&2=0var(24)&2=0
trigger1= (ctrl || (anim=[0,21])) && enemynear,statetype=A && enemynear,vel y>0 && facing!=enemynear,facing
trigger1= enemynear,movetype=I
trigger1= p2dist y+enemynear,vel y*2+enemynear,const(movement.yaccel)*3>-1
trigger1= p2dist y+enemynear,vel y*1+enemynear,const(movement.yaccel)<=-1
trigger1= fvar(37)<=38+enemynear,vel x*2
;enemy landing back
trigger2= !var(24) || var(24)=1;var(24)&2=0var(24)&2=0
trigger2= (ctrl || (anim=[0,21])) && facing=enemynear,facing
trigger2= enemynear,statetype=A && enemynear,vel y>0
trigger2= p2dist y+enemynear,vel y*2+enemynear,const(movement.yaccel)*2>-1
trigger2= p2dist y+enemynear,vel y+enemynear,const(movement.yaccel)<=-1
trigger2= fvar(37)<38-enemynear,vel x*2
;enemy rolling
trigger3= fvar(37)<=38+enemynear,vel x*2*(-1*facing*enemynear,facing)
trigger3= ctrl && enemynear,ctrl=0 && enemynear,movetype=I && helper(22222),var(10)=0 && enemynear,animtime<=-2-1
trigger3= !(enemynear,statetype=A) && !(enemynear,anim=[20,21]) && enemynear,vel x
trigger3= enemynear,animtime<=-15-1; || random<333+(prevstateno!=800)*667
;enemy attacking over
trigger4= (ctrl || (stateno=[21,23]) || stateno=52)
trigger4= p2statetype!=A && enemynear,movecontact=0 && var(29) && enemynear,animtime=-2-1 && enemynear,ctrl=0
trigger4= fvar(37)<=38+enemynear,vel x*2*(-1*facing*enemynear,facing)

[State -1, Ooichou Nage]
type=changestate
value=1300
triggerall= var(59)>=1 && numenemy
triggerall= roundstate=2 && statetype!=A
triggerall= p2statetype!=L && enemynear,hitfall=0 && (p2movetype!=H || p2statetype!=A)
triggerall= !(enemynear,movetype=H) || (p2stateno=[150,155])
triggerall= fvar(35)>=0+enemynear,vel x*2*(enemynear,statetype=A || enemynear,vel x<0)*(-1*(facing*enemynear,facing)) || (fvar(35)>=0 && p2statetype!=A)
;atenage
trigger1= !var(24) || var(24)=2;var(24)&1=0;
;trigger1= ctrl || (anim=[0,21]) || (stateno=52&&movecontact&&(prevstateno=[600,699])) || (stateno=[100,101]) || (stateno=[13000,13001])
trigger1= (enemynear,stateno=[150,155]) && enemynear,statetype!=A && enemynear,gethitvar(hittime)=2
trigger1= fvar(37)<=38+enemynear,vel x*helper(33333),fvar(2)*(-1*facing*enemynear,facing)
trigger2= !var(24) || var(24)=2;var(24)&1=0;
trigger2= (stateno=[200,499]) && movecontact
trigger2= (enemynear,stateno=[150,155]) && enemynear,statetype!=A && enemynear,gethitvar(hittime)=2
trigger2= (fvar(37)+helper(33333),fvar(0)*helper(33333),fvar(2)*(-1*facing*enemynear,facing)<=38 && movehit=1) || (movehit>1 && fvar(37)<=38+enemynear,vel x*helper(33333),fvar(2)*(-1*facing*enemynear,facing))
;enemy parrying
trigger3= stateno=[200,499]
trigger3= movehit && !numtarget && !(enemynear,movetype=H) && !(enemynear,statetype=A)
trigger3= fvar(37)<=38+enemynear,vel x*2*(enemynear,ctrl=0 || enemynear,vel x<0)*(-1*facing*enemynear,facing); && p2dist y=0
trigger3= life>750 && random<333 && enemynear,movetype=I
;enemy landing
trigger4= !var(24) || var(24)=1;var(24)&2=0
trigger4= (ctrl || (anim=[0,21]) || ((stateno=[200,499]) && movecontact))
trigger4= enemynear,movetype=I && enemynear,statetype=A && enemynear,vel y>0
trigger4= p2dist y+enemynear,vel y*2+enemynear,const(movement.yaccel)*2>-1 && p2dist y+enemynear,vel y+enemynear,const(movement.yaccel)<=-1
trigger4= fvar(37)<=38+enemynear,vel x*2*(-1*facing*enemynear,facing)
;enemy avoiding
trigger5= (stateno=[200,499]) && var(6)
trigger5= enemynear,movetype=I && enemynear,stateno>=200 && !var(29) && enemynear,ctrl=0 && enemynear,animtime<=-2-1
trigger5= fvar(37)<=38+enemynear,vel x*2*(-1*facing*enemynear,facing)

[State 21, end]
type=changestate
;triggerall= var(59)>=1
trigger1= p2dist x<0 || inguarddist || enemynear,gethitvar(hittime)<=0 || enemynear,movetype=A || enemynear,ctrl
value=0
ctrl=1


;====================<DASH>====================
[Statedef 13001]
type=S
physics=N
movetype=I
anim=100
ctrl=0
sprpriority=1

[State 100, Snd]
type=playsnd
trigger1= !time
trigger1= prevstateno!=102
value=0,102
[State 100, Dust]
type=helper
trigger1= !time
trigger1= prevstateno!=102
helpertype=normal
stateno=8103
ID=8100
name="Dash Dust"
postype=p1
pausemovetime=255
supermovetime=255
ownpal=1

[State 100, Pos]
type=posset
trigger1= 1
y= 0
[State 100, Vel]
type=velset
trigger1= 1
x= const(velocity.run.fwd.x)
y= 0

[State 100, Steps]
type=playsnd
trigger1= (animelem=3 || animelem=6)
value= 0, ifelse((animelem=3), 103, 106)

[State -1, Throw]
type=changestate
value=800
triggerall= var(59)>=1 && numenemy
triggerall= roundstate=2 && statetype!=A
triggerall= p2statetype!=L
triggerall= fvar(35)>=enemynear,vel x*2*(enemynear,statetype=A || enemynear,vel x<0)*(-1*facing*enemynear,facing)
triggerall= (helper(55555),var(50)=0 && enemy,numproj=0) || (facing=enemynear,facing && helper(55555),var(59)=0)
triggerall= p2movetype!=H || (enemynear,stateno=[150,155])
triggerall= enemynear,hitfall=0
;enemy landing front
trigger1= !var(24) || var(24)=1;var(24)&2=0var(24)&2=0
;trigger1= (ctrl || (anim=[0,21])) && enemynear,statetype=A && enemynear,vel y>0 && facing!=enemynear,facing
trigger1= enemynear,movetype=I
trigger1= p2dist y+enemynear,vel y*2+enemynear,const(movement.yaccel)*3>-1
trigger1= p2dist y+enemynear,vel y*1+enemynear,const(movement.yaccel)<=-1
trigger1= fvar(37)<=38+enemynear,vel x*2
;enemy landing back
trigger2= !var(24) || var(24)=1;var(24)&2=0var(24)&2=0
trigger2= (ctrl || (anim=[0,21])) && facing=enemynear,facing
trigger2= enemynear,statetype=A && enemynear,vel y>0
trigger2= p2dist y+enemynear,vel y*2+enemynear,const(movement.yaccel)*2>-1
trigger2= p2dist y+enemynear,vel y+enemynear,const(movement.yaccel)<=-1
trigger2= fvar(37)<38-enemynear,vel x*2
;enemy rolling
trigger3= fvar(37)<=38+enemynear,vel x*2*(-1*facing*enemynear,facing)
trigger3= ctrl && enemynear,ctrl=0 && enemynear,movetype=I && helper(22222),var(10)=0 && enemynear,animtime<=-2-1
trigger3= !(enemynear,statetype=A) && !(enemynear,anim=[20,21]) && enemynear,vel x
trigger3= enemynear,animtime<=-15-1; || random<333+(prevstateno!=800)*667
;enemy attacking over
trigger4= (ctrl || (stateno=[21,23]) || stateno=52)
trigger4= p2statetype!=A && enemynear,movecontact=0 && var(29) && enemynear,animtime=-2-1 && enemynear,ctrl=0
trigger4= fvar(37)<=38+enemynear,vel x*2*(-1*facing*enemynear,facing)

[State -1, Ooichou Nage]
type=changestate
value=1300
triggerall= var(59)>=1 && numenemy
triggerall= roundstate=2 && statetype!=A
triggerall= p2statetype!=L && enemynear,hitfall=0 && (p2movetype!=H || p2statetype!=A)
triggerall= !(enemynear,movetype=H) || (p2stateno=[150,155])
triggerall= fvar(35)>=0+enemynear,vel x*2*(enemynear,statetype=A || enemynear,vel x<0)*(-1*(facing*enemynear,facing)) || (fvar(35)>=0 && p2statetype!=A)
;atenage
trigger1= !var(24) || var(24)=2;var(24)&1=0;
;trigger1= ctrl || (anim=[0,21]) || (stateno=52&&movecontact&&(prevstateno=[600,699])) || (stateno=[100,101]) || (stateno=[13000,13001])
trigger1= (enemynear,stateno=[150,155]) && enemynear,statetype!=A && enemynear,gethitvar(hittime)=2
trigger1= fvar(37)<=38+enemynear,vel x*helper(33333),fvar(2)*(-1*facing*enemynear,facing)
trigger2= !var(24) || var(24)=2;var(24)&1=0;
trigger2= (stateno=[200,499]) && movecontact
trigger2= (enemynear,stateno=[150,155]) && enemynear,statetype!=A && enemynear,gethitvar(hittime)=2
trigger2= (fvar(37)+helper(33333),fvar(0)*helper(33333),fvar(2)*(-1*facing*enemynear,facing)<=38 && movehit=1) || (movehit>1 && fvar(37)<=38+enemynear,vel x*helper(33333),fvar(2)*(-1*facing*enemynear,facing))
;enemy parrying
trigger3= stateno=[200,499]
trigger3= movehit && !numtarget && !(enemynear,movetype=H) && !(enemynear,statetype=A)
trigger3= fvar(37)<=38+enemynear,vel x*2*(enemynear,ctrl=0 || enemynear,vel x<0)*(-1*facing*enemynear,facing); && p2dist y=0
trigger3= life>750 && random<333 && enemynear,movetype=I
;enemy landing
trigger4= !var(24) || var(24)=1;var(24)&2=0
trigger4= (ctrl || (anim=[0,21]) || ((stateno=[200,499]) && movecontact))
trigger4= enemynear,movetype=I && enemynear,statetype=A && enemynear,vel y>0
trigger4= p2dist y+enemynear,vel y*2+enemynear,const(movement.yaccel)*2>-1 && p2dist y+enemynear,vel y+enemynear,const(movement.yaccel)<=-1
trigger4= fvar(37)<=38+enemynear,vel x*2*(-1*facing*enemynear,facing)
;enemy avoiding
trigger5= (stateno=[200,499]) && var(6)
trigger5= enemynear,movetype=I && enemynear,stateno>=200 && !var(29) && enemynear,ctrl=0 && enemynear,animtime<=-2-1
trigger5= fvar(37)<=38+enemynear,vel x*2*(-1*facing*enemynear,facing)

[State 21, end]
type=changestate
;triggerall= var(59)>=1
trigger1= p2dist x<0 || inguarddist || enemynear,gethitvar(hittime)<=-1 || enemynear,movetype=A || enemynear,ctrl
value=101
ctrl=0

;====================<STANDING_AI(COUNTER)>====================
[Statedef 14000]
type=S
physics=S
movetype=I
velset=0,0
sprpriority=0
ctrl=0

[State 14000, gone]
type=removeexplod
trigger1= ishelper
[State 23456, gone]
type=destroyself
trigger1= ishelper

[State 14000, turn]
type=Turn
trigger1= p2dist x<0

[State 14000, anim]
type=changeanim
trigger1= anim!=0
trigger1= anim!=5
trigger2= anim=5 && !animtime
value=0

[State 14000, ctrl]
type=ctrlset
trigger1= !inguarddist && !(enemynear,movetype=A)
trigger2= roundstate!=2
value=1

[State -1, Standing Parry]
type=helper
triggerall= var(59)>=1 && numenemy && !numhelper(10700)
triggerall= roundstate=2
triggerall= statetype!=A
triggerall= !(enemynear,hitdefattr=SCA,AT)
trigger1= enemynear,hitdefattr=SA,AA,AP
trigger2= helper(55555),var(59)=2 || (helper(55555),var(59)=1 && !inguarddist)
trigger3= enemynear,numproj=1 && numhelper(44445)
trigger3= helper(44445),var(59)=2
trigger4= enemynear,numproj>=2 && inguarddist && helper(55555),inguarddist && random<250
helpertype = normal ;player
name = "parry"
ID=10700
stateno=10700
pos = 0,0
postype=p1
facing=1
keyctrl=0
ownpal=0
supermove=0
pausemove=0

[State -1, Crouching Parry]
type=helper
triggerall= var(59)>=1 && numenemy && !numhelper(10701)
triggerall= roundstate=2
triggerall= statetype!=A
triggerall= !(enemynear,hitdefattr=SCA,AT)
trigger1= enemynear,hitdefattr=C,AA,AP
helpertype = normal ;player
name = "parry"
ID=10701
stateno=10701
pos = 0,0
postype=p1
facing=1
keyctrl=0
ownpal=0
supermove=0
pausemove=0

[State -3, Standing Parry]
type=hitoverride
trigger1= numhelper(10700)
attr=SA,AP
stateno=760
slot=0
time=2
ignorehitpause=1
[State -3, Crouching Parry]
type=hitoverride
trigger1= numhelper(10701)
attr=C,AP
stateno=761
slot=0
time=2
ignorehitpause=1

[State -1, Super zutsuki conter]
type=changestate
value=1100
triggerall= var(59)>=1 && numenemy
triggerall= roundstate=2 && statetype!=A
;triggerall= ifelse(var(20)>0 || (stateno=[1000,4999]), 1, var(40)>16)
triggerall= !var(16) && (var(15)<1 || var(20))
triggerall= fvar(37)<=3+enemynear,vel x*7*(-1*facing*enemynear,facing) || (stateno=220 && movecontact && enemynear,hitdefattr=SCA,NA,SA)
triggerall= fvar(35)>=ifelse(p2statetype!=A,0,-8.3+enemynear,vel x*7*(-1*facing*enemynear,facing))
triggerall= (p2dist y+enemynear,vel y*8+enemynear,const(movement.yaccel)*36=[-98-fvar(39),-1]) || p2statetype!=A
trigger1= enemynear,hitdefattr=SCA,NA,SA,AP,AT
trigger1= enemynear,animtime<=-7-1 || enemynear,statetype=A
trigger1= var(10):=1 || 1

[State -1, Super Hyakkan Otoshi]
type=changestate
value=1200
triggerall= var(59)>=1 && numenemy
triggerall= roundstate=2 && statetype!=A
;triggerall= ifelse(var(20)>0 || (stateno=[1000,4999]), 1, var(40)>16)
triggerall= !var(16) && (var(15)<1 || var(20))
triggerall= fvar(35)>=0 && fvar(37)<=18+10.7*7-0.9*28
triggerall= ifelse(enemynear,statetype=S,-5.31*7+0.11*28>=enemynear,const(size.head.pos.y)+24,1)
triggerall= ifelse(enemynear,statetype=C,-5.31*7+0.11*28>=enemynear,const(size.mid.pos.y)+24,1)
triggerall= !(enemynear,statetype=A) && enemynear,animtime<=-17-1
trigger1= enemynear,time*2<=-enemynear,animtime
trigger1= var(10):=1 || 1
trigger2= fvar(6)=1 && time>enemynear,time
trigger2= enemynear,hitdefattr=SC,AA,AT
trigger2= enemynear,time*2<=-enemynear,animtime
trigger2= var(10):=1 || 1

[State -1, back step]
type=changestate
value=105
triggerall= var(59)>=1 && numenemy
triggerall= roundstate=2 && statetype!=A
trigger1= ctrl || (anim=[0,21]) || (stateno=[100,101]) || stateno=13000 || stateno=13001
trigger1= (helper(22222),rootdist x>70 && facing=-1) || (helper(33333),rootdist x>70 && facing=1) || enemynear,animtime<=-ceil(-const(velocity.run.back.y)/0.608)*2-1
trigger1= enemynear(var(5)),movetype=A && fvar(35)<160 && enemynear(var(5)),hitdefattr=SC,AT; && enemynear,animtime<=-18

[State -1, Guard hadou]
type=changestate
value=120
triggerall= var(59)>=1 && numenemy && numhelper(55555)
triggerall= roundstate=2 && inguarddist && !var(20)
triggerall= (ctrl || (stateno=[21,28]) || (stateno=[100,101]) || stateno=13000 || stateno=13001) && (stateno!=[120,155])
triggerall= !(enemynear,hitdefattr=SCA,AT)
;direct attack
trigger1= helper(55555),var(59) && !numhelper(10700) && !numhelper(10702)
trigger2= numhelper(44445)
trigger2= helper(44445),var(59) && !numhelper(10700) && !numhelper(10702)
trigger3= (enemy,numproj>=2 || (helper(55555),var(49)=0 && enemy,numproj=1)) && helper(55555),inguarddist && !numhelper(10700) && !numhelper(10702)
trigger4= fvar(35)<enemynear,const(size.proj.attack.dist) && fvar(35)>=0
trigger4= helper(55555),var(59)=0 && enemynear,numproj=0
trigger4= (enemynear,stateno=helper(55555),var(10) && helper(55555),var(10)>0) || (enemynear,stateno=helper(55555),var(11) && helper(55555),var(11)>0)
trigger5= fvar(35)<enemynear,const(size.proj.attack.dist) && fvar(35)>=0
trigger5= helper(55555),var(50)=0 && enemynear,numproj=0
trigger5= (enemynear,stateno=helper(55555),var(12) && helper(55555),var(12)>0) || (enemynear,stateno=helper(55555),var(13) && helper(55555),var(13)>0)

[State 14000, dead]
type=changestate
trigger1= !alive
value=5050


;====================<JUMPING>====================
[Statedef 40]
type=S
physics=S
movetype=I
anim=40
ctrl=0
velset=0,0
sprpriority=1
facep2=1

[State 40, AI]
type=changestate
trigger1= var(59)>=1 && !time
value=0
ctrl=1

[State 40, Direction]
type=varset
trigger1= var(59)<=0
sysvar(1)= ifelse(!time, 0, ifelse(command="holdfwd", 1, ifelse(command="holdback", -1, sysvar(1))))

[State 40, High Jump]
type=varset
trigger1= !time && var(59)<=0
var(3)= ifelse(command="highjump", 3, 0)
[State 40, High Jump]
type=varset
trigger1= !time && prevstateno=100
var(3)=3

[State 40, Low Jump]
type=varset
trigger1= var(59)<=0 && command!="holdup" && (var(3)!=[1,2])
var(3)= ifelse((var(3)=3 && sysvar(1)), 2, 1)

[State 40, Snd]
type=playsnd
trigger1= !animtime
value=0, ifelse((var(3)=[2,3]), 41, 40)
[State 40, Dust]
type=helper
trigger1= !animtime
helpertype=normal
stateno=8100
ID=8100
name="Jump Dust"
postype=p1
ownpal=1

[State 40, Vel Normal]
type=velset
trigger1= !animtime
x= ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y= const(velocity.jump.y)

[State 40, Vel Short]
type=velset
trigger1= !animtime && var(3)=1
x= ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y= -7.066

[State 40, Vel Medium]
type=velset
trigger1= !animtime && var(3)=2
x= ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.runjump.fwd.x), const(velocity.runjump.back.x)))
y= -7.066

[State 40, Vel Long]
type=null;velset
trigger1= !animtime && var(3)=3
x= ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y= ifelse(!sysvar(1), const(velocity.runjump.y), const(velocity.jump.y)*1.1)

[State 40, Dash Long]
type=velset
trigger1= !animtime && var(3)=3; && prevstateno=100
x= ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.runjump.fwd.x), const(velocity.runjump.back.x)))
y= ifelse(!sysvar(1), const(velocity.runjump.y), const(velocity.jump.y))

[State 40, End]
type=changestate
trigger1= !animtime
value=50
ctrl=1

;---
;====================<JUMPING>====================
[Statedef 41]
type=S
physics=S
movetype=I
anim=40
ctrl=0
velset=0,0
sprpriority=1
facep2=1

[State 41, Direction]
type=varset
trigger1= 1
sysvar(1)= floor(fvar(1))

[State 41, Jump Height];3>1>2
type=varset
trigger1= !time
var(3)= var(3)
[State 41, High Jump]
type=varset
trigger1= !time && prevstateno=100 && !var(3)
var(3)=3

[State 41, Snd]
type=playsnd
trigger1= !animtime
value=0, ifelse((var(3)=[2,3]), 41, 40)
[State 41, Dust]
type=helper
trigger1= !animtime
helpertype=normal
stateno=8100
ID=8100
name="Jump Dust"
postype=p1
ownpal=1

[State 41, Vel Normal]
type=velset
trigger1= !animtime
x= ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y= const(velocity.jump.y)

[State 41, Vel Short]
type=velset
trigger1= !animtime && var(3)=1
x= ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y= -7.066

[State 41, Vel Medium]
type=velset
trigger1= !animtime && var(3)=2
x= ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.runjump.fwd.x), const(velocity.runjump.back.x)))
y= -7.066

[State 41, Vel Long]
type=null;velset
trigger1= !animtime && var(3)=3
x= ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y= ifelse(!sysvar(1), const(velocity.runjump.y), const(velocity.jump.y)*1.1)

[State 41, Dash Long]
type=velset
trigger1= !animtime && var(3)=3; && prevstateno=100
x= ifelse(!sysvar(1), const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.runjump.fwd.x), const(velocity.runjump.back.x)))
y= ifelse(!sysvar(1), const(velocity.runjump.y), const(velocity.jump.y))

[State 41, End]
type=changestate
trigger1= !animtime
value=50
ctrl=1
;---


[Statedef 50]
type=A
physics=N
movetype=I
sprpriority=1

[State 50, Anim]
type=changeanim
trigger1= !time
value= ifelse(!vel x, 41, ifelse(vel x>0, 42, 43)) + 10*(var(3)=[1,2])
persistent=0

[State 50, Grounded Frame]
type=posfreeze
trigger1= time<1 && prevstateno=40
value=1
[State 50, Grav]
type=gravity
trigger1= time>=1 || prevstateno!=40

[State 50, No Guard]
type=assertspecial
trigger1= var(3)=[1,2]
flag=noairguard

[State 50, Land]
type=changestate
trigger1= pos y>-vel y
value=52


[Statedef 51]
type=A
physics=N
movetype=I
sprpriority=1
[State 51, Grav]
type=gravity
trigger1= 1
[State 51, Land]
type=changestate
trigger1= pos y>-vel y
value=52


[Statedef 52]
type=S
physics=S
movetype=I
anim=47
ctrl=0
velset=0,0
sprpriority=1
movehitpersist=1

[State 52, anim 57]
type=changeanim
trigger1= !time && (var(3)=1 || var(3)=2)
trigger1= (prevstateno=[600,699])
value=57

[State 52, Pos]
type=posset
trigger1= 1
y=0

[State 52, Ctrl]
type=ctrlset
trigger1= !time && (prevstateno!=[600,699])
trigger2= time=1 && anim!=57
value=1
[State 52, Guard]
type=changestate
trigger1= ctrl && command="holdback"
trigger1= inguarddist && (prevstateno!=[600,699])
value=120

[State 52, NoWalk]
type=assertspecial
trigger1= anim!=5
flag=nowalk

[State 52, Snd]
type=playsnd
trigger1= !time
value=0,52
[State 52, Dust]
type=explod
trigger1= !time
anim=8102
sprpriority=-3
postype=p1
scale=.5,.5
pausemovetime=-1
supermovetime=-1
ownpal=1

[State 52, Turn]
type=changeanim
trigger1= ctrl && p2dist x<0
trigger1= anim!=5
value=5
[State 52, Turn]
type=turn
trigger1= anim=5 && animelem=1

[State 52, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;======================<RUN>===========================
[Statedef 100]
type=S
physics=N
movetype=I
anim=100
ctrl=0
sprpriority=1

[State 100, Snd]
type=playsnd
trigger1= !time
trigger1= prevstateno!=102
value=0,102
[State 100, Dust]
type=helper
trigger1= !time
trigger1= prevstateno!=102
helpertype=normal
stateno=8103
ID=8100
name="Dash Dust"
postype=p1
pausemovetime=255
supermovetime=255
ownpal=1

[State 100, Pos]
type=posset
trigger1= 1
y= 0
[State 100, Vel]
type=velset
trigger1= 1
x= const(velocity.run.fwd.x)
y= 0

[State 100, Steps]
type=playsnd
trigger1= (animelem=3 || animelem=6)
value= 0, ifelse((animelem=3), 103, 106)

[State 100, Jump]
type=changestate
trigger1= var(59)<=0
trigger1= command="holdfwd" && command="holdup"
value=40

[State 100, End]
type=changestate
triggerall= time>=9
trigger1= var(59)<=0 && command!="holdfwd"
trigger2= var(59)>=1 && fvar(35)<=const(velocity.jump.fwd.x)*28
value=101


;---STOP---
[Statedef 101]
type=S
physics=S
movetype=I
anim=101
ctrl=0
sprpriority=1

[State 101, Snd]
type=playsnd
trigger1= !time
value=0,101
[State 101, Dust]
type=explod
trigger1= !time
anim=8104
sprpriority=3
postype=p1
pos=0,0
vel=0,0
scale=.5,.5
pausemovetime=-1
supermovetime=-1
ownpal=1

[State 101, Jump]
type=changestate
trigger1= var(59)<=0 && command="holdup"
value=40
[State 101, End]
type=changestate
trigger1= var(59)<=0 && !animtime
value=ifelse(command="holddown",10,0)
ctrl=1
[State 101, End]
type=changestate
trigger1= var(59)>=1 && !animtime
value=ifelse(sysvar(4),24,23)
ctrl=1

;======================<DASH>===========================
[Statedef 102]
type=S
physics=N
movetype=I
anim=102
ctrl=0
sprpriority=1

[State 102, Snd]
type=playsnd
trigger1= !time
value=0,102
[State 102, Dust]
type=helper
trigger1= animelem=2
helpertype=normal
stateno=8103
ID=8100
name="Dash Dust"
postype=p1
pausemovetime=255
supermovetime=255
ownpal=1

[State 102, Run]
type=varset
trigger1= !time
sysvar(1)=1
[State 102, Run]
type=varset
triggerall= time<=5
trigger1= var(59)<=0 && command!="holdfwd"
trigger2= var(59)>=1 && time=5 && random<500
sysvar(1)=0
[State 102, Run]
type=changestate
trigger1= time=5 && sysvar(1)
value=100

[State 102, Type]
type=statetypeset
trigger1= animelemtime(2)>=0
statetype=A
physics=N
[State 102, Accel]
type=veladd
trigger1= animelemtime(2)>=0
y= .608

[State 102, Vel]
type=velset
trigger1= animelem=2
x= 4.250
y= -4.578

[State 102, End]
type=changestate
trigger1= animelemtime(2)>=0
trigger1= pos y>-vel y
value=103


;---LAND---
[Statedef 103]
type=S
physics=S
ctrl=1
anim=103
velset=0,0

[State 103, Pos]
type=posset
trigger1= 1
y=0

[State 103, Snd]
type=playsnd
trigger1= !time
value=0,103
[State 103, Dust]
type=explod
trigger1= !time
anim=8102
sprpriority=-3
postype=p1
scale=.5,.5
pausemovetime=-1
supermovetime=-1
ownpal=1

[State 103, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;========================<BACK DASH>==========================
[Statedef 105]
type=A
physics=N
movetype=I
velset=0,0
anim=105
ctrl=0
sprpriority=1

[State 105, nhb]
type=nothitby
trigger1=1
value=SCA
time=1

[State 105, Snd]
type=playsnd
trigger1= animelem=2
value=0,105
[State 105, Dust]
type=helper
trigger1= animelem=2
helpertype=normal
stateno=8103
ID=8100
name="Dash Dust"
postype=p1
facing=-1
pausemovetime=255
supermovetime=255
ownpal=1

[State 102, Accel]
type=veladd
trigger1= animelemtime(2)>=0
y= .608

[State 105, Vel]
type=velset
trigger1= animelem=2
x= const(velocity.run.back.x)
y= const(velocity.run.back.y)

[State 105, Land]
type=changestate
trigger1= animelemtime(2)>=0
trigger1= pos y>-vel y
value=106

;---LAND---
[Statedef 106]
type=S
physics=S
ctrl=0
anim=106
velset=0,0

[State 106, Pos]
type=posset
trigger1= 1
y=0

[State 106, Snd]
type=playsnd
trigger1= !time
value=0,106
[State 106, Dust]
type=explod
trigger1= !time
anim=8102
sprpriority=-3
postype=p1
scale=.5,.5
pausemovetime=-1
supermovetime=-1
ownpal=1

[State 106, Ctrl]
type=ctrlset
trigger1= time>=2
value=1
[State 106, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;====================<DODGE>====================
[Statedef 700]
type=S
physics=S
movetype=I
anim=700
ctrl=0
velset=0,0
sprpriority=-2

[State 700, Snd]
type=playsnd
trigger1= animelem=1
value=4,0
channel=0
[State 700, Snd]
type=playsnd
trigger1= animelem=1
value=1,3

[State 700, push]
type=playerpush
trigger1= 1
value=0
[State 700, hb]
type=hitby
trigger1= 1
value=SCA,AT
time=1

[State 700, attack]
type=changestate
trigger1= var(59)<=0 && (time=[15,25])
trigger1= command="x" || command="y" || command="z" || command="a" || command="b" || command="c"
value= ifelse((command="x" || command="y" || command="z"), 210, 241)
[State 700, attack]
type=changestate
trigger1= var(59)>=1 && (time=[15,25]) && numenemy
trigger1= (enemynear,movetype!=A) && (p2bodydist x=[-60,60]) && (p2dist y>=-60)
value= ifelse(random<666, 210, 241)

[State 700, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;====================<ROLL>====================
;---Forward---
[Statedef 710]
type=S
physics=N
movetype=I
anim=710
ctrl=0
velset=0,0
sprpriority=1

[State 710, Push]
type=playerpush
trigger1= 1
value=0
[State 710, HB]
type=hitby
trigger1= animelemtime(6)<0
value=SCA,AT
time=1

[State 710, Snd]
type=playsnd
trigger1= animelem=1
value= 4, ifelse(random<500, 0, 2)
channel=0
[State 710, Snd]
type=playsnd
trigger1= animelem=1
value=0,102
channel=1

[State 710, Vel]
type=velset
trigger1= animelem=2
x= 5.223
[State 710, Vel]
type=velset
trigger1= animelem=6
x= 0

[State 710, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;---Backward---
[Statedef 715]
type=S
physics=N
movetype=I
anim=715
ctrl=0
velset=0,0
sprpriority=1

[State 715, Push]
type=playerpush
trigger1= 1
value=0
[State 715, HB]
type=hitby
trigger1= animelemtime(6)<0
value=SCA,AT
time=1

[State 715, Snd]
type=playsnd
trigger1= animelem=1
value= 4, ifelse(random<500, 0, 2)
channel=0
[State 715, Snd]
type=playsnd
trigger1= animelem=1
value=0,102
channel=1

[State 715, Vel]
type=velset
trigger1= animelem=2
x= -5.223
[State 715, Vel]
type=velset
trigger1= animelem=6
x= 0

[State 715, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;==========<POWER CHARGE>==========
[Statedef 730]
type=S
physics=S
movetype=I
anim=730
velset=0,0
ctrl=0

[State 730, power]
type=poweradd
triggerall= power<const(data.power) && power<powermax
trigger1= var(59)<=0 && (command="holdb" && command="holdy")
trigger2= var(59)>=1
value= 2 + ifelse(time<60, 0, (time-60)/12)

[State 730, Snd]
type=playsnd
trigger1= !time
value=4,6
channel=0
[State 730, Flash]
type=palfx
trigger1= 1
time=1
add= 75+ceil(sin(time/6.0*pi)*75), 25+ceil(sin(time/6.0*pi)*25), 0

[State 730, FX]
type=helper
trigger1= !numhelper(8330)
helpertype=normal
stateno=8330
ID=8330
name="Power Charge"
postype=p1
pausemovetime=65535
supermovetime=65535
ownpal=1
[State 730, FX]
type=helper
trigger1= !numhelper(8331)
helpertype=normal
stateno=8331
ID=8331
name="Particles"
postype=p1
pausemovetime=65535
supermovetime=65535
ownpal=1

[State 730, End]
type=changestate
trigger1= power>=const(data.power) || power>=powermax || roundstate!=2
trigger2= var(59)<=0 && (command!="holdb" || command!="holdy")
trigger3= var(59)>=1
trigger3= inguarddist || (p2bodydist x<=160 && enemynear,movetype=I && enemynear,vel x) || enemynear,movetype=A || enemynear,vel x>0 || (enemynear,statetype=A && enemynear,movetype=I)
value=731
ctrl=1


;---END---
[Statedef 731]
type=S
physics=S
movetype=I
anim=731
velset=0,0
ctrl=1

[State 731, Stop Snd]
type=stopsnd
trigger1= !time
channel=0
[State 730, Snd]
type=playsnd
trigger1= !time && power>=const(data.power)
value=5,9
channel=0

[State 730, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;====================<ZERO COUNTER>====================
[Statedef 750]
type=S
physics=S
movetype=I
anim=750
velset=0,0
ctrl=0
sprpriority=2
poweradd=-1000
facep2=1

[State 750, Button]
type=varset
trigger1= !time && var(59)<=0
var(10)= (command="412k")
ignorehitpause=1
[State 750, Button AI]
type=varset
trigger1= !time && var(59)>=1
var(10)= ifelse(p2statetype!=A,1,0)
ignorehitpause=1

[State 750, NHB]
type=nothitby
trigger1= 1
value=SCA
time=1
[State 750, Stop]
type=posfreeze
trigger1= 1
value=1

[State 750, Snd]
type=playsnd
trigger1= !time
value=4,0
channel=0

[State 750, SuperPause FX]
type=helper
trigger1= !time
helpertype=normal
stateno=8350
ID=8350
name="Zero Counter"
postype=p1
pos= ceil(27 * const(size.xscale)), ceil(-73 * const(size.yscale))
supermovetime=255
ownpal=1
[State 750, Super Pause]
type=superpause
trigger1= !time
time=15
movetime=15
p2defmul=1
anim=-1
sound=s0,750
darken=0

[State 750, End]
type=changestate
trigger1= time>=15
value= ifelse(var(10)=1, 2910, 2900)


;====================<PARRY>====================
;---STANDING---
[Statedef 760]
type=S
physics=S
movetype=I
anim=760
velset=0,0
ctrl=0
sprpriority=2
poweradd=78
facep2=1

[State 760, hb]
type=hitby
trigger1= 1
value=SCA,AT
time=1
[State 760, pause]
type=pause
trigger1=!time
time=13
movetime=13
endcmdbuftime=13
pausebg=0
ignorehitpause=1
pausemove=1
supermove=1
[State 760, pause]
type=pause
trigger1= time=1 && var(14)>0
time=ifelse(var(14)<=7,9-var(14),1)
movetime=ifelse(var(14)<=7,9-var(14),1)
endcmdbuftime=ifelse(var(14)<=7,9-var(14),1)
pausebg=0
ignorehitpause=1
pausemove=1
supermove=1
[State 760, varreset]
type=varset
trigger1= time=1 && var(14)>0
var(14)=0

[State 760, Stop]
type=posfreeze
trigger1= 1
value=1
[State 760, NoWalk]
type=assertspecial
trigger1= 1
flag=nowalk

[State 760, Snd]
type=playsnd
trigger1= !time
value=4,3
channel=0
[State 760, Snd]
type=playsnd
trigger1= !time
value=0,760

[State 760, blueflash]
type=palfx
trigger1= !time
add=0,64,255
sinadd=0,-64,-255,60
time=15
[State 760, FX]
type=explod
trigger1= !time
anim=8360
sprpriority=5
postype=p1
pos= ceil(23 * const(size.xscale)), ceil(-76 * const(size.yscale))
pausemovetime=-1
supermovetime=-1
scale=.5,.5
ownpal=1
[State 760, Shake]
type=envshake
trigger1= !time
time=0
ampl=0

[State 760, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;---CROUCHING---
[Statedef 761]
type=C
physics=C
movetype=I
anim=761
velset=0,0
ctrl=0
sprpriority=2
poweradd=78
facep2=1

[State 761, hb]
type=hitby
trigger1= 1
value=SCA,AT
time=1
[State 760, pause]
type=pause
trigger1=!time
time=13
movetime=13
endcmdbuftime=13
pausebg=0
ignorehitpause=1
pausemove=1
supermove=1
[State 760, pause]
type=pause
trigger1= time=1 && var(14)>0
time=ifelse(var(14)<=7,9-var(14),1)
movetime=ifelse(var(14)<=7,9-var(14),1)
endcmdbuftime=ifelse(var(14)<=7,9-var(14),1)
pausebg=0
ignorehitpause=1
pausemove=1
supermove=1
[State 760, varreset]
type=varset
trigger1= time=1 && var(14)>0
var(14)=0

[State 761, Stop]
type=posfreeze
trigger1= 1
value=1
[State 760, NoWalk]
type=assertspecial
trigger1= 1
flag=nowalk

[State 761, Snd]
type=playsnd
trigger1= !time
value=4,3
channel=0
[State 761, Snd]
type=playsnd
trigger1= !time
value=0,760

[State 761, blueflash]
type=palfx
trigger1= !time
add=0,64,255
sinadd=0,-64,-255,60
time=15
[State 761, FX]
type=explod
trigger1= !time
anim=8360
sprpriority=5
postype=p1
pos= ceil(23 * const(size.xscale)), ceil(-48 * const(size.yscale))
pausemovetime=-1
supermovetime=-1
scale=.5,.5
ownpal=1
[State 761, Shake]
type=envshake
trigger1= !time
time=0
ampl=0

[State 761, End]
type=changestate
trigger1= !animtime
value=11
ctrl=1


;---JUMPING---
[Statedef 762]
type=A
physics=N
movetype=I
anim=762
ctrl=0
sprpriority=2
poweradd=78
facep2=1

[State 762, hb]
type=hitby
trigger1= 1
value=SCA,AT
time=1
[State 760, pause]
type=pause
trigger1=!time
time=13
movetime=13
endcmdbuftime=13
pausebg=0
ignorehitpause=1
pausemove=1
supermove=1
[State 760, pause]
type=pause
trigger1= time=1 && var(14)>0
time=ifelse(var(14)<=7,9-var(14),1)
movetime=ifelse(var(14)<=7,9-var(14),1)
endcmdbuftime=ifelse(var(14)<=7,9-var(14),1)
pausebg=0
ignorehitpause=1
pausemove=1
supermove=1
[State 760, varreset]
type=varset
trigger1= time=1 && var(14)>0
var(14)=0

[State 762, Stop]
type=posfreeze
trigger1= 1
value=1

[State 762, Snd]
type=playsnd
trigger1= !time
value=4,3
channel=0
[State 762, Snd]
type=playsnd
trigger1= !time
value=0,760

[State 762, blueflash]
type=palfx
trigger1= !time
add=0,64,255
sinadd=0,-64,-255,60
time=15
[State 762, FX]
type=explod
trigger1= !time
anim=8360
sprpriority=5
postype=p1
pos= ceil(16 * const(size.xscale)), ceil(-84 * const(size.yscale))
pausemovetime=-1
supermovetime=-1
scale=.5,.5
ownpal=1
[State 762, Shake]
type=envshake
trigger1= !time
time=0
ampl=0

[State 762, End]
type=changestate
trigger1= !animtime
value=763
ctrl=1

[Statedef 763]
type=A
physics=N
movetype=I
anim=763
ctrl=1
[State 763, Vel]
type=velset
trigger1= !time
x=ifelse(vel x>2,2,ifelse(vel x<-2,-2,vel x))
y=ifelse(vel y<-2,vel y,-2)
[State 763, Grav]
type=gravity
trigger1= 1
[State 763, Land]
type=changestate
trigger1= pos y>-vel y
value=52


;====================<EXTRA CANCEL>====================
;---GROUND---
[Statedef 900]
type=S
physics=S
movetype=A
anim=900
velset=0,0
ctrl=0
sprpriority=2
poweradd=-1000

[State 900, Corner Push]
type=varset
trigger1= time=4
fvar(5)= 0
[State 900, Unguardable]
type=varset
trigger1= time=4 && numenemy
trigger1= (enemynear(var(5)),stateno!=[120,155])
var(17)=30

[State 900, NHB]
type=nothitby
trigger1= !time
value=SCA
time=38
[State 900, Stop]
type=posfreeze
trigger1= 1
value=1
[State 900, Var]
type=varset
trigger1= time>=4
var(20)=180

[State 900, Snd]
type=playsnd
trigger1= time=4
value=6,3
channel=0

[State 900, SuperPause FX]
type=helper
trigger1= time=4
helpertype=normal
stateno=8400
ID=8400
name="Custom Combo Startup"
postype=p1
pos= ceil(20 * const(size.xscale)), ceil(-30 * const(size.yscale))
supermovetime=255
size.xscale=1
size.yscale=1
ownpal=1
[State 900, Super Pause]
type=superpause
trigger1= time=4
time=30
movetime=30
anim=-1
sound=s0,900
p2defmul=1
darken=0

[State 900, AfterImage]
type=afterimage
trigger1= !animtime
time=2
timegap=1
framegap=4
length=13
palbright=0,0,0
palcontrast=64,128,192
palpostbright=0,0,0
paladd=0,0,0
palmul=.75,.75,.75
trans=add1

[State 900, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;---AIR---
[Statedef 905]
type=A
physics=N
movetype=A
anim=905
ctrl=0
sprpriority=2
poweradd=-1000

[State 905, Corner Push]
type=varset
trigger1= time=4
fvar(5)= 0
[State 905, Unguardable]
type=varset
trigger1= time=4 && numenemy
trigger1= (enemynear,stateno!=[120,155])
var(17)=30

[State 905, NHB]
type=nothitby
trigger1= !time
value=SCA
time=38
[State 905, Stop]
type=posfreeze
trigger1= 1
value=1
[State 905, Var]
type=varset
trigger1= time>=4
var(20)=180

[State 905, Snd]
type=playsnd
trigger1= time=4
value=6,3
channel=0

[State 905, SuperPause FX]
type=helper
trigger1= time=4
helpertype=normal
stateno=8400
ID=8400
name="Custom Combo Startup"
postype=p1
pos= ceil(36 * const(size.xscale)), ceil(-80 * const(size.yscale))
supermovetime=255
size.xscale=1
size.yscale=1
ownpal=1
[State 905, Super Pause]
type=superpause
trigger1= time=4
time=30
movetime=30
anim=-1
sound=s0,900
p2defmul=1
darken=0

[State 905, AfterImage]
type=afterimage
trigger1= !animtime
time=2
timegap=1
framegap=4
length=13
palbright=0,0,0
palcontrast=64,128,192
palpostbright=0,0,0
paladd=0,0,0
palmul=.75,.75,.75
trans=add1

[State 905, End]
type=changestate
trigger1= !animtime
value=906
ctrl=1


[Statedef 906]
type=A
physics=N
movetype=I
anim=906
ctrl=1
[State 906, Grav]
type=gravity
trigger1= 1
[State 906, Land]
type=changestate
trigger1= pos y>-vel y
value=52


;===================<GUARD>================
;---START---
[Statedef 120]
type=U
physics=U
anim=120+(statetype=C)+(statetype=A)*2
[State 120, Type]
type=statetypeset
trigger1= !time && statetype=S
physics=S
[State 120, Type]
type=statetypeset
trigger1= !time && statetype=C
physics=C
[State 120, Type]
type=statetypeset
trigger1= !time && statetype=A
physics=A
[State 120, Vel]
type=velset
trigger1= !time && statetype!=A
x=0
y=0

[State 120, High to Low]
type=statetypeset
trigger1= var(59)<=0 && statetype=S && command="holddown"
statetype=C
physics=C
[State 120, Low to High]
type=statetypeset
trigger1= var(59)<=0 && statetype=C && command!="holddown"
statetype=S
physics=S

[State 120, High to Low AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=S && helper(22222),var(59)=0
trigger1= enemynear,hitdefattr=C,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time<=12
statetype=C
physics=C
[State 120, Low to High AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=0
trigger1= enemynear,statetype=A || enemynear,hitdefattr=A,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time>12
trigger3= helper(55555),var(50) || enemynear,numproj
trigger3= !(enemynear,hitdefattr=C,AA,AP) && enemynear,statetype=A
statetype=S
physics=S

[State 120, Low to High AI Special]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=1
trigger1= enemynear,hitdefattr=SCA,AA,AP
statetype=S
physics=S

[State 120, AI fix]
type=ctrlset
trigger1= var(59)>=1 && numenemy
value= (enemynear,time>=120 || time>=180)
[State 120, End]
type=changestate
trigger1= !animtime || var(59)>=1
value=130+(statetype=C)+(statetype=A)*2
[State 120, stop]
type=changestate
trigger1= (var(59)<=0 && command!="holdback")
trigger2= !inguarddist && (var(59)<=0 || helper(55555),inguarddist=0)
trigger3= var(59)>=1 && enemynear,time>=10 && random<ifelse(statetype=A,100,200) && enemynear,hitdefattr=SCA,AA,AP
trigger3= helper(55555),var(50)=0 && enemy,numproj=0
trigger4= var(59)>=1 && enemynear,hitdefattr=SCA,AT
trigger5= var(59)>=1 && helper(55555),var(59)=0 && enemy,numproj=0 && var(29)
trigger5= enemynear,movetype=I || enemynear,animtime=-3-1-1
trigger5= enemynear,time*0.5>=-enemynear,animtime
trigger5= enemynear,movecontact=0 || (helper(22222),var(10)>=2 && enemynear,animtime=-3-1-1)
value=140


;---STAND GUARD (guarding)---
[Statedef 130]
type=S
physics=S
[State 130, Anim]
type=changeanim
trigger1= anim!=130
value=130
[State 130, AI fix]
type=ctrlset
trigger1= var(59)>=1 && numenemy
value= (enemynear,time>=120 || time>=180)
[State 130, High to Low]
type=changestate
trigger1= var(59)<=0 && statetype=S && command="holddown"
value=131
[State 130, High to Low AI]
type=changestate
triggerall= var(59)>=1 && statetype=S && time>0 && helper(22222),var(59)=0
trigger1= enemynear,hitdefattr=C,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time<=12
value=131
[State 130, Stop Guarding]
type=changestate
trigger1= (var(59)<=0 && command!="holdback")
trigger2= !inguarddist && (var(59)<=0 || helper(55555),inguarddist=0)
trigger3= var(59)>=1 && enemynear,time>=10 && random<150 && enemynear,hitdefattr=SCA,AA,AP
trigger3= helper(55555),var(50)=0 && enemy,numproj=0
trigger4= var(59)>=1 && enemynear,hitdefattr=SCA,AT
trigger5= var(59)>=1 && helper(55555),var(59)=0 && enemy,numproj=0 && var(29)
trigger5= enemynear,movetype=I || enemynear,animtime=-3-1-1
trigger5= enemynear,time*0.5>=-enemynear,animtime
trigger5= enemynear,movecontact=0 || (helper(22222),var(10)>=2 && enemynear,animtime=-3-1-1)
value=140
[State 130, Snd]
type=playsnd
trigger1= !time
trigger1= prevstateno=132 || (prevstateno=[154,155])
value=0,52
[State 130, Dust]
type=explod
trigger1= !time
trigger1= prevstateno=132 || (prevstateno=[154,155])
anim=8102
sprpriority=-3
postype=p1
scale=.5,.5
pausemovetime=-1
supermovetime=-1
ownpal=1


;---CROUCH GUARD (guarding)---
[Statedef 131]
type=C
physics=C
[State 131, Anim]
type=changeanim
trigger1= anim!=131
value=131
[State 131, AI fix]
type=ctrlset
trigger1= var(59)>=1 && numenemy
value= (enemynear,time>=120 || time>=180)

[State 131, Low to High]
type=changestate
trigger1= var(59)<=0 && statetype=C && command!="holddown"
value=130
[State 131, Low to High AI]
type=changestate
triggerall= var(59)>=1 && statetype=C && time>0 && helper(22222),var(59)=0
trigger1= enemynear,statetype=A || enemynear,hitdefattr=A,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time>12
trigger3= helper(55555),var(50) || enemynear,numproj
trigger3= !(enemynear,hitdefattr=C,AA,AP) && enemynear,statetype=A
value=130
[State 131, Low to High AI Special]
type=changestate
triggerall= var(59)>=1 && statetype=C && time>0 && helper(22222),var(59)=1
trigger1= enemynear,hitdefattr=SCA,AA,AP
value=130

[State 131, Stop Guarding]
type=changestate
trigger1= (var(59)<=0 && command!="holdback")
trigger2= !inguarddist && (var(59)<=0 || helper(55555),inguarddist=0)
trigger3= var(59)>=1 && enemynear,time>=10 && random<150 && enemynear,hitdefattr=SCA,AA,AP
trigger3= helper(55555),var(50)=0 && enemy,numproj=0
trigger4= var(59)>=1 && enemynear,hitdefattr=SCA,AT
trigger5= var(59)>=1 && helper(55555),var(59)=0 && enemy,numproj=0 && var(29)
trigger5= enemynear,movetype=I || enemynear,animtime=-3-1-1
trigger5= enemynear,time*0.5>=-enemynear,animtime
trigger5= enemynear,movecontact=0 || (helper(22222),var(10)>=2 && enemynear,animtime=-3-1-1)
value=140


;---AIR GUARD (guarding)---
[Statedef 132]
type=A
physics=N
[State 132, Anim]
type=changeanim
trigger1= anim!=132
value=132
[State 132, Grav]
type=veladd
trigger1= 1
y=const(movement.yaccel)
[State 132, Var]
type=varset
trigger1= 1
sysvar(0)=(pos y>=0 && vel y>0)
[State 132, Vel]
type=velset
trigger1= sysvar(0)
y=0
[State 132, Pos]
type=posset
trigger1= sysvar(0)
y=0
[State 132, AI fix]
type=ctrlset
trigger1= var(59)>=1 && numenemy
value= (enemynear,time>=120 || time>=180)
[State 132, End]
type=changestate
trigger1= sysvar(0) && inguarddist
trigger1= (var(59)<=0 && command="holdback") || var(59)>=1
value=130
[State 132, End]
type=changestate
trigger1= sysvar(0)
value=52
[State 132, stop guarding]
type=changestate
trigger1= (var(59)<=0 && command!="holdback")
trigger2= !inguarddist && (var(59)<=0 || helper(55555),inguarddist=0)
trigger3= var(59)>=1 && enemynear,time>=10 && random<100 && enemynear,hitdefattr=SCA,AA,AP
trigger3= helper(55555),var(50)=0 && enemy,numproj=0
trigger4= var(59)>=1 && enemynear,hitdefattr=SCA,AT
value=140


;---GUARD (end)---
[Statedef 140]
type=U
physics=U
ctrl=1
[State 140, Anim]
type=changeanim
trigger1= !time
value=140+(statetype=C)+(statetype=A)*2
[State 140, Type]
type=statetypeset
trigger1= !time && statetype=S
physics=S
[State 140, Type]
type=statetypeset
trigger1= !time && statetype=C
physics=C
[State 140, Type]
type=statetypeset
trigger1= !time && statetype=A
physics=A

[State 140, Counter]
type=changestate
triggerall= var(59)>=1 && statetype!=A
trigger1= (enemynear,time>=10 || enemynear,hitdefattr=SCA,AT)
trigger2= helper(55555),var(59)>=1
trigger3= numhelper(44445)
trigger3= helper(44445),var(59)=2
trigger4= enemynear,hitdefattr=SCA,AA,AP && !inguarddist && helper(55555),inguarddist=0
trigger4= abs(fvar(35))<enemynear,const(size.attack.dist)
value=14000
ctrl=0

[State 140, High to Low]
type=statetypeset
trigger1= var(59)<=0 && statetype=S && command="holddown"
statetype=C
physics=C
[State 140, Low to High]
type=statetypeset
trigger1= var(59)<=0 && statetype=C && command!="holddown"
statetype=S
physics=S

[State 120, High to Low AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=S && helper(22222),var(59)=0
trigger1= enemynear,hitdefattr=C,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time<=12
statetype=C
physics=C
[State 120, Low to High AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=0
trigger1= enemynear,statetype=A || enemynear,hitdefattr=A,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time>12
trigger3= helper(55555),var(50) || enemynear,numproj
trigger3= !(enemynear,hitdefattr=C,AA,AP) && enemynear,statetype=A
statetype=S
physics=S
[State 120, Low to High AI Special]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=1
trigger1= enemynear,hitdefattr=SCA,AA,AP
statetype=S
physics=S

[State 140, End]
type=changestate
trigger1= !animtime
value=(statetype=C)*11+(statetype=A)*51

;---SGUARDHIT (shaking)---
[Statedef 150]
type=S
movetype=H
physics=N
velset=0,0
[State 150, Anim]
type=changeanim
trigger1= 1
value=150
[State 150, End]
type=changestate
trigger1= hitshakeover
value=151+2*((var(59)<=0 && command="holddown") || (var(59)>=1 && (enemynear,movetype=A) && (enemynear,statetype=C)))

[State 150, High to Low]
type=statetypeset
trigger1= var(59)<=0 && statetype=S && command="holddown"
statetype=C
physics=C
[State 150, Low to High]
type=statetypeset
trigger1= var(59)<=0 && statetype=C && command!="holddown"
statetype=S
physics=S

[State 120, High to Low AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=S && helper(22222),var(59)=0
trigger1= enemynear,hitdefattr=C,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time<=12
statetype=C
physics=C
[State 120, Low to High AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=0
trigger1= enemynear,statetype=A || enemynear,hitdefattr=A,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time>12
trigger3= helper(55555),var(50) || enemynear,numproj
trigger3= !(enemynear,hitdefattr=C,AA,AP) && enemynear,statetype=A
statetype=S
physics=S

[State 120, Low to High AI Special]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=1
trigger1= enemynear,hitdefattr=SCA,AA,AP
statetype=S
physics=S


;---SGUARDHIT2 (knocked back)---
[Statedef 151]
type=S
physics=S
movetype=H
anim=130
[State 151, Vel]
type=hitvelset
trigger1= !time
x=1
[State 151, Vel]
type=velset
trigger1= time=gethitvar(slidetime)
trigger2= hitover
x=0
[State 151, Ctrl]
type=ctrlset
trigger1= time=gethitvar(ctrltime)
value=1

[State 151, High to Low]
type=statetypeset
trigger1= var(59)<=0 && statetype=S && command="holddown"
statetype=C
physics=C
[State 151, Low to High]
type=statetypeset
trigger1= var(59)<=0 && statetype=C && command!="holddown"
statetype=S
physics=S

[State 120, High to Low AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=S && helper(22222),var(59)=0
trigger1= enemynear,hitdefattr=C,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time<=12
statetype=C
physics=C
[State 120, Low to High AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=0
trigger1= enemynear,statetype=A || enemynear,hitdefattr=A,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time>12
trigger3= helper(55555),var(50) || enemynear,numproj
trigger3= !(enemynear,hitdefattr=C,AA,AP) && enemynear,statetype=A
statetype=S
physics=S

[State 120, Low to High AI Special]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=1
trigger1= enemynear,hitdefattr=SCA,AA,AP
statetype=S
physics=S

[State 151, End]
type=changestate
trigger1= hitover
value=130
ctrl=1


;---CGUARDHIT (shaking)---
[Statedef 152]
type=C
physics=N
movetype=H
velset=0,0
[State 152, Anim]
type=changeanim
trigger1= 1
value=151
[State 152, End]
type=changestate
trigger1= hitshakeover
value=151+2*((var(59)<=0 && command="holddown") || (var(59)>=1 && (enemynear,movetype=A) && (enemynear,statetype=C)))

[State 152, High to Low]
type=statetypeset
trigger1= var(59)<=0 && statetype=S && command="holddown"
statetype=C
physics=C
[State 152, Low to High]
type=statetypeset
trigger1= var(59)<=0 && statetype=C && command!="holddown"
statetype=S
physics=S

[State 120, High to Low AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=S && helper(22222),var(59)=0
trigger1= enemynear,hitdefattr=C,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time<=12
statetype=C
physics=C
[State 120, Low to High AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=0
trigger1= enemynear,statetype=A || enemynear,hitdefattr=A,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time>12
trigger3= helper(55555),var(50) || enemynear,numproj
trigger3= !(enemynear,hitdefattr=C,AA,AP) && enemynear,statetype=A
statetype=S
physics=S

[State 120, Low to High AI Special]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=1
trigger1= enemynear,hitdefattr=SCA,AA,AP
statetype=S
physics=S

;---CGUARDHIT2 (knocked back)---
[Statedef 153]
type=C
physics=C
movetype=H
anim=131
[State 153, Vel]
type=hitvelset
trigger1= !time
x=1
[State 153, Vel]
type=velset
trigger1= time=gethitvar(slidetime)
trigger2= hitover
x=0
[State 153, Ctrl]
type=ctrlset
trigger1= time=gethitvar(ctrltime)
value=1

[State 153, High to Low]
type=statetypeset
trigger1= var(59)<=0 && statetype=S && command="holddown"
statetype=C
physics=C
[State 153, Low to High]
type=statetypeset
trigger1= var(59)<=0 && statetype=C && command!="holddown"
statetype=S
physics=S

[State 120, High to Low AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=S && helper(22222),var(59)=0
trigger1= enemynear,hitdefattr=C,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time<=12
statetype=C
physics=C
[State 120, Low to High AI]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=0
trigger1= enemynear,statetype=A || enemynear,hitdefattr=A,AA,AP
trigger2= enemynear,hitdefattr=S,AA,AP && enemynear,time>12
trigger3= helper(55555),var(50) || enemynear,numproj
trigger3= !(enemynear,hitdefattr=C,AA,AP) && enemynear,statetype=A
statetype=S
physics=S

[State 120, Low to High AI Special]
type=statetypeset
triggerall= var(59)>=1 && statetype=C && helper(22222),var(59)=1
trigger1= enemynear,hitdefattr=SCA,AA,AP
statetype=S
physics=S

[State 153, End]
type=changestate
trigger1= hitover
value=131
ctrl=1


;---AGUARDHIT (shaking)---
[Statedef 154]
type=A
physics=N
movetype=H
velset=0,0
[State 154, Anim]
type=changeanim
trigger1= 1
value=152
[State 154, End]
type=changestate
trigger1= hitshakeover
value=155


;---AGUARDHIT2 (knocked away)---
[Statedef 155]
type=A
physics=N
movetype=H
anim=132
[State 155, Vel]
type=hitvelset
trigger1= !time
x=1
y=1
[State 155, Vel]
type=veladd
trigger1= 1
y=const(movement.yaccel)
[State 155, Ctrl]
type=ctrlset
trigger1= time=gethitvar(ctrltime)
value=1
[State 155, Var]
type=varset
trigger1= 1
sysvar(0)=(pos y>=0 && vel y>0)
[State 155, Vel]
type=velset
trigger1= sysvar(0)
y=0
[State 155, Pos]
type=posset
trigger1= sysvar(0)
y=0
[State 155, End]
type=changestate
trigger1= sysvar(0) && inguarddist
trigger1= (var(59)<=0 && command="holdback") || var(59)>=1
value=130
[State 155, End]
type=changestate
trigger1= sysvar(0)
value=52


;====================<LOSE>====================
[Statedef 170]
type=S
ctrl=0
anim=170
velset=0,0

[State 170, Assert]
type=assertspecial
trigger1= time<300
flag=roundnotover


;====================<DRAW GAME>====================
[Statedef 175]
type=S
ctrl=0
velset=0,0
[State 175, switch]
type=changestate
trigger1= !time
value=170


;====================<CONTINUE?>====================
[Statedef 5500]
type=S
anim=5300
velset=0,0
ctrl=0
[State 5500, Anim]
type=changeanim
trigger1= !time
value=5500


;====================<INITIALIZE>====================
[Statedef 5900]
type=S
[State 5900, Var Reset]
type=varrangeset
trigger1= !roundsexisted
value=0
[State 5900, Var Reset]
type=varrangeset
trigger1= !roundsexisted
fvalue=0

[State 5900, Intro VS Vega]
type=null;changestate
triggerall= numenemy
triggerall= !roundsexisted || !(enemy,roundsexisted)
triggerall= !(teammode=simul) && !(enemy,teammode=simul)
trigger1= enemy,name="Vega" && enemy,authorname="Phantom.of.the.Server"
trigger2= enemy,name="cvsvega" && (enemy,authorname="Warusaki3" || enemy,authorname="Gargoyle")
trigger3= enemy,name="M.Bison" && enemy,authorname="N-Mario"
trigger4= enemy,name="[Necromancer's] M. Bison"
trigger5= enemy,name="M. Bison" && enemy,authorname="VK, Updated by Terry Kuo, adapted by Tenebrous"
trigger6= enemy,name="CvSBison" && enemy,authorname="Team Kai (Saiai and Koga)"
value=6910

[State 5900, Turns Intro]
type=changestate
trigger1= teammode=turns
trigger1= !roundsexisted && roundno>=2
value=6900

[State 5900, Intro]
type=changestate
trigger1= roundno=1
value= 190
[State 5900, End]
type=changestate
trigger1= 1
value=0


;====================<INTRO 1>====================
[Statedef 190]
type=S
physics=S
anim=190
[State 190, Intro]
type=assertspecial
trigger1= 1
flag=intro

[State 190, Snd]
type=playsnd
trigger1= animelem=2
value= 6, ifelse(random<500, 2, 0)
channel=0
[State 190, Snd]
type=playsnd
trigger1= animelem=4
value=1,0
channel=1

[State 190, Salt]
type=explod
trigger1= animelem=4
anim=6000
sprpriority=2
postype=p1
pos=0,0
scale=const(size.xscale),const(size.yscale)
ownpal=1

[State 190, End]
type=changestate
trigger1= !animtime
value=0


;====================<TURNS INTRO>====================
[Statedef 6900]
type=A
anim=6900
velset=0,0
ctrl=0
[State 6900, Intro]
type=assertspecial
trigger1= 1
flag=intro

[State 6900, Camera]
type=screenbound
trigger1= 1
value=0
movecamera=0,0
[State 6900, Camera]
type=helper
trigger1= !numhelper(8999)
helpertype=normal
stateno=8999
ID=8999
name="Camera"
postype=p1

[State 6900, Pos]
type=posadd
trigger1= !time
x= floor(-2*backedgedist)

[State 6900, Vel]
type=velset
trigger1= !time
x= (helper(8999),rootdist x)/-40.0
y= -10.25
[State 6900, Vel]
type=veladd
trigger1= 1
y= .5

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


;---Land---
[Statedef 6901]
type=S
physics=S
anim=6901
velset=0,0
[State 6901, Intro]
type=assertspecial
trigger1= 1
flag=intro

[State 6901, Pos]
type=posset
trigger1= !time && numhelper(8999)
x= ceil(helper(8999),pos x)
[State 6901, Pos]
type=posset
trigger1= !time
y= 0

[State 6901, Snd]
type=playsnd
trigger1= !time
value=0,52
[State 6901, Dust]
type=explod
trigger1= !time
anim=8102
sprpriority=-3
postype=p1
scale=.5,.5
pausemovetime=-1
supermovetime=-1
ownpal=1

[State 6901, Snd]
type=playsnd
trigger1= animelem=6
value= 6, ifelse(random<500, 2, 0)
channel=0
[State 6901, Snd]
type=playsnd
trigger1= animelem=8
value=1,0
channel=1

[State 6901, Salt]
type=explod
trigger1= animelem=8
anim=6000
sprpriority=2
postype=p1
pos=0,0
scale=const(size.xscale),const(size.yscale)
ownpal=1

[State 6901, End]
type=changestate
trigger1= !animtime
value=0


;====================<JUMP INTRO>====================
[Statedef 6905]
type=A
physics=N
movetype=I
anim=6905
velset=0,0
ctrl=0
[State 6905, Intro]
type=assertspecial
trigger1= 1
flag=intro

[State 6905, Camera]
type=screenbound
trigger1= 1
value=0
movecamera=0,0
[State 6905, Camera]
type=helper
trigger1= !numhelper(8999)
helpertype=normal
stateno=8999
ID=8999
name="Camera"
postype=p1

[State 6905, Pos]
type=posset
trigger1= !time
x= 160*facing
y= -208

[State 6905, Vel]
type=velset
trigger1= !time
x= facing * ((-140 * facing) - pos x)/32.0

[State 6905, Vel]
type=veladd
trigger1= 1
y= .25

[State 6905, End]
type=changestate
trigger1= facing=1 && pos x<=(-140 - vel x)
trigger2= facing=-1 && pos x>=(140 + vel x)
value=6906
[State 6905, End]
type=changestate
trigger1= time
trigger1= pos y>-vel y
value=6908


;---Wall---
[Statedef 6906]
type=A
physics=N
movetype=I
anim=6906
velset=0,0
ctrl=0

[State 6906, Intro]
type=assertspecial
trigger1= 1
flag=intro
[State 6906, Camera]
type=screenbound
trigger1= 1
value=0
movecamera=0,0

[State 6906, Vel]
type=posset
trigger1= 1
x= -160*facing
y= -100

[State 6906, Snd]
type=playsnd
trigger1= !time
value=0,103

[State 6906, Snd]
type=playsnd
trigger1= !time
value=6,2
channel=0

[State 6906, End]
type=changestate
trigger1= !animtime
value=6907


;---Fall---
[Statedef 6907]
type=A
physics=N
movetype=I
anim=6907
velset=0,0
ctrl=0

[State 6907, Intro]
type=assertspecial
trigger1= 1
flag=intro
[State 6907, Camera]
type=screenbound
trigger1= 1
value=0
movecamera=0,0

[State 6907, Pos]
type=posadd
trigger1= !time
x= ceil(32 * const(size.xscale))

[State 6907, Vel]
type=velset
trigger1= !time
x= (helper(8999),rootdist x)/-19.0
[State 6907, Vel]
type=veladd
trigger1= 1
y= .5

[State 6907, End]
type=changestate
trigger1= pos y>-vel y
value=6908


;---Land---
[Statedef 6908]
type=S
physics=S
movetype=I
anim=6908
velset=0,0
[State 6908, Intro]
type=assertspecial
trigger1= 1
flag=intro

[State 6908, Pos]
type=posset
trigger1= !time
y= 0
[State 6908, Pos]
type=posset
trigger1= !time && numhelper(8999)
x= ceil(helper(8999),pos x)

[State 6908, Snd]
type=playsnd
trigger1= !time
value=0,52
[State 6908, Dust]
type=explod
trigger1= !time
anim=8102
sprpriority=-3
postype=p1
scale=.5,.5
pausemovetime=-1
supermovetime=-1
ownpal=1

[State 6908, End]
type=changestate
trigger1= !animtime
value=0


;====================<INTRO vs VEGA>====================
[Statedef 6910]
type=S
physics=S
anim=6910
[State 6910, Intro]
type=assertspecial
trigger1= 1
flag=intro

[State 6910, Snd]
type=playsnd
trigger1= animelem=5
value=0,103
channel=1

[State 6910, End]
type=changestate
trigger1= !animtime
value=0


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

[State 180, Win]
type=changestate
trigger1= command="holdx" || command="holdy" || command="holdz"
value= ifelse(command="holdx", 181, ifelse(command="holdy", 183, 184))
[State 180, Win]
type=changestate
trigger1= command="holda" || command="holdb" || command="holdc"
value= 182

[State 180, Win]
type=changestate
trigger1= 1
value= 181+(random%4)


;====================<WIN 1>====================
[Statedef 181]
type=S
physics=S
anim=181
ctrl=0
[State 181, Assert]
type=assertspecial
trigger1= time<180
flag=roundnotover

[State 181, Snd]
type=playsnd
trigger1= animelem=2
value=6,3
channel=0
[State 181, Snd]
type=playsnd
trigger1= animelem=2
value=1,0
channel=1


;====================<WIN 2>====================
[Statedef 182]
type=S
physics=S
anim=182
ctrl=0
[State 182, Assert]
type=assertspecial
trigger1= time<180
flag=roundnotover

[State 182, Snd]
type=playsnd
trigger1= animelem=2
value=6,1
channel=0


;====================<WIN 3>====================
[Statedef 183]
type=S
physics=S
anim=183
ctrl=0
[State 183, Assert]
type=assertspecial
trigger1= time<180
flag=roundnotover

[State 183, Snd]
type=playsnd
trigger1= animelem=2
value=5,0
channel=0
[State 183, Snd]
type=playsnd
trigger1= animelem=2
value=1,0
channel=1


;====================<WIN 4>====================
[Statedef 184]
type=S
physics=S
anim=184
ctrl=0
[State 184, Assert]
type=assertspecial
trigger1= time<180
flag=roundnotover

[State 184, Snd]
type=playsnd
trigger1= animelem=2
value=6,4
channel=0


;====================<TAUNT>====================
[Statedef 195]
type=S
physics=S
movetype=I
anim=195
velset=0,0
ctrl=0
sprpriority=1

[State 195, Snd]
type=playsnd
trigger1= animelem=3
value=6,0
channel=0
[State 195, Snd]
type=playsnd
trigger1= animelem=5
value=1,0
channel=1

[State 195, Projectile]
type = Projectile
trigger1 =animelem=5 && numprojid(195)=0
ProjID =195
projanim =6000
projhitanim=-1
projremanim =9741
projcancelanim =9741
projscale = const(size.xscale),1
projremove = 0
projremovetime = 45
;velocity = 0,0
;remvelocity = 0,0
;accel = 0,0
;velmul = 1
projhits = 1
projmiss=1
projpriority = 1
projsprpriority = 3
projedgebound = 40
projstagebound = 40
projheightbound = -240,240
offset = 0,0
postype = p1         ;p2,front,back,left,right
projshadow = 0,0,0
attr=S,NP
hitflag=MAFDP
guardflag=M
priority = 7, hit
damage = 10,1
getpower = 0,0
givepower = 0,0;-250-(enemynear,movetype=A)*750, -100
pausetime = 0
guard.pausetime = 10,10
animtype = Light
air.animtype = light
fall.animtype = light
ground.type = high
air.type = high
ground.hittime = 40
ground.slidetime = 40
guard.hittime = 40
air.hittime = 120
ground.velocity = -1.2, 0
ground.cornerpush.veloff = 1
guard.velocity = -1.2
guard.cornerpush.veloff = 1
air.velocity = -1.2, -1.2
air.cornerpush.veloff = 1
yaccel = .58
fall = 0
fall.recover = 1
fall.recovertime = 120
hitsound =-1; -1 + 0*(var(31):=0)
guardsound =-1; -1 + 0*(var(32):=0)
sparkno =-1; -1 + 0*(var(33):=8010)
guard.sparkno = -1; + 0*(var(34):=8000)
sparkxy = -1;0 + 0*(var(35):=86), var(36):=-58
guard.dist=160
ID=195

[State 195, Salt]
type=explod
trigger1= animelem=5
anim=6000
sprpriority=2
postype=p1
pos=10,-10
scale=const(size.xscale),const(size.yscale)
ownpal=1

[State 195, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;====================<CHEAP K.O.>====================
[Statedef 5950]
type=S
movetype=H
physics=S
anim=5950
velset=0,0

[State 5950, NHB]
type=nothitby
trigger1= 1
value=SCA
[State 5950, Pos]
type=posset
trigger1= 1
y=0

[State 5950, KO Snd]
type=assertspecial
trigger1= 1
flag=nokosnd
[State 5950, KO Snd]
type=stopsnd
trigger1= !time && !alive
channel=0
[State 5950, KO Snd]
type=playsnd
trigger1= animelem=2 && !alive
value=11,1

[State 5950, Pos]
type=posadd
trigger1= animelem=5
x= ceil(-12 * const(size.xscale))

[State 5981, Snd]
type=playsnd
trigger1= animelem=9
value=f7,0
[State 5981, FX]
type=explod
trigger1= animelem=9
anim=f60
postype=p1
pos=0,0
sprpriority=-3

[State 5950, End]
type=changestate
trigger1= !animtime
value=ifelse(alive,5110,5150)


;====================<AIR HIT TRANSITION>====================
[Statedef 5035]
type=A
movetype=H
physics=N

[State 5035, Anim]
type=changeanim
trigger1= !time
trigger1= selfanimexist(5035)
trigger1= anim=[5000,5029]
value=5035

[State 5035, Grav]
type=veladd
trigger1= 1
y=gethitvar(yaccel)

[State 5035, recover]
type=changestate
triggerall= !hitfall
trigger1= hitover
trigger2= !animtime
trigger3= vel y>0 && pos y>=10
trigger4= !time
trigger4= anim!=5035
value=5040

[State 5035, fall]
type=changestate
triggerall= hitfall
trigger1= hitover
trigger2= !animtime
trigger3= vel y>0 && pos y>=10
trigger4= !time
trigger4= anim!=5035
value=5050


; HIT_LIEDOWN
[Statedef 5111]
type    = L
movetype= H
physics = N

[State 5111, end]
type=null;selfstate
trigger1= command="recovery"
trigger1= time>=.5*const(data.liedown.time)
value=5120
[State 5111, end]
type=selfstate
trigger1=time>=const(data.liedown.time)
value=5120

[State 5110, EnvShake]
type = FallEnvShake
trigger1 = Time = 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, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5110, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[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, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

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

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


;==========<FALL RECOVERY>==========
[Statedef 5200]
type=A
movetype=H
physics=N
[State 5200, Anim]
type=changeanim
trigger1= anim=5035 && !animtime
value=5050
[State 5200, Vel]
type=veladd
trigger1= 1
y=gethitvar(yaccel)
[State 5200, End]
type=selfstate
trigger1= vel y>0 && pos y>=10
value=5201


[Statedef 5201]
type=S
physics=N
movetype=I
anim=5200
ctrl=0
facep2=1

[State 5201, Pos]
type=posset
trigger1= 1
y= 0
[State 5201, Vel]
type=velset
trigger1= animelem=1
x= -2.84375
y= 0
[State 5201, Vel]
type=velset
trigger1= animelem=5
x= 0

[State 5201, Snd]
type=playsnd
trigger1= !time
value=4,5
channel=0
[State 5201, Snd]
type=playsnd
trigger1= !time
value=0,5200

[State 5201, Flash]
type=palfx
trigger1= !time
add=255,255,255
sinadd=-255,-255,-255,40
time=10
[State 5201, FX]
type=helper
trigger1= !time
helpertype=normal
stateno=8200
ID=8200
name="Recover FX"
postype=p1
pos= 0, ceil(-16 * const(size.yscale))
size.xscale=1
size.yscale=1
ownpal=1

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

[State 5201, End]
type=changestate
trigger1= !animtime
value=0
ctrl=1


;---AIR---
[Statedef 5210]
type=A
movetype=I
physics=N
anim=5210
ctrl=0
facep2=1

[State 5210, Accel]
type=veladd
trigger1= 1
y=.6
[State 5210, Vel]
type=velset
trigger1= !time
x= ifelse((command="holdfwd" && command!="holdback"), 0, ifelse((command!="holdfwd" && command="holdback"), -4, -2))
y= -7.55

;[State 5210, Direction]
;type=velset
;trigger1= !time
;trigger1= command="holdfwd"^^command="holdback"
;x=ifelse(command="holdfwd",-1.33,-4)
;y=-7.55

[State 5210, Snd]
type=playsnd
trigger1= !time
value=4,5
channel=0
[State 5210, Snd]
type=playsnd
trigger1= !time
value=0,5200

[State 5210, Flash]
type=palfx
trigger1= !time
add=255,255,255
sinadd=-255,-255,-255,40
time=10
[State 5210, FX]
type=helper
trigger1= !time
helpertype=normal
stateno=8200
ID=8200
name="Recover FX"
postype=p1
pos= 0, ceil(-74 * const(size.yscale))
size.xscale=1
size.yscale=1
ownpal=1

[State 5210, NHB]
type=nothitby
trigger1= time<14
value=SCA
time=1
[State 5210, Ctrl]
type=ctrlset
trigger1= time>=14
value=1

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


;==========<FORCED TARGET RECOVERY>==========
[Statedef 5025]
type=A
movetype=H
physics=N
velset=0,0
facep2=1
[State 5025, HFS]
type=hitfallset
trigger1= 1
value=0
[State 5025, End]
type=selfstate
trigger1= 1
value= ifelse(pos y, 5020, 5000)


;==========<TARGET SAFE FALL>==========
[Statedef 5205]
type=A
physics=N
movetype=H
[State 5205, End]
type=selfstate
trigger1= 1
value= ifelse(pos y<-20, 5210, 5200)


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

[State -2, ChangeState]
type=changestate
triggerall= (stateno!=[760,762]) && movetype=I && statetype!=A
trigger1= numhelper(10700)
trigger1= helper(10700),stateno=10705
value=760
ctrl = 0
pausemovetime=1
supermovetime=1
[State -2, ChangeState]
type=changestate
triggerall= (stateno!=[760,762]) && movetype=I && statetype!=A
trigger1= numhelper(10701)
trigger1= helper(10701),stateno=10705
value=761
ctrl = 0
pausemovetime=1
supermovetime=1
[State -2, ChangeState]
type=changestate
triggerall= (stateno!=[760,762]) && movetype=I && statetype=A
trigger1= numhelper(10702)
trigger1= helper(10702),stateno=10705
value=762
ctrl = 0
pausemovetime=1
supermovetime=1

[State -2, Stop AI]
type=varset
trigger1= var(59)!=0
trigger1= roundstate!=2 || !alive
var(59)=0
ignorehitpause=1

[State -2, Hit Detection]
type=varset
trigger1= movecontact=1 && var(30)<0
var(30)= hitpausetime
ignorehitpause=1

[State -2, HitSound]
type=playsnd
trigger1= movecontact=1 && var(30)=hitpausetime
trigger1= movehit=1 && var(31)>=0
value= 2, var(31)
channel=2
ignorehitpause=1
[State -2, GuardSound]
type=playsnd
trigger1= movecontact=1 && var(30)=hitpausetime
trigger1= moveguarded=1 && var(32)>=0
value= 3, var(32)
channel=2
ignorehitpause=1

[State -2, Sparks]
type=helper
triggerall= movecontact=1 && var(30)=hitpausetime
trigger1= movehit=1 && numenemy
trigger1= var(33)=8010 || var(33)=8011 || var(33)=8012 || var(33)=8013 || var(33)=8014
trigger2= moveguarded=1 && numenemy
trigger2= var(34)=8000 || var(34)=8001
helpertype=normal
stateno=ifelse(moveguarded, var(34), var(33))
ID=8000
name="Spark"
postype=p1
pos= ceil(ifelse(p2dist x<0, 0, ifelse(p2dist x<var(35), ceil(p2dist x), var(35))) * const(size.xscale)), ceil(var(36) * const(size.yscale))
ownpal=1
pausemovetime=65535
supermovetime=65535
ignorehitpause=1

[State -2, Counter Flag]
type=varset
trigger1= numenemy
trigger1= enemynear(var(5)),movetype=A
var(28)= enemynear(var(5)),stateno
[State -2, Counter Flag]
type=varset
trigger1= numenemy
trigger1= var(28)
var(29)=enemynear(var(5)),stateno=var(28)

[State -2, Counter FX]
type=helper
trigger1= movehit=1 && numtarget && var(30)=hitpausetime
trigger1= numenemy && var(29)
trigger1= !(hitdefattr=SCA,AT) && !numhelper(8290)
helpertype=normal
stateno=8290
ID=8290
name="Counter FX"
postype=p1
pos= ceil((target,pos x-pos x)*facing),ceil(target,pos y+target,const(size.mid.pos.y));ceil(ifelse(p2dist x<0, 0, ifelse(p2dist x<var(35), ceil(p2dist x), var(35))) * const(size.xscale)), ceil(var(36)*const(size.yscale))
ownpal=1
pausemovetime=255
supermovetime=255
ignorehitpause=1

[State -2, Hit Detection]
type=varset
trigger1= 1
var(30)=-1
[State -2, Hit Detection]
type=varrangeset
trigger1= movetype=I 
trigger2= movetype=H && time
first=30
last=35
value=-1
ignorehitpause=1

[State -2, P2 Recovery]
type=targetstate
trigger1= numtarget(200)
trigger1= (target(200),stateno=5020) && (target(200),alive) && (target(200),hitfall)
ID=200
value=5025
ignorehitpause=1
[State -2, P2 Facing]
type=targetfacing
trigger1= movecontact=1 && numtarget
trigger1= !(target,hitshakeover) && !(target,hitfall) && (target,time<=1)
value= ifelse(p2dist x>=0, -1, 1)
ignorehitpause=1

[State -2, P2 Safe Fall]
type= targetstate
trigger1= numtarget=1
trigger1= target,command="recovery"
trigger1= target,pos y>=-20 && target,vel y>0
trigger1= target,alive && target,hitfall && target,gethitvar(fall.recover)
trigger1= target,stateno=5030 || target,stateno=5035 || target,stateno=5050 || target,stateno=5071
value= 5205
ignorehitpause=1

[State -2, Prevent Guard]
type=assertspecial
trigger1= var(17)>0
trigger1= var(17):=(var(17)-1)
flag=unguardable
ignorehitpause=1

[State -2, Hitcount]
type=varadd
trigger1= movehit=1 && numtarget
trigger1= !(hitdefattr=SCA,AT)
var(13)=1
[State -2, Hitcount Reset]
type=varset
trigger1= numenemy && var(13)
trigger1= !numtarget;!(enemynear,movetype=H) && (enemynear,stateno!=5300)
var(13)=0
ignorehitpause=1

[State -2, Juggle Count]
type=varadd
trigger1= movehit=1 && !numtarget(200)
trigger1= !(hitdefattr=SCA,AT)
var(15)=1
[State -2, Juggle Reset Single]
type=varset
triggerall= numenemy=1 && var(15)
trigger1= (enemy,statetype!=A) && (enemy,stateno!=[5100,5109]) && (enemy,time>=1)
trigger2= (enemy,movetype!=H) || (enemy,stateno=[120,155]) || (enemy,ctrl)
var(15)=0
ignorehitpause=1
[State -2, Juggle Reset Simul]
type=varset
triggerall= numenemy>=2 && var(15)
trigger1= (enemynear(0),statetype!=A) && (enemynear(0),time>=1)
trigger2= (enemynear(0),movetype!=H) || (enemynear(0),stateno=[120,155]) || (enemynear(0),ctrl)
trigger3= (enemynear(1),statetype!=A) && (enemynear(0),time>=1)
trigger4= (enemynear(1),movetype!=H) || (enemynear(0),stateno=[120,155]) || (enemynear(0),ctrl)
var(15)=0
ignorehitpause=1
[State -2, Free Juggling]
type=varset
trigger1= roundstate!=2
var(15)=0
ignorehitpause=1

[State -2, Juggle Flag]
type=varset
trigger1= numenemy && !var(16)
trigger1= (enemynear,stateno=5040) && !(enemynear,ctrl)
var(16)=1
ignorehitpause=1
[State -2, Juggle Flag Reset Single]
type=varset
triggerall= numenemy=1 && var(16)
trigger1= (enemy,movetype!=H) && (enemy,stateno!=5040)
trigger2= !(enemy,hitshakeover) || (enemy,statetype=L) || (enemy,ctrl) || numtarget(200)
var(16)=0
ignorehitpause=1
[State -2, Juggle Flag Reset Simul]
type=varset
triggerall= numenemy>=2 && var(16)
trigger1= (enemynear(0),movetype!=H) && (enemynear(0),stateno!=5040)
trigger2= !(enemynear(0),hitshakeover) || (enemynear(0),statetype=L) || (enemynear(0),ctrl)
trigger3= (enemynear(1),movetype!=H) && (enemynear(1),stateno!=5040)
trigger4= !(enemynear(1),hitshakeover) || (enemynear(1),statetype=L) || (enemynear(1),ctrl)
var(16)=0
ignorehitpause=1

[State -2, Custom Combo End]
type=varset
trigger1= var(20)<0
trigger2= movetype=H
trigger3= roundstate!=2
trigger4= (stateno=[3000,4999])
var(20)=0
ignorehitpause=1
[State -2, Custom Combo Time]
type=varadd
trigger1= var(20)>0
var(20)=-1
ignorehitpause=1

[State -2, Custom Combo Asserts]
type=assertspecial
trigger1= var(20)>0
flag= nostandguard
flag2=nocrouchguard
flag3=noairguard
ignorehitpause=1

[State -2, Custom Combo PalFX]
type=palfx
trigger1= var(20)>60
time=2
add= 32+ceil(sin(var(20)/16.0*pi)*32), 32+ceil(sin(var(20)/16.0*pi)*32), 32+ceil(sin(var(20)/16.0*pi)*32)
ignorehitpause=1
[State -2, Custom Combo PalFX]
type=palfx
trigger1= var(20)=[1,60]
time=2
add= 64+ceil(sin(var(20)/8.0*pi)*64), 64+ceil(sin(var(20)/8.0*pi)*64), 64+ceil(sin(var(20)/8.0*pi)*64)
ignorehitpause=1

[State -2, Throw Disallowed]
type=nothitby
triggerall= !(prevstateno=5120 && time<=3)
trigger1= (stateno=[150,155]); || (movetype=I && time<=1 && (prevstateno=[150,155]))
trigger2= movetype=H && statetype!=A
trigger3= (stateno=[5020,5040]) && !(hitfall)
trigger4= (stateno=0 || stateno=52) && (prevstateno=[5000,5040]) && ((time<=0) || !(ctrl))
trigger5= stateno=0 && prevstateno=52 && (!time || !ctrl)
trigger6= (stateno=40 || stateno=41); && (time>=1 || prevstateno=0 || prevstateno=52)
value=,AT
time=1

[State -2, Dampener]
type=varset
trigger1= 1
fvar(10)= ifelse(var(13)<2, 24, ifelse(var(13)>=24, 1, 25-var(13))) / 24.0
ignorehitpause=1
[State -2, Dampener - Custom Combo]
type=varset
trigger1= var(20)
fvar(10)= .72 * (10 - ifelse(var(13)>=10, 10, var(13))) / 10.0
;fvar(10)= .43 * (10 - ifelse(var(13)>=10, 10, var(13))) / 10.0
ignorehitpause=1
[State -2, Dampener - Custom Combo Limiter]
type=varset
trigger1= var(20) 
trigger1= 0
fvar(10)= ifelse(var(13), .072, .72)
ignorehitpause=1
[State -2, Dampener - Supers]
type=varset
trigger1= (stateno=[3000,4999])
fvar(10)= ifelse(var(22), .6, ifelse(var(21), .75, 1.0))
ignorehitpause=1

[State -2, Dampener Limit]
type=varset
trigger1= fvar(10)<0
fvar(10)=0
ignorehitpause=1
[State -2, Root Dampener]
type=varset
trigger1= 1
fvar(11)= fvar(10) * ifelse(var(29),1.2,1)
ignorehitpause=1

[State -2, Tap Punch]
type=varadd
trigger1= var(27)>0
var(27)= -1
[State -2, Tap Punch]
type=varset
trigger1= var(27)<=0
trigger2= time=1
trigger2= stateno=1000
var(26)= 0
[State -2, Tap Punch]
type=varadd
triggerall= var(59)<=0
trigger1= command="x"
trigger1= var(27):=14
trigger2= command="y"
trigger2= var(27):=12
trigger3= command="z"
trigger3= var(27):=10
trigger4= command="pp"
trigger4= var(27):=14
var(26)= 1

[State -2, Back Charge]
type=varadd
trigger1= var(59)<=0
trigger1= p2dist x>=0 && command="holdback"
trigger2= var(59)<=0
trigger2= p2dist x<0 && command="holdfwd"
trigger3= var(59)>=1
var(37)=1
[State -2, Back Charge]
type=varset
trigger1= var(59)<=0
trigger1= p2dist x>=0 && command!="holdback"
trigger2= var(59)<=0
trigger2= p2dist x<0 && command!="holdfwd"
trigger3= var(59)>=1
trigger3= stateno=0 || (stateno=20 && vel x>0) || (stateno=[760,762])
trigger4= var(59)>=1
trigger4= (stateno=40 && sysvar(1)!=-1)
trigger5= var(59)>=1
trigger5= (stateno=[1000,4999]) && time=1
var(37)=0

[State -2, Back Charge Buffer]
type=varset
trigger1= var(37)>=45
var(38)= 32
[State -2, Back Charge Buffer]
type=varadd
trigger1= var(37)<45 && var(38)>0
var(38)= -1

[State -2, Down Charge]
type=varadd
trigger1= var(59)<=0
trigger1= command="holddown"
trigger2= var(59)>=1
var(39)=1
[State -2, Down Charge]
type=varset
trigger1= var(59)<=0
trigger1= command!="holddown"
trigger3= var(59)>=1
trigger3= stateno=0 || stateno=20 || (stateno=40 && time=1) || stateno=760
trigger4= var(59)>=1
trigger4= (stateno=[1000,4999]) && time=1
trigger5= var(59)>=1
trigger5= (stateno=[120,155]) && statetype!=C
var(39)=0

[State -2, Down Charge Buffer]
type=varset
trigger1= var(39)>=45
var(40)= 32
[State -2, Down Charge Buffer]
type=varadd
trigger1= var(39)<45 && var(40)>0
var(40)= -1

[State -2, Voice Pos]
type=sndpan
trigger1= 1
channel=0
pan=0
ignorehitpause=1

[State -2, timer]
type=null
trigger1= roundstate=2 && var(57)<65535
trigger1= var(57):=var(57)+1
trigger2= roundstate!=2
trigger2= var(57):=0
[State -2, hadou defence]
type=helper
triggerall= roundstate=2 && numenemy && numhelper(55555) && !numhelper(44444) && var(57)>=40
trigger1= !(enemynear,numhelper=helper(55555),var(51)) && enemynear,movetype=A
trigger2= enemynear,movetype=I
trigger2= enemynear,numhelper=helper(55555),var(51) && helper(55555),var(50)=0 && inguarddist
name="hadou ID-checker"
id=44444
stateno=44444
ignorehitpause=1
supermovetime=65535
pausemovetime=65535

[State -2, AI test]
type=null
trigger1= numenemy
trigger1= movetype=H && (prevstateno=[0,4000]) && time<=1 && enemynear,numtarget && (prevstateno!=[120,155])
trigger1= gametime-var(58)=[0,1]
trigger1= var(51):=prevstateno
ignorehitpause=1
pausemove=1
supermove=1

[State -2, AI attack parryed]
type=null
trigger1= (stateno=220 || stateno=250 || (stateno=[600,699])) && (movecontact || movereversed) && !numtarget && enemynear,statetype=A
trigger1= var(53):=1
trigger2= !(enemynear,statetype=A)
trigger2= var(53):=0 || 1

[State -2, parrypausetime]
type=null
trigger1= var(14)>0
trigger1= var(14):=var(14)-1
trigger2= var(14)<0
trigger2= var(14):=0

[State -2, p2dist x]
type=varset
trigger1= playeridexist(var(54))
fvar(35)= (playerid(var(54)),pos x-pos x)*facing
[State -2, p2dist y]
type=varset
trigger1= playeridexist(var(54))
fvar(36)= playerid(var(54)),pos y-pos y
[State -2, p2bodydist x front]
type=varset
trigger1= playeridexist(var(54))
trigger1= playerid(var(54)),statetype=A
fvar(37)= fvar(35)-22-ifelse(facing=playerid(var(54)),facing,playerid(var(54)),const(size.air.back),playerid(var(54)),const(size.air.front))
ignorehitpause=1
pausemovetime=1
supermovetime=1
[State -2, p2bodydist x front]
type=varset
trigger1= playeridexist(var(54))
trigger1= !(playerid(var(54)),statetype=A)
fvar(37)= fvar(35)-22-ifelse(facing=playerid(var(54)),facing,playerid(var(54)),const(size.ground.back),playerid(var(54)),const(size.ground.front))
ignorehitpause=1
pausemovetime=1
supermovetime=1

[State -2, enemy air]
type=null
trigger1= enemynear,statetype=A && !(enemynear,stateno=[110,115])
trigger1= fvar(39):=enemynear,const(size.head.pos.y)*0.5
trigger2= enemynear,statetype=A && (enemynear,stateno=[110,115])
trigger2= fvar(39):=enemynear,const(size.mid.pos.y)

[State -2, stan recovery]
type=varset
triggerall= var(59)>=1 && sysvar(0)>0
trigger1= stateno=5300
trigger2= enemy,authorname="muteki" && gametime!=var(58)
sysvar(0)=-1

[State -2, enemy down]
type=targetstate
trigger1= numtarget
trigger1= target,stateno=5110
value=5111

[State -2, Debug]
type=displaytoclipboard
trigger1= 1
text= "dist-x%f action%f hansei%d nage%d oki%d"
params= fvar(35), fvar(3), var(51), var(24), sysvar(4)
ignorehitpause=1
pausemove=1
supermove=1
[State -2, Debug]
type=null;displaytoclipboard
trigger1= 1
text= "AI=%d Attack=%f Hits=%d Juggle=%d Charge=%d"
params= var(59), fvar(11), var(13), var(15), var(37)
ignorehitpause=1

[State -2, Debug]
type=appendtoclipboard
trigger1= 1
text= "\nBy PotS - http://www.mugenguild.com/pots/"
ignorehitpause=1


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

[State -3, AI]
type=varset
trigger1= alive && ishometeam
trigger1= teamside=2 || matchno>1
var(59)=1
[State -3, AI Helper]
type=helper
trigger1= !var(59) && !numhelper(9741)
trigger1= alive && roundstate=2
helpertype=normal
name="Honda's AI"
ID=9741
pos=99999,99999
stateno=9741
keyctrl=1
pausemovetime=65535
supermovetime=65535
[State -3, Gametime Var]
type=varset
trigger1= 1
var(58)=gametime
ignorehitpause=1

[State -3, enemynearID]
type=null
trigger1= numenemy
trigger1= var(54)!=enemynear,ID && enemynear,alive
trigger1= var(54):=enemynear,ID+0*(var(5):=0)
trigger2= numenemy>=2
trigger2= var(54)!=enemynear(1),ID && enemynear,alive=0
trigger2= var(54):=enemynear(1),ID+0*(var(5):=1)
ignorehitpause=1
pausemove=1
supermove=1

[State -1, Standing Parry]
type=helper
triggerall= var(59)>=1 && numenemy && !numhelper(10700)
triggerall= roundstate=2
triggerall= statetype!=A;statetype=S || (statetype=C && enemynear,hitdefattr=SA,AA,AP)
triggerall= !(enemynear,hitdefattr=SCA,AT)
triggerall= ctrl || (stateno=[21,29]) || (stateno=[100,101]) || stateno=10800 || stateno=10801 || ((stateno=[760,761]) && time>=10)
trigger1= enemynear,hitdefattr=SA,AA,AP
trigger1= enemynear,time>=10-(random%3=0)*2-(random%6=0)*2-(random%12=0)*2-(prevstateno=[760,761])*2 || (!inguarddist && helper(55555),inguarddist=0)
trigger1= random<150+(enemynear,time-10)*(enemynear,time>10)*25+(prevstateno=[760,761])*100 || (!inguarddist && helper(55555),inguarddist=0)
trigger2= helper(55555),var(59)=2
trigger3= enemynear,numproj=1 && numhelper(44445)
trigger3= helper(44445),var(59)=2
trigger4= enemynear,numproj>=2 && inguarddist && helper(55555),inguarddist && random<333
trigger5= stateno=29 && anim=20 && time=1
helpertype = normal ;player
name = "parry"
ID=10700
stateno=10700
pos = 0,0
postype=p1
facing=1
keyctrl=0
ownpal=0
supermove=0
pausemove=0

[State -1, Crouching Parry]
type=helper
triggerall= var(59)>=1 && numenemy && !numhelper(10701)
triggerall= roundstate=2
triggerall= statetype!=A;statetype=C || (statetype=S && enemynear,hitdefattr=C,AA,AP)
triggerall= !(enemynear,hitdefattr=SCA,AT)
triggerall= ctrl || (stateno=[21,29]) || (stateno=[100,101]) || stateno=10800 || stateno=10801 || ((stateno=[760,761]) && time>=10)
trigger1= enemynear,hitdefattr=C,AA,AP
trigger1= enemynear,time>=10-(random%3=0)*2-(random%6=0)*2-(random%12=0)*2-(prevstateno=[760,761])*2 || (!inguarddist && helper(55555),inguarddist=0)
trigger1= random<150+(enemynear,time-10)*(enemynear,time>10)*25+(prevstateno=[760,761])*100 || (!inguarddist && helper(55555),inguarddist=0)
trigger2= stateno=29 && anim=10 && time=1
helpertype = normal ;player
name = "parry"
ID=10701
stateno=10701
pos = 0,0
postype=p1
facing=1
keyctrl=0
ownpal=0
supermove=0
pausemove=0

[State -1, Air Parry]
type=helper
triggerall= var(59)>=1 && numenemy && !numhelper(10702) && var(3)!=1
triggerall= roundstate=2 && statetype=A
triggerall= !(enemynear,hitdefattr=SCA,AT)
triggerall= ctrl || (stateno=[21,25]) || stateno=762
trigger1= enemynear,hitdefattr=SCA,AA,AP
trigger1= enemynear,time>=10-(random%3=0)*2-(random%6=0)*2-(random%12=0)*2 || !inguarddist
trigger1= random<100+(enemynear,time-10)*(enemynear,time>10)*25+(stateno=762)*100 || !inguarddist
trigger2= helper(55555),var(59)=2
trigger3= enemynear,numproj=1 && numhelper(44445)
trigger3= helper(44445),var(59)
trigger4= enemynear,numproj>=2 && random<250 && inguarddist && helper(55555),inguarddist
trigger5= stateno=50 && (prevstateno=[41,45]) && time=3 && ctrl && p2dist x<enemynear,const(size.attack.dist)
trigger6= ctrl && pos y+vel y*10+0.55*55<=-1 && p2dist x<enemynear,const(size.attack.dist)
helpertype = normal ;player
name = "parry"
ID=10702
stateno=10702
pos = 0,0
postype=p1
facing=1
keyctrl=0
ownpal=0
supermove=0
pausemove=0

[State -3, Standing Parry]
type=helper
trigger1= var(59)<=0
trigger1= roundstate=2 && !numhelper(10700) && (statetype=S || stateno=5120)
trigger1= command="fwd" && command!="back" && command!="up" && command!="down"
trigger1= ctrl || stateno=5120 || (stateno=[760,761])
helpertype = normal ;player
name = "parry"
ID=10700
stateno=10700
pos = 0,0
size.xscale=0.83
postype=p1
facing=1
keyctrl=0
ownpal=0
supermove=0
pausemove=0
[State -3, Crouching Parry]
type=helper
trigger1= var(59)<=0
trigger1= roundstate=2 && !numhelper(10701) && statetype!=A
trigger1= command="down" && command!="fwd" && command!="back" && command!="up"
trigger1= ctrl || stateno=5120 || (stateno=[760,761])
helpertype = normal ;player
name = "parry"
ID=10701
stateno=10701
pos = 0,0
postype=p1
facing=1
keyctrl=0
ownpal=0
supermove=0
pausemove=0
[State -3, Air Parry]
type=helper
trigger1= var(59)<=0 && var(3)!=1
trigger1= roundstate=2 && !numhelper(10702) && statetype=A
trigger1= command="fwd" && command!="back" && command!="up" && command!="down"
trigger1= ctrl || stateno=762
helpertype = normal ;player
name = "parry"
ID=10702
stateno=10702
pos = 0,0
postype=p1
facing=1
keyctrl=0
ownpal=0
supermove=0
pausemove=0

[State -3, Standing Parry]
type=hitoverride
trigger1= numhelper(10700)
attr=SA,AP
stateno=760
slot=0
time=1
ignorehitpause=1
[State -3, Crouching Parry]
type=hitoverride
trigger1= numhelper(10701)
attr=C,AP
stateno=761
slot=0
time=1
ignorehitpause=1
[State -3, Air Parry]
type=hitoverride
trigger1= numhelper(10702)
attr=SCA,AP
stateno=762
forceair=1
slot=0
time=1
ignorehitpause=1

[State -3, ProjContact Reset]
type=varset
triggerall= var(18)
trigger1= stateno!=3300 && stateno!=3350
trigger2= (stateno=3300 || stateno=3350) && time<=1
var(18)=0

[State -3, Chain Reset]
type=varset
trigger1= 1
var(4)=0
ignorehitpause=1
[State -3, Chain Check]
type=varset
trigger1= var(20) && (stateno=[200,699]) && movecontact
trigger2= var(20) && (stateno=[1000,2999]) && (movecontact || var(18)); && statetype!=A
;trigger3= var(20) && stateno=1210 && animelemtime(8)>=0
;trigger4= var(20) && stateno=1230 && animelemtime(12)>=0
;trigger5= var(20) && stateno=1250 && animelemtime(9)>=0
var(4)=1
ignorehitpause=1

;[State -3, Command Cancel Reset]
;type=varset
;trigger1= 1
;var(5)=0
;ignorehitpause=1
;[State -3, Command Cancel Check]
;type=varset
;triggerall= !var(20)
;trigger1= stateno=200 && movecontact
;var(5)=1
;ignorehitpause=1

[State -3, Cancel Reset]
type=varset
trigger1= 1
var(6)=0
ignorehitpause=1
[State -3, Cancel Check]
type=varset
trigger1= var(20) && (stateno=[200,699])
trigger2= var(20) && (stateno=[1000,2999]) && (movecontact || var(18))
trigger3= (stateno=[200,699]) && (movecontact || time<=2)
trigger4= stateno=200 && animelemtime(3)<0
trigger5= stateno=230 && animelemtime(3)<0
trigger6= stateno=241 && animelemtime(4)<0
trigger7= stateno=400 && animelemtime(3)<0
trigger8= stateno=430 && animelemtime(3)<0
trigger9= (prevstateno=[600,699]) && stateno=52 && movecontact
var(6)=1
ignorehitpause=1

[State -3, Super Cancel Reset]
type=varset
trigger1= 1
var(7)=0
ignorehitpause=1
[State -3, Super Cancel Check]
type=varset
trigger1= var(20) && (stateno=[200,699])
trigger2= var(20) && (stateno=[1000,2999]) && (movecontact || var(18))
trigger3= (stateno=[200,699]) && (movecontact || time<=2)
trigger4= (stateno=[1000,1032]) && movecontact;(movecontact=[1,8])
trigger5= (stateno=[1100,1131]) && movecontact;(movecontact=[1,8])
trigger6= (stateno=[1200,1299]) && movecontact;numtarget
trigger7= (stateno=[1800,1899]) && movecontact
trigger8= (stateno=2900 || stateno=2910) && movecontact
trigger9= stateno=52 && movecontact
var(7)=1
ignorehitpause=1

[State -3, Hyper Cancel Reset]
type=varset
trigger1= 1
var(8)=0
ignorehitpause=1
[State -3, Hyper Cancel Reset]
type=varset
trigger1= (stateno=[3000,3002]) && movecontact; && (movecontact=[1,16])
trigger2= (stateno=[3200,3299]) && movecontact
var(8)=1
ignorehitpause=1

[State -3, Corner Push]
type=varset
triggerall= fvar(5)
trigger1= abs(fvar(5))<=(1/.85)
trigger2= numtarget
trigger2= target,gethitvar(hittime)<=0 || (target,gethitvar(hitshaketime)>0 && target,time<=0)
fvar(5)= 0
[State -3, Corner Push]
type=varset
trigger1= numtarget
trigger1= target,gethitvar(hitshaketime)<=0
fvar(5)= fvar(5)*.85
[State -3, Corner Push]
type=varset
trigger1= movecontact=1 && numtarget
fvar(5)= target,gethitvar(xvel)
ignorehitpause=1
[State -3, Corner Push]
type = posadd
triggerall= fvar(5) && stateno!=1800
triggerall= (statetype=S || statetype=C) && numtarget
triggerall= !hitpausetime && target,gethitvar(hitshaketime)<=1
triggerall= (target,statetype=S || target,statetype=C) && !(target,gethitvar(yvel)) && !(target,hitfall)
trigger1= target,frontedgebodydist<=0 && (target,gethitvar(xvel) * target,facing)>0
trigger2= target,backedgebodydist<=0 && (target,gethitvar(xvel) * target,facing)<0
x= ifelse(target,frontedgebodydist<=0, -1, 1) * (target,facing) * fvar(5)

[State -3, ExFX]
type=varadd
trigger1= var(25)>0
var(25)=-1
[State -3, ExFX]
type=varset
trigger1= (stateno!=[1000,2999]) || movetype=H
var(25)=0
[State -3, Ex Flash]
type=palfx
trigger1= !(gametime%2) && var(25)
time=1
color= 0
mul= 256, 224, 0
add= 128, 128, 128
ignorehitpause=1

[State -3, Movement Afterimage]
type=afterimage
triggerall= time=1 && !var(20)
trigger1= stateno=50 && (var(3)=2 || var(3)=3)
trigger2= (stateno=[700,715])
time=2
timegap=1
framegap=4
length=9
palbright=0,0,0
palcontrast=128,128,128
palpostbright=0,0,0
paladd=0,0,0
palmul=.9,.9,.9
trans=add1
[State -3, Lv1 Super Afterimage]
type=afterimage
trigger1= stateno=3000 && time=3
trigger2= stateno=3200 && time=3
time=2
timegap=1
framegap=10
length=21
palbright=0,0,0
palcontrast=128,128,128
palpostbright=0,0,0
paladd=0,0,0
palmul=.75,.75,.75
trans=add1
[State -3, Lv2 Super Afterimage]
type=afterimage
trigger1= stateno=3050 && time=3
trigger2= stateno=3250 && time=3
time=2
timegap=1
framegap=10
length=21
palbright=0,0,0
palcontrast=32,32,160
palpostbright=0,0,0
paladd=0,0,0
palmul=.75,.75,.75
trans=add1
[State -3, Lv3 Super Afterimage]
type=afterimage
trigger1= stateno=3100 && time=2
time=2
timegap=1
framegap=10
length=21
palbright=0,0,0
palcontrast=160,32,32
palpostbright=0,0,0
paladd=0,0,0
palmul=.75,.75,.75
trans=add1

[State -3, Afterimage Persist]
type=afterimagetime
trigger1= stateno=50 || (stateno=[600,699])
trigger1= (var(3)=2 || var(3)=3) && vel y<-1
trigger2= var(20)
trigger3= stateno=[700,715]
trigger4= (stateno=[3000,4999])
time=2
[State -3, Afterimage Off]
type=afterimagetime
triggerall= time<=1
trigger1= stateno=3000 || stateno=3050 || stateno=3100 || stateno=3200 || stateno=3250
trigger2= stateno=3300 || stateno=3350 || stateno=3400 || stateno=3450
time=0

;[State -3, Downed CornerPush]
;type=posadd
;trigger1= statetype!=A && numenemy
;trigger1= enemynear(0),time=1
;trigger1= enemynear(0),stateno=5100 || enemynear(0),stateno=5110
;trigger1= enemynear(0),backedgebodydist<=0 || enemynear(0),frontedgebodydist<=0
;x= ifelse(p2dist x<0, 1, -1)
;ignorehitpause=1

[State -3, Moles-B-Gon]
type=targetbind
trigger1= movehit=1
trigger1= numtarget && numenemy
trigger1= (target,time<=1) && (target,ID=enemynear,ID)
trigger1= !(target,hitshakeover) && (target, hitfall) && (target, pos y>0)
pos= ceil(p2dist x), 0
ignorehitpause=1

[State -3, Prevent Crossup]
type=width
trigger1= 1
edge=8,0
ignorehitpause=1

[State -3, Variable Height]
type=playerpush
triggerall= statetype=A && movetype!=H && numenemy
triggerall= p2bodydist x = [-(enemynear,const(size.ground.back) + enemynear,const(size.ground.front)), 0]
trigger1= p2statetype=S
trigger1= p2dist y >= (enemynear,const(size.height) - 22)
trigger2= p2statetype=C
trigger2= p2dist y >= (enemynear,const(size.height) - 48)
trigger3= p2statetype=L && p2stateno!=5120
trigger3= p2dist y >= 11
value=0
ignorehitpause=1

[State -3, GetHit Snd]
type=playsnd
triggerall= alive && time=1
triggerall= stateno=5000 || stateno=5010
trigger1= gethitvar(animtype)>=2 && random<500
trigger2= gethitvar(animtype)=1 && random<375
trigger3= gethitvar(animtype)=0 && random<250
value=5000,(random%3)
channel=0
ignorehitpause=1
[State -3, GetHit Snd]
type=playsnd
triggerall= alive && time=1
trigger1= (stateno=5000 || stateno=5010) && numenemy
trigger1= gethitvar(fall) || (enemynear,hitdefattr=SCA,SA,HA)
trigger2= (stateno=5020 || stateno=5070 || stateno=5080)
trigger3= (stateno=5050 || stateno=5100) && (prevstateno!=[5000,5199])
value=5000,(random%3)
channel=0
ignorehitpause=1

[State -3, Cheap KO]
type=changestate
trigger1= !alive && (stateno=[5000,5010])
trigger1= (prevstateno=[130,131]) || (prevstateno=[140,141]) || (prevstateno=[150,153])
value=5950
ignorehitpause=1
[State -3, Cheap KO]
type=assertspecial
trigger1= (stateno=[5000,5010])
trigger1= (prevstateno=[130,131]) || (prevstateno=[140,141]) || (prevstateno=[150,153])
flag=nokosnd
ignorehitpause=1

[State -3, CC Finish]
type=helper
triggerall= var(20)
triggerall= winKO && roundstate=3 && !numhelper(8600)
trigger1= movehit=1
trigger2= stateno=1311 && time<=1
;trigger2= numhelper(1005)
;trigger2= (helper(1005),stateno=[1005,1007]) && (helper(1005),var(18))
helpertype=normal
stateno=8600
ID=8600 + 0*(var(23):=900)
name="Super Finish"
postype=left
pos=160,-120
ownpal=1
pausemovetime=255
supermovetime=255
ignorehitpause=1

[State -3, Super Finish]
type=helper
triggerall= winKO && roundstate=3 && !numhelper(8600)
trigger1= movehit=1 && (stateno=[3000,4999])
trigger1= var(23):=stateno
trigger2= stateno=3112 && time<=1
trigger2= var(23):=3100
;trigger3= numhelper(6100)
;trigger3= (helper(6100),stateno=[6100,6120]) && (helper(6100),var(18))
;trigger3= var(23):=3300
helpertype=normal
stateno=8600
ID=8600
name="Super Finish"
postype=left
pos=160,-120
ownpal=1
pausemovetime=255
supermovetime=255
ignorehitpause=1

[State -3, armor damage]
type=lifeadd
trigger1= fvar(0)>0
value=-floor(fvar(0))+0*(fvar(0):=0)

[state -3, AI Disallow enemy to 0F/1F throw]
type=nothitby
trigger1= var(59)>=1 && numenemy && teamside=1 && statetype!=A
trigger1= ctrl || (anim=[0,101])
trigger1= p2movetype!=A && enemynear(var(5)),numpartner=0 && !(enemynear,hitdefattr=SCA,AT)
trigger1= random<750 || life<=500
value=SCA,AT
time=1

[State -3, throw miss1]
type=varadd
triggerall= !var(24) || var(24)=2;var(24)&1=0
trigger1= stateno=800 || stateno=1300
trigger1= hitdefattr=SCA,AT && fvar(37)<=38 && fvar(35)>=0 && time>=4 && movecontact=0
trigger1= p2movetype=I && (p2stateno=[120,155])
;trigger2= enemynear,hitover && enemynear,ctrl
var(24)=1
[State -3, throw miss2]
type=varadd
triggerall= !var(24) || var(24)=1;var(24)&2=0
trigger1= stateno=800 || stateno=1300
trigger1= hitdefattr=SCA,AT && fvar(37)<=38 && fvar(35)>=0 && time>=4 && movecontact=0
trigger1= (p2stateno=52 || enemynear,prevstateno=52)
var(24)=2

[State -3, salt]
type=targetlifeadd
trigger1=numtarget(195) && gametime%2=1
value=-1
[State -3, salt]
type=targetpoweradd
trigger1=numtarget(195)
value=-4
