; KFM's 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.

; これはKFMの定数と状態のファイルです。
; このファイルの中には注釈が散らされているので、CNSを習いたいお方は
; 読んでみたらいいです。

[Data]
  ;Amount of life to start with
  ;体力ゲージの初期値
life = 1000
  ;attack power (more is stronger)
  ;攻撃ダメージ
attack = 100
  ;defensive power (more is stronger)
  ;体力パワー
defence = 100
  ;Percentage to increase defense everytime player is knocked down
fall.defence_up = 50
  ;Time which player lies down for, before getting up
liedown.time = 60
  ;Number of points for juggling
airjuggle = 15
  ;Default hit spark number for HitDefs
sparkno = 2
  ;Default guard spark number
guard.sparkno = 40
  ;1 to enable echo on KO
KO.echo = 0
  ;Volume offset (negative for softer)
volume = 0
  ;Variables with this index and above will not have their values
  ;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.
IntPersistIndex = 60
FloatPersistIndex = 40

[Size]
xscale = .5           ;Horizontal scaling factor.
yscale = .5           ;Vertical scaling factor.
ground.back = 15     ;Player width (back, ground)
ground.front = 16    ;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.4      ;Walk forward
walk.back = -2.2     ;Walk backward
run.fwd  = 4.6, 0    ;Run forward (x, y)
run.back = -4.5,-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 = 1      ;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

;---------------------------------------------------------------------------
; 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
; CNS レベル: 基本
[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
; CNS レベル: 基本
[Statedef 180]
type = S

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

;---------------------------------------------------------------------------
; Win pose 1 - Bow
; CNS difficulty: basic
; CNS レベル: 基本
[Statedef 181]
type = S
ctrl = 0
anim = 181
velset = 0,0

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

;---------------------------------------------------------------------------
; Introduction
; CNS difficulty: basic
; CNS レベル: 基本
[Statedef 191]
type = S
ctrl = 0
anim = 190
velset = 0,0

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

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



;---------------------------------------------------------------------------
; Stand 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 200, 1]
type = HitDef
trigger1 = AnimElem = 3
attr = S, NA                     ;Attribute: Standing, Normal Attack
damage = 23, 0                   ;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 = 8, 8                 ;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 = 5, 0                  ;Sound to play on hit
guardsound = 6, 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  = 12             ;Time opponent is in hit state
ground.velocity = -4             ;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, 1]
type = PlaySnd
trigger1 = Time = 1
value = 200, 0

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

;---------------------------------------------------------------------------
; Standing strong punch
; CNS difficulty: easy
; Note the width controller. It makes KFM's push box larger, so he doesn't
; stand so close to the opponent. Hit Ctrl-C and look at the red bar at his
; feet.
; The sprpriority for this state is at -1, instead of the usual 2 for
; attacks. This makes KFM appear behind the opponent initially.
; The SprPriority controller in [State 210, 4] brings KFM to the front when
; his arm has swung over.
; To stop KFM from pausing in his swing frame, there is a ChangeAnim in
; [State 210, 3] that detects if the hit has come in contact with the
; opponent during that frame, and switches to the next animation element
; (notice the elem=6 parameter). If you don't see what I mean, try commenting
; out that controller, then hit someone with this attack.
[Statedef 210]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 65
ctrl = 0
velset = 0,0
anim = 210
sprpriority = -1

[State 210, Width]
type = Width
trigger1 = (AnimElemTime (2) >= 0) && (AnimElemTime (7) < 0)
value = 15,0

[State 210, 1]
type = PlaySnd
trigger1 = Time = 2
value = 210, 0

[State 210, 2]
type = HitDef
trigger1 = AnimElem = 3
attr = S, NA
animtype  = Medium
damage    = 57
guardflag = MA
pausetime = 12,12
sparkno = 1
sparkxy = -10,-70
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 12
ground.hittime  = 15
ground.velocity = -5.5
air.velocity = -2.5,-4

[State 210, 3]
type = ChangeAnim
trigger1 = AnimElemTime(5) > 0 && AnimElemTime(6) <= 0
trigger1 = movecontact
ignorehitpause = 1
persistent = 0
value = 210
elem = 6

