;================================================================================
;                       IRON KUSANAGI 'S CODINGS FILE - part1
;================================================================================
; VAR:  9 = AI
;      12 = Projectile hit slowdown
;       8 = Round wave charger
;      11 = Power dunk: hit?? yes or no?? -_O
;      13 = HSDM level choose
;      14 = Wind punch SDM velocities

[Data]
power = 3000
life = 1000
attack = 100
defence = 100
fall.defence_up = 50
liedown.time = 60
airjuggle = 15
sparkno = 0
guard.sparkno = 0
KO.echo = 0
volume = 100
IntPersistIndex = 60
FloatPersistIndex = 40

[Size]
xscale = 1           ;Horizontal scaling factor.
yscale = 1           ;Vertical scaling factor.
ground.back = 15     ;Player width (back, ground)
ground.front = 16    ;Player width (front, ground)
air.back = 12        ;Player width (back, air)
air.front = 12       ;Player width (front, air)
height = 60      ;Height of player (for opponent to jump over)
attack.dist = 160    ;Default attack distance
proj.attack.dist = 90 ;Default attack distance for projectiles
proj.doscale = 0     ;Set to 1 to scale projectiles too
head.pos = -5, -90   ;Approximate position of head
mid.pos = -5, -60    ;Approximate position of midsection
shadowoffset = 0     ;Number of pixels to vertically offset the shadow
draw.offset = 0,1    ;Player drawing offset in pixels (x, y)

[Velocity]
walk.fwd  = 3.16
walk.back = -3.16
run.fwd  = 6.5, 0
run.back = -4.5,-3.8
jump.neu = 0,-10    ;Neutral jumping velocity (x, y)
jump.back = -3    ;Jump back Speed (x, y)
jump.fwd = 3.25       ;Jump forward Speed (x, y)
runjump.back = -4.65,-10.5 ;Running jump speeds (opt)
runjump.fwd = 4.65,-10.5      ;.
airjump.neu = 0,-8.2      ;.
airjump.back = -2.55      ;Air jump speeds (opt)
airjump.fwd = 2.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 = .57         ;Vertical acceleration
stand.friction = .8  ;Friction coefficient when standing
crouch.friction = .8 ;Friction coefficient when crouching
;-------------------------------------------------------------
; Jump Start
[Statedef 40]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 40, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 40, 2]
type = VarSet
trigger1 = Time = 0
var(5) = 0

[State 40, 3]
type = VarSet
trigger1 = command = "longjump"
trigger2 = prevstateno = 101 && command = "holdfwd"
var(5) = 1

[State 40, 4]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 40, 5]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 40, 6]
type = VelSet
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)

[State 40, 9]
type = ChangeState
trigger1 = AnimTime = 0 && command != "holdup"
value = 950
ctrl = 1

[State 40, 10]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

; Jump Up
[Statedef 50]
type    = A
physics = A

[State 50, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 50, 2]
type = VelSet
trigger1 = Time = 0 && Var(5)
x = IfElse(vel x = 0,0,IfElse(vel x < 0,-5,5))

[State 50, 3]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, 41, ifelse((vel x)>0, 42, 43))

[State 50, 4]
type = AfterImage
trigger1 = Time = 0 && Var(5) && Vel X != 0
time = 10
trans = add1
timegap = 1
framegap = 2
length = 8
palbright = 12,12,12
palcontrast = 225,225,225
palpostbright = 0,0,0
paladd = 0,0,0
palmul = 1,1,1

; Short jump
[Statedef 950]
type = A
movetype = I
physics = A
anim = 950

[State 950, 1]
type = VelSet
trigger1 = Time = 0
x = IfElse(vel x = 0,0,IfElse(vel x < 0,-3,3))
y = -7

[State 950, 2]
type = VelSet
trigger1 = Time = 0 && Var(5)
x = IfElse(vel x = 0,0,IfElse(vel x < 0,-5,5))

[State 950, 3]
type = AfterImage
trigger1 = Time = 0 && Var(5) && Vel X != 0
time = 10
trans = add1
timegap = 1
framegap = 2
length = 8
palbright = 0,0,0
palcontrast = 128,128,128
palmul = 1,1,1

