; Constants and state file.
; There are comments scattered through this file, so you may like to
; take a look if would like to learn more about the cns.

[Data]
life = 1000			;Amount of life to start with
power = 6969000		;Amount of maximum power
attack = 100		;attack power (more is stronger)
defence = 100		;defensive power (more is stronger)
fall.defence_up = 50	;Percentage to increase defense everytime player is knocked down
liedown.time = 60		;Time which player lies down for, before getting up
airjuggle = 15		;Number of points for juggling
sparkno = 2			;Default hit spark number for HitDefs
guard.sparkno = 40	;Default guard spark number
KO.echo = 0			;1 to enable echo on KO
volume = 0			;Volume offset (negative for softer)
IntPersistIndex = 60	;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]
xscale = 2.5			;Horizontal scaling factor.
yscale = 2.5			;Vertical scaling factor.
ground.back = 11		;Player width (back, ground)
ground.front = 8		;Player width (front, ground)
air.back = 12		;Player width (back, air)
air.front = 12		;Player width (front, air)
height = 60			;Height of player (for opponent to jump over)
attack.dist = 160		;Default attack distance
proj.attack.dist = 90	;Default attack distance for projectiles
proj.doscale = 0		;Set to 1 to scale projectiles too   
head.pos = -5, -90	;Approximate position of head
mid.pos = -5, -60		;Approximate position of midsection
shadowoffset = 0		;Number of pixels to vertically offset the shadow
draw.offset = 0,0		;Player drawing offset in pixels (x, y)

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

[Movement]
airjump.num = 0		;Number of air jumps allowed (opt)
airjump.height = 35	;Minimum distance from ground before you can air jump (opt)
yaccel = .44		;Vertical acceleration
stand.friction = .85	;Friction coefficient when standing
crouch.friction = .82	;Friction coefficient when crouching
;---------------------------------------------------------------------------
; AI Walk
[Statedef 21]
type = S
physics = S
sprpriority = 0

[State 0, VarSet]
type = VarSet
trigger1 = !time
trigger2 = random<11||enemynear,movetype=A
var(58) = ifelse(enemynear,movetype=A,2,1)
ignorehitpause = 1

[State 20, 1]
type = VelSet
trigger1 = var(58)=1
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
trigger1 = var(58)=2
x = const(velocity.walk.back.x)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

[State Don't indefinitely walk.]
type = ChangeState
trigger1 = roundstate>2
value = 0
ctrl = 1

; Run
[Statedef 100]
type = S
physics = S
anim = 100
sprpriority = 1

[State 100, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 100, 2]
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3]
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[state 100, AI]
type = ctrlset
trigger1 = !!var(59)
value = 0

[State AI]
type = ChangeState
triggerAll = !!var(59)
trigger1 = p2bodydist x<=50
trigger2 = enemynear,movetype=A
value = 0
ctrl = 1

[State 100, 4]
type = ChangeState
triggerall = command!="holdfwd"
Trigger1 = !var(59)
value = 0

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

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S170,0

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

;---------------------------------------------------------------------------
; Win state decider
; CNS difficulty: basic
[Statedef 180]
type = S

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

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

[State 181, 1]
type = assertspecial
trigger1 = time < 350
flag = roundnotover

[State 0, ScreenBound]
type = ScreenBound
trigger1 = 6
value = 0
channel = 0

[State 0, VelSet]
type = VelSet
trigger1 = animelem = 6
x = -4.2

[State 170, 1]
type = PlaySnd
trigger1 = time = 0
value = S11,2
channel = 0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 2
value = S195,1

[State 0, PlaySnd 2]
type = PlaySnd
trigger1 = time = 3
value = S195,2

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

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

[State 190, PlaySnd]
type = PlaySnd
trigger1 = time = 1
value = S191,0+random%9

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

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

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

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

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

