;add to buffer, tag
; 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.


;----------------------------------------
; It is highly recommended that you log what you use your vars for
;=============================================
;Vars
;=============================================
;0: Juggle Limiter
;1: Used in .cyd for allowing certain moves to combo
;2: Used to determine if forward is being held in throw or which button is pressed in Board Throw/DiveKick
;3: Used to skip motion blur frames when an attack hits so that it does not get paused on that frame
;4: 
;5:
;6:  
;7: 
;8: 
;9: 
;10: 
;11: 
;12: 
;13: 
;14: 
;15: 
;16: 
;17: 
;18: 
;19: 
;20: 
;21: 
;22: 
;23: 
;24: 
;25: 
;26: 
;27: 
;28: 
;29: 
;30: 
;31: 
;32: 
;33: 
;34: 
;35: 
;36: 
;37: 
;38: 
;39: 
;40: 
;41: 
;42: 
;43: 
;44: 
;45: -2 Custom State Checker
;46: -3 Custom State Checker
;47: Charge Back Increments
;48: Charge Back Buffertime
;49: Charge Down Increments
;50: Charge Down Buffertime
;51: 
;52: 
;53: 
;54: 
;55: 
;56: 
;57: 
;58: 
;59:  


;fvar(0) : 
;fvar(1) : 
;fvar(2) : 
;fvar(3) : 
;fvar(4) : 
;fvar(5) : 
;fvar(6) : 
;fvar(7) : 
;fvar(8) : 
;fvar(9) : 
;fvar10) : 
;fvar(11) : 
;fvar(12) : 
;fvar(13) : 
;fvar(14) : 
;fvar(15) : 
;fvar(16) : 
;fvar(17) : 
;fvar(18) : 
;fvar(19) : 
;fvar(20) : 
;fvar(21) : 
;fvar(22) : 
;fvar(23) : 
;fvar(24) : 
;fvar(25) : 
;fvar(26) : 
;fvar(27) : 
;fvar(28) : 
;fvar(29) : 
;fvar(30) : 
;fvar(31) : 
;fvar(32) : 
;fvar(33) : 
;fvar(34) : 
;fvar(35) : 
;fvar(36) : 
;fvar(37) : 
;fvar(38) : 
;fvar(39) : 

;Explod Buffer Helper(90000005) Vars DO NOT CHANGE THESE OR ADD MORE TO THEM more may be added in the future if you have suggestions on things to add please post it on http://mugenguild.com/forum/
;=============================================
;0: Tag mode on? 1 = yes
;1: Which char is active in tag 1= 1st char, 2 = 2nd, 3 = 3rd(needs a 3 char team moded MUGEN)
;

 
[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 = 0
;Time which player lies down for, before getting up.
liedown.time = 8
;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
;volumescale offset (negative for softer)
volumescale = 100
;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 = 1           ;Horizontal scaling factor.
yscale = 1           ;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). Recommended 0,0
 
