;#ADD004BASIC#
;; "line" to command auto-patcher to ignore me.


[remap]
	x=x
	y=y
	z=z
	a=a
	b=b
	c=c
	s=s
[defaults]
	command.time=16
	command.buffer.time=1


;---------------
;---------------
[command]
	name="hp1"
	command=~D,F,D,F,x
	time=32
[command]
	name="hp1_s"
	command=~D,F,D,F,y
	time=32
[command]
	name="hp1"
	command=~D,F,x+y
[command]
	name="hp1_s"
	command=~D,F,y+z
;------
[command]
	name="hp2"
	command=~D,B,D,B,x
	time=32
[command]
	name="hp2_s"
	command=~D,B,D,B,y
	time=32
[command]
	name="hp2"
	command=~D,B,x+y
[command]
	name="hp2_s"
	command=~D,B,y+z
;------
[command]
	name="hp3"
	command=~D,F,D,F,a
	time=32
[command]
	name="hp3_s"
	command=~D,F,D,F,b
	time=32
[command]
	name="hp3"
	command=~D,F,a+b
[command]
	name="hp3_s"
	command=~D,F,b+c
;------
[command]
	name="hp4"
	command=~D,B,D,B,a
	time=32
[command]
	name="hp4_s"
	command=~D,B,D,B,b
	time=32
[command]
	name="hp4"
	command=~D,B,a+b
[command]
	name="hp4_s"
	command=~D,B,b+c



;-----------------
[command]
	name="sp3"
	command=~F,D,F,x
	time=20
[command]
	name="sp3_s"
	command=~F,D,F,y
	time=20
[command]
	name="sp3"
	command=~F,D,DF,x
	time=20
[command]
	name="sp3_s"
	command=~F,D,DF,y
	time=20
;-----
[command]
	name="sp1"
	command=~D,F,x
[command]
	name="sp1_s"
	command=~D,F,y
;------
[command]
	name="sp4"
	command=~D,F,a
[command]
	name="sp4_s"
	command=~D,F,b
;------
[command]
	name="sp5"
	command=~D,B,a
[command]
	name="sp5_s"
	command=~D,B,b


;-----------------
[command]
	name="ff"
	command=F,F
	time=10
[command]
	name="bb"
	command=B,B
	time=10

;-----------------
[command]
	name="recovery"
	command=x+y
	time=1
[command]
	name="recovery"
	command=z
	time=1
[command]
	name="ab"
	command=a+b
	time=1
[command]
	name="ab"
	command=c
	time=1

;-----------------
[command]
	name="a"
	command=a
	time=1
[command]
	name="b"
	command=b
	time=1
[command]
	name="c"
	command=c
	time=1
[command]
	name="x"
	command=x
	time=1
[command]
	name="y"
	command=y
	time=1
[command]
	name="z"
	command=z
	time=1
[command]
	name="start"
	command=s
	time=1

;-----------------
[command]
	name="holdfwd"
	command=/$F
	time=1
[command]
	name="holdback"
	command=/$B
	time=1
[command]
	name="holdup"
	command=/$U
	time=1
[command]
	name="holddown"
	command=/$D
	time=1

;-----------------
[command]
	name="holdx"
	command=/x
	time=1
[command]
	name="holdy"
	command=/y
	time=1








;--------------------
[statedef -1]
;--------------------


;---
;--- get_hit_voice
[state 0]
	type=playsnd
	trigger1=stateno=5000 || stateno=5010 || stateno=5020 || stateno=5070 || stateno=5100
	trigger1=time=1 && alive && random<500
	value=5000,(random%3)
	channel=0
;---
[state 0] ; blocking/just defence
	type=playsnd
	trigger1=stateno=195500 && time=1
	value=0,(random%3)
	channel=0



;---
;---
[state 0]
	type=varset
	trigger1=var(41)
	var(41)=0

[state 0]
	type=varset
	triggerall=movecontact
	triggerall=!var(41)
	triggerall=roundstate=2
	trigger1=stateno=200 || (stateno=220 && anim=225) || stateno=230 || (stateno=250 && anim=255)
	trigger2=stateno=301 || stateno=400 || stateno=420 || stateno=430 || stateno=440
	var(41)=1



;--------------------
; hyper / super
;--------------------
; max2
[state 0]
	type=changestate
	value=3400
	triggerall=command="hp2" || command="hp2_s"
	triggerall=var(51)<1
	triggerall=power>=2000
	trigger1=statetype!=a && (ctrl || var(41))

;--- 
; midare (super-syo-ryu)
; 
[state 0]
	type=changestate
	value=3200
	triggerall=command="hp3" || command="hp3_s"
	triggerall=var(51)<1
	triggerall=power>=1000
	trigger1=statetype!=a && (ctrl || var(41))