[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
juggle  = 1				;Number of air juggle points move takes
;Commonly-used controllers:
velset = 0,0			;Set velocity (x,y) (Def: no change)
ctrl = 0				;Set ctrl (Def: no change)
anim = 200				;Change animation (Def: no change)
poweradd = 20			;Power to add (Def: 0)
sprpriority = 2			;Set layering priority to 2 (in front)

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S0,0

[State 200, 1]
type = HitDef
trigger1 = time = 0
attr = S, NA                     ;Attribute: Standing, Normal Attack
damage = 20,10                   ;Damage that move inflicts, guard damage
animtype = Light                 ;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA                   ;Flags on how move is to be guarded against
hitflag = MAF                    ;Flags of conditions that move can hit
priority = 3, Hit                ;Attack priority: 0 (least) to 7 (most), 4 default
;Hit/Miss/Dodge type (Def: Hit)
pausetime = 3, 3                 ;Time attacker pauses, time opponent shakes
sparkno = 0                      ;Spark anim no (Def: set above)
sparkxy = -10, -76               ;X-offset for the "hit spark" rel. to p2,
;Y-offset for the spark rel. to p1
hitsound   = s1,0
guardsound = s2,0                ;Sound to play on guard
ground.type = High               ;Type: High, Low, Trip (def: Normal)
ground.slidetime = 5             ;Time that the opponent slides back
ground.hittime  = 10             ;Time opponent is in hit state
ground.velocity = -2             ;Velocity at which opponent is pushed
airguard.velocity = -1.9,-.8     ;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.type = High                  ;Type: High, Low, Trip (def: same as ground.type)
air.velocity = -1.4,-3           ;X-velocity at which opponent is pushed,
;Y-velocity at which opponent is pushed
air.hittime = 12                 ;Time before opponent regains control in air

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

;---------------------------------------------------------------------------
; Standing Medium Punch
; CNS difficulty: easy
[Statedef 210]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 65
ctrl = 0
velset = 0,0
anim = 210

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

[State 210, 2]
type = HitDef
trigger1 = time = 0
attr = S, NA
animtype  = Medium
damage    = 40,30
guardflag = MA
pausetime = 3,3
sparkno = 2
sparkxy = -10,-70
hitsound   = s1,4
guardsound = s2,0
ground.type = High
ground.slidetime = 12
ground.hittime  = 13
ground.velocity = -2.5
air.velocity = -2.5,-4

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

;---------------------------------------------------------------------------
; Standing Strong Punch
; CNS difficulty: easy
[Statedef 220]
type    = S
movetype= A
physics = S
juggle  = 1
poweradd= 65
ctrl = 0
velset = 0,0
anim = 220

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S0,2

[State 210, Voice]
type = PlaySnd
trigger1 = animelem=1
value = S201, 0
channel = 0

[State 210, 2]
type = HitDef
trigger1 = time = 0
attr = S, NA
animtype  = Medium
damage    = 100,100
guardflag = MA
pausetime = 3,3
sparkno = 1
sparkxy = -10,-70
hitsound   = s1,2
guardsound = s2,0
ground.type = High
ground.slidetime = 12
ground.hittime  = 13
ground.velocity = -3
air.velocity = -2.5,-4

[State 1200, Projectile]
type = Projectile
trigger1 = 1
projanim = 220
projhitanim = 220
projpriority = 3
projheightbound = -100000, 100000
projscale = 2.5,2.5
projedgebound = 100
projscreenbound = 100
projshadow = -1
offset = 0,0
velocity = 2,-(random/200.0)
attr = S, SP
damage   = 6,1
animtype = heavy
hitflag = MAF
pausetime = 10,10
hitsound   = S201,random%2
sparkxy = 0,0
guardsound = s2,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.velocity = -6
air.animtype = Back
air.velocity = -4,-6
air.juggle = 3
air.fall = 1
down.velocity = -4,-6
down.hittime = 30
down.bounce = 0

[State 220, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; Crouching Light Punch
; CNS difficulty: easy
; Description: Simple crouching attack. The HitDef's guardflag parameter
;     is set to "L", meaning that the move can only be guarded low
;     (crouching), and not by standing or jumping opponents.
;     Like for all light attacks, it's a good idea to keep the slidetime
;     and hittime parameters at a smaller number, so the opponent isn't
;     stunned for too long. For all crouching attacks you have to
;     remember to set the attr parameter to indicate that it is crouching
;     attack. In this case, "C, NA" stands for "crouching, normal attack".
;     The HitDef's priority is set at 3, instead of the default of 4,
;     so this attack has a lower priority than most others, meaning the
;     player will get hit instead of trading hits with the opponent if
;     their attack collision boxes (Clsn1) intersect each other's Clsn2
;     boxes at the same time.
[Statedef 400]
type    = C
movetype= A
physics = C
juggle  = 5
poweradd= 15
ctrl = 0
anim = 400

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S0,0

[State 200, 1]
type = HitDef
trigger1 = time = 0
attr = S, NA                     ;Attribute: Standing, Normal Attack
damage = 20,10                   ;Damage that move inflicts, guard damage
animtype = Light                 ;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA                   ;Flags on how move is to be guarded against
hitflag = MAF                    ;Flags of conditions that move can hit
priority = 3, Hit                ;Attack priority: 0 (least) to 7 (most), 4 default
;Hit/Miss/Dodge type (Def: Hit)
pausetime = 3, 3                 ;Time attacker pauses, time opponent shakes
sparkno = 0                      ;Spark anim no (Def: set above)
sparkxy = -10, -76               ;X-offset for the "hit spark" rel. to p2,
;Y-offset for the spark rel. to p1
hitsound   = s1,0
guardsound = s2,0                ;Sound to play on guard
ground.type = low               ;Type: High, Low, Trip (def: Normal)
ground.slidetime = 5             ;Time that the opponent slides back
ground.hittime  = 10             ;Time opponent is in hit state
ground.velocity = -2             ;Velocity at which opponent is pushed
airguard.velocity = -1.9,-.8     ;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.type = low                  ;Type: High, Low, Trip (def: same as ground.type)
air.velocity = -1.4,-3           ;X-velocity at which opponent is pushed,
;Y-velocity at which opponent is pushed
air.hittime = 12                 ;Time before opponent regains control in air


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

;---------------------------------------------------------------------------
; Crouching Medium Punch
[Statedef 410]
type    = C
movetype= A
physics = C
juggle  = 1
poweradd= 50
ctrl = 0
anim = 410


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

[State 210, 2]
type = HitDef
trigger1 = time = 0
attr = S, NA
animtype  = Medium
damage    = 40,30
guardflag = MA
pausetime = 3,3
sparkno = 2
sparkxy = -10,-70
hitsound   = s1,4
guardsound = s2,0
ground.type = low
ground.slidetime = 12
ground.hittime  = 13
ground.velocity = -2.5
air.velocity = -2.5,-4

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

;---------------------------------------------------------------------------
; Crouching Strong Punch
[Statedef 420]
type    = C
movetype= A
physics = C
juggle  = 1
poweradd= 50
ctrl = 0
anim = 420

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S0,4

[State 210, Voice]
type = PlaySnd
trigger1 = time = 3
value = S200, 0+Random%2
channel = 0

[State 1200, Projectile]
type = Projectile
trigger1 = 1
projanim = 420
projhitanim = 420
projpriority = 3
projheightbound = -100000, 100000
projscale = 2.5,2.5
projedgebound = 100
projscreenbound = 100
projshadow = -1
offset = 0,0
velocity = 2,-(random/200.0)
attr = S, SP
damage   = 6,1
animtype = heavy
hitflag = MAF
pausetime = 10,10
hitsound   = S201,random%2
sparkxy = 0,0
guardsound = s2,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.velocity = -6
air.animtype = Back
air.velocity = -4,-6
air.juggle = 3
air.fall = 1
down.velocity = -4,-6
down.hittime = 30
down.bounce = 0

[State 210, 2]
type = HitDef
trigger1 = time = 0
attr = S, NA
animtype  = Medium
damage    = 60,50
guardflag = MA
pausetime = 3,3
sparkno = 1
sparkxy = -10,-70
hitsound   = s1,2
guardsound = s2,0
ground.type = Low
ground.slidetime = 5
ground.hittime  = 60
ground.velocity = -1,-7
airguard.velocity = -1.9,-.8
air.type = Low
air.velocity = -1,-6
air.hittime = 90

[State 420, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 11
ctrl = 1
;---------------------------------------------------------------------------
; Jump Light Punch
; CNS difficulty: easy
[Statedef 600]
type    = A
movetype= A
physics = A
juggle  = 1
poweradd= 11
ctrl = 0
anim = 600

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S0,0

[State 600, 2]
type = HitDef
trigger1 = Time = 0
attr = A, NA
damage    = 20,10
guardflag = HA
priority = 3
pausetime = 3,3
sparkno = 0
sparkxy = -10,-58
hitsound   = s1,0
guardsound = s2,0
ground.type = High
ground.slidetime = 5
ground.hittime  = 5
ground.velocity = -2
air.velocity = -1.3,-3

[State 600, 5]
type = CtrlSet
trigger1 = Time = 20
value = 1

;---------------------------------------------------------------------------
; Jump Medium Punch
; CNS difficulty: easy
[Statedef 610]
type    = A
movetype= A
physics = A
juggle  = 1
poweradd= 65
ctrl = 0
anim = 610

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S0,2

[State 610, 3]
type = HitDef
trigger1 = Time = 0
attr = A, NA
damage = 40,30
guardflag = HA
priority = 4
pausetime = 3,3
sparkno = 2
sparkxy = -10,-55
hitsound   = s1,4
guardsound = s2,0
animtype = Med
ground.type = High
ground.slidetime = 17
ground.hittime  = 17
ground.velocity = -2.5
air.velocity = -3,-4

[State 610, 5]
type = CtrlSet
trigger1 = Time = 20
value = 1

;---------------------------------------------------------------------------
; Jump Strong Punch
; CNS difficulty: easy
[Statedef 620]
type    = A
movetype= A
physics = A
juggle  = 1
poweradd= 70
ctrl = 0
anim = 620

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

[State 210, Voice]
type = PlaySnd
trigger1 = animelem=1
value = S201, 1
channel = 0

[State 1200, Projectile]
type = Projectile
trigger1 = 1
projanim = 620
projhitanim = 620
projpriority = 3
projheightbound = -100000, 100000
projscale = 2.5,2.5
projedgebound = 100
projscreenbound = 100
projshadow = -1
offset = 0,0
velocity = 2,(random/200.0)
attr = S, SP
damage   = 6,1
animtype = heavy
hitflag = MAF
pausetime = 10,10
hitsound   = S201,random%2
sparkxy = 0,0
guardsound = s2,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.velocity = -6
air.animtype = Back
air.velocity = -4,-6
air.juggle = 3
air.fall = 1
down.velocity = -4,-6
down.hittime = 30
down.bounce = 0

[State 610, 3]
type = HitDef
trigger1 = Time = 0
attr = A, NA
damage = 60,50
guardflag = HA
priority = 4
pausetime = 3,3
sparkno = 1
sparkxy = -10,-55
hitsound   = s1,2
guardsound = s2,0
animtype = Med
ground.type = High
ground.slidetime = 18
ground.hittime  = 25
ground.velocity = -10
air.velocity = -12,10
air.hittime = 25
fall = 1
air.fall = 1

[State 620, 5]
type = CtrlSet
trigger1 = Time = 20
value = 1
;---------------------------------------------------------------------------
;Special 1
[Statedef 1000]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 55
velset = 0,0
anim = 1000
ctrl = 0
sprpriority = 2

[State 191, 4]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0, 2

[State 210, Voice]
type = PlaySnd
trigger1 = AnimElem = 2
value = S300, 0
channel = 0

[State 210,2]
type = velset
trigger1 = time >= 0
x = 0
y = 0

[State 210,2]
type = velset
trigger1 = time >= 5
x = 9

[State 210,2]
type = velset
trigger1 = time >= 10
x = 7

[State 210,2]
type = velset
trigger1 = time >= 15
x = 5

[State 210,2]
type = velset
trigger1 = time >= 20
x = 3

[State 210,2]
type = velset
trigger1 = time >= 23
x = 1

[State 210,2]
type = velset
trigger1 = time >= 25
x = 0.5

[State 210,2]
type = velset
trigger1 = time >= 27
x = 0.2

[State 210,2]
type = velset
trigger1 = time >= 30
x = 0

[State 1000, 6] ;Opponent not near
type = HitDef
trigger1 = time = 0
attr = S, SA
animtype  = Hard
damage    = 65, 44
priority  = 4
guardflag = MA
pausetime = 15,15
sparkxy = -10,-60
hitsound   = s1,4
guardsound = s2,0
ground.type = Low
ground.slidetime = 12
ground.hittime  = 17
ground.velocity = -7
air.velocity = -4,-2.5
fall = 1

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

;---------------------------------------------------------------------------
;Special 1(Stonger)
[Statedef 1010]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 105
velset = 0,0
anim = 1002
ctrl = 0
sprpriority = 2

[State 1000, 1]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 3
trigger3 = AnimElem = 4
trigger4 = AnimElem = 5
trigger5 = AnimElem = 6
trigger6 = AnimElem = 7
trigger7 = AnimElem = 8
trigger8 = AnimElem = 9
trigger9 = AnimElem = 10
trigger10 = AnimElem = 11
trigger11 = AnimElem = 12
trigger12 = AnimElem = 13
trigger13 = AnimElem = 14
trigger14 = AnimElem = 15
trigger15 = AnimElem = 16
trigger16 = AnimElem = 17
trigger17 = AnimElem = 18
trigger18 = AnimElem = 19
trigger19 = AnimElem = 20
trigger20 = AnimElem = 21
trigger21 = AnimElem = 22
value = 0, 2

[State 210, Voice]
type = PlaySnd
trigger1 = time = 2
value = S1002, 0+Random%3
channel = 0

[State 1000, 6] ;Opponent not near
type = HitDef
trigger1 = !time
trigger2 = time%6 = 0
attr = S, SA
animtype  = Hard
damage    = 23, 8
priority  = 4
guardflag = MA
pausetime = 3,15
sparkxy = -10,-60
hitsound   = s1,7
guardsound = s2,0
ground.type = Low
ground.slidetime = 5
ground.hittime  = 3
ground.velocity = -2
air.velocity = -1,-2.5

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

;-----------------------------------------------------------------
;Special 2
[Statedef 1020]
type = S
movetype = A
physics = S
velset = 0, 0
ctrl = 0
anim = 1001
poweradd = 100

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

[State 1200, Projectile]
type = Projectile
trigger1 = animelem = 2
projanim = 1011+random%4
projhitanim = 1016
projpriority = 3
projheightbound = 0, 0
projscale = 0.6,0.6
projedgebound = 100
projscreenbound = 100
projshadow = -1
offset = 30,-45
velocity = 7
attr = S, SP
damage   = 30,20
animtype = heavy
hitflag = MAF
pausetime = 10,10
hitsound   = S1,6
sparkxy = 0,0
guardsound = s2,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.velocity = -6
air.animtype = Back
air.velocity = -4,-6
air.juggle = 3
air.fall = 1
down.velocity = -4,-6
down.hittime = 30
down.bounce = 0


[State 1200,End]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1


;-----------------------------------------------------------------
;Special 2(Stonger)
[Statedef 1030]
type = S
movetype = A
physics = S
velset = 0, 0
ctrl = 0
anim = 1001

[State 4000, PowerAdd]
type = PowerAdd
trigger1 = time = 0
value = -500

[State 3000, 4]
type = VelSet
trigger1 = Animelem = 2
x = -5

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

[State 1030, Projectile]
type = Projectile
trigger1 = animelem = 2
projanim = 1011+random%4
projhitanim = 1016
projpriority = 3
projheightbound = 0, 0
projscale = 1.5,1.5
projedgebound = 100
projscreenbound = 100
projshadow = -1
offset = 30,-45
velocity = 12
attr = S, SP
damage   =60,50
animtype = heavy
hitflag = MAF
pausetime = 10,10
hitsound   = s1,8
sparkxy = 0,0
guardsound = s2,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.velocity = -6
air.animtype = Back
air.velocity = -4,-6
air.juggle = 3
fall = 1
air.fall = 1
down.velocity = -4,-6
down.hittime = 30
down.bounce = 0

[State 1030,End]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Hyper 1
[Statedef 3000]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
anim = 1030
ctrl = 0
sprpriority = 2

[State 3050, Super A]
type = SuperPause
trigger1 = AnimElem = 1
pos = -5, -55
anim = 105
sound = S3999, 0
poweradd = -1400

[State 3000, HyperBg]
type = Explod
trigger1 = time = 20
id = 750
anim = 750
pos = 0,0
postype = back
sprpriority = -3
removeongethit = 1
removetime = 100
scale = 0.5,0.5
bindtime = -1
supermove = 1
ownpal = 1
removeongethit = 1

[State 3050, Hyper Portrait]
type = Explod
trigger1 = time = 0
anim = 3999
postype = back
sprpriority = -3
supermovetime = -1
removetime = 30
pos = 0,0
bindtime = -1
removeongethit = 1

[State 3050, Explod]
type = Explod
trigger1 = time = 0
anim = 4050
ID = 4050
pos = 0,0
postype = left
facing = 1
bindtime = -1
removetime = 40
sprpriority = -7
ownpal = 1
supermovetime = 40
removeongethit = 1

[State 1010, 1]
type = PlaySnd
trigger1 = time = 8
trigger2 = time = 16
trigger3 = time = 24
trigger4 = time = 32
trigger5 = time = 40
trigger6 = time = 48
trigger7 = time = 56
trigger8 = time = 64
trigger9 = time = 72
trigger10 = time = 80
trigger11 = time = 88
value = 1000, 0

[State 1200, Projectile]
type = Projectile
trigger1 = time = 8
trigger2 = time = 16
trigger3 = time = 24
trigger4 = time = 32
trigger5 = time = 40
trigger6 = time = 48
trigger7 = time = 56
trigger8 = time = 64
trigger9 = time = 72
trigger10 = time = 80
trigger11 = time = 88
projanim = 1011+random%4
projhitanim = 1016
projpriority = 3
projheightbound = 0, 0
projscale = 0.6,0.6
projedgebound = 100
projscreenbound = 100
projshadow = -1
offset = 30,-45
velocity = 7
attr = S, SP
damage   = 30,20
animtype = heavy
hitflag = MAF
pausetime = 10,10
hitsound   = S1,6
sparkxy = 0,0
guardsound = s2,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.velocity = -6
air.animtype = Back
air.velocity = -4,-6
air.juggle = 3
air.fall = 1
down.velocity = -4,-6
down.hittime = 30
down.bounce = 0


[State 3000, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;-----------------------------------------------------------------
;Hyper 2
[Statedef 3010]
type = S
movetype = A
physics = S
velset = 0, 0
ctrl = 0
anim = 1040

[State 3050, Super A]
type = SuperPause
trigger1 = AnimElem = 1
pos = -5, -55
anim = 105
sound = S3999, 0
poweradd = -3000

[State 3000, HyperBg]
type = Explod
trigger1 = AnimElem = 2
id = 750
anim = 750
pos = 0,0
postype = back
sprpriority = -3
removeongethit = 1
removetime = 50
scale = 0.5,0.5
bindtime = -1
supermove = 1
ownpal = 1
removeongethit = 1

[State 1010, 1]
type = PlaySnd
trigger1 = AnimElem = 1
value = 3000, 0

[State 320, Helper]
type = Helper
trigger1 = AnimElem = 2
ID = 3011
pos = 0,-400
postype = p2
stateno = 3011
size.xscale = 1.4
size.yscale = 1.4
helpertype = normal
name = "Giant Block"
keyctrl = 0
ownpal = 1
supermovetime = 1

[State 3010,End]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;proj
[Statedef 3011]
type    = A
movetype= A
physics = N
juggle  = 1
poweradd= 50
ctrl = 0
anim = 1021
sprpriority = 2

[State 1313, 2]
type = VelSet
trigger1 = time = 0
x = 0
y = 28

[State 600, 2]
type = HitDef
trigger1 = 1
attr = S, SP
damage   = 1,1
animtype = heavy
hitflag = MAF
pausetime = 0,0
hitsound   = s1,10
sparkxy = 0,0
guardsound = s2,0
ground.type = High
ground.slidetime = 12
ground.hittime  = 13
ground.velocity = -5.5
air.velocity = -2.5,-4
envshake.time = 60
envshake.ampl = -47
envshake.freq = 105
envshake.phase = 0
p2stateno = ifelse(enemynear,pos Y < 0,9024,1242)

[State 0, DestroySelf]
type = DestroySelf
trigger1 = time = 120

;---------------------------------------------------------------------------
;disappear
[Statedef 351]
type    = A
movetype= I
physics = N
juggle  = 1
poweradd= 50
ctrl = 0
anim = 1016
sprpriority = 2

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

;------------------------------------------------------------------------------------------
; Hit by  - shaking from the hit
; (a custom gethit state)

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

[State 9020, Anim] ;Custom animation
type = null;ChangeAnim2
trigger1 = 1
value = 5012


[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim ;2
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)


[State 5000, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

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



[State 5050, 2] ; anim for trip
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(groundtype) = 3
trigger1 = SelfAnimExist(5070)
value = 5070


[State 9020, State]
type = ChangeState
trigger1 = HitShakeOver = 1
value = 9030

;------------------
; Hit by - flying through the air
; (a custom gethit state)
[Statedef 9030]
type    = A
movetype= H
physics = N

[State 9030, Velocity]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 9030, Gravity]
type = VelAdd
trigger1 = 1
y = .39

[State 9030, No scroll]
type = ScreenBound
triggerall = Pos y < -15
trigger1 = BackEdgeBodyDist < 65
trigger2 = FrontEdgeBodyDist < 65
value = 1
movecamera = 0,1

[State 9030, Hit wall]
type = ChangeState
triggerall = Pos y < -15
trigger1 = BackEdgeBodyDist <= 20
trigger2 = FrontEdgeBodyDist <= 20
value = 9027


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

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


[State 5050, 2] ;Coming down anim for trip
type = ChangeAnim
trigger1 = anim = 5070
trigger1 = Vel Y >= 0
trigger1 = SelfAnimExist(anim-10) || SelfAnimExist(5071)
value = ifelse(SelfAnimExist(5071),5071,anim-10)
persistent = 0


[State 5035, 3]
type = null;ChangeState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;HITA_RECOV

[State 5050, 4] ;Recover near ground
type = null;ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

[State 5050, 5]; Recover in mid air
type = null;ChangeState
triggerall = Vel Y > -1
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;HITFALL_AIRRECOVER

[State 9030, Hit ground]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5071]), 0, 25)
value = 5100 ;HIT_BOUNCE

;-----------------------------------------------------------------------------------------------------
; Hit by  - hit wall
; (a custom gethit state)
[Statedef 9027]
type    = A
movetype= H
physics = N
anim = 5010

[State 9027, Turn]
type = Turn
trigger1 = (Time = 0) && (FrontEdgeBodyDist <= 30)

[State 9027, Pos]
type = null;PosAdd
trigger1 = Time = 0
x = 15 - BackEdgeBodyDist

[State 9027, Stop moving]
type = null;PosFreeze
trigger1 = 1
x = 1
y = 1

[State 9027, No scroll]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 0,1

[State 9027, Spark]
type = Explod
trigger1 = Time = 0
anim = F72
pos = 0, floor (screenpos y) - 50
postype = back
sprpriority = 3

[State 9027, Sound]
type = PlaySnd
trigger1 = Time = 0
value = F7,0

[State 9027, State]
type = ChangeState
trigger1 = Time = 5
value = 9028

;------------------
; Hit by  - bounce off wall
; (a custom gethit state)
[Statedef 9028]
type    = A
movetype= H
physics = N


[State 9028, 1]
type = NotHitBy
trigger1 = 1
value = , NA, NP

[State 9028, Vel Y]
type = VelSet
trigger1 = Time = 0
y = 2

[State 9028, Vel X]
type = VelSet
trigger1 = Time = 0
x = 5

[State 9028, Turn]
type = null;Turn
trigger1 = (Time = 0) && (BackEdgeDist < 30)

[State 9028, Gravity]
type = VelAdd
trigger1 = 1
y = .39

[State 9028, Anim 5050] ;Self falling animation
type = ChangeAnim
trigger1 = Time = 0
trigger1 = !SelfAnimExist(5052)
value = 5050

[State 9028, Anim 5052] ;Self falling animation (diagup type)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5052)
value = 5052