[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,-10.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         ;.
air.gethit.groundrecover = -.15,-3.5  ;Velocity for ground recovery state (x, y) **MUGEN 1.0**
air.gethit.airrecover.mul = .5,.2     ;Multiplier for air recovery velocity (x, y) **MUGEN 1.0**
air.gethit.airrecover.add = 0,-4.5    ;Velocity offset for air recovery (x, y) **MUGEN 1.0**
air.gethit.airrecover.back = -1       ;Extra x-velocity for holding back during air recovery **MUGEN 1.0**
air.gethit.airrecover.fwd = 0         ;Extra x-velocity for holding forward during air recovery **MUGEN 1.0**
air.gethit.airrecover.up = -2         ;Extra y-velocity for holding up during air recovery **MUGEN 1.0**
air.gethit.airrecover.down = 1.5      ;Extra y-velocity for holding down during air recovery **MUGEN 1.0**
 
[Movement]
airjump.num = 0       ;Number of air jumps allowed (opt)
airjump.height = 35   ;Minimum distance from ground before you can air jump (opt)
yaccel = .5
        ;Vertical acceleration
stand.friction = .828125  ;Friction coefficient when standing. Use .85 for Phantom of the Server (POTS) style
crouch.friction = .828125 ;Friction coefficient when crouching. Use .85 for Phantom of the Server (POTS) style
stand.friction.threshold = 2          ;If player's speed drops below this threshold while standing, stop his movement **MUGEN 1.0**
crouch.friction.threshold = 2       ;If player's speed drops below this threshold while crouching, stop his movement **MUGEN 1.0**
air.gethit.groundlevel = 25           ;Y-position at which a falling player is considered to hit the ground **MUGEN 1.0**
air.gethit.groundrecover.ground.threshold = -20 ;Y-position below which falling player can use the recovery command **MUGEN 1.0**
air.gethit.groundrecover.groundlevel = 10   ;Y-position at which player in the ground recovery state touches the ground **MUGEN 1.0**
air.gethit.airrecover.threshold = -1  ;Y-velocity above which player may use the air recovery command **MUGEN 1.0**
air.gethit.airrecover.yaccel = .35    ;Vertical acceleration for player in the air recovery state **MUGEN 1.0**
air.gethit.trip.groundlevel = 15      ;Y-position at which player in the tripped state touches the ground **MUGEN 1.0**
down.bounce.offset = 0, 20            ;Offset for player bouncing off the ground (x, y) **MUGEN 1.0**
down.bounce.yaccel = .4               ;Vertical acceleration for player bouncing off the ground **MUGEN 1.0**
down.bounce.groundlevel = 12          ;Y-position at which player bouncing off the ground touches the ground again **MUGEN 1.0**
down.friction.threshold = .05         ;If the player's speed drops below this threshold while lying down, stop his movement **MUGEN 1.0**

;Default language victory quotes (optional).  **MUGEN 1.0**
;If this section is included, the default language victory quotes must be in English.
[Quotes]
; Up to 100 victory quotes can be specified per language (victory0 - victory99)
victory1 = "You must defeat Tu Shou to stand a chance."
victory2 = "You need a lot of training. Come back in ten years."
victory3 = "You look familiar. Did I see you on TV?"
victory4 = "Your moves are too predictable. You want to learn Kung Fu Palm? It's not for novices."
victory5 = "That was a good workout."
victory6 = "I want to challenge more skilled fighters."
victory7 = "What do you mean my girlfriend is in another temple?"

;Alternate language victory quotes (optional).
;0 or more alternate language sections may be added, preceded by the
;ISO 639-1 code followed by a ".", e.g. "[ja.Quotes]".
;See language setting in mugen.cfg.
[ja.Quotes]
victory1 = "カンフー突き手を破らぬ限り、お前に勝ち目はない！"
victory2 = "十年早いんだぞ"
victory3 = "お前は見覚えがあるな。テレビにでも…？"
victory4 = "お前の動きは見破りやすすぎる。　なに、カンフー突き手が覚えたいんだと？　素人には無理だぞ"
victory5 = "ふー。　いい汗だった"
victory6 = "もっと強い相手に挑戦したい"
victory7 = "なんだと！彼女はここにもいないと？"

;---------------------------------------------------------------------------
; Variable usage:
; This is a record of the variables that KFM uses. Keeping a record of your
; variable usage helps you avoid careless mistakes later.
; var(1)  - Used in kfm.cmd for combo condition (updated every tick)
; var(2)  - Used in Kung Fu Throw (state 800) to remember if fwd was being
;           held (remembered from state 800 through state 810).


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

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

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

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

;---------------------------------------------------------------------------
; Win pose 1 - Bow
; CNS difficulty: basic
[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
[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] ;Assert this until you want "round 1, fight" to begin
type = AssertSpecial
trigger1 = 1
flag = Intro

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

; You can delete the following two controllers if you're building your own
; character using KFM. These are the wood pieces that KFM kicks.
[State 191, Wood 1]
type = Explod
trigger1 = RoundState != 0
persistent = 0
anim = 191
postype = p1
pos = 260, -90
velocity = -4.2, -7
accel = 0, .32
removetime = 48

[State 191, Wood 2]
type = Explod
trigger1 = AnimElemTime(7) = 1
anim = 192
postype = p1
pos = 60, -70
velocity = 2, -4
accel = 0, .32
removetime = 35

; You can delete the following two controllers if you're building your own
; character using KFM. These play back the sounds of the wood block being
; broken.
[State 191, Snd 1]
type = PlaySnd
trigger1 = AnimElem = 7
value = F5,2

[State 191, Snd 2]
type = PlaySnd
trigger1 = AnimElemTime(7) = 3
value = F5,3

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

[State 195, 1]
type = CtrlSet
trigger1 = Time = 40
value = 1

[State 0, Explod]
type = Explod
trigger1 = Time=1
anim = 1
ID = 92468246
removetime = -1
pausemovetime = 999999999
supermovetime = 999999999

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = Time=0
trigger1 = NumExplod(92468246)
id = 92468246

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


;---------------------------------------------------------------------------
; 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 = 10                    ;Power to add (Def: 0)
sprpriority = 2                  ;Set p1's sprite 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)
;Note that most commercial games do not use priority. Notable exeptions are Street Fighter 3 and 5
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  = 11             ;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 = 15                 ;Time before opponent regains control in air

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

[State 200, 3]
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= 30
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 = 0, 4

[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  = 16
ground.velocity = -5.5
air.velocity = -2.5,-4
forcenofall = 1

[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= 11
ctrl = 0
velset = 0,0
anim = 230
sprpriority = 2

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

[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  = 14
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= 30
ctrl = 0
velset = 0,0
anim = 240
sprpriority = 2

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

[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  = 17
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= 8
ctrl = 0
anim = 400
sprpriority = 2

[State 400, 1]
type = PlaySnd
trigger1 = Time = 1
value = 0, 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  = 9
ground.velocity = -4
air.velocity = -1.5,-3

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

[State 400, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 11+(!NumExplod(90000001) && !NumExplod(90000002) && !NumExplod(90000003))

;---------------------------------------------------------------------------
;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.
[Statedef 410]
type    = C
movetype= A
physics = C
juggle  = 6
poweradd= 25
ctrl = 0
anim = 410
sprpriority = 2

[State 410, 1]
type = PlaySnd
trigger1 = Time = 1
value = 0, 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  = 17
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  = 17
ground.velocity = -7
air.velocity = -3,-4

[State 410, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 11+(!NumExplod(90000001) && !NumExplod(90000002) && !NumExplod(90000003))
ctrl = 1

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

[State 430, 1]
type = PlaySnd
trigger1 = Time = 1
value = 0, 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  = 10
ground.velocity = -5
air.velocity = -2,-3
down.velocity = -5,0
down.hittime = 22

[State 430, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 11+(!NumExplod(90000001) && !NumExplod(90000002) && !NumExplod(90000003))
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.
[Statedef 440]
type    = C
movetype= A
physics = C
juggle  = 7
poweradd= 35
ctrl = 0
anim = 440
sprpriority = 2

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

[State 440, 3]
type = HitDef
trigger1 = Time = 0
attr = C, NA
damage    = 72
hitflag = MAF
guardflag = L
pausetime = 12,12
sparkno = 1
sparkxy = -5,-10
hitsound   = 5,2
guardsound = 6,0
ground.type = Trip
ground.slidetime = 10
ground.hittime  = 17
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+(!NumExplod(90000001) && !NumExplod(90000002) && !NumExplod(90000003))
ctrl = 1

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

[State 600, 1]
type = PlaySnd
trigger1 = Time = 1
value = 0, 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  = 8
ground.velocity = -4
air.velocity = -1.3,-3
air.hittime = 14

[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= 30
ctrl = 0
anim = 610
sprpriority = 2

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

[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 = 12
ground.hittime  = 14
ground.velocity = -6
air.velocity = -3,-4

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

[State 630, 1]
type = PlaySnd
trigger1 = Time = 1
value = 0, 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  = 10
ground.velocity = -4
air.velocity = -2,-3
air.hittime = 14

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

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

[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 = 12
ground.hittime  = 15
ground.velocity = -7
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]
type    = S
movetype= A
physics = S
juggle  = 0
velset = 0,0
ctrl = 0
anim = 800
sprpriority = 2

; Notes: The '-' symbol in the hitflag field means that it only affects
;   players who are not in a hit state. This prevents KFM from combo-ing
;   into the throw. The priority should be set to a low number, such as
;   1 or 2, so that the throw does not take precedence over normal attacks.
;   The type of priority must always be set to "Miss" or "Dodge" for throws,
;   otherwise strange behavior can result.
[State 800, 1]
type = HitDef
Trigger1 = Time = 0
attr = S, NT          ;Attributes: Standing, Normal Throw
hitflag = M-          ;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
p1sprpriority = 1     ;Draw p1's sprite in front of p2
                      ;p2's sprite priority is set to 0 by default
p1facing = 1
p2facing = 1          ;Force p2 to face KFM
;p1stateno = 810       ;On success, KFM changes to state 810 (P1StateNo is bugged don't use it)
;p2stateno = 820       ;If hit, p2 changes to state 820 in KFM's cns (P2StateNo is bugged don't use it)
guard.dist = 0        ;This prevents p2 from going into a guard state if close
fall = 1              ;Force p2 into falling down

;On success, KFM changes to state 810
[State 800, ChangeState]
type = ChangeState
trigger1 = MoveHit=1
value = 810
ignorehitpause = 1
persistent = 0

[State 800, 2]
type = ChangeState
Trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;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 may 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]
type    = S
movetype= A
physics = N
anim = 810
poweradd = 0

; Here a variable, var(2), is used to remember whether or not the
; player was holding forward at the start of the state. This variable
; is checked later on to turn KFM around if necessary.
[State 810, Holding fwd?]
type = VarSet
trigger1 = Time = 0
var(2) = ((ifElse(P2DisT x < 0, Facing = -1, Facing = 1) && NumExplod(90000006)) || (ifElse(P2DisT x < 0, Facing = 1, Facing = -1) && NumExplod(90000004))) 

[State 820 Throw P2]
type = targetstate
trigger1 = !time
value = 820 ;this is the state P2 is put in, you will see it below

[State 810, Grab Sound]
type = PlaySnd
trigger1 = AnimElem = 2
value = 1, 1

[State 810, Throw Sound]
type = PlaySnd
trigger1 = AnimElem = 7
value = 800, 0

[State 810, Bind 1]
type = TargetBind
trigger1 = AnimElemTime(2) < 0
pos = 28, 0

[State 810, Width 2-11]
type = Width
trigger1 = AnimElemTime(2) >= 0 && AnimElemTime(12) < 0
edge = 60,0

[State 810, Bind 2-4]
type = TargetBind
trigger1 = AnimElemTime(2) >= 0 && AnimElemTime(5) < 0
pos = 58, 0

[State 810, Bind 5]
type = TargetBind
trigger1 = AnimElemTime(5) >= 0 && AnimElemTime(6) < 0
pos = 47, 0

[State 810, holdfwd - Turn 6] ;If was holding fwd before, turn now
type = Turn
trigger1 = var(2)
trigger1 = AnimElem = 6

[State 810, holdfwd - Pos 6] ;If was holding fwd before, move a little
type = PosAdd
trigger1 = var(2)
trigger1 = AnimElem = 6
x = -37

[State 810, holdfwd - Turn Target 6] ;If was holding fwd before, turn target too
type = TargetFacing
trigger1 = var(2)
trigger1 = AnimElem = 6
value = -1

[State 810, Bind 6]
type = TargetBind
trigger1 = AnimElemTime(6) >= 0 && AnimElemTime(7) < 0
pos = 41, -60

[State 810, Bind 7]
type = TargetBind
trigger1 = AnimElemTime(7) >= 0 && AnimElemTime(8) < 0
pos = 25, -75

[State 810, Bind 8]
type = TargetBind
trigger1 = AnimElemTime(8) >= 0 && AnimElemTime(9) < 0
pos = 15, -90

[State 810, Bind 9]
type = TargetBind
trigger1 = AnimElemTime(9) >= 0 && AnimElemTime(10) < 0
pos = -5, -96

[State 810, Bind 10]
type = TargetBind
trigger1 = AnimElemTime(10) >= 0 && AnimElemTime(11) < 0
pos = -14, -90

[State 810, Bind 11]
type = TargetBind
trigger1 = AnimElem = 11
pos = -50, -50

[State 810, Hurt 11]
type = TargetLifeAdd
trigger1 = AnimElem = 11
value = -78

[State 810, Throw 11]
type = TargetState
trigger1 = AnimElem = 11
value = 821

[State 810, Turn 12]
type = Turn
trigger1 = AnimElem = 12

[State 810, Pos 15]
type = PosAdd
trigger1 = AnimElem = 15
x = -10

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

;---------------------------------------------------------------------------
;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]
type    = A
movetype= H
physics = N
velset = 0,0

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

;In case attacker loses binding on player for any reason, this controller
;guarantees that the player will never get stuck in this thrown state.
[State 820, 2]
type = SelfState
trigger1 = !gethitvar(isbound)
value = 5050

;---------------------------------------------------------------------------
;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]
type    = A
movetype= H
physics = N
velset = 2.8,-7
poweradd = 40

[State 821, 1] ;Gravity
type = VelAdd
Trigger1 = 1
y = .4

[State 821, 2] ; Recover near ground (use ChangeState)
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

[State 821, 3] ; Recover in mid air (use SelfState)
type = SelfState
triggerall = Vel Y > 0
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;HITFALL_AIRRECOVER

[State 821, 4] ;Hit ground
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;Hit ground


;---------------------------------------------------------------------------
; Kung Fu Palm
; CNS difficulty: medium
; Description: This is like a standard attack, but with some differences.
;   There are two HitDefs in this attack. One is triggered when the
;   opponent is near (using a p2bodydist trigger), and the other
;   when the opponent is farther away. The main differences between
;   the near and far versions of the HitDefs is that the near version
;   has a "fall" parameter set to 1, causing the opponent to be knocked
;   down. Other minor differences are the damage, and the velocity to
;   give the opponent.
;   The line "attr = S, SA" line means this is a Standing, Special Attack.
;   It is important you have the attr parameter set correctly for all
;   you HitDefs.
[Statedef 1000]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 55
velset = 0,0
anim = 1000
ctrl = 0
sprpriority = 2

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

[State 1000, 2]
type = PosAdd
trigger1 = AnimElem = 2
x = 20

[State 1000, 3]
type = PosAdd
trigger1 = AnimElem = 3
trigger2 = AnimElem = 13
x = 10

[State 1000, 4]
type = PosAdd
trigger1 = AnimElem = 5
x = 5

[State 1000, 5] ;Opponent near
type = HitDef
trigger1 = AnimElem = 5
trigger1 = p2bodydist X < 40
attr = S, SA
animtype  = Hard
damage    = 90, 4
priority  = 5
guardflag = MA
pausetime = 15,15
sparkxy = -10,-60
hitsound   = 5,4
guardsound = 6,0
ground.type = Low
ground.slidetime = 12
ground.hittime  = 17
ground.velocity = -4,-3.5
air.velocity = -4,-3
fall = 1

[State 1000, 6] ;Opponent not near
type = HitDef
trigger1 = AnimElem = 5
trigger1 = p2bodydist X >= 40
attr = S, SA
animtype  = Hard
damage    = 85, 4
priority  = 4
guardflag = MA
pausetime = 15,15
sparkxy = -10,-60
hitsound   = 5,4
guardsound = 6,0
ground.type = Low
ground.slidetime = 12
ground.hittime  = 17
ground.velocity = -7
air.velocity = -4,-2.5

[State 1000, 6]
type = PosAdd
trigger1 = AnimElem = 9
x = -5

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

;---------------------------------------------------------------------------
; Strong Kung Fu Palm
; CNS difficulty: medium
[Statedef 1010]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 60
velset = 0,0
anim = 1010
ctrl = 0
sprpriority = 2

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

[State 1010, 2]
type = PosAdd
trigger1 = AnimElem = 2
x = 20

[State 1010, 3]
type = PosAdd
trigger1 = AnimElem = 3
trigger2 = AnimElem = 13
x = 10

[State 1010, 4]
type = PosAdd
trigger1 = AnimElem = 5
x = 5

[State 1010, 5]
type = VelSet
trigger1 = AnimElem = 5
x = 4

[State 1010, 6] ;Opponent near
type = HitDef
trigger1 = AnimElem = 5
trigger1 = p2bodydist X < 40
attr = S, SA
animtype  = Hard
damage    = 90, 4
priority  = 5
guardflag = MA
pausetime = 15,15
sparkxy = -10,-60
hitsound   = 5,4
guardsound = 6,0
ground.type = Low
ground.slidetime = 12
ground.hittime  = 17
ground.velocity = -4,-3.5
air.velocity = -4,-3
fall = 1

[State 1010, 7] ;Opponent not near
type = HitDef
trigger1 = AnimElem = 5
trigger1 = p2bodydist X >= 40
attr = S, SA
animtype  = Hard
damage    = 85, 4
priority  = 4
guardflag = MA
pausetime = 15,15
sparkxy = -10,-60
hitsound   = 5,4
guardsound = 6,0
ground.type = Low
ground.slidetime = 12
ground.hittime  = 17
ground.velocity = -7
air.velocity = -4,-2.5

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

;---------------------------------------------------------------------------
; Fast Kung Fu Palm
; CNS difficulty: advanced
; Description: This is a complicated attack move. If you're a beginner,
;     you should skip looking at this for now and check it later when
;     you are more comfortable with the cns.
;     This move puts the other player in a custom get-hit state.
;     The line "p2stateno = 1025" in the HitDef does this. KFM has some
;     palette effects as well as after-image effects.
[Statedef 1020]
type    = S
movetype= A
physics = N
juggle  = 6
poweradd= -330
velset = 0,0
anim = 1020
ctrl = 0
sprpriority = 2

[State 1020, Friction]
type = VelMul
trigger1 = 1
x = .85 * ifelse (AnimElemTime(6) < 0, 1, .8)

[State 1020, Afterimage]
type = AfterImage
trigger1 = Time = 0
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 = 2

[State 1020, Afterimage]
type = AfterImageTime
trigger1 = AnimElemTime(8) < 0
time = 2

[State 1020, Blink Yellow]
type = PalFX
trigger1 = Time = 0
time = 20
add = 32,16,0
sinadd = 64,32,5,3

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

[State 1020, 2]
type = PosAdd
trigger1 = AnimElem = 2
x = 20

[State 1020, 3]
type = PosAdd
trigger1 = AnimElem = 3
trigger2 = AnimElem = 12
x = 10

[State 1020, 4]
type = PosAdd
trigger1 = AnimElem = 4
x = 5

[State 1020, 5]
type = VelSet
trigger1 = AnimElem = 4
x = 13

[State 1020, 6]
type = HitDef
trigger1 = AnimElem = 4
attr = S, SA
animtype  = Hard
damage    = 95, 5
getpower  = 0
priority  = 4
guardflag = MA
pausetime = 8,7
sparkxy = -10,-60
hitsound   = 5,4
guardsound = 6,0
ground.type = Low
ground.slidetime = 20
ground.hittime  = 22
ground.velocity = -8,-7
guard.velocity = -7
air.velocity = -8,-7
airguard.velocity = -5, -4
fall = 1
;p2stateno = 1025    ;Make p2 go to state 1025 on hit (P2StateNo is broken)
p2facing = 1        ;Force to face p1
id = 1020

[State 1020, Kung Fu Palm hits]
type = targetstate
trigger1 = NumTarget(1020)
trigger1 = MoveHit = 1
value = 1025

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

;------------------
; Hit by Fast Kung Fu Palm - shaking from the hit
; (a custom gethit state)
; See State 1020 for details
[Statedef 1025]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1025, Anim] ;Custom animation
type = ChangeAnim2
trigger1 = 1
value = 1025

[State 1025, State]
type = ChangeState
trigger1 = HitShakeOver = 1
value = 1026

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

[State 1026 VelSet]
type = velset
trigger1 = Time = 0
x = gethitvar(xvel)* facing
y = gethitvar(yvel)

[State 1026, Gravity]
type = VelAdd
trigger1 = 1
y = .45

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

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

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

;------------------
; Hit by Fast Kung Fu Palm - hit wall
; (a custom gethit state)
[Statedef 1027]
type    = A
movetype= H
physics = N

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

[State 1027, Pos]
type = PosAdd
trigger1 = Time = 0
x = 15 - BackEdgeBodyDist

[State 1027, Stop moving]
type = PosFreeze
trigger1 = 1
x = 1
y = 1

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

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

[State 1027, Anim]
type = ChangeAnim2
trigger1 = Time = 0
value = 1027

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

[State 1027, State]
type = ChangeState
trigger1 = AnimTime = 0
value = 1028

;------------------
; Hit by Fast Kung Fu Palm - bounce off wall
; (a custom gethit state)
[Statedef 1028]
type    = A
movetype= H
physics = N

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

[State 1028, Vel Y]
type = VelSet
trigger1 = Time = 0
y = -6

[State 1028, Vel X]
type = VelSet
trigger1 = Time = 0
x = 1.6

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

[State 1028, Gravity]
type = VelAdd
trigger1 = 1
y = .35

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

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

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

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

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

;---------------------------------------------------------------------------
; Kung Fu Knee
; CNS difficulty: medium
; Description: Like the Kung Fu Palm, this is a special attack. This attack
;     begins on the ground, launches KFM into the air, then ends when KFM
;     lands on the ground. To achieve this, we use three states. The first
;     has KFM starting on the ground (note that type = S in the Statedef).
;     The ChangeState controller brings KFM into the second state (state
;     1051) when his ground animation ends. The second state controls KFM's
;     movement into the air and back towards the ground. The last state
;     (state 1052) stops KFM from moving when he touches the ground, and
;     brings him back to his stand state (state 0) when the animation is
;     over. More details are given in comments before each of the following
;     states.
[Statedef 1050]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 55
velset = 0,0
anim = 1050
ctrl = 0
sprpriority = 2

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

[State 1050, 2]
type = null;PosAdd
trigger1 = AnimElem = 2
x = 15

[State 1050, 3]
type = PosAdd
trigger1 = AnimElem = 4
x = 20

[State 1050, 4]
type = HitDef
trigger1 = Time = 0
attr = A, SA
animtype  = Medium
damage    = 80, 4
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = -10,-70
hitsound   = 5,3
guardsound = 6,0
ground.type = Low
ground.slidetime = 20
ground.hittime  = 22
ground.velocity = -3.5,-7
guard.velocity = -7
air.velocity = -3.5,-7
fall = 1

[State 1050, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 1051

;------------------
; Light Kung Fu Knee - jump
; Description: This state uses a velset parameter in the Statedef to make
;     KFM move upwards. A value of 2,-6 means 2 pixels/tick forwards, and
;     6 pixels/tick upwards. Since this is an aerial state, the type is set
;     to A in the Statedef.
;     Notice that physics = N (N for None) here. This means we are not using
;     the built-in aerial physics model (physics = A), so we have complete
;     control over what KFM does in this state. Since we do not have
;     physics = A to take care of gravity for us, we need to put in our own
;     controller for that. Controller 1051,1 does the work of pulling KFM
;     down towards the ground. Controller 1051,2 checks if KFM has reached
;     the ground, and changes to state 1052 if so.
;     In this state's Statedef, we will use the hitdefpersist parameter to
;     retain the HitDef information from the last state. If we did not have
;     hitdefpersist, the HitDef will be turned off between state changes.
[Statedef 1051]
type    = A
movetype= A
physics = N
velset = 2,-6
anim = 1051
hitdefpersist = 1 ;Keep the HitDef from previous state active

[State 1051, 1] ;Gravity
type = VelAdd
trigger1 = 1
y = .45

[State 1051, 2]
type = ChangeState
trigger1 = NumExplod(90000230) || NumExplod(90000240)
trigger1 = Vel y < -1
value = 1055

[State 1051, 3] ;Change state when KFM is close to ground
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= -10
value = 1052

;------------------
; Light Kung Fu Knee - land
; Description: This is KFM's landing state. There is a velset in the
;     Statedef to stop KFM from moving. Since KFM's y-position can be any
;     number greater than -10 upon entering this state (see the ChangeState
;     controller in State 1051), we need to reset it to 0, the ground
;     level. That is what controller 1052,1 is for.
[Statedef 1052]
type    = S
movetype= I
physics = S
anim = 1052
sprpriority = 1
velset = 0,0

[State 1052, 1] ;Reset y-position to ground level
type = PosSet
trigger1 = Time = 0
y = 0

[State 1052, 2] ;Play a sound for landing
type = PlaySnd
trigger1 = Time = 0
value = 40, 0

[State 1052, 3] ;Give KFM back control early
type = CtrlSet
trigger1 = AnimElem = 3, -1
value = 1

[State 1052, 4] ;Move KFM back a little
type = PosAdd
trigger1 = AnimElem = 4
x = -15

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

;------------------
; Kung Fu Knee - kick
[Statedef 1055]
type    = A
movetype= A
physics = N
anim = 1055

[State 1055, 1]
type = PlaySnd
trigger1 = Time = 0
value = 100,0
channel = 0

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

[State 1055, 3]
type = PosAdd
trigger1 = Time = 0
x = 10
y = -10

[State 1055, 4] ;Gravity
type = VelAdd
trigger1 = 1
y = .45

[State 1055, 5]
type = HitDef
trigger1 = Time = 0
attr = A, SA
animtype  = Med
damage    = 35 + (prevstateno = 1061)*5, 2
priority  = 4
guardflag = MA
pausetime = 12,12
sparkxy = 0,-90
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 15
ground.hittime  = 18
ground.velocity = -6
guard.velocity = -8
guard.ctrltime = 12
air.velocity = -4,-5
airguard.velocity = -4,-4.5
air.fall = 1

[State 1055, 6] ;Change state when KFM is close to ground
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= -5
value = 1056

;------------------
; Kung Fu Knee - land from kick
[Statedef 1056]
type    = S
movetype= I
physics = S
anim = 1056
sprpriority = 1
velset = 0,0

[State 1056, 1] ;Reset y-position to ground level
type = PosSet
trigger1 = Time = 0
y = 0

[State 1056, 2] ;Play a sound for landing
type = PlaySnd
trigger1 = Time = 0
value = 40, 0

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

;---------------------------------------------------------------------------
; Strong Kung Fu Knee
[Statedef 1060]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 60
velset = 0,0
anim = 1060
ctrl = 0
sprpriority = 2

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

[State 1060, 2]
type = PosAdd
trigger1 = AnimElem = 2
x = 6

[State 1060, 3]
type = PosAdd
trigger1 = AnimElem = 4
x = 21

[State 1060, 4]
type = HitDef
trigger1 = Time = 0
attr = A, SA
animtype  = Medium
damage    = 90, 4
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = -10,-70
hitsound   = 5,3
guardsound = 6,0
ground.type = Low
ground.slidetime = 20
ground.hittime  = 22
ground.velocity = -3.5,-7.5
guard.velocity = -7
air.velocity = -3.5,-7.5
fall = 1

[State 1060, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 1061

;------------------
; Strong Kung Fu Knee - jump
[Statedef 1061]
type    = A
movetype= A
physics = N
velset = 2.5,-7.5
anim = 1061
hitdefpersist = 1 ;Keep the HitDef from previous state active

[State 1061, 1]
type = VelAdd
trigger1 = 1
y = .45

[State 1061, 2]
type = ChangeState
trigger1 = NumExplod(90000230) || NumExplod(90000240)
trigger1 = Vel y < -1
value = 1055

[State 1061, 3]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= -10
value = 1052

;---------------------------------------------------------------------------
; Fast Kung Fu Knee
; Description: This version of the Kung Fu Knee hits up to 3 times (including
;     the kick).
[Statedef 1070]
type    = S
movetype= A
physics = S
juggle  = 6
poweradd= -330
velset = 0,0
anim = 1070
ctrl = 0
sprpriority = 2

[State 1070, Afterimage]
type = AfterImage
trigger1 = Time = 0
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 = 2

[State 1070, Afterimage]
type = AfterImageTime
trigger1 = 1
time = 2

[State 1070, Blink Yellow]
type = PalFX
trigger1 = Time = 0
time = 20
add = 32,16,0
sinadd = 64,32,5,3

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

[State 1070, 2]
type = PosAdd
trigger1 = AnimElem = 2
x = 6

[State 1070, 3]
type = PosAdd
trigger1 = AnimElem = 4
x = 21

[State 1070, 4]
type = HitDef
trigger1 = Time = 0
attr = S, SA
animtype  = Medium
getpower  = 0
damage    = 35, 3
priority  = 5
hitflag   = MA
guardflag = MA
pausetime = 8,7
sparkxy = -10,-70
hitsound   = 5,2
guardsound = 6,0
ground.type = Low
ground.slidetime = 18
ground.hittime  = 20
ground.velocity = -2,-6
guard.velocity = -7
air.velocity = -2,-6
fall = 1
fall.animtype = Med
fall.recovertime = 30

[State 1070, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 1071

;------------------
; Fast Kung Fu Knee - jump
[Statedef 1071]
type    = A
movetype= A
physics = N
velset = 2.5,-9
anim = 1071

[State 1071, Blink Yellow]
type = PalFX
trigger1 = Time = 0
time = 18
add = 32,16,0
sinadd = 64,32,5,3

[State 1071, Afterimage]
type = AfterImageTime
trigger1 = Vel Y < 0
time = 2

[State 1071, 1]
type = VelAdd
trigger1 = 1
y = .5

[State 1071, 2]
type = VelAdd
trigger1 = Vel Y >= -1
y = .2

[State 1071, 3]
type = HitDef
trigger1 = Time = 0
attr = A, SA
animtype  = Medium
getpower  = 0
damage    = 68, 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  = 20
ground.velocity = -3,-9.5
guard.velocity = -7
air.velocity = -3,-9.5
fall = 1
fall.recovertime = 30

[State 1071, 4]
type = ChangeState
trigger1 = NumExplod(90000230) || NumExplod(90000240)
trigger1 = Vel y < -1
trigger1 = Time > 0
value = 1075

[State 1071, 5]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= -10
value = 1052

;------------------
; Fast Kung Fu Knee - kick
[Statedef 1075]
type    = A
movetype= A
physics = N
anim = 1055

[State 1075, Afterimage]
type = AfterImageTime
trigger1 = 1
time = 2

[State 1075, Blink Yellow]
type = PalFX
trigger1 = Time = 0
time = 20
add = 32,16,0
sinadd = 64,32,5,3

[State 1075, 1]
type = PlaySnd
trigger1 = Time = 0
value = 100,0
channel = 0

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

[State 1075, 3]
type = PosAdd
trigger1 = Time = 0
x = 10
y = -10

[State 1075, 4] ;Gravity
type = VelAdd
trigger1 = 1
y = .45

[State 1075, 5]
type = VelAdd
trigger1 = Vel Y >= -1
y = .2

[State 1075, 6]
type = HitDef
trigger1 = Time = 0
attr = A, SA
animtype  = Med
damage    = 42, 2
getpower  = 0
priority  = 4
guardflag = MA
pausetime = 12,12
sparkxy = 0,-90
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -6
guard.velocity = -6
air.velocity = -4,-6
airguard.velocity = -4,-4.5
air.fall = 1

[State 1075, 7] ;Change state when KFM is close to ground
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= -5
value = 1056


;---------------------------------------------------------------------------
; Light Kung Fu Upper
; CNS difficulty: easy
; Description: This is a simple special attack that can hit twice. Notice
;     the use of the Width controller to keep opponents from getting too
;     close to KFM during his uppercut (press Ctrl-C, and look at the
;     yellow bar at KFM's feet during the move).
;     The second HitDef has some interesting parameters. fall.recovertime
;     is used to prevent the opponent (p2) from recovering immediately
;     after being hit (eg. press x+y with KFM to recover). This gives the
;     attacking KFM a chance to follow up with an extra attack, such as
;     a Kung Fu Knee. The yaccel parameter, set at 0.4, makes p2 fall at a
;     greater value of acceleration than the default, which is 0.35.
[Statedef 1100]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 55
velset = 0,0
anim = 1100
ctrl = 0
sprpriority = 2

[State 1100, Width]
type = Width
trigger1 = AnimElemTime(4) >= 0 && AnimElemTime(13) < 0
value = 5,0

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

[State 1100, 2]
type = HitDef
trigger1 = Time = 0
attr = S, SA
animtype  = Med
damage    = 52, 4
priority  = 5
guardflag = MA
pausetime = 4,8
sparkxy = 0,-48
hitsound   = 5,2
guardsound = 6,0
ground.type = Low
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -3
guard.velocity = -6
air.velocity = -2,-2
airguard.velocity = -4,-4.5
p2facing = 1
forcestand = 1         ;Force p2 into a standing state if hit

[State 1100, 3]
type = HitDef
trigger1 = AnimElem = 7
attr = S, SA
animtype  = Up
damage    = 55, 4
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = 0,-110
hitsound   = 5,2
guardsound = 6,0
ground.type = Low
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -1,-9.5
guard.velocity = -6
air.velocity = -1,-7.5
airguard.velocity = -4,-4.5
p2facing = 1
fall = 1                   ;Make p2 fall down
fall.recovertime = 40      ;40 ticks before p2 can recover from fall
yaccel = .4                ;p2 will accelerate down at .4 pixels/sec^2 when falling

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

;---------------------------------------------------------------------------
; Strong Kung Fu Upper
[Statedef 1110]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 60
velset = 0,0
anim = 1110
ctrl = 0
sprpriority = 2

[State 1110, Width]
type = Width
trigger1 = AnimElemTime(4) >= 0 && AnimElemTime(14) < 0
value = 5,0

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

[State 1110, 2]
type = HitDef
trigger1 = Time = 0
attr = S, SA
animtype  = Med
damage    = 57, 4
priority  = 5
guardflag = MA
pausetime = 4,8
sparkxy = 0,-48
hitsound   = 5,2
guardsound = 6,0
ground.type = Low
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -3
guard.velocity = -6
air.velocity = -2,-2
airguard.velocity = -4,-4.5
p2facing = 1
forcestand = 1

[State 1110, 3]
type = HitDef
trigger1 = AnimElem = 7
attr = S, SA
animtype  = Up
damage    = 60, 4
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = 0,-110
hitsound   = 5,2
guardsound = 6,0
ground.type = Low
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -1,-10.5
guard.velocity = -6
air.velocity = -1,-8.5
airguard.velocity = -4,-4.5
p2facing = 1
fall = 1
fall.recovertime = 50
yaccel = .4

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

;---------------------------------------------------------------------------
; Fast Kung Fu Upper
[Statedef 1120]
type    = S
movetype= A
physics = S
juggle  = 6
poweradd= -330
velset = 0,0
anim = 1120
ctrl = 0
sprpriority = 2

[State 1120, Width]
type = Width
trigger1 = AnimElemTime(4) >= 0 && AnimElemTime(14) < 0
value = 5,0

[State 1120, Afterimage]
type = AfterImage
trigger1 = Time = 0
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 = 2

[State 1120, Afterimage]
type = AfterImageTime
trigger1 = AnimTime < -2
time = 2

[State 1120, Blink Yellow]
type = PalFX
trigger1 = Time = 0
time = 20
add = 32,16,0
sinadd = 64,32,5,3

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

[State 1120, 2]
type = HitDef
trigger1 = Time = 0
trigger2 = AnimElem = 4
attr = S, SA
animtype  = Med
damage    = 30, 4
getpower  = 0
priority  = 5
guardflag = MA
pausetime = 6,10
sparkxy = 0, ifelse(Time = 0, -48, -55)
hitsound   = 5,2
guardsound = 6,0
ground.type = Low
ground.slidetime = 18
ground.hittime  = 23
ground.velocity = -3
guard.velocity = -6
air.velocity = -2,-2
airguard.velocity = -4,-4.5
p2facing = 1
forcestand = 1

[State 1120, 3]
type = HitDef
trigger1 = AnimElem = 7
attr = S, SA
animtype  = Up
damage    = 68, 4
getpower  = 0
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = 0,-110
hitsound   = 5,2
guardsound = 6,0
ground.type = Low
ground.slidetime = 18
ground.hittime  = 23
ground.velocity = -1.2,-11
guard.velocity = -6
air.velocity = -1.2,-9
airguard.velocity = -4,-4.5
p2facing = 1
fall = 1
fall.recovertime = 60
yaccel = .4

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

;---------------------------------------------------------------------------
; Light Kung Fu Blow
; CNS difficulty: easy
; Notes: This uses the EnvShake controller to shake the screen. It makes the
;        move look stronger.
[Statedef 1200]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 50
velset = 0,0
anim = 1200
ctrl = 0
sprpriority = 2

[State 1200, 1]
type = PlaySnd
trigger1 = AnimElem = 4
value = 0, 3

[State 1200, Width 1]
type = Width
trigger1 = AnimElemTime(5) >= 0 && AnimElemTime(6) < 0
value = 10,0

[State 1200, Width 2]
type = Width
trigger1 = AnimElemTime(6) >= 0 && AnimElemTime(9) < 0
value = 20,0

[State 1200, Shake Screen]
type = EnvShake
trigger1 = AnimElem = 6
time = 4     ;Time to shake screen
ampl = 2     ;Amount to shake
freq = 180   ;A frequency of 180 shakes the screen rapidly

[State 1200, 2]
type = HitDef
trigger1 = Time = 0
attr = S, SA
animtype  = Hard
damage    = 100, 6
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = 0,-65
hitsound   = 5,3
guardsound = 6,0
ground.type = Low
ground.slidetime = 16
ground.hittime  = 20
ground.velocity = -10
ground.cornerpush.veloff = -12 ;To push far away when p2 is in corner
guard.velocity = -7
air.velocity = -3.5,-4.5
airguard.velocity = -3.5,-4.5

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

;---------------------------------------------------------------------------
; Strong Kung Fu Blow
; CNS difficulty: easy
[Statedef 1210]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 60
velset = 0,0
anim = 1210
ctrl = 0
sprpriority = 2

[State 1210, 1]
type = PlaySnd
trigger1 = AnimElem = 4
value = 0, 3

[State 1210, Width 1]
type = Width
trigger1 = AnimElemTime(5) >= 0 && AnimElemTime(6) < 0
value = 10,0

[State 1210, Width 2]
type = Width
trigger1 = AnimElemTime(6) >= 0 && AnimElemTime(9) < 0
value = 20,0

[State 1210, Shake Screen]
type = EnvShake
trigger1 = AnimElem = 6
time = 8
ampl = 2
freq = 170   ;A frequency of less than 180 causes a dampening effect

[State 1210, 2]
type = HitDef
trigger1 = Time = 0
attr = S, SA
animtype  = Hard
damage    = 125, 9
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = 0,-65
hitsound   = 5,3
guardsound = 6,0
ground.type = Low
ground.slidetime = 18
ground.hittime  = 22
ground.velocity = -10
ground.cornerpush.veloff = -15 ;To push far away when p2 is in corner
guard.velocity = -8
air.velocity = -4,-4.5
airguard.velocity = -4,-4.5

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

;---------------------------------------------------------------------------
; Fast Kung Fu Blow
; CNS difficulty: easy
[Statedef 1220]
type    = S
movetype= A
physics = S
juggle  = 6
poweradd= -330
velset = 0,0
anim = 1220
ctrl = 0
sprpriority = 2

[State 1220, Afterimage]
type = AfterImage
trigger1 = Time = 0
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 = 2

[State 1220, Afterimage]
type = AfterImageTime
trigger1 = AnimTime < -2
time = 2

[State 1220, Blink Yellow]
type = PalFX
trigger1 = Time = 0
time = 20
add = 32,16,0
sinadd = 64,32,5,3

[State 1220, 1]
type = PlaySnd
trigger1 = AnimElem = 4
value = 0, 3

[State 1220, Width 1]
type = Width
trigger1 = AnimElemTime(5) >= 0 && AnimElemTime(6) < 0
value = 10,0

[State 1220, Width 2]
type = Width
trigger1 = AnimElemTime(6) >= 0 && AnimElemTime(9) < 0
value = 20,0

[State 1220, Shake Screen]
type = EnvShake
trigger1 = AnimElem = 6
time = 8
ampl = 3
freq = 170

[State 1220, 2]
type = HitDef
trigger1 = Time = 0
attr = S, SA
animtype  = Hard
damage    = 125, 9
getpower  = 0
priority  = 5
guardflag = MA
pausetime = 15,15
sparkxy = 0,-65
hitsound   = 5,4
guardsound = 6,0
ground.type = Low
ground.slidetime = 20
ground.hittime  = 32
ground.velocity = -15
ground.cornerpush.veloff = -20 ;To push far away when p2 is in corner
guard.velocity = -9
air.velocity = -5,-5
airguard.velocity = -5,-5
air.fall = 1
fall.animtype = Hard           ;Show "hard" animtype when hit for a fall
yaccel = .4                    ;Fall faster

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


;---------------------------------------------------------------------------
; Kung Fu Blocking High
; CNS difficulty: medium
; Notes: This move uses a ReversalDef controller to counter attacks. Any
;        attacks not caught by the ReversalDef are handled by the HitOverride.
;        The movetype is Idle because this is not an attack.
[Statedef 1300]
type    = S
movetype= I
physics = S
velset = 0,0
anim = 1300
ctrl = 0
sprpriority = 1

[State 1300, Width]
type = Width
trigger1 = AnimElemTime(3) < 0
value = 15,0

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

[State 1300, 2]
type = ReversalDef
trigger1 = Time = 0
reversal.attr = SA, AA
pausetime = 0,0
sparkno = 40
sparkxy = 40,0
hitsound = 6,0
p1stateno = 1310
p1sprpriority = 2 ;Set P1's sprite in front of P2's
p2sprpriority = 1

[State 1300, 3] ;Stop ReversalDef
type = ReversalDef
trigger1 = Time = 4
trigger1 = ((ifElse(P2DisT x < 0, Facing = -1, Facing = 1) && NumExplod(90000006)) || (ifElse(P2DisT x < 0, Facing = 1, Facing = -1) && NumExplod(90000004))) 
trigger2 = Time = 8
reversal.attr =

[State 1300, 4]
type = HitOverride
trigger1 = Time = 0
attr = SA, AP
stateno = 1310
time = 8

[State 1300, 5]
type = HitOverride
trigger1 = Time = 4
trigger1 = ((ifElse(P2DisT x < 0, Facing = -1, Facing = 1) && NumExplod(90000006)) || (ifElse(P2DisT x < 0, Facing = 1, Facing = -1) && NumExplod(90000004)))
attr =
time = 0

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

;---------------------------------------------------------------------------
; Kung Fu Blocking High (blocked)
; Notes: This state uses a Pause controller to freeze the action dramatically.
[Statedef 1310]
type    = S
movetype= I
physics = S
velset = 0,0
anim = 1310
ctrl = 0
sprpriority = 2

[State 1310, 1]
type = Pause
trigger1 = Time = 0
time = 20
endcmdbuftime = 20 ;Buffer commands input during the pause
pausebg = 0        ;Don't pause backgrounds

[State 1310, 2]    ;Go to guarding
type = ChangeState
trigger1 = Time = 1
trigger1 = ((ifElse(P2DisT x < 0, Facing = -1, Facing = 1) && NumExplod(90000004)) || (ifElse(P2DisT x < 0, Facing = 1, Facing = -1) && NumExplod(90000006)))
value = 130
ctrl = 1

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

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

;---------------------------------------------------------------------------
; Kung Fu Blocking Low
[Statedef 1320]
type    = C
movetype= I
physics = C
velset = 0,0
anim = 1320
ctrl = 0
sprpriority = 1

[State 1320, Width]
type = Width
trigger1 = AnimElemTime(3) < 0
value = 10,0

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

[State 1320, 2]
type = ReversalDef
trigger1 = Time = 0
reversal.attr = C, AA
pausetime = 0,0
sparkno = 40
sparkxy = 40,0
hitsound = 6,0
p1stateno = 1330
p1sprpriority = 2
p2sprpriority = 1

[State 1320, 3] ;Stop
type = ReversalDef
trigger1 = Time = 5
reversal.attr =

[State 1320, 4]
type = HitOverride
trigger1 = Time < 5
attr = C, AP
stateno = 1330

[State 1320, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 11+(!NumExplod(90000001) && !NumExplod(90000002) && !NumExplod(90000003))
ctrl = 1

;---------------------------------------------------------------------------
; Kung Fu Blocking Low (blocked)
[Statedef 1330]
type    = C
movetype= I
physics = C
velset = 0,0
anim = 1330
ctrl = 0
sprpriority = 2

[State 1330, 1]
type = Pause
trigger1 = Time = 0
time = 20
endcmdbuftime = 20 ;Buffer commands input during the pause
pausebg = 0        ;Don't pause backgrounds

[State 1330, 2]
type = ChangeState
trigger1 = Time = 1
trigger1 = ((ifElse(P2DisT x < 0, Facing = -1, Facing = 1) && NumExplod(90000004)) || (ifElse(P2DisT x < 0, Facing = 1, Facing = -1) && NumExplod(90000006)))
value = 131
ctrl = 1

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

[State 1330, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 11+(!NumExplod(90000001) && !NumExplod(90000002) && !NumExplod(90000003))
ctrl = 1

;---------------------------------------------------------------------------
; Kung Fu Blocking Air
[Statedef 1340]
type    = A
movetype= I
physics = N
anim = 1340
ctrl = 0
sprpriority = 1

[State 1340, Width]
type = Width
trigger1 = AnimElemTime(3) < 0
value = 10,0

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

[State 1340, 2]
type = ReversalDef
trigger1 = Time = 0
reversal.attr = A, AA
pausetime = 0,0
sparkno = 40
sparkxy = 40,0
hitsound = 6,0
p1stateno = 1350
p1sprpriority = 2
p2sprpriority = 1

[State 1340, 3] ;Stop
type = ReversalDef
trigger1 = Time = 5
reversal.attr =

[State 1340, 4]
type = HitOverride
trigger1 = Time < 5
attr = SA, AP
stateno = 1350

[State 1340, 5]
type = CtrlSet
trigger1 = AnimElem = 4
value = 1

[State 1340, 6] ;Gravity
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)

[State 1340, 6] ;Land from jump
type = ChangeState
trigger1 = (Pos Y >= 0) && (Vel Y > 0)
value = 1351

;---------------------------------------------------------------------------
; Kung Fu Blocking Air (blocked)
[Statedef 1350]
type    = A
movetype= I
physics = N
anim = 1350
ctrl = 0
sprpriority = 2

[State 1350, 1]
type = Pause
trigger1 = Time = 0
time = 20
endcmdbuftime = 20 ;Buffer commands input during the pause
pausebg = 0        ;Don't pause backgrounds

[State 1350, 2]
type = ChangeState
trigger1 = Time = 1
trigger1 = ((ifElse(P2DisT x < 0, Facing = -1, Facing = 1) && NumExplod(90000004)) || (ifElse(P2DisT x < 0, Facing = 1, Facing = -1) && NumExplod(90000006)))
value = 132
ctrl = 1

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

[State 1350, 4] ;Stop KFM in the air
type = PosFreeze
trigger1 = AnimElemTime(3) < 0

[State 1350, 5]
type = CtrlSet
trigger1 = AnimElem = 3
value = 1

[State 1350, 6] ;Gravity
type = VelAdd
trigger1 = AnimElemTime(3) > 0
y = Const(movement.yaccel)

[State 1350, 7] ;Land from jump
type = ChangeState
trigger1 = (Pos Y >= 0) && (Vel Y > 0)
value = 1351

;---------------------------------------------------------------------------
; Kung Fu Blocking Air (land)
[Statedef 1351]
type    = S
physics = S
ctrl = 0
anim = 47

[State 1351, 1]
type = VelSet
trigger1 = Time = 0
y = 0

[State 1351, 2]
type = PosSet
trigger1 = Time = 0
y = 0

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

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

[State 1351, 5] ;Go to high block
type = ChangeState
triggerall = ((ifElse(P2DisT x < 0, Facing = -1, Facing = 1) && NumExplod(90000016)) || (ifElse(P2DisT x < 0, Facing = 1, Facing = -1) && NumExplod(90000014)))
trigger1 = NumExplod(90000200) 
value = 1300

[State 1351, 6] ;Go to low block
type = ChangeState
triggerall = ((ifElse(P2DisT x < 0, Facing = -1, Facing = 1) && NumExplod(90000013)) || (ifElse(P2DisT x < 0, Facing = 1, Facing = -1) && NumExplod(90000011)))
trigger1 = NumExplod(90000200) 
value = 1320

;The Kung Fu Zankou will teach you how to properly make a move that acts as a projectile reflector
;See State 1500 for details on the actual projectile

;---------------------------------------------------------------------------
; Light Kung Fu Zankou
; CNS difficulty: easy
[Statedef 1400]
type    = S
movetype= A
physics = N
juggle  = 4
poweradd= 50
velset = 0,0
anim = 1400
ctrl = 0
sprpriority = 2

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

[State 1400, Friction]
type = VelMul
trigger1 = 1
x = 0.5

;---------------------------------------------------
;This helper will act as a reflector
[State 1400: Helper]
type = helper
trigger1 = !NumHelper(1435);use this trigger so the helper will not be created multiple times in 1 move
trigger1 = AnimElem = 1
id = 1435
pos = 0,0 ;50
postype = p1
facing = 1
stateno = 1435
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0
persistent = 0

;which direction do you wish reflected projectile to go?
;[State 0, Explod]
;type = Explod
;trigger1 = NumHelper(1435)
;anim = 1
;ID = 262142 ; 262141 = diag up reflection 262142 = straight reflection 262143 = diag down reflection 262144 = reverse Y vel only
;removetime = 1
;by using none of these you use the default reflection method. See stateno 1510 and 1520 for details

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

[State 1400, 2]
type = HitDef
trigger1 = Time = 0
attr = S, SA
animtype  = Hard
damage    = 100, 6
priority  = 4
guardflag = MA
pausetime = 12,12
sparkxy = 0,-65
hitsound   = 5,3
guardsound = 6,0
ground.type = Low
ground.slidetime = 12
ground.hittime  = 17
ground.velocity = -9
ground.cornerpush.veloff = -15 ;To push far away when p2 is in corner
guard.velocity = -9
air.velocity = -2,-5
airguard.velocity = -3.5,-4.5
air.fall = 1

[State 1400, 3]
type = PosAdd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 3
trigger3 = AnimElem = 4
x = 10

[State 1400, 4]
type = VelSet
trigger1 = AnimElem = 4
x = 2

[State 1400, 5]
type = PosAdd
trigger1 = AnimElem = 8
x = 10

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

;---------------------------------------------------------------------------
; Strong Kung Fu Zankou
; CNS difficulty: easy
[Statedef 1410]
type    = S
movetype= A
physics = N
juggle  = 4
poweradd= 50
velset = 0,0
anim = 1410
ctrl = 0
sprpriority = 2

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

[State 1410, Friction]
type = VelMul
trigger1 = 1
x = 0.65

;---------------------------------------------------
;This helper will act as a reflector
[State 1410: Helper]
type = helper
trigger1 = !NumHelper(1435);use this trigger so the helper will not be created multiple times in 1 move
trigger1 = AnimElem = 4
id = 1435
pos = 0,0 ;50
postype = p1
facing = 1
stateno = 1435
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0
persistent = 0

;which direction do you wish reflected projectile to go?
;[State 0, Explod]
;type = Explod
;trigger1 = NumHelper(1435)
;anim = 1
;ID = 262142 ; 262141 = diag up reflection 262142 = straight reflection 262143 = diag down reflection 262144 = reverse Y vel only
;removetime = 1
;by using none of these you use the default reflection method. See stateno 1510 and 1520 for details

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

[State 1410, 2]
type = HitDef
trigger1 = Time = 0
attr = S, SA
animtype  = Hard
damage    = 100, 6
priority  = 4
guardflag = MA
pausetime = 12,12
sparkxy = 0,-65
hitsound   = 5,3
guardsound = 6,0
ground.type = Low
ground.slidetime = 12
ground.hittime  = 17
ground.velocity = -9
ground.cornerpush.veloff = -15 ;To push far away when p2 is in corner
guard.velocity = -9
air.velocity = -2,-5
airguard.velocity = -3.5,-4.5
air.fall = 1

[State 1410, 3]
type = PosAdd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 3
trigger3 = AnimElem = 4
x = 10

[State 1410, 4]
type = VelSet
trigger1 = AnimElem = 3
x = 8

[State 1410, 5]
type = PosAdd
trigger1 = AnimElem = 9
x = 10

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

;---------------------------------------------------------------------------
; Far Kung Fu Zankou
; CNS difficulty: easy
[Statedef 1420]
type    = S
movetype= A
physics = N
juggle  = 6
poweradd= -330
velset = 0,0
anim = 1420
ctrl = 0
sprpriority = 2

[State 1420, Afterimage]
type = AfterImage
trigger1 = Time = 0
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 = 2

[State 1420, Afterimage]
type = AfterImageTime
trigger1 = AnimElemTime(8) < 0
time = 2

[State 1420, Blink Yellow]
type = PalFX
trigger1 = Time = 0
time = 20
add = 32,16,0
sinadd = 64,32,5,3

;---------------------------------------------------
;This helper will act as a reflector
[State 1420: Helper]
type = helper
trigger1 = !NumHelper(1435);use this trigger so the helper will not be created multiple times in 1 move
trigger1 = AnimElem = 3
id = 1435
pos = 0,0 ;50
postype = p1
facing = 1
stateno = 1435
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0
persistent = 0

;which direction do you wish reflected projectile to go?
;[State 0, Explod]
;type = Explod
;trigger1 = NumHelper(1435)
;anim = 1
;ID = 262142 ; 262141 = diag up reflection 262142 = straight reflection 262143 = diag down reflection 262144 = reverse Y vel only
;removetime = 1
;by using none of these you use the default reflection method. See stateno 1510 and 1520 for details

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

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

[State 1420, Friction]
type = VelMul
trigger1 = 1
x = 0.7

[State 1420, 2]
type = HitDef
trigger1 = AnimElemTime(4) = -2
attr = S, SA
animtype  = Hard
damage    = 25, 2
getpower  = 0
priority  = 4
guardflag = MA
pausetime = 9,9
sparkxy = -15,-45
hitsound   = 5,2
guardsound = 6,0
ground.type = Low
ground.slidetime = 22
ground.hittime  = 24
ground.velocity = -7
ground.cornerpush.veloff = -8 ;To push far away when p2 is in corner
guard.velocity = -9
air.velocity = -5,-4
airguard.velocity = -3.5,-4.5

[State 1420, 2]
type = HitDef
trigger1 = AnimElem = 4
attr = S, SA
animtype  = Hard
damage    = 100, 8
getpower  = 0
priority  = 5
guardflag = MA
pausetime = 12,12
sparkxy = 0,-65
hitsound   = 5,3
guardsound = 6,0
ground.type = Low
ground.slidetime = 22
ground.hittime  = 24
ground.velocity = -5,-4
ground.cornerpush.veloff = -15 ;To push far away when p2 is in corner
guard.velocity = -9
air.velocity = -5,-4
airguard.velocity = -3.5,-4.5
fall = 1

[State 1420, 3]
type = PosAdd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 3
trigger3 = AnimElem = 4
x = 10

[State 1420, 4]
type = VelSet
trigger1 = AnimElemTime(3) = [1,2]
x = 20

[State 1420, 5]
type = PosAdd
trigger1 = AnimElem = 10
x = 10

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

;---------------------------------------------------------------------------
;This is the helper created in Kung Fu Zankou
;this state sets a sysvar that the projectile "talks" to and destroys
;---------------------------------------------------------------------------
;Reflector Helper 
; CNS difficulty: hard
[Statedef 1435]
type = S
movetype = A
physics = N
ctrl = 0
velset = 0, 0
anim = 1430
sprpriority = 4

;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY    ;
;飛び道具を跳ね返し行動設定                   ;
;by Vans                                ;
;GUIDE:                                 ;
;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで	;
;sysvar(0) = 262144　　                	;
;=======================================;
[State 1435, COMPATIBILITY]
type = VarSet
trigger1 = !time && !prevstateno
sysvar(0) = 262144
;=======================================;

[State 1435, REFLECTOR]
type = ReversalDef
trigger1 = root,StateNo != 1420
reversal.attr = SCA,NP,SP;,HP  this move will not reflect Hyper Projectiles
pausetime = 0,0
sparkno = -1
sparkxy = 0,0
p1stateno = 1436 ;(it is okay to use p1stateno and p2stateno in reversaldef)
p2stateno = 1437
id = 1435
numhits = 0

[State 1435, EX REFLECTOR]
type = ReversalDef
trigger1 = root,StateNo = 1420
reversal.attr = SCA,NP,SP, HP ;the EX version WILL reflect Hyper Projectiles
pausetime = 0,0
sparkno = -1
sparkxy = 0,0
p1stateno = 1436 ;(it is okay to use p1stateno and p2stateno in reversaldef)
p2stateno = 1437
id = 1435
numhits = 0

[State 1435, projs only]
type = HitBy
trigger1 = root,StateNo != 1420
value = SCA, NP, SP;, HP this move will not reflect Hyper Projectiles
ignorehitpause = 1

[State 1435, projs only]
type = HitBy
trigger1 = root,StateNo = 1420
value = SCA, NP, SP, HP ;the EX version WILL reflect Hyper Projectiles
ignorehitpause = 1

[State 1435, override]
type = HitOverride
trigger1 = !time
attr = SCA, AA, AP, AT
stateno = 1436
time = -1
ignorehitpause = 1

[State 1435]
type = BindToParent
trigger1 = 1
pos = 0,0
ignorehitpause = 1

[State 1435, Assert];redundant since it wouldn't cast a shadow anyway because there is no sprite in anim 1430. You'd want this if they used an energy shield to reflect
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 1435, DestroySelf]
type = DestroySelf
trigger1 = root, StateNo = [1400,1420]
trigger1 = root, AnimElemTime(5) >=0
trigger2 = root, MoveType = H

;---------------------------
;Successful Reflection
[Statedef 1436]
type = S
movetype = I
physics = N
ctrl = 0
velset = 0, 0
anim = 1
sprpriority = 4

[State 1436, VarSet]
type = VarSet
trigger1 = numtarget
var(0) = target,ID
persistent = 0
ignorehitpause = 1

[State 1436, DEBUG]
type = DisplayToClipboard
trigger1 = 1
text = "var(0) = %d proj = %d ID = %d";Buff = %d GNDTYPE = %d"
params = var(0),numprojid(262144),gethitvar(chainid)
ignorehitpause = 1

;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY    ;
;飛び道具を跳ね返し行動設定                   ;
;by Vans                                ;
;GUIDE:                                 ;
;FOR PROJECTILE / 飛び道具で              	;
;sysvar(0) = 131072                     ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE   ;
;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで	;
;sysvar(0) = 262144　　                   ;
;sysvar(1) = SPECIAL                    ;
;=======================================;
[State 1436, VarSet]
type = VarSet
;RETURNING YOUR OWN PROJECTILE
;自分の飛び道具を跳ね返す。
trigger1 = Gethitvar(chainid)&2**17
sysvar(1) = sysvar(0)
[State 1436, ChangeState]
type = ChangeState
trigger1 = PlayerIDExist(var(0))
trigger1 = (PlayerID(var(0)),sysvar(0)=131072) 
;RETURNING YOUR OWN PROJECTILE
;自分の飛び道具を跳ね返す。
trigger2 = Gethitvar(chainid)&2**17
value = 1441
ctrl = 0
;=======================================;

;if the opponent does not have the standard you will fire your own projectile
[State 0, ChangeState]
type = ChangeState
trigger1 = !time 
value = 1590

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

;---------------------------
;Reflecting A Helper projectile
[Statedef 1437]
physics = N
movetype = I
ctrl = 0

[State 1437, DEBUG]
type = DisplayToClipboard
trigger1 = 1
text = "sysvar(0) = %d pao pao cafe = %d";Buff = %d GNDTYPE = %d"
params = sysvar(0),sysvar(0)&2**17
ignorehitpause = 1

[State 1437]
type = SelfState
trigger1 = sysvar(0)&2**17
value = sysvar(1)
ctrl = 0

[State 1437]
type = DestroySelf 
trigger1 = IsHelper
trigger1 = time = 5
ignorehitpause = 1

[State 1437]
type = SelfState
trigger1 = !IsHelper
value = 0
ctrl = 1

[State 1437, Anim]
Type = ChangeAnim2
Trigger1 = !Time
Value = 1 ;don't forget to add this anim to your .air -1,-1, 0,0, 1
;the anim number does not have to be 1

;---------------------------
;Successful Reflection
[Statedef 1438]
type = S
movetype = I
physics = N
ctrl = 0
velset = 0, 0
anim = 1
sprpriority = 4

[State 1436, VarSet]
type = VarSet
trigger1 = numtarget
var(0) = target,ID
persistent = 0
ignorehitpause = 1

[State 1436, DEBUG]
type = DisplayToClipboard
trigger1 = 1
text = "var(0) = %d proj = %d ID = %d";Buff = %d GNDTYPE = %d"
params = var(0),numprojid(262144),gethitvar(chainid)
ignorehitpause = 1

;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY    ;
;飛び道具を跳ね返し行動設定                   ;
;by Vans                                ;
;GUIDE:                                 ;
;FOR PROJECTILE / 飛び道具で              	;
;sysvar(0) = 131072                     ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE   ;
;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで	;
;sysvar(0) = 262144　　                   ;
;sysvar(1) = SPECIAL                    ;
;=======================================;
[State 1436, VarSet]
type = VarSet
;RETURNING YOUR OWN PROJECTILE
;自分の飛び道具を跳ね返す。
trigger1 = Gethitvar(chainid)&2**17
sysvar(1) = sysvar(0)
[State 1436, ChangeState]
type = ChangeState
trigger1 = PlayerIDExist(var(0))
trigger1 = (PlayerID(var(0)),sysvar(0)=131072) 
;RETURNING YOUR OWN PROJECTILE
;自分の飛び道具を跳ね返す。
trigger2 = Gethitvar(chainid)&2**17
value = 1441
ctrl = 0
;=======================================;

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

;the following 3 states are to make sure that you reflect something back if the opponent does not have this standard set.
;in this case you will destroy their helper then fire one of your own

;-----------------------------------------
; Noncompatible Reflect with projectile
[Statedef 1590]
type = A
physics = N
MoveType = I
ctrl = 0
anim = 1

[State 1592, NotHitBy]
type = NotHitBy
trigger1 = 1
Time = 1
value = SCA
ignorehitpause = 1

[State 1592, reflected]
type = Helper
trigger1 = !Time
Helpertype = normal
stateno = 1591
ID = 1591
name = "Reflected"
postype = p1
pos = 40,-60
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 1592, End]
type = ChangeState
trigger1 = 1
value = 1592

 ;-----------------------------------------
; Noncompatible Destroyed
[Statedef 1592]
type = A
physics = N
MoveType = I
velset = 0, 0
ctrl = 0
sprpriority = 1
anim = 1

[State 3000, nhb]
type = NotHitBy
trigger1 = 1
Time = 1
value = SCA
ignorehitpause = 1

[State 1306, End]
type = DestroySelf
trigger1 = !animTime

;---------------------------------------------------------------------------
; Noncompatible Reflected Projectile Helper
; CNS difficulty: hard
[Statedef 1591]
type    = A
movetype= A
physics = N
;juggle  = 6 Note that if you actually use juggle points for the helper they will only add to the helper's juggle points. Not the root's (KFM's)
anim = 1520
ctrl = 0
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

;IF this was a fireball you would use this. As a piece of wood we will allow it to cast a shadow
;[State 1510, NoShadow]
;type = AssertSpecial
;trigger1 = 1
;flag = noshadow
;ignorehitpause = 1


[State 1510, VelSet]
type = VelSet
trigger1 = Time >= 0
x = 4
y = 0

[State 1510, Velocity]
type = VelSet
trigger1 = Movecontact ;stop moving when the board connects
x = 0
y = 0

[State 1510, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT ; The helper can't be hit by anything except Projectiles
ignorehitpause = 1

[State 1510, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP ; Only Projectiles will hit. This allows other projectiles to destroy this one
time = 1
ignorehitpause = 1

[State 1510, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1511   ; when hit the Projectile will go to this state. It's destroyed state
attr = SCA, AA, AP, AT
ignorehitpause = 1

[State 1510, Hitdef]
type = HitDef
trigger1 = AnimElem = 1
id = 1510 ;set as same as stateno
attr = A, SP ; VERY IMPORTANT always remember to set your attr to NP, SP, or HP (Normal, Special, Hyper Projectile)
animtype  = hard
damage    = 20
priority  = 4,Hit
guardflag = MA
hitflag = MAF
pausetime = 0,10
sparkxy = 0,0
hitsound   = 5,2
guardsound = 6,0
ground.type = high
air.type = low
ground.slidetime = 16 ;20
ground.hittime  = 16 ;20
ground.velocity = -7.8,0
guard.velocity = -7.5
air.velocity = -5.8,-3
airguard.velocity = -5, -4
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
air.fall = 0
fall.recover = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = cond(p2movetype=H,40,140), 10 ; if P2 already in a hit state you get less power from hitting them
givepower = 35,35

[State 1510, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 1510, Fade]
type = changestate
trigger1 = movecontact ;destroyed state
value = 1511
ignorehitpause=1

[State 1520, End];this destroys the projectile when it goes too far
type = DestroySelf
trigger1 = pos x != [-200,200]

;---------------------------
;Special Reflection
[Statedef 1441]
type = S
movetype = A
physics = N
ctrl = 0
velset = 0, 0
sprpriority = 5

;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY    ;
;飛び道具を跳ね返し行動設定                   ;
;by Vans                                ;
;GUIDE:                                 ;
;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで	;
;sysvar(0) = 262144　　                	;
;=======================================;
[State 1441, INFORMATION SHARING] 	;
type = Projectile 			;
trigger1 = sysvar(1)&2**18 		;
projid = sysvar(0)			;
projanim = 1			;
projhitanim = -1			;
projremanim = -1			;
projremovetime = 2			;
projscale = 0,0			;
projpriority = 0			;
velocity = 0,0			;
postype = p1			;
offset = 0,0			;
persistent = 0			;
ignorehitpause = 1			;
;=======================================;

[State 1441, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = 1

[State 1441, StateTypeSet]
type = StateTypeSet
trigger1 = root,movetype = H
trigger2 = cond(PlayerIDExist(var(0)),(PlayerID(var(0)),movetype=I),0)
movetype = I        ;I,A,H

[State 1441, PosSet]
type = PosSet
trigger1 = !time || time
trigger1 = PlayerIDExist(var(0))
x = PlayerID(var(0)),Pos X
y = PlayerID(var(0)),Pos Y

[State 1441, DestroySelf]
type = DestroySelf
triggerall = time > 2
trigger1 = !PlayerIDExist(var(0))
trigger2 = PlayerIDExist(var(0))
trigger2 = (PlayerID(var(0)),sysvar(0)=131072) 

;---------------------------------------------------------------------------
; Board Throw
; CNS difficulty: easy See -2 for projectile reflection standard Explod
[Statedef 1500]
type    = S
movetype= A
physics = S
velset = 0,0
anim = 1500
ctrl = 0
sprpriority = 2

[State 1500, Button Detect]
type = VarSet
trigger1 = !Time && !AILevel
var(2) = cond((NumExplod(90000200) || NumExplod(90000205)), 0, 1);this sets the var depending on button pressed when using the move

[State 1500, Button Detect]
type = VarSet
triggerall = !Time 
triggerall = Power>=330
trigger1 = !AILevel
trigger1 = (NumExplod(90000200) && NumExplod(90000210)) || (NumExplod(90000205) && NumExplod(90000215))
var(2) = 2;this sets the var if the move was a successful EX

[State 0, PowerAdd]
type = PowerAdd
trigger1 = !Time
value = Cond(Var(2)=2,-330,60) ; if var(2) is 2 then lose meter. if any other number you gain 60 meter

[State 1220, Afterimage]
type = AfterImage
trigger1 = Var(2)=2
trigger1 = Time = 0
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 = 2

[State 1220, Afterimage]
type = AfterImageTime
trigger1 = Var(2)=2
trigger1 = AnimTime < -2
time = 2

[State 1420, Blink Yellow]
type = PalFX
trigger1 = Var(2)=2
trigger1 = Time = 0
time = 20
add = 32,16,0
sinadd = 64,32,5,3

[State 1500, 1]
type = PlaySnd
trigger1 = AnimElem = 3
value = 0, 4

;This is the helper that we use for the projectile. In this case a solid piece of wood
[State 1500, Helper]
type = Helper
trigger1 = AnimElem = 3
name = "Board"
ID = 1510
stateno = 1510
pos = 20,-60
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1

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

;---------------------------------------------------------------------------
; Board Projectile Helper
; CNS difficulty: hard
[Statedef 1510]
type    = A
movetype= A
physics = N
;juggle  = 6 Note that if you actually use juggle points for the helper they will only add to the helper's juggle points. Not the root's (KFM's)
anim = 1510
ctrl = 0
sprpriority = 5
hitcountpersist = 1

;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY    ;
;飛び道具を跳ね返し行動設定                   ;
;by Vans                                ;
;GUIDE:                                 ;
;FOR PROJECTILE / 飛び道具で              	;
;sysvar(0) = 131072                     ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE   ;
;=======================================;
[State 1510, COMPATIBILITY]
type = VarSet
trigger1 = !time 
sysvar(0) = 131072
[State 1510, REFLECTED STATE]
type = VarSet
trigger1 = !time
sysvar(1) = 1520 ; use the stateno your reflected projectile is located at
;If you do NOT wish for the projectile to be reflected then set it back to the original projectile state
;in this case 1510
;=======================================;

;IF this was a fireball you would use this. As a piece of wood we will allow it to cast a shadow
;[State 1510, NoShadow]
;type = AssertSpecial
;trigger1 = 1
;flag = noshadow
;ignorehitpause = 1

[State 1510, Button Detect]
type = VarSet
trigger1= !Time && !PrevStateNo
var(2) = Root, var(2) ;sets the helper var to be the same as the root's var

[State 0, VarSet] ;if EX Var(1) takes care of multi hitting properties 
type = VarSet
trigger1 = Var(2)=2 ; is EX
trigger1 = !Time && !PrevStateNo 
var(1) = 2

[State 0, VarAdd]
type = VarAdd
trigger1 = Var(2)=2 ; is EX
trigger1 = PrevStateNo 
trigger1 = PrevStateNo != 1520
var(1) = -1 ;subtracts 1 hit from EX
persistent = 0

;---------------------------------------------------------------------------------
;poison code example ignore this block if not wanting to learn how to poison 
;I'm using a projectile to trigger the explod in the root
[State 0, Projectile]
type = Projectile
trigger1 = Var(2)=2 ; is EX
trigger1 = NumTarget
trigger1 = !target,IsHelper ;does not activate if the target is a helper
trigger1 = MoveHit=1
ProjID = 99990000
projanim = 1
projremovetime = 1

;see statedef -2 at bottom of cns for continuation
;-----------------------------------------------------------------------------------

[State 1520, VelSet]
type = VelSet
trigger1 = !root, NumExplod(262142)
trigger1 = !root, NumExplod(262143)
trigger1 = !root, NumExplod(262141)
trigger1 = root, NumExplod(262144);This one will ONLY reverse the Y vels. Useful for reflecting an air fireball back into the air
trigger1 = !Time 
x = Cond(var(2) >= 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower
y = 0 ;had this one had any number here (negative or positive) you'd change it to it's opposite
[State 1520, VelSet]
type = VelSet
trigger1 = !root, NumExplod(262144)
trigger1 = !root, NumExplod(262143)
trigger1 = !root, NumExplod(262142)
trigger1 = root, NumExplod(262141);diag up
trigger1 = !Time 
x = Cond(var(2) >= 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower
y = Cond(var(2) >= 1, -3.125,-1.875);these values are based off of Rose's diag up vels in SFA3. In most cases it was always these numbers. Rolento used different numbers however so the values should be researched per char (Medium would have been -2.5)
[State 1520, VelSet]
type = VelSet
trigger1 = !root, NumExplod(262144)
trigger1 = !root, NumExplod(262143)
trigger1 = !root, NumExplod(262141)
trigger1 = root, NumExplod(262142);straight
trigger1 = !Time 
x = Cond(var(2) >= 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower
y = 0
[State 1520, VelSet]
type = VelSet
trigger1 = !root, NumExplod(262144)
trigger1 = !root, NumExplod(262141)
trigger1 = !root, NumExplod(262142)
trigger1 = root, NumExplod(262143);diag down
trigger1 = !Time 
x = Cond(var(2) >= 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower
y = Cond(var(2) >= 1, 3.125,1.875);these values are based off of Rose's diag up vels in SFA3. In most cases it was always these numbers. Rolento used different numbers however so the values should be researched per char (Medium would have been 2.5)
[State 1520, VelSet];this is the default reflect. It only changes the X value
type = VelSet
trigger1 = !root, NumExplod(262141)
trigger1 = !root, NumExplod(262142)
trigger1 = !root, NumExplod(262143)
trigger1 = !root, NumExplod(262144)
trigger1 = !Time 
x = Cond(var(2) >= 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower

[State 1510, Velocity]
type = VelSet
trigger1 = Movecontact ;stop moving when the board connects
trigger2 = Pos Y >=0
x = 0
y = 0

[State 1510, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT ; The helper can't be hit by anything except Projectiles
ignorehitpause = 1

[State 1510, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP ; Only Projectiles will hit. This allows other projectiles to destroy this one
time = 1
ignorehitpause = 1

[State 1510, HitOverride]
type = HitOverride
trigger1 = Var(2)<2 ;not EX
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1511   ; when hit the Projectile will go to this state. It's destroyed state
attr = SCA, AA, AP, AT
ignorehitpause = 1

[State 1510, HitOverride]
type = HitOverride
trigger1 = Var(2)=2 ;multi hitting ex
trigger1 = Time >= 0
slot = 1
time = 1
stateno = Cond(Var(1)>0,1510,1511) ;if Var(1) is greater than 0 it will make the projectile go back to state 1510, if it reaches 0 it goes to the destroyed state
attr = SCA, AA, AP, AT
ignorehitpause = 1

[State 1510, Hitdef]
type = HitDef
trigger1 = AnimElem = 1
id = 1510 ;set as same as stateno
attr = A, SP ; VERY IMPORTANT always remember to set your attr to NP, SP, or HP (Normal, Special, Hyper Projectile)
animtype  = hard
damage    = 20
priority  = 4,Hit
guardflag = MA
hitflag = MAF
pausetime = 0,10
sparkxy = 0,0
hitsound   = 5,2
guardsound = 6,0
ground.type = high
air.type = low
ground.slidetime = 16 ;20
ground.hittime  = 16 ;20
ground.velocity = -7.8,0
guard.velocity = -7.5
air.velocity = -5.8,-3
airguard.velocity = -5, -4
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
air.fall = 0
fall.recover = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = cond(Var(2)=2,0,140), cond(Var(2)=2,0,10) ; if P2 already in a hit state you get less power from hitting them
givepower = 35,35

[State 1510, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 1510, Fade]
type = changestate
trigger1 = Var(1)>0
trigger1 = movecontact ;if Var(1) isn't 0 go back to 1510
value = 1510
ignorehitpause=1

[State 1510, Fade]
type = changestate
trigger1 = Var(1)=0
trigger1 = movecontact ;destroyed state
trigger2 = Pos Y >=0
value = 1511
ignorehitpause=1

[State 1520, End];this destroys the projectile when it goes too far
type = DestroySelf
trigger1 = pos x != [-200,200]

;---------------------------------------------------------------------------
; DESTROY Board Projectile Helper
; CNS difficulty: easy
[Statedef 1511]
type    = A
movetype= A
physics = N
anim = 1511
ctrl = 0
sprpriority = 5

;[State 1511, NoShadow]
;type = AssertSpecial
;trigger1 = 1
;flag = noshadow

[State 0, ChangeState]
type = ChangeState
trigger1 = Var(1)>0
value = 1520
ignorehitpause = 1

[State 1511, Snd 1]
type = PlaySnd
trigger1 = !Time
value = F5,2
[State 1511, Snd 1]
type = PlaySnd
trigger1 = Time = 3
value = F5,3

[State 1511, DestroySelf]
type = DestroySelf
trigger1 = p2movetype != H
trigger1 = time >= 27         ;This destroys the projectile when time = 27 which is the end of the board break animation. But ONLY when P2 is NOT in a hit state. While in a hit state this will stay on the final frame so any hits that follow will add to the combo counter


;---------------------------------------------------------------------------
; REFLECTED Board Projectile Helper
; CNS difficulty: hard
[Statedef 1520]
type    = A
movetype= A
physics = N
;juggle  = 6 Note that if you actually use juggle points for the helper they will only add to the helper's juggle points. Not the root's (KFM's)
anim = 1510
ctrl = 0
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY    ;
;飛び道具を跳ね返し行動設定                   ;
;by Vans                                ;
;GUIDE:                                 ;
;FOR PROJECTILE / 飛び道具で              	;
;sysvar(0) = 131072                     ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE   ;
;=======================================;
[State 1520, COMPATIBILITY]
type = VarSet
trigger1 = !time 
sysvar(0) = 131072
[State 1520, REFLECTED STATE]
type = VarSet
trigger1 = !time 
sysvar(1) = 1510 ; Use the StateNo you use to fire your projectile
;=======================================;

[State 1520, Turn];turn the projectile around
type = Turn
trigger1 = !Time && PrevStateNo != 1511

;IF this was a fireball you would use this. As a piece of wood we will allow it to cast a shadow
;[State 1061, NoShadow]
;type = AssertSpecial
;trigger1 = 1
;flag = noshadow
;ignorehitpause = 1

[State 0, VarSet] ;if EX Var(1) takes care of multi hitting properties 
type = VarSet
trigger1 = Var(2)=2 ; is EX
trigger1 = !Time && PrevStateNo = 1510
var(1) = 2 ; many capcom games would make this 1 instead of 2 as you lose 1 hit on reflect

[State 0, VarAdd]
type = VarAdd
trigger1 = Var(2)=2 ; is EX
trigger1 = PrevStateNo = 1511
var(1) = -1
persistent = 0

;---------------------------------------------------------------------------------
;poison code example ignore this block if not wanting to learn how to poison 
;I'm using a projectile to trigger the explod in the root
[State 0, Projectile]
type = Projectile
trigger1 = Var(2)=2 ; is EX
trigger1 = MoveHit=1
trigger1 = root,MoveType = H
ProjID = 99990040
projanim = 1
projremovetime = 1

;see statedef -2 at bottom of cns for continuation
;-----------------------------------------------------------------------------------

[State 1520, VelSet]
type = VelSet
trigger1 = !enemy, NumExplod(262142)
trigger1 = !enemy, NumExplod(262143)
trigger1 = !enemy, NumExplod(262141)
trigger1 = enemy, NumExplod(262144);This one will ONLY reverse the Y vels. Useful for reflecting an air fireball back into the air
trigger1 = !Time 
x = Cond(var(2) >= 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower
y = 0 ;had this one had any number here (negative or positive) you'd change it to it's opposite
[State 1520, VelSet]
type = VelSet
trigger1 = !enemy, NumExplod(262144)
trigger1 = !enemy, NumExplod(262143)
trigger1 = !enemy, NumExplod(262142)
trigger1 = enemy, NumExplod(262141);diag up
trigger1 = !Time 
x = Cond(var(2) >= 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower
y = Cond(var(2) = 1, -3.125,-1.875);these values are based off of Rose's diag up vels in SFA3. In most cases it was always these numbers. Rolento used different numbers however so the values should be researched per char (Medium would have been -2.5)
[State 1520, VelSet]
type = VelSet
trigger1 = !enemy, NumExplod(262144)
trigger1 = !enemy, NumExplod(262143)
trigger1 = !enemy, NumExplod(262141)
trigger1 = enemy, NumExplod(262142);straight
trigger1 = !Time 
x = Cond(var(2) >= 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower
y = 0
[State 1520, VelSet]
type = VelSet
trigger1 = !enemy, NumExplod(262144)
trigger1 = !enemy, NumExplod(262141)
trigger1 = !enemy, NumExplod(262142)
trigger1 = enemy, NumExplod(262143);diag down
trigger1 = !Time 
x = Cond(var(2) >= 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower
y = Cond(var(2) >= 1, 3.125,1.875);these values are based off of Rose's diag up vels in SFA3. In most cases it was always these numbers. Rolento used different numbers however so the values should be researched per char (Medium would have been 2.5)
[State 1520, VelSet];this is the default reflect. It only changes the X value
type = VelSet
trigger1 = !enemy, NumExplod(262141)
trigger1 = !enemy, NumExplod(262142)
trigger1 = !enemy, NumExplod(262143)
trigger1 = !enemy, NumExplod(262144)
trigger1 = !Time 
x = Cond(var(2) >= 1, 6,3) ;If Var(2) is 1 then this moves faster, if not 1 it moves slower

[State 1520, Velocity]
type = VelSet
trigger1 = Movecontact ;stop moving when the board connects
trigger2 = Pos Y >=0
x = 0
y = 0

[State 1520, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT ; The helper can't be hit by anything except Projectiles
ignorehitpause = 1

[State 1520, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP ; Only Projectiles will hit. This allows other projectiles to destroy this one
time = 1
ignorehitpause = 1

[State 1510, HitOverride]
type = HitOverride
trigger1 = Var(2)<2 ;not EX
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1511   ; when hit the Projectile will go to this state. It's destroyed state
attr = SCA, AA, AP, AT
ignorehitpause = 1

[State 1510, HitOverride]
type = HitOverride
trigger1 = Var(2)=2 ;multi hitting ex
trigger1 = Time >= 0
slot = 1
time = 1
stateno = Cond(Var(1)>0,1520,1511);if Var(1) is greater than 0 it will make the projectile go back to state 1520, if it reaches 0 it goes to the destroyed state
attr = SCA, AA, AP, AT
ignorehitpause = 1

[State 1520, Hitdef]
type = HitDef
trigger1 = 1
affectteam = F ; This makes the projectile hurt your own team/char
;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY    ;
;飛び道具を跳ね返し行動設定                   ;
;by Vans                                ;
;GUIDE:                                 ;
;FOR PROJECTILE / 飛び道具で              	;
;sysvar(0) = 131072                     ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE   ;
;=======================================;
id = sysvar(0)
;=======================================;
attr = A, SP ; VERY IMPORTANT always remember to set your attr to NP, SP, or HP (Normal, Special, Hyper Projectile)
animtype  = hard
damage    = 20
priority  = 4,Hit
guardflag = MA
hitflag = MAF
pausetime = 1,10 ;pausetime of the reflected projectile must be 1
sparkxy = 0,0
sparkNo = -1
guardsound = 6,0
ground.type = high
air.type = low
ground.slidetime = 16 ;20
ground.hittime  = 16 ;20
ground.velocity = -7.8,0
guard.velocity = -7.5
air.velocity = -5.8,-3
airguard.velocity = -5, -4
yaccel = 0.5
air.fall = 0
fall.recover = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = 0,10
givepower = 35,35

;due to a 1 tick delay in communication between helper and root we need to remove hitsound, envshake, and the hitspark from the hitdef and mimic them below

[State 0, PlaySnd]
type = PlaySnd
trigger1 = movehit
value = S5,2

[State 1520, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 1520, Guardshake]
type = envshake
trigger1 = movehit=2
time = 4
ampl = 6
freq = 176
ignorehitpause = 0

[State 0, Explod]
type = Explod
trigger1 = MoveHit=1 && NumTarget
anim = F2
ID = 1520
pos = ifElse(P2Dist x < 0, 0, ifElse(P2Dist x < 20, ceil(P2Dist x), 20)), 0
postype = p1  ;p2,front,back,left,right
facing = 1
pausemovetime = 999999
supermovetime = 999999
sprpriority = 9
ownpal = 1
ignorehitpause = 1
persistent = 0

[State 0, PowerAdd]
type = PowerAdd
trigger1 = MoveHit=1 && NumTarget
value = cond(p2movetype=H,40,140); if P2 already in a hit state you get less power from hitting them
ignorehitpause = 1
persistent = 0

;end mimic hitdef attributes

;=======================================;
;PROJECTILE REFLECTION COMPATIBILITY    ;
;飛び道具を跳ね返し行動設定               ;
;by Vans                                ;
;GUIDE:                                 ;
;FOR PROJECTILE / 飛び道具で          	;
;sysvar(0) = 131072                     ;
;sysvar(1) = REFLECTED_BEHAVIOR_STATE   ;
;FOR REFLECTOR / 飛び道具を跳ね返するHELPERで;
;sysvar(0) = 262144　　                  ;
;=======================================;
[State 1520, Turn]
type = Turn
trigger1 = movecontact
trigger1 = root,NumProjID(262144)
persistent = 0
ignorehitpause = 1
[State 1520, ChangeState]
type = ChangeState
trigger1 = movecontact
trigger1 = root,NumProjID(262144)
value = sysvar(1)
ctrl = 0
ignorehitpause = 1
;=======================================;

[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "var(1) = %d, var(2) = %d, var(58) = %d"
params = var(1), var(2), var(58)

[State 1520, Broken Boards] ;see state 1511 for EX changestate
type = changestate
trigger1 = movecontact ;destroyed state
trigger2 = Pos Y >=0
value = 1511
ignorehitpause=0;reflected should stay 0

[State 1520, End]
type = DestroySelf
trigger1 = pos x != [-200,200]

;---------------------------------------------------------------------------
; CNS difficulty: easy

; Kung Fu Knee - kick
[Statedef 1600]
type    = A
movetype= A
physics = N
anim = 1600
juggle = 8

[State 0, VarSet]
type = VarSet
trigger1 = !Time
var(3) = Cond((NumExplod(90000230) || NumExplod(90000235)),0,1)

[State 1055, 1]
type = PlaySnd
trigger1 = Time = 0
value = 100,0
channel = 0

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

[State 1055, 3]
type = PosAdd
trigger1 = Time = 0
x = 10
y = -10

[State 0, VelSet]
type = VelSet
trigger1 = 1
x = Cond(Var(3)=1,3,6)

[State 1055, 4] ;Gravity
type = VelAdd
trigger1 = 1
y = .45

[State 1055, 5]
type = HitDef
trigger1 = Var(3) =0
trigger1 = Time = 0
attr = A, SA
animtype  = Med
damage    = 45 , 2
priority  = 4
guardflag = MA
pausetime = 12,12
sparkxy = 0,-90
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 18
ground.hittime  = 22
ground.velocity = -6
guard.velocity = -8
guard.ctrltime = 12
air.velocity = -4,-5
airguard.velocity = -4,-4.5
air.fall = 1

[State 1055, 5]
type = HitDef
trigger1 = Var(3) =1
trigger1 = Time = 0
attr = A, SA
animtype  = Med
damage    = 45 , 2
priority  = 4
guardflag = MA
pausetime = 12,12
sparkxy = 0,-90
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 18
ground.hittime  = 22
ground.velocity = -1,-9
guard.velocity = -8
guard.ctrltime = 12
air.velocity = -1,-6
airguard.velocity = -4,-4.5
fall = 1
fall.recover = 0

[State 1055, 6] ;Change state when KFM is close to ground
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= -5
value = 1056



;---------------------------------------------------------------------------
; Triple Kung Fu Palm (hyper)
; CNS difficulty: medium
; Notes: Notice that the HitDefs in supers have "getpower = 0". This makes
;        sure KFM doesn't recharge his super guage as he hits.
;        Also, the attributes for the HitDefs is "HA" for "hyper attack",
;        ie. "attr = S, HA".
;        Notice how the first HitDef is reused twice by allowing it to
;        trigger on two animation elements.
[Statedef 3000]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
anim = 3000
ctrl = 0
sprpriority = 2

[State 3000, Width]
type = Width
trigger1 = AnimElem = 2, >= 0
value = 15,0

[State 3000, Super A]
type = SuperPause
trigger1 = AnimElem = 2, 1
pos = 25, -57
anim = 100
sound = 20, 0
poweradd = -1000

[State 3000, Super B]
type = AfterImage
trigger1 = AnimElem = 2, 1
time = 2

[State 3000, Super C]
type = AfterImageTime
trigger1 = AnimElemTime(2) >= 1 && Time < 60
time = 2

[State 3000, Super D]
type = NotHitBy
trigger1 = AnimElem = 2
value = , NA, SA, AT
time = 11

[State 3000, Super E]
type = NotHitBy
trigger1 = AnimElemTime(2) >= 0 && AnimElemTime(14) < 0
value2 = C, NA
time = 1

[State 3000, 1]
type = PlaySnd
trigger1 = AnimElem = 4
trigger2 = AnimElem = 12
trigger3 = AnimElem = 20
value = 0, 3

[State 3000, 2]
type = PosAdd
trigger1 = AnimElem = 2
x = 20

[State 3000, 3]
type = PosAdd
trigger1 = AnimElem = 3
trigger2 = AnimElem = 11
trigger3 = AnimElem = 13
trigger4 = AnimElem = 19
trigger5 = AnimElem = 21
trigger4 = AnimElem = 31
x = 10

[State 3000, 4]
type = VelSet
trigger1 = AnimElem = 5
trigger2 = AnimElem = 13
trigger3 = AnimElem = 21
x = 6

[State 3000, 4]
type = PosAdd
trigger1 = AnimElem = 5
x = 5

[State 3000, 5]
type = HitDef
trigger1 = AnimElem = 5
trigger2 = AnimElem = 13
attr = S, HA
animtype  = Hard
damage    = 72,4
getpower  = 0
priority  = 6
guardflag = MA
pausetime = 15,15
sparkxy = -10,-60
hitsound   = 5,4
guardsound = 6,0
ground.type = Low
ground.slidetime = 30
ground.hittime  = 32
ground.velocity = -6
air.velocity = -3,-2.8
air.fall = 1
fall.animtype = Hard
fall.recover = 0

[State 3000, 6]
type = HitDef
trigger1 = AnimElem = 21
attr = S, HA
animtype  = Hard
damage    = 75,4
getpower  = 0
priority  = 5
guardflag = MA
pausetime = 15,15
sparkxy = -10,-60
hitsound   = 5,4
guardsound = 6,0
ground.type = Low
ground.slidetime = 30
ground.hittime  = 32
ground.velocity = -5, -4
guard.velocity = -12
air.velocity = -5,-4
airguard.velocity = -3,-3
fall.animtype = Hard
fall = 1
fall.recover = 0

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

;---------------------------------------------------------------------------
; Smash Kung Fu Upper (hyper)
; CNS difficulty: medium
; Description: This is very similar to KFM's Strong and Light Kung Fu Uppers.
;     There is just one HitDef, for a screen-shaking hit. The envshake
;     parameters are used to make this effect. You can find out more about
;     each parameter in the CNS documentation.
;     The fall.recover parameter is set at 0, meaning that p2 cannot recover
;     from the fall by entering his recovery command (for KFM, that is x+y).
;     This gives the attacking KFM a chance to follow up with another attack,
;     such as the Fast Kung Fu Palm.
;     Note that there is a ChangeState controller used to make KFM change to
;     a success state if he hits. The success state has KFM hold his arm
;     up longer for a dramatic effect.
[Statedef 3050]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
anim = 3050
ctrl = 0
sprpriority = 2

[State 3050, Width]
type = Width
trigger1 = AnimElemTime(4) >= 0 && AnimElemTime(16) < 0
value = 5,0

[State 3050, Super A]
type = SuperPause
trigger1 = AnimElem = 2
pos = -5, -55
anim = 100
sound = 20, 0
poweradd = -1000

[State 3050, Super B]
type = AfterImage
trigger1 = AnimElem = 2
time = 2

[State 3050, Super C]
type = AfterImageTime
trigger1 = AnimElemTime(2) >= 0
time = 2

[State 3050, Super D]
type = NotHitBy
trigger1 = AnimElem = 2
value = , NA, SA, AT
time = 6

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

[State 3050, 2]
type = HitDef
trigger1 = Time = 0
attr = S, HA
animtype  = Up               ;Make p2 use "Up" type animation on hit
damage    = 155, 12
getpower  = 0
priority  = 5
guardflag = MA
pausetime = 30,30
sparkno = 3
sparkxy = 0,-110
hitsound   = 5,4
guardsound = 6,0
ground.type = Low
ground.slidetime = 26
ground.hittime  = 28
ground.velocity = -1.3,-25
guard.velocity = -11
air.velocity = -1.3,-25
airguard.velocity = -4.5,-5
envshake.time = 25           ;Parameters for shaking the screen on hit
envshake.ampl = 7
envshake.freq = 176
p2facing = 1                 ;Force p2 to face p1 on hit
fall = 1
fall.recover = 0             ;Prevent p2 from recovering
fall.damage = 0             ;p2 will take 70 damage on hitting the ground < note that this has been changed as it is buggy. If you set defence higher it does not scale damage from fall.damage you should look in -2 instead
fall.envshake.ampl = 6       ;Parameters for shaking the screen on fall
fall.envshake.freq = 178
fall.envshake.time = 15
mindist = 50,-100            ;Keep p2 a minimum of 50 pixels away from p1, and no higher than 100 pixels up
maxdist = 100,-10            ;Keep p2 a maximum of 100 pixels away from p1, and no lower than 10 pixels below
yaccel = .8                  ;Accelerate p2 downwards rapidly
ID = 3051               ;look in -2 for NumTarget(3051) for more code pertaining to damage when hitting the ground

;This controller below makes Kung Fu man change to a success state if he
;successfully hits the Smash Kung Fu Upper.
[State 3050, 4]
type = ChangeState
trigger1 = MoveHit
value = 3051

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

;------------------
; Smash Kung Fu Upper (success)
; Description: This is the state that KFM changes to if he successfully hits
;     with Smash Kung Fu Upper. KFM holds his arm high for a short while
;     longer, then changes back to his idle stand state.
[Statedef 3051]
type    = S
movetype= A
physics = S
anim = 3051

[State 3051, 1]
type = AfterImageTime
trigger1 = AnimTime < -2
time = 2

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

;========================<EXPLODSIVE BUFFERING HELPER>=============================
[StateDef 90000005]
type = A
physics = N
moveType = I
anim = 1
velSet = 0,0
ctrl = 0

[State 90000005, Turn]
type = Turn
trigger1 = (enemy, NumExplod(94646464) || enemy, NumExplod(92468246)) && !var(0)
trigger2 = !enemy, NumExplod(94646464) && !enemy, NumExplod(92468246) && var(0)
ignoreHitPause = 1

[State 90000005, Reverse Left/Right]
type = VarSet
trigger1 = (enemy, NumExplod(94646464) || enemy, NumExplod(92468246)) && !var(0)
var(0) = 1
ignoreHitPause = 1

[State 90000005, Reset Turn Variable]
type = VarSet
trigger1 = !enemy, NumExplod(94646464) && !enemy, NumExplod(92468246) && var(0)
var(0) = 0
ignoreHitPause = 1

[State 90000005, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "by JustMorphPointman"
ignoreHitPause = 1

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

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

[Statedef -2]

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

[State -2, Sealed by Chizuru's Reigi no Ishizue]
type = PalFX
trigger1 = NumProjID(131035)
trigger1 = GameTime % 2 = 1
time = 1
add = 0,0,92
sinAdd = 0,0,0,0
color = 0
invertAll = 0
color = 256
ignoreHitPause = 1

[State -2, EXPLODsive Buffering Helper]
type = Helper
trigger1 = !NumHelper(90000005)
stateNo = 90000005
ID = 90000005
name = "EXPLODsive Buffering helper"
posType = P1
facing = ifElse(Facing = 1, 1, -1)
keyCtrl = 1
ignoreHitPause = 1

;=======================================================
;Advanced EXPLODsive buffer turning
;=======================================================
;disable MUGEN's hardcoded turning
;[State -2, AssertSpecial]
;type = AssertSpecial
;trigger1 = P2DisT x >= -1
;flag = noautoturn

;[State -2, No walk during turning animation]
;type = PosFreeze
;triggerall = MoveType != H
;trigger1 = anim=5
;value = 1
;[State 0, AssertSpecial]
;type = AssertSpecial
;triggerall = MoveType != H
;trigger1 = Anim = 5
;flag = nowalk

;When to play standing turn anim
;[State -2, ChangeAnim]
;type = ChangeAnim
;triggerall = MoveType != H
;triggerall = ctrl
;triggerall = Anim !=5
;triggerall = StateType !=A
;trigger1 = prevstateno !=50
;trigger1 = P2DisT x < -1
;trigger1 = StateNo = [0,20]
;trigger1 = (!AILEVEL && !NumExplod(90000001) && !NumExplod(90000002) && !NumExplod(90000003)) || AILEVEL && command != "holddown"
;value = 5
;When to play crouching turn anim
;[State -2, ChangeAnim]
;type = ChangeAnim
;triggerall = MoveType != H
;triggerall = StateType !=A
;trigger1 = Anim !=6
;trigger1 = P2DisT x < -1
;trigger1 = ctrl
;trigger1 = StateNo = [0,20]
;trigger1 = (!AILEVEL && NumExplod(90000001) || NumExplod(90000002) || NumExplod(90000003)) || AILEVEL && command = "holddown"
;value = 6

;[State 0, ChangeState]
;type = ChangeState
;triggerall = MoveType != H
;triggerall = (!AILEVEL && !NumExplod(90000001) && !NumExplod(90000002) && !NumExplod(90000003)) || AILEVEL && command != "holddown"
;triggerall = ctrl
;triggerall = Anim !=5
;triggerall = P2DisT x < -1
;triggerall = StateType !=A
;trigger1 = StateNo != [0,20]
;trigger1 = MoveType = I
;value = 0
;ctrl = 1
;[State 0, ChangeState]
;type = ChangeState
;triggerall = MoveType != H
;triggerall = (!AILEVEL && NumExplod(90000001) || NumExplod(90000002) || NumExplod(90000003)) || AILEVEL && command = "holddown"
;triggerall = ctrl
;triggerall = Anim !=6
;triggerall = P2DisT x < -1
;triggerall = StateType !=A
;trigger1 = StateNo != [0,20]
;trigger1 = MoveType = I
;value = 11
;ctrl = 1

;When to actually turn(notice this is below the turn anim code blocks)
;[State -2, Turn]
;type = Turn
;triggerall = P2DisT x < -1
;trigger1 = MoveType != H || (StateNo !=[120,155]) 
;trigger1 = StateType != A
;trigger1 = ctrl
;trigger1 = stateno !=52
;trigger1 = StateNo = [0,20]
;trigger2 = PrevStateNo = 5120
;trigger2 = ctrl=0


;this shows how long you have charged back and how long you have till you can fire when releasing back 
[State -2, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "var(47) = %d  var(48) = %d"
params = var(47),var(48) 

;this resets the var so he will go to state 5170 correctly in all instances
 [State -2, System Variable Set]
type = VarSet
trigger1 = StateType = S || Statetype = C
sysvar(0) = 0
ignorehitpause = 1

;this removes the jump limiter explod(s)
[State -2, RemoveExplod]
type = RemoveExplod
trigger1 = StateType != A      ;remove the explod if the opponent is no longer in a air state
id = 45
ignorehitpause = 1

;===============Applying various status to opponent outside of custom states================
[State -2, AssertSpecial]
type = AssertSpecial
trigger1 = enemy, NumExplod(99980000);create this explod ID and the opponent will become invisible if compatible
flag = invisible
ignorehitpause = 1

[State -2, CtrlSet]
type = CtrlSet
trigger1 = enemy, NumExplod(99980001);create this explod ID and the opponent will lose ctrl if compatible
value = 0

[State -2, CtrlSet]
type = CtrlSet
trigger1 = enemy, NumExplod(99980002);create this explod ID and the opponent will gain ctrl if compatible
value = 1

;===============Pal FX applied by opponent================
;MUGEN does not allow us to give P2 a PalFX outside of a custom state sp this work around was developed
;Use these expod ID ranges for their corresponding fx 
;these are more SNK style with inverted colors
;99991000 = Fire by O Illusionista
;99991001 = Ice by O Illusionista
;99991002 = Green Poison by O Illusionista
;99991003 = Purple Poison by O Illusionista
;99991004 = Blue Shock by O Illusionista
;99991005 = B&W Shock by O Illusionista
;99991006 = Evil Red by O Illusionista
;99991007 = Evil Purple by O Illusionista
;99991008 = Slow Pulse Fire by Elix
;99991009 = Yellow/Orange Burn by Sander71113
;99991010 = Blue/Violet/Crimson Burn  by Sander71113
;99991011 = Red/Blood Burn by Sander71113
;99991012 = Dust/Gray Burn by Sander71113
;99991013 = Fade to Darker fade to brighter by Odb718
;99991014 = Black and White Negative by Odb718
;99991015 = Rainbow by altoiddealer
;99991016 = White
;99991017 = Red
;99991018 = Blue
;99991019 = Green
;99991020 = Yellow
;99991021 = Pink
;99991022 = Light Blue
;99991023 = Black

;these make the fx not inverted more like Capcom
;99992000 = Fire by O Illusionista
;99992001 = Ice by O Illusionista
;99992002 = Green Poison by O Illusionista
;99992003 = Purple Poison by O Illusionista
;99992004 = Blue Shock by O Illusionista
;99992005 = B&W Shock by O Illusionista
;99992006 = Evil Red by O Illusionista
;99992007 = Evil Purple by O Illusionista
;99992008 = Slow Pulse Fire by Elix
;99992009 = Yellow/Orange Burn by Sander71113
;99992010 = Blue/Violet/Crimson Burn  by Sander71113
;99992011 = Red/Blood Burn by Sander71113
;99992012 = Dust/Gray Burn by Sander71113
;99992013 = Fade to Darker fade to brighter by Odb718
;99992014 = Black and White Negative by Odb718
;99992015 = Rainbow by altoiddealer

[State -2, SNK Fire PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991000)
time = 1
add = Ceil(240 + 110 * sin(2 * pi * gametime / 10)),Ceil(50 + 55 * sin(2 * pi * gametime / 10)),Ceil(120 + 85 * sin(2 * pi * gametime / 10))
mul = 250,224,120 
color = 0 
invertall = 1 
ignorehitpause = 1

[State -2, SNK Ice PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991001)
time = 1
add = Ceil(0 + 85 * sin(2 * pi * gametime / 10)),Ceil(50 + 55 * sin(2 * pi * gametime / 10)),Ceil(240 + 110 * sin(2 * pi * gametime / 10))
mul = 120,224,150 
color = 0 
invertall = 1 
ignorehitpause = 1

[State -2, SNK Green Poison PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991002)
time = 1
add = Ceil(0 + 85 * sin(2 * pi * gametime / 10)),Ceil(100 + 110 * sin(2 * pi * gametime / 10)),Ceil(50 + 55 * sin(2 * pi * gametime / 10))
mul = 20,120,24 
color = 0 
invertall = 1 
ignorehitpause = 1

[State -2, SNK Purple Poison PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991003)
time = 1
add = Ceil(100 + 85 * sin(2 * pi * gametime / 10)),Ceil(0 + 110 * sin(2 * pi * gametime / 10)),Ceil(100 + 55 * sin(2 * pi * gametime / 10))
mul = 120,20,124 
color = 0 
invertall = 1 
ignorehitpause = 1

[State -2, SNK Blue Shock PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991004)
time = 1
add = Ceil(100 -80 * sin(2 * pi * gametime / 10)),Ceil(100 -80 * sin(2 * pi * gametime / 10)),Ceil(180 -80 * sin(2 * pi * gametime / 10))
color = 0 
invertall = 1
ignorehitpause = 1

[State -2, SNK B&W Shock PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991005)
time = 1
add = Ceil(100 -80 * sin(2 * pi * gametime / 10)),Ceil(100 -80 * sin(2 * pi * gametime / 10)),Ceil(100 -80 * sin(2 * pi * gametime / 10))
color = 0 
invertall = 1
ignorehitpause = 1

[State -2, SNK Evil Red PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991006)
time = 1
add = Ceil(0 + 40 * sin(2 * pi * gametime / 10)),Ceil(-200 + 80 * sin(2 * pi * gametime / 10)),Ceil(-200 + 40 * sin(2 * pi * gametime / 10))
color = 0 
invertall = 1
ignorehitpause = 1

[State -2, SNK Evil Purple PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991007)
time = 1
add = Ceil(0 + 40 * sin(2 * pi * gametime / 10)),Ceil(-200 + 80 * sin(2 * pi * gametime / 10)),Ceil(0 + 40 * sin(2 * pi * gametime / 10))
color = 0 
invertall = 1
ignorehitpause = 1

[State -2, SNK Slow Pulse Fire PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991008)
time = 1
add = Ceil(224 -160 * sin(2 * pi * gametime / 14)),Ceil(68 -160 * sin(2 * pi * gametime / 14)),Ceil(-40 -160 * sin(2 * pi * gametime / 14))
mul = 256,192,128
color = 0
invertall = 1
ignorehitpause = 1

[State -2, SNK Yellow/Orange Burn PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991009)
time = 1
add = Ceil(40 + 40 * sin(2 * pi * gametime / 10)),Ceil(-70 + 30 * sin(2 * pi * gametime / 10)),Ceil(-200 + 0 * sin(2 * pi * gametime / 10))
color     = 0                                             
invertall = 1   
ignorehitpause = 1

[State -2, SNK Blue/Violet/Crimson Burn PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991010)
time = 1
add = Ceil(-104 + 56 * sin(2 * pi * gametime / 10)),Ceil(-104 + 56 * sin(2 * pi * gametime / 10)),Ceil(7 + 0 * sin(2 * pi * gametime / 10))
color     = 0
invertall = 1
ignorehitpause = 1

[State -2, SNK Red/Blood Burn PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991011)
time = 1
add = Ceil(7 + 30 * sin(2 * pi * gametime / 10)),Ceil(-200 + 30 * sin(2 * pi * gametime / 10)),Ceil(-200 + 0 * sin(2 * pi * gametime / 10))
color     = 0                                            
invertall = 1  
ignorehitpause = 1

[State -2, SNK Dust/Gray Burn PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991012)
time = 1
add = Ceil(-100 -10 * sin(2 * pi * gametime / 10)),Ceil(-100 -10 * sin(2 * pi * gametime / 10)),Ceil(-100 -10 * sin(2 * pi * gametime / 10))
color     = 0
invertall = 1
ignorehitpause = 1

[State -2, SNK Fade to Darker fade to brighter PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991013)
time = 1
add = Ceil(0 -65 * sin(2 * pi * gametime / 26)),Ceil(0 -65 * sin(2 * pi * gametime / 26)),Ceil(0 -65 * sin(2 * pi * gametime / 26))
mul = 164,164,164
invertall = 1
color = 256
ignorehitpause = 1

[State -2, SNK Black and White Negative PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991014)
time = 1
add = Ceil(0 + 55 * sin(2 * pi * gametime / 10)),Ceil(0 + 55 * sin(2 * pi * gametime / 10)),Ceil(0 + 55 * sin(2 * pi * gametime / 10))
mul = 200,200,200
invertall = 1
color = 0 
ignorehitpause = 1

[State -2, SNK Rainbow PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991015)
time = 1
add = Floor(sin(GameTime/8)*64),Floor(sin((GameTime-85)/8)*64),Floor(sin((GameTime-170)/8)*64)
invertall = 1 
ignorehitpause = 1

[State 0, White PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991016)
time = 1
add = 256,256,256
mul = 256,256,256
sinadd = 0,0,0,1
invertall = 0
color = 256
ignorehitpause = 1

[State 0, Red PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991017)
time = 1
add = 256,0,0
mul = 256,0,0
sinadd = 0,0,0,1
invertall = 0
color = 256
ignorehitpause = 1

[State 0, Blue PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991018)
time = 1
add = 0,0,256
mul = 0,0,256
sinadd = 0,0,0,1
invertall = 0
color = 256
ignorehitpause = 1

[State 0, Green PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991019)
time = 1
add = 0,256,0
mul = 0,256,0
sinadd = 0,0,0,1
invertall = 0
color = 256
ignorehitpause = 1

[State 0, Yellow PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991020)
time = 1
add = 256,256,0
mul = 256,256,0
sinadd = 0,0,0,1
invertall = 0
color = 256
ignorehitpause = 1

[State 0, Pink PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991021)
time = 1
add = 256,0,256
mul = 256,0,256
sinadd = 0,0,0,1
invertall = 0
color = 256
ignorehitpause = 1

[State 0, Light Blue PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991022)
time = 1
add = 0,256,256
mul = 0,256,256
sinadd = 0,0,0,1
invertall = 0
color = 256
ignorehitpause = 1

[State 0, Black PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99991023)
time = 1
add = 256,256,256
mul = 0,0,0
sinadd = 0,0,0,1
invertall = 0
color = 256
ignorehitpause = 1

[State -2, CAPCOM Fire PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992000)
time = 1
add = Ceil(240 + 110 * sin(2 * pi * gametime / 10)),Ceil(50 + 55 * sin(2 * pi * gametime / 10)),Ceil(120 + 85 * sin(2 * pi * gametime / 10))
mul = 250,224,120 
color = 0 
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM Ice PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992001)
time = 1
add = Ceil(0 + 85 * sin(2 * pi * gametime / 10)),Ceil(50 + 55 * sin(2 * pi * gametime / 10)),Ceil(240 + 110 * sin(2 * pi * gametime / 10))
mul = 120,224,150 
color = 0 
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM Green Poison PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992002)
time = 1
add = Ceil(0 + 85 * sin(2 * pi * gametime / 10)),Ceil(100 + 110 * sin(2 * pi * gametime / 10)),Ceil(50 + 55 * sin(2 * pi * gametime / 10))
mul = 20,120,24 
color = 0 
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM Purple Poison PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992003)
time = 1
add = Ceil(100 + 85 * sin(2 * pi * gametime / 10)),Ceil(0 + 110 * sin(2 * pi * gametime / 10)),Ceil(100 + 55 * sin(2 * pi * gametime / 10))
mul = 120,20,124 
color = 0 
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM Blue Shock PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992004)
time = 1
add = Ceil(100 -80 * sin(2 * pi * gametime / 10)),Ceil(100 -80 * sin(2 * pi * gametime / 10)),Ceil(180 -80 * sin(2 * pi * gametime / 10))
color = 0 
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM B&W Shock PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992005)
time = 1
add = Ceil(100 -80 * sin(2 * pi * gametime / 10)),Ceil(100 -80 * sin(2 * pi * gametime / 10)),Ceil(100 -80 * sin(2 * pi * gametime / 10))
color = 0 
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM Evil Red PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992006)
time = 1
add = Ceil(0 + 40 * sin(2 * pi * gametime / 10)),Ceil(-200 + 80 * sin(2 * pi * gametime / 10)),Ceil(-200 + 40 * sin(2 * pi * gametime / 10))
color = 0 
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM Evil Purple PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992007)
time = 1
add = Ceil(0 + 40 * sin(2 * pi * gametime / 10)),Ceil(-200 + 80 * sin(2 * pi * gametime / 10)),Ceil(0 + 40 * sin(2 * pi * gametime / 10))
color = 0 
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM Slow Pulse Fire PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992008)
time = 1
add = Ceil(224 -160 * sin(2 * pi * gametime / 14)),Ceil(68 -160 * sin(2 * pi * gametime / 14)),Ceil(-40 -160 * sin(2 * pi * gametime / 14))
mul = 256,192,128
color = 0
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM Yellow/Orange Burn PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992009)
time = 1
add = Ceil(40 + 40 * sin(2 * pi * gametime / 10)),Ceil(-70 + 30 * sin(2 * pi * gametime / 10)),Ceil(-200 + 0 * sin(2 * pi * gametime / 10))
color     = 0                                        
invertall = 0  
ignorehitpause = 1

[State -2, CAPCOM Blue/Violet/Crimson Burn PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992010)
time = 1
add = Ceil(-104 + 56 * sin(2 * pi * gametime / 10)),Ceil(-104 + 56 * sin(2 * pi * gametime / 10)),Ceil(7 + 0 * sin(2 * pi * gametime / 10))
color     = 0
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM Red/Blood Burn PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992011)
time = 1
add = Ceil(7 + 30 * sin(2 * pi * gametime / 10)),Ceil(-200 + 30 * sin(2 * pi * gametime / 10)),Ceil(-200 + 0 * sin(2 * pi * gametime / 10))
color     = 0 
ignorehitpause = 1

[State -2, CAPCOM Dust/Gray Burn PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992012)
time = 1
add = Ceil(-100 -10 * sin(2 * pi * gametime / 10)),Ceil(-100 -10 * sin(2 * pi * gametime / 10)),Ceil(-100 -10 * sin(2 * pi * gametime / 10))
color     = 0
invertall = 0
ignorehitpause = 1

[State -2, CAPCOM Fade to Darker fade to brighter PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992013)
time = 1
add = Ceil(0 -65 * sin(2 * pi * gametime / 26)),Ceil(0 -65 * sin(2 * pi * gametime / 26)),Ceil(0 -65 * sin(2 * pi * gametime / 26))
mul = 164,164,164
invertall = 0
color = 256
ignorehitpause = 1

[State -2, CAPCOM Black and White Negative PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992014)
time = 1
add = Ceil(0 + 55 * sin(2 * pi * gametime / 10)),Ceil(0 + 55 * sin(2 * pi * gametime / 10)),Ceil(0 + 55 * sin(2 * pi * gametime / 10))
mul = 200,200,200
invertall = 0
color = 0 
ignorehitpause = 1

[State -2, CAPCOM Rainbow PalFX]
type = PalFX
trigger1 = enemy, NumExplod(99992015)
time = 1
add = Floor(sin(GameTime/8)*64),Floor(sin((GameTime-85)/8)*64),Floor(sin((GameTime-170)/8)*64)
invertall = 0
ignorehitpause = 1


;===============poisoning P2 see state 1510 for more info================

;ID ranges include; each represents how much life per tick is lost
;99990000 = -1
;99990001 = -2
;99990002 = -3
;99990003 = -4
;99990004 = -5
;99990005 = -10
;99990006 = -15
;99990007 = -20
;99990008 = -25
;99990009 = -30
;ID ranges include; each represents how much life per tick is gained
;99990010 = +1
;99990011 = +2
;99990012 = +3
;99990013 = +4
;99990014 = +5
;99990015 = +10
;99990016 = +15
;99990017 = +20
;99990018 = +25
;99990019 = +30

;this explod tells how long the duration of poison should last
[State 0, Explod]
type = Explod
trigger1 = NumProjID(99990000)
anim = 1
ID = 99990000
removetime = 300 ;adjusts how long p2 is in poison status
removeongethit = 1 ;removes poison when you are hit
ignorehitpause = 1

;this explod tells how long the duration of poison PalFX should last
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990000)
anim = 1
ID = 99992003
removetime = 1 
ignorehitpause = 1

;ID ranges include; each represents how much life per tick is lost
;99990020 = -1
;99990021 = -2
;99990022 = -3
;99990023 = -4
;99990024 = -5
;99990025 = -10
;99990026 = -15
;99990027 = -20
;99990028 = -25
;99990029 = -30
;ID ranges include; each represents how much life per tick is gained
;99990030 = +1
;99990031 = +2
;99990032 = +3
;99990033 = +4
;99990034 = +5
;99990035 = +10
;99990036 = +15
;99990037 = +20
;99990038 = +25
;99990039 = +30

;this explod tells how frequently the poison should take life
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990000)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990020
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990001)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990021
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990002)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990022
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990003)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990023
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990004)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990024
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990005)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990025
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990006)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990026
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990007)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990027
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990008)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990028
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990009)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990029
removetime = 1

;this explod tells how frequently the poison should give life
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990010)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990030
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990011)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990031
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990012)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990032
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990013)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990033
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990014)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990034
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990015)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990035
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990016)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990036
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990017)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990037
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990018)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990038
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990019)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990039
removetime = 1

;===============poisoning yourself see state 1520 for more info================

;ID ranges include; each represents how much life per tick is lost
;99990040 = -1
;99990041 = -2
;99990042 = -3
;99990043 = -4
;99990044 = -5
;99990045 = -10
;99990046 = -15
;99990047 = -20
;99990048 = -25
;99990049 = -30
;ID ranges include; each represents how much life per tick is gained
;99990050 = +1
;99990051 = +2
;99990052 = +3
;99990053 = +4
;99990054 = +5
;99990055 = +10
;99990056 = +15
;99990057 = +20
;99990058 = +25
;99990059 = +30

;this explod tells how long the duration of poison should last
[State 0, Explod]
type = Explod
trigger1 = NumProjID(99990040)
anim = 1
ID = 99990040
removetime = 300

[State 0, RemoveExplod];removes poison when you hit P2
type = RemoveExplod
trigger1 = P2MoveType = H
id = 99990040
ignorehitpause = 1

;this explod tells how long the duration of poison PalFX should last
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990040)
anim = 1
ID = 1509
removetime = 1
ignorehitpause = 1

[State 0, RemoveExplod];removes poison PalFX when you hit P2
type = RemoveExplod
trigger1 = P2MoveType = H
id = 1509
ignorehitpause = 1

[State -2, CAPCOM Purple Poison PalFX]
type = PalFX
trigger1 = NumExplod(1509)
time = 1
add = 100 + 85 * sin(2 * pi * gametime / 10),0 + 110 * sin(2 * pi * gametime / 10),100 + 55 * sin(2 * pi * gametime / 10)
mul = 120,20,124 
color = 0 
invertall = 0

;ID ranges include; each represents how much life per tick is lost
;99990060 = -1
;99990061 = -2
;99990062 = -3
;99990063 = -4
;99990064 = -5
;99990065 = -10
;99990066 = -15
;99990067 = -20
;99990068 = -25
;99990069 = -30
;ID ranges include; each represents how much life per tick is gained
;99990070 = +1
;99990071 = +2
;99990072 = +3
;99990073 = +4
;99990074 = +5
;99990075 = +10
;99990076 = +15
;99990077 = +20
;99990078 = +25
;99990079 = +30

;this explod tells how frequently the poison should take or give life
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990040)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990060
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990041)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990061
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990042)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990062
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990043)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990063
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990044)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990064
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990045)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990065
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990046)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990066
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990047)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990067
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990048)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990068
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990049)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990069
removetime = 1

