; ===========================
; Kamek's Intro/Winpose State File
; Contents (c) 2001-2005 by Kamek the Magikoopa
; Authorized only for use in Elecbyte's M.U.G.E.N
; Do not steal my work! Ask before using something.
; ===========================
; Description: All your intro are belong to us.

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

[State 190: Temp Skip Intro]
type = Null;ChangeState
trigger1 = 1
value = 0

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

[State 190, 2] ;Assert this until you want "round 1, fight" to begin
type = AssertSpecial
trigger1 = AnimElemTime(10) < 0
flag = Intro
flag2 = nomusic

[State 190, 3]
type = PowerSet
trigger1 = Time = 1
value = 1000

[State 190, PickPose]
type = VarRandom
v = 1
range = 191, 192
;range = 191, 194
trigger1 = Time = 0

[State 190: Temp Skip Intro]
type = Null;ChangeState
trigger1 = 1
value = var(1)

;[State 190, Joke Intro VS Captain Commando]
;type = VarSet
;v = 1
;trigger1 = P2Name = "Cap.Commando by OverMind"
;trigger2 = P4Name = "Cap.Commando by OverMind"
;value = 805

;[State 190, VS Kameryu]
;type = VarSet
;v = 1
;trigger1 = P2Name = "Kameryu"
;trigger2 = P4Name = "Kameryu"
;value = 803

;[State 190, VS Apocalpyse]
;type = VarSet
;v = 1
;trigger1 = P2name="Apocalypse"
;trigger2 = P4name="Apocalypse"
;value = 809

[State 190, VS Luigi]
type = VarSet
trigger1 = P2Name = "NGPC Luigi"
trigger2 = P4Name = "NGPC Luigi"
var(1) = 810

[State 190, VS Koopa Troopa]
type = VarSet
trigger1 = P2Name = "Sexy Turtle"
trigger2 = P4Name = "Sexy Turtle"
v = 1
value = 811

[State 190, VS Peach]
type = VarSet
v = 1
trigger1 = P2Name = "Peach"
trigger2 = P4Name = "Peach"
value = 804

[State 190, VS Mario]
type = VarSet
v = 1
trigger1 = P2Name = "Mario"
trigger2 = P4Name = "Mario"
trigger3 = P2Name = "NGPC Mario"
trigger4 = P4Name = "NGPC Mario"
value = 801

[State 190, VS Super Mario]
type = VarSet
v = 1
trigger1 = P2Name = "SuperMario"
trigger2 = P4Name = "SuperMario"
value = 802

[State 190, VS Yoshi]
type = VarSet
trigger1 = P2Name = "Yoshi"
trigger2 = P4Name = "Yoshi"
var(1) = 808

[State 190, VS Evil Peach]
;Priority intro due to Kamek's role in "creating" Evil Peach
type = VarSet
v = 1
trigger1 = P2Name = "EvilPeach"
trigger2 = P4Name = "EvilPeach"
value = 807;806

[State 190, VS Bonus Stage]
;Skip intro against bonus stages
;Currently supports the Mercedes Benz stage and Mr. Wood
type = VarSet
v = 1
trigger1 = P2Name = "Mercedes Benz"
trigger2 = P2Name = "Omake: Mr. Wood"
trigger3 = P4Name = "Mercedes Benz"
trigger4 = P4Name = "Omake: Mr. Wood"
trigger5 = P2Name = "Targets"
trigger6 = P4Name = "Targets"
trigger7 = (P2Name = "M-NES Game 1") || (P2Name = "M-NES Game 2")
value = 0

[State 190, HNK]
type = VarSet
trigger1 = Name = "Hyper Neo-Kamek"
trigger1 = P2Name != "Kamek the Magikoopa"
trigger1 = P4Name != "Kamek the Magikoopa"
var(1) = 195

[State 190, Kamek vs. HNK]
type = VarSet
triggerall = Name = "Kamek the Magikoopa"
trigger1 = P2Name = "Hyper Neo-Kamek"
trigger2 = P4Name = "Hyper Neo-Kamek"
var(1) = 1000195

[State 190, HNK vs. Kamek]
type = VarSet
triggerall = Name = "Hyper Neo-Kamek"
trigger1 = P2Name = "Kamek the Magikoopa"
trigger2 = P4Name = "Kamek the Magikoopa"
var(1) = 1000196

[State 190, Temp Skip Intro]
type = Null;ChangeState
trigger1 = 1
value = 0

[State 190: VS. Cheeseheads]
triggerall = Name = "Kamek the Magikoopa"
trigger1 = var(46)
type = ChangeState
trigger1 = Time = 0
value = 196

[State 190, 1]
type = ChangeState
trigger1 = Time = 0
value = var(1)

;=======================================
;Kamek gets squashed by huge switchblock
;=======================================
[Statedef 191]
type = S
ctrl = 0
anim = 190
velset = 0,0

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

;== Begin Common HyperPause ==

[State 3000, HyperSound]
type = PlaySnd
trigger1 = AnimElem = 9
trigger2 = AnimElem = 16
trigger3 = AnimElem = 21
trigger4 = AnimElem = 23
trigger5 = AnimElem = 25
trigger6 = AnimElem = 27
trigger7 = AnimElem = 29
value = S20, 0