[State 9028, Anim 5060] ;Coming down - normal
type = ChangeAnim
trigger1 = Vel Y > -2
trigger1 = Anim = 5050
trigger1 = SelfAnimExist(5060)
persistent = 0
value = 5060

[State 9028, Anim 5062] ;Coming down - diagup type
type = ChangeAnim
trigger1 = Vel Y > -2
trigger1 = Anim = 5052
trigger1 = SelfAnimExist(5062)
persistent = 0
value = 5062

[State 9028, Hit ground]
type = SelfState
trigger1 = (Vel y > 0) && (Pos y >= 0)
value = 5100

;------------------------------------------------------------------------
;Hammer smashed

[Statedef 1242]
type = S
movetype = H
physics = N
velset = 0,0

[State 1242]
type = changestate
trigger1 = time = 0
trigger1 = selfanimexist(7689) = 0
value = 1243

[State 1242]
type = ChangeAnim2
trigger1 = Time = 0
value = 7689

[State 1242]
type = ChangeAnim2
trigger1 = Time = [1,3]
value = 7689
elem = 2

[State 1242]
type = ChangeAnim2
trigger1 = Time = [6,9]
value = 7689
elem = 3

[State 1242]
type = ChangeAnim2
trigger1 = Time = [10,60]
value = 7689
elem = 4