;this explod tells how frequently the poison should take or give life
[State 0, Explod]
type = Explod
trigger1 = NumExplod(9999005)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990070
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990051)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990071
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990052)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990072
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990053)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990073
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990054)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990074
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990055)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990075
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990056)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990076
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990057)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990077
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990058)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990078
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990059)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often the poison takes/gives life
anim = 1
ID = 99990079
removetime = 1

;===============it's time to take or give the life from poisoning================
; opponent poisons you
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990020)
value = -1
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990021)
value = -2
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990022)
value = -3
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990023)
value = -4
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990024)
value = -5
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990025)
value = -10
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990026)
value = -15
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990027)
value =-20
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990028)
value = -25
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990029)
value = -30
kill = 0

; opponent heals you
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990030)
value = 1
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990031)
value = 2
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990032)
value = 3
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990033)
value = 4
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990034)
value = 5
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990035)
value = 10
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990036)
value = 15
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990037)
value = 20
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990038)
value = 25
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = enemy, NumExplod(99990039)
value = 30
kill = 0

;you poison yourself
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990060)
value = -1
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990061)
value = -2
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990062)
value = -3
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990063)
value = -4
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990064)
value = -5
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990065)
value = -10
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990066)
value = -15
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990067)
value = -20
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990068)
value = -25
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990069)
value = -30
kill = 0