[State 950, 4]
type = ChangeState
trigger1 = Pos Y >= 0 && Vel Y > 0
value = 52

; Jump Land
[Statedef 52]
type    = S
physics = S
ctrl = 1
anim = 47
velset = 0,0
facep2 = 1

[State 52, Landing Sound]
type = PlaySnd
trigger1 = Time = 0
value = 0, 2

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

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

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

;-----RUN
[Statedef 100]
type = S
movetype = I
physics = S
anim = 100
velset = 0
ctrl = 0

[State 100, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 101

[Statedef 101]
type = S
movetype = I
physics = S
anim = 101
ctrl = 0

[State 100, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 100, 0]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0,3
loop = 1
channel = 1

[State 101, 3]
type = ChangeState
trigger1 = command = "holdup"
value = 40

[State 100, 5.1]
type = ChangeState
triggerall = var(9) = 0
trigger1 = AnimElem = 3, >= 0
trigger1 = command != "holdfwd"
value = 102

[State 100, 5.2]
type = ChangeState
trigger1 = var(9) = 1
trigger1 = AnimElem = 3, >= 0
trigger1 = P2bodydist X <= 40
value = 102

[Statedef 102]
type = S
movetype = I
physics = S
anim = 102

[State 102, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1; RUN_BACK2 (land)

[Statedef 106]
type    = S
physics = S
ctrl = 0
anim = 102

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

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

[State 106, 3]
type = MakeDust
trigger1 = Time = 2
pos = -5,-2
spacing = 1

[State 106, 4]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; 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, 2]
type = ChangeState
trigger1 = Time = 0
trigger1 = var(15) = 1
trigger1 = matchover
value = 183

[State 180, 2]
type = ChangeState
trigger1 = Time = 0
trigger1 = matchover
value = 182

[State 180, 2]
type = ChangeState
trigger1 = Time = 0
value = 181
;---------------------------------------------------------------------------
; Win pose 1
[Statedef 181]
type = S
ctrl = 0
anim = 181
velset = 0,0

[State 181, end]
type = AssertSpecial
trigger1 = time < 140
flag = RoundNotOver

[State 191, 3]
type = PlaySnd
trigger1 = AnimElem = 4
value = 181, 0

[State 705, 2]
type = Explod
trigger1 = AnimElem = 4
anim = 184
ID = 192
sprpriority = 0
postype = p1
pos = 25,-99
vel = 1,-2
accel = 0,.185
bindtime = 1
ownpal = 1

[State 705, 2]
type = Explod
trigger1 = AnimElem = 7, = 6
anim = 185
ID = 192
sprpriority = 0
postype = p1
pos = 70,0
bindtime = 1
ownpal = 1

[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 181, end]
type = AssertSpecial
trigger1 = time < 140
flag = RoundNotOver

[State 191, 3]
type = PlaySnd
trigger1 = AnimElem = 16
value = 182,0

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

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

[State 181, end]
type = AssertSpecial
trigger1 = time < 140
flag = RoundNotOver

[State 191, 3]
type = PlaySnd
trigger1 = AnimElem = 6
value = 183,0

[State 705, 2]
type = Explod
trigger1 = AnimElem = 5
anim = 186
ID = 192
sprpriority = 0
postype = p1
pos = 0,0
bindtime = 1
ownpal = 1

[State 705, 2]
type = Explod
trigger1 = AnimElem = 9
anim = 187
ID = 192
sprpriority = 0
postype = p1
pos = 30,-90
vel = 2,-4
accel = 0,.3
bindtime = 1
ownpal = 1
removetime = 42

[State 705, 2]
type = Explod
trigger1 = AnimElem = 12, = 27
anim = 188
ID = 192
sprpriority = 0
postype = p1
pos = 110,0
bindtime = 1
ownpal = 1

[State 181, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S

[State 5900, turn]
type = ChangeState
trigger1 = TeamMode = Turns
trigger1 = roundno > 1
trigger1 = RoundsExisted > 0
value = 199

[State 5900, turn]
type = ChangeState
trigger1 = TeamMode = Turns
trigger1 = roundno > 1
trigger1 = RoundsExisted = 0
value = 187

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundno = 1
value = 0

[State 5900, 2] ;Clear all float variables
type = VarRangeSet
trigger1 = roundno = 1
fvalue = 0

[State 5900, 3] ;Intro
type = ChangeState
trigger1 = roundno = 1
value = 190

;-------------- Turn team taunt if won before
[Statedef 199]
type = S
movetype = I
physics = N
anim = 0
velset = 0,0
ctrl = 0

[State 187,]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 5900, ] ;Intro
type = ChangeState
trigger1 = time = 45
value = 195

;--------------Turn team jump intro (inspired fom Sander's coding)
[Statedef 187]
type = S
movetype = I
physics = N
anim = 999
velset = 0,0
ctrl = 0

[State 187,]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 5900, ] ;Intro
type = ChangeState
trigger1 = animtime = 0
value = 188

[Statedef 188]
type = A
movetype = I
physics = N
anim = 950
velset = 4.8,-1
ctrl = 0

[State 189,]
type = screenbound
trigger1 = 1
value = 0

[State 189,]
type = posadd
trigger1 = time = 0
y = -70
x = -100

[State 189,]
type = veladd
trigger1 = 1
y = .4

[State 189,]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 189,]
type = ChangeState
trigger1 = pos y >= 0 && vel y > 0
value = 189

