[Data]
life = 1000			;Amount of life to start with
attack = 100		;attack power (more is stronger)
defence = 100		;defensive power (more is stronger)
fall.defence_up = 50	;Percentage to increase defense everytime player is knocked down
liedown.time = 30		;Time which player lies down for, before getting up
airjuggle = 15		;Number of points for juggling
sparkno = 2			;Default hit spark number for HitDefs
guard.sparkno = 40	;Default guard spark number
KO.echo = 0			;1 to enable echo on KO
volume = 128			;Volume offset (negative for softer)
IntPersistIndex = 58	;Variables with this index and above will not have their values
FloatPersistIndex = 40  ;reset to 0 between rounds or matches. There are 60 int variables,

[Size]
xscale = 1
yscale = 1
ground.back = 25
ground.front = 21
air.back = 18
air.front = 18
z.width = 3
height = 60
attack.width = 4,4
attack.dist = 160
proj.attack.dist = 90
proj.doscale = 0
head.pos = 2, -109
mid.pos = 5, -79
draw.offset=0,1 		;Player drawing offset in pixels (x, y)

[Velocity]
walk.fwd  = 2.3
walk.back = -1.8
run.fwd  = 8, -3
run.back = -8,-3
jump.neu = 0,-9.5
jump.back = -4.5
jump.fwd = 4.5
runjump.back = -7,-10
runjump.fwd = 7,-10
airjump.neu = 0,-7.5
airjump.back = -4.5
airjump.fwd = 4.5

[Movement]
airjump.num = 0		;Number of air jumps allowed (opt)
airjump.height = 35	;Minimum distance from ground before you can air jump (opt)
yaccel = .49		;Vertical acceleration
stand.friction = .85	;Friction coefficient when standing
crouch.friction = .82	;Friction coefficient when crouching

;---------------------------------------------------------------------------
; 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, winLevel3]
type=changestate
trigger1=prevstateno=340
value=340

[State 0, ChangeState]
type = ChangeState
trigger1 =prevstateno!=340
value = 181+(random%3)

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

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 3
value = S10,3
volume = 0
channel = -1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 30
value = S3,7
volume = 0
channel = 5

[State 0, Helper]
type = Helper
trigger1 = numhelper(180)=0
trigger1 = AnimElem = 2
helpertype = normal ;player
name = "Doom Servants"
ID = 180
stateno = 189
postype = p1    ;p2,front,back,left,right
keyctrl = 0
ownpal = 1

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = time < 300
flag = roundnotover

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

;---------------------------------------------------------------------------
; Win pose 2
[Statedef 182]
type = S
ctrl = 0
anim = 186
velset = 0,0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = time < 180
flag = roundnotover

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 1
value = S3,7
volume = 0
channel = 5

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

;---------------------------------------------------------------------------
; Win pose 3
[Statedef 183]
type = S
ctrl = 0
anim = 187
velset = 0,0
sprpriority = -1

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = time < 180
flag = roundnotover

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 4
value = S10,4
volume = 0
channel = -1

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

;---------------------------------------------------------------------------
; Win pose 3
[Statedef 184]
type = S
ctrl = 0
velset = 0,0
anim = 182
sprpriority = 2

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = time < 300
flag = roundnotover

;[State 0, ChangeAnim]
;type = ChangeAnim
;trigger1 = p2bodydist X > 30
;value = 20

;[State 0, VelSet]
;type = VelSet
;trigger1 = anim = 20
;x = const(velocity.walk.fwd.x)

;[State 0, ChangeAnim]
;type = ChangeAnim
;trigger1 = p2bodydist X <= 30
;value = 182

[State 0, Helper]
type = Helper
triggerall = anim = 182
trigger1 = numhelper(184)=0
trigger1 = time = 2
helpertype = normal ;player
name = "Doom Clone 1"
ID = 185
stateno = 185
pos = -30,15
postype = p1
facing = 1
keyctrl = 0
ownpal = 1

[State 0, Helper]
type = Helper
triggerall = anim = 182
trigger1 = numhelper(185)=0
trigger1 = time = 5
helpertype = normal ;player
name = "Doom Clone 2"
ID = 186
stateno = 186
pos = 60,-15
postype = p1
facing = 1
keyctrl = 0
ownpal = 1