;you heal yourself
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990070)
value = 1
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990071)
value = 2
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990072)
value = 3
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990073)
value = 4
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990074)
value = 5
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990075)
value = 10
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990076)
value = 15
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990077)
value = 20
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990078)
value = 25
kill = 0
[State 0, LifeAdd]
type = LifeAdd
trigger1 = NumExplod(99990079)
value = 30
kill = 0

;===============taking power from P2: this is pretty much identical to poisoning so no examples are given in char================

;ID ranges include; each represents how much meter per tick is lost
;99990100 = -1
;99990101 = -2
;99990102 = -3
;99990103 = -4
;99990104 = -5
;99990105 = -10
;99990106 = -15
;99990107 = -20
;99990108 = -25
;99990109 = -30
;ID ranges include; each represents how much meter per tick is gained
;99990110 = +1
;99990111 = +2
;99990112 = +3
;99990113 = +4
;99990114 = +5
;99990115 = +10
;99990116 = +15
;99990117 = +20
;99990118 = +25
;99990119 = +30

;this explod tells how long the duration of meter drain/give should last
[State 0, Explod]
type = null;Explod
trigger1 = NumProjID(99990100)
anim = 1
ID = 99990100
removetime = 300 ;adjusts how long p2 is meter drain/give status
removeongethit = 1 ;removes status when you are hit

