;Vars:
;	0  = input control
;	1  = temp var
;	2  = enemy 1 id
;	3  = enemy 1 guardcrush guage
;	4  = enemy 2 id
;	5  = enemy 2 guardcrush guage
;	6  = guard break strength
;	7  = guard break sound trigger
;	8  = id counter
;	9  = dragon commands
;	10 = dragon sound control (1-9 = background, 11-19 = foreground)
;	11 = dragon element switching
;	12 = dragon knock down flag
;	13 = dragon 1 element
;	14 = dragon 2 element
;	15 = dragon pre-battle selection off/on
;	16 = custom gameplay off/on
;	17 = wakeup flag
;	18 = dragon in-battle selection mode
;	20 = voice timer
;	21 = Shin Valdoll mode off/on
;	22 = warzard hitsparks off/on
;	23 = advanced fx off/on
;	24 = dragon switch ai timer
;	56 = hitstun counter
;	57 = (Winane) GameTime var, for pause and custom state check
;	58 = AI action select
;	59 = (Winane) AI

;Fvars:
;	0  = temp var
;	10 = AI aggression setting
;	11 = AI evasion setting

[Data]
life = 1100			;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 = 60		;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 = 200			;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,
  				;indexed from 0 to 59, and 40 float variables, indexed from 0 to 39.
  				;If omitted, then it defaults to 60 and 40 for integer and float
  				;variables repectively, meaning that none are persistent, i.e. all
  				;are reset. If you want your variables to persist between matches,
  				;you need to override state 5900 from common1.cns.


[Size]
;Adapted scale large (direct conversion from CPS-3)
	xscale=0.83333333333333333333333333333333
	yscale=1.0714285714285714285714285714286

;Adapted scale small (bit smaller to avoid pixellation)
;	xscale = 0.801           ;Horizontal scaling factor.
;	yscale = 1

;Original scale (no scaling, may appear "squashed")
;	xscale = 1           ;Horizontal scaling factor.
;	yscale = 1           ;Vertical scaling factor.

ground.back = 15		;Player width (back, ground)
ground.front = 25		;Player width (front, ground)
air.back = 12		;Player width (back, air)
air.front = 12		;Player width (front, air)
height = 100			;Height of player (for opponent to jump over)
attack.dist = 160		;Default attack distance
proj.attack.dist = 90	;Default attack distance for projectiles
proj.doscale = 1		;Set to 1 to scale projectiles too   
head.pos = 12, -110	;Approximate position of head
mid.pos = 17, -64		;Approximate position of midsection
shadowoffset = 0		;Number of pixels to vertically offset the shadow
draw.offset = 0,0		;Player drawing offset in pixels (x, y)

[Velocity]
walk.fwd  = 2.5		;Walk forward
walk.back = -2.5		;Walk backward
run.fwd  = 5, 0		;Run forward (x, y)
run.back = -4.5,-3.8	;Hop backward (x, y)
jump.neu = 0,-8		;Neutral jumping velocity (x, y)
jump.back = -2.5		;Jump back Speed (x, y)
jump.fwd = 2.5		;Jump forward Speed (x, y)
runjump.back = -2.55,-8.1;Running jump speeds (opt)
runjump.fwd = 4,-8.1	;.
airjump.neu = 0,-8.1	;.
airjump.back = -2.55	;Air jump speeds (opt)
airjump.fwd = 2.5		;.

[Movement]
airjump.num = -		;Number of air jumps allowed (opt)
airjump.height = 35	;Minimum distance from ground before you can air jump (opt)
yaccel = .5		;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
; CNS difficulty: basic
[Statedef 180]
type = S

[State 180, 1]
type = ChangeState
trigger1 = Time = 0
value = 181 + ifelse(var(16), random%2, 0)

;---------------------------------------------------------------------------
; Win pose 1
; CNS difficulty: basic
[Statedef 181]
type = S
ctrl = 0
anim = 180
velset = 0,0

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

[State 181, 2]
type = AssertSpecial
trigger1 = time < 90
flag = RoundNotOver

[State 181, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 180, 0
channel = 0

[State 181, ChangeAnim]
type = ChangeAnim
trigger1 = animtime = 0
value = 0

[Statedef 20182]
type = S
ctrl = 0
anim = 9999
velset = 0,0

[State 20182, PosAdd]
type = PosAdd
trigger1 = 1
x = p2dist x
y = p2dist y

[State 20182, PlaySnd]
type = PlaySnd
trigger1 = root, anim = 180
trigger1 = root, time = 35
value = 180, 1

[State 20182, Explod]
type = Explod
trigger1 = root, anim = 180
trigger1 = root, time = [35, 53]
trigger1 = root, time%2
id = 20181
anim = 20181
sprpriority = 1
postype = p1
bindtime = 1
random = 100, 0
ownpal = 1
scale = const(size.xscale)*((2000 + random)/3000.0), const(size.yscale)*((2000 + random)/3000.0)

;---------------------------------------------------------------------------
; Win pose 2
; CNS difficulty: basic
[Statedef 182]
type = S
physics = N
ctrl = 0
anim = 9999
velset = 0,0

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

[State 182, 2]
type = AssertSpecial
trigger1 = time < 100
flag = RoundNotOver

[State 182, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 1, 0

[State 182, PlaySnd]
type = PlaySnd
trigger1 = time = 10
value = 150, 0
channel = 0

[State 182, VelSet]
type = VelSet
trigger1 = time*0.1 < pi
y = -sin(time*0.1)

[State 182, VelSet]
type = VelSet
trigger1 = time*0.1 > pi
y = 0

[State 182, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 1100, 1

[State 20183, Helper]
type = Helper
trigger1 = time = 0
name = "dupe"
id = 20183
stateno = 20183
ownpal = 0

[State 182, Explod]
type = Explod
trigger1 = time%36 = 15
trigger2 = time%36 = 0
id = 21101
anim = 21101 + 10*(var(23) != 0)
sprpriority = -2
postype = p1
bindtime = 1
pos = 0, 3 - floor(pos y)
scale = const(size.xscale), const(size.yscale)

[Statedef 20183]
type = S
physics = N
ctrl = 0
anim = 181
velset = 0,0
sprpriority = 1

[State 20183, VelSet]
type = VelSet
trigger1 = time*0.1 < pi
y = -2*sin(time*0.1)

[State 20183, VelSet]
type = VelSet
trigger1 = time*0.1 > pi
y = -sin(time*0.1)

;---------------------------------------------------------------------------
; Introduction
; CNS difficulty: basic
[Statedef 190]
type = S
ctrl = 0
anim = 9999
velset = 0,0

[State 190, ChangeState]
type = ChangeState
trigger1 = var(19) > 0
trigger1 = facing = -1 || var(19) = 2 || var(19) = 4
trigger1 = time = 0
trigger1 = prevstateno != 192
value = 192

[State 190, 1] ;Freeze animation until PreIntro is over
type = ChangeState
trigger1 = RoundState = 0
trigger1 = time
value = 190

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

[State 190, PlaySnd]
type = PlaySnd
trigger1 = time = 10
value = 190, 0

[State 190, VarSet]
type = VarSet
trigger1 = time = 10
fvar(0) = 0.0

[State 190, Helper]
type = Helper
trigger1 = time = 10
name = "particle"
id = 191
stateno = 191
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 190, Helper]
type = Helper
trigger1 = time = 10
name = "particle"
id = 192
stateno = 191
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 190, Helper]
type = Helper
trigger1 = time = 10
name = "particle"
id = 193
stateno = 191
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 190, Helper]
type = Helper
trigger1 = time = 10
name = "particle"
id = 194
stateno = 191
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 190, Helper]
type = Helper
trigger1 = time = 10
name = "particle"
id = 195
stateno = 191
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 190, Helper]
type = Helper
trigger1 = time = 10
name = "particle"
id = 196
stateno = 191
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 190, Helper]
type = Helper
trigger1 = time = 10
name = "particle"
id = 197
stateno = 191
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 190, Helper]
type = Helper
trigger1 = time = 10
name = "particle"
id = 198
stateno = 191
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 190, Helper]
type = Helper
trigger1 = time > ifelse(var(15), 0, 70)
trigger1 = !numhelper(10000)
trigger1 = var(13) != -1
name = "Dragon1"
id = 10000
stateno = 15900
ownpal = 1
size.xscale = const(size.xscale)*ifelse(var(21), 1.1, 1)
size.yscale = const(size.yscale)*ifelse(var(21), 1.1, 1)

[State 190, Helper]
type = Helper
trigger1 = time > ifelse(var(15), 0, 70)
trigger1 = !numhelper(10001)
trigger1 = var(14) != -1
name = "Dragon2"
id = 10001
stateno = 15910
ownpal = 1
size.xscale = const(size.xscale)*ifelse(var(21), 1.1, 1)
size.yscale = const(size.yscale)*ifelse(var(21), 1.1, 1)


[State 190, Explod]
type = Explod
trigger1 = time = 70
id = 1300
anim = 1300 + 2*(var(23) != 0)
sprpriority = 0
bindtime = 1
ownpal = 1
scale = const(size.xscale), const(size.yscale)

[State 190, Helper]
type = Helper
trigger1 = time = 70
name = "teleportendimage"
id = 1360
stateno = 1360
ownpal = 1

[State 190, 4] ;Change to stand state
type = ChangeState
trigger1 = time = 96
value = 0

[Statedef 191]
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
;Commonly-used controllers:
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = 2			;Set layering priority to 2 (in front)
anim = 20190 + 2*(root, var(23) != 0)

[State 191, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow

[State 191, VarSet]
type = VarSet
trigger1 = time = 0
fvar(0) = parent, fvar(0)

[State 191, ParentVarAdd]
type = ParentVarAdd
trigger1 = time = 0
fvar(0) = 1.0

[State 191, Bind]
type = BindToParent
trigger1 = 1
pos = (60 - time)*4.0*sin(fvar(0)*pi*0.25 - time*0.06) - 4*(root, const(size.xscale)), (60 - time)*4.0*cos(fvar(0)*pi*0.25 - time*0.06) - 61*(root, const(size.yscale))

[State 191, Explod]
type = Explod
trigger1 = time%2 = 0
anim = 20191 + 2*(root, var(23) != 0)
sprpriority = 2
bindtime = 1
removetime = -2
scale = root, const(size.xscale), root, const(size.yscale)

[State 191, RemoveExplod]
type = RemoveExplod
trigger1 = time = 60

[State 191, DestroySelf]
type = DestroySelf
trigger1 = time = 60

[Statedef 192]
type = S
ctrl = 0
anim = 9999
velset = 0,0

[State 192, ChangeState]
type = ChangeState
triggerall = time = 0
triggerall = numpartner
triggerall = abs(partner, pos x) < abs(pos x)
trigger1 = partner, name = "Valdoll"
trigger2 = partner, name = "valdoll"
trigger3 = partner, name = "Scion"
trigger4 = partner, name = "scion"
value = 190

[State 192, ChangeState]
type = ChangeState
triggerall = time = 0
triggerall = numenemy > 0
triggerall = facing = 1
trigger1 = enemy(0), name = "Valdoll"
trigger2 = enemy(0), name = "valdoll"
trigger3 = enemy(0), name = "Scion"
trigger4 = enemy(0), name = "scion"
value = 190

[State 192, ChangeState]
type = ChangeState
triggerall = time = 0
triggerall = numenemy > 1
triggerall = facing = 1
trigger1 = enemy(1), name = "Valdoll"
trigger2 = enemy(1), name = "valdoll"
trigger3 = enemy(1), name = "Scion"
trigger4 = enemy(1), name = "scion"
value = 190

[State 192, Helper]
type = Helper
trigger1 = time = 0
trigger1 = !numhelper(193)
name = "Dupe"
id = 193
stateno = 193
postype = left
pos = 160, -100 - ceil(const(size.yscale) - 1)

[State 192, Helper]
type = Helper
trigger1 = time = 0
trigger1 = !numhelper(197)
name = "screenbounder"
id = 197
stateno = 197
postype = left
pos = 160, -300

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

[State 192, ChangeState]
type = ChangeState
trigger1 = roundstate = 0
trigger1 = time
value = 192

[State 192, PlaySnd]
type = PlaySnd
trigger1 = roundstate > 0
trigger1 = var(19) > 2
value = 192, 0
abspan = 0
channel = 8
persistent = 0

[State 192, Helper]
type = Helper
triggerall = !numhelper(10000)
triggerall = var(13) != -1
trigger1 = numhelper(191) = 1
trigger1 = helper(191), rootdist x - facing*2*(const(size.xscale)) = [-5, 5]
trigger1 = helper(191), rootdist y - 57*(const(size.yscale)) = [-5, 5]
trigger2 = time > 378
trigger2 = !numhelper(191)
trigger3 = var(15)
trigger3 = numhelper(191)
trigger3 = helper(191), stateno = 196
name = "Dragon1"
id = 10000
stateno = 15900
ownpal = 1
size.xscale = const(size.xscale)*ifelse(var(21), 1.1, 1)
size.yscale = const(size.yscale)*ifelse(var(21), 1.1, 1)

[State 192, Helper]
type = Helper
triggerall = !numhelper(10001)
triggerall = var(14) != -1
trigger1 = numhelper(191) = 1
trigger1 = helper(191), rootdist x - facing*2*(const(size.xscale)) = [-7, 7]
trigger1 = helper(191), rootdist y - 57*(const(size.yscale)) = [-7, 7]
trigger2 = time > 378
trigger2 = !numhelper(191)
trigger3 = var(15)
trigger3 = numhelper(191)
trigger3 = helper(191), stateno = 196
name = "Dragon2"
id = 10001
stateno = 15910
ownpal = 1
size.xscale = const(size.xscale)*ifelse(var(21), 1.1, 1)
size.yscale = const(size.yscale)*ifelse(var(21), 1.1, 1)

[State 192, Explod]
type = Explod
trigger1 = numhelper(191) = 1
trigger1 = helper(191), rootdist x - facing*2*(const(size.xscale)) = [-7, 7]
trigger1 = helper(191), rootdist y - 57*(const(size.yscale)) = [-7, 7]
trigger2 = time > 378
trigger2 = !numhelper(191)
id = 1300
anim = 1300 + 2*(var(23) != 0)
sprpriority = 0
bindtime = 1
ownpal = 1
scale = const(size.xscale), const(size.yscale)
persistent = 0

[State 192, Helper]
type = Helper
trigger1 = numhelper(191) = 1
trigger1 = helper(191), rootdist x - facing*2*(const(size.xscale)) = [-7, 7]
trigger1 = helper(191), rootdist y - 57*(const(size.yscale)) = [-7, 7]
trigger2 = time > 378
trigger2 = !numhelper(191)
name = "teleportendimage"
id = 1360
stateno = 1360
ownpal = 1
persistent = 0

[State 192, ChangeAnim]
type = ChangeAnim
triggerall = anim
triggerall = time > 380
triggerall = !numhelper(191)
trigger1 = numhelper(1360)
trigger1 = helper(1360), time = 26
trigger2 = !numhelper(1360)
value = 0

[State 192, ChangeState]
type = ChangeState
trigger1 = anim = 0
trigger1 = animelem = 16
value = 0

[Statedef 193]
type = S
ctrl = 0
anim = 193
velset = 0,0
sprpriority = -5

[State 193, PlaySnd]
type = PlaySnd
trigger1 = animelem = 2
trigger2 = animtime = 0
value = 190, 0

[State 193, DestroySelf]
type = DestroySelf
trigger1 = animtime = 0

[State 193, Helper]
type = Helper
trigger1 = animelem = 2
name = "particle"
id = 191
stateno = 194
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 193, Helper]
type = Helper
trigger1 = animelem = 2
name = "particle"
id = 191
stateno = 194
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 193, Helper]
type = Helper
trigger1 = animelem = 2
name = "particle"
id = 191
stateno = 194
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 193, Helper]
type = Helper
trigger1 = animelem = 2
name = "particle"
id = 191
stateno = 194
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 193, Helper]
type = Helper
trigger1 = animelem = 2
name = "particle"
id = 191
stateno = 194
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 193, Helper]
type = Helper
trigger1 = animelem = 2
name = "particle"
id = 191
stateno = 194
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 193, Helper]
type = Helper
trigger1 = animelem = 2
name = "particle"
id = 191
stateno = 194
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[State 193, Helper]
type = Helper
trigger1 = animelem = 2
name = "particle"
id = 191
stateno = 194
ownpal = 1
size.xscale = const(size.xscale)*1.3
size.yscale = const(size.yscale)*1.3