[State 0, Helper]
type = Helper
triggerall = anim = 182
trigger1 = numhelper(186)=0
trigger1 = time = 8
helpertype = normal ;player
name = "Doom Clone 3"
ID = 187
stateno = 187
pos = 120,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1

[State 0, Helper]
type = Helper
triggerall = anim = 182
trigger1 = numhelper(187)=0
trigger1 = time = 11
helpertype = normal ;player
name = "Doom Clone 1"
ID = 188
stateno = 188
pos = 150,15
postype = p1
facing = 1
keyctrl = 0
ownpal = 1

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

;---------------------------------------------------------------------------
; Doom Clone 1
[Statedef 185]
type = S
ctrl = 0
anim = 181
velset = 0,0
sprpriority = 3

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

;---------------------------------------------------------------------------
; Doom Clone 2
[Statedef 186]
type = S
ctrl = 0
anim = 183
velset = 0,0
sprpriority = -1

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

;---------------------------------------------------------------------------
; Doom Clone 3
[Statedef 187]
type = S
ctrl = 0
anim = 184
velset = 0,0
sprpriority = 2

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

;---------------------------------------------------------------------------
; Doom Clone 4
[Statedef 188]
type = S
ctrl = 0
anim = 185
velset = 0,0
sprpriority = 3

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

;---------------------------------------------------------------------------
; Doom Servants
[Statedef 189]
type = S
ctrl = 0
anim = 189
velset = 0,0
sprpriority = 4

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

;---------------------------------------------------------------------------
; Introduction
[Statedef 190]
type = S
ctrl = 0
anim = 190
velset = 0,0

[State 190, 1] ;Freeze animation until PreIntro is over
type = ChangeState
trigger1 = RoundState = 0
value = 191+(random%2)

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

[State 190, 4] ;Change to stand state
type = ChangeState
trigger1 = AnimTime = 0
value = 22
;---------------------------------------------------------------------------
; Introduction
[Statedef 191]
type = S
ctrl = 0
anim = 190
velset = 0,0

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

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 3
value = S10,5
volume = 0
channel = -1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 19
value = S3,5+(random%2)
volume = 0
channel = 5

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 37
value = S100,1
volume = 0
channel = -1

[State 0, Explod]
type = Explod
trigger1 = AnimElem=40
anim = 7503
ID = 7503
postype = p1  ;p2,front,back,left,right
bindtime = 1
removetime = -2
scale = .6,.6
sprpriority = -1
ownpal = 1
removeongethit = 1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 40
value = S100,0
volume = 0
channel = -1