[State 1242]
type = ChangeAnim
trigger1 = Time = 60
trigger1 = selfanimexist(7100)
value = 7100
persistent = 0

[State 1242]
type = ChangeAnim2
trigger1 = Time >= 69
value = 5110

[State 1242]
type = SelfState
trigger1 = Time = 90
value = 5110

;------------------------------------------------------------------------------------------------------------
;Because there is no anim 7689

[Statedef 1243]
type = S
movetype = H
physics = N
velset = 0,0

[State 1243]
type = AngleDraw
trigger1 = time = [0,25]
value = 0
scale = 1.2,0.45

[State 1243]
type = ChangeAnim2
trigger1 = Time = 0
value = 5110

[State 1243]
type = SelfState
trigger1 = Time = 30
value = 5110

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

; HIT_LIEDEAD
[Statedef 5150]
type    = L
movetype= H
physics = S
sprpriority = -3
anim = 5150

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

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

;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------
[Statedef -2]
;==============================================================================================================================
;    Im being a dumbass
;==============================================================================================================================
[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = random<200
value = anim
elem = ifelse(random%2,animelemno(0)-1,animelemno(0)+1)
[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = random<100
value = (random+random*1000)%(5000-(random%10-random%10*33))
[State 0, PalFX]
type = PalFX
trigger1 = random<25 
time = 2
add = random%128-random%128,random%128-random%128,random%128-random%128
mul = 256-random%128,256-random%128,256-random%128
invertall = random%2
color = random%256
ignorehitpause = 1
[State 0, CtrlSet]
type = CtrlSet
trigger1 = random<5
value = 1
ignorehitpause = 1
[State 0, VelMul]
type = VelMul
trigger1 = random<20
x = ifelse(random%2,0.125,4.0)
y = ifelse(random%2,0.125,4.0)
[State 0, PosSet]
type = PosSet
trigger1 = abs(pos x)>180
x = random%160-random%160
[State 0, PosSet]
type = PosSet
trigger1 = pos y>400||pos y<-250
y = -250+random%650
[State 0, ScreenBound]
type = ScreenBound
trigger1 = random<950
value = 0
ignorehitpause = 1
[State 0, PosAdd]
type = PosAdd
trigger1 = random<500
x = vel x*(random/500.0)
y = vel y*(random/500.0)
[State 0, PosAdd]
type = PosAdd
trigger1 = movetype=A
x = -50+random%100
[State 0, PowerSet]
type = PowerSet
trigger1 = random<250
value = floor(powermax*(random/998.0))
ignorehitpause = 1
;==============================================================================================================================
[State General Debugging]
type = DisplayToClipboard
trigger1 = 1
text = "AI:%d,EnemyDistance:(X:%.3f,Y:%.3f)"
params = !!var(59),p2bodydist x,p2bodydist y
ignorehitpause = 1
;---------------------------------------------------------------------------
; States that are executed when in self's state file (use statedef -3)
;---------------------------------------------------------------------------

[Statedef -3]

[State -3, Attack Voice]
type = PlaySnd
triggerall = Time = 1
trigger1 = Stateno = [200,299] ; Standing Attacks
trigger2 = Stateno = [400,499] ; Crouching Attacks
trigger3 = Stateno = [600,699] ; Aerial Attacks
value = S200, 0+Random%2

[State -3, 2]
type = PlaySnd
triggerall = Time = 1
triggerall = Life
triggerall = random % 10 > 5
trigger1 = stateno = 5000 || stateno = 5020
trigger1 = anim != 5000 && anim != 5010
trigger2 = stateno = 5010
trigger2 = anim != 5020
value = 5000,0+Random%3
channel = 0
ignorehitpause = 1
volume = 255

[State -3, Walking Sound]
type = PlaySnd
triggerall = stateno = 20 || stateno = 21 ;Walk Forwards/Backwards
trigger1 = animelem = 4
value = S20, 0

[State -3, Running Sound]
type = PlaySnd
triggerall = stateno = 100 ;Run Forwards
trigger1 = animelem = 4
value = S20, 0

[State -3, Jumping Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 40 ;Jump Start
trigger2 = stateno = 45 ;Air Jump Start
value = S41, 0

;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
