;Vars:
;	0  = temp var
;	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  = guard crush fx check
;	9  = starting animelem
;	10 = fake statetype flag
;	11 = altitude flag
;	12 = normal walking off/on
;	13 = hover statetype
;	14 = id of most recent hitdef
;	15 = highjump buffer
;	16 = custom gameplay off/on

;	18 = hit tracking

;	22 = warzard hitsparks off/on
;	23 = hitsound flag
;	24 = target pos
;	25 = helper pos
;	26 = movehit/fx sound flag
;	27 = fx element flag
;	28 = previous hitpausetime
;	29 = holdz
;	30 = holdc

;	33 = delay damage dampening

;	37 = previous uniqhitcount
;	38 = combo counter
;	39 = helper combo counter
;	40 = helper has target

;	43 = juggle flag
;	44 = juggle level

;	51 = walk timer
;	52 = enemy cornered
;	53 = hitstun balance

;	56 = pause/superpause check
;	57 = (Winane) GameTime var, for pause and custom state check
;	58 = ai action select
;	59 = (Winane) AI

;Fvars:
;	0  = temp var
;	1  = temp var
;	2  = hover height

;	3  = math var
;	4  = math var

;	10 = AI aggression setting

;	12 = guard crush strength setting
;	13 = overall damage mod
;	14 = damage dampening setting

;Channels:
;	0  = voice
;	1  = swing
;	2  = flap
;	3  = fire
;	4  = fx

[Data]
life = 1000			;Amount of life to start with
attack = 90		;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 = 1		;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 = 20		;Player width (back, ground)
ground.front = 20		;Player width (front, ground)
air.back = 20		;Player width (back, air)
air.front = 20		;Player width (front, air)
height = 60			;Height of player (for opponent to jump over)
attack.dist = 200		;Default attack distance
proj.attack.dist = 90	;Default attack distance for projectiles
proj.doscale = 1		;Set to 1 to scale projectiles too   
;head.pos = 25, -107	;head pos while standing
head.pos = -20, -125	;head pos when hit high
mid.pos = 8, -75		;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  = 3.33		;Walk forward
walk.back = -3.33		;Walk backward
run.fwd  = 7.5, 0		;Run forward (x, y)
run.back = -5, -6.96		;Dash backward (x, y)
jump.neu = 0,-11.6		;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,-11.6;Running jump speeds (opt)
runjump.fwd = 4,-11.6	;.
airjump.neu = 0,-11.6	;.
airjump.back = -2.5	;Air jump speeds (opt)
airjump.fwd = 2.5		;.

[Movement]
airjump.num = 0		;Number of air jumps allowed (opt)
airjump.height = 35	;Minimum distance from ground before you can air jump (opt)
yaccel = .429		;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 = ChangeAnim
trigger1 = anim = 6
value = 5

[State 180, 3]
type = ChangeAnim
triggerall = var(11)
trigger1 = anim = 5
value = 15

[State 180, 1]
type = VarSet
trigger1 = anim = 5 || anim = 15
trigger2 = anim = 20
var(9) = 65

[State 180, 1]
type = VarSet
trigger1 = anim = [5005, 5027]
trigger2 = anim = [5505, 5527]
var(9) = 69

[State 180, 1]
type = VarSet
trigger1 = anim = [140, 142]
var(9) = 21

[State 180, 1]
type = VarSet
trigger1 = anim = 0
trigger2 = anim = [21, 22]
trigger3 = anim = 100
var(9) = animelemno(0)

[State 180, 1]
type = ChangeAnim
trigger1 = (anim != [1, 2]) && (Anim != 5 && anim != 15)
trigger1 = fvar(0) := 8*sin(var(9)*pi/36.5 + pi*1.5)*const(size.yscale) || 1
trigger1 = var(0) := 30
trigger2 = (Anim = 5 || anim = 15) && AnimTime = 0 ;Turn anim over
trigger2 = fvar(0) := 8*sin(var(9)*pi/36.5 + pi*1.5)*const(size.yscale) || 1
trigger2 = var(0) := 30
value = ifelse( var(11), 2, 1 )
elem = var(9)

[State 180, ChangeState]
type = ChangeState
trigger1 = anim > 2
trigger2 = animelem = 41
value = 181

[State 180, 1]
type = VarSet
trigger1 = anim = [1, 2]
var(9) = 0

[State 180, 1]
type = VarSet
trigger1 = var(0) < 90
fvar(1) = fvar(0)*(0.5 + 0.5*sin(var(0)*pi/60))

[State 180, 1]
type = VarSet
trigger1 = var(0) = 90
fvar(1) = 0

[State 180, 1]
type = VarAdd
trigger1 = var(0) < 90
var(0) = 1

[State 180, Sine]
type = Offset
trigger1 = anim = [1, 2]
y = fvar(1) - 8*sin(animelemno(0)*pi/36.5 + pi*1.5)*const(size.yscale)

[State 180, 1]
type = AssertSpecial
trigger1 = time < 300
flag = RoundNotOver

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

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

[State 181, ChangeAnim]
type = ChangeAnim
trigger1 = animelem = 12
value = 180
elem = 4

[State 181, ExplodS]
type = Explod
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-48*const(size.xscale)), floor(-112*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 181, ExplodS]
type = Explod
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-48*const(size.xscale)), floor(-48*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 181, ExplodS]
type = Explod
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-112*const(size.xscale)), floor(-48*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 181, ExplodS]
type = Explod
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(16*const(size.xscale)), floor(-112*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 181, ExplodS]
type = Explod
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(16*const(size.xscale)), floor(-48*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 181, ExplodS]
type = Explod
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(80*const(size.xscale)), floor(-48*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

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

[State 181, 1]
type = AssertSpecial
trigger1 = time < 180
flag = RoundNotOver

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

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

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


[Statedef 191]
type = S
ctrl = 0
anim = 191
velset = 0,0

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

[State 191, Explod]
type = Explod
trigger1 = !time
id = 101919
postype = p1
anim = 101919
bindtime = -1
pos = 0, floor(-106*const(size.yscale))
sprpriority = 1
ownpal = 1
removetime = -1
scale = const(size.xscale), const(size.yscale)

[State 191, Explod]
type = Explod
trigger1 = !time
id = 101918
postype = p1
anim = 101918
bindtime = -1
pos = 0, floor(-96*const(size.yscale))
sprpriority = 1
ownpal = 1
removetime = -1
scale = const(size.xscale), const(size.yscale)

[State 191, Explod]
type = Explod
trigger1 = !time
id = 101917
postype = p1
anim = 101917
bindtime = -1
pos = 0, floor(-86*const(size.yscale))
sprpriority = 1
ownpal = 1
removetime = -1
scale = const(size.xscale), const(size.yscale)

[State 191, Explod]
type = Explod
trigger1 = !time
id = 101916
postype = p1
anim = 101916
bindtime = -1
pos = 0, floor(-76*const(size.yscale))
sprpriority = 1
ownpal = 1
removetime = -1
scale = const(size.xscale), const(size.yscale)

[State 191, Explod]
type = Explod
trigger1 = !time
id = 101915
postype = p1
anim = 101915
bindtime = -1
pos = 0, floor(-66*const(size.yscale))
sprpriority = 1
ownpal = 1
removetime = -1
scale = const(size.xscale), const(size.yscale)

[State 191, Explod]
type = Explod
trigger1 = !time
id = 101914
postype = p1
anim = 101914
bindtime = -1
pos = 0, floor(-56*const(size.yscale))
sprpriority = 1
ownpal = 1
removetime = -1
scale = const(size.xscale), const(size.yscale)

[State 191, Explod]
type = Explod
trigger1 = !time
id = 101913
postype = p1
anim = 101913
bindtime = -1
pos = 0, floor(-46*const(size.yscale))
sprpriority = 1
ownpal = 1
removetime = -1
scale = const(size.xscale), const(size.yscale)

[State 191, Explod]
type = Explod
trigger1 = !time
id = 101912
postype = p1
anim = 101912
bindtime = -1
pos = 0, floor(-36*const(size.yscale))
sprpriority = 1
ownpal = 1
removetime = -1
scale = const(size.xscale), const(size.yscale)

[State 191, Explod]
type = Explod
trigger1 = !time
id = 101911
postype = p1
anim = 101911
bindtime = -1
pos = 0, floor(-26*const(size.yscale))
sprpriority = 1
ownpal = 1
removetime = -1
scale = const(size.xscale), const(size.yscale)

[State 191, Explod]
type = Explod
trigger1 = !time
id = 101910
postype = p1
anim = 101910
bindtime = -1
pos = 0, floor(-16*const(size.yscale))
sprpriority = 1
ownpal = 1
removetime = -1
scale = const(size.xscale), const(size.yscale)

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%10 = 3
id = 101910
sprpriority = -1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%10 = 6
id = 101910
sprpriority = 1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%10 = 1
id = 101911
sprpriority = -1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%10 = 4
id = 101911
sprpriority = 1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 6
id = 101912
sprpriority = -1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 11
id = 101912
sprpriority = 1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 0
id = 101913
sprpriority = -1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 5
id = 101913
sprpriority = 1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 8
id = 101914
sprpriority = -1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 13
id = 101914
sprpriority = 1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 2
id = 101915
sprpriority = -1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 7
id = 101915
sprpriority = 1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 10
id = 101916
sprpriority = -1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 1
id = 101916
sprpriority = 1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 4
id = 101917
sprpriority = -1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%14 = 9
id = 101917
sprpriority = 1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%10 = 7
id = 101918
sprpriority = -1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%10 = 0
id = 101918
sprpriority = 1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%10 = 5
id = 101919
sprpriority = -1

[State 191, ModifyExplod]
type = ModifyExplod
trigger1 = time%10 = 8
id = 101919
sprpriority = 1

[State 191, AssertSpecial]
type = AssertSpecial
trigger1 = animelemno(0) = 2
trigger1 = time%4 > 1
flag = Invisible

[State 191, RemoveExplod]
type = RemoveExplod
trigger1 = animelem = 3

[State 191, PlaySnd]
type = PlaySnd
trigger1 = animelem = 3
value = 180, 0
channel = 0

[State 191, Explod0]
type = Explod
trigger1 = animelem = 3
id = 101920
postype = p1
anim = 101920
bindtime = 1
pos = floor(-32*const(size.xscale)), floor(-64*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
removetime = 76
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 191, Explod1]
type = Explod
trigger1 = animelem = 3
id = 101920
postype = p1
anim = 101920
bindtime = 1
pos = floor(-16*const(size.xscale)), floor(-88*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
removetime = 76
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 191, Explod2]
type = Explod
trigger1 = animelem = 3
id = 101920
postype = p1
anim = 101920
bindtime = 1
pos = floor(-16*const(size.xscale)), floor(-40*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
removetime = 76
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 191, Explod3]
type = Explod
trigger1 = animelem = 3
id = 101920
postype = p1
anim = 101920
bindtime = 1
pos = floor(0*const(size.xscale)), floor(-64*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
removetime = 76
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 191, Explod4]
type = Explod
trigger1 = animelem = 3
id = 101920
postype = p1
anim = 101920
bindtime = 1
pos = floor(16*const(size.xscale)), floor(-88*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
removetime = 76
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 191, Explod5]
type = Explod
trigger1 = animelem = 3
id = 101920
postype = p1
anim = 101920
bindtime = 1
pos = floor(16*const(size.xscale)), floor(-40*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
removetime = 76
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 191, Explod6]
type = Explod
trigger1 = animelem = 3
id = 101920
postype = p1
anim = 101920
bindtime = 1
pos = floor(32*const(size.xscale)), floor(-64*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
removetime = 76
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 191, Explod7]
type = Explod
trigger1 = animelem = 3
id = 10193
postype = p1
anim = 10193
bindtime = 1
;pos = floor(-16*const(size.xscale)), floor(-40*const(size.yscale))
sprpriority = 1
ownpal = 1
scale = const(size.xscale), const(size.yscale)

[State 191, 1] ;Freeze animation until PreIntro is over
type = ChangeState
trigger1 = !animtime
value = 0

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


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

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

;---------------------------------------------------------------------------
; Standing Light Punch
; CNS difficulty: easy
[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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 200 + (var(11) != 0)				;Change animation (Def: no change)
poweradd = 25			;Power to add (Def: 0)
sprpriority = 2			;Set layering priority to 2 (in front)

[State StateType]
type = StateTypeSet
trigger1 = !time
trigger1 = var(10) = 3
statetype = A
physics = N

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State 200, PlaySnd]
type = PlaySnd
trigger1 = animelemno(1) = 2
value = 20, 1
persistent = 0
channel = 1

[State 200, 1]
type = HitDef
triggerall = var(22)
triggerall = !var(43)
triggerall = !var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*500) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NA
damage = 104, 0
animtype = Medium
guardflag = MA
hitflag = MA
pausetime = 11, 11
sparkno = s17001
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = ifelse(p2bodydist x < 20, ifelse(p2bodydist x < 0, -30, ceil(p2bodydist x - 30)), -10), floor(-58*const(size.yscale))
hitsound   = -1 + (var(23) := 2)*0 ;s5,1
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = -7.5
ground.hittime  = 16
ground.slidetime  = 16
guard.hittime = 15
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 200, 1]
type = HitDef
triggerall = var(22)
triggerall = !var(43)
triggerall = var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*500) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, NA
damage = 104, 0
animtype = Medium
guardflag = MA
hitflag = MA
pausetime = 11, 11
sparkno = s17001
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = ifelse(p2bodydist x < 20, ifelse(p2bodydist x < 0, -30, ceil(p2bodydist x - 30)), -10), floor(-58*const(size.yscale))
hitsound   = -1 + (var(23) := 2)*0 ;s5,1
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = -7.5
ground.hittime  = 16
ground.slidetime  = 16
guard.hittime = 15
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 200, 1]
type = HitDef
triggerall = !var(22)
triggerall = !var(43)
triggerall = !var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*500) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NA
damage = 104, 0
animtype = Medium
guardflag = MA
hitflag = MA
pausetime = 11, 11
sparkno = 1
sparkxy = ifelse(p2bodydist x < 20, ifelse(p2bodydist x < 0, -30, ceil(p2bodydist x - 30)), -10), floor(-58*const(size.yscale))
hitsound   = -1 + (var(23) := 2)*0 ;s5,1
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = -7.5
ground.hittime  = 16
ground.slidetime  = 16
guard.hittime = 15
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 200, 1]
type = HitDef
triggerall = !var(22)
triggerall = !var(43)
triggerall = var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*500) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, NA
damage = 104, 0
animtype = Medium
guardflag = MA
hitflag = MA
pausetime = 11, 11
sparkno = 1
sparkxy = ifelse(p2bodydist x < 20, ifelse(p2bodydist x < 0, -30, ceil(p2bodydist x - 30)), -10), floor(-58*const(size.yscale))
hitsound   = -1 + (var(23) := 2)*0 ;s5,1
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = -7.5
ground.hittime  = 16
ground.slidetime  = 16
guard.hittime = 15
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 200, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 69
trigger1 = var(10) = 3
value = 50
ctrl = 0

[State 200, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 69
value = 0
ctrl = 1

[State Idle Anim]
type = StateTypeSet
trigger1 = animelem = 4
movetype = I

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
statetype = A
ignorehitpause = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
trigger1 = inguarddist
trigger1 = !var(13)
trigger1 = p2statetype != A || p2movetype != A || !(enemynear, hitdefattr = SCA, AT)
statetype = S
ignorehitpause = 1

;---------------------------------------------------------------------------
; Standing Medium Punch
; CNS difficulty: easy
[Statedef 210]
type    = S
movetype= A
physics = S
poweradd= 35
ctrl = 0
velset = 0,0
anim = 210 + (var(11) != 0)
sprpriority = 2			;Set layering priority to 2 (in front)

[State StateType]
type = StateTypeSet
trigger1 = !time
trigger1 = var(10) = 3
statetype = A
physics = N

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State 210, PlaySnd]
type = PlaySnd
trigger1 = animelemno(1) = 2
value = 20, 2
persistent = 0
channel = 1

[State 210, 1]
type = HitDef
triggerall = var(22)
triggerall = !var(43)
triggerall = !var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*600) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NA
damage = 144, 0
animtype = Up
guardflag = MA
hitflag = MA
pausetime = 14, 15
guard.pausetime = 13, 13
sparkno = s17002
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = -10, floor(-ifelse(animelemno(0) = 3, 49, 123)*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -0.83, -15
ground.hittime  = 16
ground.slidetime  = 16
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 15
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -0.83, -13.75
fall = 1
fall.recover = 0
fall.yvelocity = -4
airguard.velocity = -3, -6.43
yaccel = .536

[State 210, 1]
type = HitDef
triggerall = var(22)
triggerall = !var(43)
triggerall = var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*600) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, NA
damage = 144, 0
animtype = Up
guardflag = MA
hitflag = MA
pausetime = 14, 15
guard.pausetime = 13, 13
sparkno = s17002
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = -10, floor(-ifelse(animelemno(0) = 3, 49, 123)*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -0.83, -15
ground.hittime  = 16
ground.slidetime  = 16
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 15
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -0.83, -13.75
fall = 1
fall.recover = 0
fall.yvelocity = -4
airguard.velocity = -3, -6.43
yaccel = .536

[State 210, 1]
type = HitDef
triggerall = !var(22)
triggerall = !var(43)
triggerall = !var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*600) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NA
damage = 144, 0
animtype = Up
guardflag = MA
hitflag = MA
pausetime = 14, 15
guard.pausetime = 13, 13
sparkno = 2
sparkxy = -10, floor(-ifelse(animelemno(0) = 3, 49, 123)*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -0.83, -15
ground.hittime  = 16
ground.slidetime  = 16
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 15
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -0.83, -13.75
fall = 1
fall.recover = 0
fall.yvelocity = -4
airguard.velocity = -3, -6.43
yaccel = .536

[State 210, 1]
type = HitDef
triggerall = !var(22)
triggerall = !var(43)
triggerall = var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*600) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, NA
damage = 144, 0
animtype = Up
guardflag = MA
hitflag = MA
pausetime = 14, 15
guard.pausetime = 13, 13
sparkno = 2
sparkxy = -10, floor(-ifelse(animelemno(0) = 3, 49, 123)*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -0.83, -15
ground.hittime  = 16
ground.slidetime  = 16
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 15
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -0.83, -13.75
fall = 1
fall.recover = 0
fall.yvelocity = -4
airguard.velocity = -3, -6.43
yaccel = .536

[State 210, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 69
trigger1 = var(10) = 3
value = 50
ctrl = 0

[State 210, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 69
value = 0
ctrl = 1

[State Idle Anim]
type = StateTypeSet
trigger1 = animelem = 5
movetype = I

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
statetype = A
ignorehitpause = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
trigger1 = inguarddist
trigger1 = !var(13)
trigger1 = p2statetype != A || p2movetype != A || !(enemynear, hitdefattr = SCA, AT)
statetype = S
ignorehitpause = 1

;---------------------------------------------------------------------------
; Standing Light Kick
; CNS difficulty: easy
[Statedef 230]
type    = S
movetype= A
physics = S
poweradd= 20
ctrl = 0
velset = 0,0
anim = 230 + (var(11) != 0)
sprpriority = 2			;Set layering priority to 2 (in front)

[State StateType]
type = StateTypeSet
trigger1 = !time
trigger1 = var(10) = 3
statetype = A
physics = N

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State 230, PlaySnd]
type = PlaySnd
trigger1 = animelemno(1) = 2
value = 20, 0
persistent = 0
channel = 1

[State 230, 1]
type = HitDef
triggerall = var(22)
triggerall = !var(43)
triggerall = !var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*400) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NA
damage = 96, 0
animtype = Light
guardflag = MA
hitflag = MA
pausetime = 9, 9
sparkno = s17000
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = ifelse(p2bodydist x < 20, ifelse(p2bodydist x < 0, -30, ceil(p2bodydist x - 30)), -10), floor(-40*const(size.yscale))
hitsound   = -1 + (var(23) := 1)*0 ;s5,0
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -5
ground.hittime  = 11
ground.slidetime  = 11
guard.hittime = 10
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 230, 1]
type = HitDef
triggerall = var(22)
triggerall = !var(43)
triggerall = var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*400) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, NA
damage = 96, 0
animtype = Light
guardflag = MA
hitflag = MA
pausetime = 9, 9
sparkno = s17000
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = ifelse(p2bodydist x < 20, ifelse(p2bodydist x < 0, -30, ceil(p2bodydist x - 30)), -10), floor(-40*const(size.yscale))
hitsound   = -1 + (var(23) := 1)*0 ;s5,0
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = -5
ground.hittime  = 11
ground.slidetime  = 11
guard.hittime = 10
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 230, 1]
type = HitDef
triggerall = !var(22)
triggerall = !var(43)
triggerall = !var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*400) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NA
damage = 96, 0
animtype = Light
guardflag = MA
hitflag = MA
pausetime = 9, 9
sparkno = 0
sparkxy = ifelse(p2bodydist x < 20, ifelse(p2bodydist x < 0, -30, ceil(p2bodydist x - 30)), -10), floor(-40*const(size.yscale))
hitsound   = -1 + (var(23) := 1)*0 ;s5,0
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -5
ground.hittime  = 11
ground.slidetime  = 11
guard.hittime = 10
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 230, 1]
type = HitDef
triggerall = !var(22)
triggerall = !var(43)
triggerall = var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*400) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, NA
damage = 96, 0
animtype = Light
guardflag = MA
hitflag = MA
pausetime = 9, 9
sparkno = 0
sparkxy = ifelse(p2bodydist x < 20, ifelse(p2bodydist x < 0, -30, ceil(p2bodydist x - 30)), -10), floor(-40*const(size.yscale))
hitsound   = -1 + (var(23) := 1)*0 ;s5,0
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = -5
ground.hittime  = 11
ground.slidetime  = 11
guard.hittime = 10
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 230, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 65
trigger1 = var(10) = 3
value = 50
ctrl = 0

[State 230, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 65
value = 0
ctrl = 1

[State 230, CtrlSet]
type = CtrlSet
trigger1 = time = 21
value = 1

[State Idle Anim]
type = StateTypeSet
trigger1 = animelem = 3
movetype = I

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
statetype = A
ignorehitpause = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
trigger1 = inguarddist
trigger1 = !var(13)
trigger1 = p2statetype != A || p2movetype != A || !(enemynear, hitdefattr = SCA, AT)
statetype = S
ignorehitpause = 1

;---------------------------------------------------------------------------
; Standing Medium Kick
; CNS difficulty: easy
[Statedef 240]
type    = S
movetype= A
physics = S
poweradd= 30
ctrl = 0
velset = 0,0
anim = 240 + (var(11) != 0)
sprpriority = 2			;Set layering priority to 2 (in front)

[State StateType]
type = StateTypeSet
trigger1 = !time
trigger1 = var(10) = 3
statetype = A
physics = N

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State 240, PlaySnd]
type = PlaySnd
trigger1 = animelemno(1) = 2
value = 20, 2
persistent = 0
channel = 1