[State 3000, BGPalFX]
type = Null;BGPalFX
trigger1 = AnimElem = 9
trigger2 = AnimElem = 16
trigger3 = AnimElem = 21
trigger4 = AnimElem = 23
trigger5 = AnimElem = 25
trigger6 = AnimElem = 27
trigger7 = AnimElem = 29
time = 20
color = 0
mul = 80, 80, 80

[State 3000, Spark]
type = Explod
trigger1 = AnimElem = 9
trigger2 = AnimElem = 16
trigger3 = AnimElem = 21
trigger4 = AnimElem = 23
trigger5 = AnimElem = 25
trigger6 = AnimElem = 27
trigger7 = AnimElem = 29
supermovetime = 42
pausemovetime = 42
anim = 1337
pos = -25, -35
sprpriority = 3

[State 3000, Pause]
type = Null;Pause
;type = BGPalFX
trigger1 = AnimElem = 9
trigger2 = AnimElem = 16
trigger3 = AnimElem = 21
trigger4 = AnimElem = 23
trigger5 = AnimElem = 25
trigger6 = AnimElem = 27
trigger7 = AnimElem = 29
time = 20
movetime = 20

;== End Common HyperPause==

[State 191, Hocus-Pocus]
type = PlaySnd
trigger1 = AnimElem = 9
trigger2 = AnimElem = 16
value = 1,0

[State 191, Hocus]
type = PlaySnd
trigger1 = AnimElem = 30
value = 1,1

[State 191, Huge Block]
trigger1 = AnimElem = 30
type = Helper
ownpal = 1
name = "Huge Switch"
ID = 3390
postype = p1
pos = 0, -400
stateno = 3391

[State 191, Question Mark]
trigger1 = animelem = 17
type = Explod
ownpal = 1
ID=3390
postype = P1
facing = facing
pos = 0, -75
anim = 191
removetime = -1

[State 191, NoQuestions]
trigger1 = animelem = 20
type = RemoveExplod
ID = 3390

[State 191, Return]
trigger1 = AnimElem = 40
type = ChangeState
value = 0

[Statedef 3391]
type = A
movetype = A
physics = N
anim = 3391

[State 3391, Fall]
type = VelSet
trigger1 = 1
y = 13

[State 3391, Stuff]
type = VelSet
trigger1 = Pos Y >= -1
y = 0

[State 3391, Disappear]
type = ChangeState
value = 3392
trigger1 = Pos Y >= -1

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

[State 3302, ScreenShake]
type = EnvShake
trigger1 = StateTime = 1
time = 30
freq = 80
amp = -8

[State 3392, Pow]
type = PlaySnd
trigger1 = StateTime = 1
value = S3302, 0

[State 3392, Destroy]
type = DestroySelf
trigger1 = StateTime >= 100

;=========================
;Kamek talking with Bowser
;=========================
[Statedef 192]
type = S
ctrl = 0
anim = 192
velset = 0,0

[State 192, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 192
flag = Intro

[State 192, BowserSpawn]
type = Helper
ownpal = 1
trigger1 = AnimElem = 1
name = "Bowser"
pausemovetime = 50
ID = 192
postype = P1
pos = -40, -20
stateno = 3393

[State 192, Kamek Talks]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 192, Bowser Talks]
type = PlaySnd
trigger1 = StateTime = 50
value = S190, 1

[State 192, Bowser Talks Some More]
type = PlaySnd
trigger1 = AnimElem = 5
value = S190, 2

[State 192, Exclaim!]
type = Explod
trigger1 = AnimElem = 7
ownpal = 1
ID = 192
pausetime = 50
postype = P1
facing = facing
pos = 0, -75
anim = 193

[State 192, Fake SuperPause]
type = Null;BGPalFX
trigger1 = AnimElem = 7
time = 50
mul = 128, 128, 128

[State 192, Pause]
type = Null;Pause
trigger1 = AnimElem = 7
time = 50
movetime = 50

[State 192, Play Super Sound]
type = PlaySnd
trigger1 = AnimElem = 7
;value = S20, 1
value = S5,6

[State 192, Recover]
type = Changestate
trigger1 = AnimElem = 8
value = 0

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

[State 3393, Turn]
trigger1 = StateTime = 320
type = Turn

[State 3393, Fly Away]
trigger1 = StateTime = 320
type = VelSet
x = 3

[State 192, Bowser Laughs]
type = PlaySnd
trigger1 = StateTime = 320
value = S190, 0

[State 3393, Destroy]
trigger1 = StateTime = 500
type = DestroySelf

;=====================
;Kamek trips over Eefi
;=====================
[Statedef 193]
anim = 0
type = s
ctrl = 0
velset = 0, 0