[Statedef 189]
type = S
movetype = I
physics = N
anim = 47
velset = 0,0
ctrl = 0

[State 197, 1]
type = posset
trigger1 = time = 0
y = 0

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

[State 197, AS]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 197, 3]
type = ChangeState
trigger1 = animtime = 0
value = 190


; Introduction

[Statedef 190]
type = S

[State 190, 2]
type = ChangeState
trigger1 = p2name = "Yuri Sakazaki" || p4name = "Yuri Sakazaki"
trigger2 = p2name = "Blue Mary" || p4name = "Blue Mary"
value = 192

[State 190, 2]
type = ChangeState
trigger1 = p2name = "Ryo Sakazaki" || p4name = "Ryo Sakazaki"
trigger2 = p2name = "Takuma Sakazaki" || p4name = "Takuma Sakazaki"
value = 193

[State 190, 2]
type = ChangeState
trigger1 = Time = 0
value = 191

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

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

[State 191, 2]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 195, 1]
type = PlaySnd
trigger1 = AnimElem = 5
trigger2 = AnimElem = 8
value = 191,0

[State 195, 1]
type = PlaySnd
trigger1 = AnimElem = 12
value = 191,1

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

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

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

[State 191, 2]
type = AssertSpecial
trigger1 = 1
flag = Intro

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

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

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

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

[State 191, 2]
type = AssertSpecial
trigger1 = 1
flag = Intro

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

;-------------------------------TAUNT
[Statedef 195]
type = S
movetype = A
physics = S
anim = 195

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

[State 195, 2]
type = ChangeState
triggerall = roundstate = 2
triggerall = time > 20
trigger1 = command = "holdback"
trigger2 = command = "holdfwd"
value = 20

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

;------------------------------------------------------------------------
;----------------------------------DODGES--------------------------------
;------------------------------------------------------------------------
;--------KOF98 forward
[Statedef 361]
type = S
physics = S
anim = 361
sprpriority = -1
poweradd = 0
velset = 0,0
ctrl = 0

[State 360, push]
type = PlayerPush
trigger1 = 1
value = 0

[State 350, snd]
type = PlaySnd
trigger1 = AnimElem = 3
value = 360,0

[State 350, hit]
type = HitBy
trigger1 = 1
value =  , AT

[State 350, hit]
type = NotHitBy
trigger1 = 1
value = , AA, AP

[State 350, snd]
type = Poweradd
trigger1 = prevstateno = 150 || prevstateno = 151
trigger1 = AnimElem = 1
value = -1000

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

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

[State 9520, 51]
type = EnvColor
trigger1 = animelem = 1
trigger1 = prevstateno = 150 || prevstateno = 151
value = 200,200,200
time = 3

[State 705, 1]
type = velset
trigger1 = Time = [9,25]
x = 5

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

