;=====================
;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) - Special Throw Check (0 = Allowed, 1 = Disallowed)
; Var(2) - Input Buffer (Machine Gun Puncher, Puncher Vision, Puncher Weaving)

	; During Puncher Vision:
	; 1: Puncher Upper
	; 2: Puncher Sraight
	; 3: Puncher Weaving
	
	; During Puncher Weaving:
	; 1: Dash Puncher
	; 2: Parrying Puncher
	; 3: B Puncher Vision (fwd)
	; 4: D Puncher Vision (fwd)
	; 5: B Puncher Vision (back)
	; 6: D Puncher Vision (back)
	
	; During Crazy Puncher
	; 1: Crazy Puncher Finish 1
	; 2: Crazy Puncher Finish 2


; Var(3) - Version Check (Machine Gun Puncher, Parrying Puncher, Crazy Puncher)
	
	; During Machine Gun Puncher:
	; 1: A Machine Gun Puncher
	; 2: C Machine Gun Puncher

	; During Parrying Puncher:
	; 1: EX Parrying Puncher
	
	; During Crazy Puncher:
	; 1: Crazy Puncher Finish 1
	; 2: Crazy Puncher Finish 2

; Var(4) - Puncher Weaving Charge
	; 0 - Not charging. Becomes the charged value of X.
	; 1 - X was pressed at the start of the state. Becomes the charged value of Y.
	; 2 - Y was pressed at the start of the state.

; 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 
	;0 - No cancels allowed.
	;1 - Normals may be canceled into specials.
	;2 - Specials may be Drive Canceled or Super 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) - Projectile is Active

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

;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
volumescale = 200			;Volume offset (negative for softer)
IntPersistIndex = 0;60	;Variables with this index and above will not have their values
FloatPersistIndex = 0;40 ;reset to 0 between rounds or matches. There are 60 int variables,
 				;indexed from 0 to 59, and 40 float variables, indexed from 0 to 39.
 				;If omitted, then it defaults to 60 and 40 for integer and float
 				;variables repectively, meaning that none are persistent, i.e. all
 				;are reset. If you want your variables to persist between matches,
 				;you need to override state 5900 from common1.cns.


[Size]
xscale = 1           
yscale = 1           
ground.back = 15     
ground.front = 15    
air.back = 16        
air.front = 18       
height = 60          
attack.dist = 160    
proj.attack.dist = 90
proj.doscale = 0     
head.pos = 1, -102   
mid.pos = -8, -65    
shadowoffset = 0     
draw.offset = 0,0    

[Velocity]
walk.fwd  = 3.30078125
walk.back = -3.30078125
run.fwd  = 6.078125, 0   
run.back = -5.95703125,-4 
jump.neu = 0,-9.13671875;8.63671875
jump.back = -3.30078125
jump.fwd = 3.30078125       
runjump.back = -4.951171875,-9.13671875
runjump.fwd = 4.951171875,-9.13671875  
airjump.neu = 0 
airjump.back = 0
airjump.fwd = 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 = 0.5         ;Vertical acceleration
stand.friction = .828125  ;Friction coefficient when standing
crouch.friction = .828125 ;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 = "Let's do this again. If you butch up a bit, that is!"
victory1 = "How do you like adult women? Uh, hey! Don't get me wrong."
victory2 = "I saw a good training machine on an infomercial. Buy it!"
victory3 = "Well, I did win. Not bad for a gal, eh?"
victory4 = "Ooh yeah! I'm gonna drink to my success!"
victory5 = "Bummer. Such wild swings against a boxer... It's like saying, \"Beat me senseless, please!\""
victory6 = "I don't need a bazooka to kill a fly. One punch to a vital zone. And it's over!"
victory7 = "I don't need victory champagne. Give me a beer. And make it ice-cold!"
victory8 = "Stepping in after a one-two punch... A knob could counter that! Invention! Use it!"
;==
victory10 = "One and done, huh? At least try to get in a hit next time."
;==
victory20 = "Imitation is flattering and all, but you gotta at least try to get more than the looks right."
;---------------------------------------------------------------------------
; 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 % 3

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

[State 181, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 7
trigger2 = AnimElem = 11
value = S181,IfElse((AnimElem = 7), 0, 1)
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, 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, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 2
value = S183, 0
volumescale = 100

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

[State 191, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 13
value = S191,IfElse((AnimElem = 2), 0, 1)
volumescale = 100

[State 191, Explod]
type = Explod
trigger1 = AnimElem = 14
anim = 10191
ID = 10191
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = -5,-2
random = 0,0
removetime = -2
pausemovetime = 0
scale = 1,1
sprpriority = 3

[State 191, 2] ;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, 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, Air Guard Disable]
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]) && movehit
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, RemoveExplod]
type = RemoveExplod
triggerall = NumExplod(12000) > 0
trigger1 = StateNo = [1000,2099]
trigger1 = !Time
id = 12000