[State 193, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 193
flag = Intro

[State 193, AssertInvisible]
type = AssertSpecial
trigger1 = stateno = 193
flag = Invisible

[State 193, Place Eefi]
trigger1 = statetime = 0
type = Helper
ownpal = 1
name = "Eefi"
ID = 3394
pos = 0, 0
postype = p1
stateno = 3394

[State 193, Place Kamek]
trigger1 = statetime = 0
type = Helper
name = "Kamek Klone"
ID = 3395
pos = 0, 0
postype = p1
stateno = 3395

[State 193, State 0]
;trigger1 = numhelper(3395) = 0
trigger1 = time = 867
type = changestate
value = 0

[Statedef 3394]
; Eefi's State
anim = ifelse(Facing=1, 3394, 3395)
type = s
ctrl = 0
velset = 0,0

[State 3394, Next]
type = ChangeAnim
trigger1 = statetime = 500
value = 3397

[State 3394, EspiCry]
type = PlaySnd
trigger1 = statetime = 550
value = S10, 0

[State 3394, Turn]
type = Turn
trigger1 = statetime = 650

[State 3394, Run Anim]
type = ChangeAnim
trigger1 = statetime = 650
value = 3398

[State 3394, Run]
type = VelSet
trigger1 = statetime = 650
x = 2

[State 3394, Dest]
type = DestroySelf
trigger1 = statetime = 800

[Statedef 3395]
anim = 20
type = s
ctrl = 0
velset = 1,0

[State 20, ?]
type = VelSet
trigger1 = 1
y = -1*sin(time/10)

[State 3395, Go]
type = Varset
trigger1 = statetime = 0
fvar(1) = Pos X

[State 3395, Port]
type = PosAdd
trigger1 = statetime = 1
x = -320

[State 3395, Trip]
type = VelSet
trigger1 = statetime = 300
x = 1.5
y = -5

[State 182, Explod]
type = Explod
trigger1 = statetime = 300
anim = F3
pos = 2, -10
postype = P1

[State 3395, Trip]
type = PlaySnd
trigger1 = statetime = 300
value = F5,4

[State 3395, VarSet]
type = VarSet
trigger1 = statetime = 300
v = 35
value = -1

[State 3395, ChangeState]
type = ChangeState
trigger1 = statetime = 300
value = 5050

[Statedef 3396]
anim = 3396
type = s
ctrl = 0
velset = 0,0

[State 3396, Kamek Talks]
type = PlaySnd
trigger1 = StateTime = 0
trigger2 = StateTime = 40
value = S2, 0

[State 3396, Wait]
type = ChangeAnim
trigger1 = StateTime = 80
value = 0

[State 3396, Turn]
type = Turn
trigger1 = StateTime = 80

[State 3396, Returns]
type = Velset
trigger1 = statetime = 400
x = 1

[State 3396, Destroy]
type = DestroySelf
;trigger1 = Abs(Pos X - fvar(1)) <= 1
trigger1 = Time = 445

;==============================================
;Kamek talking with Dark Butterfree and Umbreon
;==============================================
[Statedef 194]
anim = 194
type = s
ctrl = 0
velset = 0, 0

[State 194, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 194
flag = Intro

[State 194, Dark Butterfree]
trigger1 = StateTime = 0
type = Helper
ownpal = 1
name = "Dark Butterfree"
pausemovetime = 50
postype = p1
pos = 40, -50
stateno = 3494

[State 194, Umbreon]
trigger1 = StateTime = 0
type = Helper
ownpal = 1
name = "Umbreon"
pausemovetime = 50
postype = p1
pos = 50, 0
stateno = 3495

[State 194, Kamek Talks]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 5
trigger3 = AnimElem = 7
trigger4 = AnimElem = 9
value = S2, 0

[State 194, DB Talks]
type = PlaySnd
trigger1 = StateTime = 80
value = S10, 1

[State 194, Umbreon Talks]
type = PlaySnd
trigger1 = StateTime = 120
value = S10, 2

[State 194, LookProj]
type = Projectile
trigger1 = StateTime = 180
Projanim = 3497
Projremove = 1
Velocity = 4, 0
offset = 10, -29
postype = p1
hitflag = MAF

[State 192, Exclaim!]
type = Explod
trigger1 = AnimElem = 4
ownpal = 1
ID=194
postype = P1
facing = facing
pausetime = 50
pos = 0, -75
anim = 193

[State 194, Fake SuperPause]
type = BGPalFX
trigger1 = AnimElem = 4
time = 50
mul = 128, 128, 128

[State 194, Pause]
type = Pause
trigger1 = AnimElem = 4
time = 50
movetime = 50

[State 194, Play Super Sound]
type = PlaySnd
trigger1 = AnimElem = 4
;value = S20, 1
value = S5, 6

[State 194, Fight]
type = ChangeState
trigger1 = AnimElem = 10
value = 0

[Statedef 3494]
anim = 3494
type = s
ctrl = 0
velset = 0, 0

[State 3494, Turn]
type = Turn
trigger1 = StateTime = 0

[State 3494, Run]
type = ChangeAnim
trigger1 = StateTime = 400
value = 2530

[State 3494, Run]
type = VelSet
x = 3
trigger1 = StateTime = 400

[State 3494, Destroy]
type = DestroySelf
trigger1 = StateTime = 500

[Statedef 3495]
anim = 3495
type = s
ctrl = 0
velset = 0, 0

[State 3495, Turn]
type = Turn
trigger1 = StateTime = 0

[State 3495, Run Anim]
type = ChangeAnim
value = 3496
trigger1 = StateTime = 400

[State 3495, Run]
type = VelSet
x = 3
trigger1 = StateTime = 400

[State 3495, Destroy]
type = DestroySelf
trigger1 = StateTime = 500

;========
;VS MARIO
;========
[Statedef 801]
type = S
anim = 800
ctrl = 0
velset = 0,0

[State 801, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 801
flag = Intro
flag2 = NoMusic
flag3 = NoBarDisplay

[State Intro Music Time]
type = PlaySnd
value = S800, 0
trigger1 = Time = 0
channel = 2
abspan = 0

[State Intro Music Loop]
type = PlaySnd
value = S800, 1
trigger1 = Time = 260
;trigger1 = (260 - Time) % 511 = 0
channel = 2
abspan = 0
loop = 1

;[State 801, Cue The Music]
;type = PlaySnd
;value = S195, 0
;trigger1 = StateTime = 0
;channel = 2
;abspan = 0

[State 801, Kamek Talks]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 801, Cuecard]
trigger1 = AnimElem = 5
type = Explod
anim = 801
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1

[State 801, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 860

;==============
;VS SUPER MARIO
;==============
[Statedef 802]
type = S
anim = 800
ctrl = 0
velset = 0,0

[State 801, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 802
flag = Intro
flag2 = NoMusic
flag3 = NoBarDisplay

[State Intro Music Time]
type = PlaySnd
value = S800, 0
trigger1 = Time = 0
channel = 2
abspan = 0

[State Intro Music Loop]
type = PlaySnd
value = S800, 1
trigger1 = Time = 260
;trigger1 = (260 - Time) % 511 = 0
channel = 2
abspan = 0
loop = 1

;[State 801, Cue The Music]
;type = PlaySnd
;value = S195, 0
;trigger1 = StateTime = 0
;channel = 2
;abspan = 0

[State 801, Kamek Talks]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 801, Cuecard]
trigger1 = AnimElem = 5
type = Explod
anim = 802
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1

[State 801, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 860

;==========
;VS KAMERYU
;==========
[Statedef 803]
type = S
anim = 800
ctrl = 0
velset = 0,0

[State 803, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 803
flag = Intro
flag2 = NoMusic
flag3 = NoBarDisplay

[State Intro Music Time]
type = PlaySnd
value = S800, 0
trigger1 = Time = 0
channel = 2
abspan = 0

[State Intro Music Loop]
type = PlaySnd
value = S800, 1
trigger1 = Time = 260
;trigger1 = (260 - Time) % 511 = 0
channel = 2
abspan = 0
loop = 1

;[State 803, Cue The Music]
;type = PlaySnd
;value = S195, 0
;trigger1 = StateTime = 0
;channel = 2
;abspan = 0

[State 803, Kamek Talks]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 801, Cuecard]
trigger1 = AnimElem = 5
type = Explod
anim = 803
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1

[State 803, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 860

;========
;VS PEACH
;========
[Statedef 804]
type = S
anim = 800
ctrl = 0
velset = 0,0

[State 804, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 804
flag = Intro
flag2 = NoMusic
flag3 = NoBarDisplay

[State Intro Music Time]
type = PlaySnd
value = S800, 0
trigger1 = Time = 0
channel = 2
abspan = 0

[State Intro Music Loop]
type = PlaySnd
value = S800, 1
trigger1 = Time = 260
;trigger1 = (260 - Time) % 511 = 0
channel = 2
abspan = 0
loop = 1

;[State 804, Cue The Music]
;type = PlaySnd
;value = S195, 0
;trigger1 = StateTime = 0
;channel = 2
;abspan = 0

[State 804, Kamek Talks]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 804, Cuecard]
trigger1 = AnimElem = 5
type = Explod
anim = 804
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1

[State 804, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 860

;========
;VS YOSHI
;========
[Statedef 808]
type = S
anim = 800
ctrl = 0
velset = 0,0

[State 808, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 808
flag = Intro
flag2 = NoMusic
flag3 = NoBarDisplay

[State Intro Music Time]
type = PlaySnd
value = S800, 0
trigger1 = Time = 0
channel = 2
abspan = 0

[State Intro Music Loop]
type = PlaySnd
value = S800, 1
trigger1 = Time = 260
;trigger1 = (260 - Time) % 511 = 0
channel = 2
abspan = 0
loop = 1

;[State 808, Cue The Music]
;type = PlaySnd
;value = S195, 1
;trigger1 = StateTime = 0
;channel = 2
;abspan = 0

[State 808, Kamek Talks]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 808, Cuecard]
trigger1 = AnimElem = 5
type = Explod
anim = 808
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1

[State 808, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 510

;========
;VS LUIGI
;========
[Statedef 810]
type = S
anim = 800
ctrl = 0
velset = 0,0

[State 810, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 810
flag = Intro
flag2 = NoMusic
flag3 = NoBarDisplay

[State Intro Music Time]
type = PlaySnd
value = S800, 0
trigger1 = Time = 0
channel = 2
abspan = 0

[State Intro Music Loop]
type = PlaySnd
value = S800, 1
trigger1 = Time = 260
;trigger1 = (260 - Time) % 511 = 0
channel = 2
abspan = 0
loop = 1

;[State 810, Cue The Music]
;type = PlaySnd
;value = S195, 1
;trigger1 = StateTime = 0
;channel = 2
;abspan = 0

[State 810, Kamek Talks]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 810, Cuecard]
trigger1 = AnimElem = 5
type = Explod
anim = 810
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1

[State 810, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 510

;===========
;========
;VS Koopa Troopa
;========
[Statedef 811]
type = S
anim = 800
ctrl = 0
velset = 0,0

[State 811, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 811
flag = Intro
flag2 = NoMusic
flag3 = NoBarDisplay

[State Intro Music Time]
type = PlaySnd
value = S800, 0
trigger1 = Time = 0
channel = 2
abspan = 0

[State Intro Music Loop]
type = PlaySnd
value = S800, 1
trigger1 = Time = 260
;trigger1 = (260 - Time) % 511 = 0
channel = 2
abspan = 0
loop = 1

;[State 810, Cue The Music]
;type = PlaySnd
;value = S195, 1
;trigger1 = StateTime = 0
;channel = 2
;abspan = 0

[State 810, Kamek Talks]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 810, Cuecard]
trigger1 = AnimElem = 5
type = Explod
anim = 811
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1

[State 810, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 910

;========
; VS YAKF
;========
[Statedef 812]
type = S
anim = 813
ctrl = 0
velset = 0,0

[State 812, Show Name]
type = Explod
trigger1 = (Time = 0)
anim = 812
pos = 0, -60
postype = p1
sprpriority = 10
removetime = 250

[State 812, AssertIntro]
type = AssertSpecial
trigger1 = 1
flag = Intro
flag2 = NoMusic
flag3 = NoBarDisplay

[State 812, Quit]
type = ChangeState
value = 0
trigger1 = Time > 250

;VS COMMANDO
;===========
[Statedef 805]
type = S
anim = 3495
ctrl = 0
velset = 0,0

[State 805, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 805
flag = Intro
flag2 = NoMusic
flag3 = NoBarDisplay

[State Intro Music Time]
type = PlaySnd
value = S800, 0
trigger1 = Time = 0
channel = 2
abspan = 0

[State Intro Music Loop]
type = PlaySnd
value = S800, 1
trigger1 = Time = 260
;trigger1 = (260 - Time) % 511 = 0
channel = 2
abspan = 0
loop = 1

;[State 805, Cue The Music]
;type = PlaySnd
;value = S195, 0
;trigger1 = StateTime = 0
;channel = 2
;abspan = 0

[State 805, Umbreon Talks]
type = PlaySnd
trigger1 = statetime = 50
value = S10, 2

[State 805, Cuecard]
trigger1 = AnimElem = 5
type = Explod
anim = 805
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1

[State 805, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 860

;=============
;VS EVIL PEACH
;=============
[Statedef 806]
type = S
anim = 9999
ctrl = 0
velset = 0,0

; Wait for Peach to turn evil, because Kamek is flying across the screen.

[State 806, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoMusic
flag2 = NoBarDisplay
flag3 = Intro

[State Intro Music Time]
type = PlaySnd
value = S800, 0
trigger1 = Time = 0
channel = 2
abspan = 0

[State Intro Music Loop]
type = PlaySnd
value = S800, 1
trigger1 = Time = 260
;trigger1 = (260 - Time) % 511 = 0
channel = 2
abspan = 0
loop = 1

;[State 806, Cue The Music]
;type = PlaySnd
;value = S195, 0
;trigger1 = StateTime = 0
;channel = 2
;abspan = 0

[State 806, Fade In]
type = PalFX
trigger1 = StateTime = [120, 145]
mul = (StateTime - 120) * 10, (StateTime - 120) * 10, (StateTime - 120) * 10
time = 5

[State 806, Appear]
type = ChangeAnim
value = 41
trigger1 = StateTime = 121

[State 806, Begin Talking]
type = ChangeAnim
value = 800
trigger1 = StateTime = 150

[State 806, Kamek Talks]
type = PlaySnd
triggerall = Anim = 800
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 806, Cuecard]
trigger1 = StateTime = 260
;This should be the approximate time for the cuecard to show up. Transitioning from animelem to statetime for the Kamek surprised anim.
type = Explod
anim = 806
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1

[State 806, Stop Music]
trigger1 = StateTime = 1010
type = PlaySnd
channel = 2
value = 999,0

[State 806, Play Super Sound]
type = PlaySnd
trigger1 = StateTime = 1010
;value = S20, 1
value = S5,6

[State 192, Exclaim!]
type = Explod
trigger1 = StateTime = 1010
ownpal = 1
ID=192
pausetime = 50
postype = P1
facing = facing
pos = 0, -75
anim = 193

[State 806, Shocked]
type = ChangeAnim
value = 899
trigger1 = StateTime = 1010

[State 806, Fight Anim]
type = ChangeAnim
value = 0
trigger1 = StateTime = 1160

[State 806, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 1310

;=============
;VS EVIL PEACH (alternate)
;=============
[Statedef 807]
type = S
anim = 9999
ctrl = 0
velset = 0,0

; Wait for Peach to turn evil, because Kamek is flying across the screen.

[State 806, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoMusic
flag2 = NoBarDisplay
flag3 = Intro

[State 192, BowserSpawn]
type = Helper
ownpal = 1
trigger1 = Time = 0
name = "Bowser"
ID = 192
postype = P1
pos = -40, -20
stateno = 1000807

[State Intro Music Time]
type = PlaySnd
value = S800, 0
trigger1 = Time = 0
channel = 2
abspan = 0

[State Intro Music Loop]
type = PlaySnd
value = S800, 1
trigger1 = Time = 260
;trigger1 = (260 - Time) % 511 = 0
channel = 2
abspan = 0
loop = 1

;[State 806, Cue The Music]
;type = PlaySnd
;value = S195, 0
;trigger1 = StateTime = 0
;channel = 2
;abspan = 0

[State 806, Fade In]
type = PalFX
trigger1 = StateTime = [120, 145]
mul = (StateTime - 120) * 10, (StateTime - 120) * 10, (StateTime - 120) * 10
time = 5

[State 806, Appear]
type = ChangeAnim
value = 41
trigger1 = StateTime = 121

[State 806, Begin Talking]
type = ChangeAnim
value = 800
trigger1 = StateTime = 150

[State 806, Kamek Talks]
type = PlaySnd
triggerall = Anim = 800
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 806, Cuecard]
trigger1 = StateTime = 260
;This should be the approximate time for the cuecard to show up. Transitioning from animelem to statetime for the Kamek surprised anim.
type = Explod
anim = 807
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1

[State 806, Stop Music]
trigger1 = StateTime = 1160
type = PlaySnd
channel = 2
value = 999,0

[State 806, Play Super Sound]
type = PlaySnd
trigger1 = StateTime = 1160
;value = S20, 1
value = S5,6

[State 192, Exclaim!]
type = Explod
trigger1 = StateTime = 1160
ownpal = 1
ID=192
pausetime = 50
postype = P1
facing = facing
pos = 0, -75
anim = 193

[State 806, Shocked]
type = ChangeAnim
value = 899
trigger1 = StateTime = 1160

[State 806, Fight Anim]
type = ChangeAnim
value = 0
trigger1 = StateTime = 1610

[State 806, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 1610

[Statedef 1000807]
type = S
ctrl = 0
anim = 3393
velset = 0,0

[State 3393, Turn]
trigger1 = StateTime = 1310
type = Turn

[State 3393, Fly Away]
trigger1 = StateTime = 1310
type = VelSet
x = 3

[State 192, Bowser Laughs]
type = PlaySnd
trigger1 = StateTime = 1310
value = S190, 0

[State 3393, Destroy]
trigger1 = StateTime = 1430
type = DestroySelf

;=======
;VS APOC
;=======
[Statedef 809]
type = S
anim = 800
ctrl = 0
velset = 0,0

[State 809, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 809
flag = Intro
flag2 = NoMusic
flag3 = NoBarDisplay

[State 809, Pause]
type = Pause
trigger1 = StateTime = 160
time = 900
movetime = 900
;Pause is needed so Apocalypse won't turn big until the convo is over.

[State 809, Kamek Talks]
type = PlaySnd
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
value = S2, 0

[State 809, Cuecard]
trigger1 = AnimElem = 5
type = Explod
anim = 809
pos = 160, 70
postype = left
ownpal = 1
sprpriority = 3
ontop = 1
pausemovetime = 900

[State 809, Stoppit]
type = ChangeState
value = 0
trigger1 = StateTime > 1060

;=============================
;Kamek becomes Hyper Neo-Kamek
;=============================
[Statedef 195]
anim = 195
type = s
ctrl = 0
velset = 0, 0

[State 195, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 195
flag = Intro

[State 195: Full Power]
type = PowerAdd
trigger1 = Time = 120
trigger1 = var(46) > 1
value = const(data.power) - Power

[State 195, Switch]
type = ChangeAnim
trigger1 = StateTime = 120
value = 220

[State 195, Blammo]
type = PlaySnd
trigger1 = StateTime = 120
value = 195, 2

[State 195, Beamo]
type = Explod
trigger1 = StateTime = 120
anim = 196
removetime = 60
sprpriority = 2

[State 195, Done]
type = ChangeState
value = 0
trigger1 = StateTime > 240

;=============================================
;Kamek gets an extra boost against cheeseheads
;=============================================
[Statedef 196]
anim = 195;195000
type = s
ctrl = 0
velset = 0, 0

[State 196: Temp Lifeset]
type = Null;LifeSet
trigger1 = Time = 0
value = 1

[State 195, AssertIntro]
type = AssertSpecial
trigger1 = stateno = 196
flag = Intro
flag2 = nomusic

[State 195: Full Power]
type = PowerAdd
trigger1 = Time = 120
;trigger1 = Time = 315
value = const(data.power) - Power

[State 195: Temp Full Life]
type = Null;LifeSet
trigger1 = Time = 120
value = const(data.life)

[State 195, Switch]
type = ChangeAnim
trigger1 = StateTime = 120
;trigger1 = StateTime = 240
value = 5120;temp 220

[State 195, Switch]
type = ChangeAnim
trigger1 = StateTime = 120;315;120
value = 220

[State 195: Temp Power Up]
type = ChangeAnim
trigger1 = Time = 255
value = 195

[State 195, Blammo]
type = PlaySnd
trigger1 = StateTime = 120
;trigger2 = StateTime = 315 ;temp
value = 195, 2

[State 195, Beamo]
type = Explod
trigger1 = StateTime = 120
;trigger2 = StateTime = 315 ;temp
anim = 196
removetime = 60
sprpriority = 2

[State 195, Done]
type = ChangeState
value = 0
trigger1 = StateTime > 240;435

;======================================
; State 820
; Teams/Survival Mode Intro (normal Kamek)
;======================================
[Statedef 820]
anim = 2600
type = S
physics = S
ctrl = 0
velset = 0,0

[State 820, TeleSnd]
type = PlaySnd
trigger1 = Time = 0
value = S2600, 0

[State 820, Determine Type of Teleport]
; 1 = Size
; 2 = Trans
type = VarRandom
trigger1 = Time = 0
v = 18
range = 1, 2

[State 820, Store Time]
type = VarSet
trigger1 = var(18) = 1
fvar(18) = Time

[State 820, Grow!]
type = AngleDraw
trigger1 = Time < 26
trigger1 = var(18) = 1
scale = fvar(18)/26, fvar(18)/26

[State 820, Fade In]
type = Trans
trigger1 = Time < 26
trigger1 = var(18) = 2
trans = addalpha
alpha = Floor(time*256/26), 256-Floor(time*256/26)

[State 820, AssertIntro]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 820, Done]
type = ChangeState
value = 0
trigger1 = StateTime >= 26

;======================================
; State 821
; Teams/Survival Mode Intro (Hyper Neo-Kamek)
;======================================
[Statedef 821]
anim = 197
type = S
physics = S
ctrl = 0
velset = 0,0

[State 821, TeleSnd]
type = PlaySnd
trigger1 = Time = 0
value = S2600, 0

[State 821, Determine Type of Teleport]
; 1 = Size
; 2 = Trans
type = VarRandom
trigger1 = Time = 0
v = 18
range = 1, 2

[State 821, Store Time]
type = VarSet
trigger1 = var(18) = 1
fvar(18) = Time

[State 821, Grow!]
type = AngleDraw
trigger1 = Time < 26
trigger1 = var(18) = 1
scale = fvar(18)/26, fvar(18)/26

[State 821, Fade In]
type = Trans
trigger1 = Time < 26
trigger1 = var(18) = 2
trans = addalpha
alpha = Floor(time*256/26), 256-Floor(time*256/26)

[State 821, AssertIntro]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 821, Done]
type = ChangeState
value = 195
trigger1 = StateTime >= 26

;======================================
; Kamek vs. Hyper Neo-Kamek
; (Kamek's ver)
;======================================
[Statedef 1000195]
anim = 1000195
type = s
ctrl = 0
velset = 0, 0

[State 195, AssertIntro]
type = AssertSpecial
trigger1 = 1
flag = Intro
flag2 = nomusic

[State 195, Blammo]
type = PlaySnd
trigger1 = StateTime = 130
value = 195, 2

[State 195, Beamo]
type = Explod
trigger1 = StateTime = 130
anim = 196
removetime = 60
sprpriority = 2

[State 195, Recover]
type = ChangeAnim
trigger1 = StateTime = 250
value = 1000197

[State 195, Done]
type = ChangeState
value = 0
trigger1 = AnimTime = 0
trigger1 = Anim = 1000197

;======================================
; Kamek vs. Hyper Neo-Kamek
; (HNK's ver)
;======================================
[Statedef 1000196]
anim = 1000196
type = S
ctrl = 0
velset = 0,0

[State 195, AssertIntro]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 195, Blammo]
type = PlaySnd
trigger1 = AnimElem = 2
value = 195, 2

[State 195, Beamo]
type = Explod
trigger1 = AnimElem = 2
anim = 196
removetime = 60
sprpriority = 2

[State 195, Done]
type = ChangeState
value = 0
trigger1 = StateTime > 280

;============================================================================
; WINPOSES
;============================================================================
; Lose by Time Over
; CNS difficulty: basic
; CNS レベル: 基本
[Statedef 170]
type = S
ctrl = 0
anim = 5000
velset = 0,0

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

;---------------------------------------------------------------------------
; Win state decider
; CNS difficulty: basic
; CNS レベル: 基本
[Statedef 180]
type = S
ctrl = 0

[State 180, Win]
type = VarSet
trigger1 = Win
trigger1 = Time = 0
var(44) = var(44) + 1

[State 180, Fatality Win]
type = ChangeState
value = 10602
trigger1 = (Var(10) = 1)
trigger2 = (Var(10) = 3)

[State 180, Friendship]
type = ChangeState
value = 10604
trigger1 = (Var(10) = 2)

[State 180, Normal Win]
type = ChangeState
value = 181
trigger1 = Name != "Hyper Neo-Kamek"
trigger1 = (Var(10) = 4)

[State 180, PickPose]
type = VarRandom
v = 1
range = 181, ifelse(Name = "Kamek's Rival", 182, 183)
trigger1 = Time = 0

[State 180, HNK Winpose]
type = VarSet
trigger1 = Name = "Hyper Neo-Kamek"
trigger2 = var(46) > 0
var(1) = 184

[State 180, 1]
type = ChangeState
trigger1 = Time = 0
value = var(1)
;value = 183

;=========================================
; Win pose 1: Jump up/down as crowd cheers
;=========================================
[Statedef 181]
type = S
ctrl = 0
anim = 180
velset = 0,0

[State 181: No Screenbound]
type = ScreenBound
trigger1 = 1
value = 0

[State 181, Jump]
type = VelSet
trigger1 = AnimElem = 2
trigger1 = vel y = 0
y = Const(velocity.jump.y)

[State 181, Stop]
type = PosSet
trigger1 = AnimTime > 10
trigger1 = vel y > 0
trigger1 = pos y >= 0
y = 0

[State 181, Accel]
type = VelSet
trigger1 = AnimTime > 10
y = vel y + .44

[State 181, Restart]
type = ChangeAnim
trigger1 = pos y = 0
trigger1 = vel y > 0
trigger1 = AnimTime > 10
value = 180

[State 181, Stop]
type = VelSet
trigger1 = AnimElem = 1
trigger1 = vel y != 0
y = 0

[State 181, Cheer]
type = PlaySnd
;freqmul = ((IsHomeTeam*.1) + (Var(34)*.2) + (1.9))/2
trigger1 = Time = 0
Value = 180, 0

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

;=========================================
; Win pose 2 - Kamek gets KO'd by his own wand
;=========================================
[Statedef 182]
type = S
ctrl = 0
anim = 182

[State 182, Hocus]
type = PlaySnd
;freqmul = ((IsHomeTeam*.1) + (Var(34)*.2) + (1.9))/2
trigger1 = AnimElem = 1
trigger1 = Name != "Kamek's Rival"
Value = 1, 0

[State 182: Wand Throw]
type = Helper
trigger1 = AnimElem = 2
name = "Kamek's Magic Wand"
ID = 1000182
StateNo = 1000182
pos = -21, -32
ownpal = 1

[State 182, Knockout]
type = Changeanim
trigger1 = time = 40
value = 5000

[State 182, Explod]
type = Explod
trigger1 = time = 40
anim = F1
pos = 2, -30
postype = P1
sprpriority = 2

[State 182, Clang]
type = PlaySnd
;freqmul = ((IsHomeTeam*.1) + (Var(34)*.2) + (1.9))/2
trigger1 = time = 40
value = F5, 2

[State 182, Seeya]
type = Velset
trigger1 = time = 45
X = -0.5
Y = -8

[State 182, 2]
type = Changestate
trigger1 = Time = 45
value = 5050

[Statedef 1000182]
type = S
movetype = I
physics = N
velset = 0.6, -9
anim = 1000182
sprpriority = 3

[State 1000182: Rotation]
type = AngleDraw
trigger1 = 1
value = (Time*15) % 360

[State 1000182: Gravity]
type = Gravity
trigger1 = 1

[State 1000182: Dies when hit]
type = DestroySelf
trigger1 = Time = 37

;=========================================
; Win Pose 3: Kammy looks for Kamek
;=========================================
[Statedef 183]
anim = 41

[State 183, Assert]
type = AssertSpecial
trigger1 = time = [0, 300]
flag = roundnotover

[State 183, FadeOut]
type = Trans
trigger1 = 1
trans = addalpha
alpha = 256, time*10
;type = PalFX
;trigger1 = 1
;mul = 256 - StateTime * 10, 256 - StateTime * 10, 256 - StateTime * 10
;time = 5

[State 183, Disappear]
type = ChangeAnim
trigger1 = StateTime = 26
value = 9999

[State 183, SpawnKammy]
type = Helper
trigger1 = StateTime = 1
name = "Kammy Koopa"
ownpal = 1
postype = front
pos = 100, -40
stateno = 6000
facing = -1

[Statedef 184]
anim = 2000

[State 184, 4]
type = GameMakeAnim
trigger1 = TimeMod = 9, 0
value = 130
pos = 0, 0

[State 195, Blammo]
type = PlaySnd
trigger1 = StateTime = 0
value = 195, 2

[State 184, Explod]
type = Explod
trigger1 = StateTime = 0
anim = 196
removetime = 240
sprpriority = 2

[Statedef 6000]
velset = 5, 0
anim = 6000

[State 6000, Sparks]
type = PlaySnd
;freqmul = ((IsHomeTeam*.1) + (Var(34)*.2) + (1.9))/2
value = S6000, 0
triggerall = !(StateTime%2)
triggerall = ScreenPos Y = [0,240]
trigger1 = Vel X != 0
trigger2 = Vel Y != 0

[State 6000, Sparks]
type = Helper
triggerall = !(StateTime%2)
triggerall = ScreenPos Y = [0,240]
trigger1 = Vel X != 0
trigger2 = Vel Y != 0
name = "Kammy's Exhaust Trail"
ID = 183
stateno = 226
postype = p1
pos = -34, -13

[State 6000, Halt Here]
type = VelSet
trigger1 = StateTime = 50
trigger1 = Vel X = 5
X = 0

[State 6000, ChangeAnim]
type = ChangeAnim
trigger1 = StateTime = 50
value = 6001

[State 6000, Look]
type = Turn
trigger1 = StateTime = 100
trigger2 = StateTime = 150

[State 600, Keep Going]
type = VelSet
trigger1 = StateTime = 200
X = 2
Y = 1

[State 600, Accel]
trigger1 = StateTime > 200
trigger1 = !(StateTime%5)
type = VelSet
Y = Vel Y - 1

[State 6000, ChangeAnim]
type = ChangeAnim
trigger1 = StateTime = 200
value = 6000