; ichiban(super-senpu-kyaku)
; t
[state 0]
	type=changestate
	value=3100
	triggerall=command="hp4" || command="hp4_s"
	triggerall=var(51)<1
	triggerall=power>=1000
	trigger1=statetype!=a && (ctrl || var(41))

; super-hadou
; ^g
[state 0]
	type=changestate
	value=3000
	triggerall=command="hp1" || command="hp1_s"
	triggerall=var(51)<1
	triggerall=power>=1000 && !numprojid(91000)
	trigger1=statetype!=a && (ctrl || var(41))



;--------------------
; special
;--------------------
; syu-ryu
; 
[state 0]
	type=changestate
	value=1100
	triggerall=command="sp3" || command="sp3_s"
	triggerall=var(51)<1
	trigger1=statetype!=a && (ctrl || var(41))

; fall-kick
; ؋r
[state 0]
	type=changestate
	value=1400
	triggerall=(command="a" || command="b") && command="holddown"
	triggerall=var(51)<1
	triggerall=(vel y=[-4,4])
	trigger1=statetype=a && ctrl

; otoshi
; 痎Ƃ
[state 0]
	type=changestate
	value=1300
	triggerall=command="sp4" || command="sp4_s"
	triggerall=var(51)<1
	trigger1=statetype!=a && (ctrl || var(41))

; air-senpu-kyaku
; 󒆏tr
[state 0]
	type=changestate
	value=1250
	triggerall=command="sp5" || command="sp5_s"
	triggerall=var(51)<1
	trigger1=statetype=a && ctrl

; senpu-kyaku
; tr
[state 0]
	type=changestate
	value=1200
	triggerall=command="sp5" || command="sp5_s"
	triggerall=var(51)<1
	trigger1=statetype!=a && (ctrl || var(41))

; hadou
; g
[state 0]
	type=changestate
	value=1000
	triggerall=command="sp1" || command="sp1_s"
	triggerall=var(51)<1
	triggerall=!numprojid(91000)
	trigger1=statetype!=a && (ctrl || var(41))



;--------------------
; normal
;--------------------

;--- roll
[state 0]
	type=changestate
	value=ifelse(command="holdback",115,110)
	triggerall=command="recovery"
	triggerall=statetype!=a && ctrl
	triggerall=var(51)<1 && !var(4)
	trigger1=(sysfvar(0)>id) && playeridexist(floor(sysfvar(0)))
	trigger1=(playerid(floor(sysfvar(0))),var(0)=90900) && (playerid(floor(sysfvar(0))),var(22)!=[2,3])
	trigger2=(sysfvar(0)<=0)

;---
; run
[state 0]
	type=changestate
	value=100
	trigger1=command="ff"
	trigger1=var(51)<1
	trigger1=statetype=s && ctrl && stateno!=100
; backstep
[state 0]
	type=changestate
	value=105
	trigger1=command="bb"
	trigger1=var(51)<1
	trigger1=statetype=s && ctrl && stateno!=105

; leap attack
; WvU
[state 0]
	type=changestate
	value=620
	trigger1=stateno=58 && vel y>0

;--------------------
; throw
; 
[state 0]
	type=changestate
	value=800
	triggerall=(command="y" || command="b") && (command="holdfwd" || command="holdback")
	trigger1=statetype=s && ctrl && (stateno!=[100,101])
	trigger1=p2statetype!=a && p2movetype!=h && p2statetype!=l && (p2bodydist x=[-12,12])