[Statedef 194]
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
;Commonly-used controllers:
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = -1			;Set layering priority to 2 (in front)
anim = 20190 + 2*(root, var(23) != 0)

[State 194, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow

[State 194, VarSet]
type = VarSet
trigger1 = time = 0
fvar(0) = parent, fvar(0)

[State 194, ParentVarAdd]
type = ParentVarAdd
trigger1 = time = 0
fvar(0) = 1.0

[State 194, Bind]
type = BindToParent
trigger1 = 1
pos = time*7.0*sin(fvar(0)*pi*0.25 - time*0.03 - 0.2), time*7.0*cos(fvar(0)*pi*0.25 - time*0.03 - 0.2)

[State 194, VarSet]
type = VarSet
trigger1 = 1
fvar(1) = (0.5 + ifelse(time < 30, time, 30)/60.0)*1.3

[State 194, AngleDraw]
type = AngleDraw
trigger1 = root, var(23) != 0
scale = fvar(1), fvar(1)

[State 194, Trans]
type = Trans
trigger1 = root, var(23) != 0
trans = addalpha
alpha = 256, 256

[State 194, Explod]
type = Explod
trigger1 = root, var(23) = 0
trigger1 = time%2 = 0
anim = 20191 + 2*(root, var(23) != 0)
sprpriority = -2
bindtime = 1
removetime = -2
scale = root, const(size.xscale), root, const(size.yscale)

[State 194, Explod]
type = Explod
trigger1 = root, var(23) != 0
trigger1 = time%2 = 0
anim = 20191 + 2*(root, var(23) != 0)
sprpriority = -2
bindtime = 1
removetime = -2
scale = root, const(size.xscale)*fvar(1), root, const(size.yscale)*fvar(1)

[State 194, ChangeState]
type = ChangeState
trigger1 = time = 60
value = 196

[Statedef 196]
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
;Commonly-used controllers:
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = 2			;Set layering priority to 2 (in front)
anim = 20190 + 2*(root, var(23) != 0)

[State 196, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow

[State 196, VarSet]
type = VarSet
trigger1 = time = 0
var(1) = random%25 + 1

[State 196, PosFreeze]
type = PosFreeze
trigger1 = time < var(1)

[State 196, VarSet]
type = VarSet
trigger1 = 1
fvar(1) = rootdist x - root, facing*4*(root, const(size.xscale))

[State 196, VarSet]
type = VarSet
trigger1 = 1
fvar(2) = rootdist y - 61*(root, const(size.yscale))

[State 196, VarSet]
type = VarSet
trigger1 = fvar(1)
fvar(3) = atan(fvar(2)/fvar(1))

[State 196, VarAdd]
type = VarAdd
trigger1 = fvar(1) < 0
fvar(3) = pi

[State 196, VarSet]
type = VarSet
trigger1 = fvar(1) = 0
fvar(3) = ifelse(fvar(2) < 0, -pi/2, pi/2)

[State 196, VelSet]
type = VelSet
trigger1 = 1
x = 7*cos(fvar(3))*facing
y = 7*sin(fvar(3))

[State 196, Explod]
type = Explod
trigger1 = time%2 = 0
anim = 20191 + 2*(root, var(23) != 0)
sprpriority = 2
bindtime = 1
removetime = -2
scale = root, const(size.xscale), root, const(size.yscale)

[State 196, AllPalFX]
type = AllPalFX
trigger1 = rootdist x - root, facing*2*(root, const(size.xscale)) = [-14, 14]
trigger1 = rootdist y - 57*(root, const(size.yscale)) = [-14, 14]
trigger2 = time = 119
add = 256, 256, 256
time = 1
persistent = 0

[State 196, RemoveExplod]
type = RemoveExplod
trigger1 = rootdist x - root, facing*2*(root, const(size.xscale)) = [-7, 7]
trigger1 = rootdist y - 57*(root, const(size.yscale)) = [-7, 7]
trigger2 = time = 120

[State 196, DestroySelf]
type = DestroySelf
trigger1 = rootdist x - root, facing*2*(root, const(size.xscale)) = [-7, 7]
trigger1 = rootdist y - 57*(root, const(size.yscale)) = [-7, 7]
trigger2 = time = 120

[Statedef 197]
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
;Commonly-used controllers:
velset = 0, 1.3			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 9999				;Change animation (Def: no change)

[State 197, ChangeState]
type = ChangeState
trigger1 = roundstate = 0
trigger1 = time
value = 197

[State 197, PosFreeze]
type = PosFreeze
trigger1 = time < 20

[State 197, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 1, 1

[State 197, DestroySelf]
type = DestroySelf
trigger1 = pos y > 0

;---------------------------------------------------------------------------
; Taunt
; CNS difficulty: easy
[Statedef 195]
type = S
ctrl = 0
anim = 180
velset = 0,0
movetype = I
physics = S

[State 195, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 180, 0
channel = 0

[State 195, ChangeState]
type = ChangeState
trigger1 = animtime = 0
value = 0

;---------------------------------------------------------------------------
; Magilis Sentinel

[Statedef 200]
type    = S                      ;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A                      ;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
;Commonly-used controllers:
anim = 200
velset = 0,0                     ;Set velocity (x,y) (Def: no change)
ctrl = 0                         ;Set ctrl (Def: no change)
poweradd = 30                    ;Power to add (Def: 0)
sprpriority = 1                  ;Set p1's sprite layering priority to 2 (in front)

[State 200, VarSet]
type = Null
triggerall = var(59) < 1
triggerall = time = 0
triggerall = command != "holddown"
trigger1 = command = "a"
trigger1 = var(0) := 1
trigger2 = command = "b"
trigger2 = var(0) := 2
trigger3 = command = "c"
trigger3 = var(0) := 3
trigger4 = command = "x"
trigger4 = var(0) := 4
trigger5 = command = "y"
trigger5 = var(0) := 5
trigger6 = command = "z"
trigger6 = var(0) := 6
trigger7 = var(0) := 0

[State 200, VarSet]
type = Null
triggerall = var(59) < 1
triggerall = time = 0
triggerall = command = "holddown"
trigger1 = command = "a"
trigger1 = var(0) := 7
trigger2 = command = "b"
trigger2 = var(0) := 8
trigger3 = command = "c"
trigger3 = var(0) := 3
trigger4 = command = "x"
trigger4 = var(0) := 9
trigger5 = command = "y"
trigger5 = var(0) := 10
trigger6 = command = "z"
trigger6 = var(0) := 6
trigger7 = var(0) := 0

[State 200, VarSet]
type = VarSet
trigger1 = time = 0
var(1) = 0

[State 200, 1]
type = HitDef
triggerall = var(22)
trigger1 = time = 0
attr = S, NA                     ;Attribute: Standing, Normal Attack
damage = 23, 0                   ;Damage that move inflicts, guard damage
animtype = Heavy                 ;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA                   ;Flags on how move is to be guarded against
hitflag = MA                    ;Flags of conditions that move can hit
;Hit/Miss/Dodge type (Def: Hit)
pausetime = 11, 11                 ;Time attacker pauses, time opponent shakes
sparkno = s7002				;Spark anim no (Def: set above)
guard.sparkno = s7006
sparkxy = -10, -95               ;X-offset for the "hit spark" rel. to p2,
;Y-offset for the spark rel. to p1
hitsound = s5, 2                  ;Sound to play on hit
guardsound = s6, 0                ;Sound to play on guard
ground.type = Low               ;Type: High, Low, Trip (def: Normal)
ground.slidetime = 22             ;Time that the opponent slides back
ground.hittime  = 22             ;Time opponent is in hit state
ground.velocity = -12.5             ;Velocity at which opponent is pushed
air.type = Low                  ;Type: High, Low, Trip (def: same as ground.type)
air.velocity = -3, -6.43
yaccel = .536
;Y-velocity at which opponent is pushed
air.hittime = 22                 ;Time before opponent regains control in air
fall.type = Low
id = 200

[State 200, 1]
type = HitDef
triggerall = !var(22)
trigger1 = time = 0
attr = S, NA                     ;Attribute: Standing, Normal Attack
damage = 23, 0                   ;Damage that move inflicts, guard damage
animtype = Heavy                 ;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA                   ;Flags on how move is to be guarded against
hitflag = MA                    ;Flags of conditions that move can hit
;Hit/Miss/Dodge type (Def: Hit)
pausetime = 11, 11                 ;Time attacker pauses, time opponent shakes
sparkno = 2				;Spark anim no (Def: set above)
guard.sparkno = 40
sparkxy = -10, -95               ;X-offset for the "hit spark" rel. to p2,
;Y-offset for the spark rel. to p1
hitsound = s5, 2                  ;Sound to play on hit
guardsound = s6, 0                ;Sound to play on guard
ground.type = Low               ;Type: High, Low, Trip (def: Normal)
ground.slidetime = 22             ;Time that the opponent slides back
ground.hittime  = 22             ;Time opponent is in hit state
ground.velocity = -12.5             ;Velocity at which opponent is pushed
air.type = Low                  ;Type: High, Low, Trip (def: same as ground.type)
air.velocity = -3, -6.43
yaccel = .536
;Y-velocity at which opponent is pushed
air.hittime = 22                 ;Time before opponent regains control in air
fall.type = Low
id = 200

[State 200, 1]
type = PlaySnd
trigger1 = Time = 0
value = 1100, 0
channel = 0

[State 200, VarSet]
type = VarSet
triggerall = !var(11)
triggerall = anim = 200
trigger1 = animelem = 2
trigger1 = var(0) = 1
trigger2 = animelemno(0) > 1
trigger2 = (command = "buffera" && command = "holda" && var(0) != 1) || command = "a"
trigger2 = command != "holddown"
var(9) = ifelse((helper(10001), stateno = [10000, 10001]), 4, 1)
ignorehitpause = 1

[State 200, VarSet]
type = VarSet
triggerall = !var(11)
triggerall = anim = 200
trigger1 = animelem = 2
trigger1 = var(0) = 4
trigger2 = animelemno(0) > 1
trigger2 = (command = "bufferx" && command = "holdx" && var(0) != 4) || command = "x"
trigger2 = command != "holddown"
var(9) = ifelse((helper(10000), stateno = [10000, 10001]), 1, 4)
ignorehitpause = 1

[State 200, VarSet]
type = VarSet
triggerall = !var(11)
triggerall = anim = 200
trigger1 = animelem = 2
trigger1 = var(0) = 2
trigger2 = animelemno(0) > 1
trigger2 = (command = "bufferb" && command = "holdb" && var(0) != 2) || command = "b"
trigger2 = command != "holddown"
var(9) = ifelse((helper(10001), stateno = [10000, 10001]), 5, 2)
ignorehitpause = 1

[State 200, VarSet]
type = VarSet
triggerall = !var(11)
triggerall = anim = 200
trigger1 = animelem = 2
trigger1 = var(0) = 5
trigger2 = animelemno(0) > 1
trigger2 = (command = "buffery" && command = "holdy" && var(0) != 5) || command = "y"
trigger2 = command != "holddown"
var(9) = ifelse((helper(10000), stateno = [10000, 10001]), 2, 5)
ignorehitpause = 1

[State 200, VarSet]
type = VarSet
triggerall = !var(11)
triggerall = anim = 200
trigger1 = animelem = 2
trigger1 = var(0) = 3
trigger2 = animelemno(0) > 1
trigger2 = (command = "bufferc" && command = "holdc" && var(0) != 3) || command = "c"
var(9) = ifelse((helper(10001), stateno = [10000, 10001]), 6, 3)
ignorehitpause = 1

[State 200, VarSet]
type = VarSet
triggerall = !var(11)
triggerall = anim = 200
trigger1 = animelem = 2
trigger1 = var(0) = 6
trigger2 = animelemno(0) > 1
trigger2 = (command = "bufferz" && command = "holdz" && var(0) != 6) || command = "z"
var(9) = ifelse((helper(10000), stateno = [10000, 10001]), 3, 6)
ignorehitpause = 1

[State 200, VarSet]
type = VarSet
triggerall = !var(11)
triggerall = anim = 200
trigger1 = animelem = 2
trigger1 = var(0) = 7
trigger2 = animelemno(0) > 1
trigger2 = (command = "buffery" && command = "holda" && var(0) != 7) || command = "a"
trigger2 = command = "holddown"
var(9) = ifelse((helper(10001), stateno = [10000, 10001]), 9, 7)
ignorehitpause = 1

[State 200, VarSet]
type = VarSet
triggerall = !var(11)
triggerall = anim = 200
trigger1 = animelem = 2
trigger1 = var(0) = 9
trigger2 = animelemno(0) > 1
trigger2 = (command = "bufferx" && command = "holdx" && var(0) != 9) || command = "x"
trigger2 = command = "holddown"
var(9) = ifelse((helper(10000), stateno = [10000, 10001]), 7, 9)
ignorehitpause = 1

[State 200, VarSet]
type = VarSet
triggerall = !var(11)
triggerall = anim = 200
trigger1 = animelem = 2
trigger1 = var(0) = 8
trigger2 = animelemno(0) > 1
trigger2 = (command = "bufferb" && command = "holdb" && var(0) != 8) || command = "b"
trigger2 = command = "holddown"
var(9) = ifelse((helper(10001), stateno = [10000, 10001]), 10, 8)
ignorehitpause = 1

[State 200, VarSet]
type = VarSet
triggerall = !var(11)
triggerall = anim = 200
trigger1 = animelem = 2
trigger1 = var(0) = 10
trigger2 = animelemno(0) > 1
trigger2 = (command = "buffery" && command = "holdy" && var(0) != 10) || command = "y"
trigger2 = command = "holddown"
var(9) = ifelse((helper(10000), stateno = [10000, 10001]), 8, 10)
ignorehitpause = 1

[State 200, ChangeAnim]
type = ChangeAnim
trigger1 = anim = 200
trigger1 = animelemno(0) > 4
trigger1 = helper(10000), movetype != A
trigger1 = helper(10001), movetype != A
value = 201

[State 200, VarSet]
type = VarSet
triggerall = var(1)
trigger1 = var(9) = [1, 3]
trigger1 = var(1)%2 = 0
trigger2 = var(9) = [4, 6]
trigger2 = var(1)%3 = 0
trigger3 = var(9) = [7, 8]
trigger3 = var(1)%2 = 0
trigger4 = var(9) = [9, 10]
trigger4 = var(1)%3 = 0
var(9) = 0

[State 200, VarSet]
type = VarSet
trigger1 = (var(9) = [1, 3]) || var(9) = [7, 8]
trigger1 = helper(10000), stateno != [10000, 10001]
trigger2 = (var(9) = [4, 6]) || var(9) = [9, 10]
trigger2 = helper(10001), stateno != [10000, 10001]
var(9) = 0

[State 200, VarSet]
type = VarSet
triggerall = var(1) != 6
trigger1 = var(9) = 7
trigger2 = var(9) = 9
var(1) = 6

[State 200, VarSet]
type = VarSet
triggerall = var(1) != 6
trigger1 = var(9) = [1, 3]
trigger2 = var(9) = [7, 8]
var(1) = ifelse(var(1) = 3, 6, 2)

[State 200, VarSet]
type = VarSet
triggerall = var(1) != 6
trigger1 = var(9) = [4, 6]
trigger2 = var(9) = [9, 10]
var(1) = ifelse(var(1) = 2, 6, 3)

[State 200, 7]
type = ChangeState
trigger1 = anim = 201
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Perish Lightning (Horizontal)

[Statedef 1000]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 1000				;Change animation (Def: no change)
poweradd = 90			;Power to add (Def: 0)
sprpriority = 1			;Set layering priority to 2 (in front)

[State 1000, PlaySnd]
type = PlaySnd
trigger1 = animelem = 2
value = 1100, 0
channel = 0

[State 1000, Helper]
type = Helper
trigger1 = time = 13
name = "beam"
id = 1001
stateno = 1001
pos = floor(115*const(size.xscale)), floor(-87*const(size.yscale))
ownpal = 1

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

[Statedef 1001]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;Move-type: A-attack, I-idle, H-gethit
physics = N				;Physics: S-stand, C-crouch, A-air
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = 2			;Set layering priority to 2 (in front)
hitdefpersist = 1
movehitpersist = 1
hitcountpersist = 1

[State 1001, PlaySnd]
type = PlaySnd
trigger1 = !anim
value = 1000, 0

[State 1001, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 1001 + (root, var(23) != 0)
value = 1001 + (root, var(23) != 0)

[State 1001, SprPriority]
type = SprPriority
trigger1 = 1
value = 2

[State 1001, BindToParent]
type = BindToParent
trigger1 = 1
pos = floor(115*const(size.xscale)), floor(-87*const(size.yscale))

[State 1001, HitOverride]
type = HitOverride
trigger1 = 1
stateno = 1001
attr = SCA, AA, AP, AT
time = -1

[State 1001, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = -1

[State 1001, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow

[State 1001, HitDef]
type = HitDef
triggerall = root, var(22)
trigger1 = !movecontact && !movereversed
trigger2 = movecontact = 12 && !movereversed
trigger3 = movereversed = 12 && !movecontact
attr = S, SP			;Attribute: Standing, Normal Attack
damage = ifelse(!hitcount,80,ifelse(hitcount=1,50,30)),ifelse(!hitcount,8,ifelse(hitcount=1,5,3))
animtype = diagup			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA			;Flags on how move is to be guarded against
hitflag = MAF			;Flags of conditions that move can hit
pausetime = 0, 5			;Time attacker pauses, time opponent shakes
sparkno = s7002				;Spark anim no (Def: set above)
guard.sparkno = s7006
sparkxy = -10, 0		;X-offset for the "hit spark" rel. to p2,
					;Y-offset for the spark rel. to p1
hitsound = s5, 2			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = High		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 22		;Time that the opponent slides back
ground.hittime  = 22		;Time opponent is in hit state
ground.velocity = -5, -4.99		;Velocity at which opponent is pushed
guard.velocity = -10
guard.dist = 320
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
air.type = Low
yaccel = .536
air.hittime = 22			;Time before opponent regains control in air
fall = 1
fall.recover = 0
palfx.time = 50
palfx.color = 0
palfx.invertall = 1
palfx.mul = 256,256,256
palfx.add = -64,-96,-160
palfx.sinadd = 64,96,128, 10
sprpriority = 2

[State 1001, HitDef]
type = HitDef
triggerall = !root, var(22)
trigger1 = !movecontact && !movereversed
trigger2 = movecontact = 12 && !movereversed
trigger3 = movereversed = 12 && !movecontact
attr = S, SP			;Attribute: Standing, Normal Attack
damage = ifelse(!hitcount,80,ifelse(hitcount=1,50,30)),ifelse(!hitcount,8,ifelse(hitcount=1,5,3))
animtype = diagup			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA			;Flags on how move is to be guarded against
hitflag = MAF			;Flags of conditions that move can hit
pausetime = 0, 5			;Time attacker pauses, time opponent shakes
sparkno = 3				;Spark anim no (Def: set above)
guard.sparkno = 40
sparkxy = -10, 0		;X-offset for the "hit spark" rel. to p2,
					;Y-offset for the spark rel. to p1
hitsound = s5, 2			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = High		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 22		;Time that the opponent slides back
ground.hittime  = 22		;Time opponent is in hit state
ground.velocity = -5, -4.99		;Velocity at which opponent is pushed
guard.velocity = -10
guard.dist = 320
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
air.type = Low
yaccel = .536
air.hittime = 22			;Time before opponent regains control in air
fall = 1
fall.recover = 0
palfx.time = 50
palfx.color = 0
palfx.invertall = 1
palfx.mul = 256,256,256
palfx.add = -64,-96,-160
palfx.sinadd = 64,96,128, 10
sprpriority = 2

[State 1001, Shock]
type = Explod
trigger1 = movehit = 1
trigger1 = numtarget
id = 7070
anim = 7070 + random%5
sprpriority = 2
postype = p2
bindtime = -1
pos = 0, enemynear, const(size.mid.pos.y)
random = floor((enemynear, const(size.ground.front)+enemynear, const(size.ground.back))*(hitcount != 0)*0.4), floor((enemynear, const(size.mid.pos.y)-enemynear, const(size.head.pos.y))*(hitcount != 0)*0.8)

[State 1001, PlaySnd]
type = PlaySnd
trigger1 = movehit = 1
trigger1 = numtarget
value = 5, 10
ignorehitpause = 1

[State 1001, DestroySelf]
type = DestroySelf
trigger1 = AnimTime = 0
trigger2 = root, stateno != 1000
trigger3 = root, movetype != A
trigger4 = root, statetype != S

;---------------------------------------------------------------------------
; Perish Lightning (Diagonal)

[Statedef 1010]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 1010				;Change animation (Def: no change)
poweradd = 90			;Power to add (Def: 0)
sprpriority = 1			;Set layering priority to 2 (in front)

[State 1010, PlaySnd]
type = PlaySnd
trigger1 = animelem = 2
value = 1100, 0
channel = 0

[State 1010, Helper]
type = Helper
trigger1 = time = 9
name = "beam"
id = 1011
stateno = 1011
pos = floor(99*const(size.xscale)), floor(-141*const(size.yscale))
ownpal = 1

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

[Statedef 1011]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;Move-type: A-attack, I-idle, H-gethit
physics = N				;Physics: S-stand, C-crouch, A-air
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = 2			;Set layering priority to 2 (in front)
hitdefpersist = 1
movehitpersist = 1
hitcountpersist = 1

[State 1011, PlaySnd]
type = PlaySnd
trigger1 = !anim
value = 1000, 0

[State 1011, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 1011 + (root, var(23) != 0)
value = 1011 + (root, var(23) != 0)

[State 1011, SprPriority]
type = SprPriority
trigger1 = 1
value = 2

[State 1011, BindToParent]
type = BindToParent
trigger1 = 1
pos = floor(99*const(size.xscale)), floor(-141*const(size.yscale))

[State 1011, HitOverride]
type = HitOverride
trigger1 = 1
stateno = 1011
attr = SCA, AA, AP, AT
time = -1

[State 1011, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = -1

[State 1011, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow

[State 1011, HitDef]
type = HitDef
triggerall = hitcount < 3
trigger1 = !movecontact && !movereversed
trigger2 = movecontact > 11 && !movereversed
trigger3 = movereversed > 11 && !movecontact
attr = S, SP			;Attribute: Standing, Normal Attack
damage = ifelse(!hitcount,30,ifelse(hitcount=1,50,30)),ifelse(!hitcount,3,ifelse(hitcount=1,5,3))
animtype = diagup			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA			;Flags on how move is to be guarded against
hitflag = MAF			;Flags of conditions that move can hit
pausetime = 0, 5			;Time attacker pauses, time opponent shakes
sparkno = -1				;Spark anim no (Def: set above)
guard.sparkno = -1
sparkxy = 0, 0		;X-offset for the "hit spark" rel. to p2,
					;Y-offset for the spark rel. to p1
hitsound = s5, 2			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = High		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 22		;Time that the opponent slides back
ground.hittime  = 22		;Time opponent is in hit state
ground.velocity = -3, -7.5		;Velocity at which opponent is pushed
guard.velocity = -10
guard.dist = 320
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
air.type = Low
yaccel = .536
air.hittime = 22			;Time before opponent regains control in air
fall = 1
fall.recover = 0
palfx.time = 50
palfx.color = 0
palfx.invertall = 1
palfx.mul = 256,256,256
palfx.add = -64,-96,-160
palfx.sinadd = 64,96,128, 10
sprpriority = 2

[State 1011, Spark]
type = Explod
triggerall = root, var(22)
trigger1 = movehit = 1
id = 7002
anim = 7002
sprpriority = 3
postype = p1
bindtime = 1
pos = floor((p2dist x - 10)*const(size.xscale)), -floor(((p2dist x - 11)*0.55 + 1)*const(size.yscale))
supermovetime = 99999
pausemovetime = 99999
ownpal = 1

[State 1011, Spark]
type = Explod
triggerall = root, var(22)
trigger1 = moveguarded = 1
id = 7006
anim = 7006
sprpriority = 2
postype = p1
bindtime = 1
pos = floor((p2dist x + 10)*const(size.xscale)), -floor(((p2dist x - 11)*0.55 + 1)*const(size.yscale))
supermovetime = 99999
pausemovetime = 99999
ownpal = 1

[State 1011, Spark]
type = Explod
triggerall = !root, var(22)
trigger1 = movehit = 1
id = 7002
anim = F3
sprpriority = 3
postype = p1
bindtime = 1
pos = floor((p2dist x - 10)*const(size.xscale)), -floor(((p2dist x - 11)*0.55 + 1)*const(size.yscale))
supermovetime = 99999
pausemovetime = 99999
ownpal = 1

[State 1011, Spark]
type = Explod
triggerall = !root, var(22)
trigger1 = moveguarded = 1
id = 7006
anim = F40
sprpriority = 2
postype = p1
bindtime = 1
pos = floor((p2dist x + 10)*const(size.xscale)), -floor(((p2dist x - 11)*0.55 + 1)*const(size.yscale))
supermovetime = 99999
pausemovetime = 99999
ownpal = 1

[State 1011, Shock]
type = Explod
trigger1 = movehit = 1
trigger1 = numtarget
id = 7070
anim = 7070 + random%5
sprpriority = 2
postype = p2
bindtime = -1
pos = 0, enemynear, const(size.mid.pos.y)
random = floor((enemynear, const(size.ground.front)+enemynear, const(size.ground.back))*(hitcount != 0)*0.4), floor((enemynear, const(size.mid.pos.y)-enemynear, const(size.head.pos.y))*(hitcount != 0)*0.8)

[State 1011, PlaySnd]
type = PlaySnd
trigger1 = movehit = 1
trigger1 = numtarget
value = 5, 10
ignorehitpause = 1

[State 1011, DestroySelf]
type = DestroySelf
trigger1 = AnimTime = 0
trigger2 = root, stateno != 1010
trigger3 = root, movetype != A
trigger4 = root, statetype != S

;---------------------------------------------------------------------------
; Forbidden Viper

[Statedef 1100]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 1100				;Change animation (Def: no change)
poweradd = 110			;Power to add (Def: 0)
sprpriority = 1			;Set layering priority to 2 (in front)

[State 1100, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 1100, 0
channel = 0

[State 1100, Helper]
type = Helper
trigger1 = time = 28
name = "portal"
id = 1101
stateno = 1101
pos = floor(30*const(size.xscale)), floor(6*const(size.yscale))
ownpal = 1

[State 1100, Helper]
type = Helper
trigger1 = time = 46
name = "viper"
id = 1102
stateno = 1102
pos = floor(62*const(size.xscale)), floor(6*const(size.yscale))
ownpal = 1

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

;Portal
[Statedef 1101] 
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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 21100 + 10*(root, var(23) != 0)
sprpriority = -2

[State 1101, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 1100, 1

[State 1101, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow

[State 1101, Explod]
type = Explod
triggerall = time > 21
trigger1 = time%36 = 22
trigger2 = time%36 = 7
id = 21101
anim = 21101 + 10*(root, var(23) != 0)
sprpriority = -2
postype = p1
bindtime = 1
scale = root, const(size.xscale), root, const(size.yscale)

[State 1101, DestroySelf]
type = DestroySelf
trigger1 = time > 115
trigger2 = parent, movetype = H
trigger2 = parent, stateno != [120, 155]

; Viper
[Statedef 1102]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;Move-type: A-attack, I-idle, H-gethit
physics = N				;Physics: S-stand, C-crouch, A-air
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = 2			;Set layering priority to 2 (in front)
hitdefpersist = 1
movehitpersist = 1
hitcountpersist = 1

[State 1102, VarSet]
type = VarSet
trigger1 = anim != [21103, 21104]
trigger1 = !parent, ishelper
var(0) = 1

[State 1102, VarSet]
type = VarSet
triggerall = anim != [21103, 21104]
triggerall = parent, ishelper
trigger1 = !parent, var(0)
trigger2 = parent, animelemno(0) > 6
var(1) = parent, var(1) + 1

[State 1102, VarSet]
type = VarSet
triggerall = anim != [21103, 21104]
trigger1 = var(0)
trigger2 = parent, var(2)
trigger2 = parent, animelemno(0) > 6
var(2) = 1

[State 1102, VarSet]
type = VarSet
trigger1 = anim != [21103, 21104]
var(3) = ifelse(pos y < 0, -1, ifelse(var(2), 0, 1))

[State 1102, ChangeAnim]
type = ChangeAnim
trigger1 = anim != [21103, 21104]
value = 21103 + (root, var(21) != 0)

[State 1102, Explod]
type = Explod
triggerall = animelem = 1
trigger1 = !parent, ishelper
trigger2 = parent, var(0)
trigger2 = parent, animelem = 2, = 1
id = 21102
anim = 21102 + 10*(root, var(23) != 0)
postype = p1
bindtime = 1
sprpriority = -3 + var(3)
scale = root, const(size.xscale), root, const(size.yscale)

[State 1102, PlaySnd]
type = PlaySnd
trigger1 = animelem = 2
trigger1 = var(2)
value = 1100, 2

[State 1102, SprPriority]
type = SprPriority
trigger1 = time = 0
value = 1 + var(3)

[State 1102, HitOverride]
type = HitOverride
trigger1 = 1
stateno = 1102
attr = SCA, AA, AP, AT
time = -1

[State 1102, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = -1

[State 1102, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow

[State 1102, HitDef]
type = HitDef
triggerall = root, var(22)
trigger1 = !movecontact && !movereversed
attr = S, SA			;Attribute: Standing, Normal Attack
damage = 85, 6
animtype = Back			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = L			;Flags on how move is to be guarded against
hitflag = MA			;Flags of conditions that move can hit
pausetime = 0, ifelse(!var(2) || animelemno(0) > 4, 3, 11)
sparkno = s7002				;Spark anim no (Def: set above)
guard.sparkno = s7006
sparkxy = -10, -25		;X-offset for the "hit spark" rel. to p2,
					;Y-offset for the spark rel. to p1
hitsound = s5, 2			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = Trip		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 22		;Time that the opponent slides back
ground.hittime  = 22		;Time opponent is in hit state
ground.velocity = 0, -7.5		;Velocity at which opponent is pushed
guard.velocity = -15
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = 0, -7.5		;X-velocity at which opponent is pushed,
air.type = Trip
yaccel = .536
air.hittime = 22			;Time before opponent regains control in air
fall = 1
fall.recover = 0
sprpriority = 1 + var(3)

[State 1102, HitDef]
type = HitDef
triggerall = !root, var(22)
trigger1 = !movecontact && !movereversed
attr = S, SA			;Attribute: Standing, Normal Attack
damage = 85, 6
animtype = Back			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = L			;Flags on how move is to be guarded against
hitflag = MA			;Flags of conditions that move can hit
pausetime = 0, ifelse(!var(2) || animelemno(0) > 4, 3, 11)
sparkno = 2				;Spark anim no (Def: set above)
guard.sparkno = 40
sparkxy = -10, -25		;X-offset for the "hit spark" rel. to p2,
					;Y-offset for the spark rel. to p1
hitsound = s5, 2			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = Trip		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 22		;Time that the opponent slides back
ground.hittime  = 22		;Time opponent is in hit state
ground.velocity = 0, -7.5		;Velocity at which opponent is pushed
guard.velocity = -15
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = 0, -7.5		;X-velocity at which opponent is pushed,
air.type = Trip
yaccel = .536
air.hittime = 22			;Time before opponent regains control in air
fall = 1
fall.recover = 0
sprpriority = 1 + var(3)

[State 1110, Helper]
type = Helper
triggerall = var(0)
triggerall = parent, stateno = 1100
triggerall = parent, movetype = A
triggerall = parent, statetype = S
trigger1 = animelem = 2, = 1
name = "viper2"
id = 1103
stateno = 1102
pos = floor(32*root, const(size.xscale)), floor(-16*root, const(size.yscale))
ownpal = 1

[State 1110, Helper]
type = Helper
triggerall = var(0)
triggerall = parent, stateno = 1100
triggerall = parent, movetype = A
triggerall = parent, statetype = S
trigger1 = animelem = 2, = 1
name = "viper3"
id = 1104
stateno = 1102
pos = 0, floor(16*root, const(size.yscale))
ownpal = 1

[State 1110, Helper]
type = Helper
triggerall = var(1) < 3
trigger1 = animelem = 7, = 2
name = "viper"
id = 1102
stateno = 1102
pos = floor(ifelse(root, var(21), 161, 124)*root, const(size.xscale)), 0
ownpal = 1

[State 1102, DestroySelf]
type = DestroySelf
trigger1 = animtime = 0

;---------------------------------------------------------------------------
; Emnity Malice

[Statedef 1200]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 1200				;Change animation (Def: no change)
poweradd = 100			;Power to add (Def: 0)
sprpriority = 1			;Set layering priority to 2 (in front)

[State 1200, Explod]
type = Explod
trigger1 = animelem = 1
id = 1201
anim = 1201
sprpriority = 1
postype = p1
bindtime = -1
ownpal = 1
scale = const(size.xscale), const(size.yscale)
removeongethit = 1

[State 1200, RemoveExplod]
type = RemoveExplod
trigger1 = animtime = 0
id = 1201

[State 1200, Helper]
type = Helper
trigger1 = animelem = 6, = 1
name = "ghostproj"
id = 1201
stateno = 1201
pos = floor(75*const(size.xscale)), floor(-73*const(size.yscale))
ownpal = 1

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

[Statedef 1201]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;Move-type: A-attack, I-idle, H-gethit
physics = N				;Physics: S-stand, C-crouch, A-air
;Commonly-used controllers:
velset = 3.5,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = 2			;Set layering priority to 2 (in front)
hitdefpersist = 1
movehitpersist = 1
hitcountpersist = 1

[State 1201, PlaySnd]
type = PlaySnd
trigger1 = !prevstateno
trigger1 = time = 0
value = 1200, 0

[State 1201, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 21200 + 10*(root, var(23) != 0)
value = 21200 + 10*(root, var(23) != 0)

[State 1201, SprPriority]
type = SprPriority
trigger1 = 1
value = 2

[State 1201, VelSet]
type = VelSet
trigger1 = 1
x = 3.5

[State 1201, HitOverride]
type = HitOverride
trigger1 = 1
stateno = 1201
attr = SCA, AA, AP, AT
time = -1

[State 1201, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = -1

[State 1201, Explod]
type = Explod
trigger1 = !movecontact && !movereversed
trigger1 = random < 100
trigger2 = movecontact = 1
trigger3 = movereversed = 1
id = 21201
anim = 21201 + random%2 + 10*(root, var(23) != 0)
sprpriority = 1
postype = p1
bindtime = 1
vel = (random - 500)*0.001, (random - 500)*0.001
scale = root, const(size.xscale), root, const(size.yscale)

[State 1201, Explod]
type = Explod
trigger1 = movecontact = 1
trigger2 = movereversed = 1
id = 21201
anim = 21201 + random%2 + 10*(root, var(23) != 0)
sprpriority = 1
postype = p1
bindtime = 1
vel = (random - 500)*0.001, (random - 500)*0.001
scale = root, const(size.xscale), root, const(size.yscale)

[State 1201, HitDef]
type = HitDef
triggerall = root, var(22)
trigger1 = !movecontact && !movereversed
attr = S, SP			;Attribute: Standing, Normal Attack
damage = 20, 5
animtype = Up			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA			;Flags on how move is to be guarded against
hitflag = MAF			;Flags of conditions that move can hit
pausetime = 0, 3			;Time attacker pauses, time opponent shakes
sparkno = s7000				;Spark anim no (Def: set above)
guard.sparkno = s7006
sparkxy = -10, 0		;X-offset for the "hit spark" rel. to p2,
					;Y-offset for the spark rel. to p1
hitsound = s5, 0			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = low		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 16		;Time that the opponent slides back
ground.hittime  = 16		;Time opponent is in hit state
ground.velocity = -5, -7.5		;Velocity at which opponent is pushed
guard.velocity = -10
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
yaccel = .536
air.hittime = 22			;Time before opponent regains control in air
air.type = low
fall = 1
fall.animtype = light
fall.recover = 0
sprpriority = 2
p2stateno = 25000

[State 1201, HitDef]
type = HitDef
triggerall = !root, var(22)
trigger1 = !movecontact && !movereversed
attr = S, SP			;Attribute: Standing, Normal Attack
damage = 20, 5
animtype = Up			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA			;Flags on how move is to be guarded against
hitflag = MAF			;Flags of conditions that move can hit
pausetime = 0, 3			;Time attacker pauses, time opponent shakes
sparkno = 0				;Spark anim no (Def: set above)
guard.sparkno = 40
sparkxy = -10, 0		;X-offset for the "hit spark" rel. to p2,
					;Y-offset for the spark rel. to p1
hitsound = s5, 0			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = low		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 16		;Time that the opponent slides back
ground.hittime  = 16		;Time opponent is in hit state
ground.velocity = -5, -7.5		;Velocity at which opponent is pushed
guard.velocity = -10
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
yaccel = .536
air.hittime = 22			;Time before opponent regains control in air
air.type = low
fall = 1
fall.animtype = light
fall.recover = 0
sprpriority = 2
p2stateno = 25000

[State 1201, Helper]
type = Helper
trigger1 = moveguarded = 1
trigger2 = movereversed = 1
name = "ghostprojfade"
id = 1202
stateno = 1202
ownpal = 1

[State 1201, Explod]
type = Explod
trigger1 = movehit = 1
id = 21203
anim = 21203 + 10*(root, var(23) != 0)
sprpriority = 2
postype = p1
bindtime = 1
scale = root, const(size.xscale), root, const(size.yscale)

[State 1201, ChangeState]
type = ChangeState
trigger1 = movehit = 2
value = 1203

[State 1201, DestroySelf]
type = DestroySelf
trigger1 = frontedgedist < -50
trigger2 = moveguarded = 2
trigger3 = movereversed = 2

[State 1201, Invis]
type = AssertSpecial
trigger1 = movecontact || movereversed
flag = Invisible

[Statedef 1202]
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
velset = 1,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = 2			;Set layering priority to 2 (in front)

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

[State 1202, VarSet]
type = VarSet
trigger1 = time = 0
var(0) = parent, animelemno(0)

[State 1202, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 21200 + 10*(root, var(23) != 0)
elem = var(0)

[State 1202, Trans]
type = Trans
trigger1 = root, var(23)
trans = addalpha
alpha = 256 - time*4, time*4

[State 1202, DestroySelf]
type = DestroySelf
trigger1 = time > 62

[State 1202, AngleDraw]
type = AngleDraw
trigger1 = 1
scale = (63 - time)/63.0, (63 - time)/63.0

[Statedef 1203]
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
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)

[State 1203, Invis]
type = AssertSpecial
trigger1 = 1
flag = Invisible

[State 1203, VarSet]
type = VarSet
trigger1 = !time
var(4) = -1

[State 1203, VarSet]
type = VarSet
trigger1 = !time
trigger1 = numtarget
trigger1 = numenemy
trigger1 = target, id = enemy(0), id
var(4) = 0

[State 1203, VarSet]
type = VarSet
trigger1 = !time
trigger1 = numtarget
trigger1 = numenemy > 1
trigger1 = target, id = enemy(1), id
var(4) = 1

[State 1203, PosSet]
type = PosSet
trigger1 = var(4) != -1
x = enemy(var(4)), pos x
y = enemy(var(4)), pos y

[State 1203, PosSet]
type = PosSet
triggerall = var(4) = -1
trigger1 = time = 0
trigger1 = numtarget
trigger1 = !target, ishelper
x = target, pos x
y = target, pos y

[State 1203, PosAdd]
type = PosAdd
triggerall = var(4) = -1
trigger1 = time
trigger2 = !numtarget
trigger3 = target, ishelper
x = p2dist x
y = p2dist y

[State 1203, PosSet]
type = PosSet
trigger1 = pos y > 0
y = 0

[State 1203, PosSet]
type = PosAdd
trigger1 = 1
y = -50

[State 1203, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 5300, 0
channel = 1
loop = 1

[State 1203, VarSet]
type = VarSet
trigger1 = time = 0
var(3) = floor(enemynear, const(size.head.pos.y)) + 30

[State 1203, Helper]
type = Helper
trigger1 = time = 0
trigger1 = !var(2)
name = "stars"
id = 1209
stateno = 1209
ownpal = 1

[State 1203, Helper]
type = Helper
trigger1 = time = 12
trigger1 = !var(2)
name = "ghost"
id = 1204
stateno = 1204
ownpal = 1

[State 1203, Helper]
type = Helper
trigger1 = time = 12
trigger1 = !var(2)
name = "ghost"
id = 1205
stateno = 1205
ownpal = 1

[State 1203, Helper]
type = Helper
trigger1 = time = 12
trigger1 = !var(2)
name = "ghost"
id = 1206
stateno = 1206
ownpal = 1

[State 1203, Helper]
type = Helper
trigger1 = time = 12
trigger1 = !var(2)
name = "ghost"
id = 1207
stateno = 1207
ownpal = 1

[State 1203, VarSet]
type = VarSet
triggerall = var(4)  != -1
trigger1 = !var(2)
trigger1 = enemy(var(4)), stateno = 25300
var(1) = 1

[State 1203, VarAdd]
type = VarAdd
triggerall = time
triggerall = var(4) != -1
trigger1 = !var(1)
trigger1 = enemy(var(4)), movetype != H || enemy(var(4)), stateno < 25000 || !enemy(var(4)), alive
trigger2 = var(1)
trigger2 = enemy(var(4)), anim != 5300 || enemy(var(4)), stateno != 25300 || enemy(var(4)), movetype != I || enemy(var(4)), statetype != S
trigger3 = var(2)
var(2) = 1

[State 1203, VarSet]
type = VarSet
triggerall = var(4) = -1
trigger1 = !var(2)
trigger1 = enemynear, stateno = 25300
var(1) = 1

[State 1203, VarAdd]
type = VarAdd
triggerall = numtarget
triggerall = time
triggerall = var(4) = -1
trigger1 = !var(1)
trigger1 = target, movetype != H || target, stateno < 25000 || !target, alive
trigger2 = var(1)
trigger2 = target, anim != 5300 || target, stateno != 25300 || target, movetype != I || target, statetype != S
trigger3 = var(2)
var(2) = 1

[State 1203, VarAdd]
type = VarAdd
triggerall = !numtarget
triggerall = var(4) = -1
trigger1 = !var(1)
trigger1 = p2movetype != H || enemynear, stateno < 25000 || !enemynear, alive
trigger2 = var(1)
trigger2 = enemynear, anim != 5300 || enemynear, stateno != 25300 || p2movetype != I || p2statetype != S
trigger3 = var(2)
var(2) = 1

[State 1203, StopSnd]
type = StopSnd
trigger1 = var(2) = 1
channel = 1

[State 1203, DestroySelf]
type = DestroySelf
trigger1 = var(2) > 30

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

[State 1204, VarSet]
type = VarSet
trigger1 = time = 0
var(0) = 350

[State 1204, VarSet]
type = VarSet
trigger1 = time = 0
fvar(0) = var(0)*pi/180

[State 1204, Bind]
type = BindToParent
trigger1 = 1
pos = -floor(sin(fvar(0))*80), -floor(cos(fvar(0))*20)

[State 1204, Explod]
type = Explod
trigger1 = time = 0
id = 21203
anim = 21203 + 10*(root, var(23) != 0)
sprpriority = 0
postype = p1
bindtime = 13
scale = root, const(size.xscale), root, const(size.yscale)

[State 1204, ChangeState]
type = ChangeState
trigger1 = time = 12
value = 1208

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

[State 1205, VarSet]
type = VarSet
trigger1 = time = 0
var(0) = 80

[State 1205, VarSet]
type = VarSet
trigger1 = time = 0
fvar(0) = var(0)*pi/180

[State 1205, Bind]
type = BindToParent
trigger1 = 1
pos = -floor(sin(fvar(0))*80), -floor(cos(fvar(0))*20)

[State 1205, Explod]
type = Explod
trigger1 = time = 0
id = 21203
anim = 21203 + 10*(root, var(23) != 0)
sprpriority = 0
postype = p1
bindtime = 13
scale = root, const(size.xscale), root, const(size.yscale)

[State 1205, ChangeState]
type = ChangeState
trigger1 = time = 12
value = 1208

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

[State 1206, VarSet]
type = VarSet
trigger1 = time = 0
var(0) = 170

[State 1206, VarSet]
type = VarSet
trigger1 = time = 0
fvar(0) = var(0)*pi/180

[State 1206, Bind]
type = BindToParent
trigger1 = 1
pos = -floor(sin(fvar(0))*80), -floor(cos(fvar(0))*20)

[State 1206, Explod]
type = Explod
trigger1 = time = 0
id = 21203
anim = 21203 + 10*(root, var(23) != 0)
sprpriority = 2
postype = p1
bindtime = 13
scale = root, const(size.xscale), root, const(size.yscale)

[State 1206, ChangeState]
type = ChangeState
trigger1 = time = 12
value = 1208

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

[State 1207, VarSet]
type = VarSet
trigger1 = time = 0
var(0) = 260

[State 1207, VarSet]
type = VarSet
trigger1 = time = 0
fvar(0) = var(0)*pi/180

[State 1207, Bind]
type = BindToParent
trigger1 = 1
pos = -floor(sin(fvar(0))*80), -floor(cos(fvar(0))*20)

[State 1207, Explod]
type = Explod
trigger1 = time = 0
id = 21203
anim = 21203 + 10*(root, var(23) != 0)
sprpriority = 2
postype = p1
bindtime = 13
scale = root, const(size.xscale), root, const(size.yscale)

[State 1207, ChangeState]
type = ChangeState
trigger1 = time = 12
value = 1208

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

[State 1208, VarSet]
type = VarSet
trigger1 = 1
var(1) = (time*360)/200 + var(0)

[State 1208, VarSet]
type = VarSet
trigger1 = 1
var(1) = var(1)%360

[State 1208, VarSet]
type = VarSet
trigger1 = 1
fvar(0) = var(1)*pi/180

[State 1208, Bind]
type = BindToParent
trigger1 = 1
pos = -floor(sin(fvar(0))*80), -floor(cos(fvar(0))*20)

[State 1208, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 21205 + 10*(root, var(23) != 0)
value = 21204
elem = ifelse(var(1)<45,1,ifelse(var(1)<90,2,ifelse(var(1)<135,3,ifelse(var(1)<225,4,ifelse(var(1)<270,5,ifelse(var(1)<315,6,1))))))

[State 1208, SprPriority]
type = SprPriority
trigger1 = 1
value = ifelse((var(1)=[90,270]), 1, -1)

[State 1208, ChangeAnim]
type = ChangeAnim
trigger1 = parent, var(2)
trigger1 = anim != 21205 + 10*(root, var(23) != 0)
value = 21205 + 10*(root, var(23) != 0)

[State 1208, Trans]
type = Trans
trigger1 = root, var(23)
trigger1 = anim = 21204
trans = addalpha
alpha = floor(192 - sin(time*0.1 + 2)*64), floor(64 + sin(time*0.1 + 2)*64)

[State 1208]
type = DestroySelf
trigger1 = animtime = 0

[StateDef 1209]
type = S
movetype = I
physics = N
ctrl = 0
anim = 21206
sprpriority = 1

[State 1209, Bind]
type = BindToParent
trigger1 = 1
pos = 0, parent, var(3)

[State 1209, DestroySelf]
type = DestroySelf
trigger1 = parent, var(2) > 29

[State 1209, AngleDraw]
type = AngleDraw
trigger1 = time < 30
scale = time/30.0, time/30.0

[State 1209, AngleDraw]
type = AngleDraw
trigger1 = parent, var(2)
scale = (30 - parent, var(2))/30.0, (30 - parent, var(2))/30.0


;---------------------------------------------------------------------------
; Teleport Start

[Statedef 1300]
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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 9999				;Change animation (Def: no change)
sprpriority = 1			;Set layering priority to 2 (in front)

[State 1300, Explod]
type = Explod
trigger1 = time = 0
id = 1300
anim = 1300 + 2*(var(23) != 0)
sprpriority = 0
bindtime = 1
ownpal = 1
scale = const(size.xscale), const(size.yscale)

[State 1300, Helper]
type = Helper
trigger1 = time = 0
name = "teleportstartimage"
id = 1310
stateno = 1310
ownpal = 1

[State 1300, Button]
type = Null
triggerall = var(59) < 1
triggerall = time = 0
trigger1 = command = "Teleporta"
trigger1 = var(0) := 1
trigger2 = command = "Teleportb"
trigger2 = var(0) := 2
trigger3 = command = "Teleportc"
trigger3 = var(0) := 3
trigger4 = command = "Teleportx"
trigger4 = var(0) := 4
trigger5 = command = "Teleporty"
trigger5 = var(0) := 5
trigger6 = command = "Teleportz"
trigger6 = var(0) := 6
trigger7 = var(0) := 0

[State 1300, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 0
movecamera = ifelse(time < 2, 1, 0), 0

[State 1300, PosSet]
type = PosSet
trigger1 = time = 1
y = 0

[State 1300, VarSet]
type = VarSet
triggerall = time = 1
trigger1 = var(0) = 1
var(1) = floor(P2Dist x - 50)

[State 1300, VarSet]
type = VarSet
triggerall = time = 1
trigger1 = var(0) = 2
var(1) = floor(P2Dist x - 150)

[State 1300, VarSet]
type = VarSet
triggerall = time = 1
trigger1 = var(0) = 3
var(1) = floor(P2Dist x - 260)

[State 1300, VarSet]
type = VarSet
triggerall = time = 1
trigger1 = var(0) = 4
var(1) = floor(P2Dist x + 50)

[State 1300, VarSet]
type = VarSet
triggerall = time = 1
trigger1 = var(0) = 5
var(1) = floor(P2Dist x + 150)

[State 1300, VarSet]
type = VarSet
triggerall = time = 1
trigger1 = var(0) = 6
var(1) = floor(P2Dist x + 250)

[State 1300, Helper]
type = Helper
trigger1 = time = 1
name = "screenbounder"
id = 1301
stateno = 1301
ownpal = 1
pos = var(1), 0

[State 1300, PosAdd]
type = PosAdd
trigger1 = time = 36
x = -helper(1301), rootdist x

[State 1300, ChangeState]
type = ChangeState
trigger1 = time = 36
value = 1350
ctrl = 1


;---------------------------------------------------------------------------
; Screenbound Helper
[Statedef 1301]
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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 9999				;Change animation (Def: no change)

[State 1301, VarSet]
type = VarSet
trigger1 = time = 0
var(1) = root, var(1)

[State 1301, PosAdd]
type = PosAdd
triggerall = var(1)
trigger1 = root, stateno != 1350
trigger1 = root, time < 30
x = rootdist x + var(1)

[State 1301, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 1, 1

[State 1301, DestroySelf]
type = DestroySelf
trigger1 = root, stateno = 1350
trigger1 = root, time > 1

;---------------------------------------------------------------------------
; Teleport Start Helper
; Var(0) = image anim

[Statedef 1310]
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
anim = 9999

[State 1310, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 1300, 0

[State 1310, Anim Select]
type = VarSet
trigger1 = time = 0
var(0) = ifelse(parent, stateno = 1300, 1301, ifelse(parent, stateno = 5120, 5121, 5211))

[State 1310, PalFX]
type = PalFX
trigger1 = 1
time = 1
add = 128 - time*14, 128 - time*14, 128 - time*14
;mul = 512 - time*20, 512 - time*20, 512 - time*20

[State 1310, Bind]
type = BindToParent
trigger1 = parent, stateno = 5210

[State 1310, Explod 1a]
type = Explod
trigger1 = time = 0
id = 1301
anim = var(0)
sprpriority = 1
bindtime = 5
removetime = 5
pos = -floor(2*root, const(size.xscale)), floor(2*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 1b]
type = Explod
trigger1 = time = 0
id = 1301
anim = var(0)
sprpriority = 1
bindtime = 5
removetime = 5
pos = floor(2*root, const(size.xscale)), -floor(2*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 2a]
type = Explod
trigger1 = time = 6
id = 1301
anim = var(0)
sprpriority = 1
bindtime = 2
removetime = 2
pos = -floor(7*root, const(size.xscale)), floor(4*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 2b]
type = Explod
trigger1 = time = 6
id = 1301
anim = var(0)
sprpriority = 1
bindtime = 2
removetime = 2
pos = floor(7*root, const(size.xscale)), -floor(4*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 3a]
type = Explod
trigger1 = time = 9
id = 1301
anim = var(0)
sprpriority = 1
bindtime = 2
removetime = 2
pos = -floor(10*root, const(size.xscale)), floor(6*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 3b]
type = Explod
trigger1 = time = 9
id = 1301
anim = var(0)
sprpriority = 1
bindtime = 2
removetime = 2
pos = floor(10*root, const(size.xscale)), -floor(6*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 4a]
type = Explod
trigger1 = time = 12
id = 1301
anim = var(0)
sprpriority = 1
bindtime = 1
removetime = 1
pos = -floor(15*root, const(size.xscale)), floor(7*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 4b]
type = Explod
trigger1 = time = 12
id = 1301
anim = var(0)
sprpriority = 1
bindtime = 1
removetime = 1
pos = floor(15*root, const(size.xscale)), -floor(7*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 5a]
type = Explod
trigger1 = time = 13
id = 1301
anim = var(0)
sprpriority = -1
bindtime = 1
removetime = 1
pos = -floor(15*root, const(size.xscale)), floor(7*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 5b]
type = Explod
trigger1 = time = 13
id = 1301
anim = var(0)
sprpriority = -1
bindtime = 1
removetime = 1
pos = floor(15*root, const(size.xscale)), -floor(7*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 6a]
type = Explod
trigger1 = time = 15
id = 1301
anim = var(0)
sprpriority = -1
bindtime = 2
removetime = 2
pos = -floor(17*root, const(size.xscale)), floor(8*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 6b]
type = Explod
trigger1 = time = 15
id = 1301
anim = var(0)
sprpriority = -1
bindtime = 2
removetime = 2
pos = floor(17*root, const(size.xscale)), -floor(8*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 7a]
type = Explod
trigger1 = time = 18
id = 1301
anim = var(0)
sprpriority = -1
bindtime = 2
removetime = 2
pos = -floor(22*root, const(size.xscale)), floor(10*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 7b]
type = Explod
trigger1 = time = 18
id = 1301
anim = var(0)
sprpriority = -1
bindtime = 2
removetime = 2
pos = floor(22*root, const(size.xscale)), -floor(10*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 8a]
type = Explod
trigger1 = time = 21
id = 1301
anim = var(0)
sprpriority = -1
bindtime = 2
removetime = 2
pos = -floor(24*root, const(size.xscale)), floor(12*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 8b]
type = Explod
trigger1 = time = 21
id = 1301
anim = var(0)
sprpriority = -1
bindtime = 2
removetime = 2
pos = floor(24*root, const(size.xscale)), -floor(12*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 9a]
type = Explod
trigger1 = time = 24
id = 1301
anim = var(0)
sprpriority = -1
bindtime = 2
removetime = 2
pos = -floor(26*root, const(size.xscale)), floor(12*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, Explod 9b]
type = Explod
trigger1 = time = 24
id = 1301
anim = var(0)
sprpriority = -1
bindtime = 2
removetime = 2
pos = floor(26*root, const(size.xscale)), -floor(12*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, DestroySelf]
type = DestroySelf
trigger1 = time = 27

;---------------------------------------------------------------------------
; Teleport End

[Statedef 1350]
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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 9999				;Change animation (Def: no change)
sprpriority = 1			;Set layering priority to 2 (in front)

[State 1350, Turn]
type = Turn
trigger1 = time = 2
trigger1 = p2dist x < 0

[State 1350, PosSet]
type = PosSet
trigger1 = 1
y = 0

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

[State 1350, NotHitBy]
type = NotHitBy
trigger1 = var(17)
value2 = , NT, ST, HT
time = 10

[State 1350, Explod]
type = Explod
trigger1 = time = 2
id = 1350
anim = 1350 + 2*(var(23) != 0)
sprpriority = 0
bindtime = 1
ownpal = 1
scale = const(size.xscale), const(size.yscale)

[State 1350, Helper]
type = Helper
trigger1 = time = 2
name = "teleportendimage"
id = 1360
stateno = 1360
ownpal = 1

[State 1350, Command Buffer]
type = VarSet
trigger1 = time = 0
var(0) = 0

[State 1350, Command Buffer]
type = VarSet
trigger1 = command = "BB"
trigger1 = time > 10
var(0) = -1

[State 1350, Command Buffer]
type = VarSet
trigger1 = command = "FF"
trigger1 = time > 10
var(0) = 1

[State 1350, Dash Cancel]
type = ChangeState
triggerall = time = 28
trigger1 = var(59) < 1
trigger1 = command = "holdback"
trigger1 = var(0) = -1
trigger2 = var(59) > 0
trigger2 = fvar(11)
trigger2 = random/fvar(11) < 1000
trigger2 = inguarddist || (!var(17) && enemynear, hitdefattr = SCA, NT, ST, HT)
trigger2 = backedgebodydist > 20 || p2dist x > 100
value = 105
ctrl = 0

[State 1350, Dash Cancel]
type = ChangeState
triggerall = time = 28
trigger1 = var(59) < 1
trigger1 = command = "holdfwd"
trigger1 = var(0) = 1
trigger2 = var(59) > 0
trigger2 = fvar(11)
trigger2 = random/fvar(11) < 1000
trigger2 = inguarddist || (!var(17) && enemynear, hitdefattr = SCA, NT, ST, HT)
value = 100
ctrl = 0

[State 1350, End]
type = ChangeState
trigger1 = time = 28
value = 0 
ctrl = 1

;---------------------------------------------------------------------------
; Teleport End Helper
; Var(0) = image anim

[Statedef 1360]
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
anim = 9999

[State 1360, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 1300, 1

[State 1360, Anim Select]
type = VarSet
trigger1 = time = 0
var(0) = 1301

[State 1360, Bind]
type = BindToParent
trigger1 = 1

[State 1360, PalFX]
type = PalFX
trigger1 = 1
time = 1
add = time*14 - 221, time*14 - 221, time*14 - 221
;mul = 512 - time*20, 512 - time*20, 512 - time*20

[State 1360, Explod 1a]
type = Explod
trigger1 = time = 22
id = 1301
anim = var(0)
sprpriority = 1
bindtime = -1
removetime = 4
pos = -floor(2*root, const(size.xscale)), floor(2*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 1b]
type = Explod
trigger1 = time = 22
id = 1301
anim = var(0)
sprpriority = 1
bindtime = -1
removetime = 4
pos = floor(2*root, const(size.xscale)), -floor(2*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 2a]
type = Explod
trigger1 = time = 19
id = 1301
anim = var(0)
sprpriority = 1
bindtime = -1
removetime = 2
pos = -floor(7*root, const(size.xscale)), floor(4*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 2b]
type = Explod
trigger1 = time = 19
id = 1301
anim = var(0)
sprpriority = 1
bindtime = -1
removetime = 2
pos = floor(7*root, const(size.xscale)), -floor(4*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 3a]
type = Explod
trigger1 = time = 16
id = 1301
anim = var(0)
sprpriority = 1
bindtime = -1
removetime = 2
pos = -floor(10*root, const(size.xscale)), floor(6*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 3b]
type = Explod
trigger1 = time = 16
id = 1301
anim = var(0)
sprpriority = 1
bindtime = -1
removetime = 2
pos = floor(10*root, const(size.xscale)), -floor(6*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 4a]
type = Explod
trigger1 = time = 13
id = 1301
anim = var(0)
sprpriority = 1
bindtime = -1
removetime = 1
pos = -floor(15*root, const(size.xscale)), floor(7*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 4b]
type = Explod
trigger1 = time = 13
id = 1301
anim = var(0)
sprpriority = 1
bindtime = -1
removetime = 1
pos = floor(15*root, const(size.xscale)), -floor(7*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 5a]
type = Explod
trigger1 = time = 10
id = 1301
anim = var(0)
sprpriority = -1
bindtime = -1
removetime = 2
pos = -floor(17*root, const(size.xscale)), floor(8*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 5b]
type = Explod
trigger1 = time = 10
id = 1301
anim = var(0)
sprpriority = -1
bindtime = -1
removetime = 2
pos = floor(17*root, const(size.xscale)), -floor(8*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 6a]
type = Explod
trigger1 = time = 7
id = 1301
anim = var(0)
sprpriority = -1
bindtime = -1
removetime = 2
pos = -floor(22*root, const(size.xscale)), floor(10*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 6b]
type = Explod
trigger1 = time = 7
id = 1301
anim = var(0)
sprpriority = -1
bindtime = -1
removetime = 2
pos = floor(22*root, const(size.xscale)), -floor(10*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 7a]
type = Explod
trigger1 = time = 4
id = 1301
anim = var(0)
sprpriority = -1
bindtime = -1
removetime = 2
pos = -floor(24*root, const(size.xscale)), floor(12*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 7b]
type = Explod
trigger1 = time = 4
id = 1301
anim = var(0)
sprpriority = -1
bindtime = -1
removetime = 2
pos = floor(24*root, const(size.xscale)), -floor(12*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 8a]
type = Explod
trigger1 = time = 1
id = 1301
anim = var(0)
sprpriority = -1
bindtime = -1
removetime = 2
pos = -floor(26*root, const(size.xscale)), floor(12*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1360, Explod 8b]
type = Explod
trigger1 = time = 1
id = 1301
anim = var(0)
sprpriority = -1
bindtime = -1
removetime = 2
pos = floor(26*root, const(size.xscale)), -floor(12*root, const(size.yscale))
scale = root, const(size.xscale), root, const(size.yscale)

[State 1310, DestroySelf]
type = DestroySelf
trigger1 = time = 26

;---------------------------------------------------------------------------
; Souls Soliton

[Statedef 2000]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = ifelse(var(21), 2010, 2000)				;Change animation (Def: no change)
poweradd = ifelse(var(16), -333, 100)			;Power to add (Def: 0)
sprpriority = 0			;Set layering priority to 2 (in front)

[State 2000, VarSet]
type = VarSet
trigger1 = time = 0
var(0) = ifelse(var(59) < 1, ifelse(command = "Solitonb", 2, ifelse(command = "Solitonc", 1, 0)), random%3)

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

[State 2000, Explod]
type = Explod
trigger1 = anim = 2000
trigger1 = animelem = 13
trigger2 = anim = 2010
trigger2 = animelem = 7
id = 22000
anim = 22000 + (var(23) != 0)
sprpriority = 1
postype = p1
bindtime = 1
pos = floor(2*const(size.xscale)), floor(-83*const(size.yscale))
ownpal = 1
scale = const(size.xscale), const(size.yscale)

[State 2000, PlaySnd]
type = PlaySnd
trigger1 = anim = 2000
trigger1 = animelem = 13
trigger2 = anim = 2010
trigger2 = animelem = 7
value = 2000, 1

[State 2000, Helper]
type = Helper
trigger1 = anim = 2000
trigger1 = animelem = 13
trigger2 = anim = 2010
trigger2 = animelem = 7
name = "swordspawner"
id = 2001
stateno = 2001
pos = ifelse(var(0) = 2, ceil(511*const(size.xscale)),  ceil(-7*const(size.xscale))), floor(-pos y)
ownpal = 1

[State 2000, StopSnd]
type = StopSnd
trigger1 = animtime = 0
channel = 0

[State 2000, 5]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

;Forward/Back Spawner
[Statedef 2001] 
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;Move-type: A-attack, I-idle, H-gethit
physics = N				;Physics: S-stand, C-crouch, A-air
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 9999

[State 2001, VarSet]
type = VarSet
trigger1 = time = 0
var(0) = root, var(0);ifelse(root, command = "holdback", 2, ifelse(root, command = "holdup" || root, command = "holddown", 1, 0))

[State 2001, Helper]
type = Helper
trigger1 = time%17 = 0
trigger1 = var(0) = 0
name = "sword"
id = 2002
stateno = 2002
pos = (time/17)*ceil(128*root, const(size.xscale)), 0
ownpal = 1

[State 2001, Helper]
type = Helper
trigger1 = time%34 = 0
trigger1 = var(0) = 1
trigger1 = var(1) := 0 || 1
name = "sword"
id = 2002
stateno = 2002
pos = (time/34)*ceil(192*root, const(size.xscale)), 0
ownpal = 1

[State 2001, Helper]
type = Helper
trigger1 = time%34 = 17
trigger1 = var(0) = 1
trigger1 = var(1) := 1
name = "sword"
id = 2002
stateno = 2002
pos = ceil((((time - 17)/34)*192 + 96)*root, const(size.xscale)), ceil(-353*root, const(size.yscale))
ownpal = 1

[State 2001, Helper]
type = Helper
trigger1 = time%17 = 0
trigger1 = var(0) = 2
name = "sword"
id = 2002
stateno = 2002
pos = ceil(((time/17)*-128 - 50)*root, const(size.xscale)), 0
ownpal = 1

[State 2001, DestroySelf]
type = DestroySelf
trigger1 = time > 75 + 17*(var(0) = 1)

[Statedef 2002]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;Move-type: A-attack, I-idle, H-gethit
physics = N				;Physics: S-stand, C-crouch, A-air
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = -1			;Set layering priority to 2 (in front)
hitdefpersist = 1
movehitpersist = 1
hitcountpersist = 1

[State 2002, Debris]
type = Explod
trigger1 = anim != 2001
trigger1 = anim != 2003
trigger1 = anim != 2011
trigger1 = anim != 2013
id = 2002
anim = 2002 + 2*(parent, var(1) = 1) + 10*(root, var(21) != 0)
sprpriority = 0
postype = p1
bindtime = -1
scale = root, const(size.xscale), root, const(size.yscale)

[State 2002, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 2001
trigger1 = anim != 2003
trigger1 = anim != 2011
trigger1 = anim != 2013
value = 2001 + 2*(parent, var(1) = 1) + 10*(root, var(21) != 0)

[State 2002, HitOverride]
type = HitOverride
trigger1 = 1
stateno = 2002
attr = SCA, AA, AP, AT
time = -1

[State 2002, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = -1

[State 2002, PlaySnd]
type = PlaySnd
trigger1 = animelem = 4
value = 2000, 2

[State 2002, HitDef]
type = HitDef
triggerall = root, var(22)
trigger1 = !movecontact
attr = S, SA			;Attribute: Standing, Normal Attack
damage = ifelse(root, var(16), 120, 90), ifelse(root, var(16), 12, 9)
getpower = ifelse(root, var(16), 0, 63)
animtype = Back			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA			;Flags on how move is to be guarded against
hitflag = MA			;Flags of conditions that move can hit
pausetime = 0, 12 ;ifelse(moveguarded, 3, 12)
sparkno = s7002				;Spark anim no (Def: set above)
guard.sparkno = s7006
sparkxy = -10, floor(p2dist y + enemynear, const(size.mid.pos.y))
					;Y-offset for the spark rel. to p1
hitsound = s5, 6			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = Low		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 16		;Time that the opponent slides back
ground.hittime  = 16		;Time opponent is in hit state
ground.velocity = -5, -4.99		;Velocity at which opponent is pushed
guard.velocity = -10
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
air.type = Low
yaccel = .536
air.hittime = 16			;Time before opponent regains control in air
fall = 1
fall.recover = 0
fall.animtype = medium
sprpriority = -1
;forcestand = 1

[State 2002, HitDef]
type = HitDef
triggerall = root, var(22)
triggerall = hitcount < 2
trigger1 = moveguarded = 9
trigger2 = movehit = 11
attr = S, SA			;Attribute: Standing, Normal Attack
damage = ifelse(root, var(16), 120, 90), ifelse(root, var(16), 12, 9)
getpower = ifelse(root, var(16), 0, 63)
animtype = Back			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA			;Flags on how move is to be guarded against
hitflag = MAF			;Flags of conditions that move can hit
pausetime = 0, 3
sparkno = s7002				;Spark anim no (Def: set above)
guard.sparkno = s7006
sparkxy = -10, floor(p2dist y + enemynear, const(size.head.pos.y))
					;Y-offset for the spark rel. to p1
hitsound = s5, 6			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = Low		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 16		;Time that the opponent slides back
ground.hittime  = 16		;Time opponent is in hit state
ground.velocity = -5, -4.99		;Velocity at which opponent is pushed
guard.velocity = -10
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
air.type = Low
yaccel = .536
air.hittime = 16			;Time before opponent regains control in air
fall = 1
fall.recover = 0
fall.animtype = medium
sprpriority = -1
;forcestand = 1

[State 2002, HitDef]
type = HitDef
triggerall = !root, var(22)
trigger1 = !movecontact
attr = S, SA			;Attribute: Standing, Normal Attack
damage = ifelse(root, var(16), 120, 90), ifelse(root, var(16), 12, 9)
getpower = ifelse(root, var(16), 0, 63)
animtype = Back			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA			;Flags on how move is to be guarded against
hitflag = MA			;Flags of conditions that move can hit
pausetime = 0, 12 ;ifelse(moveguarded, 3, 12)
sparkno = 3				;Spark anim no (Def: set above)
guard.sparkno = 40
sparkxy = -10, floor(p2dist y + enemynear, const(size.mid.pos.y))
					;Y-offset for the spark rel. to p1
hitsound = s5, 6			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = Low		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 16		;Time that the opponent slides back
ground.hittime  = 16		;Time opponent is in hit state
ground.velocity = -5, -4.99		;Velocity at which opponent is pushed
guard.velocity = -10
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
air.type = Low
yaccel = .536
air.hittime = 16			;Time before opponent regains control in air
fall = 1
fall.recover = 0
fall.animtype = medium
sprpriority = -1
;forcestand = 1

[State 2002, HitDef]
type = HitDef
triggerall = !root, var(22)
triggerall = hitcount < 2
trigger1 = moveguarded = 9
trigger2 = movehit = 11
attr = S, SA			;Attribute: Standing, Normal Attack
damage = ifelse(root, var(16), 120, 90), ifelse(root, var(16), 12, 9)
getpower = ifelse(root, var(16), 0, 63)
animtype = Back			;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA			;Flags on how move is to be guarded against
hitflag = MAF			;Flags of conditions that move can hit
pausetime = 0, 3
sparkno = 3				;Spark anim no (Def: set above)
guard.sparkno = 40
sparkxy = -10, floor(p2dist y + enemynear, const(size.head.pos.y))
					;Y-offset for the spark rel. to p1
hitsound = s5, 6			;Sound to play on hit
guardsound = s6, 0			;Sound to play on guard
ground.type = Low		;Type: High, Low, Trip (def: Normal)
ground.slidetime = 16		;Time that the opponent slides back
ground.hittime  = 16		;Time opponent is in hit state
ground.velocity = -5, -4.99		;Velocity at which opponent is pushed
guard.velocity = -10
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
air.type = Low
yaccel = .536
air.hittime = 16			;Time before opponent regains control in air
fall = 1
fall.recover = 0
fall.animtype = medium
sprpriority = -1
;forcestand = 1

[State 2002, DestroySelf]
type = DestroySelf
trigger1 = AnimTime = 0

;---------------------------------------------------------------------------
; Destruction Rain

[Statedef 2200]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 2200				;Change animation (Def: no change)
poweradd = ifelse(var(16), -1000, 100)			;Power to add (Def: 0)
sprpriority = 0			;Set layering priority to 2 (in front)

[State 2200, Explod]
type = Explod
trigger1 = animelem = 6, = 1
id = 22200
anim = 22200 + 10*(var(23) != 0)
sprpriority = 1
postype = p1
bindtime = 1
pos = floor(81*const(size.xscale)), floor(-137*const(size.yscale))
ownpal = 1
scale = const(size.xscale), const(size.yscale)

[State 2200, PlaySnd]
type = PlaySnd
trigger1 = animelem = 6, = 1
value = 2000, 1

[State 2200, Helper]
type = Helper
trigger1 = animelem = 6, = 1
name = "meteorspawner"
id = 2201
stateno = 2201
ownpal = 1

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

;Meteor Spawner
[Statedef 2201] 
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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 9999

[State 2201, VarSet]
type = VarSet
trigger1 = time = 0
var(1) = random%5

[State 2201, VarSet]
type = VarSet
trigger1 = time = 0
var(4) = random%21

[State 2201, VarSet]
type = VarSet
trigger1 = time = 0
var(5) = random%21

[State 2201, VarSet]
type = VarSet
trigger1 = time = 0
var(6) = random%21

[State 2201, VarSet]
type = VarSet
trigger1 = time = 0
trigger2 = root, var(16)
fvar(0) = enemynear, pos x - helper(9999), pos x

[State 2201, VarSet]
type = VarSet
trigger1 = time = 0
trigger2 = root, var(16)
fvar(1) = enemynear, pos y + enemynear, const(size.mid.pos.y)

[State 2201, VarSet]
type = VarSet
trigger1 = time = 0
trigger1 = random%2 || var(1) = 0
trigger2 = time = 25 + var(4)
trigger2 = random%2 || var(1) = 1
trigger3 = time = 60 + var(5)
trigger3 = random%2 || var(1) = 2
trigger4 = time = 95 + var(6)
trigger4 = random%2 || var(1) = 3
trigger5 = time = 140
trigger5 = random%2 || var(1) = 4
var(2) = !var(2)

[State 2201, VarSet]
type = VarSet
trigger1 = time = 0
trigger2 = time = 25 + var(4)
trigger3 = time = 60 + var(5)
trigger4 = time = 95 + var(6)
trigger5 = time = 140
var(3) = parent, var(8)

[State 2201, VarSet]
type = ParentVarAdd
trigger1 = time = 0
trigger2 = time = 25 + var(4)
trigger3 = time = 60 + var(5)
trigger4 = time = 95 + var(6)
trigger5 = time = 140
var(8) = 1

[State 2201, Helper]
type = Helper
trigger1 = time = 0
trigger2 = time = 25 + var(4)
trigger3 = time = 60 + var(5)
trigger4 = time = 95 + var(6)
trigger5 = time = 140
name = "meteor"
id = 2202
stateno = 2202
pos = 0, -470
ownpal = 1

[State 2201, PlaySnd]
type = PlaySnd
trigger1 = time = 10
trigger2 = time = 35 + var(4)
trigger3 = time = 70 + var(5)
trigger4 = time = 105 + var(6)
trigger5 = time = 150
value = 2200, 0
channel = 1

[State 2201, DestroySelf]
type = DestroySelf
trigger1 = time > 150
trigger2 = root, var(16)
trigger2 = root, movetype != A || root, anim != 2200

;---------------------
; var(0) = unused
; var(1) = unused
; var(2) = small/big
; var(3) = exploding
; var(4) = movecontacts
; var(5) = id offset

[Statedef 2202]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A				;Move-type: A-attack, I-idle, H-gethit
physics = N				;Physics: S-stand, C-crouch, A-air
;Commonly-used controllers:
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = 2			;Set layering priority to 2 (in front)
hitdefpersist = 1
movehitpersist = 1
hitcountpersist = 1
sprpriority = 2

[State 2202, DestroySelf]
type = DestroySelf
trigger1 = var(3) = 2

[State 2202, VarSet]
type = VarSet
trigger1 = !prevstateno
trigger1 = time = 0
var(2) = parent, var(2)

[State 2202, VarSet]
type = VarSet
trigger1 = !prevstateno
trigger1 = time = 0
var(5) = parent, var(3)

[State 2202, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 22201 + var(2)
value = 22201 + var(2)
elem = 1 + random%16

[State 2202, PosAdd]
type = PosAdd
trigger1 = !prevstateno
trigger1 = time = 0
trigger1 = screenpos y > 70*root, const(size.yscale)
y = 70*root, const(size.yscale) - screenpos y

[State 2202, VarSet]
type = VarSet
trigger1 = !prevstateno
trigger1 = time = 0
trigger1 = parent, fvar(1) - pos y != 0
fvar(0) = atan((parent, fvar(0) - pos x + helper(9999), pos x)/(parent, fvar(1) - pos y))

[State 2202, VarSet]
type = VarSet
trigger1 = !prevstateno
trigger1 = time = 0
trigger1 = parent, fvar(1) - pos y = 0
fvar(0) = pi/2

[State 2202, VarAdd]
type = VarAdd
trigger1 = !prevstateno
trigger1 = time = 0
fvar(0) = (random - 500)*0.0003

[State 2202, VarSet]
type = VarSet
trigger1 = !prevstateno
trigger1 = time = 0
fvar(1) = random*0.001 + 6.5

[State 2202, VelSet]
type = VelSet
trigger1 = !prevstateno
trigger1 = time = 0
x = fvar(1)*sin(fvar(0))*facing
y = fvar(1)*cos(fvar(0))

[State 2202, HitOverride]
type = HitOverride
trigger1 = 1
stateno = 2202
attr = SCA, AA, AP, AT
time = -1

[State 2202, VarAdd]
type = VarAdd
triggerall = !var(3)
trigger1 = root, projcontacttime(2202 + var(5)) = 1
trigger2 = frontedgedist < -100
trigger3 = backedgedist < -100
var(4) = 1

[State 2202, VarAdd]
type = VarAdd
trigger1 = pos y > -30
trigger2 = var(4) = 3
var(3) = 1

[State 2202, Projectile]
type = Projectile
triggerall = root, var(22)
triggerall = !var(3)
trigger1 = animelemno(0) < 25
trigger1 = root, projcontacttime(2202 + var(5)) != [0, 11]
projanim = anim + 10
projid = 2202 + var(5)
projremovetime = 1
id = 2202 + var(5)
offset = vel x, vel y
attr = S, HP
animtype  = back
damage    = 40 - var(4)*10, ifelse(root, var(16), 15, 10) ;high chip damage
getpower = ifelse(root, var(16), 0, 28 - var(4)*7)
hitflag = MAFD
guardflag = MA
pausetime = 0, 11
sparkno = s7004
guard.sparkno = s7006
sparkxy = floor(p2dist x/2), floor(p2dist y/2)
hitsound   = s5,2
guardsound = s6,0
ground.type = High
ground.slidetime = 22
ground.hittime  = 22
ground.velocity = -3, -7.5
guard.velocity = -10
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
air.type = Low
yaccel = .536
air.cornerpush.veloff = 0
palfx.time = 50
palfx.color = 0
palfx.mul = 256, 64, 0
palfx.sinadd = -64, -64, 0, 20
fall = 1
fall.recover = 0

[State 2202, Projectile]
type = Projectile
triggerall = !root, var(22)
triggerall = !var(3)
trigger1 = animelemno(0) < 25
trigger1 = root, projcontacttime(2202 + var(5)) != [0, 11]
projanim = anim + 10
projid = 2202 + var(5)
projremovetime = 1
id = 2202 + var(5)
offset = vel x, vel y
attr = S, HP
animtype  = back
damage    = 40 - var(4)*10, ifelse(root, var(16), 15, 10) ;high chip damage
getpower = ifelse(root, var(16), 0, 28 - var(4)*7)
hitflag = MAFD
guardflag = MA
pausetime = 0, 11
sparkno = 3
guard.sparkno = 40
sparkxy = floor(p2dist x/2), floor(p2dist y/2)
hitsound   = s5,2
guardsound = s6,0
ground.type = High
ground.slidetime = 22
ground.hittime  = 22
ground.velocity = -3, -7.5
guard.velocity = -10
ground.cornerpush.veloff = 0
airguard.velocity = -3,-6.43	;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.velocity = -3, -6.43		;X-velocity at which opponent is pushed,
air.type = Low
yaccel = .536
air.cornerpush.veloff = 0
palfx.time = 50
palfx.color = 0
palfx.mul = 256, 64, 0
palfx.sinadd = -64, -64, 0, 20
fall = 1
fall.recover = 0

[State 2202, Fire]
type = Explod
trigger1 = root, projhittime(2202 + var(5)) = 1
trigger1 = root, numtarget(2202 + var(5))
id = 7050
anim = 7050 + random%3
sprpriority = 2
postype = p2
bindtime = 45 
pos = 0, enemynear, const(size.mid.pos.y)
random = floor((enemynear, const(size.ground.front)+enemynear, const(size.ground.back))*(hitcount != 0)*0.4), floor((enemynear, const(size.mid.pos.y)-enemynear, const(size.head.pos.y))*(hitcount != 0)*0.8)

;[State 2202, PlaySnd]
;type = PlaySnd
;trigger1 = root, projhittime(2202 + var(5)) = 1
;trigger1 = root, numtarget(2202 + var(5))
;value = 5, 8
;ignorehitpause = 1

[State 2202, HitBy]
type = HitBy
trigger1 = !var(3)
value = SCA, NP, SP, HP
time = 1

[State 2202, HitBy]
type = NotHitBy
trigger1 = var(3)
value = SCA
time = -1

[State 2202, VarSet]
type = PosFreeze
trigger1 = var(3)

[State 2202, SprPriority]
type = SprPriority
trigger1 = var(3)
value = 1

[State 2201, PlaySnd]
type = PlaySnd
trigger1 = var(3) = 1
value = 2200, 1
channel = 1

[State 2202, EnvShake]
type = EnvShake
trigger1 = var(3) = 1
time = 12
freq = 60
ampl = 7
phase = 270

[State 2202, Helper]
type = Helper
trigger1 = var(3) = 1
name = "meteordebris"
id = 2203
stateno = 2203
ownpal = 1

[State 2202, Helper]
type = Helper
trigger1 = var(3) = 1
name = "meteordebris"
id = 2203
stateno = 2203
ownpal = 1

[State 2202, Helper]
type = Helper
trigger1 = var(3) = 1
name = "meteordebris"
id = 2203
stateno = 2203
ownpal = 1

[State 2202, Helper]
type = Helper
trigger1 = var(3) = 1
name = "meteordebris"
id = 2203
stateno = 2203
ownpal = 1

[State 2202, ChangeAnim]
type = ChangeAnim
trigger1 = var(3) = 2
value = 9999

[Statedef 2203]
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
;Commonly-used controllers:
ctrl = 0				;Set ctrl (Def: no change)
sprpriority = 2			;Set layering priority to 2 (in front)

[State 2203, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 22203 + random%3

[State 2203, VelSet]
type = velSet
trigger1 = time = 0
x = ifelse(random%2, -1, 1)*(random + 1000)*0.002
y = -(random + 2000)*0.002

[State 2203, VelAdd]
type = VelAdd
trigger1 = time
y = 0.4

[State 2203, DestroySelf]
type = DestroySelf
trigger1 = pos y > 0
trigger1 = vel y > 0

;---------------------------------------------------------------------------
; Chaos Destiny

[Statedef 3000]
type    = S                      ;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A                      ;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
;Commonly-used controllers:
anim = 200
velset = 0,0                     ;Set velocity (x,y) (Def: no change)
ctrl = 0                         ;Set ctrl (Def: no change)
poweradd = -2000                    ;Power to add (Def: 0)
sprpriority = 1                  ;Set p1's sprite layering priority to 2 (in front)

[State 3000, VarSet]
type = VarSet
trigger1 = time = 0
var(1) = 0

[State 3000, 1]
type = HitDef
triggerall = var(22)
trigger1 = time = 0
attr = S, NA                     ;Attribute: Standing, Normal Attack
damage = 23, 0                   ;Damage that move inflicts, guard damage
getpower = 0, 0
animtype = Heavy                 ;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA                   ;Flags on how move is to be guarded against
hitflag = MA                    ;Flags of conditions that move can hit
;Hit/Miss/Dodge type (Def: Hit)
pausetime = 11, 11                 ;Time attacker pauses, time opponent shakes
sparkno = s7002				;Spark anim no (Def: set above)
guard.sparkno = s7006
sparkxy = -10, -65               ;X-offset for the "hit spark" rel. to p2,
;Y-offset for the spark rel. to p1
hitsound = s5, 2                  ;Sound to play on hit
guardsound = s6, 0                ;Sound to play on guard
ground.type = Low               ;Type: High, Low, Trip (def: Normal)
ground.slidetime = 22             ;Time that the opponent slides back
ground.hittime  = 22             ;Time opponent is in hit state
ground.velocity = -12             ;Velocity at which opponent is pushed
airguard.velocity = -3,-6     ;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.type = Low                  ;Type: High, Low, Trip (def: same as ground.type)
air.velocity = -3,-6           ;X-velocity at which opponent is pushed,
;Y-velocity at which opponent is pushed
air.hittime = 22                 ;Time before opponent regains control in air
fall.type = Low

[State 3000, 1]
type = HitDef
triggerall = !var(22)
trigger1 = time = 0
attr = S, NA                     ;Attribute: Standing, Normal Attack
damage = 23, 0                   ;Damage that move inflicts, guard damage
getpower = 0, 0
animtype = Heavy                 ;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA                   ;Flags on how move is to be guarded against
hitflag = MA                    ;Flags of conditions that move can hit
;Hit/Miss/Dodge type (Def: Hit)
pausetime = 11, 11                 ;Time attacker pauses, time opponent shakes
sparkno = 2				;Spark anim no (Def: set above)
guard.sparkno = 40
sparkxy = -10, -65               ;X-offset for the "hit spark" rel. to p2,
;Y-offset for the spark rel. to p1
hitsound = s5, 2                  ;Sound to play on hit
guardsound = s6, 0                ;Sound to play on guard
ground.type = Low               ;Type: High, Low, Trip (def: Normal)
ground.slidetime = 22             ;Time that the opponent slides back
ground.hittime  = 22             ;Time opponent is in hit state
ground.velocity = -12             ;Velocity at which opponent is pushed
airguard.velocity = -3,-6     ;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.type = Low                  ;Type: High, Low, Trip (def: same as ground.type)
air.velocity = -3,-6           ;X-velocity at which opponent is pushed,
;Y-velocity at which opponent is pushed
air.hittime = 22                 ;Time before opponent regains control in air
fall.type = Low

[State 3000, 1]
type = PlaySnd
trigger1 = Time = 0
value = 1100, 0
channel = 0

[State 3000, VarSet]
type = VarSet
trigger1 = time = 10
var(1) = 1

[State 3000, VarSet]
type = VarSet
trigger1 = var(1) = 1
trigger1 = helper(10000), stateno = 10000
trigger1 = helper(10001), stateno = 10000
var(1) = 3000

[State 3000, VarSet]
type = VarSet
trigger1 = var(1) = 3000
trigger1 = helper(10000), stateno = 10300
trigger1 = helper(10001), stateno = 10300
var(1) = 2

[State 3000, ChangeAnim]
type = ChangeAnim
triggerall = anim = 200
triggerall = var(1) = 2
trigger1 = helper(10000), stateno = 10310
trigger2 = helper(10001), stateno = 10310
value = 3000

[State 3000, SprPriority]
type = SprPriority
triggerall = anim = 3000
trigger1 = animelem = 1
value = 0

[State 3000, PlaySnd]
type = PlaySnd
triggerall = anim = 3000
trigger1 = animelem = 1
value = 2200, 2
channel = 0

[State 3000, Explod]
type = Explod
triggerall = anim = 3000
trigger1 = animelem = 5, = 1
id = 22100
anim = 22100 + (var(23) != 0)
sprpriority = 1
postype = p1
bindtime = 1
pos = floor(81*const(size.xscale)), floor(-137*const(size.yscale))
ownpal = 1
scale = const(size.xscale), const(size.yscale)

[State 3000, PlaySnd]
type = PlaySnd
triggerall = anim = 3000
trigger1 = animelem = 5, = 1
value = 2000, 1

[State 3000, ChangeAnim]
type = ChangeAnim
trigger1 = anim = 200
trigger1 = var(1) = 2
trigger1 = helper(10000), movetype != A
trigger1 = helper(10001), movetype != A
value = 201

[State 3000, StopSnd]
type = StopSnd
trigger1 = anim = 3000
trigger1 = helper(10000), movetype != A
trigger1 = helper(10001), movetype != A
channel = 0

[State 3000, 7]
type = ChangeState
trigger1 = anim = 201
trigger1 = animtime = 0
trigger2 = anim = 3000
trigger2 = helper(10000), movetype != A
trigger2 = helper(10001), movetype != A
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]

[State -2, StopSnd] ;Stop intro music if intro skipped
type = StopSnd
trigger1 = var(19) > 2
trigger1 = !numhelper(9999)
channel = 8

[State -2, Helper]
type = Helper
trigger1 = !numhelper(9999)
name = "origin"
id = 9999
stateno = 9999
ignorehitpause = 1

[State -2, Dragon 1 Breath Single Target Guard Break]
type = TargetState
triggerall = projguardedtime(10052) = 0
triggerall = numtarget(10052) = 1
triggerall = target(10052), alive
triggerall = target(10052), gethitvar(guarded)
trigger1 = target(10052), id = var(2)
trigger1 = var(3) := 0 || 1
trigger1 = var(7) := 1
trigger2 = target(10052), id = var(4)
trigger2 = var(5) := 0 || 1
trigger2 = var(7) := 1
id = 10052
value = 5400
ignorehitpause = 1

[State -2, Dragon 1 Breath Multiple Target Guard Break]
;Since TargetState can only affect ALL targets, only activates when both enemies meet criteria
;This means if only 1 can be broken, but both are hit at the same time, there will be no guard crush
type = TargetState
triggerall = projguardedtime(10052) = 0
triggerall = numtarget(10052) > 1
triggerall = numenemy > 1
trigger1 = enemy(0), alive
trigger1 = enemy(0), gethitvar(guarded)
trigger1 = enemy(0), gethitvar(chainid) = 10052
trigger1 = enemy(0), gethitvar(hitshaketime)
trigger1 = enemy(1), alive
trigger1 = enemy(1), gethitvar(guarded) 
trigger1 = enemy(1), gethitvar(chainid) = 10052
trigger1 = enemy(1), gethitvar(hitshaketime)
trigger1 = var(3) := 0 || 1
trigger1 = var(5) := 0 || 1
trigger1 = var(7) := 2
id = 10052
value = 5400
ignorehitpause = 1

[State -2, Dragon 2 Breath Single Target Guard Break]
type = TargetState
triggerall = projguardedtime(11052) = 0
triggerall = numtarget(11052) = 1
triggerall = target(11052), alive
triggerall = target(11052), gethitvar(guarded)
trigger1 = target(11052), id = var(2)
trigger1 = var(3) := 0 || 1
trigger1 = var(7) := 1
trigger2 = target(11052), id = var(4)
trigger2 = var(5) := 0 || 1
trigger2 = var(7) := 1
id = 11052
value = 5400
ignorehitpause = 1

[State -2, Dragon 2 Breath Multiple Target Guard Break]
;Since TargetState can only affect ALL targets, only activates when both enemies meet criteria
;This means if only 1 can be broken, but both are hit at the same time, there will be no guard crush
type = TargetState
triggerall = projguardedtime(11052) = 0
triggerall = numtarget(11052) > 1
triggerall = numenemy > 1
trigger1 = enemy(0), alive
trigger1 = enemy(0), gethitvar(guarded)
trigger1 = enemy(0), gethitvar(chainid) = 11052
trigger1 = enemy(0), gethitvar(hitshaketime)
trigger1 = enemy(1), alive
trigger1 = enemy(1), gethitvar(guarded) 
trigger1 = enemy(1), gethitvar(chainid) = 11052
trigger1 = enemy(1), gethitvar(hitshaketime)
trigger1 = var(3) := 0 || 1
trigger1 = var(5) := 0 || 1
trigger1 = var(7) := 2
id = 11052
value = 5400
ignorehitpause = 1

[State -2, Dragon 1 Breath Guard Break Sound]
type = PlaySnd
trigger1 = numtarget(10052) = 1
trigger1 = var(7) = 1
trigger1 = var(7) := 0 || 1
value = 6, 2
abspan = floor(target(10052), pos x)
ignorehitpause = 1

[State -2, Dragon 2 Breath Guard Break Sound]
type = PlaySnd
trigger1 = numtarget(11052) = 1
trigger1 = var(7) = 1
trigger1 = var(7) := 0 || 1
value = 6, 2
abspan = floor(target(11052), pos x)
ignorehitpause = 1

[State -2, Dragon Breath Double Guard Break Sounds Fail Safe]
type = PlaySnd
trigger1 = numenemy = 1
trigger1 = var(7) = 2
trigger1 = var(7) := 0 || 1
value = 6, 2
abspan = floor(enemy(0), pos x)
ignorehitpause = 1

[State -2, Dragon Breath Double Guard Break Sounds]
type = PlaySnd
trigger1 = numenemy > 1
trigger1 = var(7) = 2
value = 6, 2
abspan = floor(enemy(0), pos x)
ignorehitpause = 1

[State -2, Dragon Breath Double Guard Break Sounds]
type = PlaySnd
trigger1 = numenemy > 1
trigger1 = var(7) = 2
trigger1 = var(7) := 0 || 1
value = 6, 2
abspan = floor(enemy(1), pos x)
ignorehitpause = 1

[State -2, Guard Break Reset]
type = VarSet
trigger1 = !hitdefattr = SCA, AA
trigger2 = movecontact = 1
var(6) = 0
ignorehitpause = 1

[State -2, GetHit Sound]
type = StopSnd
trigger1 = movetype = H
trigger1 = stateno != 9000
trigger1 = gethitvar(hitshaketime) = 1
trigger1 = !gethitvar(guarded) || stateno > 155
channel = 0
ignorehitpause = 1

[State -2, GetHit Sound]
type = PlaySnd
triggerall = alive
trigger1 = movetype = H
trigger1 = stateno != 9000
trigger1 = gethitvar(hitshaketime) = 1
trigger1 = random < (gethitvar(animtype) + 1)*150
trigger1 = !gethitvar(guarded)
channel = 0
value = 5000, random%2
ignorehitpause = 1

[State -2, Block Sound]
type = PlaySnd
trigger1 = movetype = H
trigger1 = !var(20)
trigger1 = gethitvar(guarded)
trigger1 = gethitvar(hitshaketime) = 1
trigger1 = stateno = [120, 155]
trigger1 = random < 200
trigger1 = var(20) := 600
channel = 0
value = 150, random%2
ignorehitpause = 1

[State -2, Block Sound Timer]
type = VarAdd
trigger1 = var(20) > 0
var(20) = -1
ignorehitpause = 1

[State -2, Id Counter]
type = VarSet
trigger1 = !numhelper(2202)
var(8) = 0
ignorehitpause = 1

[State -2, Debug Info]
type = null;DisplayToClipboard
trigger1 = 1
text = "var(1) %d, ai %d, id counter %d, numtarget %d"
params = var(1), var(59), var(8), numtarget
ignorehitpause = 1

[State -2, Debug Info]
type = null;DisplayToClipboard
trigger1 = 1
text = "a %d, qcfa %d, holda %d"
params = command = "a", command = "Lightninga", command = "holda"
ignorehitpause = 1

[State -2, Dragon Sound]
type = PlaySnd
trigger1 = var(10)%10; < 3
channel = 1 + var(10)%10
value = 10000, var(10)%10
abspan = floor(ifelse(var(10) < 10, (helper(10000), pos x), (helper(10001), pos x)))
ignorehitpause = 1

[State -2, Dragon Command Reset]
type = VarSet
trigger1 = 1
var(9) = 0
ignorehitpause = 1

[State -2, Dragon Sound Reset]
type = VarSet
trigger1 = 1
var(10) = 0
ignorehitpause = 1

[State -2, Dragon Switch Timer]
type = VarAdd
trigger1 = var(24) > 0
var(24) = -1
ignorehitpause = 1

[State -2, Dragon Switch AI]
type = VarSet
triggerall = var(18) = 1
triggerall = var(59) > 0
triggerall = (p2statetype = L && enemynear, vel y) || (stateno = 1350 && time = 1)
triggerall = random < 30 + 170*(stateno = 1350 && time = 1)
triggerall = !var(24)
triggerall = !var(11)
triggerall = anim != 200 || animelemno(0) > 2
triggerall = numhelper(10000)
triggerall = numhelper(10001)
trigger1 = helper(10000), movetype != A
trigger1 = helper(10001), movetype != A
trigger1 = var(24) := 300
var(11) = ifelse(random%2, 120, 102)
ignorehitpause = 1

[State -2, Dragon Switch AI]
type = VarSet
triggerall = var(18) = 1
triggerall = var(59) > 0
triggerall = (p2statetype = L && enemynear, vel y) || (stateno = 1350 && time = 1)
triggerall = random < 30 + 170*(stateno = 1350 && time = 1)
triggerall = !var(24)
triggerall = !var(11)
triggerall = anim != 200 || animelemno(0) > 2
triggerall = numhelper(10000)
triggerall = numhelper(10001)
trigger1 = helper(10000), movetype != A
trigger1 = helper(10001), movetype = A
trigger1 = var(24) := 300
var(11) = 120
ignorehitpause = 1

[State -2, Dragon Switch AI]
type = VarSet
triggerall = var(18) = 1
;triggerall = var(59) > 0
triggerall = (p2statetype = L && enemynear, vel y) || (stateno = 1350 && time = 1)
triggerall = random < 30 + 170*(stateno = 1350 && time = 1)
triggerall = !var(24)
triggerall = !var(11)
triggerall = anim != 200 || animelemno(0) > 2
triggerall = numhelper(10000)
triggerall = numhelper(10001)
trigger1 = helper(10000), movetype = A
trigger1 = helper(10001), movetype != A
trigger1 = var(24) := 300
var(11) = 102
ignorehitpause = 1

[State -2, Dragon Switch AI]
type = VarSet
triggerall = var(59) > 0
triggerall = (p2statetype = L && enemynear, vel y) || (stateno = 1350 && time = 1)
triggerall = random < 30 + 170*(stateno = 1350 && time = 1)
triggerall = !var(24)
triggerall = !var(11)
trigger1 = anim != 200
trigger1 = var(24) := 300
trigger2 = animelemno(0) > 8
trigger2 = var(24) := 300
var(11) = 22
ignorehitpause = 1

[State -2, Dragon Switch]
type = VarSet
triggerall = command = "start"
triggerall = command != "holdfwd" || var(18) != 1
triggerall = command != "holdback" || var(18) != 1
triggerall = !var(11)
trigger1 = anim != 200 
trigger2 = animelemno(0) > 2
var(11) = 22
ignorehitpause = 1

[State -2, Dragon Switch]
type = VarSet
triggerall = var(18) = 1
triggerall = command = "start"
triggerall = command = "holdfwd"
triggerall = !var(11)
triggerall = anim != 200 || animelemno(0) > 2
trigger1 = numhelper(10000)
trigger1 = helper(10000), movetype != A
var(11) = 120
ignorehitpause = 1

[State -2, Dragon Switch]
type = VarSet
triggerall = var(18) = 1
triggerall = command = "start"
triggerall = command = "holdback"
triggerall = anim != 200 || animelemno(0) > 2
trigger1 = numhelper(10001)
trigger1 = helper(10001), movetype != A
var(11) = 102
ignorehitpause = 1

[State -2, Dragon 1 Element Change]
type = VarSet
triggerall = var(18) = 2
triggerall = var(11)
triggerall = numhelper(10000)
trigger1 = helper(10000), var(4) < 3
var(13) = -1
ignorehitpause = 1

[State -2, Dragon 2 Element Change]
type = VarSet
triggerall = var(18) = 2
triggerall = var(11)
triggerall = numhelper(10001)
trigger1 = helper(10001), var(4) < 3
var(14) = -1
ignorehitpause = 1

[State -2, Dragon 1 Element]
type = VarSet
trigger1 = var(13) = -1
var(13) = ifelse(var(14) = -1, random%4, (random%2)*2 + ifelse(var(14)%2, 0, 1))
ignorehitpause = 1

[State -2, Dragon 2 Element]
type = VarSet
trigger1 = var(14) = -1
var(14) = ifelse(var(13) = -1, random%4, (random%2)*2 + ifelse(var(13)%2, 0, 1))
ignorehitpause = 1

[State -2, Dragon Element Change]
type = VarSet
trigger1 = var(11) = 100
var(11) = 0
ignorehitpause = 1

[State -2, Dragon 1 Element Update]
type = VarSet
triggerall = var(18) != 2
triggerall = numhelper(10000)
triggerall = numhelper(10001)
trigger1 = helper(10000), var(4) < 3
trigger1 = helper(10001), var(4) < 3
var(13) = helper(10000), var(1)
ignorehitpause = 1

[State -2, Dragon 2 Element Update]
type = VarSet
triggerall = var(18) != 2
triggerall = numhelper(10000)
triggerall = numhelper(10001)
trigger1 = helper(10000), var(4) < 3
trigger1 = helper(10001), var(4) < 3
var(14) = helper(10001), var(1)
ignorehitpause = 1

[State -2, Dragon 1 Element Selection]
type = VarSet
triggerall = roundstate < 2
triggerall = !var(11)
triggerall = var(15)
trigger1 = command = "up"
trigger2 = command = "down"
var(13) = (var(13) + 2)%4
ignorehitpause = 1

[State -2, Dragon 2 Element Selection]
type = VarSet
triggerall = roundstate < 2
triggerall = !var(11)
triggerall = var(15)
trigger1 = command = "back"
trigger2 = command = "fwd"
var(14) = (var(14) + 2)%4
ignorehitpause = 1

[State -2, Dragon Knockback Flag]
type = VarSet
trigger1 = var(12) = 2
trigger1 = movetype != H
var(12) = 0
ignorehitpause = 1

[State -2, Dragon Knockback Flag]
type = VarSet
trigger1 = var(12) = 1
trigger1 = movetype = H
var(12) = 2
ignorehitpause = 1

[State -2, Dragon Knockback Flag]
type = VarSet
trigger1 = var(12) = 0
trigger1 = movetype = H
trigger1 = gethitvar(animtype) = [3, 5]
var(12) = 1
ignorehitpause = 1

[State -2, Width Scale]
type = Width
trigger1 = statetype != A
player = floor(const(size.ground.front)*(const(size.xscale) - 1)), floor(const(size.ground.back)*(const(size.xscale) - 1))

[State -2, Width Scale]
type = Width
trigger1 = statetype = A
player = floor(const(size.air.front)*(const(size.xscale) - 1)), floor(const(size.air.back)*(const(size.xscale) - 1))

[State -2, Wakeup Flag]
type = VarSet
trigger1 = var(17) = -1
var(17) = 0
ignorehitpause = 1

[State -2, Wakeup Flag]
type = VarSet
triggerall = var(17) = 1
trigger1 = stateno != 5120
trigger1 = stateno != 5210
trigger1 = stateno != 1350
trigger1 = stateno != [100, 106]
var(17) = -1
ignorehitpause = 1

[State -2, AI Hitstun Counter]
type = VarAdd
triggerall = var(56) < 600
trigger1 = movetype = H
trigger2 = statetype = L
var(56) = 1
ignorehitpause = 1

[State -2, AI Hitstun Counter]
type = VarAdd
trigger1 = var(56) > 0
trigger1 = movetype != H
trigger1 = statetype != L
trigger1 = gametime%2
var(56) = ceil(-1 - var(56)/100.0)
ignorehitpause = 1

[State -2, Ko effect pos]
type = Helper
trigger1 = roundstate > 2
trigger1 = !numhelper(20182)
name = "ko tracker"
id = 20182
stateno = 20182
pos = floor(p2dist x), floor(p2dist y)
ignorehitpause = 1

[State -2, Debug Info]
type = DisplayToClipboard
trigger1 = 1
text = "ai %d, hitstun counter %d, backedgebodydist %d, p2dist x %d, numenemy %d"
params = var(59), var(56), backedgebodydist, var(23), numenemy
ignorehitpause = 1

;==================================================================================
;======| 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

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


;---------------------------------------------------------------------------
; 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 = "a") ^^ (command = "a2")
trigger2 = (command = "b") ^^ (command = "b2")
trigger3 = (command = "c") ^^ (command = "c2")
trigger4 = (command = "x") ^^ (command = "x2")
trigger5 = (command = "y") ^^ (command = "y2")
trigger6 = (command = "z") ^^ (command = "z2")
trigger7 = (command = "start") ^^ (command = "start2")
trigger8 = (command = "holda") ^^ (command = "holda2")
trigger9 = (command = "holdb") ^^ (command = "holdb2")
trigger10 = (command = "holdc") ^^ (command = "holdc2")
trigger11 = (command = "holdx") ^^ (command = "holdx2")
trigger12 = (command = "holdy") ^^ (command = "holdy2")
trigger13 = (command = "holdz") ^^ (command = "holdz2")
trigger14 = (command = "holdstart") ^^ (command = "holdstart2")
trigger15 = (command = "holdfwd") ^^ (command = "holdfwd2")
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, Float]
type = VelAdd
triggerall = statetype = A
triggerall = hitshakeover
trigger1 = movetype != H
trigger2 = stateno = [120, 155]
y = -const(movement.yaccel)*0.5

;This controller plays a sound everytime the player lands from a jump, or
;from a back-dash.
;[State -3, Landing Sound]
;type = PlaySnd
;triggerall = Time = 1
;trigger1 = stateno = 52 ;Jump land
;trigger2 = stateno = 106 ;Run-back land
;value = 52, 0
