
;=====================
;Variable list
; This list does not account for variables used by helpers (states 10000-50000).
; Unless stated otherwise here or in the code, the helper variables don't correspond at all to the main ones.

; Var(0)- Throw Check (0 = Allowed, 1 = Disallowed)
; Var(1) - Button Buffer Check (Kobi Kyaku Brake)
; Var(2) - Version Detection (Tenshou Ranki)

; Var(5) - Super Jump Detection (0 = Off, 1 = On)
; Var(6) - Jump/Hop Detection (1 = Hop, 2 = Jump)


; Var(9) - Air Throw Check

; Var(10) - Statedef -2, Superpause Check Variable
; Var(11) - Statedef -2, Cornerpush Variable

; Var(15) - Juggle: determines what kind of fall state the opponent is in.
	; 0: None.
	; 1: Air reset (Only air basics/special moves/super moves can juggle.)
	; 2: Special air juggle (only special moves/super moves may juggle).
	; 3: Super air juggle (only super moves may juggle).
	; 4: Universal reset (no juggles allowed.)
; Var(16) - MoveHit/Contact Detection (1 = Hit, 2 = Guarded, 3 = Whiffed, 4 = Reversed)
; Var(17) - Cancel Detection - Determines when normal and special moves are allowed to be canceled.
; Var(18) - Attack Type (1 = Light Attacks, 2 = Medium Attacks, 3 = Heavy Attacks)

; Var(21) - Counterhit variable 1 (0: opponent is idle, 1: opponent is attacking)
; Var(22) - Counterhit variable 2 (counterhit timer)

; Var(25) - Dive kick limiter

; Var(30) - Drive Meter value
; Var(31) - HD Switch

; Var(35) - Drive Meter Pos X
; Var(36) - Drive Meter Pos Y

;Floats
;--------
; FVar(10) - Statedef -2, Cornerpush Variable
; FVar(20) - Damage Dampening System (keeps count of the % to decay the damage by)

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

[Data]
life = 1000			;Amount of life to start with
power = 5000		;Amount of maximum power
attack = 100		;attack power (more is stronger)
defence = 100		;defensive power (more is stronger)
fall.defence_up = 50	;Percentage to increase defense everytime player is knocked down
liedown.time = 30		;Time which player lies down for, before getting up
airjuggle = 15		;Number of points for juggling
sparkno = 2			;Default hit spark number for HitDefs
guard.sparkno = 40	;Default guard spark number
KO.echo = 0			;1 to enable echo on KO
volume = 0			;Volume offset (negative for softer)
IntPersistIndex = 0	;Variables with this index and above will not have their values
FloatPersistIndex = 0 ;reset to 0 between rounds or matches. There are 60 int variables,
 				;indexed from 0 to 59, and 40 float variables, indexed from 0 to 39.
 				;If omitted, then it defaults to 60 and 40 for integer and float
 				;variables repectively, meaning that none are persistent, i.e. all
 				;are reset. If you want your variables to persist between matches,
 				;you need to override state 5900 from common1.cns.


[Size]
xscale = 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 j.over)
attack.dist = 160		;Default attack distance
proj.attack.dist = 90	;Default attack distance for projectiles
proj.doscale = 0		;Set to 1 to scale projectiles too  
head.pos = -5, -90	;Approximate position of head
mid.pos = -5, -60		;Approximate position of midsection
shadowoffset = 0		;Number of pixels to vertically offset the shadow
draw.offset = 0,0		;Player drawing offset in pixels (x, y)

[Velocity]
walk.fwd = 3.1		;Walk forward
walk.back = -3.0		;Walk backward
run.fwd = 6, -4		;Run forward (x, y)
run.back = -4.5,-3.8	;Hop backward (x, y)
jump.neu = 0,-11	;Neutral jump velocity (x, y)
jump.back = -2.55		;Jump back Speed (x, y)
jump.fwd = 2.5		;Jump forward Speed (x, y)
runjump.back = -4.330078125,-11                ;Running jump speeds (opt)
runjump.fwd = 4.330078125,-11  

[Movement]
airjump.num = 0		;Number of air jumps allowed (opt)
airjump.height = 35	;Minimum distance from ground before you can air j.(opt)
yaccel = .56		;Vertical acceleration
stand.friction = .85	;Friction coefficient when standing
crouch.friction = .82	;Friction coefficient when crouching
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**
stand.friction.threshold = 2     ;If player's speed drops below this threshold while standing, stop his movement **MUGEN 1.0**
crouch.friction.threshold = .05    ;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,0      ;Offset for player bouncing off the ground (x, y) **MUGEN 1.0**
down.bounce.yaccel = .5        ;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**