[State -2, RemoveExplod]
type = RemoveExplod
trigger1 = StateNo = [1000,2099]
trigger1 = !Time
id = 12002

[State -2, Drive Meter Helper]
type = Helper
trigger1 = roundstate=2
triggerall = NumHelper(22010) < 1
name = "Drive 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 = "Puncher Weaving Charge = %d, Juggle = %d, Cancel = %d, Drive = %d, HD = %d"
params = var(4), var(15), var(17), var(30), var(31) 

[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
trigger12 = EnemyNear, StateNo > 50000
var(0) = 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.25)*((var(11)))));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.
trigger1 = StateNo != [190,199] ;Does not activate during intros.
trigger1 = StateNo != 251
trigger1 = StateNo != [800,899]
trigger1 = StateNo != 3001
trigger1 = StateNo != [3012,3014]
trigger1 = StateNo != 3016
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 x ticks passed and move hit (var(22)'s value default = 22 ticks)
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 != 3001
triggerall = StateNo != [3012,3014]
triggerall = StateNo != 3016
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 != 3001
triggerall = StateNo != [3012,3014]
triggerall = StateNo != 3016
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 (Specials)]
type = VarAdd
triggerall = StateNo = [1000,2099]
triggerall = StateNo != [1005,1008]
triggerall = StateNo != 2005
triggerall = var(31) = 0 && var(30) < 1000
trigger1 = movecontact = 1 
var(30) = IfElse(MoveHit = 1, 70, 30)
ignorehitpause = 0
persistent = 0

[State -2, HD Meter Increase (MGP)]
type = VarAdd
triggerall = StateNo = [1000,2099]
triggerall = (StateNo = [1005,1008]) || StateNo = 2005
triggerall = var(31) = 0 && var(30) < 1000
trigger1 = movecontact = 1 
var(30) = IfElse(MoveHit = 1, 10, 5)
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 = RoundState < 2
triggerall = Power = 5000 && Life = 1000
triggerall = StateNo <= 200 || StateNo >= 5000
trigger1 = var(31) = 0
trigger1 = var(30) < 1000
trigger1 = Time > 60
var(30) = 1000
persistent = 1

[State -3, StopSnd]
type = StopSnd
trigger1 = NumExplod(11025) = 1
trigger1 = MoveType = H
channel = 1

[State -3, StopSnd]
type = StopSnd
trigger1 = Anim != 100
channel = 3

[State -3, Version Check Reset]
type = VarSet
trigger1 = MoveType = H
trigger2 = MoveType = I
var(3) = 0

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

[State -3, Superjump Var Reset]
type = VarSet
trigger1 = stateno = 52
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%9

[State -3, Perfect Victory Quote]
type = VictoryQuote
triggerall = NumEnemy
trigger1 = WinPerfect
value = 10

;== 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 = HitDefAttr = SCA,AT
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 1 (Whiff)]
type = VarSet
triggerall = MoveType = A
trigger1 = (StateNo = 200) && AnimElemTime(4) >= 0 && AnimElemTime(6) < 0
trigger2 = (StateNo = 201) && AnimElemTime(4) >= 0 && AnimElemTime(6) < 0
trigger3 = StateNo = 230 && AnimElemTime(3) >= 0 && AnimElemTime(5) < 0
trigger4 = StateNo = 250 && AnimElemTime(7) >= 0 && AnimElemTime(9) < 0 
trigger5 = StateNo = 400 && AnimElemTime(3) >= 0 && AnimElemTime(5) < 0
trigger6 = StateNo = 410 && AnimElemTime(5) >= 0 && AnimElemTime(7) < 0
trigger7 = StateNo = 430 && AnimElemTime(3) >= 0 && AnimElemTime(4) < 0
var(17) = 1
ignorehitpause = 1

[State -3, Special Cancel Variable Set 2]
type = VarSet
triggerall = Var(31) = 0
triggerall = MoveType = A
trigger1 = (StateNo = [200,440)) && MoveContact
trigger1 = StateNo != [210,211]
trigger1 = StateNo != [240,241]
trigger1 = StateNo != 431
trigger2 = ((StateNo = [210,211]) || (StateNo = [240,241])) && NumTarget(StateNo)
var(17) = 1
ignorehitpause = 1

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

[State -3, Drive Cancel Variable Set 1]
type = VarSet
triggerall = var(31) = 0
triggerall = (StateNo = [1000,2099])
trigger1 = MoveHit = 1
trigger1 = var(30) >= 500
var(17) = 2
ignorehitpause = 1

