;--------------------- Variable List ----------------------
; Var(0) = Throw Check (0 = Allowed, 1 = Disallowed)
; Var(5) = Superjump variable (0 = Not active, 1 = active)


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

; Var(15) - Juggle System Sub-system: determines what kind of fall state the opponent is in.
	; 0: None (All moves will hit. Counter hits will reset the juggle count to 0.)
	; 1: Air reset (Aerial basic moves and special moves that juggle will hit.)
	; 2: Air juggle (Specials and supers that juggle will hit.)
	; 3: Super air juggle (Super moves that juggle will hit.)
	; 4: Universal reset (no juggles allowed. Occurs naturally when the enemy's Pos Y is greater than -20.)
; Var(16) - MoveHit/Contact Detection (1 = Hit, 2 = Guarded, 3 = Whiffed, 4 = Reversed)
; Var(17) - Cancel Detection (1 = Command/Special Cancel, 2 = Super Cancel)
; Var(18) - Attack Type (1 = Light Attacks, 2 = Medium Attacks, 3 = Heavy Attacks)

; Var(20) - Hit counter: keeps track of the number of hits that have landed for the damage dampener.

;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 = 3000		;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 = 80		;Time which player lies down for, before getting up
airjuggle = 15		;Number of points for juggling
sparkno = 10005		;Default hit spark number for HitDefs
guard.sparkno = 10045	;Default guard spark number
KO.echo = 0			;1 to enable echo on KO
volumescale = 100			;Volume offset (negative for softer)
IntPersistIndex = 60	;Variables with this index and above will not have their values
FloatPersistIndex = 40  ;reset to 0 between rounds or matches. There are 60 int variables,
  				;indexed from 0 to 59, and 40 float variables, indexed from 0 to 39.
  				;If omitted, then it defaults to 60 and 40 for integer and float
  				;variables repectively, meaning that none are persistent, i.e. all
  				;are reset. If you want your variables to persist between matches,
  				;you need to override state 5900 from common1.cns.


[Size]
xscale = 1			;Horizontal scaling factor.
yscale = 1			;Vertical scaling factor.
ground.back = 14		;Player width (back, ground)
ground.front = 16		;Player width (front, ground)
air.back = 14		;Player width (back, air)
air.front = 16		;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 = -4, -95	;Approximate position of head
mid.pos = -7, -70		;Approximate position of midsection
shadowoffset = 1		;Number of pixels to vertically offset the shadow
draw.offset = 0,3		;Player drawing offset in pixels (x, y)

[Velocity]
walk.fwd  = 4		;Walk forward
walk.back = -3.4		;Walk backward
run.fwd  = 8, 0		;Run forward (x, y)
run.back = -6,-3.8	;Hop backward (x, y)
jump.neu = 0,-9.5		;Neutral jumping velocity (x, y)
jump.back = -4		;Jump back Speed (x, y)
jump.fwd = 4		;Jump forward Speed (x, y)
runjump.back = -3.5,-9.5;Running jump speeds (opt)
runjump.fwd = 3.5,-9.5

[Movement]
airjump.num = 0	;Number of air jumps allowed (opt)
airjump.height = 35	;Minimum distance from ground before you can air jump (opt)
yaccel = .5		;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 = .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**

[Quotes]
victory1 = "Oh, lighten up, you wimp. It's just a fight!"
victory2 = "You need help. There's no way you're going to win!"
victory3 = "Consider yourself lucky to be alive. Pick up your liver and go!"
victory4 = "Have you had enough? Then beat it, fool!"
victory5 = "Why did you do it? You never had a chance."
victory6 = "Bye, bye, baby. Game over."
victory7 = "Don't feel bad. This is just my job."
victory8 = "What a novice. Butch up, you punk!"
victory9 = "You should've expected that. I know I did."
victory10 = "I'm always the winner. You should've known that."
victory11 = "Now, get out of here...if you want to live."
victory12 = "To fight is to win...or lose. That's it. ...Wait a minute...."
victory13 = "Oh, stop whimpering. A wound like that won't kill you."
victory14 = "Ground-to-ground, anti-air...I'm a human missile defense system."
victory15 = "I'm warning you...stand up again, and...."
victory16 = "This is only a scratch. My mission continues...."
victory17 = "Now, stay still. Move, and your wounds will open up."
victory18 = "Stop cowering. I'm through with you."
victory19 = "You need more training. That's all I've got to say."
victory20 = "... ..."
victory21 = "Disappointed? Then work out."
victory22 = "Had enough? Good. You lose."
victory23 = "Resistance... is just dumb."
victory24 = "Whew. That was refreshing."
victory25 = "Worry about the future, and you lose big today."
;==
victory30 = "A bloodless battle on my side. That suits me fine."
;==
victory40 = "I know how to overcome myself. This removes all doubt."
victory41 = "British special forces, huh. You weren't too bad. But I'm better."
victory42 = "That hairstyle and that attitude...you're not fit for military. Go home and be a family man."
victory43 = "Guess Air Force jockeys can put up a good fight after all."
victory44 = "Your genuine power would make you kind of cute...if you weren't so large."
victory45 = "Those empty eyes...I hate to say it, but they remind me of my own."
victory46 = "Now back to my mission...you'll back me up, right?"
victory47 = "I've mastered assasssination. My mission continues, sir."

;---------------------------------------------------------------------------
; Lose by Time Over
[Statedef 170]
type = S
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 170

[State 170, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 8
value = S100,0
channel = 2
volumescale = 100

;---------------------------------------------------------------------------
; Win state decider
[Statedef 180]
type = S

[State 180, 1]
type = ChangeState
triggerall = !Time
triggerall = NumEnemy
triggerall = Enemy,Name!="ZeroLeona"
triggerall = Enemy,name!="Clark Steel"
triggerall = Enemy,Name!="Ralf_WLS"&&Enemy,Name!="Ralf Jones"
triggerall = Enemy,Name!="Heidern"
triggerall = Enemy,Name!="CammyHD"||Enemy,Name!="Cammy"
triggerall = Enemy,Name!="cvsguile" && EnemyNear,Name != "Guile"
triggerall = Enemy,Name!="Nash"
trigger1 = WinPerfect
value = 182

[State 180, 2]
type = ChangeState
triggerall = !Time
triggerall = NumEnemy
trigger1 = Enemy,Name="ZeroLeona"
value = 186

[State 180, 3]
type = ChangeState
triggerall = !Time
triggerall = NumEnemy
trigger1 = Enemy,name="Clark Steel"
trigger2 = Enemy,Name="Ralf_WLS"||Enemy,Name="Ralf Jones"
trigger3 = Enemy,Name="Heidern"
value = 188

[State 180, 4]
type = ChangeState
triggerall = !Time
triggerall = NumEnemy
trigger1 = Enemy,Name="CammyHD"||Enemy,Name="Cammy"
trigger2 = Enemy,Name="cvsguile" || EnemyNear,Name = "Guile"
trigger3 = Enemy,Name="Nash"
value = 181

[State 180, end]
type = ChangeState
trigger1 = Time = 0
value = 180+Random%7

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

[State 181, VictoryQuote]
type = VictoryQuote
triggerall = NumEnemy
triggerall = EnemyNear,Name="CammyHD"
trigger1 = 1
value = 41

[State 181, VictoryQuote]
type = VictoryQuote
triggerall = NumEnemy
triggerall = EnemyNear,Name="cvsguile" || EnemyNear,Name = "Guile"
trigger1 = 1
value = 42

[State 181, VictoryQuote]
type = VictoryQuote
triggerall = NumEnemy
triggerall = EnemyNear,Name="Nash"
trigger1 = 1
value = 43

[State 181, VictoryQuote]
type = VictoryQuote
triggerall = NumEnemy
triggerall = EnemyNear,Name="Cammy"
trigger1 = 1
value = 45

[State 181, AssertSpecial]
type = AssertSpecial
trigger1 = Time < 300
flag = roundnotover

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

[State 181, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 17
value = S180,0
channel = 0
volumescale = 100
;---------------------------------------------------------------------------
; Win pose 2
[Statedef 182]
type = S
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 181

[State 182, VictoryQuote]
type = VictoryQuote
trigger1 = WinPerfect
value = 30

[State 182, AssertSpecial]
type = AssertSpecial
trigger1 = Time < 300
flag = roundnotover

[State 182, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 2
value = S5,8
channel = 2
volumescale = 100
;---------------------------------------------------------------------------
; Win pose 3
[Statedef 183]
type = S
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 182

[State 183, AssertSpecial]
type = AssertSpecial
trigger1 = Time < 180
flag = roundnotover

;---------------------------------------------------------------------------
; Win pose 4
[Statedef 184]
type = S
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 183

[State 184, AssertSpecial]
type = AssertSpecial
trigger1 = Time < 300
flag = roundnotover

[State 184, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 6
value = S183,0
channel = 0
volumescale = 100

[State 184, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 11
value = S5,8
channel = 2
volumescale = 100

;---------------------------------------------------------------------------
; Win pose 5
[Statedef 185]
type = S
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 184

[State 185, AssertSpecial]
type = AssertSpecial
trigger1 = Time < 300
flag = roundnotover

[State 185, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 3
value = S100,1
channel = 2
volumescale = 100

[State 185, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 8
value = S183,0
channel = 0
volumescale = 100

;---------------------------------------------------------------------------
; Win pose 6
[Statedef 186]
type = S
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 185

[State 186, VictoryQuote]
type = VictoryQuote
triggerall = NumEnemy
triggerall = EnemyNear,Name = "CVSZeroLeona" || EnemyNear,Name="ZeroLeona"
trigger1 = 1
value = 40

[State 186, AssertSpecial]
type = AssertSpecial
trigger1 = Time < 300
flag = roundnotover

[State 186, PlaySnd]
type = PlaySnd
trigger1 = Time = 34
value = S186,0
channel = 0
volumescale = 100

[State 186, Explod]
type = Explod
trigger1 = Time = 34
anim = 10185
ID = 10185
pos = -1,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 50
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 1,1
sprpriority = 2
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 0

[State 186, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 15
value = S5,8
channel = 2
volumescale = 100
;---------------------------------------------------------------------------
; Win pose 7
[Statedef 187]
type = S
ctrl = 0
velset = 0,0
anim = 186

[State 187, 2]
type = AssertSpecial
trigger1 = Time < 240
flag = RoundNotOver

[State 187, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 5
value = S193,0
channel = 0
volumescale = 100

;---------------------------------------------------------------------------
; Win pose 8 (vs. Ikari Warriors)
[Statedef 188]
type = S
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 187

[State 188, VictoryQuote]
type = VictoryQuote
triggerall = NumEnemy
triggerall = EnemyNear,name="Clark Steel"||EnemyNear,Name="Ralf_WLS"||EnemyNear,Name="Ralf Jones"
trigger1 = 1
value = 46

[State 188, VictoryQuote]
type = VictoryQuote
triggerall = NumEnemy
triggerall = EnemyNear,name="Heidern"
trigger1 = 1
value = 47

[State 188, AssertSpecial]
type = AssertSpecial
trigger1 = Time < 300
flag = roundnotover

[State 188, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 5
value = S100,1
channel = 0
volumescale = 100

;---------------------------------------------------------------------------
; Introduction 1
[Statedef 190]
type = S
ctrl = 0
velset = 0,0

[State 190, 1]
type = ChangeState
triggerall = !Time
triggerall = NumEnemy
trigger1 = EnemyNear,Name="Heidern"
value = 191

[State 190, 2]
type = ChangeState
triggerall = !Time
triggerall = NumEnemy
trigger1 = EnemyNear,Name="CVSZeroRalf"||EnemyNear,Name="Ralf_WLS"
trigger2 = EnemyNear,Name="Clark Steel"
value = 196

[State 190, 3]
type = ChangeState
triggerall = !Time
triggerall = NumEnemy
trigger1 = EnemyNear,Name="Cammy"||EnemyNear,Name="CammyHD"
trigger2 = EnemyNear,Name="cvsguile"|| EnemyNear,Name = "Guile"|| EnemyNear,Name="Nash"
value = 197

[State 190, 4]
type = ChangeState
trigger1 = EnemyNear,Name="ZeroLeona"||EnemyNear,name="CVSZeroLeona"
value = 193

[State 190, 5]
type = ChangeState
trigger1 = !Time
trigger1 = Random%2=1
value = 193

[State 190, 6]
type = ChangeState
trigger1 = !Time
trigger1 = Random%2=0
value = 192

[State 190, 7]
type = ChangeAnim
trigger1 = Time = 0
value = 190

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

[State 190, end] ;Change to stand state
type = ChangeState
trigger1 = AnimTime = 0
value = 0
;---------------------------------------------------------------------------
; Introduction 2
[Statedef 191]
type = S
ctrl = 0
velset = 0,0

[State 191, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 191

[State 191, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 19
value = S191,0
channel = 0
volumescale = 100

[State 191, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 19
value = S100,0
channel = 1
volumescale = 100

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

[State 191, end] ;Change to stand state
type = ChangeState
trigger1 = AnimTime = 0
value = 0
;---------------------------------------------------------------------------
; Introduction 3
[Statedef 192]
type = S
ctrl = 0
velset = 0,0
sprpriority = 2

[State 192, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 192

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

[State 192, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 13
value = S5,11
channel = 1
volumescale = 100

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

[State 192, StateTypeSet]
type = StateTypeSet
trigger1 = AnimElem = 9
StateType = A       ;S,A,C,L
movetype = A        ;I,A,H
physics = A         ;A,C,S,N

[State 192, Explod]
type = Explod
trigger1 = Time = 82
anim = 10192
ID = 10192
pos = 15,-55
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = -5,-6
accel = 0,.5
random = 0,0
removetime = 60
pausemovetime = 0
scale = 1,1
sprpriority = 3
shadow = 0,0,0
ownpal = 1
removeongethit = 0

[State 192, Explod]
type = Explod
trigger1 = Time = 82
anim = 10193
ID = 10193
pos = 15,-55
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 5,-6
accel = 0,.5
random = 0,0
removetime = -2
pausemovetime = 0
scale = 1,1
sprpriority = 4
shadow = 0,0,0
ownpal = 1
removeongethit = 0

[State 192, VelAdd]
type = VelAdd
trigger1 = AnimElem = 9
x = 0
y = -9
;---------------------------------------------------------------------------
; Introduction 4
[Statedef 193]
type = S
ctrl = 0
velset = 0,0

[State 193, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 193

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

[State 193, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 5
value = S193,0
channel = 0
volumescale = 100

[State 193, end] ;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
channel = 1
volumescale = 100

[State 195, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; Special Intro 1
[Statedef 196]
type = S
ctrl = 0
velset = 0,0

[State 196, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 196

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

[State 196, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 5
value = S100,1
channel = 0
volumescale = 100

[State 196, end] ;Change to stand state
type = ChangeState
trigger1 = AnimTime = 0
value = 0
;---------------------------------------------------------------------------
; Special Intro 2
[Statedef 197]
type = S
ctrl = 0
velset = 0,0

[State 197, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 197

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

[State 197, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 32
value = S197,0
channel = 0
volumescale = 100

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

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

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

[Statedef -2]

[State -2, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "Juggle = %d, Projectile = %d"
params = var(15), var(25) 

[State -2, Long Jump Reset]
type = VarSet
trigger1 = stateno = 52
trigger2 = MoveType = H
v = 5
value = 0

[State -2, RemoveExplod]
type = RemoveExplod
triggerall = 1
trigger1 = MoveType = H 
id = 11053
ignorehitpause = 1

[State -2, Disable Cornerpush (Normals)]
type = VarSet
triggerall = Vel X = 0
triggerall = StateType != A
triggerall = MoveType != H
trigger1 = StateNo = 450
var(10) = 2
ignorehitpause = 1

[State -2, Disable Cornerpush (Specials)]
type = VarSet
trigger1 = stateno = [1000,1002]
trigger2 = stateno = 1022
var(10) = 2
ignorehitpause = 1

[State -2, Disable Cornerpush (Supers)]
type = VarSet
triggerall = Vel X = 0
triggerall = Vel Y = 0
trigger1 = StateNo = [3000,3999]
var(10) = 2

[State -2, P2 Facing]
type= targetfacing
triggerall = NumTarget
triggerall = StateNo != [3040,3042]
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 = EnemyNear,StateType = A && StateNo != 860
trigger9 = EnemyNear,StateType = L
trigger10 = var(15) > 0
trigger11 = P2BodyDist X > 20
var(0) = 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 || Target,StateType = A && (Target, StateNo = [120,155])
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, VarSet];Counter Hit Succesful
type = VarSet
triggerall = var(21) = 1 && var(16) = 1 ;Counter Check Ok, Move Hit Succesfully.
trigger1 = StateNo != [190,199]
trigger1 = StateNo != [800,899]
var(22) = 1
ignorehitpause = 1

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

[State -2, VarSet];Counter Hit Reset
type = VarSet
trigger1 = var(22) >= 22 && 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, EnvColor];This will produce a flash a la KOF2K2
type = EnvColor
triggerall = MoveType != H
triggerall = numenemy
triggerall = var(21)
triggerall = StateNo != [190,199] ;Does not activate during intros.
triggerall = StateNo != [800,899] ;Does not activate during throws.
trigger1 = var(21) = 1 && Var(16) = 1 ;Move hit, Ok
value = 255,255,255
time = 1
under = 1
ignorehitpause = 1
persistent = 0

;---------------------------------------------------------------------------
[Statedef -3]

[State -3, VictoryQuote]
type = VictoryQuote
triggerall = NumEnemy
triggerall = Enemy,Name!="ZeroLeona"
triggerall = Enemy,name!="Clark Steel"
triggerall = Enemy,Name!="Ralf_WLS"&&Enemy,Name!="Ralf Jones"
triggerall = Enemy,Name!="Heidern"
triggerall = Enemy,Name!="CammyHD"||Enemy,Name!="Cammy"
triggerall = Enemy,Name!="cvsguile" && EnemyNear,Name != "Guile"
triggerall = Enemy,Name!="Nash"
trigger1 = 1
value = 1+Random%25

[State -3, SuperJump VarSet]
type = VarSet
trigger1 = command = "highjump"
trigger2 = PrevStateNo = 102 && StateNo = 40 && !Time
v = 5    
value = 1

[State -3, SuperJump Var Reset]
type = VarSet
trigger1 = stateno = 52
trigger2 = MoveType = H
var(5) = 0

[State -3, Projectile Active]
type = VarSet
triggerall = 1
triggerall = Var(25) = 1
trigger1 = NumHelper(11010) = 0
trigger1 = NumHelper(11011) = 0
trigger1 = NumHelper(11012) = 0
trigger1 = NumHelper(11030) = 0
trigger1 = NumHelper(11031) = 0
trigger1 = NumHelper(11032) = 0
trigger1 = NumHelper(11040) = 0
trigger1 = NumHelper(11041) = 0
trigger1 = NumHelper(11042) = 0
trigger1 = NumHelper(11050) = 0
trigger1 = NumHelper(11051) = 0
trigger1 = NumHelper(11052) = 0
var(25) = 0

;== Juggle System by Zero-Sennin ==

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

[State -3, var(15) = 2 (Juggle State)]
type = VarSet
triggerall = StateNo = [1020,1024]
triggerall = Var(16) = 1
triggerall = NumTarget 
trigger1 = Target,StateType = A
var(15) = 2
ignorehitpause = 1

[State -3, var(15) = 3 (Super Juggle State)]
type = VarSet
triggerall = Var(16) = 1
triggerall = NumTarget 
triggerall = Target,HitFall = 1
trigger1 = StateNo = [1000,1002]
trigger2 = StateNo = 1025
var(15) = 3
ignorehitpause = 1

[State -3, var(15) = 4 (Full Reset)]
type = VarSet
trigger1 = NumTarget 
trigger1 = Target, Vel Y > 0
trigger1 = Target,Pos Y>=-10
trigger2 = StateNo = [3000,3050]
trigger2 = MoveType = I
trigger3 = StateNo = [800,899]
trigger4 = NumEnemy
trigger4 = EnemyNear,StateType = L || EnemyNear, StateNo = [5100,5210]
trigger5 = RoundState != 2
trigger6 = StateNo = 251 && PrevStateNo != [200,650]
trigger6 = MoveHit
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, MoveHit/Whiff Detection]
type = VarSet
trigger1 = movehit
var(16) = ifElse(MoveHit,1,3)
ignorehitpause = 1

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

[State -3, Reset MoveWhiff/Hit/Guarded/Reversed Variable]
type = VarSet
trigger1 = Time = 1
trigger2 = MoveType = I
trigger3 = MoveType = H
var(16) = 0
ignorehitpause = 1

[State -3, Special Cancel Variable Set]
type = VarSet
triggerall = MoveType = A
triggerall = StateNo = [200,650]
triggerall = PrevStateNo != [150,154]
triggerall = StateNo != 220
triggerall = StateNo != 240
triggerall = StateNo != 250
triggerall = StateNo != [440,450]
trigger1 = Var(16) = [1,2]
var(17) = 1
ignorehitpause = 1

[State -3, Super Cancel Variable Set]
type = VarSet
triggerall = MoveType = A
triggerall = Var(16) = [1,2]
triggerall = PrevStateNo != [150,154]
trigger1 = StateNo = 220
trigger2 = StateNo = 250
trigger3 = StateNo = [440,450]
trigger4 = StateNo = 651
trigger5 = StateNo = 1022 
var(17) = 2
ignorehitpause = 1

[State -3, Command Cancel Variable Set]
type = VarSet
triggerall = MoveType = A
triggerall = Var(16) = [1,2]
trigger1 = StateNo = [200,201]
trigger2 = StateNo = 211
trigger3 = StateNo = [230,231]
trigger4 = StateNo = 241
trigger5 = StateNo = 420
var(17) = 1
ignorehitpause = 1

[State -3, Cancel Variable Reset]
type = VarSet
trigger1 = Var(16) = 0
trigger2 = MoveType = H
var(17) = 0
ignorehitpause = 1

;==

[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, Medium Attack VarSet]
type = VarSet
trigger1 = StateNo = [210,211]
trigger2 = StateNo = 410
trigger3 = StateNo = 610
trigger4 = StateNo = [240,241]
trigger5 = StateNo = 440
trigger6 = StateNo = 640
var(18) = 2
ignorehitpause = 1

[State -3, Heavy Attack VarSet]
type = VarSet
trigger1 = StateNo = 220
trigger2 = StateNo = 420
trigger3 = StateNo = 620
trigger4 = StateNo = 250
trigger5 = StateNo = 450
trigger6 = StateNo = 650
var(18) = 3
ignorehitpause = 1

[State -3, Attack Type Var Reset]
type = VarSet
trigger1 = 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, 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
triggerall = Enemy,GetHitVar(HitCount) > 0
triggerall = fvar(20) <=  0.4
trigger1 = 1
fvar(20) = 0.4
ignorehitpause = 1

;==

[State -3, Jumping Sound]
type = PlaySnd
trigger1 = Time = 1
trigger1 = stateno = 50 && PrevStateNo = 40
trigger2 = time = 1
trigger2 = StateNo = 105
trigger3 = Time = 1
trigger3 = stateno = 1025 || stateno = 1028 || stateno = 3043
value = S40,0

[State -3, Super Jumping Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 50 && var(5)=1
value = S41,0

[State -3, Landing Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 52
trigger2 = stateno = 106
trigger3 = stateno = 10 && prevstateno = 52
value = S40, 1

[State -3, Falling Voice]
type = PlaySnd
triggerall = Time = 1
triggerall = Alive
trigger1 = Anim = 5170
trigger1 = IfElse((PrevStateNo!=[150,151]),Random%2=0,1)
value = S5000,2
channel = 1

[State -3, Randomized Voice] ;Attack Voice
type = PlaySnd
triggerall = Time = 1
triggerall = Random%2 = 0
trigger1 = stateno = [200,650]
trigger1 = stateno !=251
value = S200,random%2
volumescale = 200
channel = 0
freqmul = 1.0
loop = 0
pan = 0

[State -3, Randomized Voice 2]
type = PlaySnd
triggerall = Time = 1
triggerall = Random%2 = 1
triggerall = Alive
trigger1 = stateno = 5001
trigger2 = stateno = 5011
trigger3 = stateno = 5021
trigger4 = stateno = 5030
value = S5000,random%2
channel = 0

[State -3, Randomized Voice 3]
type = PlaySnd
triggerall = Time = 1
triggerall = Random%2 = 1
triggerall = Alive
trigger1 = Anim = 5100
value = S5000,random%2
channel = 0

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

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

[State -3, Punching Swing 3]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 220
trigger2 = stateno = 420
trigger3 = stateno = 620
value = S5,8
channel = 1

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

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

[State -3, Kicking Swing 3]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 250
trigger2 = stateno = 450
trigger3 = stateno = 650 
trigger4 = stateno = 651
value = S5,11
channel = 1

[State -3, Moon Slasher]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = [1000,1003]
value = S1000,0
channel = 0
volumescale = 100

[State -3, Slasher Sound]
type = PlaySnd
trigger1 = AnimElem = 5
trigger1 = stateno = [1000,1003]
trigger2 = AnimElem = 8
trigger2 = stateno = 1003
trigger3 = Anim = 1022
trigger3 = AnimElem = 2
trigger4 = Anim = 3031
trigger4 = AnimElem = 2
value = S1000,1
channel = 1
volumescale = 100
ignorehitpause = 1

[State -3, I-Slasher]
type = PlaySnd
triggerall = AnimElem = 15,=0
trigger1 = stateno = 1040||stateno=1042||stateno=1043||stateno=1044
value = S1040,0
channel = 0
volumescale = 100

[State -3, I-Slasher Throw]
type = PlaySnd
triggerall = AnimElem = 15,=0
trigger1 = stateno = 1040||stateno=1042||stateno=1043||stateno=1044
value = S5,11
channel = 1
volumescale = 100

[State -3, Landing Dust 1]
type = Explod
trigger1 = Anim = 47 && Time = 1
trigger2 = (Anim = 1013)&&AnimElem = 2
trigger3 = Anim = 1026 && Time = 1
trigger4 = Anim = 3043 && Time = 1
trigger5 = Anim = 3013 && Time = 1
trigger6 = Anim = 3023 && Time = 1
anim = 10121
ID = 10121
pos = 0,15
postype = p1
removetime = -2
sprpriority = 3
ownpal = 1
scale = 1.5,1.5

[State -3, Earring Bomb Whoosh]
type = PlaySnd
triggerall = AnimElem = 19
trigger1 = Anim = [1050,1052]
value = S5,6
channel = 1
; 
[State -3, Prevent Underground Juggles]
type= TargetBind
triggerall = NumEnemy
trigger1= movehit=1
trigger1= numtarget=1
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

