;var(20) = zero counter strength set
;var(36) = gethits enshake time


[Data]
life = 900
attack = 100
defence = 100
fall.defence_up = 50
liedown.time = 30
airjuggle = 15
sparkno = 2
guard.sparkno = 40
KO.echo = 0
volume = 200
IntPersistIndex =
FloatPersistIndex =

[Size]
xscale = .50 : (Real) skala szerokoci postaci, 1 = 100%, 0.5 = 50%.
yscale = .50 : (Real) skala wysokoci postaci.
ground.back = 15 : (Integer) szerokoć postaci w tył (od rodka osi wewnętrznych) na ziemi.
ground.front = 16 : (Integer) szerokoć w przód na ziemi.
air.back = 12 : (Integer) szerokoć w tył w powietrzu.
air.front = 12 : (Integer) szerokoć w przód w powietrzu.
height = 90 : (Integer) wysokoć postaci.
attack.dist = 160 : (Integer) standardowy dystans ataku postaci, przeciwnik w tej odległoi zaczyna blokować.
proj.attack.dist = 90 : (Integer) standardowy dystans ataku dodatkowych obiektów.
proj.doscale = 0 : (0/1) skalowanie dodatkowych obiektów, poza grafikš samej postaci: 1 = tak, 0 = nie.
head.pos = -5, -90 : (Integer) pozycja głowy (x, y).
mid.pos = -5, -60 : (Integer) pozycja tułowia (x, y).
shadowoffset = 0 : (Integer) przesunięcie w pikselach na osi Y cienia postaci.
draw.offset = 0,0 : (Integer) dodatkowe przesunięcie postaci w pikselach (x, y) względem rodka osi wewnętrznych.

[Velocity]
walk.fwd  = 3
walk.back = -2.4
run.fwd  = 6.8, -2
run.back = -7,-2
runjump.back = -2.55,-8.1
jump.neu = 0,-9.625
jump.back = -3.9
jump.fwd = 3.9
airjump.fwd = 2.5

[Movement]
airjump.num = 0
airjump.height = 35
yaccel = .5
stand.friction = .85
crouch.friction = .82
;---------------------------------------------------------------------------
; Format:
; [Statedef STATENO]
; type = ?      S/C/A/L  stand/crouch/air/liedown
; movetype = ?  I/A/H    idle/attack/gethit
; physics = ?   S/C/A/N  stand/crouch/air/none
; juggle = ?             air juggle points move requires
;
; [State STATENO, ?]     ? - any number you choose
; type = ?
; ...

;---------------------------------------------------------------------------
; Lose by Time Over
; CNS difficulty: basic
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

[State 170, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
;---------------------------------------------------------------------------
; Win state decider
[Statedef 180]
type = S

[State 180, 1]
type = ChangeState
trigger1 = Time = 0
value = 181

;---------------------------------------------------------------------------
; Win pose 1 - Bow
[Statedef 181]
type = S
ctrl = 0
anim = 181
velset = 0,0

[State 181, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
;---------------------------------------------------------------------------
; intro decider
[Statedef 190]
type = S
anim = 9741

[State 180, 1]
type = ChangeState
trigger1 = Time = 0
value = 191+(random%2)

;------------------------------------------------------------------------
; Introduction
[Statedef 191: intro]
type = S
ctrl = 0
anim = 193;9741;193
velset = 0,0
sprpriority = -2

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 =  1
flag =  nobardisplay

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 100
value = S3000,10
volume = 0
channel = -1

[State 191, 1] ;Freeze animation until PreIntro is over
type = ChangeAnim
trigger1 = RoundState = 0
value = 193

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = time <=100
flag = nobg
flag2 = nofg

[State 0, Explod]
type = Explod
trigger1 = animelem = 3
anim = 194
ID = 194
pos = -1,-68
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = 200
supermove
pausemove
scale = .68,.62
sprpriority = 0
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 0

[State 0, Explod]
type = Explod
trigger1 = time = 75
anim = 197
ID = 197
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
supermove = 9999
pausemove = 9999
scale = 1,1
sprpriority = 3
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 1
ignorehitpause = 1
persistent =  0

[State 0, Explod]
type = Explod
trigger1 = time = 80
anim = 196
ID = 196
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = 140
supermove
pausemove
scale = 1,1
sprpriority = 0
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 0

[State 0, EnvColor]
type = BGPalFX
trigger1 = time = [100,230]
mul = 1+((time-100)),1+((time-100)),1+((time-100))
time = 2
invertall = 0
ignorehitpause = 1

[State 0, EnvColor]
type = PalFX
trigger1 = time <100;[100,230]
mul = 0,0,0
time = 2
invertall = 0
ignorehitpause = 1

[State 0, EnvColor]
type = PalFX
trigger1 = time = [100,230]
mul = 1+((time-100)*2),1+((time-100)*2),1+((time-100)*2)
time = 2
invertall = 0
ignorehitpause = 1

[State 191, 2] ;Assert this until you want "round 1, fight" to begin
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 191, 3] ;Change to stand state when done
type = ChangeState
trigger1 = AnimTime = 0
value = 0
;---------------------------------------------------------------------------
[Statedef 192]
type = S
ctrl = 0
anim = 1996
velset = 0,0

[State 190, 2]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 0, Explod]
type = Explod
trigger1 = time = 0
anim = 1997
ID = 1996
pos = -18,-3
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
supermove
pausemove
scale = 1,1
sprpriority = 5
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 1