[State -3, HD Cancel Variable Set]
type = VarSet
triggerall = var(31) = 1
triggerall = (StateNo = [1000,2099])
trigger1 = MoveContact = 1
trigger1 = var(30) >= 90
var(17) = 2
ignorehitpause = 1

[State -3, Max Cancel Variable Set]
type = VarSet
triggerall = var(31) = 1
trigger1 = StateNo = 3012 && AnimElemTime(75) < 0
trigger2 = StateNo = 3016 && AnimElemTime(187) < 0
var(17) = 3
ignorehitpause = 1

[State -3, Cancel Variable Reset 1]
type = VarSet
trigger1 = MoveType = I
trigger2 = MoveType = H
trigger3 = Var(17) = 3 && StateNo != 3012 && StateNo != 3016
trigger4 = (StateNo = [1000,2099])
trigger4 = Var(30) < 500 && var(31) = 0
trigger5 = (StateNo = [1000,2099])
trigger5 = var(30) < 90 && var(31) = 1
trigger6 = Time = 1
trigger7 = StateNo = 251
trigger8 = StateNo = 202 && UniqHitCount = 2
var(17) = 0
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
trigger1 = StateNo = [200,201]
trigger2 = StateNo = 400
trigger3 = StateNo = 600
trigger4 = StateNo = [230,231]
trigger5 = StateNo = 430
trigger6 = StateNo = 630
var(18) = 1
ignorehitpause = 1

[State -3, Heavy Attack VarSet]
type = VarSet
trigger1 = StateNo = [210,211]
trigger2 = StateNo = 650
trigger3 = StateNo = 410
trigger4 = StateNo = 610
trigger5 = StateNo = [240,241]
trigger6 = StateNo = 440
trigger7 = StateNo = 640
trigger8 = StateNo = 650
var(18) = 2
ignorehitpause = 1

[State -3, Command Attack VarSet]
type = VarSet
trigger1 = StateNo = 202
trigger2 = StateNo = 431
var(18) = 3
ignorehitpause = 1

[State -3, Attack Type Var Reset]
type = VarSet
trigger1 = StateNo < 200
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

;==

; Miscellany

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

[State -3, Landing Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 52
trigger2 = stateno = 106
value = S52,0

[State -3, Taunt Voice]
type = PlaySnd
triggerall = Anim = 195
trigger1 = AnimElem = 1, =1
value = S195, 0
volumescale = 100

[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 = 410
trigger2 = stateno = 610
value = S5,7

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

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

[State -3, Sliding Sound]
type = PlaySnd
triggerall = NumEnemy
trigger1 = EnemyNear, StateNo = 51009
trigger1 = EnemyNear,AnimElem = 1, = 1
value = S101,0
persistent = 0

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

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

[State -3, Dashing Puncher Explod]
type = Explod
trigger1 = Anim = 1000 || Anim = 1001 || Anim = 2000
trigger1 = AnimElemTime(1) = 1
trigger2 = Anim = 1015 || Anim = 1016
trigger2 = AnimElemTime(3) = 0
trigger3 = Anim = 1017 
trigger3 = AnimElemTime(3) = 0
anim = 11000
ID = 11000
pos = 0,0
postype = p1 
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ownpal = 1
removeongethit = 1

[State -3, Dashing Puncher Sound]
type = PlaySnd
trigger1 = Anim = 1000 || Anim = 1001 || Anim = 2000
trigger1 = AnimElemTime(1) = 1
trigger2 = Anim = 1015 || Anim = 1016
trigger2 = AnimElemTime(3) = 0
trigger3 = Anim = 1017 
trigger3 = AnimElemTime(3) = 0
value = S101,0
volumescale = 100
channel = 2

[State -3, Puncher Vision Explod 1]
type = Explod
triggerall = Anim = [1010,1013]
trigger1 = AnimElemTime(2) = 0
anim = 11011
ID = 11011
pos = 0,0
postype = p1 
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ownpal = 1
removeongethit = 1

[State -3, Forbidden Eagle Explod]
type = Explod
triggerall = Anim = 1020 || Anim = 1021 || Anim = 2020
trigger1 = AnimElem = 5
anim = 11020
ID = 11020
pos = 0,0
postype = p1 
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 4
ownpal = 1
removeongethit = 1
ignorehitpause = 1

[State -3, Forbidden Eagle Swing]
type = PlaySnd
triggerall = Anim = 1020 || Anim = 1021 || Anim = 2020
trigger1 = AnimElem = 5
trigger2 = AnimElem = 10
value = S5, IfElse((AnimElem = 5), 6, 7)
channel = 2
ignorehitpause = 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%2)
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