[State 190, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 22
;---------------------------------------------------------------------------
; Introduction 2
[Statedef 192]
type = S
ctrl = 0
anim = 191
velset = 0,0

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

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 6
value = S3,5
volume = 0
channel = 5

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 2
value = S10,3
volume = 0
channel = -1

[State 190, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 22
;---------------------------------------------------------------------------
; Taunt
[Statedef 195]
type = S
ctrl = 0
anim = 195+(random%2)
velset = 0,0
movetype = I
physics = S
juggle = 1
sprpriority = 2

[State 0, PowerAdd]
type = PowerAdd
trigger1 = time = 0
value = 100

[State 0, PlaySnd]
type = PlaySnd
trigger1 = anim = 196
trigger1 = animelem = 2
value = S3,6
volume = 0
channel = 5

[State 195, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;Tech Hitted
[Statedef 345]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= I				;Move-type: A-attack, I-idle, H-gethit
physics = S				;Physics: S-stand, C-crouch, A-air
juggle  = 0				;Number of air juggle points move takes
velset = -2,0			;Set velocity (x,y) (Def: no change)
ctrl = 0
anim = 345				;Set ctrl (Def: no change)
poweradd = 0			;Power to add (Def: 0)
sprpriority = 2	;Set layering priority to 2 (in front)

[State 0, EnvShake]
type = EnvShake
;trigger1 = enemynear,life >0
trigger1 = time = 0
time = 15
freq = 60
ampl = -4

[State 0, EnvColor]
type = EnvColor
trigger1 = !time
value = 255,255,255
time = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S5000,3
channel = 5

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2,3
volume = 0
channel = -1

[State 3805, end]
type=selfstate
trigger1 = animtime =0
value=0
ctrl=1

;---------------------------------------------------------------------------
;Tech Hitted
[Statedef 346]
type    = A				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= I				;Move-type: A-attack, I-idle, H-gethit
physics = A				;Physics: S-stand, C-crouch, A-air
juggle  = 0				;Number of air juggle points move takes
velset = -2,-8			;Set velocity (x,y) (Def: no change)
ctrl = 0
anim = 346				;Set ctrl (Def: no change)
poweradd = 0			;Power to add (Def: 0)
sprpriority = 2	;Set layering priority to 2 (in front)

[State 0, EnvShake]
type = EnvShake
;trigger1 = enemynear,life >0
trigger1 = time = 0
time = 15
freq = 60
ampl = -4

[State 0, EnvColor]
type = EnvColor
trigger1 = !time
value = 255,255,255
time = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S5000,3
channel = 5

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2,3
volume = 0
channel = -1

[State 3805, end]
type=selfstate
trigger1 = animtime =0
value=50
ctrl=1

;---------------------------------------------------------------------------
;Tech Hitted Low
[Statedef 347]
type    = C				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= I				;Move-type: A-attack, I-idle, H-gethit
physics = C				;Physics: S-stand, C-crouch, A-air
juggle  = 0				;Number of air juggle points move takes
velset = -2,0			;Set velocity (x,y) (Def: no change)
ctrl = 0
anim = 347				;Set ctrl (Def: no change)
poweradd = 0			;Power to add (Def: 0)
sprpriority = 2	;Set layering priority to 2 (in front)

[State 0, EnvShake]
type = EnvShake
;trigger1 = enemynear,life >0
trigger1 = time = 0
time = 15
freq = 60
ampl = -4

[State 0, EnvColor]
type = EnvColor
trigger1 = !time
value = 255,255,255
time = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S5000,3
channel = 5

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2,3
volume = 0
channel = -1

[State 3805, end]
type=selfstate
trigger1 = animtime =0
value=11
ctrl=1
;---------------------------------------------------------------------------
; Throw Forward - Attempt
[Statedef 800]
type    = S
movetype= A
physics = S
juggle  = 0
velset = 0,0
ctrl = 0
anim = 800
p2facing = 1
facep2 = 1
sprpriority = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 1
value = S0,5
volume = 0
channel = -1

[State 800, 1]
type = HitDef
Trigger1 = Time = 0
attr = S, NT
hitflag = M-
priority = 1, Miss
sparkno = -1
sparkxy = -13, -72
hitsound = S1,16
sprpriority = 1
p1facing = 1
p2facing = 1
p1stateno = ifelse (command = "holdback", 805, 801)
p2stateno = ifelse (command = "holdback", 815, 810)
numhits = 0
guard.dist = 0
fall = 1

[State 800, 2]
type = ChangeState
Trigger1 = AnimTime = 0
value = 0
ctrl = 1
;-------------------------------
[Statedef 801]
type = S
movetype = A
physics = S
anim = 801
velset = 0,0
sprpriority = 2

[State 920, 0]
type = NotHitBy
trigger1 = time >= 0
value = SCA
time = 1

[State 0, Width]
type = Width
trigger1 = time < 25
value = 90,0

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElem = 1
pos = 90,-100

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElemTime(2) >= 0&&AnimElemTime(5)<0
pos = 75,-130

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElem=5
pos = 80,-125

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 5
value = S3,2
volume = 0
channel = 5

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 6
value = S10,6
volume = 0
channel = -1

[State 0, Explod]
type = Explod
trigger1 = AnimElem = 7
anim = 809
ID = 800
pos = 90,-140
postype = p1  ;p2,front,back,left,right
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = 3
ownpal = 1
removeongethit = 1

[State 225, hit]
type=hitdef
trigger1=!time
attr=S,NT
damage=90,0
animtype=Hard
guardflag=MA
hitflag=MAF+
priority=4,Hit
pausetime=2,2
sparkno=s8200+(random%8)
guard.sparkno=-1;s8100
sparkxy=-10,-138
hitsound=s1,6
guardsound=s2,0
ground.type=High
ground.slidetime=16
ground.hittime=20
ground.velocity=-8,-12
air.type=Low
air.hittime=15
air.velocity=-8,-12
air.cornerpush.veloff=0
yaccel=.5
persistent=0
fall = 1
fall.recover = 0
p2stateno = 885
envshake.time = 9
envshake.ampl = 3
getpower=0

[State 920, 9]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;-------------------------------
[Statedef 805]
type = S
movetype = A
physics = S
anim = 805
velset = 0,0
sprpriority = 2

[State 0, Turn]
type = Turn
trigger1 = !time

[State 920, 0]
type = NotHitBy
trigger1 = time >= 0
value = SCA
time = 1

[State 0, Width]
type = Width
trigger1 = time = [9,30]
value = 90,0

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElem = 1
pos = -40,0

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElem = 2
pos = 40,0

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElem = 3
pos = 90,-100

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElemTime(4) >= 0&&AnimElemTime(7)<0
pos = 75,-130

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElem=7
pos = 80,-125

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 7
value = S3,2
volume = 0
channel = 5

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 8
value = S10,6
volume = 0
channel = -1

[State 225, hit]
type=hitdef
trigger1=!time
attr=S,NT
damage=90,0
animtype=Hard
guardflag=MA
hitflag=MAF+
priority=4,Hit
pausetime=2,2
sparkno=s8200+(random%8)
guard.sparkno=-1;s8100
sparkxy=-10,-155
hitsound=s1,6
guardsound=s2,0
ground.type=High
ground.slidetime=16
ground.hittime=20
ground.velocity=-8,-12
air.type=Low
air.hittime=15
air.velocity=-8,-12
air.cornerpush.veloff=0
yaccel=.5
persistent=0
fall = 1
fall.recover = 0
p2stateno = 885
envshake.time = 9
envshake.ampl = 3
getpower=0

[State 920, 9]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;-------------------------------------------
[Statedef 810]
type = A
movetype = H
physics = N
sprpriority = 3

;[State 3400, Tech Hit!]
;type = SelfState
;trigger1 = alive
;trigger1 = time = [1,9]
;trigger1 = CanRecover
;trigger1 = Command = "x" || Command = "y" || Command = "z" || Command = "a" || Command = "b" || Command = "c"
;value = 5210

[State 925, 1]
type = screenbound
trigger1 = 1
value = 0
movecamera = 1,0

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = ,AA,AP,SA,HA,ST,HT
time = 1

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

[State 925, 1]
type = ChangeAnim2
trigger1 = time = 0
value = 810

[State 0, SelfState]
type = SelfState
trigger1 = Time >= 30
value = 5040
ctrl = 1
;-------------------------------------------
[Statedef 815]
type = A
movetype = H
physics = N
sprpriority = 3

[State 0, Turn]
type = Turn
trigger1 = !time

;[State 3400, Tech Hit!]
;type = SelfState
;trigger1 = alive
;trigger1 = time = [1,9]
;trigger1 = CanRecover
;trigger1 = Command = "x" || Command = "y" || Command = "z" || Command = "a" || Command = "b" || Command = "c"
;value = 5210

[State 925, 1]
type = screenbound
trigger1 = 1
value = 0
movecamera = 1,0

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

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = ,AA,AP,SA,HA,ST,HT
time = 1

[State 925, 1]
type = ChangeAnim2
trigger1 = time = 0
value = 815

[State 0, SelfState]
type = SelfState
trigger1 = time >= 40
value = 5040
ctrl = 1

;---------------------------------------------------------------------------
; Air Throw Forward - Attempt
[Statedef 820]
type    = A
movetype= A
physics = A
juggle  = 0
ctrl = 0
anim = 820
p2facing = 1
facep2 = 1
sprpriority = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 3
value = S0,5
volume = 0
channel = -1

[State 800, 1]
type = HitDef
Trigger1 = Time = 0
attr = A, NT
hitflag = AF
priority = 1, Miss
sparkno = -1
sparkxy = -13, -72
hitsound = S1,16
sprpriority = 1
p1facing = ifelse (frontedgebodydist <= 50||command="holdback", -1, 1)
p2facing = 1
p1stateno = 821
p2stateno = 830
numhits = 0
guard.dist = 0
fall = 1

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = AnimElem = 6
statetype = A       ;S,A,C,L
movetype = I        ;I,A,H
physics = A         ;A,C,S,N

[State 0, CtrlSet]
type = CtrlSet
trigger1 = AnimElem = 6
value = 1

;-------------------------------
[Statedef 821]
type = A
movetype = A
physics = N
anim = 821
velset = 0,0
sprpriority = 2

[State 920, 0]
type = NotHitBy
trigger1 = time < 14
value = SCA
time = 1

[State 0, Width]
type = Width
trigger1 = time < 14
value = 75,0

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElem = 1
pos = 75,-112

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElemTime(2) >= 0&&AnimElemTime(5)<0
pos = 60,-142

[State 0, TargetBind]
type = TargetBind
trigger1 = AnimElem=5
pos = 65,-137

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 1
value = S100,3
volume = 0
channel = -1

[State 0, Explod]
type = Explod
triggerall = Time <= 20
trigger1 = (gametime%2)=1
anim = 109
ID = 100
pos = 5,-45
postype = p1  ;p2,front,back,left,right
bindtime = 1
vel = 0,8
random = 35,20
removetime = -2
scale = .25,.25
sprpriority = ifelse(random < 500, 3, -3)
ownpal = 1
removeongethit = 0

[State 0, Explod]
type = Explod
trigger1 = AnimElem = 7
anim = 809
ID = 800
pos = 60,-155
postype = p1  ;p2,front,back,left,right
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = 3
ownpal = 1
removeongethit = 1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 5
value = S3,2
volume = 0
channel = 5

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 6
value = S10,6
volume = 0
channel = -1

[State 225, hit]
type=hitdef
trigger1=!time
attr=S,NT
damage=90,0
animtype=Hard
guardflag=MA
hitflag=MAF+
priority=4,Hit
pausetime=2,2
sparkno=s8200+(random%8)
guard.sparkno=-1;s8100
sparkxy=-10,-167
hitsound=s1,6
guardsound=s2,0
ground.type=High
ground.slidetime=16
ground.hittime=20
ground.velocity=-8,-12
air.type=Low
air.hittime=15
air.velocity=-8,-12
air.cornerpush.veloff=0
yaccel=.5
persistent=0
fall = 1
fall.recover = 0
p2stateno = 885
envshake.time = 9
envshake.ampl = 3
getpower=0

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = AnimElem = 12
statetype = A       ;S,A,C,L
movetype = I        ;I,A,H
physics = A         ;A,C,S,N

[State 0, CtrlSet]
type = CtrlSet
trigger1 = AnimElem = 12
value = 1

;-------------------------------------------
[Statedef 830]
type = A
movetype = H
physics = N
sprpriority = 3

;[State 3400, Tech Hit!]
;type = SelfState
;trigger1 = alive
;trigger1 = time = [1,9]
;trigger1 = CanRecover
;trigger1 = Command = "x" || Command = "y" || Command = "z" || Command = "a" || Command = "b" || Command = "c"
;value = 5210

[State 925, 1]
type = screenbound
trigger1 = 1
value = 0
movecamera = 1,0

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = ,AA,AP,SA,HA,ST,HT
time = 1

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

[State 925, 1]
type = ChangeAnim2
trigger1 = time = 0
value = 830

[State 0, SelfState]
type = SelfState
trigger1 = Time >= 30
value = 5040
ctrl = 1

;Fall
[Statedef 885]
type    = S
movetype= H
physics = N
velset = 0,0

[State 0, PosAdd]
type = PosAdd
trigger1 = !time
y = -const(size.head.pos.y)

[State 886, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(groundtype) = 1),5000,5010) + GetHitVar(animtype)

[State 886, 2]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 886, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 886, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 886, 5]
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 && GetHitVar(fall)
trigger2 = Pos Y != 0
type = A

[State 886, 6]
type = SelfState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0
value = 5001 ;HITG_SLIDE

[State 886, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 886

[State 886, Force Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 886, Force Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 886, Force Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140
; Initial Going Up
[Statedef 886]
type    = A
movetype= H
physics = N
ctrl = 0

[State 886, 1]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 886, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 886, 4]
type = ChangeState
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 888 ;HITA_FALL

[State 886, GameMakeAnim]
type = GameMakeAnim
triggerall = vel x != 0
trigger1 = backedgebodydist <= 5
persistent = 0
ignorehitpause = 1
value = 72
pos = -20,-65
postype = p1
bindtime = -1

[State 886, Explod]
type = Explod
triggerall = vel x != 0
trigger1 = frontedgebodydist <= 5
persistent = 0
ignorehitpause = 1
anim = f72
pos = 20,-65
sprpriority = 2
facing = -1
bindtime = 1
ownpal = 1

[State 886, 10]
type = PlaySnd
triggerall = vel x != 0
trigger1 = backedgebodydist <= 5
trigger2 = frontedgebodydist <= 5
trigger1 = vel x != 0
persistent = 0
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 886, 10]
type = velset
triggerall = vel x != 0
trigger1 = backedgebodydist <= 5
trigger2 = frontedgebodydist <= 5
persistent = 0
x = 0

[State 886, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 887

;---------------------------------------------------------------------------
; Transition
[Statedef 887]
type    = A
movetype= H
physics = N

[State 272, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059]
trigger1 = Anim != 5090
value = 5035

[State 887, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 887, GameMakeAnim]
type = GameMakeAnim
triggerall = vel x != 0
trigger1 = backedgebodydist <= 5
persistent = 0
ignorehitpause = 1
value = 72
pos = -20,-65
postype = p1
bindtime = -1

[State 887, Explod]
type = Explod
triggerall = vel x != 0
trigger1 = frontedgebodydist <= 5
persistent = 0
ignorehitpause = 1
anim = f72
pos = 20,-65
sprpriority = 2
facing = -1
bindtime = 1
ownpal = 1

[State 887, 10]
type = PlaySnd
triggerall = vel x != 0
trigger1 = backedgebodydist <= 5
trigger2 = frontedgebodydist <= 5
persistent = 0
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 887, 10]
type = velset
triggerall = vel x != 0
trigger1 = backedgebodydist <= 5
trigger2 = frontedgebodydist <= 5
persistent = 0
x = 0

[State 887, ChangeState]
type = ChangeState
trigger1 = HitOver
trigger2 = AnimTime = 0
trigger3 = Vel Y > 0
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0
trigger4 = Anim != 5035
value = 888
; falling
[Statedef 888]
type    = A
movetype= H
physics = N

[State 888, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 888, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 888, 3]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 888, GameMakeAnim]
type = GameMakeAnim
triggerall = vel x != 0
trigger1 = backedgebodydist <= 5
persistent = 0
ignorehitpause = 1
value = 72
pos = -20,-65
postype = p1
bindtime = -1