[State 191, Cloth]
type = Helper
;trigger1 = random%2=1
trigger1 = Time = 1
ID = 7950
stateno = 7950
postype = p1
pos = 0,2
ownpal = 1
name = "afterimage_intro"
size.xscale = 1
size.yscale = 1.05

[State 191, Cloth]
type = Helper
trigger1 = numhelper(7950)
trigger1 = Time = 6
ID = 7951
stateno = 7950
postype = p1
pos = 0,2
ownpal = 1
name = "afterimage_intro"
size.xscale = .9
size.yscale = 1.1

[State 190, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
;ciCgj
[Statedef 7950]
ctrl = 0
anim = root,anim
sprpriority = 2

[State 9000, 1]
type = varadd
trigger1 = 1
var(0) = 1

[State 9000, 1]
type = velset
trigger1 = 1
x = .18*cos(var(0)*0.095)
y = .18*sin(var(0)*0.095)

[State 9000, 1]
type = posadd
trigger1 = time = 0
x = 1

[State 8200, PalFX]
type = PalFX
trigger1 = 1;var(1)
mul = 230,230,230;ceil(152-abs(76*sin(gametime*.05))),ceil(128-abs(64*sin(gametime*.05)))
time = 1

[State 9000, 1]
type = trans
trigger1 = 1
trans = add1
alpha = 128,192

[State 9000, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 1000, ChangeState]
type = ChangeState
trigger1 = animelem = 2
value = 7951

;---------------------------------------------------------------------------
;ciCgjiÁĹj
[Statedef 7951]
ctrl = 0
ownpal = 1
sprpriority = 2

[State 9000, 1]
type = varadd
trigger1 = 1
var(0) = 1

[State 9000, 1]
type = velset
trigger1 = 1
x = .18*cos(var(0)*0.095)
y = .18*sin(var(0)*0.095)

[State 8200, PalFX]
type = PalFX
trigger1 = 1
mul = (256-(time*16))*ifelse(var(1),.8984375,1),(256-(time*16))*ifelse(var(1),ceil(152-abs(76*sin(gametime*.05)))*.00390265,1),(256-(time*16))*ifelse(var(1),ceil(128-abs(64*sin(gametime*.05)))*.00390265,1)
time = 1

[State 9000, 1]
type = trans
trigger1 = 1
trans = add1
alpha = 64,256

[State 9000, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 8200, Destroy]
type = DestroySelf
trigger1 = time = 16
;---------------------------------------
;intro3
[Statedef 193]
type = S
ctrl = 0
anim = 1998
velset = 0,0

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

[State 0, Explod]
type = Explod
trigger1 = time = 80
anim = 3491
ID = 7003
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
supermove
pausemove
scale = 1,1
sprpriority = 0
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 1
;ignorehitpause =
;persistent =


[State 191, 2] ;Assert this until you want "round 1, fight" to begin
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 191, 3] ;Change to stand state when done
type = ChangeState
trigger1 = AnimTime = 0
value = 0
;---------------------------------------------------------------------------
; Taunt
[Statedef 195]
type = S
ctrl = 0
anim = 195
velset = 0,0
movetype = I
physics = S
sprpriority = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = animelem = 1
value = S180,4
volume = 0
channel = -1

[State 195, 1]
type = CtrlSet
trigger1 = Time = 40
value = 1