;ID ranges include; each represents how much meter per tick is lost
;99990120 = -1
;99990121 = -2
;99990122 = -3
;99990123 = -4
;99990124 = -5
;99990125 = -10
;99990126 = -15
;99990127 = -20
;99990128 = -25
;99990129 = -30
;ID ranges include; each represents how much meter per tick is gained
;99990130 = +1
;99990131 = +2
;99990132 = +3
;99990133 = +4
;99990134 = +5
;99990135 = +10
;99990136 = +15
;99990137 = +20
;99990138 = +25
;99990139 = +30

;this explod tells how frequently to take meter
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990100)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990120
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990101)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990121
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990102)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990122
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990103)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990123
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990104)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990124
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990105)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990125
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990106)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990126
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990107)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990127
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990108)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990128
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990109)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990129
removetime = 1

;this explod tells how frequently to give meter
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990110)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990130
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990111)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990131
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990112)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990132
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990113)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990133
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990114)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990134
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990105)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990135
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990116)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990136
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990117)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990137
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990118)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990138
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990119)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990139
removetime = 1

;===============poisoning yourself see state 1520 for more info================

;ID ranges include; each represents how much life per tick is lost
;99990140 = -1
;99990141 = -2
;99990142 = -3
;99990143 = -4
;99990144 = -5
;99990145 = -10
;99990146 = -15
;99990147 = -20
;99990148 = -25
;99990149 = -30
;ID ranges include; each represents how much life per tick is gained
;99990150 = +1
;99990151 = +2
;99990152 = +3
;99990153 = +4
;99990154 = +5
;99990155 = +10
;99990156 = +15
;99990157 = +20
;99990158 = +25
;99990159 = +30