[State 888, GameMakeAnim]
type = Explod
triggerall = vel x != 0
trigger1 = frontedgebodydist <= 5
persistent = 0
ignorehitpause = 1
anim = f72
pos = 20,-65
sprpriority = 2
facing = -1
bindtime = 1
ownpal = 1

[State 888, 10]
type = PlaySnd
triggerall = vel x != 0
trigger1 = backedgebodydist <= 5
trigger2 = frontedgebodydist <= 5
persistent = 0
;value = F7, 0 ;Hit ground
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 888, 10]
type = velset
triggerall = vel x != 0
trigger1 = backedgebodydist <= 5
trigger2 = frontedgebodydist <= 5
persistent = 0
x = 0

[State 888, 6]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5110
;---------------------------------------------------------------------------
; roll recovery
[Statedef 900]
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 = 900				;Change animation (Def: no change)
poweradd = 20			;Power to add (Def: 0)
sprpriority = 1			;Set layering priority to 2 (in front)

[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.5
y = 0
;ignorehitpause =
;persistent =

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

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

[State 200, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger2 = FrontEdgeBodyDist <= 10
value = 11
ctrl = 1
;---------------------------------------------------------------------------
; roll recovery
[Statedef 901]
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 = 901				;Change animation (Def: no change)
poweradd = 20			;Power to add (Def: 0)
sprpriority = 1		;Set layering priority to 2 (in front)

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

[State 0, VelSet]
type = VelSet
trigger1 = animelem = 1
x =-7.5
y = 0

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

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

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

[State 200, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger2 = backEdgeBodyDist <= 10
value = 11
ctrl = 1

;---------------------------------------------------------------------------
; roll recovery Dodge
[Statedef 701]
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 = 701				;Change animation (Def: no change)
poweradd = 0			;Power to add (Def: 0)
sprpriority = 1			;Set layering priority to 2 (in front)

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

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

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

[State 200, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger2 = FrontEdgeBodyDist <= 10
value = 11
ctrl = 1

;---------------------------------------------------------------------------
; roll recovery Dodge
[Statedef 702]
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 = 702				;Change animation (Def: no change)
poweradd = 0			;Power to add (Def: 0)
sprpriority = 1			;Set layering priority to 2 (in front)

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

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

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

[State 200, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger2 = FrontEdgeBodyDist <= 10
value = 11
ctrl = 1

;---------------------------------------------------------------------------
; roll recovery Dodge
[Statedef 703]
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 = 703				;Change animation (Def: no change)
poweradd = 0			;Power to add (Def: 0)
sprpriority = 1			;Set layering priority to 2 (in front)

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

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

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

[State 200, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger2 = FrontEdgeBodyDist <= 10
value = 11
ctrl = 1

;---------<PARRY>----------
;---STANDING---
[Statedef 790]
type=S
physics=S
movetype=I
anim=165
velset=0,0
ctrl=0
sprpriority=2
poweradd=100

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

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

[State 700, pause]
type=pause
trigger1=!time
time=15
movetime=15
endcmdbuftime=15
pausebg=0

[State 700, pause]
type=pause
trigger1= !time && numenemy
trigger1= (enemynear,movehit=1)
time= ifelse((enemynear,hitpausetime=[0,15]), 15-(enemynear,hitpausetime), 0)
movetime= ifelse((enemynear,hitpausetime=[0,15]), 15-(enemynear,hitpausetime), 0)
endcmdbuftime= ifelse((enemynear,hitpausetime=[0,15]), 15-(enemynear,hitpausetime), 0)
pausebg=0

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

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

[State 700, spark]
type=explod
trigger1= animelem=1
anim=8065
ID=8065
sprpriority=5
postype=p1
pos=45,-63
pausemovetime=60
ownpal=1
scale=.5,.5

[State 700, nowalk]
type=assertspecial
trigger1=1
flag=nowalk

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


;---CROUCHING---
[Statedef 791]
type=C
physics=C
movetype=I
anim=166
velset=0,0
ctrl=0
sprpriority=2
poweradd=100

[State 701, hb]
type=hitby
trigger1=1
value=SCA,AT
time=1

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

[State 701, pause]
type=pause
trigger1=!time
time=15
movetime=15
endcmdbuftime=15
pausebg=0

[State 701, pause]
type=pause
trigger1= !time && numenemy
trigger1= (enemynear,movehit=1)
time= ifelse((enemynear,hitpausetime=[0,15]), 15-(enemynear,hitpausetime), 0)
movetime= ifelse((enemynear,hitpausetime=[0,15]), 15-(enemynear,hitpausetime), 0)
endcmdbuftime= ifelse((enemynear,hitpausetime=[0,15]), 15-(enemynear,hitpausetime), 0)
pausebg=0

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

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

[State 700, spark]
type=explod
trigger1= animelem=1
anim=8065
ID=8065
sprpriority=5
postype=p1
pos=25,-22
pausemovetime=60
ownpal=1
scale=.5,.5

[State 701, nowalk]
type=assertspecial
trigger1=1
flag=nowalk

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


;---AERIAL---
[Statedef 792]
type=A
physics=A
movetype=I
anim=167
ctrl=0
sprpriority=2
poweradd=100

[State 702, hb]
type=hitby
trigger1=time<15
value=SCA,AT
time=1

[State 702, pause]
type=pause
trigger1=!time
time=15
movetime=15
endcmdbuftime=15
pausebg=0

[State 702, pause]
type=pause
trigger1= !time && numenemy
trigger1= (enemynear,movehit=1)
time= ifelse((enemynear,hitpausetime=[0,15]), 15-(enemynear,hitpausetime), 0)
movetime= ifelse((enemynear,hitpausetime=[0,15]), 15-(enemynear,hitpausetime), 0)
endcmdbuftime= ifelse((enemynear,hitpausetime=[0,15]), 15-(enemynear,hitpausetime), 0)
pausebg=0

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

[State 702, stop]
type=posfreeze
trigger1= time<15
value=1

[State 702, vel]
type=velset
trigger1= time=15
x=ifelse(vel x>2,2,ifelse(vel x<-2,-2,vel x))
y=ifelse(vel y<-2,vel y,-2)

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

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

[State 702, blueflash]
type=palfx
trigger1= !time
add=0,64,255
sinadd=0,-64,-255,60
time=15

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

[State 700, spark]
type=explod
trigger1= animelem=1
anim=8065
ID=8065
sprpriority=5
postype=p1
pos=45,-80
pausemovetime=60
ownpal=1
scale=.5,.5

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

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

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

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

[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, strengthvar (AI)]
type=varset
trigger1=!time&&var(59)=1
var(10)=1
ignorehitpause=1

[State 750, snd]
type=playsnd
trigger1=time = 0
value=2,3
channel=0

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

[State 3000, carga]
type=helper
trigger1=time = 0
helpertype=normal
stateno=9750
ID=9750
name="fx"
postype=p1
pos = 50,-55
ownpal=1
persistent=0
supermovetime=9999

[State 750, end]
type=changestate
trigger1=time>=20
value=ifelse(var(10)=1,420,450)

;==========<ZERO COUNTER>==========
[Statedef 751]
type=A
physics=N
movetype=I
anim=751
ctrl=0
velset=0,0
poweradd=-500
sprpriority=2

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

[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, strengthvar (AI)]
type=varset
trigger1=!time&&var(59)=1
var(10)=1
ignorehitpause=1

[State 750, snd]
type=playsnd
trigger1=time = 0
value=2,3
channel=0

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

[State 3000, carga]
type=helper
trigger1=time = 0
helpertype=normal
stateno=9750
ID=9750
name="fx"
postype=p1
pos = 50,-90
ownpal=1
persistent=0
supermovetime=9999

[State 750, end]
type=changestate
trigger1=time>=20
value=ifelse(var(10)=1,1152,1220)

[State 450, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 11
ctrl = 1

;;-----------------------------
; Charge
[Statedef 950]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= I				;Move-type: A-attack, I-idle, H-gethit
physics = S				;Physics: S-stand, C-crouch, A-air
juggle  = 1				;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 = 950				;Change animation (Def: no change)
poweradd = 0			;Power to add (Def: 0)
sprpriority = 2			;Set layering priority to 2 (in front)

[State 820, PowerAdd]
type = PowerAdd
triggerall = Anim = 950
trigger1 = 1
value = 2* ((time+12)/12)

[State 820, Anim]
type = ChangeAnim
triggerall=var(59)<=0
;triggerall = Time >= 4
trigger1 = (Command != "chargey" || Command != "chargeb") || (power >= 3000)
value = 951
persistent = 0

[State 740, fx]
type=helper
trigger1=anim=950&&!numhelper(7240)&&animelem =2
helpertype=normal
stateno=7240
ID=7240
name="Power Charge"
postype=p1
ownpal=1
persistent=0

[State 820, StateChange]
type = ChangeState
trigger1 = anim = 951 && AnimTime = 0
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(15):=0)
var(15) = 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(15)
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)
;==================================================================================
;==================================================================================
;==================================================================================