[State 210, 4]
type = SprPriority
trigger1 = AnimElem = 5
value = 2

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

;---------------------------------------------------------------------------
; Standing light kick
; CNS difficulty: easy
[Statedef 230]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 22
ctrl = 0
velset = 0,0
anim = 230
sprpriority = 2

[State 230, 1]
type = PlaySnd
trigger1 = Time = 2
value = 230, 0

[State 230, 2]
type = HitDef
trigger1 = Time = 0
attr = S, NA
animtype  = Medium
damage    = 26
guardflag = MA
pausetime = 12,12
sparkno = 0
sparkxy = -10,-37
hitsound   = 5,1
guardsound = 6,0
ground.type = Low
ground.slidetime = 10
ground.hittime  = 12
ground.velocity = -5
air.velocity = -2.5,-3.5

[State 230, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Standing strong kick
; CNS difficulty: easy
[Statedef 240]
type    = S
movetype= A
physics = S
juggle  = 5
poweradd= 65
ctrl = 0
velset = 0,0
anim = 240
sprpriority = 2

[State 240, 1]
type = PlaySnd
trigger1 = Time = 2
value = 240, 0

[State 240, 2]
type = HitDef
trigger1 = Time = 0
attr = S, NA
animtype  = Medium
damage    = 63
guardflag = MA
pausetime = 12,12
sparkno = 1
sparkxy = -10,-60
hitsound   = 5,2
guardsound = 6,0
ground.type = Low
ground.slidetime = 12
ground.hittime  = 15
ground.velocity = -6
air.velocity = -2.2,-3.2

[State 240, 3]
type = PosAdd
trigger1 = AnimElem = 7
x = 12

[State 240, 4]
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
;     KFM will get hit instead of trading hits with his 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
sprpriority = 2

[State 400, 1]
type = PlaySnd
trigger1 = Time = 1
value = 210, 0

[State 400, 2]
type = HitDef
trigger1 = Time = 0
attr = C, NA
damage    = 23
priority  = 3
animtype  = Light
hitflag = MAF
guardflag = L
pausetime = 10,11
sparkno = 0
sparkxy = -10,-42
hitsound   = 5,0
guardsound = 6,0
ground.type = Low
ground.slidetime = 4
ground.hittime  = 12
ground.velocity = -4
air.velocity = -1.5,-3

[State 400, 3]
type = CtrlSet
trigger1 = Time = 5
value = 1

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

;---------------------------------------------------------------------------
;Crouching strong punch
; CNS difficulty: easy
; Description: This is a 2-hit move. It is done by having two HitDefs
;     triggered, one for each frame of animation that hits.
;     Notice how the first hit cannot be guarded by an opponent in the
;     air, because of the "M" in the guardflag, meaning it can only
;     be guarded "middle". The second hit has an "MA" guardflag, so
;     it can be guarded both on the ground and in the air.
; CNS レベル: 易
; 詳細: これは殴打が二発ある攻撃です。
;       殴打できるアニメーションの枚は一々HitDefを登録しています。
;       一発目の攻撃のHitDefにはguardflagが「M」（middle＝中段ガード）
;       にセットされているので、相手は空中でガードできません。二発目
;       の攻撃のguardflagは「MA」（middle+air＝中段＋空中ガード）で、
;       地上、空中でもガードすることができます。
[Statedef 410]
type    = C
movetype= A
physics = C
juggle  = 6
poweradd= 50
ctrl = 0
anim = 410
sprpriority = 2

[State 410, 1]
type = PlaySnd
trigger1 = Time = 1
value = 210, 0

;This is the first hit, triggered on the 3rd element of animation.
[State 410, 2]
type = HitDef
trigger1 = AnimElem = 3
attr = C, NA
damage    = 37
animtype  = Medium
hitflag = MAF
guardflag = M
pausetime = 12,12
sparkno = 1
sparkxy = -10,-55
hitsound   = 5,2
guardsound = 6,0
ground.type = Low
ground.slidetime = 12
ground.hittime  = 15
ground.velocity = -4
air.velocity = -3,-4

;This is the second hit, triggered on the 4th element of animation.
[State 410, 3] 
type = HitDef
trigger1 = AnimElem = 4
attr = C, NA
damage    = 36
animtype  = Medium
hitflag = MAF
guardflag = MA
pausetime = 12,12
sparkxy = -10,-83
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 12
ground.hittime  = 15
ground.velocity = -7
air.velocity = -3,-4

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

;---------------------------------------------------------------------------
;Crouching light kick
; CNS difficulty: easy
[Statedef 430]
type    = C
movetype= A
physics = C
juggle  = 5
poweradd= 22
ctrl = 0
anim = 430
sprpriority = 2

[State 430, 1]
type = PlaySnd
trigger1 = Time = 1
value = 230, 0

[State 430, 2]
type = HitDef
trigger1 = Time = 0
attr = C, NA
damage    = 28
animtype  = Light
hitflag = MAFD
guardflag = L
pausetime = 12,12
sparkno = 0
sparkxy = -10,-8
hitsound   = 5,1
guardsound = 6,0
ground.type = Low
ground.slidetime = 6
ground.hittime  = 12
ground.velocity = -5
air.velocity = -2,-3
down.velocity = -5,0
down.hittime = 20

[State 430, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 11
ctrl = 1

;---------------------------------------------------------------------------
;Crouch Strong Kick
; CNS difficulty: easy
; Description: This move uses "Trip" for the "ground.type" parameter in
;     its HitDef. It's a special type that puts the opponent in a tripped
;     animation as he falls. Also, the hitflag parameter in the HitDef
;     is set to "MAFD". The "D" indicates that a downed opponent can be
;     hit by the attack.
; CNS レベル: 易
; 詳細: 
[Statedef 440]
type    = C
movetype= A
physics = C
juggle  = 7
poweradd= 70
ctrl = 0
anim = 440
sprpriority = 2

[State 440, 2]
type = PlaySnd
trigger1 = Time = 2
value = 240, 0

[State 440, 3]
type = HitDef
trigger1 = Time = 0
attr = C, NA
damage    = 72
hitflag = MAFD
guardflag = L
pausetime = 12,12
sparkno = 1
sparkxy = -5,-10
hitsound   = 5,2
guardsound = 6,0
ground.type = Trip
ground.slidetime = 10
ground.hittime  = 15
ground.velocity = -1.5,-2
air.velocity = -1.2,-3
guard.velocity = -5
fall = 1

[State 440, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 11
ctrl = 1

;---------------------------------------------------------------------------
;Jump Light Punch
; CNS difficulty: easy
[Statedef 600]
type    = A
movetype= A
physics = A
juggle  = 2
poweradd= 11
ctrl = 0
anim = 600
sprpriority = 2

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

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

[State 600, 3]
type = CtrlSet
trigger1 = Time = 17
value = 1

;---------------------------------------------------------------------------
;Jump Strong Punch
; CNS difficulty: easy
[Statedef 610]
type    = A
movetype= A
physics = A
juggle  = 4
poweradd= 65
ctrl = 0
anim = 610
sprpriority = 2

[State 610, 2]
type = PlaySnd
trigger1 = Time = 2
value = 210, 0

[State 610, 3]
type = HitDef
trigger1 = Time = 0
attr = A, NA
damage = 72
guardflag = HA
priority = 4
pausetime = 12,12
sparkno = 1
sparkxy = -10,-55
hitsound   = 5,3
guardsound = 6,0
animtype = Med
ground.type = High
ground.slidetime = 17
ground.hittime  = 17
ground.velocity = -5
air.velocity = -3,-4

;---------------------------------------------------------------------------
;Jump Light Kick
; CNS difficulty: easy
[Statedef 630]
type    = A
movetype= A
physics = A
juggle  = 3
poweradd= 20
ctrl = 0
anim = 630
sprpriority = 2

[State 630, 1]
type = PlaySnd
trigger1 = Time = 1
value = 1000, 0

[State 630, 2]
type = HitDef
trigger1 = Time = 0
attr = A, NA
damage = 26
guardflag = HA
priority = 3
pausetime = 8,8
sparkno = 1
sparkxy = -5,-35
hitsound   = 5,0
guardsound = 6,0
ground.type = High
ground.slidetime = 6
ground.hittime  = 6
ground.velocity = -4
air.velocity = -2,-3

;---------------------------------------------------------------------------
;Jump Strong Kick
; CNS difficulty: easy
[Statedef 640]
type    = A
movetype= A
physics = A
juggle  = 4
poweradd= 65
ctrl = 0
anim = 640
sprpriority = 2

[State 640, 2]
type = PlaySnd
trigger1 = Time = 2
value = 240, 0

[State 640, 3]
type = HitDef
trigger1 = Time = 0
attr = A, NA
damage    = 70
guardflag = HA
priority = 4
pausetime = 12,12
sparkno = 1
sparkxy = -10,-40
hitsound   = 5,3
guardsound = 6,0
animtype = Med
ground.type = High
ground.slidetime = 17
ground.hittime  = 17
ground.velocity = -5
air.velocity = -3,-4

;---------------------------------------------------------------------------
;Kung Fu Throw - Attempt
; CNS difficulty: medium-advanced
; Description: Throws are not difficult to make, although then can be
;     tedious at times. Throw attempt states have a HitDef of a
;     special format. The key parameters in a throw are p1stateno
;     and p2stateno. If the HitDef successfully connects, then
;     the attacker will change to the state number specified by
;     p1stateno, and the opponent will be change to the state
;     number assigned to p2stateno. The special thing about p2stateno
;     is that the opponent will be temporarily brought into the
;     attacker's state file. In this case, no matter who the
;     opponent is, he will be taken to state 820 of this file (kfm.cns)
;     and remain here until the end of the throw (look at his debug
;     information when he is being thrown; the text changes to yellow
;     to mean that he is in another player's state file).
;[Statedef 800]
;---------------------------------------------------------------------------
;Kung Fu Throw - Throwing the opponent
; Description: In this state, KFM throws the opponent by binding him to
;     various offsets based on his current frame of animation. For
;     example, [State 810, Bind 1] binds the opponent to an offset of
;     28 pixels in front of KFM. That puts him around where KFM's hand
;     is at. Is is important to keep the opponent bound using a
;     TargetBind controller at all times, until you let him go. This
;     is especially important if your player has a Clsn2 box that
;     allows him to get hit while throwing someone. Each time a player
;     gets hit, all his bound targets will be set to a fall state. If
;     the opponent is not bound, then he might get stuck in his thrown
;     state when his attacker is knocked out of the throw halfway.
; Notes: There is a TargetLifeAdd controller to decrease the opponent's
;     life, and a TargetState controller to change his state to a
;     falling state when KFM lets go of him.
;[Statedef 810]
;---------------------------------------------------------------------------
;Thrown by Kung Fu Throw
; (a custom gethit state)
; Description: This is the state that the opponent changes to after being
;     hit by KFM's throw HitDef. The important thing here is to use a
;     ChangeAnim2 controller. The difference between ChangeAnim2 and
;     ChangeAnim is that ChangeAnim2 changes the player's animation to
;     an action in the AIR file of the attacker (in this case, kfm.air),
;     whereas ChangeAnim always changes the player to an action in his
;     own AIR file. Look at Action 820 in kfm.air for some extra
;     comments.
;[Statedef 820]
;---------------------------------------------------------------------------
;Thrown by Kung Fu Throw - thrown into the air
; (a custom gethit state)
; Description: This state has the opponent flying through the air and
;     falling down onto the ground. The SelfState controller sets the
;     opponent back using to his own state file when he his the ground.
;     Controllers 821,2 and 821,3 allow the opponent to recover by
;     hitting his recovery command when he is falling.
;[Statedef 821]

; Charge 
[Statedef 730]
type = S
movetype = I
physics = S
anim = 730
velset = 0
ctrl = 0

[State 730, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 735

[State 730, 2]
type = PlaySnd
trigger1 = Time = 1
value = 730,0

; Charge
[Statedef 735]
type = S
movetype = I
physics = S
anim = 730

[State 735, 1]
type = ChangeState
trigger1 = command != "charge"
value = 740

[State 735, energy]
type = Explod
trigger1 = Time = 0
anim = 4002
sprpriority = -1
bindtime = -1
removetime = 150
ownpal = 1

[State 735, 2]
type = PowerAdd
trigger1 = Time = [0,12]
value = 10

[State 735, 2]
type = ChangeState
trigger1 = Power >= 3000
value = 740


[State 735, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 735

; Charge (Fim)
[Statedef 740]
type = S
movetype = I
physics = S
anim = 730

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

; Charge Parte1
[Statedef 741]
type = S
movetype = I
physics = S
anim = 740

[State 741, 1]
type = PlaySnd
trigger1 = Time = 1
value = 0,5

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

;Fireball Motion
[Statedef 4000]
type = S
movetype= A 
physics = S 
poweradd= 0 
ctrl = 0
velset = 0
anim = 4000

[State 4000, 1]
type = PlaySnd 
trigger1 = AnimElem = 1 
value = 200,0

[State 4000, 2]
type = Projectile 
trigger1 = AnimElem = 3 
projanim = 4001 
;projhitanim = 4410 
offset = 25, -50 
velocity = 20, 0 
;remvelocity = 0, 0
;velmul = 1.01, 1
;accel = 0, 0
; HitDef part of projectile info
attr = S, SP 
damage = 36,4 
animtype = Medium 
pausetime = 0,9 
;sparkno = 0 
sparkxy = 10, 0 
hitsound = 5,3 
guardflag = MA 
guardsound = 6,0 
ground.type = Low 
ground.slidetime = 14 
ground.hittime = 16 
ground.velocity = -8 
air.animtype = Back 
air.velocity = -2.5,-5 
air.juggle = 3 

[State 4000, 3]
type=VarSet
trigger1=power = 0
v=1
value=1

[State 4000, 3a]
type=ChangeState
trigger1=Var(1) = 1
trigger1=AnimTime = 0
value=5300

[State 4000, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

[State 4000, 5]
type = PowerAdd
trigger1 = Time = 2
value = -100

;kenzien
[Statedef 4100]
type    = S
movetype= A
physics = S
poweradd= -1000
ctrl = 1
anim = 4100
velset = 0

[State 4100, 2]
type = SuperPause
trigger1 = AnimElem = 1
pos = -23, -53
anim = 9000

[State 4100, 1]
type = velset
trigger1 = time >= 0
trigger1 = time <= 48
x = 0
y = 0

[State 4100, 3]
type = PlaySnd
trigger1 = Time = 1
value = 4100,0

[State 4100, 4]
type = AfterImage
trigger1 = Time = 1	
Time = 45
TimeGap  = 1
FrameGap = 4


[State 4100, 3]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0, 10

[State 4100, 8]
type = Projectile
trigger1 = AnimElem = 4
projanim = 4101
;projhitanim = 1009
;ProjRemAnim = 1009
;ProjEdgeBound = 50   
;ProjHeightBound = -240, 5
offset = 25, -66
velocity = 6.5, 0
remvelocity = .7, 0
projhits = 30
accel = 0, .00
; HitDef part of projectile info
attr = S, SP
damage    = 19,2
priority = 99999
animtype  = Hard
getpower  = 50
givepower = 30
pausetime = 0,12
sparkno = 1
sparkxy = 0, 0
hitsound = 5,3
;guardflag = A 
guardsound = 6,0
ground.type = High
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -8
air.type = Low
air.velocity = -2.5,-1.75
air.juggle = 3
fall.animtype = Hard
air.fall = 1
fall = 1
;PalFX
palfx.time = 15
palfx.add = 32,0,0
palfx.mul = 300,192,192

[State 4100, 3]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = Pos Y < 0
value = 4100

[State 4100, 4]
type=VarSet
trigger1=power = 0
v=1
value=1

[State 4100, 5]
type=ChangeState
trigger1=Var(1) = 1
trigger1=AnimTime = 0
value=5300

[State 4100, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;KameHameha
[Statedef 4500]
type    = S
movetype= A
physics = S
poweradd= -1000
ctrl = 0
anim = 4500
velset = 0,0,0

[State 4500, 1]
type = HitDef
trigger1 = Time = 0
attr = S, HA

[State 4500, 2]
type = SuperPause
trigger1 = AnimElem = 1
pos = 15,-55

;[State 4500, 2]
;type = SuperPause
;trigger1 = AnimElem = 1
;pos = -6,-26

[State 4500, 3]
type = PlaySnd
trigger1 = Time = 1
value = 4500,0

[State 4500, 4]
type = AfterImage
trigger1 = Time = 1	
Time = 45
TimeGap  = 1
FrameGap = 4

[State 4500, 6]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0,7

[State 4500, 7]
type = Projectile
trigger1 = AnimElem = 6
projanim = 4501
offset = 45, -50
velocity = 0, 0
projremovetime = 10
velmul = 0, 0
projpriority = 9999

[State 4500, 7]
type = Projectile
trigger1 = AnimElem = 6
projanim = 4501
projremanim = 4501
offset = 45, -50
velocity = 0, 0
projremovetime = 110
velmul = 0, 0
projpriority = 9999

[State 4500, 7]
type = Projectile
trigger1 = AnimElem = 6
projanim = 4501
projremanim = 4501
offset = 45, -50
velocity = 0, 0
projremovetime = 220
projhits = 43
projpriority = 9999
projmisstime = 1
attr = S, HP
damage    = 10,9
animtype  = Hard
numhits = 1
getpower  = 5
givepower = 31
guardflag = MA
pausetime = 2,15
hitsound   = 5,3
hitspark = -1
sparkno = -1
guardsound = 6,0
ground.type = high
ground.slidetime = 4
ground.velocity = -50   
airguard.velocity = -50  
air.type = Low
air.velocity = -50,1
air.juggle = 5
fall.animtype = Hard
;fall = 1

[State 4500, 8]
type = Projectile
trigger1 = Time = 135
projanim = 4501
offset = 45, -50
velocity = 0, 0
projhits = 0
projremovetime = 0
velmul = 0, 0
projpriority = 9999
projmisstime = 1
attr = S, HP
numhits = 1
getpower  = 0
givepower = 31
guardflag = MA
pausetime = 2,12
hitsound   = 5,3
hitspark = -1
sparkno = -1
guardsound = 6,0
ground.type = high
ground.slidetime = 4
ground.velocity = -50  
airguard.velocity = -50  
air.type = Low
air.velocity = -50,0
air.juggle = 5
fall.animtype = Hard
;fall = 1

[State 4500, 9]
type=VarSet
trigger1=power = 0
v=1
value=1

[State 4500, 9a]
type=ChangeState
trigger1=Var(1) = 1
trigger1=AnimTime = 0
value=5300

[State 4500, 10]
type = ChangeState
trigger1 = Time = 200
value = 0
ctrl = 1

;Solar Flare
[Statedef 406]
type=S
movetype=H
physics=S
poweradd=-250
ctrl=0
velset=0,0,0
anim=406

[State 406, 0]
type=PlaySnd
trigger1=AnimElem = 1
value=406,0
volume=255

[State 406, 1]
type=Explod
trigger1=Time = 0
anim=407
sprpriority=-1
bindtime=-1
removetime=24
ownpal=1

[State 406, 1]
type=Projectile
trigger1=AnimElem = 1
sprpriority=-1
projanim=408
projremovetime=24
projhits=4
projmisstime=6
offset=0, -40
velocity=0, 0
attr=S, SP
damage=0,0
animtype=Medium
pausetime=0,90
sparkno=-1
hitsound=5,3
guardflag=MA
guardsound=6,0
ground.type=Low
ground.slidetime=0
ground.hittime=16
ground.velocity=0
air.animtype=Back
air.velocity=0,0
air.juggle=1
fall=1

[State 406, 2]
type=VarSet
trigger1=power = 0
v=1
value=1

[State 406, 3a]
type=ChangeState
trigger1=Var(1) = 1
trigger1=AnimTime = 0
value=5300

[State 406, 3b]
type=ChangeState
trigger1=AnimTime = 0
value=0
ctrl=1

[Statedef 1000]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 110
velset = 30,0
anim = 1000
ctrl = 0
sprpriority = 2

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

;[State 1000, 2]
;type = PosAdd
;trigger1 = AnimElem = 3
;x = 50

[State 1000, 2]
type = HitDef
trigger1 = AnimElem = 3
attr = A, SA
animtype  = Hard
damage    = 95, 4
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = -10,-70
hitsound   = 5,3
guardsound = 6,0
ground.type = Low
ground.slidetime = 18
ground.hittime  = 18
ground.velocity = -3.5,-7
guard.velocity = -7
air.velocity = -3.5,-7
fall = 1

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

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

[State 5300, 0]
type = PlaySnd
trigger1 = Time = 1
value = 5300, 0

[State 5300, 1]
type=VarSet
trigger1=Time >= 160
trigger1=Var(1) = 1
v=1
value=0

[State 5300, 2]
type=ChangeState
trigger1=Var(1) = 0
value=0
ctrl=1

;-----------------------------------------------------------
;Bukuu Jutsu (Flying Start)
[Statedef 1999]
type = A
movetype = A
physics = A
velset = 0,-8,0
ctrl = 0
anim = 1999

;This makes Krillin invulnerable to projectiles during this action.
[State 1999, Resistance]
type = HitDef
Trigger1 = Alive = 1
Trigger1 = Var(5) != 0
Trigger1 = timemod = 20,0
attr = S, SA
getpower = 100
guardflag = MA
hitflag = P
priority = 9

;This makes the shadows behind Krillin.
[State 1999, AfterImage]
type = AfterImage
Trigger1 = time = 1
length = 13
PalBright = 30, 30, 0
PalContrast = 70, 70, 20
PalAdd = -10,-10,-10
PalMul = .85,.85,.50
TimeGap = 1
FrameGap = 2
Trans = Add
time = 10

;This makes the jump sound effect.
[State 1999, JumpSnd]
type = PlaySnd
Trigger1 = AnimElem = 1
value = 0, 2

;Krillin will go to state 2000 as soon as the move has ended.
[State 1999, Fly]
type = ChangeState
Trigger1 = AnimTime = 0
value = 2000
ctrl = 1

;---------------------------------------------------------------------------
;Bukuu Jutsu
[Statedef 2000] 
type = S
movetype = I
physics = N
ctrl = 0
anim = 2000
velset = 0,0

[State 2000, VarSet]
type = VarSet
Trigger1 = Time = 0
var(3) = 1

[State 2000, Block1]
type = ReversalDef
Trigger1 = command = "holdback"
Trigger2 = command = "BB"
reversal.attr = SCA, NA, SA, HA
pausetime = 0,15
hitsound = S20, 3
p1stateno = 150

[State 2000, RunSnd]
type = PlaySnd
Trigger1 = command = "FF"
Trigger2 = command = "BB"
Trigger3 = command = "DD"
Trigger4 = command = "UU"
value = 21, 0

[State 2000, Stop1]
type = VelSet
Trigger1 = command != "holdfwd"
Trigger1 = command != "holdback"
Trigger1 = command != "holdup"
Trigger1 = command != "holddown"
Trigger1 = var(2) = 0
Trigger2 = Pos Y < -405
x = 0
y = 0

[State 2000, Stop2]
type = ChangeAnim
Trigger1 = command != "holdup"
Trigger1 = command != "holddown"
Trigger1 = Anim != 2000
value = 2000

;フワフワ
[State 2000,fuwavar(1)]
type = VarSet
Trigger1 = command != "holdfwd"
Trigger1 = command != "holdback"
Trigger1 = command != "holdup"
Trigger1 = command != "holddown"
Trigger1 = var(2) != 2
Trigger2 = var(2) = 2
Trigger2 = Vel Y >= 2.4
v = 2
value = 1

[State 2000,fuwavar(2)]
type = VarSet
Triggerall = var(2) = 1
Trigger1 = Vel Y <= -2.4
Trigger2 = P2BodyDist Y > 250
Trigger2 = Vel Y < 0
v = 2
value = 2

[State 2000,fuwaUp]
type = VelAdd
Trigger1 = var(2) = 1
y = -0.3

[State 2000,fuwaDown]
type = VelAdd
Trigger1 = var(2) = 2
y = 0.3

[State 2000,fuwaEnd]
type = VelSet
Triggerall = var(2) != 0
Trigger1 = command = "holdfwd"
Trigger2 = command = "holdback"
Trigger3 = command = "holdup"
Trigger4 = command = "holddown"
y = 0

[State 2000,fuwaEndVar]
type = VarSet
Trigger1 = command = "holdfwd"
Trigger2 = command = "holdback"
Trigger3 = command = "holdup"
Trigger4 = command = "holddown"
v = 2
value = 0

[State 2000, UpBorder1]
type = PosSet
Trigger1 = Pos Y < -400
y = -400

[State 2000, UpBorder2a]
type = PosAdd
Trigger1 = P2BodyDist Y > 250
Trigger1 = Vel Y < 0
y = 1

[State 2000, UpBorder2b]
type = VelSet
Trigger1 = P2BodyDist Y > 250
Trigger1 = Vel Y < 0
y = 0

[State 2000, Runeffect]
type = AfterImage
Trigger1 = Command = "FF"
Trigger1 = Vel X < 8.6
Trigger2 = Command = "BB"
Trigger2 = Vel X > -7
Trigger3 = Command = "DD"
Trigger3 = Vel Y < 8.6
Trigger4 = Command = "UU"
Trigger4 = Vel Y > -7
length = 13
PalBright = 30, 30, 0
PalContrast = 70, 70, 20
PalAdd = -10,-10,-10
PalMul = .85,.85,.50
TimeGap = 1
FrameGap = 2
Trans = Add
time = 10

[State 2000, RunFwd]
type = VelSet
Trigger1 = Command = "FF"
Trigger1 = Vel X < 8.6
x = 8.6

[State 2000, RunBack]
type = VelSet
Trigger1 = Command = "BB"
Trigger1 = Vel X > -7
x = -7

[State 2000, RunDown]
type = VelSet
Trigger1 = Command = "DD"
Trigger1 = Vel Y < 8.6
y = 8.6

[State 2000, RunUp]
type = VelSet
Trigger1 = Command = "UU"
Trigger1 = Vel Y > -7
y = -7

[State 2000, GoDown1]
type = VelAdd
Trigger1 = command = "holddown"
y = 0.4

[State 2000,GoDown2]
type = VelSet
Trigger1 = command = "holddown"
Trigger1 = Vel Y < 0 
y = 0

[State 2000, GoUp1]
type = VelAdd
Trigger1 = command = "holdup"
y = -0.3

[State 2000,GoUp2]
type = VelSet
Trigger1 = command = "holdup"
Trigger1 = Vel Y > 0 
y = 0

[State 2000, GoUpAnim]
type = ChangeAnim
Trigger1 = Anim != 100
Trigger1 = command = "holdup"
value = 100

[State 2000, GoBack1]
type = VelAdd
Trigger1 = command = "holdback"
x = -0.3

[State 2000,GoBack2]
type = VelSet
Trigger1 = command = "holdback"
Trigger1 = Vel X > 0 
x = 0

[State 2000, GoBackAnim]
type = ChangeAnim
Triggerall = Anim != 105
Trigger1 = command = "holdback"
Trigger2 = command = "holddown"
value = 105

            ;前進
[State 2000, GoFwd1]
type = VelAdd
Trigger1 = command = "holdfwd"
x = 0.4

[State 2000,GoFwd2]
type = VelSet
Trigger1 = command = "holdfwd"
Trigger1 = Vel X < 0 
x = 0

[State 2000, GoFwdAnim]
type = ChangeAnim
Trigger1 = Anim != 100
Trigger1 = command = "holdfwd"
value = 100

[State 2000, Turn]
type = Turn
Trigger1 = P2Dist X < 0

[State 2000, Land1]
type = ChangeState
Trigger1 = Pos Y >= 0
value = 52
ctrl = 1

[State 2000, Land2]
type = ChangeState
Trigger1 = command = "holdx"
Trigger1 = command = "holdy"
Trigger1 = command = "holddown"
value = 50
ctrl = 1

[State 2000, WinLose]
type = ChangeState
Trigger1 = Win
Trigger2 = Lose
value = 50


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

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

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

[Statedef -3]

;This controller plays a sound everytime KFM lands from a jump, or
;from his 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