;this explod tells how long the duration of taking/giving meter should last
[State 0, Explod]
type = Null;Explod
trigger1 = NumProjID(99990140)
anim = 1
ID = 99990140
removetime = 300

[State 0, RemoveExplod];removes meter status when you hit P2
type = Null;RemoveExplod
trigger1 = P2MoveType = H
id = 99990140
ignorehitpause = 1

;ID ranges include; each represents how much life per tick is lost
;99990160 = -1
;99990161 = -2
;99990162 = -3
;99990163 = -4
;99990164 = -5
;99990165 = -10
;99990166 = -15
;99990167 = -20
;99990168 = -25
;99990169 = -30
;ID ranges include; each represents how much life per tick is gained
;99990170 = +1
;99990171 = +2
;99990172 = +3
;99990173 = +4
;99990174 = +5
;99990175 = +10
;99990176 = +15
;99990177 = +20
;99990178 = +25
;99990179 = +30

;this explod tells how frequently the status should take or give meter
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990140)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990160
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990141)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990161
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990142)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990162
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990143)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990163
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990144)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990164
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990145)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990165
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990146)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990166
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990147)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990167
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990148)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990168
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990149)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990169
removetime = 1

;this explod tells how frequently the status should take or give meter
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990150)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990170
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990151)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990171
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990152)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990172
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990153)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990173
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990154)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990174
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990155)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990175
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990156)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990176
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990157)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990177
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990158)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990178
removetime = 1
[State 0, Explod]
type = Explod
trigger1 = NumExplod(99990159)
trigger1 = GameTime%15 = 0 ;edit gametime% to change how often it takes/gives meter
anim = 1
ID = 99990179
removetime = 1