[State 240, 2]
type = HitDef
triggerall = var(22)
triggerall = !var(43)
triggerall = !var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*600) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NA
damage = 128, 0
animtype = Back
guardflag = MA
hitflag = MA
pausetime = 14, 15
guard.pausetime = 13, 13
sparkno = s17002
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = ifelse(p2bodydist x < 40, ifelse(p2bodydist x < 0, -50, ceil(p2bodydist x - 50)), -10), floor(-55.5*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -5, -4.99
ground.hittime  = 22
ground.slidetime  = 22
ground.cornerpush.veloff = 0
guard.hittime = 21
guard.velocity = -10
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.velocity = -5, -6.43
fall = 1
fall.recover = 0
airguard.velocity = -5, -6.43
yaccel = .536

[State 240, 2]
type = HitDef
triggerall = var(22)
triggerall = !var(43)
triggerall = var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*600) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, NA
damage = 128, 0
animtype = Back
guardflag = MA
hitflag = MA
pausetime = 14, 15
guard.pausetime = 13, 13
sparkno = s17002
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = ifelse(p2bodydist x < 40, ifelse(p2bodydist x < 0, -50, ceil(p2bodydist x - 50)), -10), floor(-55.5*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -5, -4.99
ground.hittime  = 22
ground.slidetime  = 22
ground.cornerpush.veloff = 0
guard.hittime = 21
guard.velocity = -10
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.velocity = -5, -6.43
fall = 1
fall.recover = 0
airguard.velocity = -5, -6.43
yaccel = .536

[State 240, 2]
type = HitDef
triggerall = !var(22)
triggerall = !var(43)
triggerall = !var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*600) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NA
damage = 128, 0
animtype = Back
guardflag = MA
hitflag = MA
pausetime = 14, 15
guard.pausetime = 13, 13
sparkno = 2
sparkxy = ifelse(p2bodydist x < 40, ifelse(p2bodydist x < 0, -50, ceil(p2bodydist x - 50)), -10), floor(-55.5*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -5, -4.99
ground.hittime  = 22
ground.slidetime  = 22
ground.cornerpush.veloff = 0
guard.hittime = 21
guard.velocity = -10
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.velocity = -5, -6.43
fall = 1
fall.recover = 0
airguard.velocity = -5, -6.43
yaccel = .536

[State 240, 2]
type = HitDef
triggerall = !var(22)
triggerall = !var(43)
triggerall = var(11)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*600) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, NA
damage = 128, 0
animtype = Back
guardflag = MA
hitflag = MA
pausetime = 14, 15
guard.pausetime = 13, 13
sparkno = 2
sparkxy = ifelse(p2bodydist x < 40, ifelse(p2bodydist x < 0, -50, ceil(p2bodydist x - 50)), -10), floor(-55.5*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -5, -4.99
ground.hittime  = 22
ground.slidetime  = 22
ground.cornerpush.veloff = 0
guard.hittime = 21
guard.velocity = -10
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.velocity = -5, -6.43
fall = 1
fall.recover = 0
airguard.velocity = -5, -6.43
yaccel = .536

[State 240, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 69
trigger1 = var(10) = 3
value = 50
ctrl = 0

[State 240, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 69
value = 0
ctrl = 1

[State Idle Anim]
type = StateTypeSet
trigger1 = animelem = 3
movetype = I

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
statetype = A
ignorehitpause = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
trigger1 = inguarddist
trigger1 = !var(13)
trigger1 = p2statetype != A || p2movetype != A || !(enemynear, hitdefattr = SCA, AT)
statetype = S
ignorehitpause = 1

;---------------------------------------------------------------------------
; Stomp

[Statedef 600]
type    = A
movetype= A
physics = N
ctrl = 0
anim = 600
velset = 0, 0
sprpriority = 2

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State 600, VarSet]
type = VarSet
trigger1 = !time
var(0) = ifelse(pos y < -128, 1, 0)

[State 600, VelSet]
type = VelSet
trigger1 = animelem = 3
y = 12.86

[State 600, 2]
type = ChangeState
trigger1 = vel y > 0
trigger1 = pos y + vel y >= 0
value = 602

[State 600, VelSet]
type = VelAdd
trigger1 = animelemno(-1) > 2
y = 0.536

[State 600, PlaySnd]
type = PlaySnd
trigger1 = animelem = 3
value = 20, 2
persistent = 0
channel = 1

[Statedef 602]
type    = A
movetype= A
physics = S
ctrl = 0
anim = 602
velset = 0, 0
sprpriority = 2

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State StateType]
type = StateTypeSet
trigger1 = time = 1
trigger1 = var(10) := 1
statetype = S

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

[State 602, PlaySnd]
type = PlaySnd
trigger1 = !time
value = 8, 2
channel = 1

[State 602, PlaySnd]
type = PlaySnd
trigger1 = projguardedtime(var(14)) = 0
value = 6, 0
channel = 1

[State 602, EnvShake]
type = EnvShake
trigger1 = !time
time = 6
freq = 50
ampl = 2 + 4*var(0)
phase = 270
persistent = 0

[State 602, Explod]
type = Explod
trigger1 = !time
trigger1 = !var(0)
postype = p1
anim = F61
bindtime = 1
pos = 0, 5
sprpriority = -5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1

[State 602, Explod]
type = Explod
trigger1 = !time
trigger1 = var(0)
postype = p1
anim = F62
bindtime = 1
pos = 0, 5
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1

[State 602, ChangeState]
type = ChangeState
trigger1 = !animtime
trigger1 = var(9) := 25
value = 0
ctrl = 1

[State 602, 1]
type = Projectile
triggerall = var(22)
trigger1 = p2dist x >= 0
trigger1 = !var(0)
trigger1 = !time
trigger1 = var(6) := floor(fvar(12)*400) || 1
projanim = 604
projid = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
projremovetime = 1
projfacing = ifelse(p2dist x > 0, 1, -1)
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NT
hitonce = 0
damage = 80, 0
animtype = Medium
guardflag = LA
hitflag = M
pausetime = 0, 11
sparkno = s17001
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = floor(p2dist x), -5
hitsound   = -1 + (var(23) := 2)*0 ;s5,2
guardsound = s6,-1 + 3*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -7.5
ground.hittime  = 16
ground.slidetime  = 16
guard.hittime = 15
guard.kill = 0
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 602, 2]
type = Projectile
triggerall = var(22)
trigger1 = p2dist x >= 0
trigger1 = var(0)
trigger1 = !time
trigger1 = var(6) := floor(fvar(12)*400) || 1
projanim = 606
projid = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
projremovetime = 1
projfacing = ifelse(p2dist x > 0, 1, -1)
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NT
hitonce = 0
damage = 96, 0
animtype = Back
guardflag = LA
hitflag = M
pausetime = 0, 13
sparkno = s17002
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = floor(p2dist x), -5
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,-1 + 3*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Trip
ground.velocity = 0, -7.5
ground.hittime  = 20
ground.slidetime  = 20
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 19
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.type = Trip
air.velocity = 0, -7.5
airguard.velocity = -3, -6.43
yaccel = .536
fall = 1
fall.recover = 0

[State 602, 1]
type = Projectile
triggerall = !var(22)
trigger1 = p2dist x >= 0
trigger1 = !var(0)
trigger1 = !time
trigger1 = var(6) := floor(fvar(12)*400) || 1
projanim = 604
projid = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
projremovetime = 1
projfacing = ifelse(p2dist x > 0, 1, -1)
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NT
hitonce = 0
damage = 80, 0
animtype = Medium
guardflag = LA
hitflag = M
pausetime = 0, 11
sparkno = 1
sparkxy = floor(p2dist x), -5
hitsound   = -1 + (var(23) := 2)*0 ;s5,2
guardsound = s6,-1 + 3*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -7.5
ground.hittime  = 16
ground.slidetime  = 16
guard.hittime = 15
guard.kill = 0
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 602, 2]
type = Projectile
triggerall = !var(22)
trigger1 = p2dist x >= 0
trigger1 = var(0)
trigger1 = !time
trigger1 = var(6) := floor(fvar(12)*400) || 1
projanim = 606
projid = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
projremovetime = 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NT
hitonce = 0
damage = 96, 0
animtype = Back
guardflag = LA
hitflag = M
pausetime = 0, 13
sparkno = 2
sparkxy = floor(p2dist x), -5
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,-1 + 3*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Trip
ground.velocity = 0, -7.5
ground.hittime  = 20
ground.slidetime  = 20
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 19
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.type = Trip
air.velocity = 0, -7.5
airguard.velocity = -3, -6.43
yaccel = .536
fall = 1
fall.recover = 0

;/

[State 602, 1]
type = Projectile
triggerall = var(22)
trigger1 = p2dist x < 0
trigger1 = !var(0)
trigger1 = !time
trigger1 = var(6) := floor(fvar(12)*400) || 1
projanim = 604
projid = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
projremovetime = 1
projfacing = ifelse(p2dist x > 0, 1, -1)
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NT
hitonce = 0
damage = 80, 0
animtype = Medium
guardflag = LA
hitflag = M
pausetime = 0, 11
sparkno = s17001
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = floor(p2dist x), -5
hitsound   = -1 + (var(23) := 2)*0 ;s5,2
guardsound = s6,-1 + 3*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = 7.5
ground.hittime  = 16
ground.slidetime  = 16
guard.hittime = 15
guard.kill = 0
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 602, 2]
type = Projectile
triggerall = var(22)
trigger1 = p2dist x < 0
trigger1 = var(0)
trigger1 = !time
trigger1 = var(6) := floor(fvar(12)*400) || 1
projanim = 606
projid = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
projremovetime = 1
projfacing = ifelse(p2dist x > 0, 1, -1)
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NT
hitonce = 0
damage = 96, 0
animtype = Back
guardflag = LA
hitflag = M
pausetime = 0, 13
sparkno = s17002
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = floor(p2dist x), -5
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,-1 + 3*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Trip
ground.velocity = 0, -7.5
ground.hittime  = 20
ground.slidetime  = 20
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 19
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.type = Trip
air.velocity = 0, -7.5
airguard.velocity = -3, -6.43
yaccel = .536
fall = 1
fall.recover = 0

[State 602, 1]
type = Projectile
triggerall = !var(22)
trigger1 = p2dist x < 0
trigger1 = !var(0)
trigger1 = !time
trigger1 = var(6) := floor(fvar(12)*400) || 1
projanim = 604
projid = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
projremovetime = 1
projfacing = ifelse(p2dist x > 0, 1, -1)
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NT
hitonce = 0
damage = 80, 0
animtype = Medium
guardflag = LA
hitflag = M
pausetime = 0, 11
sparkno = 1
sparkxy = floor(p2dist x), -5
hitsound   = -1 + (var(23) := 2)*0 ;s5,2
guardsound = s6,-1 + 3*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = 7.5
ground.hittime  = 16
ground.slidetime  = 16
guard.hittime = 15
guard.kill = 0
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 602, 2]
type = Projectile
triggerall = !var(22)
trigger1 = p2dist x < 0
trigger1 = var(0)
trigger1 = !time
trigger1 = var(6) := floor(fvar(12)*400) || 1
projanim = 606
projid = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
projremovetime = 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, NT
hitonce = 0
damage = 96, 0
animtype = Back
guardflag = LA
hitflag = M
pausetime = 0, 13
sparkno = 2
sparkxy = floor(p2dist x), -5
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,-1 + 3*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Trip
ground.velocity = 0, -7.5
ground.hittime  = 20
ground.slidetime  = 20
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 19
guard.cornerpush.veloff = -13
guard.kill = 0
;air.hittime = 999
airguard.ctrltime = 999
air.type = Trip
air.velocity = 0, -7.5
airguard.velocity = -3, -6.43
yaccel = .536
fall = 1
fall.recover = 0

[State Idle Anim]
type = StateTypeSet
trigger1 = time
movetype = I

;---------------------------------------------------------------------------
; Dodge

[Statedef 700]
type    = S
movetype= I
physics = N
ctrl = 0
anim = ifelse( var(11), 701, 700 )
velset = 0, 0
sprpriority = -1

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

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

[State 700, 5]
type = CtrlSet
trigger1 = AnimTime = -1
value = 1