;--------KOF98 backward
[Statedef 360]
type = S
physics = S
anim = 360
poweradd = 0
sprpriority = -1
velset = 0,0
ctrl = 0

[State 360, push]
type = PlayerPush
trigger1 = 1
value = 0

[State 350, hit]
type = HitBy
trigger1 = 1
value =  , AT

[State 350, hit]
type = NotHitBy
trigger1 = 1
value = , AA, AP

[State 350, snd]
type = PlaySnd
trigger1 = AnimElem = 3
value = 360,0

[State 350, snd]
type = Poweradd
trigger1 = prevstateno = 150 || prevstateno = 151
trigger1 = AnimElem = 1
value = -1000

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

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

[State 9520, 51]
type = EnvColor
trigger1 = animelem = 1
trigger1 = prevstateno = 150 || prevstateno = 151
value = 200,200,200
time = 3

[State 705, 1]
type = velset
trigger1 = Time = [9,25]
x = -5

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

;---------------Recovery
[Statedef 370]
type = S
physics = S
anim = 370
poweradd = 0
sprpriority = -1
velset = 0,0
ctrl = 0
facep2 = 1

[State 370, pos]
type = posset
trigger1 = time = 0
y = 0

[State 360, push]
type = PlayerPush
trigger1 = 1
value = 0

[State 350, hit]
type = HitBy
trigger1 = 1
value = SCA

[State 350, snd]
type = PlaySnd
trigger1 = AnimElem = 1
value = 360,0

[State 705, 1]
type = velset
trigger1 = Time = [1,16]
x = -4

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

;---------------Special KO detect
[Statedef 169]
type = S
physics = S
anim = 999
poweradd = 0
sprpriority = -1
velset = 0,0
ctrl = 0
facep2 = 1

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

[Statedef 999]
type = A
movetype = I
physics = N
velset = 0
anim = 999
ctrl = 0

[State -2]
type = playsnd
trigger1 = animelem = 2
value = s0,0
channel = 5
volume = 220
loop = 1

[State 999,]
type = changestate
trigger1 = animtime = 0
value = 998

[Statedef 998]
type = A
movetype = I
physics = N
anim = 999
velset = 0
ctrl = 0

[State 999,]
type = changestate
trigger1 = animtime = 0
value = 998

[Statedef 997]
type = A
movetype = I
physics = N
velset = 0
anim = 999
ctrl = 0

[State -2]
type = playsnd
trigger1 = animelem = 2
value = s0,1
channel = 5
volume = 220
loop = 1

[State 999,]
type = changestate
trigger1 = animtime = 0
value = 998

[Statedef 4096]
type = A
movetype = I
physics = N
anim = 999
velset = 0
ctrl = 0
facep2 = 1

[State 4096, pos]
type = PosSet
trigger1 = 1
trigger1 = facing = 1
X = enemy,pos X - 20
Y = enemy,pos Y

[State 4096, pos]
type = PosSet
trigger1 = 1
trigger1 = facing = -1
X = enemy,pos X + 20
Y = enemy,pos Y

[State 190, varrandom]
type = VarRandom
trigger1 = 1
v = 15
range = 0,8

[State 190, varrandom]
type = VarRandom
trigger1 = 1
v = 16
range = 0,6

[State 705, 2]
type = Explod
trigger1 = time = 15
anim = 4095
ID = 4095
sprpriority = 3
postype = p1
pos = 0,-60
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 28
anim = 4095
ID = 4095
sprpriority = 3
postype = p1
pos = -40,-40
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 35
anim = 4095
ID = 4095
sprpriority = 3
postype = p1
pos = 20,-80
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 54
anim = 4095
ID = 4095
sprpriority = 3
postype = p1
pos = 30,-20
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 40
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 20
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 35
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 45
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 60
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 75
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 90
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 999,]
type = DestroySelf
trigger1 = time = 100

[Statedef 4097]
type = A
movetype = I
physics = N
anim = 999
velset = 0
ctrl = 0
facep2 = 1

[State 4096, pos]
type = PosSet
trigger1 = 1
trigger1 = facing = 1
X = enemy,pos X - 20
Y = enemy,pos Y