;===============it's time to take or give the meter================
; opponent drains meter
[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990120)
value = -1

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990121)
value = -2

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990122)
value = -3

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990123)
value = -4

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990124)
value = -5

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990125)
value = -10

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990126)
value = -15

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990127)
value =-20

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990128)
value = -25

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990129)
value = -30


; opponent gives meter
[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990130)
value = 1

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990131)
value = 2

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990132)
value = 3

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990133)
value = 4

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990134)
value = 5

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990135)
value = 10

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990136)
value = 15

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990137)
value = 20

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990138)
value = 25

[State 0, PowerAdd]
type = PowerAdd
trigger1 = enemy, NumExplod(99990139)
value = 30


;you take your own meter
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990160)
value = -1

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990161)
value = -2

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990162)
value = -3

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990163)
value = -4

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990164)
value = -5

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990165)
value = -10

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990166)
value = -15

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990167)
value = -20

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990168)
value = -25

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990169)
value = -30


;you add to your own meter
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990170)
value = 1

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990171)
value = 2

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990172)
value = 3

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990173)
value = 4

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990174)
value = 5

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990175)
value = 10

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990176)
value = 15

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990177)
value = 20

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990178)
value = 25

[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumExplod(99990179)
value = 30

;===============continued from Smash Kung Fu Upper connecting================
;This creates an explod when P2 hits the ground if they have ID 3051
[State -2, Explod]
type = Explod
trigger1 = NumExplod(3051)<2   ;This limits the number of times the explod is created. It will only create the explod if less than 2 are alive
trigger1 = NumTarget(3051)     ;This tells it which ID the opponent should have
trigger1 = target,Pos Y >= 0
trigger1 = target,Vel Y > 0
anim = 1
ID = 3051
removetime = -1                   ;this means the explod will stay forever
ignorehitpause = 1

;this removes the above explods
[State -2, RemoveExplod]
type = RemoveExplod
trigger1 = P2MoveType != H      ;remove the explod if the opponent is no longer in a hitstate
id = 3051
ignorehitpause = 1

;This removes life from the opponent when the land after being hit by Smash Kung Fu Upper
;you will use this method instead of fall.damage because this method will scale in accordance with the opponent's defence properly
[State -2, TargetLifeAdd]
type = TargetLifeAdd
trigger1 = NumExplod(3051)=1  ;This uses the explod as the limiter. If there is 1 explod it is true
trigger1 = NumTarget(3051)
trigger1 = target,Pos Y >= 0
trigger1 = target,Vel Y > 0
value = -70                      ;this is how much life you remove from the opponent
ID = -1
kill = 1                        ;This means it can kill the opponent

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

;"Ever notice that, for example, in Street Fighter if Ryu does a hurricane kick and you 
;crouch he'll just go over you?  Ever noticed that Mugen is rarely like that?  That's because the size of a character in a fighting game, or rather its "pushing area", changes depending on whether it is standing, crouching, jumping and so on.  In Mugen it is always the same, however, so a character is always equally easy to push no matter if he's in any of those situations.
;There are two ways to fix this in Mugen, one requires changing every single character 
;in existence, while the other just goes on your character and makes it react to others as it should. 
;The latter is of course the one I used, and it is merely one piece of code that goes in State -3:
;This will also make jump-ins and crossups easier to execute, or basically anything related to air to ground contact.
;The values used here (22, 48 and 11) aren't some universal rules you must follow but
;rather some I cooked up while checking some games, so, while they are fine, you're free to modify them for each character." -Phantom of the Server

[State -3, Variable Height]
type= playerpush
triggerall= statetype=A && movetype!=H && numenemy
triggerall= p2bodydist x = [-(enemynear,const(size.ground.back) + enemynear,const(size.ground.front)), 0]; checks if both characters are within each other's width
trigger1= p2statetype=S
trigger1= p2dist y >= (enemynear,const(size.height) - 22)
trigger2= p2statetype=C
trigger2= p2dist y >= (enemynear,const(size.height) - 48)
trigger3= p2statetype=L
trigger3= p2dist y >= 11
value= 0
ignorehitpause= 1