[State 700, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 65
value = 0
ctrl = 1

[State 700, NotHitBy]
type = NotHitBy
trigger1 = animelemno(0) < 8
value = SCA

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
statetype = A
ignorehitpause = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
trigger1 = inguarddist
trigger1 = !var(13)
trigger1 = p2statetype != A || p2movetype != A || !(enemynear, hitdefattr = SCA, AT)
statetype = S
ignorehitpause = 1

;---------------------------------------------------------------------------
; Altitude Switch

[Statedef 900]
type = A
ctrl = 0
anim = 900
velset = -2.5,-7.5
movetype = I
physics = N
sprpriority = 0

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

[State 900, PlaySnd]
type = PlaySnd
trigger1 = !time
value = 40, 2
channel = 2

[State 900, VarSet]
type = VarSet
trigger1 = !time
var(0) = 0

[State 900, VelAdd]
type = VelAdd
trigger1 = !time
trigger1 = !var(11)
y = (fvar(2) - pos y)/36.0

[State 900, VelAdd]
type = VelAdd
trigger1 = !time
trigger1 = var(11)
y = -pos y/36.0

[State 900, VelAdd]
type = VelAdd
trigger1 = !var(0)
trigger1 = time
y = const(movement.yaccel)

[State 900, PosSet]
type = PosSet
triggerall = vel y > 0
trigger1 = !var(11)
trigger1 = pos y + vel y >= fvar(2)
trigger1 = var(0) := 1
y = fvar(2)

[State 900, PosSet]
type = PosSet
triggerall = vel y > 0
trigger1 = var(11)
trigger1 = pos y + vel y >= 0
trigger1 = var(0) := 1
y = 0

[State 900, VelSet]
type = VelSet
trigger1 = var(0)
x = 0
y = 0

[State 900, PlayerPush]
type = PlayerPush
triggerall = animelemno(0) = 1
trigger1 = prevstateno = [1212, 1255]
value = 0

[State 900, StateTypeSet]
type = StateTypeSet
trigger1 = var(0)
trigger1 = var(10) := 1
statetype = S
physics = S

[State 900, CtrlSet]
type = CtrlSet
trigger1 = var(0)
value = 1

[State 900, VarSet]
type = VarSet
trigger1 = var(0)
var(11) = !var(11)
persistent = 0

[State 900, 2]
type = ChangeState
trigger1 = !animtime
trigger1 = var(9) := 1
value = 0
ctrl = 1

[State 900, 2]
type = ChangeAnim
trigger1 = animelem = 6
value = 100
elem = 53

[State 900, NotHitBy]
type = NotHitBy
trigger1 = !var(0)
value = SCA

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 1
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(0*const(size.xscale)), floor(-64*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 2
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(16*const(size.xscale)), floor(-96*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 3
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-32*const(size.xscale)), floor(-160*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-96*const(size.xscale)), floor(-128*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 5
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-96*const(size.xscale)), floor(-72*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 1
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(0*const(size.xscale)), floor(-64*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 1
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(16*const(size.xscale)), floor(-32*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 1
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-16*const(size.xscale)), floor(-32*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 1
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(0*const(size.xscale)), floor(-80*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 2
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(16*const(size.xscale)), floor(-96*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 2
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(16*const(size.xscale)), floor(-104*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 3
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-32*const(size.xscale)), floor(-160*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-96*const(size.xscale)), floor(-128*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(108*const(size.xscale)), floor(63*const(size.yscale))

[State 900, ExplodS]
type = Explod
triggerall = anim = 900
trigger1 = animelem = 5
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-96*const(size.xscale)), floor(-72*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State StateType Change]
type = StateTypeSet
trigger1 = var(0)
trigger1 = var(11)
statetype = A
ignorehitpause = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(0)
trigger1 = var(11)
trigger1 = inguarddist
trigger1 = !var(13)
trigger1 = p2statetype != A || p2movetype != A || !(enemynear, hitdefattr = SCA, AT)
statetype = S
ignorehitpause = 1

;---------------------------------------------------------------------------
;  Shinjyougokou

[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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 1000 + (var(11) != 0 || var(10) = 3)				;Change animation (Def: no change)
poweradd = 70			;Power to add (Def: 0)
sprpriority = 2			;Set layering priority to 2 (in front)

[State StateType]
type = StateTypeSet
trigger1 = !time
trigger1 = var(10) = 3
statetype = A
physics = N

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State 1000, VarSet]
type = VarSet
trigger1 = !time
trigger1 = !var(11)
trigger1 = !var(0)
trigger1 = var(10) != 3
var(0) = 1

[State 1000, PlaySnd]
type = PlaySnd
trigger1 = animelem = 5
value = 40, 2
channel = 2

[State 1000, Helper]
type = Helper
trigger1 = animelem = 6
id = 1005
name = "feather"
stateno = 1005
ownpal = 1
postype = p1
pos = floor( -49*const(size.xscale) + 0.5), floor( -138*const(size.yscale) + 0.5)

[State 1000, Helper]
type = Helper
trigger1 = animelem = 6
id = 1005
name = "feather"
stateno = 1005
ownpal = 1
postype = p1
pos = floor( -97*const(size.xscale) + 0.5), floor( -90*const(size.yscale) + 0.5)

[State 1000, Helper]
type = Helper
trigger1 = animelem = 6
id = 1005
name = "feather"
stateno = 1005
ownpal = 1
postype = p1
pos = floor( -49*const(size.xscale) + 0.5), floor( -42*const(size.yscale) + 0.5)

[State 1000, Helper]
type = Helper
trigger1 = animelem = 6
id = 1005
name = "feather"
stateno = 1005
ownpal = 1
postype = p1
pos = floor( 47*const(size.xscale) + 0.5), floor( -138*const(size.yscale) + 0.5)

[State 1000, Helper]
type = Helper
trigger1 = animelem = 6
id = 1005
name = "feather"
stateno = 1005
ownpal = 1
postype = p1
pos = floor( 95*const(size.xscale) + 0.5), floor( -90*const(size.yscale) + 0.5)

[State 1000, Helper]
type = Helper
trigger1 = animelem = 6
id = 1005
name = "feather"
stateno = 1005
ownpal = 1
postype = p1
pos = floor( 47*const(size.xscale) + 0.5), floor( -42*const(size.yscale) + 0.5)

[State 1000, Helper]
type = Helper
trigger1 = animelem = 10
id = 1010
name = "sound"
stateno = 1010
ownpal = 0
postype = p1

[State 1000, 5]
type = ChangeState
trigger1 = animelem = 13
trigger1 = var(10) = 3
value = 50
ctrl = 0

[State 1000, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 1
value = 0
ctrl = 1

[State Idle Anim]
type = StateTypeSet
trigger1 = animelem = 12
movetype = I

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
statetype = A
ignorehitpause = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
trigger1 = inguarddist
trigger1 = !var(13)
trigger1 = p2statetype != A || p2movetype != A || !(enemynear, hitdefattr = SCA, AT)
statetype = S
ignorehitpause = 1

[StateDef 1005]
type = A
movetype = A
physics = N
anim = 1005
ctrl = 0
sprpriority = 3

[State 1005, VarSet]
type = VarSet
trigger1 = !time
var(0) = root, var(0)

[State 1005, VarSet]
type = VarSet
trigger1 = root, var(11)
trigger2 = root, var(10) = 3
var(11) = 1

[State 1005, 1]
type = NotHitBy
trigger1 = 1
value = SCA

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

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

[State 1005, DestroySelf]
type = DestroySelf
trigger1 = root, movetype != A
trigger2 = root, anim != [1000, 1001]

[State 1005, ChangeState]
type = ChangeState
trigger1 = root, animelem = 10
value = 1006

[StateDef 1006]
type = A
movetype = A
physics = N

[State 1006, ChangeState]
type = ChangeState
trigger1 = movecontact
value = 1008

[State 1006, DestroySelf]
type = DestroySelf
trigger1 = movereversed
trigger2 = frontedgedist < -100
trigger3 = time > 300

[State 1006, ChangeState]
type = ChangeState
trigger1 = pos y + vel y >= -8*const(size.yscale)
value = 1007

[State 1006, 1]
type = NotHitBy
trigger1 = 1
value = , AA, AT

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

[State 1006, VarSet]
type = VarSet
trigger1 = 1
fvar(1) = ifelse(root, var(39), root, fvar(14)*(root, fvar(14)**root, var(39)), 1)

[State 1006, 1]
type = HitDef
triggerall = !root, var(43)
triggerall = !var(11)
trigger1 = !movecontact && !movereversed
id = 0
attr = S, SP
damage = ceil(fvar(1)*56), ceil(fvar(1)*16)
animtype = Light
guardflag = MA
hitflag = MA
numhits = 2
pausetime = 0, 10 ; +1 to simulate 2nd hit
sparkno = -1
guard.sparkno = -1
hitsound   = -1
guardsound = -1
ground.type = High
ground.velocity = -5
ground.hittime  = 11
ground.slidetime  = 11
ground.cornerpush.veloff = 0
guard.hittime = 10
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

[State 1006, 1]
type = HitDef
triggerall = !root, var(43)
triggerall = var(11)
trigger1 = !movecontact && !movereversed
id = 0
attr = A, SP
damage = ceil(fvar(1)*56), ceil(fvar(1)*16)
animtype = Light
guardflag = MA
hitflag = MA
numhits = 2
pausetime = 0, 10 ; +1 to simulate 2nd hit
sparkno = -1
guard.sparkno = -1
hitsound   = -1
guardsound = -1
ground.type = High
ground.velocity = -5
ground.hittime  = 11
ground.slidetime  = 11
ground.cornerpush.veloff = 0
guard.hittime = 10
air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -3, -6.43
airguard.velocity = -3, -6.43
yaccel = .536

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

[State 1006, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 1005
elem = 22 + var(0)

[State 1006, VarSet]
type = VarSet
trigger1 = !time
fvar(0) = (animelemno(0) - 1)*pi/16 + pi

[State 1006, VelSet]
type = VelSet
trigger1 = !time
x = 12.5*sin(fvar(0))*(3.0/2.5)*const(size.xscale)
y = 15*cos(fvar(0))*(7.0/7.5)*const(size.yscale)

[StateDef 1007]
type = A
movetype = I
physics = N

[State 1007, 1]
type = NotHitBy
trigger1 = 1
value = SCA

[State 1007, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 1005
elem = animelemno(-1)

[State 1007, AssertSpecial]
type = AssertSpecial
trigger1 = time%2
flag = Invisible

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

[State 1007, VarSet] ;height, based on rotation
type = VarSet
trigger1 = !time
fvar(0) = vel y

[State 1007, PosSet]
type = PosSet
trigger1 = !time
x = pos x - ((pos y + fvar(0)*const(size.yscale))/vel y)*vel x*facing
y = -fvar(0)*const(size.yscale)

[State 1007, VelSet]
type = VelSet
trigger1 = !time
x = 0
y = 0

[State 1007, DestroySelf]
type = DestroySelf
trigger1 = time = 30

[StateDef 1008]
type = A
movetype = A
physics = N
movehitpersist = 1
anim = 9999

[State 1008, VelSet]
type = VelSet
trigger1 = 1
x = 14*sin(fvar(0))*(3.0/2.5)*const(size.xscale)
y = 16*cos(fvar(0))*(7.0/7.5)*const(size.yscale)

[State 1008, ParentVarAdd]
type = ParentVarAdd
trigger1 = !time
var(39) = 3

[State 1008, ParentVarSet]
type = ParentVarSet
trigger1 = time = 0
trigger2 = time = 2
var(23) = ifelse(movehit, -1, -2)

[State 1008, ParentVarSet]
type = ParentVarSet
trigger1 = time = 0
trigger2 = time = 2
var(25) = floor(pos x + 0.5)

[State 1008, Explod]
type = Explod
triggerall = root, var(22)
triggerall = movehit
trigger1 = time = 0
trigger2 = time = 2
postype = p1
anim = 27000
bindtime = 1
pos = floor(vel x + 0.5), floor(vel y + 0.5)
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
ownpal = 1
random = 24, 24

[State 1008, Explod]
type = Explod
triggerall = root, var(22)
triggerall = moveguarded
trigger1 = time = 0
trigger2 = time = 1
postype = p1
anim = 17006
bindtime = 1
pos = floor(vel x + 0.5), floor(vel y + 0.5)
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
ownpal = 1

[State 1008, Explod]
type = Explod
triggerall = !root, var(22)
triggerall = movehit
trigger1 = time = 0
trigger2 = time = 2
postype = p1
anim = F0
bindtime = 1
pos = floor(vel x + 0.5), floor(vel y + 0.5)
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
ownpal = 1
random = 24, 24

[State 1008, Explod]
type = Explod
triggerall = !root, var(22)
triggerall = moveguarded
trigger1 = time = 0
trigger2 = time = 1
postype = p1
anim = F40
bindtime = 1
pos = floor(vel x + 0.5), floor(vel y + 0.5)
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
ownpal = 1

[State 1008, VelSet]
type = VelSet
trigger1 = 1
x = 0
y = 0

[State 1008, 1]
type = ParentVarSet
trigger1 = !numtarget
var(39) = 0
ignorehitpause = 1

[State 1008, DestroySelf]
type = DestroySelf
trigger1 = !numtarget
trigger1 = time > 2
trigger2 = time > 300

[State 1008, ParentVarSet]
type = ParentVarSet
trigger1 = numtarget
var(40) = 1

[StateDef 1009]
type = A
movetype = I
physics = N
movehitpersist = 1
anim = 9999

[State 1009, 1]
type = ParentVarSet
trigger1 = !numtarget
var(39) = 0
ignorehitpause = 1

[State 1009, DestroySelf]
type = DestroySelf
trigger1 = time > 30
trigger2 = !numtarget
trigger2 = time > 0

[StateDef 1010]
type = A
movetype = I
physics = N
anim = 9999

[State 1010, PlaySnd]
type = PlaySnd
trigger1 = time%6 = 0
value = 1000, 0
channel = 3

[State 1010, DestroySelf]
type = DestroySelf
trigger1 = time > 18

;---------------------------------------------------------------------------
; Tenshiouzahou

[Statedef 1100]
type    = S
movetype= A
physics = N
poweradd= 70
ctrl = 0
velset = 0,0
anim = 1100
sprpriority = 2			;Set layering priority to 2 (in front)
;3 hits max
;hithitmisshit
;misshitmisshit
;missmisshithit

[State StateType]
type = StateTypeSet
trigger1 = !time
trigger1 = var(10) = 3
statetype = A
physics = N

[State 1100, Turn]
type = Turn
trigger1 = !time
trigger1 = prevstateno = 5120
trigger1 = p2dist x < 0

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

[State 1100, PlaySnd]
type = PlaySnd
trigger1 = !time
trigger1 = var(16)
value = 40, 2
channel = 2

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State 1100, 1]
type = NotHitBy
trigger1 = !time
value = SCA
time = 7

[State 1100, VelAdd]
type = VelAdd
trigger1 = animelemno(-1) > 1
y = ifelse(var(0) || vel y > 0, .321, .241)

[State 1100, VelMul]
type = VelMul
trigger1 = animelemno(-1) > 1
x = .85

[State 1100, VarSet]
type = VarSet
trigger1 = !hitcount
var(1) = 120

[State 1100, VarSet]
type = VarSet
trigger1 = hitcount = 1
var(1) = 48

[State 1100, VarSet]
type = VarSet
trigger1 = hitcount > 1
var(1) = 40

[State 1100, 1]
type = HitDef
trigger1 = 1
attr = A, SA
hitflag =
guardflag = 

[State 1100, 1]
type = HitDef
triggerall = var(22)
triggerall = time ;to allow blocking
triggerall = animelemno(0) > var(18)
triggerall = !var(43) || var(44) < 2 || movecontact
triggerall = var(10) != 3
trigger1 = animelemno(0) = 1
trigger1 = var(6) := floor(fvar(12)*300) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, SA
damage = var(1), var(1)/5
animtype = Up
guardflag = MA
hitflag = MAF
pausetime = 11, 11
sparkno = s17002
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = ifelse(p2bodydist x < 10, ifelse(p2bodydist x < 0, -20, ceil(p2bodydist x - 20)), -10), floor(-100*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -0.83, -15
ground.hittime  = 16
ground.slidetime  = 16
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 15
guard.cornerpush.veloff = 0
guard.kill = 1
;air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -1.67, -10.7
airguard.velocity = -3, -6.43
fall = 1
fall.recover = 0
fall.yvelocity = -4
yaccel = .536

[State 1100, 1]
type = HitDef
triggerall = var(22)
triggerall = time ;to allow blocking
triggerall = animelemno(0) > var(18)
triggerall = !var(43) || var(44) < 2 || movecontact
triggerall = var(10) = 3
trigger1 = animelemno(0) = 1
trigger1 = var(6) := floor(fvar(12)*300) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, SA
damage = var(1), var(1)/5
animtype = Up
guardflag = MA
hitflag = MAF
pausetime = 11, 11
sparkno = s17002
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = ifelse(p2bodydist x < 10, ifelse(p2bodydist x < 0, -20, ceil(p2bodydist x - 20)), -10), floor(-100*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -0.83, -15
ground.hittime  = 16
ground.slidetime  = 16
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 15
guard.cornerpush.veloff = 0
guard.kill = 1
;air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -1.67, -10.7
airguard.velocity = -3, -6.43
fall = 1
fall.recover = 0
fall.yvelocity = -4
yaccel = .536

[State 1100, 1]
type = HitDef
triggerall = var(22)
triggerall = animelemno(0) > var(18)
triggerall = !var(43) || var(44) < 2 || movecontact
trigger1 = animelemno(0) = 2
trigger1 = var(6) := floor(fvar(12)*300) || 1
trigger2 = animelemno(0) > var(18) + 1
trigger2 = var(6) := floor(fvar(12)*300) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, SA
damage = var(1), var(1)/5
animtype = Up
guardflag = MA
hitflag = MAF
pausetime = 11, 11
sparkno = s17002
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = -10, floor(-ifelse(animelemno(0) = 2, 113, ifelse(animelemno(0) = 3, 105, 113 ))*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -0.83, -15
ground.hittime  = 16
ground.slidetime  = 16
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 15
guard.cornerpush.veloff = 0
guard.kill = 1
;air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -1.67, -10.7
airguard.velocity = -3, -6.43
fall = 1
fall.recover = 0
fall.yvelocity = -4
yaccel = .536

[State 1100, 1]
type = HitDef
triggerall = !var(22)
triggerall = time ;to allow blocking
triggerall = animelemno(0) > var(18)
triggerall = !var(43) || var(44) < 2 || movecontact
triggerall = var(10) != 3
trigger1 = animelemno(0) = 1
trigger1 = var(6) := floor(fvar(12)*300) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, SA
damage = var(1), var(1)/5
animtype = Up
guardflag = MA
hitflag = MAF
pausetime = 11, 11
sparkno = 2
sparkxy = ifelse(p2bodydist x < 10, ifelse(p2bodydist x < 0, -20, ceil(p2bodydist x - 20)), -10), floor(-100*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -0.83, -15
ground.hittime  = 16
ground.slidetime  = 16
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 15
guard.cornerpush.veloff = 0
guard.kill = 1
;air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -1.67, -10.7
airguard.velocity = -3, -6.43
fall = 1
fall.recover = 0
fall.yvelocity = -4
yaccel = .536

[State 1100, 1]
type = HitDef
triggerall = !var(22)
triggerall = time ;to allow blocking
triggerall = animelemno(0) > var(18)
triggerall = !var(43) || var(44) < 2 || movecontact
triggerall = var(10) = 3
trigger1 = animelemno(0) = 1
trigger1 = var(6) := floor(fvar(12)*300) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, SA
damage = var(1), var(1)/5
animtype = Up
guardflag = MA
hitflag = MAF
pausetime = 11, 11
sparkno = 2
sparkxy = ifelse(p2bodydist x < 10, ifelse(p2bodydist x < 0, -20, ceil(p2bodydist x - 20)), -10), floor(-100*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -0.83, -15
ground.hittime  = 16
ground.slidetime  = 16
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 15
guard.cornerpush.veloff = 0
guard.kill = 1
;air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -1.67, -10.7
airguard.velocity = -3, -6.43
fall = 1
fall.recover = 0
fall.yvelocity = -4
yaccel = .536

[State 1100, 1]
type = HitDef
triggerall = !var(22)
triggerall = animelemno(0) > var(18)
triggerall = !var(43) || var(44) < 2 || movecontact
trigger1 = animelemno(0) = 2
trigger1 = var(6) := floor(fvar(12)*300) || 1
trigger2 = animelemno(0) > var(18) + 1
trigger2 = var(6) := floor(fvar(12)*300) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, SA
damage = var(1), var(1)/5
animtype = Up
guardflag = MA
hitflag = MAF
pausetime = 11, 11
sparkno = 2
sparkxy = -10, floor(-ifelse(animelemno(0) = 2, 113, ifelse(animelemno(0) = 3, 105, 113 ))*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -0.83, -15
ground.hittime  = 16
ground.slidetime  = 16
ground.cornerpush.veloff = 0
guard.velocity = -10
guard.hittime = 15
guard.cornerpush.veloff = 0
guard.kill = 1
;air.hittime = 999
airguard.ctrltime = 999
air.type = Low
air.velocity = -1.67, -10.7
airguard.velocity = -3, -6.43
fall = 1
fall.recover = 0
fall.yvelocity = -4
yaccel = .536

[State 1100, StateTypeSet]
type = StateTypeSet
trigger1 = animelemno(0) > 1
trigger1 = var(10) := 3
trigger1 = var(11) := 0 || 1
statetype = A

[State 1100, VelSet]
type = VelSet
trigger1 = animelem = 2
trigger1 = !var(0)
x = 12.5
y = -4.85

[State 1100, VelSet]
type = VelSet
trigger1 = animelem = 2
trigger1 = var(0)
x = 7.5
y = -10.2

[State 1100, 2]
type = PosSet
trigger1 = vel y > 0
trigger1 = pos y + vel y >= 0
y = 0

[State 1100, 2]
type = ChangeState
trigger1 = vel y > 0
trigger1 = pos y + vel y >= 0
value = 0
ctrl = 1

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 2
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-64*const(size.xscale)), floor(-128*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 2
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-32*const(size.xscale)), floor(-128*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 2
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(64*const(size.xscale)), floor(-96*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 2
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(32*const(size.xscale)), floor(-96*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 3
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-96*const(size.xscale)), floor(-96*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 3
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-48*const(size.xscale)), floor(-96*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 3
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(96*const(size.xscale)), floor(-128*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 3
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(48*const(size.xscale)), floor(-128*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-96*const(size.xscale)), floor(-128*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(-48*const(size.xscale)), floor(-128*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(96*const(size.xscale)), floor(-96*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State 1100, ExplodS]
type = Explod
trigger1 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(48*const(size.xscale)), floor(-96*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(36*const(size.xscale)), floor(21*const(size.yscale))

[State Idle Anim]
type = StateTypeSet
trigger1 = animelem = 5
movetype = I

[State 1100, VarSet]
type = VarSet
trigger1 = 1
var(33) = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
statetype = A
ignorehitpause = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
trigger1 = inguarddist
trigger1 = !var(13)
trigger1 = p2statetype != A || p2movetype != A || !(enemynear, hitdefattr = SCA, AT)
statetype = S
ignorehitpause = 1

;---------------------------------------------------------------------------
; Yokurestujyusou/Kakurestudakou

[Statedef 1200]
type    = A
movetype= I
physics = N
poweradd= 70
ctrl = 0
velset = 0,-8.57
anim = 1200
sprpriority = 0			;Set layering priority to 2 (in front)
;change on 15 for Y
;triangulate vel for X
;target height -128

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State 1200, Turn]
type = Turn
trigger1 = !time
trigger1 = p2dist x < 0

[State 1200, VarSet]
type = VarSet
trigger1 = !time
trigger1 = !var(0)
fvar(0) = p2dist x - 260.0
ignorehitpause = 1

[State 1200, VarSet]
type = VarSet
trigger1 = !time
trigger1 = !var(0)
fvar(1) = atan( fvar(0)/(-128.0 - pos y) ) + ifelse(fvar(0) < 0, -pi, pi)
ignorehitpause = 1

[State 1200, VelSet]
type = VelSet
trigger1 = !time
trigger1 = !var(0)
x = 8.57*sin(fvar(1))
y = 8.57*cos(fvar(1))
ignorehitpause = 1

[State 1200, PosAdd]
type = PosAdd
trigger1 = time
trigger1 = pos x - helper(9999), pos x = fvar(0)
y = -8.57 - vel y

[State 1200, VarSet]
type = VarSet
trigger1 = 1
fvar(0) = pos x - helper(9999), pos x

[State 1200, 2]
type = ChangeState
trigger1 = pos y < -128
value = 1210
ctrl = 1

[Statedef 1210]
type    = A
movetype= A
physics = N
ctrl = 0
velset = 0,0
anim = 1210
sprpriority = 2			;Set layering priority to 2 (in front)

[State 1210, VarSet]
type = VarSet
trigger1 = !time
var(11) = ifelse(var(0), 1, 0)
ignorehitpause = 1

[State 1210, PlaySnd]
type = PlaySnd
trigger1 = animelem = 1
value = 1200, 0
channel = 0

[State 1210, VelAdd]
type = VelAdd
trigger1 = var(0)
trigger1 = animelemno(-1) > 2
trigger1 = pos y > fvar(2)
y = -.429

;[State 1210, VelMul]
;type = VelMul
;trigger1 = animelemno(-1) > 2
;x = .85

[State 1210, PlaySnd]
type = PlaySnd
trigger1 = animelem = 3
value = 40, 2
channel = 2

[State 1210, VelSet]
type = VelSet
trigger1 = animelem = 3
x = 10
y = 6.43

[State 1210, VelSet]
type = VelSet
trigger1 = !var(0)
trigger1 = vel y > 0
trigger1 = pos y + vel y >= 0
x = 0

[State 1210, 2]
type = ChangeState
trigger1 = !var(0)
trigger1 = vel y > 0
trigger1 = pos y + vel y >= 0
value = 1212

[State 1210, 2]
type = ChangeState
trigger1 = var(0)
trigger1 = vel y < 0
value = 1211

[State 1210, 2]
type = HitDef
triggerall = var(22)
triggerall = !var(43)
triggerall = !var(0)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*600) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, SA
damage = 120, 24
animtype = Back
guardflag = HA
hitflag = MA
pausetime = 14, 15
guard.pausetime = 13, 13
sparkno = s17002
guard.sparkno = s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
sparkxy = ifelse(p2bodydist x < 40, ifelse(p2bodydist x < 0, -50, ceil(p2bodydist x - 50)), -10), floor(-24*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -5, -4.99
ground.hittime  = 22
ground.slidetime  = 22
ground.cornerpush.veloff = 0
guard.hittime = 21
guard.velocity = -10
guard.cornerpush.veloff = -13
;air.hittime = 999
airguard.ctrltime = 999
air.velocity = -5, -6.43
fall = 1
fall.recover = 0
airguard.velocity = -5, -6.43
yaccel = .536

[State 1210, 2]
type = HitDef
triggerall = !var(22)
triggerall = !var(43)
triggerall = !var(0)
trigger1 = !movecontact && !movereversed
trigger1 = var(6) := floor(fvar(12)*600) || 1
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, SA
damage = 120, 24
animtype = Back
guardflag = HA
hitflag = MA
pausetime = 14, 15
guard.pausetime = 13, 13
sparkno = 2
sparkxy = ifelse(p2bodydist x < 40, ifelse(p2bodydist x < 0, -50, ceil(p2bodydist x - 50)), -10), floor(-24*const(size.yscale))
hitsound   = -1 + (var(23) := 3)*0 ;s5,2
guardsound = s6,0 + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = Low
ground.velocity = -5, -4.99
ground.hittime  = 22
ground.slidetime  = 22
ground.cornerpush.veloff = 0
guard.hittime = 21
guard.velocity = -10
guard.cornerpush.veloff = -13
;air.hittime = 999
airguard.ctrltime = 999
air.velocity = -5, -6.43
fall = 1
fall.recover = 0
airguard.velocity = -5, -6.43
yaccel = .536

[State 1210, 1]
type = HitDef
trigger1 = var(0)
attr = A, ST
hitflag =
guardflag = 

[State 1210, 1]
type = HitDef
triggerall = var(0)
trigger1 = p2bodydist x < 150*const(size.xscale)
trigger1 = p2dist x > 50*const(size.xscale)
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, ST          ;Attributes: Standing, Normal Throw
hitflag = HA-          ;Affect only ground people who are not being hit
priority = 1, Miss    ;Throw has low priority, must be miss or dodge type.
sparkno = -1          ;No spark
hitsound = s8, 0
sprpriority = 2       ;Draw in front of p2
p2facing = 1          ;Force p2 to face player
p1stateno = 1250       ;On success, player changes to state 810
p2stateno = 1251       ;If hit, p2 changes to state 820 in player's cns
guard.dist = 0        ;This prevents p2 from going into a guard state if close
ground.velocity = 0
fall = 1              ;Force p2 into falling down
fall.recover = 0
fall.xvelocity = -4.12
fall.yvelocity = -6.43
yaccel = .536

[State 1210, PlayerPush]
type = PlayerPush
trigger1 = enemynear, pos y >= 0
value = 0

[State 1210, Width]
type = Width
trigger1 = 1
edge = floor(32*const(size.xscale)), 0

[State 1210, ExplodS]
type = Explod
triggerall = anim = 1210
trigger1 = animelem = 3
trigger2 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(80*const(size.xscale)), floor(-48*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 1210, ExplodS]
type = Explod
triggerall = anim = 1210
trigger1 = animelem = 3
trigger2 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(104*const(size.xscale)), floor(-32*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 1210, ExplodS]
type = Explod
triggerall = anim = 1210
trigger1 = animelem = 3
trigger2 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(128*const(size.xscale)), floor(-16*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[Statedef 1211]
type    = A
movetype= I
physics = N
ctrl = 0
anim = 22
sprpriority = 2			;Set layering priority to 2 (in front)

[State 1211, PosAdd]
type = PosAdd
trigger1 = !time
x = 32*const(size.xscale)

[State 1211, VarSet]
type = VarSet
trigger1 = !time
var(0) = 0

[State 1211, VarSet]
type = VarSet
trigger1 = !time
var(1) = 1

[State 1211, VelAdd]
type = VelAdd
trigger1 = time
y = -.429

[State 1211, VelMul]
type = VelMul
trigger1 = 1
x = .85

[State 1211, VelSet]
type = VelSet
trigger1 = pos y + vel y <= fvar(2)
trigger1 = var(0) := 1
x = 0
y = 0

[State 1211, PosSet]
type = PosSet
trigger1 = var(0) = 1
y = fvar(2)
persistent = 0

[State 1211, VarAdd]
type = VarAdd
trigger1 = animelem = 9
var(1) = 1

[State 1211, 2]
type = ChangeState
trigger1 = var(0)
trigger1 = var(1) > 2
trigger1 = var(11) := 1
trigger1 = var(9) := 9
value = 0
ctrl = 1

[State 1211, ChangeAnim]
type = ChangeAnim
trigger1 = animelemno(0)%4 = 1
value = 22
elem = animelemno(0) + 2

[State 1211 PlayerPush]
type = PlayerPush
trigger1 = enemynear, pos y >= 0
value = 0

[State 1211, ExplodS]
type = Explod
triggerall = anim = 1210
trigger1 = animelem = 3
trigger2 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(80*const(size.xscale)), floor(-48*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 1211, ExplodS]
type = Explod
triggerall = anim = 1210
trigger1 = animelem = 3
trigger2 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(104*const(size.xscale)), floor(-32*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[State 1211, ExplodS]
type = Explod
triggerall = anim = 1210
trigger1 = animelem = 3
trigger2 = animelem = 4
id = 950
postype = p1
anim = 950 + random%3
bindtime = 1
pos = floor(128*const(size.xscale)), floor(-16*const(size.yscale))
sprpriority = 3
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
random = floor(72*const(size.xscale)), floor(42*const(size.yscale))

[Statedef 1212]
type    = S
movetype= I
physics = N
ctrl = 0
velset = 0,0
anim = 1212
sprpriority = 0			;Set layering priority to 2 (in front)
movehitpersist = 1

[State 1212, PosSet]
type = PosSet
trigger1 = !time
y = 0

[State 1212, PosAdd]
type = PosAdd
trigger1 = !time
x = 32*const(size.xscale)

[State 1212, 2]
type = ChangeState
triggerall = !time
trigger1 = command = "holdz"
trigger1 = var(59) < 1
trigger2 = var(59) > 0
trigger2 = moveguarded || p2statetype != A || p2movetype != H
trigger2 = p2dist x > 0 || random%3 = 0
value = 900

[State 1212, 2]
type = ChangeState
triggerall = animelem = 6
trigger1 = command = "holda"
trigger1 = var(59) < 1
trigger2 = var(59) > 0
trigger2 = numtarget
trigger2 = p2dist x > 0
value = 1213

[State 1212, 2]
type = ChangeState
trigger1 = animelem = 6
trigger1 = var(9) := 65
value = 0
ctrl = 1

[State 1212, 1]
type = PosAdd
trigger1 = animelem = 2
trigger2 = animelem = 5
x = const(size.xscale)*24

[State 1212, 1]
type = PosAdd
trigger1 = animelem = 3
trigger2 = animelem = 4
x = const(size.xscale)*32

[State 1212, Width]
type = Width
trigger1 = animelem = 1, = 0
edge = floor(-8*const(size.xscale)), floor(8*const(size.xscale))

[State 1212, Width]
type = Width
trigger1 = animelem = 1, = 1
edge = floor(-8*const(size.xscale)*0.67), floor(8*const(size.xscale)*0.67)

[State 1212, Width]
type = Width
trigger1 = animelem = 1, = 2
edge = floor(8*const(size.xscale)*0.33), floor(8*const(size.xscale)*0.33)

[State 1212, Width]
type = Width
trigger1 = animelem = 2, = 0
trigger2 = animelem = 5, = 0
edge = floor(-24*const(size.xscale)), floor(24*const(size.xscale))

[State 1212, Width]
type = Width
trigger1 = animelem = 2, = 1
trigger2 = animelem = 5, = 1
edge = floor(-24*const(size.xscale)*0.67), floor(24*const(size.xscale)*0.67)

[State 1212, Width]
type = Width
trigger1 = animelem = 2, = 2
trigger2 = animelem = 5, = 2
edge = floor(-24*const(size.xscale)*0.33), floor(24*const(size.xscale)*0.33)

[State 1212, Width]
type = Width
trigger1 = animelem = 3, = 0
trigger2 = animelem = 4, = 0
edge = floor(-32*const(size.xscale)), floor(32*const(size.xscale))

[State 1212, Width]
type = Width
trigger1 = animelem = 3, = 1
trigger2 = animelem = 4, = 1
edge = floor(-32*const(size.xscale)*0.67), floor(32*const(size.xscale)*0.67)

[State 1212, Width]
type = Width
trigger1 = animelem = 3, = 2
trigger2 = animelem = 4, = 2
edge = floor(-32*const(size.xscale)*0.33), floor(32*const(size.xscale)*0.33)

[Statedef 1213]
type    = A
movetype= A
physics = N
ctrl = 0
velset = 4.17,-6.43
sprpriority = 0			;Set layering priority to 2 (in front)

[State 1213, 2]
type = VelAdd
trigger1 = time
y = .429

[State 1213, 2]
type = PosSet
trigger1 = vel y > 0
trigger1 = pos y + vel y >= 0
y = 0

[State 1213, 2]
type = ChangeState
trigger1 = vel y > 0
trigger1 = pos y + vel y >= 0
value = 0
ctrl = 1

[State 1213, 1]
type = HitDef
trigger1 = time > 27
trigger2 = p2statetype = L
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, ST          ;Attributes: Standing, Normal Throw
numhits = 0
hitflag = FD          ;Affect only ground people who are not being hit
priority = 1, Miss    ;Throw has low priority, must be miss or dodge type.
sparkno = -1          ;No spark
hitsound = s8, 0
sprpriority = 2       ;Draw in front of p2
p2facing = 1          ;Force p2 to face player
p1stateno = 1220       ;On success, player changes to state 810
p2stateno = 1221       ;If hit, p2 changes to state 820 in player's cns
guard.dist = 0        ;This prevents p2 from going into a guard state if close
ground.velocity = 0
fall = 1              ;Force p2 into falling down
fall.recover = 0
fall.xvelocity = -4.12
fall.yvelocity = -6.43
yaccel = .536

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

[Statedef 1220]
type    = S
movetype= A
physics = N
anim = 1220
ctrl = 0
velset = 0, 0
sprpriority = 0			;Set layering priority to 2 (in front)

[State 1220, TargetState]
type = TargetState
trigger1 = !animtime
value = 1224

[State 1220, 2]
type = ChangeState
trigger1 = !animtime
value = 900

[State 1220, PosSet]
type = PosSet
trigger1 = !time
x = target, pos x
y = 0

[State 1220, Bind]
type = TargetBind
trigger1 = 1
pos = 0, 0

[State 1220, TargetState]
type = TargetState
trigger1 = animelem = 4
value = 1222

[State 1220, PlaySnd]
type = PlaySnd
trigger1 = animelem = 4
trigger2 = animelem = 7
trigger3 = animelem = 10
trigger4 = animelem = 13
value = 1200, 1
channel = 1

[State 1220, Explod]
type = Explod
triggerall = var(22)
trigger1 = animelem = 4
trigger2 = animelem = 8
trigger3 = animelem = 12
postype = p1
anim = 27000
bindtime = 1
pos = floor(8*const(size.xscale)), -10
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
ownpal = 1

[State 1220, Explod]
type = Explod
triggerall = var(22)
trigger1 = animelem = 6
trigger2 = animelem = 10
trigger3 = animelem = 14
postype = p1
anim = 27000
bindtime = 1
pos = floor(-8*const(size.xscale)), -10
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
ownpal = 1

[State 1220, Explod]
type = Explod
triggerall = !var(22)
trigger1 = animelem = 4
trigger2 = animelem = 8
trigger3 = animelem = 12
postype = p1
anim = F0
bindtime = 1
pos = floor(8*const(size.xscale)), -10
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
ownpal = 1

[State 1220, Explod]
type = Explod
triggerall = !var(22)
trigger1 = animelem = 6
trigger2 = animelem = 10
trigger3 = animelem = 14
postype = p1
anim = F0
bindtime = 1
pos = floor(-8*const(size.xscale)), -10
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
ownpal = 1

[State 1220, TargetLifeAdd]
type = TargetLifeAdd
trigger1 = animelem = 4
trigger2 = animelem = 6
trigger3 = animelem = 8
trigger4 = animelem = 10
trigger5 = animelem = 12
trigger6 = animelem = 14
value = -ceil(0.24*const(data.attack))
kill = animelem = 14

[Statedef 1221]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1221, 1]
type = NotHitBy
Trigger1 = 1
value = SCA

[State 1221, 1]
type = ChangeAnim
Trigger1 = Time = 0
value = 5170

[State 1221, 1]
type = ChangeAnim
Trigger1 = !animtime
value = 5110

[State 1221, SelfState]
type = SelfState
trigger1 = time
trigger1 = !gethitvar(isbound)
value = 5110

[Statedef 1222]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1222, 1]
type = NotHitBy
Trigger1 = 1
value = SCA

[State 1222, 1]
type = ChangeAnim2
triggerall = !time
trigger1 = name != "Leo"
trigger2 = authorname != "Doggiedoo"
value = 1222

[State 1222, 1]
type = ChangeAnim
triggerall = name = "Leo"
triggerall = authorname = "Doggiedoo"
trigger1 = time%24 = [0, 5]
value = 5170

[State 1222, 1]
type = ChangeAnim
triggerall = name = "Leo"
triggerall = authorname = "Doggiedoo"
trigger1 = time%24 = [12, 17]
value = 5080

[State 1222, 1]
type = ChangeAnim
triggerall = name = "Leo"
triggerall = authorname = "Doggiedoo"
trigger1 = time%24 = [6, 11]
trigger2 = time%24 = [18, 23]
value = 5110

[State 1222, SelfState]
type = SelfState
trigger1 = time
trigger1 = !gethitvar(isbound)
value = 5110

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

[Statedef 1224]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1224, 1]
type = ChangeAnim
Trigger1 = Time = 0
value = 5100

[State 1224, 1]
type = SelfState
Trigger1 = !animtime
value = 5101

[Statedef 1250]
type    = A
movetype= A
physics = N
ctrl = 0
velset = 0,0
anim = 1250
sprpriority = 2			;Set layering priority to 2 (in front)

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

[State 1250, Helper]
type = Helper
trigger1 = !time
trigger1 = !numhelper(1260)
id = 1260
name = "camera"
stateno = 1260
ownpal = 1
postype = p1

[State 1250, 1]
type = PosSet
triggerall = !time
trigger1 = facing = 1
trigger1 = target, pos x - pos x < 110
trigger2 = facing = -1
trigger2 = target, pos x - pos x > -110
x = target, pos x
y = (target, const(size.head.pos.y)*.25 + target, const(size.mid.pos.y)*.75) + target, pos y

[State 1250, 1]
type = PosSet
trigger1 = !time
trigger1 = pos x != target, pos x
x = pos x + 110*facing
y = (target, const(size.head.pos.y)*.25 + target, const(size.mid.pos.y)*.75) + target, pos y

[State 1250, Bind]
type = TargetBind
trigger1 = animelemno(0) = 1
pos = -12.0*const(size.xscale), (target, const(size.head.pos.y) - target, const(size.mid.pos.y))*-0.5 - 16.0*const(size.yscale)

[State 1250, Bind]
type = TargetBind
trigger1 = animelemno(0) = [2, 3]
pos = -12.0*const(size.xscale), (target, const(size.head.pos.y) - target, const(size.mid.pos.y))*-0.25 - 16.0*const(size.yscale)

[State 1250, Bind]
type = TargetBind
trigger1 = animelemno(0) > 3
pos = -12.0*const(size.xscale), -16.0*const(size.yscale)

[State 1250, PlaySnd]
type = PlaySnd
trigger1 = animelem = 4
value = 40, 1
channel = 2

[State 1250, 2]
type = VelSet
trigger1 = animelem = 4
y = -12.86

[State 1250, 2]
type = ChangeState
triggerall = time > 49
trigger1 = screenpos y < -32
trigger2 = time > 90
value = 1255

; Opponent Grabbed
[Statedef 1251]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1251, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 1251

[State 1251, SelfState]
type = SelfState
trigger1 = time
trigger1 = !gethitvar(isbound)
value = 5050

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

[Statedef 1255]
type    = A
movetype= A
physics = N
ctrl = 0
velset = 0, 19.29;16.07
anim = 1255
sprpriority = 2			;Set layering priority to 2 (in front)

[State 1255, PosSet]
type = PosSet
trigger1 = !animtime
y = 0

[State 1255, TargetState]
type = TargetState
trigger1 = !animtime
value = 1257

[State 1255, 2]
type = ChangeState
trigger1 = !animtime
trigger1 = var(11) := 0 || 1
value = 900

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

[State 1255, VarSet]
type = VarSet
trigger1 = !time
var(0) = 0

[State 1255, ChangeAnim]
type = ChangeAnim
trigger1 = !var(0)
trigger1 = pos y + vel y < 32.0*const(size.yscale) -16
value = 1255

[State 1255, TargetState]
type = TargetState
trigger1 = animelemno(0) = 1
value = 1256

[State 1255, Bind]
type = TargetBind
trigger1 = animelemno(0) = 1
pos = 0, -105.0*const(size.yscale) + 16

[State 1255, PosSet]
type = PosSet
trigger1 = animelem = 2
trigger1 = var(0) := 1
y = -8

[State 1255, PosSet]
type = VelSet
trigger1 = animelem = 2
y = 0

[State 1255, PlaySnd]
type = PlaySnd
trigger1 = animelem = 2
value = 8, 2

[State 1255, TargetLifeAdd]
type = TargetLifeAdd
trigger1 = animelem = 2
value = -ceil(1.68*const(data.attack))

[State 1255, EnvShake]
type = EnvShake
trigger1 = animelem = 2
time = 9
freq = 50
ampl = 8
phase = 270
persistent = 0

[State 1255, Explod]
type = Explod
triggerall = var(22)
trigger1 = animelem = 2
postype = p1
anim = 17005
facing = -facing
bindtime = 1
pos = 0, 20
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1

[State 1255, Explod]
type = Explod
triggerall = var(22)
trigger1 = animelem = 2
postype = p1
anim = F61
bindtime = 1
pos = 0, 20
sprpriority = -5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1

[State 1255, Explod]
type = Explod
triggerall = !var(22)
trigger1 = pos y + vel y > -16*const(size.yscale)
postype = p1
anim = F62
bindtime = 1
facing = -facing
pos = 0, 20
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1

[State 1255, Bind]
type = TargetBind
trigger1 = animelemno(0) > 1
pos = 0, 16

[Statedef 1256]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1256, 1]
type = NotHitBy
Trigger1 = 1
value = SCA

[State 1256, 1]
type = ChangeAnim
Trigger1 = Time = 0
value = 5170

[State 1256, 1]
type = ChangeAnim
Trigger1 = Time = 1
value = 5080

[State 1256, SelfState]
type = SelfState
trigger1 = time
trigger1 = !gethitvar(isbound)
value = 5050

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

[Statedef 1257]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1257, 1]
type = ChangeAnim
Trigger1 = Time = 0
value = 5100

[State 1257, 1]
type = SelfState
Trigger1 = !animtime
value = 5101

[Statedef 1260]
type    = A
movetype= I
physics = N
ctrl = 0
velset = 0,0
anim = 9999
sprpriority = 2			;Set layering priority to 2 (in front)

[State 1260, DestroySelf]
type = DestroySelf
trigger1 = root, stateno != [1250, 1255]
trigger2 = root, movetype != A

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

[State 1260, PosSet]
type = PosSet
trigger1 = 1
y = parent, pos y + parent, vel y + 16

[State 1260, PosSet]
type = PosSet
trigger1 = pos y < -200
y = -200


;---------------------------------------------------------------------------
; Mamestusenshiou

[Statedef 1300]
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
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 1300 + 11*(var(11) != 0 || var(10) = 3)				;Change animation (Def: no change)
poweradd = 25			;Power to add (Def: 0)
sprpriority = 2			;Set layering priority to 2 (in front)

[State StateType]
type = StateTypeSet
trigger1 = !time
trigger1 = var(10) = 3
statetype = A
physics = N

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State 1300, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 1
value = 0
ctrl = 1

[State 1300, 5]
type = AttackDist
trigger1 = animelemno(0) > 8
value = 300

[State 1300, 5]
type = VarSet
triggerall = !time
trigger1 = !var(11) && var(10) != 3
trigger1 = var(0) = 0
trigger2 = var(11) || var(10) = 3
trigger2 = var(0) = 2
var(0) = 1

[State 1300, 5]
type = VarSet
trigger1 = !time
var(1) = 0

[State 1300, PlaySnd]
type = PlaySnd
trigger1 = animelem = 5
value = 1300, 0
channel = 3

[State 1300, ChangeAnim]
type = ChangeAnim
triggerall = var(1) = 17
trigger1 = anim = 1300
trigger1 = animelemno(0) < 20
trigger1 = var(1) := 20
trigger2 = anim = 1310
trigger2 = animelemno(0) < 17
trigger2 = var(1) := 17
trigger3 = anim = 1311
trigger3 = animelemno(0) < 22
trigger3 = var(1) := 22
value = anim
elem = var(1)

[State 1300, 5]
type = ChangeState
triggerall = var(10) = 3
trigger1 = anim = 1300
trigger1 = animelem = 21
trigger2 = anim = 1310
trigger2 = animelem = 18
trigger3 = anim = 1311
trigger3 = animelem = 23
value = 50
ctrl = 0

[State 1300, StateTypeSet]
type = StateTypeSet
trigger1 = anim = 1300
trigger1 = animelem = 20
trigger2 = anim = 1310
trigger2 = animelem = 17
trigger3 = anim = 1311
trigger3 = animelem = 22
movetype = I

[State 1300, VarSet]
type = VarSet
trigger1 = !time
trigger1 = var(0) = 0
fvar(3) = sin(-atan(1))*16*0.83333333333333333333333333333333*(const(size.xscale)/0.83333333333333333333333333333333)

[State 1300, VarSet]
type = VarSet
trigger1 = !time
trigger1 = var(0) = 0
fvar(4) = cos(-atan(1))*16*0.83333333333333333333333333333333*(const(size.yscale)/1.0714285714285714285714285714286)

[State 1300, VarSet]
type = VarSet
trigger1 = !time
trigger1 = var(0) = 1
fvar(3) = sin(-atan(2))*16*0.83333333333333333333333333333333*(const(size.xscale)/0.83333333333333333333333333333333)

[State 1300, VarSet]
type = VarSet
trigger1 = !time
trigger1 = var(0) = 1
fvar(4) = cos(-atan(2))*16*0.83333333333333333333333333333333*(const(size.yscale)/1.0714285714285714285714285714286)

[State 1300, VarSet]
type = VarSet
trigger1 = !time
trigger1 = var(0) = [0, 1]
fvar(0) = atan(fvar(4)/fvar(3));

[State 1300, VarSet]
type = VarSet
trigger1 = !time
trigger1 = var(0) = 2
fvar(0) = 0

[State 1300, VarSet]
type = VarSet
trigger1 = !time
trigger1 = var(0) = [0, 1]
fvar(1) = ((fvar(3)**2 + (fvar(4))**2)**0.5)/16.0

[State 1300, VarSet]
type = VarSet
trigger1 = !time
trigger1 = var(0) = 2
fvar(1) = const(size.xscale)

[State 1300, Helper]
type = Helper
trigger1 = animelem = 6
id = 1350
name = "beamstart"
stateno = 1350
ownpal = 1
postype = p1
pos = floor(47*const(size.xscale)), floor(-86*const(size.yscale))
size.xscale=fvar(1)
size.yscale=const(size.yscale)

[State 1300, Helper]
type = Helper
trigger1 = animelem = 6
id = 1353
name = "beamhead"
stateno = 1353
ownpal = 1
postype = p1
pos = floor(119*const(size.xscale)), floor(-86*const(size.yscale))
size.xscale=fvar(1)
size.yscale=const(size.yscale)

[State 1300, Helper]
type = Helper
trigger1 = animelem = 6
id = 1352
name = "beamtrail"
stateno = 1352
ownpal = 1
postype = p1
pos = floor(119*const(size.xscale)), floor(-86*const(size.yscale))
size.xscale=fvar(1)
size.yscale=const(size.yscale)

[State 1300, Helper]
type = Helper
trigger1 = animelem = 6
id = 1351
name = "beamstart2"
stateno = 1351
ownpal = 1
postype = p1
pos = floor(47*const(size.xscale)), floor(-86*const(size.yscale))
size.xscale=fvar(1)
size.yscale=const(size.yscale)

[State 1300, Helper]
type = Helper
trigger1 = animelem = 6
id = 1370
name = "collision"
stateno = 1370
ownpal = 1
postype = p1
pos = floor(47*const(size.xscale)), floor(-86*const(size.yscale))
size.xscale=fvar(1)
size.yscale=const(size.yscale)

[State 1300, VarAdd]
type = VarAdd
trigger1 = var(1)
var(1) = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
statetype = A
ignorehitpause = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
trigger1 = inguarddist
trigger1 = !var(13)
trigger1 = p2statetype != A || p2movetype != A || !(enemynear, hitdefattr = SCA, AT)
statetype = S
ignorehitpause = 1

[StateDef 1350]
type = S
movetype = I
physics = N
anim = 1350
ctrl = 0
sprpriority = 3

[State 1350, DestroySelf]
type = DestroySelf
trigger1 = root, movetype != A
trigger2 = root, anim != [1300, 1311]
trigger3 = root, anim = 1300
trigger3 = root, animelem = 20
trigger4 = root, anim = 1310
trigger4 = root, animelem = 17
trigger5 = root, anim = 1311
trigger5 = root, animelem = 22

[State 1350, VarSet]
type = VarSet
trigger1 = !var(1)
var(0) = root, var(0)

[State 1350, VarSet]
type = VarSet
trigger1 = !var(1)
fvar(1) = 1.0

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

[State 1350 VarSet]
type = Null
triggerall = root, var(1)
trigger1 = root, anim = [1300, 1301]
trigger1 = var(1) < 38
trigger1 = var(1) := 38
trigger2 = root, anim = [1310, 1311]
trigger2 = var(1) < 47
trigger2 = var(1) := 47

[State 1350, VarSet]
type = VarSet
trigger1 = root, anim = [1300, 1301]
trigger1 = var(1) > 38
fvar(1) = (54.0 - var(1))/16.0

[State 1350, VarSet]
type = VarSet
trigger1 = root, anim = [1310, 1311]
trigger1 = var(1) > 47
fvar(1) = (63.0 - var(1))/16.0

[State 1350, AngleSet]
type = AngleSet
trigger1 = 1
value = root, fvar(0)*180/pi

[State 1350, AngleDraw]
type = AngleDraw
trigger1 = 1
scale = 1, fvar(1)

[State 1350, BindToParent]
type = PosSet
trigger1 = facing = 1
x = ceil(root, pos x) + 47*root, const(size.xscale)
y = ceil(root, pos y) - 86*root, const(size.yscale)

[State 1350, BindToParent]
type = PosSet
trigger1 = facing = -1
x = ceil(root, pos x) - 47*root, const(size.xscale)
y = ceil(root, pos y) - 86*root, const(size.yscale)

[State 1350, VarAdd]
type = VarAdd
trigger1 = 1
var(1) = 1

[StateDef 1351]
type = S
movetype = I
physics = N
anim = 1352
ctrl = 0
sprpriority = 3

[State 1351, DestroySelf]
type = DestroySelf
trigger1 = root, movetype != A
trigger2 = root, anim != [1300, 1311]
trigger3 = root, anim = 1300
trigger3 = root, animelem = 20
trigger4 = root, anim = 1310
trigger4 = root, animelem = 17
trigger5 = root, anim = 1311
trigger5 = root, animelem = 22

[State 1351, VarSet]
type = VarSet
trigger1 = !var(1)
var(0) = root, var(0)

[State 1351 VarSet]
type = Null
triggerall = root, var(1)
trigger1 = root, anim = [1300, 1301]
trigger1 = var(1) < 38
trigger1 = var(1) := 38
trigger2 = root, anim = [1310, 1311]
trigger2 = var(1) < 47
trigger2 = var(1) := 47

[State 1351, VarSet]
type = VarSet
trigger1 = !var(1)
fvar(1) = 1.0

[State 1351, VarSet]
type = VarSet
trigger1 = root, anim = [1300, 1301]
trigger1 = var(1) > 38
fvar(1) = (54.0 - var(1))/16.0

[State 1351, VarSet]
type = VarSet
trigger1 = root, anim = [1310, 1311]
trigger1 = var(1) > 47
fvar(1) = (63.0 - var(1))/16.0

[State 1351, AngleSet]
type = AngleSet
trigger1 = 1
value = root, fvar(0)*180/pi

[State 1351, AngleDraw]
type = AngleDraw
trigger1 = 1
scale = 1, fvar(1)

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

[State 1351, BindToParent]
type = PosSet
trigger1 = facing = 1
x = ceil(root, pos x) + 47*root, const(size.xscale)
y = ceil(root, pos y) - 86*root, const(size.yscale)

[State 1351, BindToParent]
type = PosSet
trigger1 = facing = -1
x = ceil(root, pos x) - 47*root, const(size.xscale)
y = ceil(root, pos y) - 86*root, const(size.yscale)

;[State 1351, BindToParent]
;type = PosSet
;trigger1 = 1
;x = floor(pos x + 0.5)
;y = floor(pos y + 0.5)

[State 1351, VarAdd]
type = VarAdd
trigger1 = 1
var(1) = 1

[StateDef 1352]
type = S
movetype = I
physics = N
anim = 1355
ctrl = 0
sprpriority = 3

[State 1352, DestroySelf]
type = DestroySelf
trigger1 = root, movetype != A
trigger2 = root, anim != [1300, 1311]
trigger3 = root, anim = 1300
trigger3 = root, animelem = 20
trigger4 = root, anim = 1310
trigger4 = root, animelem = 17
trigger5 = root, anim = 1311
trigger5 = root, animelem = 22

[State 1352, VarSet]
type = VarSet
trigger1 = !var(1)
var(0) = root, var(0)

[State 1352, VarSet]
type = VarSet
trigger1 = !var(1)
fvar(1) = 1.0

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

[State 1352, AssertSpecial]
type = AssertSpecial
trigger1 = var(1) < 18
flag = Invisible

[State 1352 VarSet]
type = Null
triggerall = root, var(1)
trigger1 = root, anim = [1300, 1301]
trigger1 = var(1) < 38
trigger1 = var(1) := 38
trigger2 = root, anim = [1310, 1311]
trigger2 = var(1) < 47
trigger2 = var(1) := 47

[State 1352, VarSet]
type = VarSet
trigger1 = root, anim = [1300, 1301]
trigger1 = var(1) > 38
fvar(1) = (54.0 - var(1))/16.0

[State 1352, VarSet]
type = VarSet
trigger1 = root, anim = [1310, 1311]
trigger1 = var(1) > 47
fvar(1) = (63.0 - var(1))/16.0

[State 1352, AngleSet]
type = AngleSet
trigger1 = 1
value = root, fvar(0)*180/pi

[State 1352, BindToParent]
type = PosSet
trigger1 = facing = 1
x = ceil(root, pos x) + 47*root, const(size.xscale)
y = ceil(root, pos y) - 86*root, const(size.yscale)

[State 1352, BindToParent]
type = PosSet
trigger1 = facing = -1
x = ceil(root, pos x) - 47*root, const(size.xscale)
y = ceil(root, pos y) - 86*root, const(size.yscale)

;[State 1352, BindToParent]
;type = PosAdd
;trigger1 = 1
;x = ifelse(facing = -1, -0.5, 0.5)*const(size.xscale)

;[State 1352, BindToParent]
;type = PosSet
;trigger1 = 1
;x = pos x + 0.5
;y = pos y - 0.5

;[State 1352, BindToParent]
;type = PosAdd
;trigger1 = var(0) != 1
;trigger2 = const(size.yscale) > 1.0
;x = ceil(cos(root, fvar(0))*72*const(size.xscale))
;y = ceil(-sin(root, fvar(0))*72*const(size.xscale))

;[State 1352, BindToParent]
;type = PosAdd
;trigger1 = var(0) = 1
;trigger1 = const(size.yscale) <= 1.0
;x = floor(cos(root, fvar(0))*72*const(size.xscale))
;y = floor(-sin(root, fvar(0))*72*const(size.xscale))

;[State 1352, BindToParent]
;type = PosAdd
;trigger1 = var(0) = 2
;x = -1

[State 1352, BindToParent]
type = PosAdd
trigger1 = var(0) != 1
x = cos(root, fvar(0))*71*const(size.xscale)
y = -sin(root, fvar(0))*71*const(size.xscale)

[State 1352, BindToParent]
type = PosAdd
trigger1 = var(0) = 1
x = cos(root, fvar(0))*70*const(size.xscale)
y = -sin(root, fvar(0))*70*const(size.xscale)

[State 1352, VarAdd]
type = VarAdd
triggerall = var(1)
triggerall = !root, var(1)
trigger1 = var(0) = 2
trigger2 = pos y - sin(root, fvar(0))*16*const(size.xscale)*(var(2)-16) < 0
var(2) = 1

[State 1352, AngleDraw]
type = AngleDraw
trigger1 = var(1) > 16
scale = var(2) - 16, fvar(1)

[State 1352, VarAdd]
type = VarAdd
trigger1 = 1
var(1) = 1

[StateDef 1353]
type = S
movetype = I
physics = N
anim = 1365
ctrl = 0
sprpriority = 3

[State 1353, DestroySelf]
type = DestroySelf
trigger1 = root, movetype != A
trigger2 = root, anim != [1300, 1311]
trigger3 = root, anim = 1300
trigger3 = root, animelem = 20
trigger4 = root, anim = 1310
trigger4 = root, animelem = 17
trigger5 = root, anim = 1311
trigger5 = root, animelem = 22

[State 1353, VarSet]
type = VarSet
trigger1 = !var(1)
var(0) = root, var(0)

[State 1353, VarSet]
type = VarSet
trigger1 = !var(1)
fvar(1) = 1.0

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

[State 1353, AssertSpecial]
type = AssertSpecial
trigger1 = var(1) < 16
flag = Invisible

[State 1353 VarSet]
type = Null
triggerall = root, var(1)
trigger1 = root, anim = [1300, 1301]
trigger1 = var(1) < 38
trigger1 = var(1) := 38
trigger2 = root, anim = [1310, 1311]
trigger2 = var(1) < 47
trigger2 = var(1) := 47

[State 1353, VarSet]
type = VarSet
trigger1 = root, anim = [1300, 1301]
trigger1 = var(1) > 38
fvar(1) = (54.0 - var(1))/16.0

[State 1353, VarSet]
type = VarSet
trigger1 = root, anim = [1310, 1311]
trigger1 = var(1) > 47
fvar(1) = (63.0 - var(1))/16.0

[State 1353, AngleSet]
type = AngleSet
trigger1 = 1
value = root, fvar(0)*180/pi

[State 1353, BindToParent]
type = PosSet
trigger1 = facing = 1
x = ceil(root, pos x) + 47*root, const(size.xscale)
y = ceil(root, pos y) - 86*root, const(size.yscale)

[State 1353, BindToParent]
type = PosSet
trigger1 = facing = -1
x = ceil(root, pos x) - 47*root, const(size.xscale)
y = ceil(root, pos y) - 86*root, const(size.yscale)

[State 1353, BindToParent]
type = PosAdd
trigger1 = 1
x = cos(root, fvar(0))*72*const(size.xscale)
y = -sin(root, fvar(0))*72*const(size.xscale)

[State 1353, VarAdd]
type = VarAdd
triggerall = var(1)
triggerall = !root, var(1)
trigger1 = var(0) = 2
trigger2 = pos y -sin(root, fvar(0))*(var(2)-16)*16*const(size.xscale) < 0
var(2) = 1

[State 1353, VarAdd]
type = VarAdd
trigger1 = var(0) != 2
trigger1 = pos y -sin(root, fvar(0))*(var(2)-16)*16*const(size.xscale) >= 0
var(3) = 1

[State 1353, BindToParent]
type = PosAdd
trigger1 = var(1) > 16
x = cos(root, fvar(0))*(var(2)-16)*16*const(size.xscale)
y = -sin(root, fvar(0))*(var(2)-16)*16*const(size.xscale)

[State 1353, AngleDraw]
type = AngleDraw
trigger1 = !var(3)
trigger1 = var(1) = [16, 18]
scale = (var(1) - 14)*0.5, fvar(1)

[State 1353, AngleDraw]
type = AngleDraw
trigger1 = !var(3)
trigger1 = var(1) > 18
scale = 2, fvar(1)

[State 1353, AngleDraw]
type = AngleDraw
trigger1 = var(3)
trigger1 = (var(3)-1)%8 = [0, 1]
scale = 1.5, fvar(1)*1.22

[State 1353, AngleDraw]
type = AngleDraw
trigger1 = var(3)
trigger1 = (var(3)-1)%8 = [2, 3]
scale = 1.25, fvar(1)*1.66

[State 1353, AngleDraw]
type = AngleDraw
trigger1 = var(3)
trigger1 = (var(3)-1)%8 = [4, 5]
scale = 1.75, fvar(1)*1.44

[State 1353, AngleDraw]
type = AngleDraw
trigger1 = var(3)
trigger1 = (var(3)-1)%8 = [6, 7]
scale = 2, fvar(1)

[State 1353, VarAdd]
type = VarAdd
trigger1 = 1
var(1) = 1

[StateDef 1355]
type = S
movetype = A
physics = N
ctrl = 0
sprpriority = 3
anim = 9999

[State 1355, DestroySelf]
type = DestroySelf
trigger1 = !numtarget

[State 1355, ParentVarSet]
type = ParentVarSet
trigger1 = numtarget
var(40) = 1

[StateDef 1370]
type = S
movetype = A
physics = N
anim = 9999
ctrl = 0
sprpriority = 3
movehitpersist = 1
hitcountpersist = 1
hitdefpersist = 1

[State 1370, 1]
type = ChangeState
triggerall = time || (prevstateno != 1397 && prevstateno != 1398)
trigger1 = movecontact = 1
value = 1397
ignorehitpause = 1

[State 1370]
type = ChangeState
triggerall = time || prevstateno != 1398
trigger1 = movecontact = 1
value = 1398
ignorehitpause = 1

[State 1370, ChangeState]
type = ChangeState
trigger1 = root, movetype != A
trigger2 = root, anim != [1300, 1311]
trigger3 = root, anim = 1300
trigger3 = root, animelem = 20
trigger4 = root, anim = 1310
trigger4 = root, animelem = 17
trigger5 = root, anim = 1311
trigger5 = root, animelem = 22
value = 1355

[State 1370, VarSet]
type = VarSet
trigger1 = !var(1)
var(0) = root, var(0)

[State 1370, VarSet]
type = VarSet
trigger1 = !var(1)
fvar(1) = 1.0

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

[State 1370, BindToParent]
type = PosSet
trigger1 = 1
x = ceil(root, pos x) + (47*root, const(size.xscale))*facing
y = ceil(root, pos y) - 86*root, const(size.yscale)

[State 1370, 1]
type = VarAdd
trigger1 = var(5)
var(5) = 1
ignorehitpause = 1

[State 1370, 1]
type = VarSet
triggerall = !var(5)
triggerall = movecontact = 1 || movereversed = 1
trigger1 = numtarget(var(14))
trigger2 = numenemy
trigger2 = enemy(0), time = [-1, 1]
trigger2 = enemy(0), gethitvar(chainid) = var(14)
trigger3 = numenemy > 1
trigger3 = enemy(1), time = [-1, 1]
trigger3 = enemy(1), gethitvar(chainid) = var(14)
var(5) = 1
ignorehitpause = 1

[State 1370, VarSet]
type = Null
triggerall = var(5) = 1
trigger1 = root, anim = [1300, 1301]
trigger1 = var(1) < 38
trigger1 = var(1) := 38
trigger2 = root, anim = [1310, 1311]
trigger2 = var(1) < 47
trigger2 = var(1) := 47

[State 1370, 1]
type = ParentVarAdd
trigger1 = var(5)
trigger1 = movecontact = 1
var(39) = 3
ignorehitpause = 1

[State 1370, ParentVarSet]
type = ParentVarSet
trigger1 = var(5) = 1
trigger1 = !root, var(1)
var(1) = 1

[State 1370, VarAdd]
type = VarAdd
triggerall = var(1)
triggerall = !root, var(1)
trigger1 = var(0) = 2
trigger2 = pos y - sin(root, fvar(0))*16*const(size.xscale)*(var(2)-11) < 0
var(2) = 1

[State 1370, VarSet]
type = VarSet
trigger1 = var(2) > 15
var(3) = var(2) - 11

[State 1370, ChangeAnim]
type = ChangeAnim
trigger1 = var(1) > 15
value = 1370 + var(0)
elem = ifelse(var(3) > 25, 25, var(3))

[State 1370, VarSet]
type = VarSet
trigger1 = root, anim = [1300, 1301]
trigger1 = var(1) > 38
fvar(1) = (54.0 - var(1))/16.0

[State 1370, VarSet]
type = VarSet
trigger1 = root, anim = [1310, 1311]
trigger1 = var(1) > 47
fvar(1) = (63.0 - var(1))/16.0

[State 1370, ChangeAnim]
type = ChangeAnim
trigger1 = fvar(1) < 0.67
trigger2 = var(5) > 2
value = 9999

[State 1370, 1]
type = NotHitBy
trigger1 = time > 5
value = , AA, AT
time = 1
ignorehitpause = 1

[State 1370, 1]
type = NotHitBy
trigger1 = time < 6
value = SCA
time = 1
ignorehitpause = 1

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

[State 1370, VarSet]
type = VarSet
trigger1 = 1
fvar(1) = ifelse(root, var(39), root, fvar(14)*(root, fvar(14)**root, var(39)), 1)
ignorehitpause = 1

[State 1370, 2]
type = HitDef
triggerall = !root, var(11)
trigger1 = !var(5)
trigger2 = var(5) = 2
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = S, SP
damage = ceil(112*fvar(1)), ceil(24*fvar(1))
animtype = Back
guardflag = MA
hitflag = MAF
pausetime = 0, 9
sparkno = -1;s17004
guard.sparkno = -1;s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
;sparkxy = -10, floor(-200*const(size.yscale) + ifelse((p2dist y*const(size.yscale) = [-264, -136]), (p2dist y*const(size.yscale)+200)*0.5, ifelse(p2dist y*const(size.yscale) < -264, -32, 32)))
hitsound   = -1;s5,2
guardsound = -1;s6,0; + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = -5, -7.5
ground.hittime  = 22
ground.slidetime  = 22
ground.cornerpush.veloff = 0
guard.hittime = 21
guard.velocity = -10
guard.kill = 1
;air.hittime = 999
airguard.ctrltime = 999
air.velocity = -5, -6.43
airguard.velocity = -5, -6.43
fall = 1
fall.recover = 0
palfx.invertall = 1
palfx.time = 50
palfx.color = 0
palfx.add = -64, -96, -160
palfx.sinadd = 64, 96, 128, 10
yaccel = .536

[State 1370, 2]
type = HitDef
triggerall = root, var(11)
trigger1 = !var(5)
trigger2 = var(5) = 2
id = 0*(var(14) := stateno + (var(18)%1000)*10000 + id%10) + var(14)
attr = A, SP
damage = ceil(112*fvar(1)), ceil(24*fvar(1))
animtype = Back
guardflag = MA
hitflag = MAF
pausetime = 0, 9
sparkno = -1;s17004
guard.sparkno = -1;s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
;sparkxy = -10, floor(-200*const(size.yscale) + ifelse((p2dist y*const(size.yscale) = [-264, -136]), (p2dist y*const(size.yscale)+200)*0.5, ifelse(p2dist y*const(size.yscale) < -264, -32, 32)))
hitsound   = -1;s5,2
guardsound = -1;s6,0; + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = -5, -7.5
ground.hittime  = 22
ground.slidetime  = 22
ground.cornerpush.veloff = 0
guard.hittime = 21
guard.velocity = -10
guard.kill = 1
;air.hittime = 999
airguard.ctrltime = 999
air.velocity = -5, -6.43
airguard.velocity = -5, -6.43
fall = 1
fall.recover = 0
palfx.invertall = 1
palfx.time = 50
palfx.color = 0
palfx.add = -64, -96, -160
palfx.sinadd = 64, 96, 128, 10
yaccel = .536

[State 1370, ParentVarSet]
type = ParentVarSet
trigger1 = numtarget
var(40) = 1

[State 1370, VarAdd]
type = VarAdd
trigger1 = 1
var(1) = 1

[Statedef 1397]
type = U
movetype = U
physics = U
movehitpersist = 1
hitcountpersist = 1

;var(30) = target num x no use, but can use in 1398 to specify enemy(v)
;var(31) = starting state
;var(32) = enemies found
;var(33) = cornerpush
;var(40) = guardbreak
;fvar(20) = max x
;fvar(21) = min x
;fvar(22) = max y
;fvar(23) = min y
;fvar(30) = dist x
;fvar(31) = dist y
;fvar(32) = math 1
;fvar(33) = math 2

[State 1397, 1]
type = VarSet
trigger1 = 1
var(30) = 0
ignorehitpause = 1

[State 1397, 1]
type = VarSet
trigger1 = 1
var(31) = prevstateno
ignorehitpause = 1

[State 1397, 2]
type = VarSet
trigger1 = 1
var(32) = 0
ignorehitpause = 1

[State 1397, 2]
type = VarSet
trigger1 = 1
var(33) = 0
ignorehitpause = 1

[State 1397, 17]
type = ChangeState
trigger1 = !numtarget(var(14))
trigger2 = target(var(14)), time != [-1, 1]
value = prevstateno
ignorehitpause = 1

[State 1397, 4]
type = VarSet
trigger1 = numenemy
trigger1 = target(var(14)), id = enemy(0), id
var(32) = 1
ignorehitpause = 1

[State 1397, 5]
type = VarSet
trigger1 = numenemy > 1
trigger1 = target(var(14)), id = enemy(1), id
var(32) = 2
ignorehitpause = 1

[State 1397, 2]
type = VarSet
triggerall = moveguarded = 1
trigger1 = facing = 1
trigger1 = target(var(14)), pos x > pos x
trigger1 = target(var(14)), backedgebodydist <= 0 || target(var(14)), frontedgebodydist <= 0
trigger2 = facing = -1
trigger2 = target(var(14)), pos x < pos x
trigger2 = target(var(14)), backedgebodydist <= 0 || target(var(14)), frontedgebodydist <= 0
var(33) = 1
ignorehitpause = 1

[State 1397, 6]
type = VarSet
trigger1 = 1
fvar(32) = target(var(14)), pos x + ifelse(target(var(14)), statetype = A, target(var(14)), const(size.air.front), target(var(14)), const(size.ground.front))*target(var(14)), facing
ignorehitpause = 1

[State 1397, 7]
type = VarSet
trigger1 = 1
fvar(32) = (fvar(32) - ( pos x + (fvar(20)+fvar(21))*0.5*facing ) )*facing
ignorehitpause = 1

[State 1397, 8]
type = VarSet
trigger1 = 1
fvar(33) = target(var(14)), pos x - ifelse(target(var(14)), statetype = A, target(var(14)), const(size.air.back), target(var(14)), const(size.ground.back))*target(var(14)), facing
ignorehitpause = 1

[State 1397, 9]
type = VarSet
trigger1 = 1
fvar(33) = (fvar(33) - ( pos x + (fvar(20)+fvar(21))*0.5*facing ) )*facing
ignorehitpause = 1

[State 1397, 10]
type = VarSet
trigger1 = 1
fvar(30) = 0
ignorehitpause = 1

[State 1397, 11]
type = VarSet
trigger1 = fvar(32) > 0
trigger1 = fvar(33) > 0
fvar(30) = ifelse( fvar(32) < fvar(33), fvar(32), fvar(33) ) + 10
ignorehitpause = 1

[State 1397, 12]
type = VarSet
trigger1 = fvar(32) < 0
trigger1 = fvar(33) < 0
fvar(30) = ifelse( fvar(32) > fvar(33), fvar(32), fvar(33) ) - 10
ignorehitpause = 1

[State 1397, 13]
type = VarSet
trigger1 = fvar(32) < 0
trigger1 = fvar(33) > 0
trigger1 = fvar(32)+fvar(33) != 0
fvar(30) = (fvar(32) + 10)*(fvar(32)/(-fvar(32)+fvar(33))) + (fvar(33) - 10)*(fvar(33)/(-fvar(32)+fvar(33)))
ignorehitpause = 1

[State 1397, 13]
type = VarSet
trigger1 = fvar(32) > 0
trigger1 = fvar(33) < 0
trigger1 = fvar(32)+fvar(33) != 0
fvar(30) = (fvar(32) - 10)*(fvar(32)/(fvar(32)-fvar(33))) + (fvar(33) + 10)*(fvar(33)/(fvar(32)-fvar(33)))
ignorehitpause = 1

[State 1397, 14]
type = VarAdd
trigger1 = 1
fvar(30) = (fvar(20)+fvar(21))*0.5
ignorehitpause = 1

;[State 1397, 15]
;type = VarSet
;trigger1 = var(0) < 2
;fvar(31) = (target(var(14)), pos y + target(var(14)), const(size.mid.pos.y) - pos y)
;ignorehitpause = 1

[State 1397, 15]
type = VarSet
trigger1 = var(0) < 2
fvar(31) = -atan(root, fvar(0))*fvar(30)/const(size.xscale)
ignorehitpause = 1

[State 1397, 15]
type = VarSet
trigger1 = var(0) = 2
fvar(31) = 0
ignorehitpause = 1

[State 1397, Explod]
type = Explod
triggerall = root, var(22)
trigger1 = !target(var(14)), gethitvar(guarded)
postype = left
facing = -target(var(14)), facing
anim = 27002
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1
random = ifelse(var(5), 32, 0), ifelse(var(5), 32, 0)

[State 1397, Explod]
type = Explod
triggerall = root, var(22)
triggerall = target(var(14)), gethitvar(guarded)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = target(var(14)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = target(var(14)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = target(var(14)), id != enemy(0), id
trigger5 = target(var(14)), id != enemy(1), id
postype = left
facing = -target(var(14)), facing
anim = 17006
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1
random = ifelse(var(5), 32, 0), ifelse(var(5), 32, 0)

[State 1397, Explod]
type = Explod
triggerall = target(var(14)), gethitvar(guarded)
trigger1 = var(40) = 1
trigger1 = target(var(14)), id = enemy(0), id
trigger2 = var(40) = 2
trigger2 = target(var(14)), id = enemy(1), id
trigger3 = var(40) = 3
trigger3 = target(var(14)), id = enemy(0), id
trigger4 = var(40) = 3
trigger4 = target(var(14)), id = enemy(1), id
postype = left
facing = -target(var(14)), facing
anim = 17008
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1
random = ifelse(var(5), 32, 0), ifelse(var(5), 32, 0)

[State 1397, Explod]
type = Explod
triggerall = !root, var(22)
trigger1 = !target(var(14)), gethitvar(guarded)
postype = left
facing = -target(var(14)), facing
anim = F3
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1
random = ifelse(var(5), 32, 0), ifelse(var(5), 32, 0)

[State 1397, Explod]
type = Explod
triggerall = !root, var(22)
triggerall = target(var(14)), gethitvar(guarded)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = target(var(14)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = target(var(14)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = target(var(14)), id != enemy(0), id
trigger5 = target(var(14)), id != enemy(1), id
postype = left
facing = -target(var(14)), facing
anim = F40
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1
random = ifelse(var(5), 32, 0), ifelse(var(5), 32, 0)

[State 1397, VarSet]
type = VarSet
trigger1 = !target(var(14)), gethitvar(guarded)
var(34) = 1

[State 1397, PlaySnd]
type = PlaySnd
triggerall = !var(34)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = target(var(14)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = target(var(14)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = target(var(14)), id != enemy(0), id
trigger5 = target(var(14)), id != enemy(1), id
value = 6, 0
channel = 1
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 1397, PlaySnd]
type = PlaySnd
triggerall = !var(34)
trigger1 = var(40) = 1
trigger1 = target(var(14)), id = enemy(0), id
trigger2 = var(40) = 2
trigger2 = target(var(14)), id = enemy(1), id
trigger3 = var(40) = 3
trigger3 = target(var(14)), id = enemy(0), id
trigger3 = var(40) := 2 || 1
trigger4 = var(40) = 3
trigger4 = target(var(14)), id = enemy(1), id
trigger4 = var(40) := 1 || 1
value = 6, 2
channel = 3
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 1397, PlaySnd]
type = PlaySnd
trigger1 = var(34)
value = 5, 2
channel = 1
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 1397, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
ignorehitpause = 1

[State 1397, Shift]
type = PosSet
trigger1 = fvar(30) = pos x || 1
trigger1 = fvar(31) = pos y || 1
x = target(var(14)), pos x
y = target(var(14)), pos y

[State 1397, Shock FX]
type = Explod
trigger1 = !target(var(14)), gethitvar(guarded)
id = 7070
anim = 7070 + random%5
sprpriority = 2
postype = p2
bindtime = -1
pos = 0, target(var(14)), const(size.mid.pos.y)
random = floor((target(var(14)), const(size.ground.front)+target(var(14)), const(size.ground.back))*(hitcount != 0)*0.4), floor((target(var(14)), const(size.mid.pos.y)-target(var(14)), const(size.head.pos.y))*(hitcount != 0)*0.8)
ignorehitpause = 1
ownpal = 1

[State 1397, FX Sound]
type = PlaySnd
trigger1 = !target(var(14)), gethitvar(guarded)
value = 5, 10
abspan = floor(target(var(14)), pos x)
ignorehitpause = 1
channel = 4

[State 1397, Shift]
type = PosSet
trigger1 = 1
x = fvar(30)
y = fvar(31)

[State 1397, 17]
type = ChangeState
trigger1 = var(40) := 0 || 1
value = prevstateno
ignorehitpause = 1

[Statedef 1398]
type = U
movetype = U
physics = U
movehitpersist = 1
hitcountpersist = 1

;var(30) = target num x no use, but can use in 1398 to specify enemy(v)
;var(31) = starting state
;var(32) = enemies found
;var(33) = cornerpush
;var(40) = guardbreak
;fvar(20) = max x
;fvar(21) = min x
;fvar(22) = max y
;fvar(23) = min y
;fvar(30) = dist x
;fvar(31) = dist y
;fvar(32) = math 1
;fvar(33) = math 2

[State 1398, 1]
type = VarSet
trigger1 = prevstateno != 1398
var(31) = prevstateno
ignorehitpause = 1

[State 1398, 1]
type = VarAdd
trigger1 = prevstateno = 1398
var(30) = 1
ignorehitpause = 1

[State Info]
type = DisplayToClipboard
trigger1 = 0
text = "OK3 %d, %d, %d, %d, e %d"
params = prevstateno, var(30), var(31), var(32), (var(30) > numenemy - 1)
ignorehitpause = 1

[State 1398, 1]
type = ChangeState
triggerall = var(30) = 0
trigger1 = !numenemy 
trigger2 = var(32) = 3 ;redundant, but just in case
trigger3 = var(32) = 1
trigger4 = enemy(var(30)), time != [-1, 1]
trigger5 = enemy(var(30)), gethitvar(chainid) != var(14)
value = 1398
ignorehitpause = 1

[State 1398, 1]
type = ChangeState
triggerall = var(30) = 1
trigger1 = numenemy < 2
trigger2 = var(32) = 3 ;redundant, but just in case
trigger3 = var(32) = 2
trigger4 = enemy(var(30)), time != [-1, 1]
trigger5 = enemy(var(30)), gethitvar(chainid) != var(14)
value = var(31)
ignorehitpause = 1

[State 1398, 1]
type = ChangeState
trigger1 = var(30) > 1
value = var(31)
ignorehitpause = 1

[State 1398, 2]
type = VarSet
triggerall = moveguarded = 1
trigger1 = facing = 1
trigger1 = enemy(var(30)), pos x > pos x
trigger1 = enemy(var(30)), backedgebodydist <= 0 || enemy(var(30)), frontedgebodydist <= 0
trigger2 = facing = -1
trigger2 = enemy(var(30)), pos x < pos x
trigger2 = enemy(var(30)), backedgebodydist <= 0 || enemy(var(30)), frontedgebodydist <= 0
var(33) = 1
ignorehitpause = 1

[State 1398, 6]
type = VarSet
trigger1 = 1
fvar(32) = enemy(var(30)), pos x + ifelse(enemy(var(30)), statetype = A, enemy(var(30)), const(size.air.front), enemy(var(30)), const(size.ground.front))*enemy(var(30)), facing
ignorehitpause = 1

[State 1398, 7]
type = VarSet
trigger1 = 1
fvar(32) = (fvar(32) - ( pos x + (fvar(20)+fvar(21))*0.5*facing ) )*facing
ignorehitpause = 1

[State 1398, 8]
type = VarSet
trigger1 = 1
fvar(33) = enemy(var(30)), pos x - ifelse(enemy(var(30)), statetype = A, enemy(var(30)), const(size.air.back), enemy(var(30)), const(size.ground.back))*enemy(var(30)), facing
ignorehitpause = 1

[State 1398, 9]
type = VarSet
trigger1 = 1
fvar(33) = (fvar(33) - ( pos x + (fvar(20)+fvar(21))*0.5*facing ) )*facing
ignorehitpause = 1

[State 1398, 10]
type = VarSet
trigger1 = 1
fvar(30) = 0
ignorehitpause = 1

[State 1398, 11]
type = VarSet
trigger1 = fvar(32) > 0
trigger1 = fvar(33) > 0
fvar(30) = ifelse( fvar(32) < fvar(33), fvar(32), fvar(33) ) + 10
ignorehitpause = 1

[State 1398, 12]
type = VarSet
trigger1 = fvar(32) < 0
trigger1 = fvar(33) < 0
fvar(30) = ifelse( fvar(32) > fvar(33), fvar(32), fvar(33) ) - 10
ignorehitpause = 1

[State 1398, 13]
type = VarSet
trigger1 = fvar(32) < 0
trigger1 = fvar(33) > 0
trigger1 = fvar(32)+fvar(33) != 0
fvar(30) = (fvar(32) + 10)*(fvar(32)/(-fvar(32)+fvar(33))) + (fvar(33) - 10)*(fvar(33)/(-fvar(32)+fvar(33)))
ignorehitpause = 1

[State 1398, 13]
type = VarSet
trigger1 = fvar(32) > 0
trigger1 = fvar(33) < 0
trigger1 = fvar(32)+fvar(33) != 0
fvar(30) = (fvar(32) - 10)*(fvar(32)/(fvar(32)-fvar(33))) + (fvar(33) + 10)*(fvar(33)/(fvar(32)-fvar(33)))
ignorehitpause = 1

[State 1398, 14]
type = VarAdd
trigger1 = 1
fvar(30) = (fvar(20)+fvar(21))*0.5
ignorehitpause = 1

;[State 1398, 15]
;type = VarSet
;trigger1 = var(0) < 2
;fvar(31) = (enemy(var(30)), pos y + enemy(var(30)), const(size.mid.pos.y) - pos y)
;ignorehitpause = 1

[State 1398, 15]
type = VarSet
trigger1 = var(0) < 2
fvar(31) = -atan(root, fvar(0))*fvar(30)/const(size.xscale)
ignorehitpause = 1

[State 1398, 15]
type = VarSet
trigger1 = var(0) = 2
fvar(31) = 0
ignorehitpause = 1

[State 1398, Explod]
type = Explod
triggerall = root, var(22)
trigger1 = !enemy(var(30)), gethitvar(guarded)
postype = left
facing = -enemy(var(30)), facing
anim = 27002
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1
random = ifelse(var(5), 32, 0), ifelse(var(5), 32, 0)

[State 1398, Explod]
type = Explod
triggerall = root, var(22)
triggerall = enemy(var(30)), gethitvar(guarded)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = enemy(var(30)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = enemy(var(30)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = enemy(var(30)), id != enemy(0), id
trigger5 = enemy(var(30)), id != enemy(1), id
postype = left
facing = -enemy(var(30)), facing
anim = 17006
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1
random = ifelse(var(5), 32, 0), ifelse(var(5), 32, 0)

[State 1398, Explod]
type = Explod
triggerall = enemy(var(30)), gethitvar(guarded)
trigger1 = var(40) = 1
trigger1 = enemy(var(30)), id = enemy(0), id
trigger2 = var(40) = 2
trigger2 = enemy(var(30)), id = enemy(1), id
trigger3 = var(40) = 3
trigger3 = enemy(var(30)), id = enemy(0), id
trigger4 = var(40) = 3
trigger4 = enemy(var(30)), id = enemy(1), id
postype = left
facing = -enemy(var(30)), facing
anim = 17008
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1
random = ifelse(var(5), 32, 0), ifelse(var(5), 32, 0)

[State 1398, Explod]
type = Explod
triggerall = !root, var(22)
trigger1 = !enemy(var(30)), gethitvar(guarded)
postype = left
facing = -enemy(var(30)), facing
anim = F3
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1
random = ifelse(var(5), 32, 0), ifelse(var(5), 32, 0)

[State 1398, Explod]
type = Explod
triggerall = !root, var(22)
triggerall = enemy(var(30)), gethitvar(guarded)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = enemy(var(30)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = enemy(var(30)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = enemy(var(30)), id != enemy(0), id
trigger5 = enemy(var(30)), id != enemy(1), id
postype = left
facing = -enemy(var(30)), facing
anim = F40
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1
random = ifelse(var(5), 32, 0), ifelse(var(5), 32, 0)

[State 1398, VarSet]
type = VarSet
trigger1 = !enemy(var(30)), gethitvar(guarded)
var(34) = 1

[State 1398, PlaySnd]
type = PlaySnd
triggerall = !var(34)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = enemy(var(30)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = enemy(var(30)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = enemy(var(30)), id != enemy(0), id
trigger5 = enemy(var(30)), id != enemy(1), id
value = 6, 0
channel = 1
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 1398, PlaySnd]
type = PlaySnd
triggerall = !var(34)
trigger1 = var(40) = 1
trigger1 = enemy(var(30)), id = enemy(0), id
trigger2 = var(40) = 2
trigger2 = enemy(var(30)), id = enemy(1), id
trigger3 = var(40) = 3
trigger3 = enemy(var(30)), id = enemy(0), id
trigger3 = var(40) := 2 || 1
trigger4 = var(40) = 3
trigger4 = enemy(var(30)), id = enemy(1), id
trigger4 = var(40) := 1 || 1
value = 6, 2
channel = 3
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 1398, PlaySnd]
type = PlaySnd
trigger1 = var(34)
value = 5, 2
channel = 1
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 1398, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
ignorehitpause = 1

[State 1398, Shift]
type = PosSet
trigger1 = fvar(30) = pos x || 1
trigger1 = fvar(31) = pos y || 1
x = enemy(var(30)), pos x
y = enemy(var(30)), pos y

[State 1398, Shock FX]
type = Explod
trigger1 = !enemy(var(30)), gethitvar(guarded)
trigger1 = enemy(var(30)), movetype = H
id = 7070
anim = 7070 + random%5
sprpriority = 2
postype = p2
bindtime = -1
pos = 0, enemy(var(30)), const(size.mid.pos.y)
random = floor((enemy(var(30)), const(size.ground.front)+enemy(var(30)), const(size.ground.back))*(hitcount != 0)*0.4), floor((enemy(var(30)), const(size.mid.pos.y)-enemy(var(30)), const(size.head.pos.y))*(hitcount != 0)*0.8)
ignorehitpause = 1
ownpal = 1

[State 1398, FX Sound]
type = PlaySnd
trigger1 = !enemy(var(30)), gethitvar(guarded)
trigger1 = enemy(var(30)), movetype = H
value = 5, 10
abspan = floor(enemy(var(30)), pos x)
ignorehitpause = 1
channel = 4

[State 1398, Shift]
type = PosSet
trigger1 = 1
x = fvar(30)
y = fvar(31)

[State 1398, 17]
type = ChangeState
trigger1 = 1
value = 1398
ignorehitpause = 1

;---------------------------------------------------------------------------
; Standing Light Punch

[Statedef 1400]
type    = S				;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= I				;Move-type: A-attack, I-idle, H-gethit
physics = S				;Physics: S-stand, C-crouch, A-air
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 1400 + (var(11) != 0)				;Change animation (Def: no change)
poweradd = 30			;Power to add (Def: 0)
sprpriority = 2			;Set layering priority to 2 (in front)

[State StateType Flag]
type = VarSet
trigger1 = !time
var(10) = ifelse( statetype = A, 3, ifelse( statetype = C, 2, 1 ) )
ignorehitpause = 1

[State 1400, PlaySnd]
type = PlaySnd
trigger1 = animelem = 2
value = 1200, 0
persistent = 0
channel = 1

[State 1400, 5]
type = ChangeAnim
triggerall = !animtime
trigger1 = var(0) = 0
trigger1 = command = "holda"
trigger2 = var(0) = 1
trigger2 = command = "holdb"
value = anim

[State 1400, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = var(9) := 61
value = 0
ctrl = 1

[State 1400, PlaySnd]
type = PlaySnd
trigger1 = animelem = 1
value = 40, 2
channel = 2

[State 1400, Helper]
type = Helper
trigger1 = animelem = 3
trigger1 = numenemy
trigger1 = !numhelper(1450)
id = 1450
name = "pusher"
stateno = 1450
ownpal = 1
postype = p1
size.height = 999

[State 1400, Helper]
type = Helper
trigger1 = animelem = 3
trigger1 = numenemy > 1
trigger1 = !numhelper(1451)
id = 1451
name = "pusher2"
stateno = 1451
ownpal = 1
postype = p1
size.height = 999

[State 1400, Explod2]
type = Explod
trigger1 = animelem = 3
id = 1440
postype = p1
anim = 1440
bindtime = 1
pos = floor(96*const(size.xscale)), floor(-pos y)
sprpriority = 1
ownpal = 1
scale = const(size.xscale), const(size.yscale)
vel = const(size.xscale)*2, 0
accel = 0, -const(size.yscale)*0.005

[State 1400, Explod2]
type = Explod
trigger1 = animelem = 3
id = 1440
postype = p1
anim = 1441
bindtime = 1
pos = floor(128*const(size.xscale)), floor(-pos y)
sprpriority = 1
ownpal = 1
scale = const(size.xscale), const(size.yscale)
vel = const(size.xscale)*2, 0
accel = 0, -const(size.yscale)*0.01

[State 1400, Explod2]
type = Explod
trigger1 = animelem = 3
id = 1440
postype = p1
anim = 1442
bindtime = 1
pos = floor(160*const(size.xscale)), floor(-pos y)
sprpriority = 1
ownpal = 1
scale = const(size.xscale), const(size.yscale)
vel = const(size.xscale)*2, 0
accel = 0, -const(size.yscale)*0.015

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
statetype = A
ignorehitpause = 1

[State StateType Change]
type = StateTypeSet
trigger1 = var(11)
trigger1 = inguarddist
trigger1 = !var(13)
trigger1 = p2statetype != A || p2movetype != A || !(enemynear, hitdefattr = SCA, AT)
statetype = S
ignorehitpause = 1

[Statedef 1450]
ctrl = 0
anim = 1450
type = S
movetype = I
physics = N

[State 1450, DestroySelf]
type = DestroySelf
trigger1 = root, movetype != I
trigger2 = root, anim != [1400, 1401]
trigger3 = !numenemy

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

[State 1450, Turn]
type = Turn
trigger1 = facing != root, facing

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

[State 1450, VelSet]
type = VelSet
trigger1 = 1
x = 7.5 + rootdist x/32

[State 1450, VelSet]
type = VelSet
trigger1 = vel x < 0
x = 0

[State 1450, PlayerPush]
type = PlayerPush
trigger1 = rootdist x < 0
value = 1

[State 1450, PosSet]
type = PosSet
triggerall = enemy(0), statetype != A
trigger1 = (enemy(0), pos x - pos x)*facing < 0
trigger2 = !time
trigger3 = rootdist x < 0
x = enemy(0), pos x - enemy(0), const(size.ground.front)*facing

[State 1450, PosSet]
type = PosSet
triggerall = enemy(0), statetype = A
trigger1 = (enemy(0), pos x - pos x)*facing < 0
trigger2 = !time
trigger3 = rootdist x < 0
x = enemy(0), pos x - enemy(0), const(size.air.front)*facing

[State 1450, PosSet]
type = PosSet
triggerall = enemy(0), authorname = "Doggiedoo"
triggerall = enemy(0), statetype != A
trigger1 = (enemy(0), pos x - pos x)*facing < 0
trigger2 = !time
trigger3 = rootdist x < 0
x = enemy(0), pos x - enemy(0), const(size.ground.front)*enemy(0), const(size.xscale)*facing

[State 1450, PosSet]
type = PosSet
triggerall = enemy(0), authorname = "Doggiedoo"
triggerall = enemy(0), statetype = A
trigger1 = (enemy(0), pos x - pos x)*facing < 0
trigger2 = !time
trigger3 = rootdist x < 0
x = enemy(0), pos x - enemy(0), const(size.air.front)*enemy(0), const(size.xscale)*facing

[State 1450, Width]
type = Width
trigger1 = 1
player = 4 - const(size.ground.front), 4 - const(size.ground.back)

[Statedef 1451]
ctrl = 0
anim = 1450
type = S
movetype = I
physics = N

[State 1451, DestroySelf]
type = DestroySelf
trigger1 = root, movetype != I
trigger2 = root, anim != [1400, 1401]
trigger3 = numenemy < 2

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

[State 1451, Turn]
type = Turn
trigger1 = facing != root, facing

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

[State 1451, VelSet]
type = VelSet
trigger1 = 1
x = 7.5 + rootdist x/50

[State 1451, VelSet]
type = VelSet
trigger1 = vel x < 0
x = 0

[State 1451, PlayerPush]
type = PlayerPush
trigger1 = rootdist x < 0
value = 1

[State 1451, PosSet]
type = PosSet
triggerall = enemy(1), statetype != A
trigger1 = (enemy(1), pos x - pos x)*facing < 0
trigger2 = !time
trigger3 = rootdist x < 0
x = enemy(1), pos x - enemy(1), const(size.ground.front)*facing

[State 1451, PosSet]
type = PosSet
triggerall = enemy(1), statetype = A
trigger1 = (enemy(1), pos x - pos x)*facing < 0
trigger2 = !time
trigger3 = rootdist x < 0
x = enemy(1), pos x - enemy(1), const(size.air.front)*facing

[State 1451, PosSet]
type = PosSet
triggerall = enemy(1), authorname = "Doggiedoo"
triggerall = enemy(1), statetype != A
trigger1 = (enemy(1), pos x - pos x)*facing < 0
trigger2 = !time
trigger3 = rootdist x < 0
x = enemy(1), pos x - enemy(1), const(size.ground.front)*enemy(1), const(size.xscale)*facing

[State 1451, PosSet]
type = PosSet
triggerall = enemy(1), authorname = "Doggiedoo"
triggerall = enemy(1), statetype = A
trigger1 = (enemy(1), pos x - pos x)*facing < 0
trigger2 = !time
trigger3 = rootdist x < 0
x = enemy(1), pos x - enemy(1), const(size.air.front)*enemy(1), const(size.xscale)*facing

[State 1451, Width]
type = Width
trigger1 = 1
player = 4 - const(size.ground.front), 4 - const(size.ground.back)

;---------------------------------------------------------------------------
; Kientenhou
[Statedef 2000]
type = A
ctrl = 0
anim = 2000
velset = 0,-2.17
movetype = A
physics = N
sprpriority = 0

[State 2000, VelAdd]
type = VelAdd
trigger1 = time
y = 0.217

[State 2000, ChangeState]
type = ChangeState
trigger1 = time = 9
value = 2002

[Statedef 2002]
type = A
ctrl = 0
anim = 2002
velset = 0,0
movetype = A
physics = N
sprpriority = 0

[State 2002, SuperPause]
type = SuperPause
trigger1 = animelem = 9
time = 32
pos = 32*const(size.xscale), -80*const(size.yscale)
anim = s7300
sound = s3000, 0
poweradd = -1000
movetime = 32
p2defmul = 1
darken = 0

[State 2002, BGPalFX]
type = BGPalFX
trigger1 = animelem = 9
time = 31
mul = 32,32,32


[State 2002, ChangeState]
type = ChangeState
trigger1 = !animtime
trigger1 = fvar(3) := random%15 || 1
value = 2004

[State 2002, Explod1]
type = Explod
trigger1 = animelem = 11
id = 2015
postype = p1
anim = 2015
bindtime = 12
pos = 0, floor(32*const(size.yscale))
sprpriority = 4
ownpal = 1
scale = const(size.xscale), const(size.yscale)

[State 2002, 1]
type = NotHitBy
trigger1 = var(16)
value = SCA
time = 1
ignorehitpause = 1

[Statedef 2004]
type = A
ctrl = 0
anim = 2020
velset = 0,0
movetype = A
physics = N
sprpriority = 0

[State 2004, VarSet]
type = VarSet
trigger1 = !time
var(0) = 0

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

[State 2004, VarSet]
type = VarSet
trigger1 = !time
fvar(0) = 0

[State 2004, VarSet]
type = VarSet
triggerall = !var(0)
triggerall = fvar(0) > 16 ;16 per level
trigger1 = var(59) < 1
trigger1 = command != "holdx" || command != "holdy"
trigger2 = fvar(0) > 64
trigger3 = var(59) > 0
trigger3 = p2movetype = H
trigger3 = p2statetype = A
trigger3 = p2bodydist x < 128*const(size.xscale)
trigger3 = !enemynear, gethitvar(guarded)
trigger4 = var(59) > 0
trigger4 = fvar(0) > 64 - fvar(3)
var(0) = 1

[State 2004, Invisible]
type = AssertSpecial
trigger1 = 1
flag = Invisible

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

[State 2004, 1]
type = ChangeAnim
triggerall = var(0)
triggerall = anim = 2020
trigger1 = !numhelper(2050)
trigger1 = fvar(0) := 0 || 1
trigger2 = !helper(2050), var(1)
trigger2 = fvar(0) := 0 || 1
value = 2041

[State 2004, ChangeState]
type = ChangeState  
triggerall = (anim = 2040 && fvar(0) = 18) || (anim = 2041 && fvar(0) = 12)
trigger1 = var(59) < 1
trigger1 = command = "holdup"
trigger2 = var(59) > 0
trigger2 = p2statetype = A
trigger2 = p2dist x + p2dist y < 0
value = 2007

[State 2004, ChangeState]
type = ChangeState  
trigger1 = (anim = 2040 && fvar(0) = 18) || (anim = 2041 && fvar(0) = 12)
value = 2006

[State 2004, PosFreeze]
type = PosFreeze
trigger1 = numhelper(2050)
trigger1 = helper(2050), var(1)
trigger2 = anim > 2039

[State 2004, VarAdd]
type = VarAdd
trigger1 = numhelper(2050)
trigger1 = helper(2050), var(1) = 1
fvar(0) = -1

[State 2004, 1]
type = ChangeAnim
trigger1 = anim = 2040
value = 2040
elem = floor(fvar(0)/6) + 1

[State 2004, 1]
type = ChangeAnim
trigger1 = anim = 2041
value = 2041
elem = floor(fvar(0)/4) + 1

[State 2004, Helper]
type = Helper
trigger1 = !numhelper(2050)
trigger2 = !time
id = 2050
name = "firebird"
stateno = 2050
ownpal = 1
postype = p1

[State 2004, 1]
type = ChangeAnim
trigger1 = anim = 2020
value = 2020
elem = floor(fvar(0))%5 + 1

[State 2004, VarAdd]
type = VarAdd
trigger1 = !numhelper(2050)
trigger2 = !helper(2050), var(1)
trigger3 = helper(2050), var(1) > 10
fvar(0) = 1

[State 2004, VelMul]
type = VelMul
trigger1 = numhelper(2050)
trigger1 = !helper(2050), var(1)
x = 0.7

[State 2004, VelSet]
type = VelSet
trigger1 = numhelper(2050)
trigger1 = helper(2050), var(1) = 1
trigger1 = helper(2050), var(33)
x = -13

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

[Statedef 2006]
type = A
ctrl = 0
velset = 10, 0
movetype = A
physics = N
sprpriority = 0

[State 2006, Helper]
type = Helper
trigger1 = !numhelper(2050)
id = 2050
name = "firebird"
stateno = 2060
ownpal = 1
postype = p1

[State 2006, VarAdd]
type = VarAdd
trigger1 = numhelper(2050)
trigger1 = helper(2050), var(1) = 1
var(0) = -1

[State 2006, 1]
type = ChangeAnim
trigger1 = 1
value = 2062 + floor((fvar(1) - 1.0)*5.0 + 0.5)
;elem = (var(0)/3)%4 + 2

[State 2006, VarSet]
type = VarSet
trigger1 = !time
var(0) = 0

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

[State 2006, PlaySnd]
type = PlaySnd
trigger1 = !time
value = 2000, 1
channel = 3

[State 2006, PosFreeze]
type = PosFreeze
trigger1 = numhelper(2050)
trigger1 = helper(2050), var(1)

[State 2006, ChangeState]
type = ChangeState
triggerall = var(0) > 40
trigger1 = !numhelper(2050)
trigger2 = helper(2050), movecontact != 1 && helper(2050), movereversed != 1
value = 2010

[State 2006, ChangeState]
type = ChangeState
triggerall = var(59) < 1
triggerall = var(0) > 18
triggerall = command = "holddown"
trigger1 = !numhelper(2050)
trigger2 = helper(2050), movecontact != 1 && helper(2050), movereversed != 1
value = 2010

[State 2006, Invisible]
type = AssertSpecial
trigger1 = 1
flag = Invisible

[State 2006, VarAdd]
type = VarAdd
trigger1 = !numhelper(2050)
trigger2 = !helper(2050), var(1)
trigger3 = helper(2050), var(1) > 10
var(0) = 1

[State 2006, Offset]
type = Offset
trigger1 = 1
y = floor(-50*const(size.yscale) + 0.5)

[State 2006, NotHitBy]
type = NotHitBy
trigger1 = var(16)
value = , NA, SA, NT, ST, NP, SP

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

[Statedef 2007]
type = A
ctrl = 0
anim = 2081
velset = 6.67, -5
movetype = A
physics = N
sprpriority = 0

[State 2007, Helper]
type = Helper
trigger1 = !numhelper(2050)
id = 2050
name = "firebird"
stateno = 2060
ownpal = 1
postype = p1

[State 2007, VarAdd]
type = VarAdd
trigger1 = numhelper(2050)
trigger1 = helper(2050), var(1) = 1
var(0) = -1

[State 2007, 1]
type = ChangeAnim
trigger1 = 1
value = 2082 + floor((fvar(1) - 1.0)*5.0 + 0.5)
;elem = (var(0)/3)%4 + 2

[State 2007, VarSet]
type = VarSet
trigger1 = !time
var(0) = 0

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

[State 2007, PlaySnd]
type = PlaySnd
trigger1 = !time
value = 2000, 1
channel = 3

[State 2007, PosFreeze]
type = PosFreeze
trigger1 = numhelper(2050)
trigger1 = helper(2050), var(1)

[State 2007, ChangeState]
type = ChangeState
triggerall = var(0) > 40
trigger1 = !numhelper(2050)
trigger2 = helper(2050), movecontact != 1 && helper(2050), movereversed != 1
value = 2010

[State 2007, ChangeState]
type = ChangeState
triggerall = var(59) < 1
triggerall = var(0) > 18
triggerall = command = "holddown"
trigger1 = !numhelper(2050)
trigger2 = helper(2050), movecontact != 1 && helper(2050), movereversed != 1
value = 2010

[State 2007, Invisible]
type = AssertSpecial
trigger1 = 1
flag = Invisible

[State 2007, VarAdd]
type = VarAdd
trigger1 = !numhelper(2050)
trigger2 = !helper(2050), var(1)
trigger3 = helper(2050), var(1) > 10
var(0) = 1

[State 2007, Offset]
type = Offset
trigger1 = 1
y = floor(-50*const(size.yscale) + 0.5)

[State 2007, NotHitBy]
type = NotHitBy
trigger1 = var(16)
value = , NA, SA, NT, ST, NP, SP

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

[Statedef 2010]
type = A
ctrl = 0
anim = 2010
velset = 0,0
movetype = I
physics = N
sprpriority = 0

[State 2010, Explod1]
type = Explod
trigger1 = !time
id = 2017
postype = p1
anim = 2017 + random%2
bindtime = 1
pos = floor(-16*const(size.xscale)), floor(-88*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 2010, Explod2]
type = Explod
trigger1 = !time
id = 2017
postype = p1
anim = 2017 + random%2
bindtime = 1
pos = floor(-32*const(size.xscale)), floor(-40*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 2010, Explod3]
type = Explod
trigger1 = !time
id = 2017
postype = p1
anim = 2017 + random%2
bindtime = 1
pos = floor(0*const(size.xscale)), floor(-64*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 2010, Explod4]
type = Explod
trigger1 = !time
id = 2017
postype = p1
anim = 2017 + random%2
bindtime = 1
pos = floor(16*const(size.xscale)), floor(-88*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 2010, Explod5]
type = Explod
trigger1 = !time
id = 2017
postype = p1
anim = 2017 + random%2
bindtime = 1
pos = floor(32*const(size.xscale)), floor(-40*const(size.yscale))
sprpriority = 1
facing = ifelse(random%2, -1, 1)
ownpal = 1
scale = const(size.xscale), const(size.yscale)
vel = 0, const(size.yscale)
random = floor(16*const(size.xscale)), floor(32*const(size.yscale))

[State 2010, Explod]
type = Explod
trigger1 = !time
id = 10193
postype = p1
anim = 10193
bindtime = 1
sprpriority = 1
ownpal = 1
scale = const(size.xscale), const(size.yscale)

[State 2010, VelAdd]
type = VelAdd
trigger1 = animelemno(-1) > 2
y = 0.217

[State 2010, PosSet]
type = PosSet
trigger1 = pos y + vel y >= 0
y = 0

[State 2010, ChangeState]
type = ChangeState
trigger1 = pos y + vel y >= 0
trigger1 = var(11) := 0 || 1
value = 0
ctrl = 1

[Statedef 2050]
type = A
ctrl = 0
velset = 0,0
movetype = A
physics = N
sprpriority = 3
movehitpersist = 1
;should only hit once in original mode

[State 2050, 1]
type = ChangeAnim
trigger1 = root, movetype != A
trigger2 = root, statetype != A
trigger3 = root, stateno != [2000, 2010)
value = 9999
ignorehitpause = 1

[State 2050, 1]
type = ChangeState
trigger1 = anim = 9999
value = 2096
ignorehitpause = 1

[State 2050, Bind]
type = BindToParent
trigger1 = 1
pos = 0, floor(-50*const(size.yscale) + 0.5)
ignorehitpause = 1

[State 2050, 1]
type = ChangeState
triggerall = time || (prevstateno != 2097 && prevstateno != 2098)
trigger1 = movecontact = 1
value = 2097
ignorehitpause = 1

[State 2050]
type = ChangeState
triggerall = time || prevstateno != 2098
trigger1 = movecontact = 1
value = 2098
ignorehitpause = 1

[State 2050, 1]
type = VarSet
trigger1 = !var(59)
var(59) = gametime
ignorehitpause = 1

[State 2050, 1]
type = VarSet
trigger1 = !fvar(0)
fvar(0) = 1
ignorehitpause = 1

[State 2050, 1]
type = VarAdd
trigger1 = var(1)
var(1) = 1
ignorehitpause = 1

[State 2050, 1]
type = VarSet
triggerall = movecontact = 1 || movereversed = 1
trigger1 = numtarget(var(14))
trigger2 = numenemy
trigger2 = enemy(0), time = [-1, 1]
trigger2 = enemy(0), gethitvar(chainid) = var(14)
trigger3 = numenemy > 1
trigger3 = enemy(1), time = [-1, 1]
trigger3 = enemy(1), gethitvar(chainid) = var(14)
var(1) = 1
ignorehitpause = 1

[State 2050, 1]
type = ParentVarSet
trigger1 = var(1)
var(1) = var(1)
ignorehitpause = 1

[State 2050, 1]
type = ParentVarAdd
trigger1 = var(1) = 1
trigger1 = movecontact = 1
var(39) = 2
ignorehitpause = 1

[State 2050, 1]
type = VarAdd
trigger1 = var(1) = 1
var(18) = 1
ignorehitpause = 1

[State 2050, 1]
type = VarSet
trigger1 = movecontact != [1, 12]
trigger1 = movereversed != 1
var(1) = 0
ignorehitpause = 1

[State 2050, 1]
type = VarSet
trigger1 = var(1)
var(2) = 12
ignorehitpause = 1

[State 2050, 1]
type = VarAdd
trigger1 = var(2) > 0
trigger1 = !var(1)
var(2) = -1
ignorehitpause = 1

[State 2050, ChangeState]
type = ChangeState  
trigger1 = root, anim > 2059
trigger1 = var(0) := 0 || 1
trigger1 = var(2) := ifelse(var(2) < 6, 0, var(2) - 6) || 1
value = 2060
ignorehitpause = 1

[State 2050, 2]
type = ChangeAnim
trigger1 = 1
value = root, anim + 2 + floor((fvar(0) - 1.0)*20.0 + 0.5)
elem = root, animelemno(0) + 1
ignorehitpause = 1

[State 2050, 1]
type = VarAdd
trigger1 = !root, var(0)
trigger1 = !var(1)
fvar(0) = 0.01

[State 2050, 1]
type = ParentVarSet
trigger1 = 1
fvar(1) = fvar(0)

[State 2050, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
ignorehitpause = 1

[State 2050, AngleDraw]
type = AngleDraw
trigger1 = 1
scale = fvar(0), fvar(0)

[State 2050, 1]
type = NotHitBy
trigger1 = 1
value = , AA, AT
time = 1
ignorehitpause = 1

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

[State 2050, VarSet]
type = VarSet
trigger1 = 1
fvar(1) = ifelse(root, var(39), root, fvar(14)*(root, fvar(14)**root, var(39)), 1)*fvar(0)
ignorehitpause = 1

[State 2050, 1]
type = HitDef
trigger1 = !var(2)
id = 0*(var(14) := stateno + (var(18)%100)*10000 + (var(59)%100)*1000000 + id%10) + var(14)
attr = A, HP
damage = ceil(80*fvar(1)), ceil(16*fvar(1))
getpower = 0,0
animtype = Heavy
guardflag = MA
hitflag = MA
pausetime = 0, 13
sparkno = -1;s17004
guard.sparkno = -1;s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
;sparkxy = -10, floor(-200*const(size.yscale) + ifelse((p2dist y*const(size.yscale) = [-264, -136]), (p2dist y*const(size.yscale)+200)*0.5, ifelse(p2dist y*const(size.yscale) < -264, -32, 32)))
hitsound   = -1;s5,2
guardsound = -1;s6,0; + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = -5, -7.5
ground.hittime  = 20
ground.slidetime  = 20
ground.cornerpush.veloff = 0
guard.hittime = 19
guard.velocity = -10
guard.kill = 1
;air.hittime = 999
airguard.ctrltime = 999
air.velocity = -5, -6.43
airguard.velocity = -5, -6.43
fall = 1
fall.recover = 0
palfx.time = 50
palfx.color = 0
palfx.mul = 256, 64, 0
palfx.sinadd = -64, -64, 0, 20
yaccel = .536

[State 2050, ParentVarSet]
type = ParentVarSet
trigger1 = numtarget
var(40) = 1

[State 2050, 1]
type = VarAdd
trigger1 = !var(1)
var(0) = 1

[Statedef 2060]
type = A
ctrl = 0
anim = 2062
velset = 0,0
movetype = A
physics = N
sprpriority = 3
movehitpersist = 1
hitcountpersist = 1

[State 2060, Bind]
type = BindToParent
trigger1 = 1
pos = 0, floor(-50*const(size.yscale) + 0.5)
ignorehitpause = 1

[State 2060, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
ignorehitpause = 1

[State 2060, ChangeState]
type = ChangeState
triggerall = time || (prevstateno != 11000 && prevstateno != 2097 && prevstateno != 2098)
trigger1 = moveguarded = 1
trigger1 = var(6)
value = 11000
ignorehitpause = 1

[State 2060]
type = ChangeState
triggerall = time || (prevstateno != 2097 && prevstateno != 2098)
trigger1 = movecontact = 1
value = 2097
ignorehitpause = 1

[State 2060]
type = ChangeState
triggerall = time || prevstateno != 2098
trigger1 = movecontact = 1
value = 2098
ignorehitpause = 1

[State Info]
type = DisplayToClipboard
trigger1 = 0
text = "30 %d, 31 %d, 32 %d, 33 %d"
params = var(30), var(31), var(32), var(33)
ignorehitpause = 1

[State 2060, 1]
type = VarSet
trigger1 = !time
var(32) = 0
ignorehitpause = 1

[State 2060, 1]
type = ChangeState
trigger1 = root, movetype != A
trigger2 = root, statetype != A
trigger3 = root, stateno != [2000, 2010)
trigger4 = root, anim != [2060, 2099]
value = 2096
ignorehitpause = 1

[State 2060, AngleDraw]
type = AngleDraw
trigger1 = 1
scale = fvar(0), fvar(0)

[State 2060, 1]
type = NotHitBy
trigger1 = 1
value = SCA, AA, AT
time = 1
ignorehitpause = 1

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

[State 2060, 1]
type = VarSet
trigger1 = root, frontedgebodydist <= 0
trigger1 = !root, var(16)
trigger1 = root, var(0) > 12
trigger2 = root, var(0) > 40
var(20) = 1
ignorehitpause = 1

[State 2060, 2]
type = ChangeAnim
trigger1 = root, var(16)
trigger1 = root, anim = [2060, 2079]
value = 2062 + floor((fvar(0) - 1.0)*20.0 + 0.5)
elem = (var(0)/3)%4 + 2
ignorehitpause = 1

[State 2060, 2]
type = ChangeAnim
trigger1 = root, var(16)
trigger1 = root, anim = [2080, 2099]
value = 2082 + floor((fvar(0) - 1.0)*20.0 + 0.5)
elem = (var(0)/3)%4 + 2
ignorehitpause = 1

[State 2060, 2]
type = ChangeAnim
trigger1 = !root, var(16)
trigger1 = root, anim = [2060, 2079]
value = 2062 + floor((fvar(0) - 1.0)*20.0 + 0.5)
elem = (var(0)/6)%4 + 2
ignorehitpause = 1

[State 2060, 2]
type = ChangeAnim
trigger1 = !root, var(16)
trigger1 = root, anim = [2080, 2099]
value = 2082 + floor((fvar(0) - 1.0)*20.0 + 0.5)
elem = (var(0)/6)%4 + 2
ignorehitpause = 1

[State 2060, 2]
type = ChangeAnim
trigger1 = root, anim != [2060, 2099]
value = 9999
ignorehitpause = 1

[State 2060, 1]
type = VarAdd
triggerall = time || prevstateno != 2050
trigger1 = var(1)
var(1) = 1
ignorehitpause = 1

[State 2060, 1]
type = VarSet
triggerall = time || prevstateno != 2050
triggerall = movecontact = 1
trigger1 = numtarget(var(14))
trigger2 = numenemy
trigger2 = enemy(0), time = [-1, 1]
trigger2 = enemy(0), gethitvar(chainid) = var(14)
trigger3 = numenemy > 1
trigger3 = enemy(1), time = [-1, 1]
trigger3 = enemy(1), gethitvar(chainid) = var(14)
var(1) = 1
ignorehitpause = 1

[State 2060, 1]
type = VarSet
triggerall = time || prevstateno != 2050
trigger1 = movereversed = 1
var(1) = 1
ignorehitpause = 1

[State 2060, 1]
type = VarAdd
trigger1 = var(1) = 1
var(0) = -1

[State 2060, 1]
type = ParentVarSet
trigger1 = var(1)
var(1) = var(1)
ignorehitpause = 1

[State 2060, 1]
type = ParentVarAdd
triggerall = time || prevstateno != 2050
trigger1 = var(1) = 1
trigger1 = movecontact = 1
var(39) = 3
ignorehitpause = 1

[State 2060, 1]
type = VarAdd
triggerall = time || prevstateno != 2050
trigger1 = var(1) = 1
var(18) = 1
ignorehitpause = 1

[State 2060, 1]
type = VarSet
trigger1 = movecontact != [1, 12]
trigger1 = movereversed != 1
var(1) = 0
ignorehitpause = 1

[State 2060, 1]
type = VarSet
trigger1 = var(1)
var(2) = 6
ignorehitpause = 1

[State 2060, 1]
type = VarAdd
trigger1 = var(2) > 0
trigger1 = !var(1)
var(2) = -1
ignorehitpause = 1

[State 2060, VarSet]
type = VarSet
trigger1 = 1
fvar(1) = ifelse(root, var(39), root, fvar(14)*(root, fvar(14)**root, var(39)), 1)*(fvar(0)*0.5 + 0.5)

[State 2060, 1]
type = HitDef
triggerall = !var(20)
trigger1 = !var(2)
trigger1 = var(6) := floor(root, fvar(12)*500) || 1
id = 0*(var(14) := stateno + (var(18)%100)*10000 + (var(59)%100)*1000000 + id%10) + var(14)
attr = A, HP
damage = ceil(112*fvar(1)), ceil(24*fvar(1))
getpower = 0,0
animtype = Heavy
guardflag = MA
hitflag = MAF
pausetime = 0, 13
sparkno = -1;s17004
guard.sparkno = -1;s17006 + 2*(numenemy = 1 && var(8) - var(6) < 1)
;sparkxy = -10, floor(-200*const(size.yscale) + ifelse((p2dist y*const(size.yscale) = [-264, -136]), (p2dist y*const(size.yscale)+200)*0.5, ifelse(p2dist y*const(size.yscale) < -264, -32, 32)))
hitsound   = -1;s5,2
guardsound = -1;s6,0; + 2*(numenemy = 1 && var(8) - var(6) < 1)
ground.type = High
ground.velocity = -5, -7.5
ground.hittime  = 20
ground.slidetime  = 20
ground.cornerpush.veloff = 0
guard.hittime = 19
guard.velocity = -10
guard.kill = 1
;air.hittime = 999
airguard.ctrltime = 999
air.velocity = -5, -6.43
airguard.velocity = -5, -6.43
fall = 1
fall.recover = 0
palfx.time = 50
palfx.color = 0
palfx.mul = 256, 64, 0
palfx.sinadd = -64, -64, 0, 20
yaccel = .536

[State 2060, ParentVarSet]
type = ParentVarSet
trigger1 = numtarget
var(40) = 1

[State 2060, 1]
type = VarAdd
trigger1 = !var(1)
var(0) = 1

[Statedef 2096]
type = U
movetype = I
physics = U
anim = 9999

[State 2096, 1]
type = DestroySelf
trigger1 = !numtarget
ignorehitpause = 1

[State 2096, Invisible]
type = AssertSpecial
trigger1 = 1
flag = Invisible
ignorehitpause = 1

[State 2096, ParentVarSet]
type = ParentVarSet
trigger1 = numtarget
var(40) = 1

[Statedef 2097]
type = U
movetype = U
physics = U
movehitpersist = 1
hitcountpersist = 1

;var(30) = target num x no use, but can use in 2098 to specify enemy(v)
;var(31) = starting state
;var(32) = enemies found
;var(33) = cornerpush
;var(34) = hit or guarded
;var(40) = guardbreak
;fvar(20) = max x
;fvar(21) = min x
;fvar(22) = max y
;fvar(23) = min y
;fvar(30) = dist x
;fvar(31) = dist y
;fvar(32) = math 1
;fvar(33) = math 2

[State 2097, 1]
type = VarSet
trigger1 = 1
var(30) = 0
ignorehitpause = 1

[State 2097, 1]
type = VarSet
trigger1 = 1
var(31) = prevstateno
ignorehitpause = 1

[State 2097, 2]
type = VarSet
trigger1 = 1
var(32) = 0
ignorehitpause = 1

[State 2097, 2]
type = VarSet
trigger1 = 1
var(33) = 0
ignorehitpause = 1

[State 2097, 2]
type = VarSet
trigger1 = 1
var(34) = 0
ignorehitpause = 1

[State 2097, 17]
type = ChangeState
trigger1 = !numtarget(var(14))
trigger2 = target(var(14)), time != [-1, 1]
value = prevstateno
ignorehitpause = 1

[State 2097, 4]
type = VarSet
trigger1 = numenemy
trigger1 = target(var(14)), id = enemy(0), id
var(32) = 1
ignorehitpause = 1

[State 2097, 5]
type = VarSet
trigger1 = numenemy > 1
trigger1 = target(var(14)), id = enemy(1), id
var(32) = 2
ignorehitpause = 1

[State 2097, 2]
type = VarSet
triggerall = target(var(14)), gethitvar(guarded)
trigger1 = facing = 1
trigger1 = target(var(14)), pos x > pos x
trigger1 = target(var(14)), backedgebodydist <= 0 || target(var(14)), frontedgebodydist <= 0
trigger2 = facing = -1
trigger2 = target(var(14)), pos x < pos x
trigger2 = target(var(14)), backedgebodydist <= 0 || target(var(14)), frontedgebodydist <= 0
var(33) = 1
ignorehitpause = 1

[State 2097, 6]
type = VarSet
trigger1 = 1
fvar(32) = target(var(14)), pos x + ifelse(target(var(14)), statetype = A, target(var(14)), const(size.air.front), target(var(14)), const(size.ground.front))*target(var(14)), facing
ignorehitpause = 1

[State 2097, 7]
type = VarSet
trigger1 = 1
fvar(32) = (fvar(32) - ( pos x + (fvar(20)+fvar(21))*0.5*facing ) )*facing
ignorehitpause = 1

[State 2097, 8]
type = VarSet
trigger1 = 1
fvar(33) = target(var(14)), pos x - ifelse(target(var(14)), statetype = A, target(var(14)), const(size.air.back), target(var(14)), const(size.ground.back))*target(var(14)), facing
ignorehitpause = 1

[State 2097, 9]
type = VarSet
trigger1 = 1
fvar(33) = (fvar(33) - ( pos x + (fvar(20)+fvar(21))*0.5*facing ) )*facing
ignorehitpause = 1

[State 2097, 10]
type = VarSet
trigger1 = 1
fvar(30) = 0
ignorehitpause = 1

[State 2097, 11]
type = VarSet
trigger1 = fvar(32) > 0
trigger1 = fvar(33) > 0
fvar(30) = ifelse( fvar(32) < fvar(33), fvar(32), fvar(33) ) + 10
ignorehitpause = 1

[State 2097, 12]
type = VarSet
trigger1 = fvar(32) < 0
trigger1 = fvar(33) < 0
fvar(30) = ifelse( fvar(32) > fvar(33), fvar(32), fvar(33) ) - 10
ignorehitpause = 1

[State 2097, 13]
type = VarSet
trigger1 = fvar(32) < 0
trigger1 = fvar(33) > 0
trigger1 = fvar(32)+fvar(33) != 0
fvar(30) = (fvar(32) + 10)*(fvar(32)/(-fvar(32)+fvar(33))) + (fvar(33) - 10)*(fvar(33)/(-fvar(32)+fvar(33)))
ignorehitpause = 1

[State 2097, 13]
type = VarSet
trigger1 = fvar(32) > 0
trigger1 = fvar(33) < 0
trigger1 = fvar(32)+fvar(33) != 0
fvar(30) = (fvar(32) - 10)*(fvar(32)/(fvar(32)-fvar(33))) + (fvar(33) + 10)*(fvar(33)/(fvar(32)-fvar(33)))
ignorehitpause = 1

[State 2097, 14]
type = VarAdd
trigger1 = 1
fvar(30) = (fvar(20)+fvar(21))*0.5
ignorehitpause = 1

[State 2097, 15]
type = VarSet
trigger1 = 1
fvar(31) = (target(var(14)), pos y + target(var(14)), const(size.mid.pos.y) - pos y)*0.5
ignorehitpause = 1

[State 2097, Explod]
type = Explod
triggerall = root, var(22)
trigger1 = !target(var(14)), gethitvar(guarded)
postype = left
facing = -target(var(14)), facing
anim = 27004
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1

[State 2097, Explod]
type = Explod
triggerall = root, var(22)
triggerall = target(var(14)), gethitvar(guarded)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = target(var(14)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = target(var(14)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = target(var(14)), id != enemy(0), id
trigger5 = target(var(14)), id != enemy(1), id
postype = left
facing = -target(var(14)), facing
anim = 17006
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1

[State 2097, Explod]
type = Explod
triggerall = target(var(14)), gethitvar(guarded)
trigger1 = var(40) = 1
trigger1 = target(var(14)), id = enemy(0), id
trigger2 = var(40) = 2
trigger2 = target(var(14)), id = enemy(1), id
trigger3 = var(40) = 3
trigger3 = target(var(14)), id = enemy(0), id
trigger4 = var(40) = 3
trigger4 = target(var(14)), id = enemy(1), id
postype = left
facing = -target(var(14)), facing
anim = 17008
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1

[State 2097, Explod]
type = Explod
triggerall = !root, var(22)
trigger1 = !target(var(14)), gethitvar(guarded)
postype = left
facing = -target(var(14)), facing
anim = F3
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1

[State 2097, Explod]
type = Explod
triggerall = !root, var(22)
triggerall = target(var(14)), gethitvar(guarded)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = target(var(14)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = target(var(14)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = target(var(14)), id != enemy(0), id
trigger5 = target(var(14)), id != enemy(1), id
postype = left
facing = -target(var(14)), facing
anim = F40
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1

[State 2097, VarSet]
type = VarSet
trigger1 = !target(var(14)), gethitvar(guarded)
var(34) = 1

[State 2097, PlaySnd]
type = PlaySnd
triggerall = !var(34)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = target(var(14)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = target(var(14)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = target(var(14)), id != enemy(0), id
trigger5 = target(var(14)), id != enemy(1), id
value = 6, 0
channel = 1
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 2097, PlaySnd]
type = PlaySnd
triggerall = !var(34)
trigger1 = var(40) = 1
trigger1 = target(var(14)), id = enemy(0), id
trigger2 = var(40) = 2
trigger2 = target(var(14)), id = enemy(1), id
trigger3 = var(40) = 3
trigger3 = target(var(14)), id = enemy(0), id
trigger3 = var(40) := 2 || 1
trigger4 = var(40) = 3
trigger4 = target(var(14)), id = enemy(1), id
trigger4 = var(40) := 1 || 1
value = 6, 2
channel = 3
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 2097, PlaySnd]
type = PlaySnd
trigger1 = var(34)
value = 5, 2
channel = 1
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 2097, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
ignorehitpause = 1

[State 2097, Shift]
type = PosSet
trigger1 = fvar(30) = pos x || 1
trigger1 = fvar(31) = pos y || 1
x = target(var(14)), pos x
y = target(var(14)), pos y

[State 2097, Fire FX]
type = Explod
trigger1 = !target(var(14)), gethitvar(guarded)
id = 7050
anim = 7050 + random%3
sprpriority = 2
postype = p2
bindtime = 45 
pos = 0, floor(target(var(14)), const(size.mid.pos.y))
random = floor((target(var(14)), const(size.ground.front)+target(var(14)), const(size.ground.back))*(hitcount != 0)*0.4), floor((target(var(14)), const(size.mid.pos.y)-target(var(14)), const(size.head.pos.y))*(hitcount != 0)*0.8)
ignorehitpause = 1
ownpal = 1

[State 2097, FX Sound]
type = PlaySnd
trigger1 = !target(var(14)), gethitvar(guarded)
value = 5, 8
abspan = floor(target(var(14)), pos x)
ignorehitpause = 1
channel = 4

[State 2097, Shift]
type = PosSet
trigger1 = 1
x = fvar(30)
y = fvar(31)

[State 2097, 17]
type = ChangeState
trigger1 = var(40) := 0 || 1
value = prevstateno
ignorehitpause = 1

[Statedef 2098]
type = U
movetype = U
physics = U
movehitpersist = 1
hitcountpersist = 1

;var(30) = target num x no use, but can use in 2098 to specify enemy(v)
;var(31) = starting state
;var(32) = enemies found
;var(33) = cornerpush
;var(40) = guardbreak
;fvar(20) = max x
;fvar(21) = min x
;fvar(22) = max y
;fvar(23) = min y
;fvar(30) = dist x
;fvar(31) = dist y
;fvar(32) = math 1
;fvar(33) = math 2

[State 2098, 1]
type = VarSet
trigger1 = prevstateno != 2098
var(31) = prevstateno
ignorehitpause = 1

[State 2098, 1]
type = VarAdd
trigger1 = prevstateno = 2098
var(30) = 1
ignorehitpause = 1

[State Info]
type = DisplayToClipboard
trigger1 = 1
text = "OK3 %d, %d, %d, %d, e %d"
params = prevstateno, var(30), var(31), var(32), (var(30) > numenemy - 1)
ignorehitpause = 1

[State 2098, 1]
type = ChangeState
triggerall = var(30) = 0
trigger1 = !numenemy 
trigger2 = var(32) = 3 ;redundant, but just in case
trigger3 = var(32) = 1
trigger4 = enemy(var(30)), time != [-1, 1]
trigger5 = enemy(var(30)), gethitvar(chainid) != var(14)
value = 2098
ignorehitpause = 1

[State 2098, 1]
type = ChangeState
triggerall = var(30) = 1
trigger1 = numenemy < 2
trigger2 = var(32) = 3 ;redundant, but just in case
trigger3 = var(32) = 2
trigger4 = enemy(var(30)), time != [-1, 1]
trigger5 = enemy(var(30)), gethitvar(chainid) != var(14)
value = var(31)
ignorehitpause = 1

[State 2098, 1]
type = ChangeState
trigger1 = var(30) > 1
value = var(31)
ignorehitpause = 1

[State 2098, 2]
type = VarSet
triggerall = enemy(var(30)), gethitvar(guarded)
trigger1 = facing = 1
trigger1 = enemy(var(30)), pos x > pos x
trigger1 = enemy(var(30)), backedgebodydist <= 0 || enemy(var(30)), frontedgebodydist <= 0
trigger2 = facing = -1
trigger2 = enemy(var(30)), pos x < pos x
trigger2 = enemy(var(30)), backedgebodydist <= 0 || enemy(var(30)), frontedgebodydist <= 0
var(33) = 1
ignorehitpause = 1

[State 2098, 6]
type = VarSet
trigger1 = 1
fvar(32) = enemy(var(30)), pos x + ifelse(enemy(var(30)), statetype = A, enemy(var(30)), const(size.air.front), enemy(var(30)), const(size.ground.front))*enemy(var(30)), facing
ignorehitpause = 1

[State 2098, 7]
type = VarSet
trigger1 = 1
fvar(32) = (fvar(32) - ( pos x + (fvar(20)+fvar(21))*0.5*facing ) )*facing
ignorehitpause = 1

[State 2098, 8]
type = VarSet
trigger1 = 1
fvar(33) = enemy(var(30)), pos x - ifelse(enemy(var(30)), statetype = A, enemy(var(30)), const(size.air.back), enemy(var(30)), const(size.ground.back))*enemy(var(30)), facing
ignorehitpause = 1

[State 2098, 9]
type = VarSet
trigger1 = 1
fvar(33) = (fvar(33) - ( pos x + (fvar(20)+fvar(21))*0.5*facing ) )*facing
ignorehitpause = 1

[State 2098, 10]
type = VarSet
trigger1 = 1
fvar(30) = 0
ignorehitpause = 1

[State 2098, 11]
type = VarSet
trigger1 = fvar(32) > 0
trigger1 = fvar(33) > 0
fvar(30) = ifelse( fvar(32) < fvar(33), fvar(32), fvar(33) ) + 10
ignorehitpause = 1

[State 2098, 12]
type = VarSet
trigger1 = fvar(32) < 0
trigger1 = fvar(33) < 0
fvar(30) = ifelse( fvar(32) > fvar(33), fvar(32), fvar(33) ) - 10
ignorehitpause = 1

[State 2098, 13]
type = VarSet
trigger1 = fvar(32) < 0
trigger1 = fvar(33) > 0
trigger1 = fvar(32)+fvar(33) != 0
fvar(30) = (fvar(32) + 10)*(fvar(32)/(-fvar(32)+fvar(33))) + (fvar(33) - 10)*(fvar(33)/(-fvar(32)+fvar(33)))
ignorehitpause = 1

[State 2098, 13]
type = VarSet
trigger1 = fvar(32) > 0
trigger1 = fvar(33) < 0
trigger1 = fvar(32)+fvar(33) != 0
fvar(30) = (fvar(32) - 10)*(fvar(32)/(fvar(32)-fvar(33))) + (fvar(33) + 10)*(fvar(33)/(fvar(32)-fvar(33)))
ignorehitpause = 1

[State 2098, 14]
type = VarAdd
trigger1 = 1
fvar(30) = (fvar(20)+fvar(21))*0.5
ignorehitpause = 1

[State 2098, 15]
type = VarSet
trigger1 = 1
fvar(31) = (enemy(var(30)), pos y + enemy(var(30)), const(size.mid.pos.y) - pos y)*0.5
ignorehitpause = 1

[State 2098, Explod]
type = Explod
triggerall = root, var(22)
trigger1 = !enemy(var(30)), gethitvar(guarded)
postype = left
facing = -enemy(var(30)), facing
anim = 27004
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1

[State 2098, Explod]
type = Explod
triggerall = root, var(22)
triggerall = enemy(var(30)), gethitvar(guarded)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = enemy(var(30)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = enemy(var(30)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = enemy(var(30)), id != enemy(0), id
trigger5 = enemy(var(30)), id != enemy(1), id
postype = left
facing = -enemy(var(30)), facing
anim = 17006
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1

[State 2098, Explod]
type = Explod
triggerall = enemy(var(30)), gethitvar(guarded)
trigger1 = var(40) = 1
trigger1 = enemy(var(30)), id = enemy(0), id
trigger2 = var(40) = 2
trigger2 = enemy(var(30)), id = enemy(1), id
trigger3 = var(40) = 3
trigger3 = enemy(var(30)), id = enemy(0), id
trigger4 = var(40) = 3
trigger4 = enemy(var(30)), id = enemy(1), id
postype = left
facing = -enemy(var(30)), facing
anim = 17008
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1

[State 2098, Explod]
type = Explod
triggerall = !root, var(22)
trigger1 = !enemy(var(30)), gethitvar(guarded)
postype = left
facing = -enemy(var(30)), facing
anim = F3
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1

[State 2098, Explod]
type = Explod
triggerall = !root, var(22)
triggerall = enemy(var(30)), gethitvar(guarded)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = enemy(var(30)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = enemy(var(30)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = enemy(var(30)), id != enemy(0), id
trigger5 = enemy(var(30)), id != enemy(1), id
postype = left
facing = -enemy(var(30)), facing
anim = F40
bindtime = 1
pos = floor(screenpos x + fvar(30)*facing), floor(screenpos y + fvar(31))
sprpriority = 5
pausemovetime = 99999
supermovetime = 99999
persistent = 0
ownpal = 1
ignorehitpause = 1

[State 2098, VarSet]
type = VarSet
trigger1 = !enemy(var(30)), gethitvar(guarded)
var(34) = 1

[State 2098, PlaySnd]
type = PlaySnd
triggerall = !var(34)
trigger1 = !numenemy
trigger2 = !var(40)
trigger3 = var(40) = 1
trigger3 = enemy(var(30)), id != enemy(0), id
trigger4 = var(40) = 2
trigger4 = enemy(var(30)), id != enemy(1), id
trigger5 = var(40) = 3
trigger5 = enemy(var(30)), id != enemy(0), id
trigger5 = enemy(var(30)), id != enemy(1), id
value = 6, 0
channel = 1
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 2098, PlaySnd]
type = PlaySnd
triggerall = !var(34)
trigger1 = var(40) = 1
trigger1 = enemy(var(30)), id = enemy(0), id
trigger2 = var(40) = 2
trigger2 = enemy(var(30)), id = enemy(1), id
trigger3 = var(40) = 3
trigger3 = enemy(var(30)), id = enemy(0), id
trigger3 = var(40) := 2 || 1
trigger4 = var(40) = 3
trigger4 = enemy(var(30)), id = enemy(1), id
trigger4 = var(40) := 1 || 1
value = 6, 2
channel = 3
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 2098, PlaySnd]
type = PlaySnd
trigger1 = var(34)
value = 5, 2
channel = 1
pan = floor(fvar(30) + 0.5)
ignorehitpause = 1

[State 2098, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
ignorehitpause = 1

[State 2098, Shift]
type = PosSet
trigger1 = fvar(30) = pos x || 1
trigger1 = fvar(31) = pos y || 1
x = enemy(var(30)), pos x
y = enemy(var(30)), pos y

[State 2098, Fire FX]
type = Explod
trigger1 = !enemy(var(30)), gethitvar(guarded)
trigger1 = enemy(var(30)), movetype = H
id = 7050
anim = 7050 + random%3
sprpriority = 2
postype = p2
bindtime = 45 
pos = 0, floor(enemy(var(30)), const(size.mid.pos.y))
random = floor((enemy(var(30)), const(size.ground.front)+enemy(var(30)), const(size.ground.back))*(hitcount != 0)*0.4), floor((enemy(var(30)), const(size.mid.pos.y)-enemy(var(30)), const(size.head.pos.y))*(hitcount != 0)*0.8)
ignorehitpause = 1
ownpal = 1

[State 2098, FX Sound]
type = PlaySnd
trigger1 = !enemy(var(30)), gethitvar(guarded)
trigger1 = enemy(var(30)), movetype = H
value = 5, 8
abspan = floor(enemy(var(30)), pos x)
ignorehitpause = 1
channel = 4

[State 2098, Shift]
type = PosSet
trigger1 = 1
x = fvar(30)
y = fvar(31)

[State 2098, 17]
type = ChangeState
trigger1 = 1
value = 2098
ignorehitpause = 1

[Statedef 11000]
type = U
ctrl = 0
movetype = A
physics = U
movehitpersist = 1
hitdefpersist = 1
hitcountpersist = 1

[state 11000, Single Target Guarded]
type = ParentVarAdd
triggerall = moveguarded = 1
triggerall = numtarget(var(14)) = 1
triggerall = numenemy
triggerall = target(var(14)), gethitvar(guarded)
triggerall = var(6)
trigger1 = target(var(14)), id = root, var(2)
trigger1 = root, var(3) != -1
trigger2 = target(var(14)), id = root, var(4)
trigger2 = root, var(5) != -1
v = ifelse(target(var(14)), id = root, var(2), 3, 5)
value = var(6)
ignorehitpause = 1

[state 11000, Multiple Targets Guarded]
type = null
triggerall = movecontact = 1
triggerall = numtarget(var(14)) > 1
triggerall = numenemy
triggerall = var(6)
;triggerall = target(var(14)), id = root, var(2) || target(var(14)), id = root, var(4)
trigger1 = root, var(3) != -1
trigger1 = enemy(0), gethitvar(guarded)
trigger1 = enemy(0), gethitvar(chainid) = var(14)
trigger1 = enemy(0), gethitvar(hitshaketime)
trigger1 = var(53) := root, var(3) + var(6)
trigger1 = var(52) := 1
trigger1 = 0
trigger2 = root, var(5) != -1
trigger2 = numenemy > 1
trigger2 = enemy(1), gethitvar(guarded)
trigger2 = enemy(1), gethitvar(chainid) = var(14)
trigger2 = enemy(1), gethitvar(hitshaketime)
trigger2 = var(55) := root, var(5) + var(6)
trigger2 = var(54) := 1
trigger2 = 0
ignorehitpause = 1

[State Info]
type = DisplayToClipboard
trigger1 = 0
text = "30 %f, 32 %f, 33 %f"
params = fvar(30), fvar(32), fvar(33)
ignorehitpause = 1

[state 11000, Single Target Guard Break]
type = TargetState
triggerall = moveguarded = 1
triggerall = var(6)
triggerall = numtarget(var(14)) = 1
triggerall = target(var(14)), alive
triggerall = target(var(14)), gethitvar(guarded)
trigger1 = target(var(14)), id = root, var(2)
trigger1 = root, var(3) > floor(target(var(14)), lifemax*target(var(14)), const(data.defence)*0.01)
trigger1 = var(52) := 1
trigger1 = var(53) := 0 || 1
trigger1 = var(7) := 1
trigger2 = target(var(14)), id = root, var(4)
trigger2 = root, var(5) > floor(target(var(14)), lifemax*target(var(14)), const(data.defence)*0.01)
trigger2 = var(54) := 1
trigger2 = var(55) := 0 || 1
trigger2 = var(7) := 1
id = var(14)
value = 5400
ignorehitpause = 1

[state 11000, 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 = moveguarded = 1
triggerall = var(6)
triggerall = numtarget(var(14)) > 1
triggerall = numenemy > 1
trigger1 = enemy(0), alive
trigger1 = enemy(0), gethitvar(guarded)
trigger1 = enemy(0), gethitvar(chainid) = var(14)
trigger1 = enemy(0), gethitvar(hitshaketime)
trigger1 = enemy(1), alive
trigger1 = enemy(1), gethitvar(guarded) 
trigger1 = enemy(1), gethitvar(chainid) = var(14)
trigger1 = enemy(1), gethitvar(hitshaketime)
trigger1 = root, var(3) > floor(enemy(0), lifemax*enemy(0), const(data.defence)*0.01)
trigger1 = root, var(5) > floor(enemy(1), lifemax*enemy(0), const(data.defence)*0.01)
trigger1 = var(52) := 1
trigger1 = var(53) := 0 || 1
trigger1 = var(54) := 1
trigger1 = var(55) := 0 || 1
trigger1 = var(7) := 2
id = var(14)
value = 5400
ignorehitpause = 1

[state 11000, Guard Break Root Guage Update]
type = ParentVarSet
trigger1 = var(7)
trigger1 = var(52)
var(3) = var(53)

[state 11000, Guard Break Root Guage Update]
type = ParentVarSet
trigger1 = var(7)
trigger1 = var(54)
var(5) = var(55)

[State 11000, Guard Break VarSet]
type = VarAdd
trigger1 = var(40) := 0 || 1
trigger1 = numtarget(var(14)) = 1
trigger1 = numenemy
trigger1 = target(var(14)), id = enemy(0), id
trigger1 = var(7) = 1
var(40) = 1
ignorehitpause = 1

[State 11000, Guard Break VarSet]
type = VarAdd
trigger1 = numtarget(var(14)) = 1
trigger1 = numenemy > 1
trigger1 = target(var(14)), id = enemy(1), id
trigger1 = var(7) = 1
trigger1 = var(7) := 0 || 1
var(40) = 2
ignorehitpause = 1

[State 11000, Double Guard Break VarSet]
type = VarAdd
trigger1 = var(7) = 2
trigger1 = var(7) := 0 || 1
var(40) = 3

[State Info]
type = DisplayToClipboard
trigger1 = 0
text = "OK2 %d"
params = var(40)
ignorehitpause = 1

[state 11000, Guard Break Reset]
type = VarSet
trigger1 = 1
var(6) = 0
ignorehitpause = 1

[state 11000, Guard Break Reset]
type = VarSet
trigger1 = 1
var(7) = 0
ignorehitpause = 1

[state 11000, ChangeState]
type = ChangeState
trigger1 = 1
value = prevstateno
ignorehitpause = 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)

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

[State 9999, PlaySnd]
type = PlaySnd
trigger1 = root, movehit = 1 || root, projhittime(var(14)) = 1
trigger1 = root, var(23) > 0
value = 5, (root, var(23) - 1)
channel = 1
abspan = root, var(24)

[State 9999, PlaySnd]
type = PlaySnd
trigger1 = root, var(23) = -1
value = 5, 0
channel = 1
abspan = root, var(25)

[State 9999, PlaySnd]
type = PlaySnd
trigger1 = root, var(23) = -2
value = 6, 0
channel = 1
abspan = root, var(25)

[State 9999, ParentVarSet]
type = ParentVarSet
trigger1 = root, movehit = 1
trigger1 = root, var(23)
trigger2 = root, var(23) < 0
var(23) = 0

[State 9999, ParentVarSet]
type = ParentVarSet
trigger1 = root, movetype != A
var(18) = 0

[State 9999, ParentVarSet]
type = ParentVarSet
trigger1 = root, stateno != 20
trigger1 = root, var(51) != 60
trigger1 = root, var(51) != -60
trigger2 = abs(root, var(51) = 60)
trigger2 = !root, numtarget || (root, stateno = 20 && !root, animtime)
var(51) = (20 + random%40)*ifelse(random%2, 1, -1)

[State 9999, ParentVarSet]
type = ParentVarSet
trigger1 = root, stateno = 210
trigger1 = root, numtarget
trigger1 = root, p2dist x > 0
var(51) = 60

[State 9999, ParentVarSet]
type = ParentVarSet
trigger1 = root, stateno = 210
trigger1 = root, numtarget
trigger1 = root, p2dist x < 0
var(51) = -60

[State AI, Enemy SuperAttack]
type = VarSet
triggerall = var(48)
triggerall = enemynear, time < 2
trigger1 = root, var(56) = gametime
var(48) = 0
ignorehitpause = 1

[State AI, Enemy SuperAttack]
type = ParentVarSet
trigger1 = root, var(56) != gametime
trigger1 = !root, hitpausetime
trigger1 = var(48) := 1
var(48) = 1
ignorehitpause = 1

[State AI, Enemy SuperAttack]
type = ParentVarSet
triggerall = root, var(48)
triggerall = !var(48)
trigger1 = root, p2movetype != A
trigger1 = !inguarddist
trigger1 = !root, inguarddist
var(48) = 0
ignorehitpause = 1

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

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

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

[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, Var Helper]
type = Helper
trigger1 = !numhelper(9999)
id = 9999
stateno = 9999
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999
ownpal = 0
postype = left
pos = 0, 128

[State -2, Single Target Guarded]
type = VarAdd
triggerall = moveguarded = 1 || projguardedtime(var(14)) = 0
triggerall = numtarget(var(14)) = 1
triggerall = numenemy
triggerall = target(var(14)), gethitvar(guarded)
triggerall = var(6)
trigger1 = target(var(14)), id = var(2)
trigger1 = var(3) != -1
trigger2 = target(var(14)), id = var(4)
trigger2 = var(5) != -1
v = ifelse(target(var(14)), id = var(2), 3, 5)
value = var(6)
ignorehitpause = 1

[State -2, Multiple Targets Guarded]
type = null
triggerall = moveguarded = 1 || projguardedtime(var(14)) = 0
triggerall = numtarget(var(14)) > 1
triggerall = numenemy
triggerall = var(6)
;triggerall = target(var(14)), id = var(2) || target(var(14)), id = var(4)
trigger1 = var(3) != -1
trigger1 = enemy(0), gethitvar(guarded)
trigger1 = enemy(0), gethitvar(chainid) = var(14)
trigger1 = enemy(0), gethitvar(hitshaketime)
trigger1 = var(3) := var(3) + var(6)
trigger1 = 0
trigger2 = var(5) != -1
trigger2 = numenemy > 1
trigger2 = enemy(1), gethitvar(guarded)
trigger2 = enemy(1), gethitvar(chainid) = var(14)
trigger2 = enemy(1), gethitvar(hitshaketime)
trigger2 = var(5) := var(5) +  var(6)
trigger2 = 0
ignorehitpause = 1

[State -2, Single Target Guard Break]
type = TargetState
triggerall = moveguarded = 1 || projguardedtime(var(14)) = 0
triggerall = var(6)
triggerall = numtarget(var(14)) = 1
triggerall = target(var(14)), alive
triggerall = target(var(14)), gethitvar(guarded)
trigger1 = target(var(14)), id = var(2)
trigger1 = var(3) >= floor(target(var(14)), lifemax*target(var(14)), const(data.defence)*0.01)
trigger1 = var(3) := 0 || 1
trigger1 = var(7) := 1
trigger2 = target(var(14)), id = var(4)
trigger2 = var(5) >= floor(target(var(14)), lifemax*target(var(14)), const(data.defence)*0.01)
trigger2 = var(5) := 0 || 1
trigger2 = var(7) := 1
id = var(14)
value = 5400
ignorehitpause = 1

[State -2, 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 = moveguarded = 1 || projguardedtime(var(14)) = 0
triggerall = var(6)
triggerall = numtarget(var(14)) > 1
triggerall = numenemy > 1
trigger1 = enemy(0), alive
trigger1 = enemy(0), gethitvar(guarded)
trigger1 = enemy(0), gethitvar(chainid) = var(14)
trigger1 = enemy(0), gethitvar(hitshaketime)
trigger1 = enemy(1), alive
trigger1 = enemy(1), gethitvar(guarded) 
trigger1 = enemy(1), gethitvar(chainid) = var(14)
trigger1 = enemy(1), gethitvar(hitshaketime)
trigger1 = var(3) >= floor(enemy(0), lifemax*enemy(0), const(data.defence)*0.01)
trigger1 = var(5) >= floor(enemy(1), lifemax*enemy(0), const(data.defence)*0.01)
trigger1 = var(3) := 0 || 1
trigger1 = var(5) := 0 || 1
trigger1 = var(7) := 2
id = var(14)
value = 5400
ignorehitpause = 1

[State -2, 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 = moveguarded = 1 || projguardedtime(var(14)) = 0
triggerall = var(6)
triggerall = numtarget(var(14)) > 1
triggerall = numenemy > 1
trigger1 = enemy(0), alive
trigger1 = enemy(0), gethitvar(guarded)
trigger1 = enemy(0), gethitvar(chainid) = var(14)
trigger1 = enemy(0), gethitvar(hitshaketime)
trigger1 = enemy(1), alive
trigger1 = enemy(1), gethitvar(guarded) 
trigger1 = enemy(1), gethitvar(chainid) = var(14)
trigger1 = enemy(1), gethitvar(hitshaketime)
trigger1 = var(3) >= floor(enemy(0), lifemax*enemy(0), const(data.defence)*0.01)
trigger1 = var(5) >= floor(enemy(1), lifemax*enemy(0), const(data.defence)*0.01)
trigger1 = var(3) := 0 || 1
trigger1 = var(5) := 0 || 1
trigger1 = var(7) := 2
id = var(14)
value = 5400
ignorehitpause = 1

[State -2, Single Mode Guard Break Spark/Sound]
type = VarSet
trigger1 = var(7)
trigger1 = var(22)
trigger1 = numenemy = 1
var(7) = 0
ignorehitpause = 1

[State -2, Guard Break Spark]
type = Explod
trigger1 = numtarget(var(14)) = 1
trigger1 = var(7) = 1
id = 17008
anim = 17008
sprpriority = 5
bindtime = 1
pos = floor((target(var(14)), pos x - pos x)*facing - target(var(14)), const(size.ground.front) + 10), floor((target(var(14)), pos y - pos y) + target(var(14)), const(size.head.pos.y)*0.3 + target(var(14)), const(size.mid.pos.y)*0.7)
ignorehitpause = 1
supermovetime = 99999
pausemovetime = 99999
ownpal = 1

[State -2, Double Guard Break Spark]
type = Explod
trigger1 = numenemy
trigger1 = var(7) = 2
id = 17008
anim = 17008
sprpriority = 5
bindtime = 1
pos = floor((enemy(0), pos x - pos x)*facing - enemy(0), const(size.ground.front) + 10), floor((enemy(0), pos y - pos y) + enemy(0), const(size.head.pos.y)*0.3 + enemy(0), const(size.mid.pos.y)*0.7)
ignorehitpause = 1
supermovetime = 99999
pausemovetime = 99999
ownpal = 1

[State -2, Double Guard Break Spark]
type = Explod
trigger1 = numenemy > 1
trigger1 = var(7) = 2
id = 17008
anim = 17008
sprpriority = 5
bindtime = 1
pos = floor((enemy(1), pos x - pos x)*facing - enemy(1), const(size.ground.front) + 10), floor((enemy(1), pos y - pos y) + enemy(1), const(size.head.pos.y)*0.3 + enemy(1), const(size.mid.pos.y)*0.7)
ignorehitpause = 1
supermovetime = 99999
pausemovetime = 99999
ownpal = 1

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

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

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

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

[State -2, Enemy 1 Guard Guage]
type = VarAdd
trigger1 = var(3) > 0
trigger1 = numenemy
trigger1 = enemy(0), statetype != A
trigger1 = enemy(0), movetype != H || enemy(0), statetype = L
var(3) = ifelse(var(3) > ceil(fvar(12)*15), -ceil(fvar(12)*15), -var(3))
ignorehitpause = 1

[State -2, Enemy 2 Guard Guage]
type = VarAdd
trigger1 = var(5) > 0
trigger1 = numenemy > 1
trigger1 = enemy(1), statetype != A
trigger1 = enemy(1), movetype != H || enemy(1), statetype = L
var(5) = ifelse(var(5) > ceil(fvar(12)*15), -ceil(fvar(12)*15), -var(5))
ignorehitpause = 1

[State -2, Single Mode Guard Break Spark/Sound]
type = VarSet
trigger1 = var(8)
var(8) = 0
ignorehitpause = 1

[State -2, Single Mode Guard Break Spark/Sound]
type = null
triggerall = numenemy = 1
trigger1 = enemy, id = var(2)
trigger1 = var(8) := floor(enemy, lifemax*enemy, const(data.defence)*0.01) - var(3)
trigger2 = enemy, id = var(4)
trigger2 = var(8) := floor(enemy, lifemax*enemy, const(data.defence)*0.01) - var(5)
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)*100
trigger1 = !gethitvar(guarded)
channel = 1
value = 5000, random%2
ignorehitpause = 1

[State -2, Movehit Var Reset]
type = VarSet
trigger1 = 1
var(26) = ifelse(movehit = 1 && (hitpausetime > var(28) || movetype != A), -1, 0)
ignorehitpause = 1

[State -2, Movehit Var Reset for Projcontact]
type = VarSet
trigger1 = projcontacttime(var(14)) = 0
var(26) = -1
ignorehitpause = 1

[State -2, Hitpause Var Reset]
type = VarSet
trigger1 = 1
var(28) = hitpausetime
ignorehitpause = 1

[State -2, FX Flag Reset]
type = VarSet
trigger1 = var(27) < 0
var(27) = 0
ignorehitpause = 1

[State -2, Fire FX]
type = Explod
trigger1 = var(27) = 1
trigger1 = var(26) = -1
trigger1 = numtarget(var(14))
trigger1 = var(26) := 2
id = 7050
anim = 7050 + random%3
sprpriority = 2
postype = p2
bindtime = 45 
pos = 0, floor(target(var(14)), const(size.mid.pos.y))
random = floor((target(var(14)), const(size.ground.front)+target(var(14)), const(size.ground.back))*(hitcount != 0)*0.4), floor((target(var(14)), const(size.mid.pos.y)-target(var(14)), const(size.head.pos.y))*(hitcount != 0)*0.8)
ignorehitpause = 1
ownpal = 1

[State -2, FX Sound]
type = PlaySnd
trigger1 = var(26) = 2
trigger1 = numtarget(var(14))
value = 5, 7 + var(27)
abspan = floor(target(var(14)), pos x)
ignorehitpause = 1
channel = 4

[State -2, FX Flag Invert]
type = VarSet
trigger1 = var(27) > 0
var(27) = -var(27)
ignorehitpause = 1

[State -2, Jump Buffer]
type = VarAdd
triggerall = var(15) > 0
trigger1 = var(15) > 1
trigger2 = command != "holddown"
var(15) = -1
ignorehitpause = 1

[State -2, Jump Buffer]
type = VarSet
triggerall = var(15) = 0
trigger1 = command = "holddown"
var(15) = 20
ignorehitpause = 1

[State -2, Hit Tracking]
type = VarSet
trigger1 = movecontact = 1
trigger2 = movereversed = 1
var(18) = animelemno(-1)
ignorehitpause = 1

[State -2, Juggle Flag]
type = VarSet
triggerall = var(43) := 0 || 1
triggerall = numtarget
trigger1 = numenemy = 1
trigger1 = target, statetype = A
trigger1 = target, movetype = H
trigger2 = numenemy > 1
trigger2 = enemynear(0), statetype = A
trigger2 = enemynear(0), movetype = H
trigger2 = enemynear(1), statetype = A
trigger2 = enemynear(1), movetype = H
var(43) = 1
ignorehitpause = 1

[State -2, Juggle Level]
type = Null
triggerall = var(43)
trigger1 = movecontact = 1
trigger1 = stateno = 1100
trigger1 = var(44) < 2
trigger1 = var(44) := 2
trigger2 = var(44) < 1
trigger2 = var(44) := 1
ignorehitpause = 1

[State -2, Juggle Flag]
type = VarSet
trigger1 = !var(43)
var(44) = 0

[State -2, Hitsound Target]
type = Null
trigger1 = numtarget = 1
trigger1 = var(24) := floor(target, pos x + 0.5)
trigger2 = numtarget > 1
trigger2 = var(24) := floor(target(0), pos x + target(1), pos x + 0.5)
ignorehitpause = 1

[State -2, Combo Counter]
type = VarSet
trigger1 = !numtarget
var(38) = 0
ignorehitpause = 1

[State -2, Combo Counter]
type = VarSet
trigger1 = !var(40)
var(39) = 0
ignorehitpause = 1

[State -2, Combo Counter]
type = VarAdd
trigger1 = uniqhitcount > var(37)
var(38) = uniqhitcount - var(37)
ignorehitpause = 1

[State -2, Combo Counter]
type = VarSet
trigger1 = 1
var(37) = uniqhitcount
ignorehitpause = 1

[State -2, Damage Dampening Var]
type = VarSet
trigger1 = var(38) || var(39)
trigger1 = !var(33)
fvar(13) = fvar(14)*(fvar(14)**(var(38)+var(39)/3))
ignorehitpause = 1

[State -2, Damage Dampening Var]
type = VarSet
trigger1 = !var(38)
trigger1 = !var(39)
fvar(13) = 1
ignorehitpause = 1

[State -2, Damage Dampening & Bonus]
type = AttackMulSet
trigger1 = fvar(13) = 1
trigger2 = !var(33)
value = fvar(13)
ignorehitpause = 1

[State -2, Damage Dampening Var]
type = VarSet
trigger1 = 1
var(33) = 0
ignorehitpause = 1

[State -2, Altitude Reset]
type = VarSet
trigger1 = movetype = H
trigger1 = hitfall
trigger2 = pos y >= 0
trigger3 = statetype = L
var(11) = 0

[State -2, Altitude PlayerPush]
type = PlayerPush
trigger1 = var(11)
trigger1 = var(10) = 1
trigger1 = enemynear, pos y >= 0
value = 0

[State -2, Altitude StateType]
type = PlayerPush
trigger1 = var(11)
trigger1 = statetype = S
trigger1 = enemynear, pos y >= 0
value = 0

[State -2, Helper Target]
type = VarSet
trigger1 = 1
var(40) = 0

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

[State -2, Hitstun Balance]
type = VarAdd
triggerall = var(53) < 600
trigger1 = movetype = H
trigger1 = gametime%3
trigger2 = stateno = [120, 155]
trigger2 = gametime%6
var(53) = 2
ignorehitpause = 1

[State -2, Hitstun Balance]
type = VarAdd
trigger1 = var(53) > 0
trigger1 = stateno != [120, 155]
trigger1 = movetype != H
trigger1 = statetype != L
trigger1 = gametime%2
var(53) = ceil(-1 - var(53)/100.0)
ignorehitpause = 1

[State -2, Pause Detector]
type = VarSet
trigger1 = 1
var(56) = gametime

[State -2, Dodge Holdz]
type = VarSet
trigger1 = command != "holdz"
var(29) = 0

[State -2, Dodge Holdc]
type = VarSet
trigger1 = command != "holdc"
var(30) = 0

[State Debug Info]
type = DisplayToClipboard
trigger1 = 1
text = "prev %d, v51 %d, v10 %d, x %f, y %f"
params = prevstateno, var(51), var(10), p2bodydist x/const(size.xscale), p2bodydist y/const(size.yscale)
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")
trigger20 = (command = "QCFXY") ^^ (command = "QCFXY2")
trigger21 = (command = "QCFX") ^^ (command = "QCFX2")
trigger22 = (command = "QCFY") ^^ (command = "QCFY2")
trigger23 = (command = "QCFA") ^^ (command = "QCFA2")
trigger24 = (command = "QCFB") ^^ (command = "QCFB2")
trigger25 = (command = "QCBX") ^^ (command = "QCBX2")
trigger26 = (command = "QCBY") ^^ (command = "QCBY2")
trigger27 = (command = "QCBA") ^^ (command = "QCBA2")
trigger28 = (command = "QCBB") ^^ (command = "QCBB2")
trigger29 = (command = "DPX") ^^ (command = "DPX2")
trigger30 = (command = "DPY") ^^ (command = "DPY2")
;trigger31 = command = "start"
;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.

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

;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 = 40, 0