[State 4096, pos]
type = PosSet
trigger1 = 1
trigger1 = facing = -1
X = enemy,pos X + 20
Y = enemy,pos Y

[State 190, varrandom]
type = VarRandom
trigger1 = 1
v = 15
range = 0,8

[State 190, varrandom]
type = VarRandom
trigger1 = 1
v = 16
range = 0,6

[State 705, 2]
type = Explod
trigger1 = time = 5
anim = 4095
ID = 4095
sprpriority = 3
postype = p1
pos = 0,-60
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 13
anim = 4095
ID = 4095
sprpriority = 3
postype = p1
pos = -40,-40
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 3
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 7
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 11
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 705, 2]
type = Explod
trigger1 = time = 15
anim = 4096
ID = 4096
sprpriority = 3
postype = p1
;pos = -10,-10
pos = (var(15) * 5),(var(16) * -4)
bindtime = 1

[State 999,]
type = DestroySelf
trigger1 = time = 20
;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------
[Statedef -2]

[State -2, DEBUG]
trigger1 = 1
type = DisplayToClipboard
ignorehitpause = 1
text = "Counter = %d & %d - var11 = %d - Projhit slow = %d - AI  = %d\nCC Iron King by David Demianoff"
params = var(15) , var(16) , var(11) , var(12) , var(9)

;-----------------------------------------
; Thanks to Sander for letting me use his Counter code!
;==================================================================================
; ------- COUNTER HIT --------
;===============================================
[State -2, COUNTER HIT1]
type = VarSet
trigger1 = enemy, movetype = A
ignorehitpause = 1
var(20) = 1

[State -2, COUNTER HIT2]
type = VarSet
trigger1 = enemy, movetype = I || var(21) >= 1
ignorehitpause = 1
var(20) = 0

[State -2, COUNTER HIT3]
type = VarSet
trigger1 = var(21) > 10 && enemy, movetype = H
ignorehitpause = 1
var(20) = 0

[State -2, COUNTER HIT4]
type = VarSet
trigger1 = (stateno != [1600,1655]) && (stateno != [1901,1910]) && (stateno != 460) && var(20) = 1 && movehit
ignorehitpause = 1
var(21) = 1

[State -2, COUNTER HIT5]
type = Varadd
trigger1 = var(21) >= 1
ignorehitpause = 1
var(21) = 1

[State -2, COUNTER HIT6]
type = VarSet
trigger1 = var(21) >= 22 && movehit && stateno != 1001
trigger2 = p2movetype != H
trigger3 = movetype = H
trigger4 = var(21) >= 22 && stateno = 1002
trigger5 = var(35) > 0
ignorehitpause = 1
var(21) = 0

[State -2, COUNTER HIT7]
type = Assertspecial
trigger1 = var(21) > 0 
trigger2 = var(13) > 0
trigger3 = var(24) = 1
trigger4 = var(32) > 0
trigger5 = var(35) > 0
flag = Nojugglecheck
;--------------------------

[State -2, run sound]
type = stopsnd
trigger1 = stateno != 101
channel = 1

[State 100, 0]
type = StopSnd
trigger1 = stateno != 2301
channel = 2

[State 100, 0]
type = StopSnd
trigger1 = stateno != 310 && stateno != 311
channel = 3

[State 100, 0]
type = StopSnd
trigger1 = stateno != 310 && stateno != 311
channel = 4

[State -2,]
type = Varset
trigger1 = projhit1000 = 1
var(12) = 18

[State -2,]
type = Varset
trigger1 = projhit3000 = 1
var(12) = 25

[State -2,]
type = VarAdd
trigger1 = var(12) != 0
trigger1 = (gametime%3) = 0
var(12) = -1

[State -2,]
type = Pause
triggerall = (gametime%3) = 0
trigger1 = var(12) != 0
time = 1
movetime = 0

[State -2, Cheese!!!]
type = ChangeState
trigger1 = prevstateno = [120,152]
;trigger1 = statetype != A
trigger1 = !alive
trigger1 = enemy,hitdefattr = SCA, SA, SP, HA, HP
value = 6010
ignorehitpause = 1