[State 195, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;==========<ZERO COUNTER>==========
[Statedef 750]
type=S
physics=S
movetype=I
anim=750
ctrl=0
velset=0,0
poweradd=-500
sprpriority=2

[State 750, strengthvar]
type=varset
trigger1=!time&&var(59)<=0
var(10)=ifelse((command="bdx"||command="bdy"||command="bdz"),1,2)
ignorehitpause=1

[State 750, snd]
type=playsnd
trigger1=time = 0
value=1100,2
channel=2
freqmul = 2.0

[State 750, superpause]
type=superpause
trigger1=!time
time=20
movetime=20
anim=-1
sound=s3000,0
p2defmul=1
darken=0

[State 3000, carga]
type=helper
trigger1=time = 0
helpertype=normal
stateno=9750
ID=9750
name="fx"
postype=p1
pos = 35,-70
ownpal=1
persistent=0
supermovetime=9999
size.xscale = .35
size.yscale = .35

[State 750, end]
type=changestate
trigger1=time>=20
value=ifelse(var(10)=1,1101,450)
;-----------------------------------------------
;roll forward
[Statedef 900: roll]
type = C
movetype = I
physics = N
anim = 900
velset = 0
ctrl = 0
sprpriority = -1

[State 800, 1]
type = NotHitBy
trigger1 = Time
value = SCA

[State 800, 1]
type = PlayerPush
trigger1 = Time = [1,14]
value = 0

[state 2100]
type = AfterImage
trigger1 = Time = 2
time = 2
timegap = 1
framegap = 4
trans = add1
length = 10
paladd = 0,0,0
palmul = .9,.9,.9
palcontrast = 120,120,120
palpostbright = 0,0,0

[State 2000]
type = AfterImageTime
trigger1 = Time > 2
time = 2

[State 800, 1]
type = posset
trigger1 = 1
y = 0

[State 800, 1]
type = velset
trigger1 = Time > 1 && Time < 14
x = 6.5

[State 800, 1]
type = velset
trigger1 = time = 15
x = 0

[State 800, 2]
type = ChangeState
trigger1 = AnimTime = 0
trigger2 = p2dist X <= 0
trigger2 = animelem >= 9
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; roll back
[Statedef 901]
type = S
movetype = I
physics = N
anim = 901
velset = 0,0
ctrl = 0
sprpriority = -1

[State 800, 1]
type = posset
trigger1 = pos Y != 0
y = 0

[State 800, 1]
type = NotHitBy
trigger1 = Time
value = SCA

[State 800, 1]
type = PlayerPush
trigger1 = Time = [1,25]
value = 0

[state 2100]
type = AfterImage
trigger1 = Time = 2
time = 2
timegap = 1
framegap = 4
trans = add1
length = 10
paladd = 0,0,0
palmul = .9,.9,.9
palcontrast = 120,120,120
palpostbright = 0,0,0

[State 2000]
type = AfterImageTime
trigger1 = Time > 2
time = 2

[State 800, 1]
type = velset
trigger1 = Time > 1 && Time < 14
x = -6.5

[State 800, 1]
type = velset
trigger1 = time = 15
x = 0

[State 800, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; roll recovery fwd
[Statedef 905]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= I				;Move-type: A-attack, I-idle, H-gethit
physics = N				;Physics: S-stand, C-crouch, A-air
juggle  = 0				;Number of air juggle points move takes
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 905				;Change animation (Def: no change)
poweradd = 0			;Power to add (Def: 0)
sprpriority = 1			;Set layering priority to 2 (in front)

[State 5221, flash]
type=palfx
trigger1=!time
add=0,50,255
sinadd=0,-50,-255,60
time=15

[State 0, PlaySnd]
type = PlaySnd
trigger1 = animelem = 1
value = S100,4
volume = 0
channel = -1

[State 0, PlayerPush]
type = PlayerPush
trigger1 = 1
value = 0

[State 0, VelSet]
type = VelSet
trigger1 = animelem = 1
x =7
y = 0
;ignorehitpause =
;persistent =

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 =animelem = 16
statetype = S      ;S,A,C,L
movetype = I        ;I,A,H
physics = S         ;A,C,S,N
;ignorehitpause =
;persistent =

[State 5221, nhb]
type=nothitby
trigger1=animelemtime(15)<0
value=SCA
time=1

[State 5221, push]
type=playerpush
trigger1=animelemtime(15)<0
value=0

[State 5700, VarSet]
type = VarSet
trigger1 = Time = 0
var(22) = 0

[State 200, 5]
type = ChangeState
trigger1 = AnimTime = 0
;trigger2 = FrontEdgeBodyDist <= 10
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; roll recovery back
[Statedef 906]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= I				;Move-type: A-attack, I-idle, H-gethit
physics = N				;Physics: S-stand, C-crouch, A-air
juggle  = 0				;Number of air juggle points move takes
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 905				;Change animation (Def: no change)
poweradd = 0			;Power to add (Def: 0)
sprpriority = 1			;Set layering priority to 2 (in front)

[State 0, Turn]
type = Turn
trigger1 = time = 0
;ignorehitpause =
;persistent =

[State 5221, flash]
type=palfx
trigger1=!time
add=0,50,255
sinadd=0,-50,-255,60
time=15

[State 0, PlaySnd]
type = PlaySnd
trigger1 = animelem = 1
value = S100,4
volume = 0
channel = -1

[State 0, PlayerPush]
type = PlayerPush
trigger1 = 1
value = 0

[State 0, VelSet]
type = VelSet
trigger1 = animelem = 1
x =6
y = 0
;ignorehitpause =
;persistent =

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 =animelem = 16
statetype = S      ;S,A,C,L
movetype = I        ;I,A,H
physics = S         ;A,C,S,N
;ignorehitpause =
;persistent =

[State 5221, nhb]
type=nothitby
trigger1=animelemtime(15)<0
value=SCA
time=1

[State 5221, push]
type=playerpush
trigger1=animelemtime(15)<0
value=0

[State 5700, VarSet]
type = VarSet
trigger1 = Time = 0
var(22) = 0

[State 200, 5]
type = ChangeState
trigger1 = AnimTime = 0
;trigger2 = backEdgeBodyDist <= 10
value = 0
ctrl = 1
;==================================================================================
;======| RELACIONADO Ŕ AI - AI RELATED |===========================================
;==================================================================================

; (Credit to ANMC, Bagaliao, and FlowaGirl for the basic helper method concept.)
;
;------------------
; AI Activation Helper State - Primary Version
; (Credit to YongMing for the basic HitPause bugfix concept.)
;
; var(1) - First tick button activation prevention.
; var(2) - Used for pause/superpause and custom state check, basically.
; var(3) - (Super/)Pause & custom state-triggered dir detection disabler.
; var(4) - Persistent direction command detection enabler (due to 2002.04.14).
; var(9) - AutoTurn bug fixer.
; parent's var(57) - Parent's GameTime var, for pause and custom state check.
; parent's var(59) - Parent's primary AI variable.
;
; The code in this state is mostly simply copy/pasteable.
; But if you're using different indices for the parent's variables,
; or if you change your character's basic commands' names, you'll
; of course need to change the code in this state accordingly.

[StateDef 9741]
type = S
movetype = I
physics = N
anim = 9741
ctrl = 0

[State 9741, Safety]; Just in case your opponent is very poorly coded.
type = SelfState
trigger1 = !IsHelper
value = 0

[State 9741, PauseCheck]
type = VarSet
trigger1 = (GameTime>(Parent,var(57)))
trigger2 = !(Parent,Alive)
trigger3 = (RoundState != 2)
trigger4 = Parent,var(59)
trigger5 = (var(3):=0)
var(2) = (var(3):=1)+(var(4):=0)

[State 9741, Facing]
type = Turn
trigger1 = (var(9):=(Facing != Parent,Facing))

[State 9741, DirTurnOnAI]
type = ParentVarSet
triggerall = !var(3)
triggerall = !var(9)
trigger1 = (Parent,command = "holdfwd")
trigger2 = (Parent,command = "holdback")
trigger3 = (Parent,command = "holdup")
trigger4 = (Parent,command = "holddown")
trigger5 = !(var(4):=1)
var(59) = var(4)

[State 9741, DirTurnOffAI]
type = ParentVarSet
triggerall = !var(3)
triggerall = Parent,var(59)
trigger1 = (command = "holdfwd")
trigger1 = (Parent,command = "holdfwd")
trigger2 = (command = "holdback")
trigger2 = (Parent,command = "holdback")
trigger3 = (command = "holdup")
trigger3 = (Parent,command = "holdup")
trigger4 = (command = "holddown")
trigger4 = (Parent,command = "holddown")
var(59) = (var(4):=0)

[State 9741, ButtonTurnOnAI]
type = ParentVarSet
triggerall = var(1)
triggerall = !var(2)
trigger1 = (Parent,command = "a")
trigger2 = (Parent,command = "b")
trigger3 = (Parent,command = "c")
trigger4 = (Parent,command = "x")
trigger5 = (Parent,command = "y")
trigger6 = (Parent,command = "z")
trigger7 = (Parent,command = "start")
var(59) = 1

[State 9741, ButtonTurnOffAI]
type = ParentVarSet
triggerall = !var(2)
trigger1 = (command = "a")
trigger1 = (Parent,command = "a")
trigger2 = (command = "b")
trigger2 = (Parent,command = "b")
trigger3 = (command = "c")
trigger3 = (Parent,command = "c")
trigger4 = (command = "x")
trigger4 = (Parent,command = "x")
trigger5 = (command = "y")
trigger5 = (Parent,command = "y")
trigger6 = (command = "z")
trigger6 = (Parent,command = "z")
trigger7 = (command = "start")
trigger7 = (Parent,command = "start")
var(59) = -1

[State 9741, UnPauseCheck]
type = VarSet
triggerall = var(2)
trigger1 = (Parent,command = "a")
trigger2 = (Parent,command = "b")
trigger3 = (Parent,command = "c")
trigger4 = (Parent,command = "x")
trigger5 = (Parent,command = "y")
trigger6 = (Parent,command = "z")
trigger7 = (Parent,command = "start")
trigger8 = (var(2) = 2)
trigger8 = (var(2):=0)
var(2) = 2

[State 9741, Goodbye]
type = DestroySelf
triggerall = (var(1):=1)
trigger1 = Parent,var(59)
trigger2 = !(Parent,Alive)
trigger3 = (RoundState != 2)


;------------------
; AI Activation Helper State - Compatibly Partnered Version
;
; var(1) - First tick dir activation prevention
; var(2) - Used for pause/superpause and custom state check, basically.
; var(3) - (Super/)Pause & custom state-triggered dir detection disabler.
; var(4) - Hitpause check.
; var(5) - No button on previous tick.
; var(6) - Any dir on this tick.
; var(7) - Any button on this tick.
; var(8) - Matching partner button detected.
; var(9) - AutoTurn bug fixer.
; parent's var(57) - Parent's GameTime var, for pause and custom state check.
; parent's var(59) - Parent's primary AI variable.
;
; The code in this state is mostly simply copy/pasteable.
; But if you're using different indices for the parent's variables,
; or if you change your character's basic commands' names, you'll
; of course need to change the code in this state accordingly.

[StateDef 9742]
type = S
movetype = I
physics = N
anim = 9741
ctrl = 0

[State 9742, Safety]; Just in case your opponent is very poorly coded.
type = SelfState
trigger1 = !IsHelper
value = 0

[State 9742, PauseCheck]
type = VarSet
trigger1 = (GameTime>Parent,var(57))
trigger2 = !(Parent,Alive)
trigger3 = (RoundState != 2)
trigger4 = Parent,var(59)
trigger5 = (var(3):=0)
var(2) = (var(3):=1)

[State 9742, Facing]
type = Turn
trigger1 = (var(9):=(Facing != Parent,Facing))

[State 9742, ParentDirCheck]
type = VarSet
trigger1 = (Parent,command = "holdfwd")
trigger2 = (Parent,command = "holdback")
trigger3 = (Parent,command = "holdup")
trigger4 = (Parent,command = "holddown")
trigger5 = (var(6):=0)
var(6) = 1

[State 9742, ParentButtonCheck]
type = VarSet
trigger1 = (Parent,command = "a")
trigger2 = (Parent,command = "b")
trigger3 = (Parent,command = "c")
trigger4 = (Parent,command = "x")
trigger5 = (Parent,command = "y")
trigger6 = (Parent,command = "z")
trigger7 = (Parent,command = "start")
trigger8 = (var(7):=0)
var(7) = 1

[State 9742, SameButtonCheck]
type = VarSet
triggerall = var(7)
triggerall = !var(2)
triggerall = NumPartner
trigger1 = (Parent,command = "a")
trigger1 = (Partner,command = "a")
trigger2 = (Parent,command = "b")
trigger2 = (Partner,command = "b")
trigger3 = (Parent,command = "c")
trigger3 = (Partner,command = "c")
trigger4 = (Parent,command = "x")
trigger4 = (Partner,command = "x")
trigger5 = (Parent,command = "y")
trigger5 = (Partner,command = "y")
trigger6 = (Parent,command = "z")
trigger6 = (Partner,command = "z")
trigger7 = (Parent,command = "start")
trigger7 = (Partner,command = "start")
trigger8 = (var(8):=0)
var(8) = 1

[State 9742, DirTurnOnAI]
type = ParentVarSet
trigger1 = var(1)
trigger1 = var(6)
trigger1 = !var(3)
trigger1 = !var(4)
trigger1 = !var(9)
var(59) = 1

[State 9742, DirTurnOffAI]
type = ParentVarSet
triggerall = var(6)
triggerall = !var(3)
triggerall = Parent,var(59)
trigger1 = (command = "holdfwd")
trigger1 = (Parent,command = "holdfwd")
trigger2 = (command = "holdback")
trigger2 = (Parent,command = "holdback")
trigger3 = (command = "holdup")
trigger3 = (Parent,command = "holdup")
trigger4 = (command = "holddown")
trigger4 = (Parent,command = "holddown")
var(59) = 0

[State 9742, ButtonTurnOnAI]
type = ParentVarSet
trigger1 = var(5)
trigger1 = var(7)
trigger1 = !var(2)
trigger1 = !var(8)
var(59) = 1

[State 9742, ButtonTurnOffAI]
type = ParentVarSet
triggerall = var(7)
triggerall = !var(2)
triggerall = !var(8)
trigger1 = (command = "a")
trigger1 = (Parent,command = "a")
trigger2 = (command = "b")
trigger2 = (Parent,command = "b")
trigger3 = (command = "c")
trigger3 = (Parent,command = "c")
trigger4 = (command = "x")
trigger4 = (Parent,command = "x")
trigger5 = (command = "y")
trigger5 = (Parent,command = "y")
trigger6 = (command = "z")
trigger6 = (Parent,command = "z")
trigger7 = (command = "start")
trigger7 = (Parent,command = "start")
var(59) = -1

[State 9742, UnPauseCheck]
type = VarSet
triggerall = var(2)
triggerall = !var(4)
trigger1 = var(7)
trigger2 = (var(2) = 2)
trigger2 = (var(2):=0)
var(2) = 2

[State 9742, Goodbye]
type = DestroySelf
trigger1 = Parent,var(59)
trigger2 = !(Parent,Alive)
trigger3 = (RoundState != 2)

[State 9742, HitPauseCheck]
type = VarSet
trigger1 = var(6)
trigger2 = var(7)
trigger3 = !(Parent,HitPauseTime)
var(4) = Parent,HitPauseTime

[State 9742, Delay]
type = VarSet
trigger1 = (var(1):=1)
var(5) = !var(7)


;------------------
; XOR Method's HitPauseTime Helper State

[StateDef 9743]
type = S
movetype = I
physics = N
anim = 9741
ctrl = 0

[State 9743, Safety]; Just in case your opponent is very poorly coded.
type = SelfState
trigger1 = !IsHelper
value = 0

[State 9743, HitPauseTime]
type = VarSet
trigger1 = !(Parent,HitPauseTime)
trigger2 = (GameTime>Parent,var(57))
var(1) = Parent,HitPauseTime

[State 9742, Goodbye]
type = DestroySelf
trigger1 = (Parent,var(59) = 1)
trigger2 = !(Parent,Alive)
trigger3 = (RoundState != 2)

;==================================================================================
;==================================================================================
;==================================================================================

;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------

;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------
[StateDef -2]

;==================================================================================
;======| RELACIONADO Ŕ AI - AI RELATED |===========================================
;==================================================================================

; Within StateDef -2, none of your own AI-related code should be placed
; above these next two controllers.

[State -2, StopAI]
type = VarSet
triggerall = (var(59) > 0)
trigger1 = (RoundState != 2)
trigger2 = !Alive
var(59) = -2
IgnoreHitPause = 1

; This controller is optional.  It allows you treat the AI flag as a boolean
; value rather than an integer value, letting you trigger your AI directives
; with "var(0)" instead of "var(59)>0", and letting you make moves usable only
; by humans by using "!var(0)" instead of "var(59)<1", thus slightly improving
; the size and efficiency of your code.
; Another benefit is that it makes it much easier for users to disable your AI,
; if they so choose.
[State -2, Simplifier]
type = VarSet
trigger1 = (var(59) = 1)
trigger2 = (var(0):=0)
var(0) = 1	; Another option is to replace 1 with something like MatchNo, if
		; you want to design your AI to have varying levels of difficulty.
IgnoreHitPause = 1
;--------------------------------------------------------------
[State -2, HitPause]
type=varset
trigger1= movecontact!=1
var(46)=gametime+2

[State -2, HitSparks]
type=helper
trigger1= var(46)=gametime
trigger1= movehit=1 && numenemy
trigger1= var(40)=8010 || var(40)=8015 || var(40)=8020 || var(40)=8025 || var(40)=8030
trigger1 = stateno !=3302
trigger1 = stateno !=[1700,1703]
helpertype=normal
stateno=var(40)
ID=8000
name="Spark"
postype=p2
pos= (enemynear,const(size.ground.front) + var(42)) * (enemynear,facing) * (-facing), floor(pos y-enemynear,pos y) + var(43)
facing= ifelse((enemynear,facing = facing), 1, -1)
ownpal=1
size.xscale=.5
size.yscale=.5
pausemovetime=65535
supermovetime=65535
ignorehitpause=1

[State -2, GuardSparks]
type=helper
trigger1= var(46)=gametime
trigger1= moveguarded=1 && numenemy
trigger1= var(41)=8000 || var(41)=8001
helpertype=normal
stateno=8001;var(31)
ID=8000
name="Spark"
postype=p2
pos= (enemynear,const(size.ground.front) + var(42)) * (enemynear,facing) * (-facing), floor(pos y-enemynear,pos y) + var(43)
facing= ifelse((enemynear,facing = facing), 1, -1)
ownpal=1
size.xscale=1
size.yscale=1
pausemovetime=65535
supermovetime=65535
ignorehitpause=1

[State -2, Reset]
type=varrangeset
trigger1= movetype=I
trigger2= movetype=H && time
;trigger3 = var(40) !=-1
first=40
last=46
value=-1
ignorehitpause=1

[State -2, HitPause]
type=varadd
trigger1= var(46)>0
var(46)=-1
ignorehitpause=1

[State -2, varKOsnd]
type=varset
trigger1=alive&&var(18)>0
trigger2=!alive&&var(18)<2
var(18)=ifelse(alive,0,var(8)+1)
ignorehitpause=1

[State -2, KOsnd]
type=playsnd
trigger1=!alive&&var(18)=1
trigger1=var(18):=2
value=5500,0;ifelse((var(1)=2),2,1)+2*(stateno=5130)
ignorehitpause=1
persistent=0

[State -2, Damage based on hits]
type=varset
trigger1= numenemy
fvar(12)= enemynear,gethitvar(hitcount)
ignorehitpause=1

[State -2, Reset var when the opponent recovers]
type=varset
trigger1= numenemy
trigger1= (enemynear,movetype!=H)
trigger2= !numenemy
;trigger3 = (stateno = [3000,3999]) && (time = 0)
fvar(12)=1

[State -2, Dampener]
type=varset
trigger1=1
trigger1 = stateno != [3000,3999]
fvar(10)= ifelse(fvar(12)=0, 1, ifelse(fvar(12)=1, .9, .8**fvar(12)))
ignorehitpause=1

[State -2, Dampener For Supers]
type=varset
trigger1=1
trigger1 = stateno = [3000,3999]
fvar(10)= ifelse((prevstateno=[1000,1999]),.7,ifelse((prevstateno=[200,699]),.8,1))
ignorehitpause=1

[State -2, Dampener itself]
type=attackmulset
trigger1= 1
value=fvar(10)
ignorehitpause=1

;==================================================================================
;==================================================================================
;==================================================================================
;---------------------------------------------------------------------------
; States that are executed when in self's state file (use statedef -3)
;---------------------------------------------------------------------------

[Statedef -3]

;==================================================================================
;======| RELACIONADO Ŕ AI - AI RELATED |===========================================
;==================================================================================

; Kamek and Luchini appear to have been the first ones to use the IsHomeTeam AI activation concept.
; Feel free to move this controller to your character's intro state for slightly better efficiency.
[State -3, SetAI]
type = VarSet
triggerall = !RoundState
triggerall = IsHomeTeam
trigger1 = (TeamSide = 2)
trigger2 = (MatchNo > 1)
var(59) = 1

; Feel free to move this controller to your character's intro state for slightly better efficiency.
; Note that it may give P2 a slight unfair advantage in simul team vs mode, so you
; may want to disable it.  But then, since when has Mugen been about fairness? =P
[State -3, Unfair]; Is this reliable?
type = VarSet
trigger1 = !RoundState
trigger1 = (var(59) != 1)
trigger1 = NumPartner
trigger1 = (ID > Partner,ID)
trigger1 = (TeamSide = 2)
var(59) = 1

[State -3, AI Helper (Compatibly Partnered Version)]
type = Helper
trigger1 = !var(59)
trigger1 = !NumHelper(9742)
trigger1 = (RoundState = 2)
trigger1 = Alive
trigger1 = NumPartner
trigger1 = Partner,SelfAnimExist(9741)
HelperType = normal
name = "AI Helper (Simul Version)"
ID = 9742
pos = 9999999,99999
StateNo = 9742
KeyCtrl = 1
PauseMoveTime = 999999999
SuperMoveTime = 999999999

; If you want to use the Guard mode, Dummy mode, Distance, or Button jam dummy control
; options in Training mode without activating the dummy's AI while working on your
; character, then all you need to do is temporarily disable this controller.
; Or, if you want to permanently disable this controller in Training mode,
; then you could use the Training mode detection code available on my site
; ( http://www.shinmugen.net/winane/ ), and then just add a "(var(59)&63)>30"
; triggerall to this controller.
[State -3, AI Helper]
type = Helper
triggerall = !var(59)
triggerall = !NumHelper(9741)
triggerall = (RoundState = 2)
triggerall = Alive
trigger1 = !NumPartner
trigger2 = !(Partner,SelfAnimExist(9741))
HelperType = normal
name = "AI Helper"
ID = 9741
pos = 9999999,99999
StateNo = 9741
KeyCtrl = 1
PauseMoveTime = 999999999
SuperMoveTime = 999999999

[State -3, TurnBackOnAI]
type = VarSet
trigger1 = (var(59) = -2)
trigger1 = (RoundState = 2)
trigger1 = Alive
var(59) = 1

[State -3, HitPauseTime Helper]
type = Helper
triggerall = var(59)!=1
triggerall = !NumHelper(9743)
triggerall = (RoundState = 2)
triggerall = Alive
trigger1 = (MatchNo = 1)
trigger2 = NumPartner
trigger2 = (ID > Partner,ID)
HelperType = normal
name = "HitPauseTime"
ID = 9743
pos = 9999999,99999
StateNo = 9743
PauseMoveTime = 999999999
SuperMoveTime = 999999999

; According to Roque, this method works in Linux Mugen version 2002.04.14,
; whereas the old humanly-impossible commands method does not.
; It is very important that this controller NOT be moved to State -2.
; Note that this part won't work if AI.Cheat is turned off in mugen.cfg.
[State -3, XOR]
type = VarSet
triggerall = var(59)!=1
triggerall = (var(57) = GameTime-1)
triggerall = NumHelper(9743)
triggerall = !(Helper(9743),var(1))
trigger1  = command = "CPU1"
trigger2  = command = "CPU2"
trigger3  = command = "CPU3"
trigger4  = command = "CPU4"
trigger5  = command = "CPU5"
trigger6  = command = "CPU6"
trigger7  = command = "CPU7"
trigger8  = command = "CPU8"
trigger9  = command = "CPU9"
trigger10  = command = "CPU10"
trigger11  = command = "CPU11"
trigger12  = command = "CPU12"
trigger13  = command = "CPU13"
trigger14  = command = "CPU14"
trigger15  = command = "CPU15"
;trigger16 = (command = "holdback") ^^ (command = "holdback2")
;trigger17 = (command = "holdup") ^^ (command = "holdup2")
;trigger18 = (command = "holddown") ^^ (command = "holddown2")
;trigger19 = (command = "recovery") ^^ (command = "recovery2")
;Add more as desired. (See my notes in the CMD.)
var(59) = 1

; It is very important that this controller NOT be moved to State -2, as putting
; it there would defeat the entire purpose of the controller, allowing the
; helper method or the XOR method to erroneously set the AI variable.
; And within State -3, don't put any ChangeState controllers before this
; controller, lest you unnecessarily delay your character's AI activation.
[State -3, GameTimeVar]
type = VarSet
trigger1 = 1
var(57) = GameTime
IgnoreHitPause = 1

; Within StateDef -3, none of your own AI-related code should come after the code
; provided here (and putting it before the code is also generally a bad idea).
; It's better to use State -1 (or, in special circumstances, State -2) instead.

;==================================================================================
;==================================================================================
;==================================================================================

[State -3,Slow]
type = Pause
trigger1 = stateno = 3301
trigger1 = (GameTime%1) = 0
trigger1 = roundstate = 2
trigger1 =  Movehit = 1
;trigger2 = stateno = 3501
;trigger2 = (GameTime%1) = 0
;trigger2 = roundstate = 2
;trigger3 = (GameTime%1) = 0
;trigger3 = roundstate = 2
;trigger3 = stateno = 3500
;trigger3 = movehit
;trigger2 =  Movehit = 1
time = 2
movetime = 0
ignorehitpause = 1

[State 0, Helper]
type = Helper
trigger1 = roundstate = 2
trigger1 = !NumHelper(3)
helpertype = normal ;player
name = "aura"
ID = 3
stateno = 3
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 1
pausemovetime =0 ;9999
supermovetime =0 ;9999
size.xscale = .95
size.yscale = 1

[State -3, Turn]
type = Turn
triggerall = P2bodydist x < -60
trigger1 = stateno = 0
trigger2 = stateno = 11
trigger3 = stateno = 52

[State -3, Turn]
type = Turn
triggerall = P2bodydist x < -20
trigger1 = stateno = 52

[State -3, Landing Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 52 ;Jump land
trigger2 = stateno = 106 ;Run-back land
trigger3 = stateno = 1110
trigger4 = stateno = 1210
value = s100,0

[State -3, Landing Anim]
type = Explod
triggerall = Time = 1
trigger1 = stateno = 52 ;Jump land
trigger2 = stateno = 1110
trigger3 = stateno = 1210
anim = 10001
ID = 10001
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
supermove = 9999
pausemove = 9999
scale = .6,.8
sprpriority = -1
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 0
ignorehitpause =1
persistent =0

[State -3, AfterImagePersist]
type=afterimagetime
trigger1=stateno=3400 && time <= 90
trigger2=stateno=3000 && time = [9,60]
trigger3=stateno=3401 && time <= 90
trigger4=stateno=[1600,1603] ;&& time <= 80
trigger5=stateno=3302 ;&& time <= 80
trigger6=stateno=3301;&& time <= 80
trigger7=stateno=3700&& time <= 95
trigger8=stateno=3901 && time <= 9
trigger9=stateno=3020
trigger10 = stateno = [3100,3195]
time=2

[State -3, GetHitSnd]
type=playsnd
triggerall=alive&&time=1
triggerall=stateno=5000||stateno=5010||stateno=5020||stateno=5070||stateno=5080
trigger1=enemynear,hitdefattr=SCA,SA,HA
trigger2=gethitvar(animtype)>=2&&random<500
trigger3=gethitvar(animtype)=1&&random<375
trigger4=gethitvar(animtype)=0&&random<250
value=s5000,(0+(random%4));*10,ceil(random/200)
channel=0
ignorehitpause=1
persistent=0

[State -3, RemoveExplod]
type = RemoveExplod
trigger1 = stateno != 0
id = 2

[State -3, RemoveExplod]
type = RemoveExplod
trigger1 = stateno != 1402
id = 1490

[State -3, RemoveExplod]
type = RemoveExplod
trigger1 = stateno != [3400,3401]
id = 3490

[State -3, RemoveExplod]
type = RemoveExplod
trigger1 = stateno != 1102
id = 1190

[State -3, RemoveExplod]
type = RemoveExplod
trigger1 = stateno != 1102
id = 1191

[State -3, RemoveExplod]
type = RemoveExplod
trigger1 = stateno != [1200,1299]
id = 12900

[State -3, RemoveExplod]
type = RemoveExplod
trigger1 = stateno != [1100,1199]
id = 11900

[State -3, StopSnd]
type = StopSnd
trigger1 = movetype = H;anim != 1090
channel = 19

[State -3, StopSnd]
type = StopSnd
trigger1 = movetype = H;anim != 1090
channel = 18

[State -3, StopSnd]
type = StopSnd
trigger1 = movetype = H;anim != 1090
channel = 9

[State -3, StopSnd]
type = StopSnd
trigger1 = movetype = H;anim != 1090
channel = 8

[State -3, StopSnd]
type = StopSnd
trigger1 = movetype = H;anim != 1090
channel = 7

[State -3, DistCheck]
type = VarSet
trigger1 = !Time
var(15) = floor((P2BodyDist X / 2) - 25)

;----------------------------------------------
;dramaric ko (tnx syn)
[State -3, Fake helper]
type = helper
trigger1 = roundstate = 2 && !numhelper(6100)
helpertype = Normal
id = 6100
pos = 0,0
postype = p1
name = "Fake Helper"
stateno = 6100
supermovetime = 9999999999
pausemovetime = 9999999999