[Quotes]
victory0 = "A tad of courage... That's what fuels me."
victory1 = "Hee, hee! Didja see that? I'm a real fighter, aren't I?"
victory2 = "Hey, I did it! I did it, big brother! I fought like a pro!"
victory3 = "Hey, Itokatsu. How'd you get in there? Watch it, you silly sable!"
victory4 = "What am I doing here... in such an awesome tournament? I want to go home...!"
victory5 = "You were stronger. But my courage led me to victory--tiny though it may be."
victory6 = "Heh, heh, that was a good match. I'd like to fight you again."
victory7 = "I won't lose! I've got someone to protect, too!"
victory8 = "Itokatsu... Are you worrying about me? It's OK. I wouldn't give up in a place like this!"
victory9 = "It's alright... I'll meet him... I know I will..."
victory10 = "It's scary, alright... But we have to move forward! Right, Itokatsu?"
victory11 = "I've prepared myself for this tournament. Don't go easy on me!"
victory12 = "Oh, no! I'm sorry I was frantic and... Um, are you OK?"
victory13 = "You have beautiful eyes. You must have an innocent soul... Do you think we could be friends?"
;---------------------------------------------------------------------------
; Lose by Time Over
[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
[Statedef 180]
type = S

[State 180, 1]
type = ChangeState
trigger1 = Time = 0
value = 181+Random%2

;---------------------------------------------------------------------------
; Win pose 1
[Statedef 181]
type = S
ctrl = 0
anim = 181
velset = 0,0

[State 181, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 1
value = S181,0
volumescale = 100

[State 181, Explod]
type = Explod
trigger1 = !Time
anim = 10181
ID = 10181
pos = 0,0
postype = p1 
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 0
scale = 1,1
sprpriority = 3
ownpal = 1
removeongethit = 1

[State 181, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 5
value = S181,1
volumescale = 100

[State 181, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 9
value = S181,2
volumescale = 100

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

;---------------------------------------------------------------------------
; Win pose 2
[Statedef 182]
type = S
ctrl = 0
anim = 182
velset = 0,0

[State 182, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 2
value = S182,0
volumescale = 100

[State 182, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 8
value = S182,1
volumescale = 100

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

;---------------------------------------------------------------------------
; Win pose 3
[Statedef 183]
type = S
ctrl = 0
anim = 183
velset = 0,0

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

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

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

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

[State 191, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 9
value = S195,0
volumescale = 100

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

;---------------------------------------------------------------------------
; Introduction 2
[Statedef 192]
type = S
ctrl = 0
anim = 192
velset = 0,0

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

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

[State 192, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 2
value = S192,0
volumescale = 100

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

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

[State 195, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 1
value = S195,0
volumescale = 100

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

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

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

[Statedef -2]

[State -2, Universal Air Block Disabled]
type = AssertSpecial
trigger1 = 1
flag = noairguard
ignorehitpause = 1

[State -2, StopSnd]
type = StopSnd
trigger1 = StateNo != 100
channel = 3
ignorehitpause = 1

[State -2, Helper]
type = Helper
trigger1 = winko && (stateno = [3000,3999])
triggerall = NumHelper(8100) < 1
name = "winko"
ID = 8100
stateno = 8100
pos = 0,0
postype = left   ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
supermovetime = 999
pausemovetime = 999
ignorehitpause = 1

[State -2, VarSet]
type = VarSet
trigger1 = StateType != A && MoveType = I
trigger2 = MoveType = H
var(25) = 0
ignorehitpause = 1
persistent = 0

[State -2, VarSet]
type = VarSet
trigger1 = PrevStateNo = 632
var(25) = 2
ignorehitpause = 1
persistent = 0

[State -2, Intro Blank]
type = AssertSpecial
triggerall = RoundNo = 1
trigger1 = RoundState < 2
flag = nobardisplay
ignorehitpause = 1

[State -2, StateTypeSet]
type = StateTypeSet
trigger1 = Pos Y != 0 
statetype = A       
ignorehitpause = 1
persistent = 1

[State -2, HD Meter Helper]
type = Helper
trigger1 = roundstate=2
triggerall = NumHelper(22010) < 1
name = "HD Meter"
ID = 22010
stateno = 22010
pos = 0,0
postype = left   ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
supermovetime =999
pausemovetime = 999
ignorehitpause = 1

[State -2, Debug]
type = DisplayToClipboard
trigger1 = 1
text = "Air Throws = %d"
params = var(9)

[State -2, P2 Facing]
type = targetfacing
trigger1 = movecontact = 1 && numtarget = 1
trigger1 = !(target,hitshakeover) && !(target,hitfall) && (target,time <= 1)
value = ifelse(p2dist x>= 0, -1, 1)
ignorehitpause = 1

[State -2, Throws Disallowed]; Resets condition every tick to check again
type = VarSet
trigger1 = 1
var(0) = 0

[State -2, Throws Disallowed]
type = VarSet
triggerall = NumEnemy
triggerall = RoundState = 2
trigger1 = (enemynear,stateno = [150,155])
trigger2 = enemynear,movetype = H 
trigger3 = (enemynear,stateno = [5020,5040]) && !(enemynear,hitfall)
trigger4 = ((enemynear,stateno = 0) || (enemynear,stateno = 52)) && (enemynear,prevstateno = [5000,5040]) && ((enemynear,time <= 0) || !(enemynear,ctrl))
trigger5 = (enemynear,stateno = 0) && (enemynear,prevstateno = 52) && ((enemynear,time <= 0) || !(enemynear,ctrl))
trigger6 = (enemynear,stateno = 40) && (enemynear,time>= 1 || enemynear,prevstateno = 0 || enemynear,prevstateno = 52)
trigger7 = MoveType = H
trigger8 = StateType = L
trigger9 = EnemyNear,StateType = L
trigger10 = var(15) > 0
trigger11 = P2BodyDist X > 20
var(0) = 1

[State -2, Air Throws Disallowed]; Resets condition every tick to check again
type = VarSet
trigger1 = 1
var(9) = 0

[State -2, Air Throws Disallowed]
type = VarSet
triggerall = NumEnemy
triggerall = RoundState = 2
trigger1 = (enemynear,stateno = [150,155])
trigger2 = StateType != A
trigger3 = EnemyNear, StateType != A
trigger4 = ((enemynear,stateno = 0) || (enemynear,stateno = 52)) && (enemynear,prevstateno = [5000,5040]) && ((enemynear,time <= 0) || !(enemynear,ctrl))
trigger5 = (enemynear,stateno = 0) && (enemynear,prevstateno = 52) && ((enemynear,time <= 0) || !(enemynear,ctrl))
trigger6 = (enemynear,stateno = 40) && (enemynear,time>= 1 || enemynear,prevstateno = 0 || enemynear,prevstateno = 52)
trigger7 = MoveType = H
trigger8 = StateType = L
trigger9 = EnemyNear,StateType = L
trigger10 = P2BodyDist X > 30
trigger11 = var(15) >= 4
var(9) = 1

[State -2, Prevent Underground Juggles]
type = targetbind
trigger1 = movehit = 1
trigger1 = numtarget = 1 && numenemy
trigger1 = (target,time <= 1) && (target,ID = enemynear,ID); this is just to prevent Simul issues as usual
trigger1 = !(target,hitshakeover) && (target, hitfall) && (target, pos y>0)
pos = ceil(p2dist x), ceil(-pos y); keeps P2 at the same horizontal distance, but resets his Y position
ignorehitpause = 1

;================================================================================
; ------- KOF Cornerpush System by Vans --------
;===============================================================================
[State -2, Superpause Check]
type = VarAdd
trigger1 = var(10)
var(10) = -1

[State -2, Reset Time counter]
type = VarSet
trigger1 = movecontact = 1
var(11) = 0

[State -2, Accel]
type = VarSet
triggerall = roundstate = 2
triggerall = var(10) <=  0
triggerall = numtarget >= 1
trigger1 = target, hitshakeover
fvar(10) = (target, gethitvar(xvel)*exp((-0.1886)*((var(11)))))

[State -2, Push]
type = PosAdd
triggerall = roundstate = 2
triggerall = !var(10)
triggerall = numtarget >= 1
triggerall = (target, BackEdgeBodyDist <=  0) || (target, FrontEdgeBodyDist <=  0)
triggerall = target,statetype != L
triggerall = target,statetype != A
trigger1 = Statetype != A
x = ifelse(facing = -1,fvar(10),-fvar(10))

[State -2, Increase]
type = VarSet
triggerall = numtarget >= 1
triggerall = target, hitshakeover
trigger1 = var(10) <=  0
trigger1 = var(11)
var(11) = var(11)+1

[State -2, Time counter]
type = VarSet
trigger1 = !var(11)
trigger1 = fvar(10)
var(11) = 1

[State -2, Freeze Pos During Superpause]
type = PosFreeze
trigger1 = var(10)
value = 1

[State -2, Drop]
type = VarSet
triggerall = fvar(10)
trigger1 = !numtarget
trigger2 = projcontact = 1
trigger3 = movecontact = 1
fvar(10) = 0
ignorehitpause = 1

;================================================================================
; ------- COUNTER HIT by Vans (Based on Sander's Method) --------
;===============================================================================
[State -2, VarSet];Checks if opponent is in attack state
type = VarSet
triggerall = numenemy
trigger1 = enemy, movetype = a
var(21) = 1
ignorehitpause = 1

[State -2, VarSet];This resets the condition if counter not succesful and succesful
type = VarSet
triggerall = numenemy
trigger1 = enemy, movetype = i || var(22) >= 1 ;Enemy is Idle | Counter was Succesful
trigger2 = var(22) > 10 && enemy, movetype = h ;10 ticks passed & enemy is on gethit state
trigger3 = MoveType = I
var(21) = 0
ignorehitpause = 1

[State -2, Counter Hit Succesful]
type = VarSet
trigger1 = var(21) = 1 && var(16) = 1 ;Counter Check Ok, Move Hit Succesfully.
triggerall = StateNo != [190,199] ;Does not activate during intros.
triggerall = StateNo != 251
triggerall = StateNo != [800,899] ;Does not activate during throws.
triggerall = StateNo != [1020,1021]
triggerall = StateNo != [2020,2021]
triggerall = StateNo != [3011,3012]
var(22) = 1
ignorehitpause = 1

[State -2, Counter Hit Timer]
type = VarAdd
trigger1 = var(22) >= 1 ;Counter was succesful
var(22) = 1
ignorehitpause = 1

[State -2, Counter Hit Reset]
type = VarSet
trigger1 = var(22) >= 30 && var(16) = 1;Reset if 22 ticks passed and move hit
trigger2 = p2movetype != h ;Reset if P2 is no longer in gethit state
trigger3 = movetype = h ;Reset if P1 is getting hit
var(22) = 0
ignorehitpause = 1

[State -2, CH Explod]
type = Explod
triggerall = MoveType != H
triggerall = numenemy
triggerall = var(21)
triggerall = StateNo != [190,199] ;Does not activate during intros.
triggerall = StateNo != 251
triggerall = StateNo != [800,899] ;Does not activate during throws.
triggerall = StateNo != [1020,1021]
triggerall = StateNo != [2020,2021]
triggerall = StateNo != [3011,3012]
trigger1 = var(21) = 1 && Var(16) = 1 ;Move hit, Ok
trigger1=numexplod(12040)<1
anim = ifelse(teamside=1,12040,12042)
ID = 12040
pos = ifelse(teamside=1,0,200),80
postype = left  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
pausemovetime =30
scale = .5,.5
sprpriority = 5
ontop = 1
shadow = 0,0,0
ownpal = 1
removeongethit = 0
ignorehitpause=1

[State -2, CH Subt.]
type = Explod
triggerall = MoveType != H
triggerall = numenemy
triggerall = var(21)
triggerall = StateNo != [190,199] ;Does not activate during intros.
triggerall = StateNo != 251
triggerall = StateNo != [800,899] ;Does not activate during throws.
triggerall = StateNo != [1020,1021]
triggerall = StateNo != [2020,2021]
triggerall = StateNo != [3011,3012]
trigger1 = var(21) = 1 && Var(16) = 1 ;Move hit, Ok
trigger1 = numexplod(12040)<1
anim = ifelse(teamside=1,12041,12043)
ID = 12040
pos = ifelse(teamside=1,0,200),80
postype = left  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
pausemovetime =30
scale = .5,.5
sprpriority = 4
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 0
ignorehitpause=1

;== 

[State -2, HD Meter Max Value]
type = VarSet
trigger1 = var(30) > 1000 
var(30) = 1000
ignorehitpause =1 
persistent = 1

[State -2, HD Meter Gain Disabled]
type = VarSet
trigger1 = var(31)=1 && roundstate!=2 
var(30) = 0

[State -2, HD Meter Min Value]
type = VarSet
trigger1 = var(30) < 0 
var(30) = 0

[State -2, HD Meter Increase (Normals)]
type = VarAdd
triggerall = StateNo = [200,650]
triggerall = var(31) = 0 && var(30) < 1000
trigger1 = movecontact = 1 
var(30) = IfElse(MoveHit = 1, IfElse(Var(18) = 1, 30, 50), IfElse(Var(18) = 1, 10, 30))
ignorehitpause = 0
persistent = 0

[State -2, HD Meter Increase 1 (Specials)]
type = VarAdd
triggerall = StateNo = [1000,2099]
triggerall = var(31) = 0 && var(30) < 1000
triggerall = (StateNo != [1000,1001]) && StateNo != 2000
triggerall = StateNo !=[1005,1006]
triggerall = StateNo !=[1015,1016]
triggerall = StateNo != [1020,1022]
triggerall = StateNo != [1025,1026]
triggerall = StateNo != 2005
triggerall = StateNo != 2015
triggerall = StateNo != [2020,2021]
trigger1 = movecontact = 1 
var(30) = IfElse(MoveHit = 1, 70, 35)
ignorehitpause = 0
persistent = 0

[State -2, HD Meter Increase 2 (Specials)]
type = VarAdd
triggerall = StateNo = [1000,2099]
triggerall = var(31) = 0 && var(30) < 1000
triggerall = movecontact = 1 
trigger1 = StateNo = [1005,1006]
trigger2 = StateNo = [1015,1016]
trigger3 = StateNo = 1021
trigger4 = StateNo = [1025,1026]
trigger5 = StateNo = 2005
trigger6 = StateNo = 2015
trigger7 = StateNo = 2021
var(30) = IfElse(MoveHit = 1, 25, 15)
ignorehitpause = 0
persistent = 0


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

[Statedef -3]

[State -3, HD Meter Full (Training)]
type = VarSet
triggerall = Power = 5000 && Life = 1000
triggerall = StateNo < 200
trigger1 = var(31) = 0
trigger1 = var(30) < 1000
trigger1 = RoundState < 2
var(30) = 1000
persistent = 1

[State -3, Superjump VarSet]
type = VarSet
trigger1 = command = "highjump"
var(5) = 1

[State -3, Superjump Var Reset]
type = VarSet
trigger1 = stateno != [40,50]
trigger2 = MoveType = H
var(5) = 0

[State -3, CornerPush Disabled]
type = VarSet
triggerall = Vel X = 0
triggerall = Vel Y = 0
trigger1 = NumHelper(30000) = 1
trigger2 = NumHelper(30001) = 1
trigger3 = NumHelper(30002) = 1
trigger4 = StateNo = [3000,3050]
var(10) = 2

[State -3, Standard Victory Quote]
type = VictoryQuote
triggerall = NumEnemy
trigger1 = !WinPerfect
value = Random%12

;== Juggle System by Zero-Sennin ==

[State -3, var(15) = 1 (Air Reset)]
type = VarSet
triggerall = var(22) <= 0
triggerall = stateno = [200,650)
triggerall = StateNo != [250,251]
triggerall = MoveHit
triggerall = NumTarget
trigger1 = Target, StateNo = [5030,5040]
var(15) = 1
ignorehitpause = 1
persistent = 0

[State -3, var(15) = 4 (Full Reset)]
type = VarSet
trigger1 = StateNo = [3000,3050]
trigger1 = MoveType = I
trigger2 = StateNo = [800,899]
trigger3 = NumEnemy
trigger3 = EnemyNear,StateType = L || EnemyNear, StateNo = [5100,5210]
trigger4 = RoundState != 2
var(15) = 4
ignorehitpause = 1

[State -3, var(15) = 0 (Enemy Recovers)]
type = VarSet
trigger1 = NumEnemy
trigger1 = EnemyNear,MoveType != H
trigger1 = EnemyNear, StateNo != [5030,5040]
trigger1 = EnemyNear, StateNo != [5100,5210]
trigger2 = MoveType = H
trigger3 = StateType = L
trigger4 = var(22) >= 1
var(15) = 0
ignorehitpause = 1
persistent = 0

;== Hit Detection ==

[State -3, Var(16) MoveHit]
type = VarSet
trigger1 = movehit
var(16) = ifElse(MoveHit,1,3)
ignorehitpause = 1

[State -3, Var(16) Move/Projectile Guarded/Reversed]
type = VarSet
trigger1 = MoveGuarded
trigger2 = ProjGuarded = 1
trigger3 = MoveReversed
var(16) = ifElse((MoveGuarded||MoveReversed),2,4)
ignorehitpause = 1

[State -3, Var(16) Reset]
type = VarSet
trigger1 = Time = 1
trigger2 = MoveType = I
trigger3 = MoveType = H
var(16) = 0
ignorehitpause = 1

;==
; Special, Super, Drive Cancels

[State -3, Special Cancel Variable Set (Whiff)]
type = VarSet
triggerall = MoveType = A
trigger1 = (StateNo = [200,201]) && AnimElemTime(2) >= 0 && AnimElemTime(4) < 0
trigger2 = (StateNo = [210,211]) &&  IfElse(StateNo = 210, AnimElemTime(6) >= 0, AnimElemTime(5) >= 0) && IfElse(StateNo = 210, AnimElemTime(8) < 0, AnimElemTime(7) < 0)
trigger3 = (StateNo = [230,231]) && AnimElemTime(3) < 0 && AnimElemTime(5) < 0
trigger4 = StateNo = 250 && AnimElemTime(8) >= 0 && AnimElemTime(11) < 0
trigger5 = (StateNo = 400) && AnimElemTime(2) >= 0 && AnimElemTime(4) < 0
trigger6 = (StateNo = 410) && AnimElemTime(7) >= 0 && AnimElemTime(9) < 0
trigger7 = StateNo = 430 && AnimElemTime(3)>= 0
var(17) = 1
ignorehitpause = 1

[State -3, Special Cancel Variable Set (Hit)]
type = VarSet
triggerall = Var(31) = 0
triggerall = MoveType = A
trigger1 = (StateNo = [200,440)) && MoveContact
trigger1 = StateNo != [240,241]
trigger2 = StateNo = [600,641]
trigger2 = MoveContact
var(17) = 1
ignorehitpause = 1

[State -3, Special Cancel Variable Set (HD Mode)]
type = VarSet
triggerall = MoveType = A
triggerall = Var(31) = 1
triggerall = StateNo = [200,650] 
triggerall = StateNo != 440
trigger1 = Var(16) = [1,2]
var(17) = 1
ignorehitpause = 1

[State -3, Drive Cancel Variable Set]
type = VarSet
triggerall = var(31) = 0
triggerall = (StateNo = [1000,2099]) && (StateNo != [1000,1001]) && StateNo != 2000
triggerall = (StateNo != [1020,1022]) && (StateNo != [2020,2021])
trigger1 = MoveHit = 1
trigger1 = var(30) >= 500
var(17) = 2
ignorehitpause = 1

[State -3, HD Cancel Variable Set 1]
type = VarSet
triggerall = var(31) = 1
triggerall = (StateNo = [1000,2099]) && (StateNo != [1000,1001]) && StateNo != 2000
triggerall = (StateNo != [1020,1022]) && (StateNo != [2020,2021])
trigger1 = MoveContact = 1
trigger1 = var(30) >= IfElse((StateNo = [1000,1999]), 150, 175)
var(17) = 2
ignorehitpause = 1

[State -3, Cancel Variable Reset 1]
type = VarSet
trigger1 = Var(16) = 0
trigger1 = (StateNo = [1000,2099]) && (StateNo = [1000,1001]) && StateNo = 2000 && (StateNo != [1020,1022]) && (StateNo != [2020,2021])
trigger2 = MoveType = H
trigger3 = Time = 1
trigger4 = (stateno = [600,650]) && PrevStateNo = 631
trigger5 = Var(31) = 0 && Var(17) = 2
trigger5 = Var(30) < 500
trigger6 = Var(31) = 1 && Var(17) = 2
trigger6 = Var(30) < IfElse((StateNo = [1000,1099]), 150, IfElse((StateNo = [2000,2099]), 175, 300))
trigger7 = MoveType = I && StateNo < 1000
trigger8 = StateNo = 251
trigger9 = Anim = 1012
var(17) = 0
ignorehitpause = 1

[State -3, Max Cancel Variable Set]
type = VarSet
triggerall = var(31) = 1
trigger1 = StateNo = [3000,3001]
trigger1 = StateType = S
var(17) = 3
ignorehitpause = 1

[State -3, MAX CANCEL Variable Reset]
type = VarSet
trigger1 = Var(31) = 0 && Var(17) = 3
var(17) = 0
ignorehitpause = 1

;== Attack Strength Detection (Self) ==

[State -3, Light Attack VarSet]
type = VarSet
triggerall = MoveType = A
trigger1 = StateNo = [200,201]
trigger2 = StateNo = 400
trigger3 = StateNo = 600
trigger4 = StateNo = [230,231]
trigger5 = StateNo = [250,251]
trigger6 = StateNo = 430
trigger7 = StateNo = [630,633]
var(18) = 1
ignorehitpause = 1

[State -3, Heavy Attack VarSet]
type = VarSet
triggerall = MoveType = A
trigger1 = StateNo = StateNo = [210,211]
trigger2 = StateNo = [240,241]
trigger3 = StateNo = 440
trigger4 = StateNo = 650
var(18) = 2
ignorehitpause = 1

[State -3, Attack Type Var Reset]
type = VarSet
trigger1 = Var(16) = 0 && MoveType = I
trigger2 = MoveType = H
var(18) = 0
ignorehitpause = 1

;== 
;Damage Dampening System

[State -3, Decay Set]
type = VarSet
triggerall = NumEnemy
trigger1 = 1
fvar(20) = 1 - IfElse(Enemy,MoveType != H, 0, .05 * Enemy,GetHitVar(HitCount))
ignorehitpause = 1
persistent = 1

[State -3, Minimum Multiplier Calculation (Normals/Specials)]
type = VarSet
triggerall = StateNo = [200, 3000)
triggerall = Enemy,GetHitVar(HitCount) > 0
triggerall = fvar(20) <=  0.2
trigger1 = 1
fvar(20) = 0.2
ignorehitpause = 1

[State -3, Minimum Multiplier Calculation (Supers)]
type = VarSet
triggerall = StateNo = [3000,3016]
triggerall = Enemy,GetHitVar(HitCount) > 0
triggerall = fvar(20) <=  0.4
trigger1 = 1
fvar(20) = 0.4
ignorehitpause = 1

[State -3, Minimum Multiplier Calculation (NEOMAX)]
type = VarSet
triggerall = StateNo = 3020 
triggerall = Enemy,GetHitVar(HitCount) > 0
triggerall = fvar(20) <= 0.5
trigger1 = 1
fvar(20) = 0.5
ignorehitpause = 1

;== 

[State -3, Jumping Sound]
type = PlaySnd
trigger1 = Time = 1
trigger1 = stateno = 50 && PrevStateNo = 40
trigger2 = Time = 1
trigger2 = StateNo = 105
trigger3 = AnimElem = 2
trigger3 = Anim = 1015 || Anim = 1016 || Anim = 2015
value = S40, IfElse(StateNo = 50 && Vel X != 0, var(5), 0)

[State -3, Landing Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = Anim = 47
trigger2 = Stateno = 106
trigger3 = Anim = 1017
trigger4 = Anim = [1027,1028]
trigger5 = Anim = 3002
value = S52,0

[State -3, Punch Swing 1]
type = PlaySnd
triggerall = Time = 1
trigger1 = StateNo = [200,201]
trigger2 = stateno = 400
trigger3 = stateno = 600
value = S5,6

[State -3, Punch Swing 2]
type = PlaySnd
triggerall = Time = 1
trigger1 = StateNo = [210,211]
trigger2 = stateno = 410
trigger3 = stateno = 610
value = S5, 7

[State -3, Kick Swing 1]
type = PlaySnd
triggerall = Time = 1
trigger1 = StateNo = [230,231]
trigger2 = StateNo = 250
trigger3 = stateno = 430
trigger4 = stateno = 630
trigger5 = StateNo = 650
value = S5,9

[State -3, Kick Swing 2]
type = PlaySnd
triggerall = Time = 1
trigger1 = StateNo = [240,241]
trigger2 = stateno = 440
trigger3 = stateno = 640
value = S5, 10

[State -3, Grab Miss]
type = PlaySnd
trigger1 = Anim = 800 
trigger1 = AnimElem = 3
value = S800,0
channel = 0

[State -3, Randomized Voice] ;Attack Voice
type = PlaySnd
triggerall = Time = 1
triggerall = Random % 2 = 0
trigger1 = stateno = [200,650]
trigger1 = Stateno != [250,251]
trigger1 = StateNo != 650
value = S200,Random%3
volumescale = 100
channel = 0

[State -3, Randomized Voice 2] ;CD Voice
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = [250,251]
trigger2 = StateNo = 650
value = S250,0
volumescale = 100
channel = 0

[State -3, EX Move Helper]
type = Helper
triggerall = StateNo = [2000,2999]
triggerall = StateNo != 2021
trigger1 = Time = 1
name = "EX FX"
ID = 22000
stateno = 22000
pos = 0,0
postype = p1  
facing = 1
keyctrl = 0
ownpal = 1

[State -3, Hakki Shou Voice]
type = PlaySnd 
triggerall = AnimElem = 5
trigger1 = Anim = [1000,1001]
trigger2 = Anim = 2000
value = S1000,0
channel = 0

[State -3, Sousou Shin Voice]
type = PlaySnd 
triggerall = AnimElem = 3
trigger1 = Anim = [1005,1006]
trigger2 = Anim = 2005
value = S1005,0
channel = 0

[State -3, Sousou Shin Sound]
type = PlaySnd 
triggerall = AnimElem = 5 || AnimElem = 14
trigger1 = Anim = [1005,1006]
trigger2 = Anim = 2005
value = S5, 8
channel = 1

[State -3, Kobi Kyaku Voice]
type = PlaySnd 
triggerall = AnimElem = 4
trigger1 = Anim = [1010,1011]
trigger2 = Anim = 2010
value = S1010,0
channel = 0

[State -3, Kobi Kyaku Sound]
type = PlaySnd 
triggerall = AnimElem = 4
trigger1 = Anim = [1010,1011]
trigger2 = Anim = 2010
value = S1010,1
channel = 1

[State -3, Tenshin Shou Voice]
type = PlaySnd 
triggerall = AnimElem = 3
trigger1 = Anim = [1015,1016]
trigger2 = Anim = 2015
value = S(IfElse(Anim = 1015, 1015, 1016)),0
channel = 0

[State -3, Shinjou Tai Voice]
type = PlaySnd 
triggerall = AnimElem = 4
trigger1 = Anim = 1021
value = S1021,0
channel = 0

[State -3, Rengeki Shou Voice]
type = PlaySnd 
triggerall = AnimElem = 2
trigger1 = Anim = 1025
trigger2 = Anim = 2025
value = S1025,0
channel = 0

[State -3, Rengeki Shou Sound]
type = PlaySnd 
triggerall = AnimElem = 3
trigger1 = Anim = 1025
trigger2 = Anim = 2025
value = S5,11
channel = 2

[State -3, Kobi Kyaku Explod]
type = Explod
triggerall = AnimElem = 4
trigger1 = Anim = [1010,1011]
trigger2 = Anim = 2010
anim = 11012
ID = 11010
pos = 75, -55
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
pausemovetime = 0
scale = 1,1
sprpriority = 4
shadow = 0,0,0
ownpal = 1
removeongethit = 1

[State -3, Randomized Voice 2] ;Hurt Voice
type = PlaySnd
triggerall = Time = 1
triggerall = Random < 499
triggerall = Alive
trigger1 = stateno = 5001
trigger2 = stateno = 5011
trigger3 = stateno = 5021
trigger4 = stateno = 5030
value = S5000,(Random%6)
volumescale = 100
channel = 0

;---------------------
;HD Mode Pal FX

[State -3, HD Mode PalFX]
type = palfx
triggerall = var(31) > 0
trigger1 = gametime % 14 = 0
time = 1
add = 96,96,0
color = 186
ignorehitpause = 1

[State -3, HD Mode PalFX]
type = palfx
triggerall = var(31) > 0
trigger1 = gametime % 14 = 1
trigger2 = gametime % 14 = 13
time = 1
add = 84,84,0
color = 196
ignorehitpause = 1

[State -3, HD Mode PalFX]
type = palfx
triggerall = var(31) > 0
trigger1 = gametime % 14 = 2
trigger2 = gametime % 14 = 12
time = 1
add = 72,72,0
color = 206
ignorehitpause = 1

[State -3, HD Mode PalFX]
type = palfx
triggerall = var(31) > 0
trigger1 = gametime % 14 = 3
trigger2 = gametime % 14 = 11
time = 1
add = 60,60,0
color = 216
ignorehitpause = 1

[State -3, HD Mode PalFX]
type = palfx
triggerall = var(31) > 0
trigger1 = gametime % 14 = 4
trigger2 = gametime % 14 = 10
time = 1
add = 48,48,0
color = 226
ignorehitpause = 1

[State -3, HD Mode PalFX]
type = palfx
triggerall = var(31) > 0
trigger1 = gametime % 14 = 5
trigger2 = gametime % 14 = 9
time = 1
add = 36,36,0
color = 236
ignorehitpause = 1

[State -3, HD Mode PalFX]
type = palfx
triggerall = var(31) > 0
trigger1 = gametime % 14 = 6
trigger2 = gametime % 14 = 8
time = 1
add = 24,24,0
color = 246
ignorehitpause = 1

[State -3, HD Mode PalFX]
type = palfx
triggerall = var(31) > 0
trigger1 = gametime % 14 = 7
time = 1
add = 12,12,0
color = 256
ignorehitpause = 1