;--------------------
; t[LbN
; F+A
[state 0]
	type=changestate
	value=300
	triggerall=command="a" && command!="holddown" && command="holdfwd"
	triggerall=var(51)<1
	trigger1=statetype!=a && ctrl && (stateno!=[300,301])
; t[LbN(LZp)
[state 0]
	type=changestate
	value=301
	triggerall=command="a" && command!="holddown" && command="holdfwd"
	triggerall=var(51)<1
	trigger1=statetype!=a && var(41) && (stateno!=[300,301])

;-----------------
; basic
;-----------------

; 
; taunt
[state 0]
	type=changestate
	value=195
	triggerall=command="start"
	triggerall=var(51)<1
	trigger1=statetype=s && ctrl

;-----------------
; SLP
[state 0]
	type=changestate
	value=200
	triggerall=command="x" && command!="holddown"
	triggerall=var(51)<1
	triggerall=statetype!=a
	trigger1=ctrl
	trigger2=(stateno=200 || stateno=230 || stateno=400 || stateno=430) && (time>4 || movecontact)
; SHP
[state 0]
	type=changestate
	value=220
	triggerall=command="y" && command!="holddown"
	triggerall=var(51)<1
	trigger1=statetype=s && ctrl
; SLK
[state 0]
	type=changestate
	value=230
	triggerall=command="a" && command!="holddown"
	triggerall=var(51)<1
	triggerall=statetype!=a
	trigger1=ctrl
	trigger2=(stateno=200 || stateno=230 || stateno=400 || stateno=430) && (time>4 || movecontact)
; SHK
[state 0]
	type=changestate
	value=250
	triggerall=command="b" && command!="holddown"
	triggerall=var(51)<1
	trigger1=statetype=s && ctrl

;--------------------
; CLP
[state 0]
	type=changestate
	value=400
	triggerall=command="x" && command="holddown"
	triggerall=var(51)<1
	triggerall=statetype!=a
	trigger1=ctrl
	trigger2=(stateno=200 || stateno=230 || stateno=400 || stateno=430) && (time>4 || movecontact)
; CHP
[state 0]
	type=changestate
	value=420
	triggerall=command="y" && command="holddown"
	triggerall=var(51)<1
	trigger1=statetype=c && ctrl
; CLK
[state 0]
	type=changestate
	value=440
	triggerall=command="a" && command="holddown" && (command="holdfwd" || command="holdback")
	triggerall=var(51)<1
	triggerall=statetype!=a
	trigger1=ctrl
	trigger2=(stateno=200 || stateno=230 || stateno=400 || stateno=430) && (time>4 || movecontact)
; CMK
[state 0]
	type=changestate
	value=430
	triggerall=command="a" && command="holddown"
	triggerall=var(51)<1
	triggerall=statetype!=a
	trigger1=ctrl
	trigger2=(stateno=200 || stateno=230 || stateno=400 || stateno=430) && (time>4 || movecontact)
; CHK
[state 0]
	type=changestate
	value=450
	triggerall=command="b" && command="holddown"
	triggerall=var(51)<1
	trigger1=statetype=c && ctrl

;--------------------
; JLP
[state 0]
	type=changestate
	value=600
	triggerall=command="x"
	triggerall=var(51)<1
	trigger1=statetype=a && ctrl
; JHP
[state 0]
	type=changestate
	value=620
	triggerall=command="y"
	triggerall=var(51)<1
	trigger1=statetype=a && ctrl
; JLK
[state 0]
	type=changestate
	value=630
	triggerall=command="a"
	triggerall=var(51)<1
	trigger1=statetype=a && ctrl
; JHK
[state 0]
	type=changestate
	value=650
	triggerall=command="b"
	triggerall=var(51)<1
	trigger1=statetype=a && ctrl

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








;--------------------
; [ai]
;--------------------


;-------------------
; ߋE p200, k230 /  p220 k250
[state 0] ; stand attack***
	type=changestate
	value=ifelse(random<200, ifelse(random<500,200,230), ifelse(random<500,220,250))
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && p2statetype!=l && ctrl
	trigger1=sysfvar(0)>0 && playeridexist(floor(sysfvar(0)))
	trigger1=(playerid(floor(sysfvar(0))),var(0)=90900) && playerid(floor(sysfvar(0))),var(18)%10=1
	trigger2=(p2bodydist x=[-38,38]) && random<560 && (gametime%200>100)
	trigger3=( (stateno=52&&animtime=0&&(prevstateno=[600,699])) || (stateno=1402&&animtime=0) ) && (p2bodydist x=[-42,42]) && random<700

; Ek 250
[state 0] ; stand attack***
	type=changestate
	value=250
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && p2statetype!=l && ctrl
	trigger1=(p2bodydist x=[38,65]) && p2statetype=s && random<250 && (gametime%600<200)

; Ep 400 k 430 / p 420 / k 450
[state 0] ; crouching attack
	type=changestate
	value=ifelse(random<500, ifelse(random<600,430,400), ifelse(random<500,420,450) )
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && p2statetype!=l && ctrl && numenemy
	trigger1=sysfvar(0)>0 && playeridexist(floor(sysfvar(0)))
	trigger1=(playerid(floor(sysfvar(0))),var(0)=90900) && (playerid(floor(sysfvar(0))),var(18)/10)%10=1
	trigger2=(p2bodydist x=[-32,42]) && (p2movetype!=a) && (p2statetype=s) && random<180
	trigger3=(stateno=[100,101]) && (p2bodydist x=[-26,26]) && (p2bodydist y=[-36,36]) && (enemynear,numprojid(91000)=0) && (p2statetype!=a) && random<220
	trigger4=(prevstateno=52) && (p2bodydist x=[-42,42]) && (p2bodydist y=[-36,36]) && random<200

; Ep 400
[state 0]
	type=changestate
	value=400
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && (p2bodydist x=[-32,32]) && (p2bodydist y=[-36,36]) && p2statetype!=l
	trigger1=(stateno=200 || stateno=230 || stateno=400) && (time>4 || movecontact) && random<(stateno/2)
; Ek 430
[state 0]
	type=changestate
	value=430
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && (p2bodydist x=[-32,38]) && (p2bodydist y=[-30,30]) && p2statetype!=l
	trigger1=(stateno=200 || stateno=230 || stateno=400 || stateno=430) && (time>4 || movecontact) && random<(stateno/2)

; Ep
[state 0]
	type=changestate
	value=420
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && p2statetype!=l && numenemy
	;;--- ΋
	trigger1=ctrl && sysfvar(0)>0 && playeridexist(floor(sysfvar(0)))
	trigger1=(playerid(floor(sysfvar(0))),var(0)=90900) && (playerid(floor(sysfvar(0))),var(18)/1000)%10=1
	trigger1=p2statetype=a && (p2bodydist x=[0,30]) && (p2bodydist y>=-80) && random<500
	trigger2=stateno=52 && (animtime=0) && (prevstateno=[600,699]) && (p2bodydist x=[0,32]) && random<500

; Ek 440
[state 0] ; crouching attack
	type=changestate
	value=440
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && p2statetype!=l && ctrl && numenemy && (gametime%850=[350,650])
	trigger1=(p2bodydist x=[35,75]) && p2statetype!=a && random<150
	trigger2=(prevstateno=1000) && (p2bodydist x=[35,75]) && random<220

; Ek
[state 0]
	type=changestate
	value=450
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && p2statetype!=l && ctrl && numenemy
	trigger1=(p2bodydist x=[5,60]) && p2movetype!=a && p2statetype=s && random<125

;---
; 󒆍U :: p600 p620 k630 k650
[state 0] ; jump attack
	type=changestate
	value=ifelse(random<350, ifelse(random<500,600,630), ifelse(random<350,620,650) )
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype=a && ctrl
	trigger1=sysfvar(0)>0 && playeridexist(floor(sysfvar(0)))
	trigger1=(playerid(floor(sysfvar(0))),var(0)=90900) && (playerid(floor(sysfvar(0))),var(18)/100)%10=1
	trigger2=(pos y>-65) && (vel y>0) && (p2bodydist x=[-35,85]) && random<800

;--------------------
; AU ::t[LbN (LZ) 301
[state 0]
	type=changestate
	value=301
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && movecontact && (stateno!=[300,301]) && statetype!=a && p2statetype!=l && p2statetype!=a
	trigger1=(stateno=220 || stateno=250 || stateno=420) && var(41) && (p2bodydist x=[-50,50]) && random<420
	trigger2=var(41) && (p2bodydist x=[30,45]) && random<10

;-------------------
; Far_Retrain ; 
[state 0]
	type=changestate
	value=ifelse(random<450,400,200) +(random<500)*30
	trigger1=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && ctrl && (sysfvar(0)>0) && playeridexist(floor(sysfvar(0)))
	trigger1=(playerid(floor(sysfvar(0))),var(0)=90900) && (playerid(floor(sysfvar(0))),var(18)%10=2)


;--------------------
; ΋}
[state 0] ; ΋ - 
	type=changestate
	value=1100
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && p2statetype!=l && numenemy
	trigger1=ctrl && sysfvar(0)>0 && playeridexist(floor(sysfvar(0)))
	trigger1=(playerid(floor(sysfvar(0))),var(0)=90900) && (playerid(floor(sysfvar(0))),var(18)/1000)%10=1
	trigger2=ctrl && p2movetype=a && (p2bodydist x<32) && random<420
	trigger3=ctrl && p2statetype=a && (p2bodydist x=[0,30]) && (p2bodydist y=[-80,0]) && random<500
	trigger4=(stateno=8200) && (animtime=0) && movehit && random<500
	trigger5=(stateno=0 && ctrl) && (prevstateno=5121) && p2movetype=a && (p2bodydist x=[0,38]) && random<110
	trigger6=(stateno=301) && movehit && (p2bodydist x=[0,36]) && random<200
	trigger7=(stateno=220 || stateno=250 || stateno=420) && var(41) && movehit && (p2bodydist x=[0,36]) && random<100

; ѓi~TCjU
[state 0]
	type=changestate
	value=1000
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && numenemy && !numprojid(91000) && (gametime%600>300)
	trigger1=p2statetype!=a && ctrl && (((p2bodydist x>150) && random<234) || ((p2bodydist x>200) && random<456))
	trigger2=var(41) && (movecontact) && random<ifelse(moveguarded,165,77)
	trigger3=(stateno=301 || stateno=420) && (movecontact) && random<500 && ((gametime%225<125) || life<250)
	trigger4=(stateno=440) && (movecontact) && random<500

; 痎Ƃ
[state 0]
	type=changestate
	value=1300
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && numenemy && random<500
	trigger1=( stateno=220 || stateno=250 ) && var(41) && random<100
	trigger2=(stateno=301) && (p2bodydist x=[0,36]) && movecontact && random<ifelse(moveguarded, 500, 100)
	trigger3=ctrl && (p2bodydist x=[0,50]) && p2movetype=i && random<60

; r / tr
[state 0]
	type=changestate
	value=1200
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && p2statetype!=c && numenemy && random<500
	trigger1=( stateno=220 || stateno=250 ) && var(41) && random<250
	trigger2=(stateno=301) && movecontact
	trigger3=ctrl && (p2bodydist x=[50,90]) && p2movetype=i && random<60

; 󒆗r / tr
[state 0]
	type=changestate
	value=1250
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype=a && p2statetype!=l && random<500 && (gametime%400=[100,300])
	trigger1=ctrl && (pos y<-55 || vel y>0) && random<100

;  / ؋r
[state 0]
	type=changestate
	value=1400
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype=a && p2statetype!=l && random<500 && (gametime%400>300)
	trigger1=ctrl && (pos y<-45 || vel y>=0) && (p2bodydist x=[-20,86]) && random<150

;--------------------
; EU
; ΋} ::  t
[state 0]
	type=changestate
	value=3100
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && power>=1000 && statetype!=a && p2statetype!=a && numenemy
	trigger1=var(41) && (p2bodydist x<28) && (enemynear,backedgebodydist<8) && random<50 && life<300
	trigger2=ctrl && p2statetype=a && (p2bodydist y=[-36,36]) && (p2bodydist x=[-28,28]) && random<100
	trigger3=(stateno=8200) && (animtime=0) && movehit && (p2bodydist x=[-32,32]) && random<250

;  / t
[state 0]
	type=changestate
	value=ifelse(random<330,3100,3200)
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && power>=1000 && statetype!=a && numenemy
	trigger1=var(41) && movehit && random<20
	trigger2=p2statetype=a && ctrl && (p2bodydist x=[0,32]) && (p2bodydist y=[-30,0]) && random<150
	trigger3=stateno=301 && movehit && random<150
	trigger4=(stateno=8200) && (animtime=0) && movehit && random<150

; vr (max2)
[state 0]
	type=changestate
	value=3400
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && power>=2000 && statetype!=a && numenemy
	trigger1=ctrl && (p2stateno=190116) ;;dizzy
	trigger2=ctrl && (p2bodydist x<75) && movetype!=a && (enemy,numprojid(91000)) && random<50
	trigger3=(stateno=301) && movecontact && random<ifelse(moveguarded, 20, 50)
	trigger4=(stateno=8200) && (animtime=0) && movehit && random<20

;--------------------
; h
; 
[state 0]
	type=changestate
	value=800
	triggerall=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && ctrl && (stateno!=[100,101]) && numenemy
	trigger1=p2statetype!=a && p2movetype!=h && p2statetype!=l && (p2bodydist x=[-12,12])
	trigger1=random<(matchno+roundno+1)*88 && random<var(51)*98 ;*ntv

; i
[state 0]
	type=changestate
	value=300
	trigger1=var(51)>0 && sysfvar(4)<1 && roundstate=2 && statetype!=a && ctrl && numenemy
	trigger1=(p2bodydist x<30) && p2statetype=c && p2movetype!=a && random<100 && random>life*2

; 
[state 0]
	type=changestate
	value=195
	trigger1=var(51)>0 && sysfvar(4)<1 && roundstate=2 && (gametime%300<100) && numenemy
	trigger1=statetype!=a && ctrl && p2movetype!=a && (p2bodydist x>150) && random<25


;---------------
;---------------
;=========
; AI switch
[state 0]
	type=varset
	trigger1=(sysfvar(0)>0) && playeridexist(floor(sysfvar(0)))
	trigger1=playerid(floor(sysfvar(0))),stateno=90900 && var(51)!=playerid(floor(sysfvar(0))),var(51)
	var(51)=playerid(floor(sysfvar(0))),var(51)

;=========
;[EOF]