[State -2, Sexy KO]
type = Helper
triggerall = NumHelper(6969) = 0
trigger1 = !alive
trigger1 = matchover || teammode = turns
helpertype = normal
name = "Sexy KO detect"
id = 6969
postype = p1
pos = 0,0
stateno = 169
keyctrl = 0
ownpal = 1
facep2 = 0
ignorehitpause = 1

[State 5000, 1]
type = ChangeAnim
trigger1 = stateno = 5020
trigger1 = time >= 0
trigger1 = NumHelper(6969) = 1
value = 25030
ignorehitpause

;----------------------------------------------------------
;-----------------------------------------ENEMY DETECTION
;----------------------------------------------------------

[State -2, detect]
type = VarSet
trigger1 = p2name = "Ryo Sakazaki" || p4name = "Ryo Sakazaki"
var(15) = 1


;==========================================================================
;    King Of Figthers 2002 Unlimited Match HSDM Fondo y Broken Glass
;==========================================================================
;--------------------------------------HSDM 2002 UM------------------------
[Statedef 40001]
anim = 9999

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG

[State 40001, Tile #1-7]
type = Explod
triggerall = !numexplod(15600)
trigger1 = !time
anim = 15600
ID = 15600
pos = 0,0
postype = left  ;p2,front,back,left,right
removetime = 10
pausemovetime = -1
supermovetime = -1
scale = 1,1
sprpriority = -20
ownpal = 1
ignorehitpause = 1
bindtime = -1
persistent = 0

[State 40001, Tile #1-7]
type = Explod
triggerall = !numexplod(15601) < 2
trigger1 = !time
trigger2 = (time%10) = 0
anim = 15600
ID = 15601
pos = 320,0
postype = left  ;p2,front,back,left,right
removetime = 20
pausemovetime = -1
supermovetime = -1
scale = 1,1
sprpriority = -20
ownpal = 1
ignorehitpause = 1
bindtime = -1

[State 40001, Tile #2-6]
type = Explod
triggerall = !numexplod(15610)
trigger1 = !time
anim = 15601
ID = 15610
pos = 0,0
postype = left  ;p2,front,back,left,right
removetime = 20
pausemovetime = -1
supermovetime = -1
scale = 1,1
sprpriority = -20
ownpal = 1
ignorehitpause = 1
persistent = 0
bindtime = -1

[State 40001, Tile #2-6]
type = Explod
triggerall = !numexplod(15611) < 2
trigger1 = !time
trigger2 = (time%20) = 0
anim = 15601
ID = 15611
pos = 320,0
postype = left  ;p2,front,back,left,right
removetime = 40
pausemovetime = -1
supermovetime = -1
scale = 1,1
sprpriority = -20
ownpal = 1
ignorehitpause = 1
bindtime = -1

[State 40001, Tile #3-5]
type = Explod
triggerall = !numexplod(15620)
trigger1 = !time
anim = 15602
ID = 15620
pos = 0,0
postype = left  ;p2,front,back,left,right
removetime = 40
pausemovetime = -1
supermovetime = -1
scale = 1,1
sprpriority = -20
ownpal = 1
ignorehitpause = 1
persistent = 0
bindtime = -1

[State 40001, Tile #3-5]
type = Explod
triggerall = !numexplod(15621) < 2
trigger1 = !time
trigger2 = (time%40) = 0
anim = 15602
ID = 15621
pos = 320,0
postype = left  ;p2,front,back,left,right
removetime = 80
pausemovetime = -1
supermovetime = -1
scale = 1,1
sprpriority = -20
ownpal = 1
ignorehitpause = 1
bindtime = -1

[State 40001, Tile #4]
type = Explod
triggerall = !numexplod(15630)
trigger1 = !time
anim = 15603
ID = 15630
pos = 0,0
postype = left  ;p2,front,back,left,right
removetime = 80
pausemovetime = -1
supermovetime = -1
scale = 1,1
sprpriority = -20
ownpal = 1
ignorehitpause = 1
persistent = 0
bindtime = -1

[State 40001, Tile #4]
type = Explod
triggerall = !numexplod(15631) < 2
trigger1 = !time
trigger2 = (time%80) = 0
anim = 15603
ID = 15631
pos = 320,0
postype = left  ;p2,front,back,left,right
removetime = 160
pausemovetime = -1
supermovetime = -1
scale = 1,1
sprpriority = -20
ownpal = 1
ignorehitpause = 1
bindtime = -1

;----------Aqui cambias a broken glass tiempo-------------

[State 40001, Glass Break]
type = ChangeState
trigger1 = root, stateno != [3400,3403]
trigger2 = root, stateno = 3403 && root,animelemtime(14) = 2
value = stateno+1

;----------Aqui regulas el tiempo-------------

;kof 2002 um part2
[Statedef 40002]
anim = 9999

[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15600
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15601
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15610
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15611
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15620
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15621
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15630
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15631

[State 40002, PlaySnd]
type = PlaySnd
trigger1 = !time
value = 3000,5
volume = 500

[State 40001, Glass Break]
type = Explod
triggerall = !numexplod(15640)
trigger1 = !time
anim = 15604
ID = 15640
pos = 0,0
postype = left  ;p2,front,back,left,right
pausemovetime = -1
supermovetime = -1
removetime = -2
scale = 1,1
sprpriority = -20
ownpal = 1
bindtime = -1
ignorehitpause = 1

[State 40001, DestroySelf]
type = DestroySelf
trigger1 = time = 1
;--------------------------------------------------------------------------
;==========================================================================
;    King Of Figthers 2002 Unlimited Match HSDM Fondo y Broken Glass
;==========================================================================

;--------------------------[2002 UM MAX2 PORTRAIT]------------------------------
[Statedef 40003]
anim = 9999

[State 40003, VarSet]
type = VarSet
triggerall = enemy, numhelper(40003)
triggerall = !enemy, numhelper(40004)
trigger1 = enemy, authorname = "Vans"
trigger2 = enemy, authorname = "K.O.D"
trigger3 = enemy, authorname = "K.O.D & Vans"
trigger4 = enemy, authorname = "OrochiKOF97"
trigger5 = enemy, authorname = "Dark Saviour"
trigger6 = enemy, authorname = "Kung Fu Man"
trigger7 = enemy, authorname = "KoopaKoot"
trigger8 = enemy, authorname = "Anjel"
trigger9 = enemy, authorname = "Vans & Kung Fu Man"
var(0) = 1

[State 40003, VarSet]
type = VarSet
triggerall = teamside = 2
triggerall = enemy, numhelper(40004)
trigger1 = enemy, authorname = "Vans"
trigger2 = enemy, authorname = "K.O.D"
trigger3 = enemy, authorname = "K.O.D & Vans"
trigger4 = enemy, authorname = "OrochiKOF97"
trigger5 = enemy, authorname = "Dark Saviour"
trigger6 = enemy, authorname = "Kung Fu Man"
trigger7 = enemy, authorname = "KoopaKoot"
trigger8 = enemy, authorname = "Anjel"
trigger9 = enemy, authorname = "Vans & Kung Fu Man"
var(0) = 1

[State 40001, P1 BG]
type = Explod
triggerall = !numexplod(15650)
triggerall = teamside = 1
trigger1 = !time
anim = 15605
ID = 15650
pos = 0,abs((240*var(0))-81)
postype = left  ;p2,front,back,left,right
pausemovetime = -1
supermovetime = -1
removetime = -2
bindtime = -1
scale = 1,1
sprpriority = -20
ownpal = 1
ignorehitpause = 1

[State 40001, P2 BG]
type = Explod
triggerall = !numexplod(15651)
triggerall = teamside = 2
trigger1 = !time
anim = 15606
ID = 15651
pos = 0,abs((240*var(0))-81)
postype = right  ;p2,front,back,left,right
pausemovetime = -1
supermovetime = -1
removetime = -2
bindtime = -1
scale = 1,1
facing = -1
sprpriority = -20
ownpal = 1
ignorehitpause = 1

[State 40001, P1 PORTRAIT]
type = Explod
triggerall = !numexplod(15660)
triggerall = teamside = 1
trigger1 = !time
anim = 15607
ID = 15660
pos = 0,abs((240*var(0))-81)
postype = left  ;p2,front,back,left,right
pausemovetime = -1
supermovetime = -1
removetime = -2
bindtime = -1
scale = 1,1
sprpriority = -19
ownpal = 1
ignorehitpause = 1

[State 40001, P2 PORTRAIT]
type = Explod
triggerall = !numexplod(15661)
triggerall = teamside = 2
trigger1 = !time
anim = 15607
ID = 15661
pos = 0,abs((240*var(0))-81)
postype = right  ;p2,front,back,left,right
pausemovetime = -1
supermovetime = -1
removetime = -2
bindtime = -1
scale = 1,1
facing = -1
sprpriority = -19
ownpal = 1
ignorehitpause = 1

[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 2
ID = 15650
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 4
ID = 15650
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 6
ID = 15650
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 8
ID = 15650
scale = 1,1
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 56
ID = 15650
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 57
ID = 15650
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 58
ID = 15650
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 59
ID = 15650
scale = 1,1

[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 2
ID = 15651
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 4
ID = 15651
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 6
ID = 15651
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 8
ID = 15651
scale = 1,1
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 56
ID = 15651
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 57
ID = 15651
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 58
ID = 15651
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 59
ID = 15651
scale = 1,1

[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 2
ID = 15660
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 4
ID = 15660
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 6
ID = 15660
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 8
ID = 15660
scale = 1,1
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 56
ID = 15660
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 57
ID = 15660
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 58
ID = 15660
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 59
ID = 15660
scale = 1,1

[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 2
ID = 15661
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 4
ID = 15661
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 6
ID = 15661
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 8
ID = 15661
scale = 1,1
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 56
ID = 15661
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 57
ID = 15661
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 58
ID = 15661
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 59
ID = 15661
scale = 1,1

[State 40001, DestroySelf]
type = DestroySelf
trigger1 = time = 60

[Statedef 40004]
anim = 9999

[State 40001, DestroySelf]
type = DestroySelf
trigger1 = time = 1






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

[Statedef -3]

[State 52, Landing Sound]
type = PlaySnd
trigger1 = Time = 1
trigger1 = stateno = 106
value = 0,2

[State -3, Jumping Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 105
value = 0,4

[State -3, Jumping Sound]
type = PlaySnd
triggerall = Time = 1
triggerall = Var(5) = 1
trigger1 = stateno = 50
trigger2 = stateno = 950
value = 0,1

[State -3, Jumping Sound]
type = PlaySnd
triggerall = Time = 1
triggerall = Var(5) = 0
trigger1 = stateno = 50
trigger2 = stateno = 950
value = 0,0

[State -2, 4]
type = VarRandom
triggerall = Time = 1
trigger1 = stateno = 5000
trigger2 = stateno = 5010
trigger3 = stateno = 5020
v = 4
range = 0,15

[State -2, 5]
type = PlaySnd
triggerall = Time = 1
triggerall = Var(4) = [0,3]
triggerall = alive = 1
trigger1 = stateno = 5000
trigger2 = stateno = 5010
trigger3 = stateno = 5020
value = 5000,0

[State -2, 6]
type = PlaySnd
triggerall = Time = 1
triggerall = Var(4) = [4,7]
triggerall = alive = 1
trigger1 = stateno = 5000
trigger2 = stateno = 5010
trigger3 = stateno = 5020
value = 5000,1

[State -2, 6]
type = PlaySnd
triggerall = Time = 1
triggerall = Var(4) = [8,11]
triggerall = alive = 1
trigger1 = stateno = 5000
trigger2 = stateno = 5010
trigger3 = stateno = 5020
value = 5000,2

[State -3, ai1]
type = Null
triggerall = var(9) != 1
triggerall = RoundState != 3
trigger1 = command = "AI_1"
trigger2 = command = "AI_2"
trigger3 = command = "AI_3"
trigger4 = command = "AI_4"
trigger5 = command = "AI_5"
trigger6 = command = "AI_6"
trigger7 = command = "AI_7"
trigger8 = command = "AI_8"
trigger9 = command = "AI_9"
trigger10 = command = "AI_10"
var(9) = 1

[State -3, ai2]
type = Null
trigger1 = RoundState = 3
var(9) = 0
