; ===========================
; Kamek's Command File
; Contents (c) 2001-2005 by Kamek the Magikoopa
; Portions by Winane & Co. (AI Activators)
; Authorized only for use in Elecbyte's M.U.G.E.N
; Do not steal my work! Ask before using something.
; ===========================
; Description: .CNS file for Kamek
; Contains most of Kamek's basic AI

;   slash (/) - means the key must be held down
;          egs. command = /D       ;hold the down direction
;               command = /DB, a   ;hold down-back while you press a
;   tilde (~) - to detect key releases
;          egs. command = ~a       ;release the a button
;               command = ~D, F, a ;release down, press fwd, then a
;          If you want to detect "charge moves", you can specify
;          the time the key must be held down for (in game-ticks)
;          egs. command = ~30a     ;hold a for at least 30 ticks, then release
;               command = ~30
;   dollar ($) - Direction-only: detect as 4-way
;          egs. command = $D       ;will detect if D, DB or DF is held
;               command = $B       ;will detect if B, DB or UB is held
;   plus (+) - Buttons only: simultaneous press
;          egs. command = a+b      ;press a and b at the same time
;               command = x+y+z    ;press x, y and z at the same time
;   You can combine them:
;     eg. command = ~30$D, a+b     ;hold D, DB or DF for 30 ticks, release,
;                                  ;then press a and b together
;-| Single Button |---------------------------------------------------------
[Command]
name = "a"
command = a
time = 1

[Command]
name = "b"
command = b
time = 1

[Command]
name = "c"
command = c
time = 1

[Command]
name = "x"
command = x
time = 1

[Command]
name = "y"
command = y
time = 1

[Command]
name = "z"
command = z
time = 1

[Command]
name = "start"
command = s
time = 1

;-| Hold Dir |--------------------------------------------------------------
[Command]
name = "holdfwd";Required (do not remove)
command = /$F
time = 1

[Command]
name = "holdback";Required (do not remove)
command = /$B
time = 1

[Command]
name = "holdup" ;Required (do not remove)
command = /$U
time = 1

[Command]
name = "holddown";Required (do not remove)
command = /$D
time = 1

;-| Hold Button |----------------------------------------------------------
; Please define Anim 74140108 in your AIR file if AND ONLY IF you place these
; 7 Hold Button commands immediately after the 11 Single Button and Hold Dir
; commands at the very top of your CMD list, as demonstrated here.
; In this version of the AI code, these commands are only used by the XOR
; method, and thus are optional.  But there remains a possibility that a
; future version of the helper method might be helped by having these
; commands placed here, and Anim 74140108 would then be used to indicate
; that a partner character has a compatible CMD.

[Command]
name = "holda"
command = /a
time = 1

[Command]
name = "holdb"
command = /b
time = 1

[Command]
name = "holdc"
command = /c
time = 1

[Command]
name = "holdx"
command = /x
time = 1

[Command]
name = "holdy"
command = /y
time = 1

[Command]
name = "holdz"
command = /z
time = 1

[Command]
name = "holdstart"
command = /s
time = 1

;-| CPU |--------------------------------------------------------------
; Note that if you make any changes to the basic one-button or recovery
; commands, you'll need to make the same changes to their matching commands here
; and/or in the XOR varSet controller.  That includes things like, for example:
;  * changing the recovery command to use a different combination of buttons.
;  * renaming the b button command as "d", or the start button command as "s".
;  * switching the button names around, e.g. so button y triggers "a" and button a triggers "y".
;  * having more than one way to trigger the same command name.
; If you understand how the XOR method works, the proper changes should be obvious.
; If you don't understand it, then simply disable the lines in the XOR varSet
; controller that correspond to the commands you've altered.

[Command]
name = "a2"
command = a
time = 1

[Command]
name = "b2"
command = b
time = 1

[Command]
name = "c2"
command = c
time = 1

[Command]
name = "x2"
command = x
time = 1

[Command]
name = "y2"
command = y
time = 1

[Command]
name = "z2"
command = z
time = 1

[Command]
name = "start2"
command = s
time = 1

[Command]
name = "holdfwd2"
command = /$F
time = 1

[Command]
name = "holdback2"
command = /$B
time = 1

[Command]
name = "holdup2"
command = /$U
time = 1

[Command]
name = "holddown2"
command = /$D
time = 1

[Command]
name = "holda2"
command = /a
time = 1

[Command]
name = "holdb2"
command = /b
time = 1

[Command]
name = "holdc2"
command = /c
time = 1

[Command]
name = "holdx2"
command = /x
time = 1

[Command]
name = "holdy2"
command = /y
time = 1

[Command]
name = "holdz2"
command = /z
time = 1

[Command]
name = "holdstart2"
command = /s
time = 1

[Command]
name = "recovery2"
command = x+y
time = 1

; Here add matching commands for any moves that must never be used randomly
; by the computer, such as suicide moves and super moves, and add the pairs
; to the XOR varSet controller in State -3.

[Command]
name = "hyperpoly2"
command = ~D, DF, F, z
time = 1

[Command]
name = "kooparush2"
command = ~D, DF, F, y
time = 1

[Command]
name = "switch2"
command = ~D, DF, F, x
time = 1

[Command]
name = "hyperbeam2"
command = a+b+c
time = 1

[Command]
name = "beatup2"
command = x+y+z
time = 1

[Command]
name = "invin2"
command = ~D, DB, B, z
time = 1

[Command]
name = "kefka2"
command = ~D, DF, F, z+y
time = 1

[Command]
name = "ultima2"
command = ~D, DB, B, ~D, DB, B, x
time = 1

[Command]
name = "stopspell2"
command = ~D, DB, B, ~D, DB, B, y
time = 1

[command]
name = "merton2"
command = ~D, DB, B, ~D, DB, B, z
time = 1

[Command]
name = "wincrash2"
command = ~D, DB, B, x+y
time = 1

;-| Fatality Motions |-----------------------------------------------------
[Command]
name = "bigswitch"
command = a, a, D, b
time = 45
; Command for Kamek's Monstrous Switchblock Fatality.
; A giant switchblock falls on the enemy, crushing them.

[Command]
name = "bgfatal"
command = D, D, D, b
time = 45
; Command for Kamek's Background Fatality.
; Knocks the enemy into the background and they disappear.
; REMOVED. DOES NOT WORK.

[Command]
name = "bomb"
command = F, F, D, a
time = 45
; Command for Kamek's "Blow up the world" Fatality.
; Many Bob-Ombs drop onto the screen, and the world explodes.

[Command]
name = "friendship"
command = B, F, a
time = 45

[Command]
name = "humiliate"
command = a, D, D, y+z
time = 60

;-| Super Motions |--------------------------------------------------------
[Command]
name = "hyperpoly"
command = ~D, DF, F, z
time = 30
; Hyper Polygon Attack

[Command]
name = "kooparush"
command = ~D, DF, F, y
time = 30
; Troopa Rush attack

[Command]
name = "switch"
command = ~D, DF, F, x
time = 30
; Hyper Switchblock Attack

[Command]
name = "hyperbeam"
command = a+b+c
; Double Hyper Beam

;[Command]
;name = "drainbeam"
;command = ~D, DF, F, a+b+c

[Command]
name = "beatup"
command = x+y+z
; Beat Up

[Command]
name = "invin"
command = ~D, DB, B, z
;time = 9999
; Invincibility!

[Command]
name = "kefka"
command = ~D, DF, F, z+y
time = 30

[Command]
name = "ultima"
command = ~D, DB, B, ~D, DB, B, x
time = 80

[Command]
name = "stopspell"
command = ~D, DB, B, ~D, DB, B, y
time = 80

[command]
name = "merton"
command = ~D, DB, B, ~D, DB, B, z
time = 80

[Command]
name = "wincrash"
command = ~D, DB, B, x+y
time = 30
; Kamek's WinCrash -- Fakes a Windows crash.
; Loads of fun! Everyone falls down!

;[Command]
;name = "hiddenpower"
;command = ~D, DB, B, z
;time = 30
; Hidden Power attack.
; Who knows what you'll get?
; Note: Not implemented, probably never will be.

;-| Special Motions |------------------------------------------------------
[Command]
name = "QCF_y"
command = ~D, DF, F, y
; QCF+y

[Command]
name = "LitBolt"
command = ~D, DF, F, a
; Lightning Bolt attack

;[Command]
;name = "AALitBolt"
;command = ~D, DB, B, a
;; Anti-Air Lightning Bolt

;[Command]
;name = "IceBeam"
;command = ~D, DF, F, b
;; Ice Beam

[Command]
name = "AAIceBeam"
command = ~D, DB, B, b
; Anti-Air Ice Beam

[Command]
name = "FireBlast"
command = ~D, DF, F, c
; Kamek's Fire Blast

[Command]
name = "koopamagic"
command = ~D, DF, F, b

;[Command]
;name = "koopamagic"
;command = ~30B, F, c

;[Command]
;name = "koopamagic"
;command = ~30B, F, b

;[Command]
;name = "koopamagic"
;command = ~30B, F, a

[Command]
name = "toadie"
command = ~D, DB, B, a

[Command]
name = "counter_a"
command = ~B, DB, D, a

[Command]
name = "counter_b"
command = ~B, DB, D, b

[Command]
name = "counter_c"
command = ~B, DB, D, c

[Command]
name = "bobomb"
command = ~D, DB, B, c

[Command]
name = "TPort_X"
command = D, D, x
time = 30
; The various teleport commands.

[Command]
name = "TPort_Y"
command = D, D, y
time = 30

[Command]
name = "TPort_Z"
command = D, D, z
time = 30

[Command]
name = "TPort_A"
command = D, D, a
time = 30

[Command]
name = "TPort_B"
command = D, D, b
time = 30

[Command]
name = "TPort_C"
command = D, D, c
time = 30

;-| Strikers/Assists |-----------------------------------------------------
;[Command]
;name = "Tron"
;command = x+y
; Tron Bonne Summon
; Abandoned in place

[Command]
name = "Umbreon"
command = x+a
; Umbreon assist. Umbreon uses Body Slam

[Command]
name = "Eefi"
command = y+b
; Espeon assist. Espeon uses Psybeam

[Command]
name = "DarkButterfree"
command = z+c
; Dark Butterfree assist. Butterfree uses Stun Spore

[Command]
name = "Bowser"
command = a+b
; Bowser Assist. Bowser rams the enemy ALA Colossus

;-| Pushblock |------------------------------------------------------------
[Command]
name = "pushblock1"
command = b+c

[Command]
name = "pushblock2"
command = a+c

[Command]
name = "pushblock3"
command = y+z

[Command]
name = "pushblock4"
command = x+z

;-| Double Tap |-----------------------------------------------------------
[Command]
name = "FF"     ;Required (do not remove)
command = F, F
time = 10
; Dash Forward

[Command]
name = "BB"     ;Required (do not remove)
command = B, B
time = 10
; BackDash

;-| 2/3 Button Combination |-----------------------------------------------
[Command]
name = "recovery"
command = x+y
time = 1
; Recover

;-| Dir + Button |---------------------------------------------------------
[Command]
name = "down_a"
command = /$D,a
time = 1

[Command]
name = "down_b"
command = /$D,b
time = 1

[Command]
name = "down_c"
command = /$D,c
time = 1

;-| AI Activators |---------------------------------------------------------
;[Command]
;name = "TurnOnAI1"
;command = U,D,U,D,U,D,U,D
;time = 1
;
;[Command]
;name = "TurnOnAI2"
;command = U,D,U,D,U,D,D,D
;time = 1
;
;[Command]
;name = "TurnOnAI3"
;command = U,D,U,D,U,D,D,U
;time = 1
;
;[Command]
;name = "TurnOnAI4"
;command = U,D,U,D,U,D,U,U
;time = 1
;
;[Command]
;name = "TurnOnAI5"
;command = a,a,a,a,a,a,a,a,a
;time = 1
;
;[Command]
;name = "TurnOnAI6"
;command = a+b+c+x+y+z+U+D
;time = 1
;
;[Command]
;name = "TurnOnAI7"
;command = a,b,c,z,y,x
;time = 1
;
;[Command]
;name = "TurnOnAI8"
;command = s,s,s,s,s,s,s,s
;time = 1
;
;[Command]
;name = "TurnOnAI1a"
;command = D,D,U,D,U,D,U,D
;time = 1
;
;[Command]
;name = "TurnOnAI2a"
;command = D,D,U,D,U,D,D,D
;time = 1
;
;[Command]
;name = "TurnOnAI3a"
;command = D,D,U,D,U,D,D,U
;time = 1
;
;[Command]
;name = "TurnOnAI4a"
;command = D,D,U,D,U,D,U,U
;time = 1
;
;[Command]
;name = "TurnOnAI5a"
;command = D,a,a,a,a,a,a,a,a
;time = 1
;
;[Command]
;name = "TurnOnAI6a"
;command = D+b+c+x+y+z+U+D
;time = 1
;
;[Command]
;name = "TurnOnAI7a"
;command = D,b,c,z,y,x
;time = 1
;
;[Command]
;name = "TurnOnAI8a"
;command = D,s,s,s,s,s,s,s
;time = 1
;
;[Command]
;name = "TurnOnAI9"
;command = a,a,a,a,a,a,a,a
;time = 1
;
;[Command]
;name = "TurnOnAI10"
;command = b,b,b,b,b,b,b,b
;time = 1
;
;[Command]
;name = "TurnOnAI11"
;command = c,c,c,c,c,c,c,c
;time = 1
;
;[Command]
;name = "TurnOnAI12"
;command = x,x,x,x,x,x,x,x
;time = 1
;
;[Command]
;name = "TurnOnAI13"
;command = y,y,y,y,y,y,y,y
;time = 1
;
;[Command]
;name = "TurnOnAI14"
;command = z,z,z,z,z,z,z,z
;time = 1
;
;[Command]
;name = "TurnOnAI15"
;command = U,U,U,U,U,U,U,U
;time = 1
;
;[Command]
;name = "TurnOnAI16"
;command = D,D,D,D,D,D,D,D
;time = 1
;
;[Command]
;name = "TurnOnAI17"
;command = F,F,F,F,F,F,F,F
;time = 1
;
;[Command]
;name = "TurnOnAI18"
;command = B,B,B,B,B,B,B,B
;time = 1

; Super Jump
[Command]
name = "superjump"
command = ~$D, $U
time = 10
; Kamek's Super Jump

;---------------------------------------------------------------------------
; 2. State entry
; --------------
; This is where you define what commands bring you to what states.
;
; Each state entry block looks like:
;   [State -1, Label]           ;Change Label to any name you want to use to
;                               ;identify the state with.
;   type = ChangeState          ;Don't change this
;   value = new_state_number
;   trigger1 = command = command_name
;   . . .  (any additional triggers)
;
; - new_state_number is the number of the state to change to
; - command_name is the name of the command (from the section above)
; - Useful triggers to know:
;   - statetype
;       S, C or A : current state-type of player (stand, crouch, air)
;   - ctrl
;       0 or 1 : 1 if player has control. Unless "interrupting" another
;                move, you'll want ctrl = 1
;   - stateno
;       number of state player is in - useful for "move interrupts"
;   - movecontact
;       0 or 1 : 1 if player's last attack touched the opponent
;                useful for "move interrupts"
;
; Note: The order of state entry is important.
;   State entry with a certain command must come before another state
;   entry with a command that is the subset of the first.
;   For example, command "fwd_a" must be listed before "a", and
;   "fwd_ab" should come before both of the others.
;
; For reference on triggers, see CNS documentation.
;
; Just for your information (skip if you're not interested):
; This part is an extension of the CNS. "State -1" is a special state
; that is executed once every game-tick, regardless of what other state
; you are in.


; Don't remove the following line. It's required by the CMD standard.
[Statedef -1]

; The main purpose of having these next two controllers here at the top of
; StateDef -1 is to make sure the AI helper never changes to a different state,
; but they also improve efficiency by preventing Mugen from wasting time
; processing the entire State -1 for the helper.
[State -1, AI Helper Check]
type = ChangeState
trigger1 = IsHelper(9741)
value = 9741

[State -1, AI Helper Check 2]
type = ChangeState
trigger1 = IsHelper(9742)
value = 9742

;===========================================================================
;===========================================================================
;===========================================================================
;AI directives
;===========================================================================
;===========================================================================
;===========================================================================

;OK to hit Psycho Shredder?
[State -1: Reset Red Glow Var]
type = VarSet
trigger1 = var(39)
var(39) = 0

[State -1: Check for Red Glow - Enemy 0]
type = VarSet
triggerall = enemy(0), Name = "Psycho Shredder[S]" || enemy(0), Name = "Psycho Shredder [S]"
trigger1 = enemy(0), Var(1) > 0
var(39) = 1 ;red glow present, do not attack

[State -1: Check for Red Glow - Enemy 1]
type = VarSet
triggerall = NumEnemy > 1
triggerall = enemy(1), Name = "Psycho Shredder[S]" || enemy(1), Name = "Psycho Shredder [S]"
trigger1 = enemy(1), Var(1) > 0
var(39) = 1 ;red glow present, do not attack

;AI Invincibility if we have more power than we know what to do with
[State -1, AI Invin]
type = ChangeState
value = 3600
triggerall = var(59) > 0
triggerall = power > 9000
triggerall = var(30) = 0
triggerall = RoundState = 2
triggerall = Var(46) < 4
trigger1 = Ctrl
trigger1 = Statetype != A

;AI Heal
[State -1, AI Heal]
type = ChangeState
value = 2001
triggerall = var(46) = 6
triggerall = Life < LifeMax/2
triggerall = statetype != A
triggerall = var(59) > 0
triggerall = P2Life > 0
triggerall = P2StateNo != 10700
trigger1 = Ctrl

;==========
;OTG COMBOS
;==========
[State -3, OTG]
type = ChangeState
value = 20
ctrl = 1
triggerall = var(46) < 6
triggerall = var(59) > 0
triggerall = ctrl
triggerall = StateType != A
trigger1 = P2StateNo = [5000,5110]
trigger1 = P2Dist X > 40
trigger1 = P2Dist X < 100
trigger1 = enemyNear, gethitvar(fall.damage) = 0
trigger1 = enemyNear, Life > 1

[State -3, Ground Block Low]
type = ChangeState
triggerall = var(46) = [1, 3]
triggerall = InGuardDist
triggerall = var(59) > 0
triggerall = MatchOver = 0
triggerall = statetype != A
triggerall = ctrl = 1
triggerall = var(57) >= var(58)
triggerall = NumHelper(1300) = 0
trigger1 = Random <= 750
trigger1 = P2bodydist X <= 120
trigger1 = enemyNear, MoveType = A
trigger1 = enemyNear, Facing != Facing
trigger2 = enemy, numproj > 0
trigger2 = Random <= 750
trigger3 = enemynear, hitdefattr = A, HA
trigger3 = Random <= 900
trigger4 = enemynear, hitdefattr = S, HA
trigger4 = Random <= 900
trigger5 = enemynear, hitdefattr = C, HA
trigger5 = Random <= 900
value = 131

[State -3, Ground Block High]
type = ChangeState
triggerall = var(46) = [1, 3]
triggerall = InGuardDist
triggerall = var(59) > 0
triggerall = MatchOver = 0
triggerall = statetype != A
triggerall = ctrl = 1
triggerall = NumHelper(1300) = 0
trigger1 = P2bodydist X <= 120
trigger1 = enemyNear, MoveType = A
trigger1 = enemyNear, Facing != Facing
trigger1 = var(57) < var(58)
trigger2 = enemy, numproj > 0
trigger2 = Random <= 750
trigger3 = enemynear, hitdefattr = A, HA
trigger3 = Random <= 900
trigger4 = enemynear, hitdefattr = S, HA
trigger4 = Random <= 900
trigger5 = enemynear, hitdefattr = C, HA
trigger5 = Random <= 900
value = 130

[State -3, Air Block]
type = ChangeState
triggerall = var(46) = [1, 3]
triggerall = InGuardDist
triggerall = var(59) > 0
triggerall = MatchOver = 0
triggerall = statetype = A
triggerall = ctrl = 1
triggerall = stateno != 132
triggerall = NumHelper(1300) = 0
trigger1 = P2bodydist X <= 120
trigger1 = Random <= 750
trigger1 = enemyNear, MoveType = A
trigger1 = enemyNear, Facing != Facing
trigger2 = enemy, numproj > 0
trigger2 = Random <= 750
trigger3 = enemynear, hitdefattr = A, HA
trigger3 = Random <= 900
trigger4 = enemynear, hitdefattr = S, HA
trigger4 = Random <= 900
trigger5 = enemynear, hitdefattr = C, HA
trigger5 = Random <= 900
value = 132

;==============================================================================
;AI Humiliation -- CPU rubs the enemy's face in it!
;==============================================================================
[State -1, AI Humiliate]
type = ChangeState
value = 10920
triggerall = ctrl
trigger1 = Life = LifeMax
trigger1 = var(59) > 0
trigger1 = p2stateno = 10700
trigger1 = Enemy, Time > 100
trigger1 = statetype != A
;trigger1 = stateno < 10000
trigger1 = p2life < 5
trigger1 = var(10) != 1

;==============================================================================
;AI chooses which fatality to use.
;==============================================================================
[State -1, AI Choose Fatality]
type = varRandom
triggerall = var(59) > 0
triggerall = ctrl
trigger1 = var(59) > 0
trigger1 = p2stateno = 10700
trigger1 = Enemy, Time > 100
trigger1 = statetype != A
;trigger1 = stateno = [200,10000]
trigger1 = p2life < 5
trigger1 = var(10) != 1
v = 23
range = 1,3

;==============================================================================
;AI drops a Giant Switchblock fatality.
;==============================================================================
[State -1, AI Big Switch]
type = ChangeState
value = 10800
triggerall = var(59) > 0
triggerall = ctrl
trigger1 = var(59) > 0
trigger1 = p2stateno = 10700
trigger1 = Enemy, Time > 100
trigger1 = statetype != A
;trigger1 = stateno = [200, 10000]
trigger1 = var(10) != 1
trigger1 = var(23) = 1

;==============================================================================
;AI summons Umbreon to slice them up.
;==============================================================================
;AI Umbreon Slice
[State -1, UmbSlice]
Type = ChangeState
value = 2529
triggerall = var(59) > 0
triggerall = ctrl
trigger1 = var(59) > 0
trigger1 = p2stateno = 10700
trigger1 = Enemy, Time > 100
trigger1 = statetype != A
;trigger1 = stateno < 10000
trigger1 = var(10) != 1
trigger1 = var(23) = 2
trigger1 = var(41) > 0

;==============================================================================
;AI blows up the world.
;==============================================================================
[State -1, AI Someone Set Up Us The Bomb]
type = ChangeState
value = 10950
triggerall = ctrl
triggerall = var(59) > 0
trigger1 = p2stateno = 10700
trigger1 = Enemy, Time > 100
trigger1 = statetype != A
;trigger1 = stateno < 10000
trigger1 = var(10) != 1
trigger1 = var(59) > 0
trigger1 = var(23) = 3

;==============================================================================
; AI will sometimes chain combo into Beat Up.
;==============================================================================
;AI Beat Up
[State -1, Beat Up]
type = ChangeState
value = 4000
triggerall = var(46) < 6
triggerall = var(59) > 0
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = Statetype != A
triggerall = NumHelper(2500) = 0
triggerall = NumHelper(2510) = 0
triggerall = NumHelper(2520) = 0
triggerall = NumHelper(2530) = 0
triggerall = NumHelper(2540) = 0
Triggerall = P2Dist X < 50
Triggerall = P2Dist Y < 50
triggerall = (Power != [5000,6999]) || (NumPartner > 1)
triggerall = !enemyNear, HitFall
;Three PKMN
trigger1 = (Ctrl) || (Stateno = [200,3000))
trigger1 = var(40) > 0
trigger1 = var(41) > 0
trigger1 = var(42) > 0
trigger1 = Power >= 3000
trigger1 = (Stateno = 210 && MoveHit) || (Stateno = 410 && MoveHit) || (var(46) && MoveHit && StateNo != 1000)
;Two PKMN
trigger2 = (Ctrl) || (Stateno = [200,3000))
trigger2 = (var(40)>0 && var(41)>0 && var(42)<=0) || (var(40)>0 && var(42)>0 && var(41)<=0) || (var(41)>0 && var(42)>0 && var(40)<=0)
trigger2 = Power >= 2000
trigger2 = (Stateno = 210 && MoveHit) || (Stateno = 410 && MoveHit) || (var(46) && MoveHit && StateNo != 1000)

;AI Ultima
[State -1, Ultima]
type = ChangeState
value = 3800
triggerall = power >= 5000
triggerall = var(59) > 0
triggerall = Ctrl
triggerall = statetype = S
triggerall = var(46) < 5
; Cheapass AI uses Ultima if enemy is stunned.
trigger1 = enemy, movetype = H
trigger1 = enemy, stateno = 2593
trigger1 = enemy, time <= 25
trigger2 = enemy, stateno = 2220
; Also use Ultima if our partner is laying down some kind of assrape.
trigger2 = NumPartner > 0
;trigger2 = Partner, MoveType = A
trigger2 = enemy(1), MoveType = H
trigger2 = NumEnemy = 1 || enemy(2), MoveType = H
; Preferably from far away.
;trigger3 = abs(enemyNear, Pos X - Pos X) > 120 || enemyNear, HitFall
; Also if we're invincible
trigger3 = Power >= 7000
trigger3 = var(30) = 1

;==============================================================================
;AI will use Hyper/Drain Beam
;==============================================================================
[State -1, AI Hyperbeam]
type = ChangeState
;value = ifelse((enemy,power < 3000), 3400, 4100)
value = 3400 ;Drain Beam was canned
triggerall = var(46) < 6
triggerall = power >= 2000
triggerall = statetype != A
triggerall = NumHelper(2540) = 0
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = (Power != [5000,6999]) || (NumPartner > 1)
triggerall = NumPartner = 0 || (Partner, Pos X < Pos X && Facing = 1) || (Partner, Pos X > Pos X && Facing = -1)
;triggerall = (P2Life > 204) || (Life < 200)
;triggerall = enemy, power < 3000
; AI combos this off the Launcher
trigger1 = MoveHit
trigger1 = stateno = 410
; AI will also throw this out if enemy is under seige by Espeon
trigger2 = enemy, movetype = H
trigger2 = enemy, stateno != [130, 139] ; Not if blocking
trigger2 = NumHelper(2515) > 0
trigger2 = (var(40) >= 600) || ifelse(Facing=1, (Helper(2515), Pos X < Pos X), (Helper(2515), Pos X > Pos X)) ; Prevents Espeon from being killed
trigger2 = stateno < 3000
trigger2 = stateno != [120,155]
; Or immediately after a Troopa Rush
trigger3 = prevstateno = 3200
trigger3 = enemy, movetype = H
trigger3 = stateno < 3000
trigger3 = stateno != [120,155]
; Or if stunned by Dark Butterfree
trigger4 = enemy, movetype = H
trigger4 = enemy, stateno = 2593
trigger4 = enemy, time <= 100
; But not if we'd rather switchblock 'em
trigger4 = enemy, time > IfElse(var(46),50,70)
trigger4 = var(42) >= 450
trigger4 = stateno < 3000
trigger4 = stateno != [120,155]
; If stunned by Dark Butterfree and DB can't survive a DHB, wait for DB to go away.
trigger5 = enemy, movetype = H
trigger5 = enemy, stateno = 2593
trigger5 = enemy, time <= 70
trigger5 = NumHelper(2530) = 0
trigger5 = stateno < 3000
trigger5 = stateno != [120,155]
; Or from the Fire Blast
trigger6 = MoveHit
trigger6 = stateno = 1200
trigger6 = Time >= 50
; Or if they're attacking the wrong way
trigger7 = enemynear, statetype = A
trigger7 = enemynear, facing = facing
trigger7 = enemynear, AnimTime > 20
trigger7 = ifelse(facing=1, (enemynear, pos X > pos X), (enemynear, pos X < pos X))
trigger7 = ctrl || (MoveHit && StateNo < 3000 && StateNo != 1000)
trigger7 = stateno != [120,155]
;trigger7 = stateno < 3000
; Or after a successful Lightning Bolt
trigger8 = StateNo = 1001
Trigger8 = MoveHit
; DHC into DHB from Troopa Rush or Hyper Polygon Attack
trigger9 = var(31) < 3
trigger9 = stateno = 3200
trigger9 = time >= 200
trigger9 = enemyNear, MoveType = H
trigger9 = enemyNear, Stateno != [120,155]
trigger9 = enemyNear, Life > 150
trigger10 = var(31) < 3
trigger10 = stateno = 3000
trigger10 = enemyNear, MoveType = H
trigger10 = enemyNear, Stateno != [120,155]
trigger10 = Time >= 80
trigger10 = enemyNear, Life > 150

;==============================================================================
;AI will chain into the Hyper Polygon Attack to end a long air combo
;==============================================================================
[State -1, AI Hyper Polygon Attack Air]
Type = ChangeState
Value = 3100
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
Triggerall = var(59) > 0
triggerall = statetype = A
triggerall = power >= 1000
triggerall = (Power != [5000,6999]) || (NumPartner > 1)
trigger1 = MoveHit
trigger1 = stateno = 610
trigger1 = (var(17) >= 10) || (var(46))
; DHC into a Hyper Polygon from a DHB
trigger2 = var(31) < 3
trigger2 = stateno = 3400
trigger2 = Time >= 100
trigger2 = enemyNear, MoveType = H
trigger2 = enemyNear, Stateno != [120,155]
trigger2 = P2Dist X < 100 || (var(46))
trigger2 = P2Dist Y < 80 || (var(46))
trigger2 = EnemyNear, Life > 100

;==============================================================================
;AI will chain into the Hyper Polygon Attack to finish off the opponent
;==============================================================================
[State -1, AI Hyper Polygon Attack Air]
Type = ChangeState
Value = 3100
triggerall = var(46) < 6
Triggerall = (power >= 2000) || (power >= 1000 && p2life < 150)
triggerall = p2stateno < 10700 || P2StateNo > 10704
Triggerall = var(59) > 0
triggerall = (P2Life > 50) || (Life < 200)
triggerall = statetype = A
triggerall = (Power != [5000,6999]) || (NumPartner > 1)
trigger1 = MoveHit
trigger1 = stateno = 610
trigger2 = MoveHit
trigger2 = stateno = 2115
trigger3 = MoveHit
trigger3 = stateno = 2215

;==============================================================================
;Troopa Rush (AI-link)
;==============================================================================
[State -1, Hyper AI Rush]
type = Changestate
value = 3200
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = (P2Dist X <= 53) && (P2Dist Y >= -56)
triggerall = (P2Life > 100) || (Life < 200)
triggerall = (Power != [5000,6999]) || (NumPartner > 1)
triggerall = !(enemyNear, HitFall)
trigger1 = MoveHit
trigger1 = stateno = 210
trigger1 = var(1) = 0
trigger1 = (power >= 2000) || (power >= 1000 && p2life <= 292)
trigger2 = enemyNear, MoveType = H ;can't check for MoveHit since the helper does the hit
trigger2 = stateno = 1110
trigger2 = time >= 14
trigger2 = (power >= 2000) || (power >= 1000 && var(24) = 1)
trigger3 = MoveHit
trigger3 = stateno = 1200
trigger3 = Time >= 50
trigger3 = (power >= 2000) || (power >= 1000 && p2life <= 292)

;==============================================================================
;AI Switch
;==============================================================================
[State -1, AI Switch]
type = ChangeState
value = 3300
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = Statetype != A
triggerall = power >= 1000
triggerall = ctrl
triggerall = (Power != [5000,6999]) || (NumPartner > 1)
trigger1 = enemy, movetype = H
trigger1 = enemy, stateno = 2593
trigger1 = enemy, time <= IfElse(var(46),50,70)
trigger1 = (Power != [5000,6999]) || (enemy, time > 25)
;trigger2 = enemy, stateno = 2220

;==============================================================================
;AI Hyper Polygon Attack (Standing)
;==============================================================================
[State -1, AI Hyper Polygon Attack]
Type = ChangeState
Value = 3000
triggerall = var(46) < 6
Triggerall = StateType != A
Triggerall = NumHelper(3000) = 0
Triggerall = power >= 1000
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
Triggerall = MoveHit || var(3)
triggerall = stateno < 3000 && Stateno != 1000
triggerall = stateno != [120,155]
triggerall = (Power != [5000,6999]) || (NumPartner > 1)
trigger1 = P2Life <= 100
trigger1 = P2Life > 30
trigger2 = var(46)
trigger2 = Power < 3000 || NumPartner > 1
trigger2 = Random <= 64
trigger2 = (StateNo = 210 && MoveHit) || (StateNo = 1100 && MoveHit) || (StateNo = 1200 && MoveHit)
; DHC from the Troopa Rush if not enough power to use DHB.
trigger3 = var(31) < 3
trigger3 = stateno = 3200
trigger3 = time >= 200
trigger3 = enemyNear, MoveType = H
trigger3 = enemyNear, Stateno != [120,155]
; Random spamming
trigger4 = P2Dist X > 140
trigger4 = Ctrl
trigger4 = Power >= 2000
trigger4 = Random = [1,3]

; AI Koopa Magic
[State -1, AI Koopa Magic]
type = Changestate
value = 2200
triggerall = var(46) < 6
triggerall = statetype != A
triggerall = var(59) > 0
triggerall = EnemyNear, Pos Y < 30
triggerall = NumEnemy = 1
triggerall = NumHelper(2200) = 0
triggerall = (var(46) || Power >= 5000)
triggerall = NumHelper(10600) = 0
trigger1 = Ctrl
trigger1 = P2Dist X > 100
trigger1 = Random <= 16
;trigger2 = MoveHit
;trigger2 = StateNo < 1000
;trigger2 = Random <= 32
;trigger2 = stateno != [120,155]

;AI Combo Finisher
[State -1, AI Combo Finisher]
Type = varRandom
triggerall = var(46) < 6
Triggerall = var(59) > 0
trigger1 = MoveContact
trigger1 = stateno = 610
v = 6
range = 1,4

;AI Airbolt
[State -1, AI Airbolt]
type = Changestate
value = 2015
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
Triggerall = var(59) > 0
trigger1 = MoveContact
trigger1 = stateno = 610
trigger1 = var(6) = 1
trigger1 = !var(46)
Trigger1 = 0
trigger2 = MoveContact ;|| helper, MoveContact
Trigger2 = StateNo = 2215
Trigger2 = var(46)

;AI Bolt
[State -1, AI Bolt]
Type = ChangeState
Value = 1000
triggerall = var(46) < 6
Triggerall = statetype != A
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = EnemyNear, Pos Y < 30
Trigger1 = Ctrl
Trigger1 = Power < 2000
trigger1 = enemynear, statetype = A
trigger1 = enemynear, facing = facing
trigger1 = ifelse(facing=1, (enemynear, pos X < pos X), (enemynear, pos X > pos X))

;AI AntiBolt
[State -1, AntiBolt]
Type = ChangeState
;value = 2005
value = 2100
triggerall = var(46) < 6
triggerall = statetype != A
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = !(enemyNear, HitFall)
trigger1 = Ctrl
trigger1 = P2MoveType = A
trigger1 = P2StateType = A
trigger1 = Abs(P2Dist X - P2Dist Y) < 100
trigger1 = P2Dist X < 200
trigger1 = P2Dist Y < 150

;AI Tornado
[State -1, AI Tornado 2]
Type = ChangeState
value = 2100
triggerall = var(46) < 6
triggerall = statetype != A
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = !(enemyNear, HitFall)
trigger1 = Ctrl
trigger1 = P2MoveType = A
trigger1 = P2StateType = A
trigger1 = Abs(P2Dist X - P2Dist Y) < 100
trigger1 = P2Dist X < 200
trigger1 = P2Dist Y >= 150

;AI Airbeam
[State -1, AI Airbeam]
type = Changestate
value = 2115
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
Triggerall = var(59) > 0
triggerall = StateType = A
triggerall = Time > 30
trigger1 = MoveContact
trigger1 = stateno = 610
trigger1 = var(6) = 2
trigger2 = MoveContact ;|| helper, MoveContact
trigger2 = stateno = 610
trigger2 = var(46)
trigger3 = Ctrl
trigger3 = Random < 128
trigger3 = Time < 60
trigger3 = PrevStateNo != 2115
trigger3 = enemyNear, MoveType != H
trigger3 = ((Pos X - enemyNear, Pos X) && (Facing = -1)) || ((Pos X - enemyNear, Pos X) && (Facing = 1))
trigger3 = abs(Pos Y - enemyNear, Pos Y) < 20

;AI Toadie
[State -1, AI Toadie]
type = ChangeState
value = 1300
triggerall = var(46) < 6
Triggerall = StateType != A
Triggerall = var(59) > 0
triggerall = NumHelper(1300) < ifelse(Name = "Hyper Neo-Kamek" || var(46) >= 3,4,1)
triggerall = P2Dist X > 100
trigger1 = Ctrl
trigger1 = (EnemyNear, MoveType = I) || (EnemyNear, MoveType = H)
trigger1 = NumHelper(1300) = 0
trigger1 = Random <= 8
trigger2 = Ctrl
trigger2 = var(46)
trigger2 = Random <= 64

;AI Bob-Omb
[State -1, AI Bomber]
type = ChangeState
value = 1400
triggerall = var(46) < 6
triggerall = !var(39)
Triggerall = StateType != A
Triggerall = var(59) > 0
triggerall = NumHelper(1400) < ifelse(Name = "Hyper Neo-Kamek" || var(46) >= 3,4,1)
triggerall = P2Dist X > 100
trigger1 = Ctrl
trigger1 = (EnemyNear, MoveType = I) || (EnemyNear, MoveType = H)
trigger1 = NumHelper(1400) = 0
trigger1 = Random <= 4
trigger2 = Ctrl
trigger2 = var(46)
trigger2 = Random <= 32

[State -1, Ice or Lightning?]
Type = varRandom
triggerall = var(46) < 6
TriggerAll = var(59) > 0
TriggerAll = !MoveContact
Trigger1 = StateNo != 610
v = 6
range = 1,2

;AI throws Ice Beams randomly
[State -1, AI Ice Beam]
Type = ChangeState
value = 1100
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = StateType !=A
TriggerAll = var(59) > 0
TriggerAll = (var(6) = 1 || P2Dist X > 250 || NumHelper(2520) > 0 || var(46) = 6)
triggerall = !Var(39)
triggerall = EnemyNear, Pos Y < 30
triggerall = Name = "Hyper Neo-Kamek"
triggerall = !(enemyNear, HitFall)
triggerall = NumHelper(2531) = 0 ;Not if we're trying to Stun Spore
triggerall = (NumHelper(2800) = 0) || (Helper(2800), StateNo = [2810, 2820]) ;Not if Umbreon is attacking
;triggerall = 0 ;DEBUGDEBUG
Trigger1 = Ctrl
Trigger1 = P2Dist X >= IfElse(Name = "Hyper Neo-Kamek",80,160)
Trigger1 = Random <= IfElse(Name = "Hyper Neo-Kamek",256,16)
Trigger2 = Ctrl
Trigger2 = P2Dist X >= IfElse(Name = "Hyper Neo-Kamek",80,160)
Trigger2 = P2MoveType = A
Trigger2 = Random <= IfElse(Name = "Hyper Neo-Kamek",512,32)

;AI throws Bolts randomly
[State -1, AI Bolt Again]
Type = ChangeState
value = 1000
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = StateType !=A
TriggerAll = var(59) > 0
TriggerAll = (var(6) = 2 && P2Dist X <= 250 && NumHelper(2520) = 0)
triggerall = EnemyNear, Pos Y < 30
triggerall = !(enemyNear, HitFall)
triggerall = NumHelper(2531) = 0 ;Not if we're trying to Stun Spore
triggerall = (NumHelper(2800) = 0) || (Helper(2800), StateNo = [2810, 2820]) ;Not if Umbreon is attacking
;triggerall = 0 ;DEBUGDEBUG
Trigger1 = Ctrl
Trigger1 = P2Dist X >= IfElse(Name = "Hyper Neo-Kamek",80,160)
Trigger1 = Random <= IfElse(Name = "Hyper Neo-Kamek",256,16)
Trigger2 = Ctrl
Trigger2 = P2Dist X >= IfElse(Name = "Hyper Neo-Kamek",80,160)
Trigger2 = P2MoveType = A
Trigger2 = Random <= IfElse(Name = "Hyper Neo-Kamek",512,32)

;AI Random Fire Blast
[State -1, Fire Blast]
Type = ChangeState
Value = 1200
triggerall = var(46) < 6
Triggerall = statetype != A
triggerall = var(59) > 0
Trigger1 = Ctrl
trigger1 = P2Dist X = [40, 80]
trigger1 = Random < 6
trigger1 = enemyNear, MoveType != A
trigger1 = !enemyNear, HitFall

;AI Airblast
[State -1, AI Airblast]
type = Changestate
value = 2215
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
Triggerall = var(59) > 0
trigger1 = MoveContact ;|| helper, MoveContact
trigger1 = stateno = IfElse(Name="Hyper Neo-Kamek",2115, 610)
trigger1 = (var(6) = 3) || (Name = "Hyper Neo-Kamek")

[State -1, AI Teleport In After Successful Dark Butterfree Assist]
type = varSet
value = 6
v = 26
trigger1 = var(59) > 0
trigger1 = P2StateNo = 2593
trigger1 = P2MoveType = H
trigger1 = Power < 2000

[State -1, AI Teleport]
type = ChangeState
value = 2600
triggerall = Ctrl
triggerall = StateType != A
triggerall = var(59) > 0
trigger1 = P2BodyDist X > 40
trigger1 = P2MoveType = H
trigger1 = P2StateNo = 2593
;trigger2 = P2MoveType = H
;trigger2 = P2Dist X + Pos X > 100
;trigger2 = Pos X < 100
;trigger2 = var(59) > 0

;[State -1, AI Teleport To ???]
;type = varSet
;var(26) = 3
;trigger1 = P2StateType = A
;trigger1 = P2MoveType = H
;trigger1 = P2Dist X + Pos X > 100
;trigger1 = Pos X < 100
;trigger1 = var(59) > 0

[State -1, Get Away From Own Bomb]
triggerall = var(59) > 0
trigger1 = NumHelper(1400) > 0
trigger1 = Helper(1400), StateNo = 1402
trigger1 = abs(Pos X - Helper(1400), Pos X) < 50
trigger1 = facing = 1
trigger2 = NumHelper(3300) > 0
trigger2 = Helper(3300), StateNo = 3342
trigger2 = abs(Pos X - Helper(3300), Pos X) < 50
trigger2 = facing = 1
type = varSet
var(26) = (IfElse(ScreenPos X < 160, 4, 1))

[State -1, Get Away From Own Bomb]
triggerall = var(59) > 0
trigger1 = NumHelper(1400) > 0
trigger1 = Helper(1400), StateNo = 1402
trigger1 = abs(Pos X - Helper(1400), Pos X) < 50
trigger1 = facing = -1
trigger2 = NumHelper(3300) > 0
trigger2 = Helper(3300), StateNo = 3342
trigger2 = abs(Pos X - Helper(3300), Pos X) < 50
trigger2 = facing = -1
type = varSet
var(26) = (IfElse(ScreenPos X < 160, 1, 4))

[State -1, Get Away From Own Bomb]
type = ChangeState
value = 2600
triggerall = Ctrl
triggerall = StateType != A
triggerall = var(59) > 0
trigger1 = NumHelper(1400) > 0
trigger1 = Helper(1400), StateNo = 1402
trigger1 = abs(Pos X - Helper(1400), Pos X) < 50
trigger2 = NumHelper(3300) > 0
trigger2 = Helper(3300), StateNo = 3342
trigger2 = abs(Pos X - Helper(3300), Pos X) < 50

[State -1: Teleport out of Danger]
type = VarSet
triggerall = var(59) > 0
trigger1 = var(46)
trigger1 = enemyNear, MoveType = A
trigger1 = abs(enemyNear, Pos X - Pos X) < 160
trigger2 = var(46) = 6
trigger2 = abs(enemyNear, Pos X - Pos X) < 160
trigger2 = enemyNear, StateNo = 8000
var(26) = 4

[State -1: Teleport Away]
type = ChangeState
value = 2600
triggerall = Ctrl
triggerall = StateType != A
triggerall = var(59) > 0
trigger1 = var(46)
trigger1 = enemyNear, MoveType = A
trigger1 = abs(enemyNear, Pos X - Pos X) < 100
;trigger1 = Random < 128

;=================
;AI Alpha Counters
;=================
;[State -1, Blah]
;type = VarSet
;var(24) = 1
;triggerall = Power >= 1000
;trigger1 = StateNo = [150,155]

[State -1, Alpha Counter]
type = VarSet
triggerall = var(46) < 6
triggerall = Stateno = [150,155]
triggerall = Power >= 1000
triggerall = statetype != A
triggerall = var(59) > 0
triggerall = P2Dist X <= 200
;triggerall = Time = 10
trigger1 = random < 4
trigger2 = var(46)
trigger2 = random < 16
trigger3 = Power >= 3000
trigger3 = random < 64
trigger4 = Power >= 3000
trigger4 = var(46)
trigger4 = random < 128
var(24) = 1

;Don't use
;[State -1, Alpha Counter Tornado]
;type = ChangeState
;triggerall = var(59) > 0
;trigger1 = statetype != A
;trigger1 = Stateno = [150,155]
;trigger1 = Power >= 1000
;trigger1 = var(24) = 1
;trigger1 = Random < 250
;trigger1 = P2Dist X <= 60
;trigger1 = !(enemyNear, HitFall)
;value = 2100

[State -1, Alpha Counter Fire]
type = ChangeState
triggerall = var(46) < 6
triggerall = var(59) > 0
triggerall = Power >= 1000
trigger1 = statetype != A
trigger1 = Stateno = [150,155]
trigger1 = Power >= 2000
trigger1 = Power < 3000
trigger1 = var(24) = 1
trigger1 = Random < 250
trigger1 = P2Dist X <= 120
value = 1200

[State -1, Alpha Counter Lightning Bolt]
type = ChangeState
triggerall = var(46) < 6
triggerall = var(59) > 0
triggerall = Power >= 1000
trigger1 = statetype != A
trigger1 = Stateno = [150,155]
trigger1 = Power >= 2000
trigger1 = var(24) = 1
value = 1000

;===========================================================================
;---------------------------------------------------------------------------

;==========
;FATALITIES
;==========
;Humiliation
[State -1, Humiliate]
type = ChangeState
value = 10920
trigger1 = command = "humiliate"
trigger1 = statetype != A
trigger1 = ctrl
trigger1 = p2stateno = 10700
trigger1 = Life = LifeMAx


;Monstrous Switchblock Fatality
[State -1, Big Switch]
type = ChangeState
value = 10800
trigger1 = command = "bigswitch"
trigger1 = p2stateno = 10700
trigger1 = statetype != A
trigger1 = ctrl

;Kaboom!
[State -1, Someone Set Up Us The Bomb]
type = ChangeState
value = 10950
trigger1 = command = "bomb"
trigger1 = p2stateno = 10700
trigger1 = statetype != A
trigger1 = ctrl

;Knock 'em into the BG
[State -1, BGKnock]
type = Null;ChangeState
value = 10900
trigger1 = command = "bgfatal"
trigger1 = p2stateno = 10700
trigger1 = statetype != A
trigger1 = ctrl

;Friendship
[State -1, Fship]
type = ChangeState
value = 10910
trigger1 = command = "friendship"
trigger1 = statetype != A
trigger1 = ctrl
trigger1 = p2stateno = 10700
trigger1 = P2Dist X = [100, 270]
trigger1 = var(49) = 0

;============
;HYPER COMBOS
;============

;Hidden Power Selector
;[State -2, HPSelect]
;type = varRandom
;var = 22
;range = 0

;Hidden Power -- Cure 2
;[State -2, Cure2]
;type = ChangeState
;value = 3600
;triggerall = command = "hiddenpower"
;triggerall = statetype != A
;triggerall = var(59) <= 0
;triggerall = ctrl
;trigger1 = 1

;WinCrash
[State -1, WinCrash]
type = Null;ChangeState
value = 3500
triggerall = command = "wincrash"
triggerall = power >= 1000
triggerall = statetype != A
trigger1 = var(59) <= 0
trigger1 = ctrl

;Kefka Team
[State -1, Kefka]
type = Null;ChangeState
value = 3700
triggerall = command = "kefka"
;Triggerall = StateType != A
Triggerall = NumHelper(3000) = 0
Triggerall = power >= 2000
triggerall = var(59) <= 0
triggerall = partner, name = "Kefka"
triggerall = name != "Hyper Neo-Kamek"
triggerall = RoundState = 2
Trigger1 = Ctrl
trigger2 = stateno < 3000
trigger2 = stateno != [120,155]

;Hyper Polygon Attack (Stand)
[State -1, Hyper Polygon Attack Standing]
Type = ChangeState
Value = 3000
Triggerall = command = "hyperpoly"
Triggerall = StateType != A
Triggerall = power >= 1000
triggerall = var(59) <= 0
triggerall = RoundState = 2
Trigger1 = Ctrl
Trigger1 = NumHelper(3000) = 0
trigger2 = stateno < 3000
Trigger2 = NumHelper(3000) = 0
trigger2 = stateno != [120,155]
trigger3 = var(31) < 3
trigger3 = stateno = [3000,4000]
trigger3 = stateno != 3000
trigger3 = stateno != 4000

;Hyper Polygon Attack (Aerial)
[State -1, Hyper Polygon Attack Air]
Type = ChangeState
Value = 3100
Triggerall = command = "hyperpoly"
Triggerall = StateType = A
Triggerall = power >= 1000
triggerall = var(59) <= 0
triggerall = RoundState = 2
Trigger1 = Ctrl
Trigger1 = NumHelper(3000) = 0
;trigger2 = MoveContact
trigger2 = stateno < 3000
trigger2 = stateno != [120,155]
Trigger2 = NumHelper(3000) = 0
trigger3 = var(31) < 3
trigger3 = stateno = [3000,4000]
trigger3 = stateno != 3100

;Troopa Rush
[State -1, Hyper Troopa Rush]
Type = Changestate
Value = 3200
triggerall = command = "kooparush"
triggerall = power >= 1000
triggerall = statetype != A
triggerall = var(59) <= 0
triggerall = RoundState = 2
;triggerall = var(59) <= 0 ; Don't want the AI to use this randomly!
trigger1 = ctrl
;trigger2 = MoveContact
trigger2 = stateno < 3000
trigger2 = stateno != [120,155]
trigger3 = var(31) < 3
trigger3 = stateno = [3000,4000]
trigger3 = stateno != 3200

;Switch Attack
[State -1, Switch Attack]
Type = Changestate
Value = 3300
triggerall = var(59) <= 0 ; Don't want the AI to use this randomly!
triggerall = command = "switch"
triggerall = statetype != A
triggerall = RoundState = 2
trigger1 = power >= 1000
trigger1 = ctrl
trigger2 = var(31) < 3
trigger2 = stateno = [3000,4000]
trigger2 = stateno != 3300
trigger2 = stateno != 4000

;Drain Beam
;[State -1, Drain Beam]
;type = ChangeState
;value = 4100
;triggerall = command = "drainbeam"
;triggerall = power >= 2000
;triggerall = statetype != A
;triggerall = var(59) <= 0
;trigger1 = ctrl
;trigger2 = stateno < 3000

;Hyper Beam
[State -1, Hyperbeam]
type = ChangeState
value = 3400
triggerall = command = "hyperbeam"
triggerall = power >= 2000
triggerall = statetype != A
triggerall = NumHelper(2540) = 0
triggerall = var(59) <= 0
triggerall = RoundState = 2
trigger1 = ctrl
;trigger2 = MoveContact
trigger2 = stateno < 3000
trigger2 = stateno != [120,155]
trigger3 = var(31) < 3
trigger3 = stateno = [3000,4000]
trigger3 = stateno != 3400
trigger3 = stateno != 4000

;Merton
[State -1, Merton]
type = Null;ChangeState
value = 3900
triggerall = command = "merton"
triggerall = power >= 3000
triggerall = var(59) <= 0
triggerall = statetype = S
triggerall = RoundState = 2
trigger1 = Ctrl

;Invincibility
[State -1, Invin]
type = ChangeState
value = 3600
triggerall = command = "invin"
triggerall = power > 0
triggerall = var(59) <= 0 ; Don't want the AI to use this randomly!
triggerall = var(30) = 0 ; Don't use this if you're already invincible, dumbass
triggerall = RoundState = 2
trigger1 = Ctrl
trigger1 = Statetype != A
;trigger2 = stateno = 2000

;Ultima
[State -1, Ultima]
type = ChangeState
value = 3800
triggerall = command = "ultima"
triggerall = power >= 5000
triggerall = var(59) <= 0
triggerall = statetype = S
triggerall = RoundState = 2
trigger1 = Ctrl

;Stop
[State -1, Stop]
type = ChangeState
value = 3850
triggerall = command = "stopspell"
triggerall = power >= 3000
triggerall = var(59) <= 0
triggerall = statetype = S
triggerall = RoundState = 2
trigger1 = Ctrl

;Beat Up
[State -1, Beat Up]
type = ChangeState
value = 4000
triggerall = command = "beatup"
triggerall = var(59) <= 0
triggerall = Statetype = S
triggerall = NumHelper(2500) = 0
triggerall = NumHelper(2510) = 0
triggerall = NumHelper(2520) = 0
triggerall = NumHelper(2530) = 0
triggerall = NumHelper(2540) = 0
triggerall = stateno != [120,155]
triggerall = RoundState = 2
triggerall = (Ctrl) || (Stateno < 3000)
;Three PKMN
trigger1 = var(40) > 0
trigger1 = var(41) > 0
trigger1 = var(42) > 0
trigger1 = Power >= 3000
;Two PKMN
trigger2 = (var(40)>0 && var(41)>0 && var(42)<=0) || (var(40)>0 && var(42)>0 && var(41)<=0) || (var(41)>0 && var(42)>0 && var(40)<=0)
trigger2 = Power >= 2000
;One PKMN
trigger3 = (var(40)>0 && var(41)<=0 && var(42)<=0) || (var(41)>0 && var(40)<=0 && var(42)<=0) || (var(42)>0 && var(40)<=0 && var(41)<=0)
trigger3 = Power >= 1000

;=============
;SPECIAL MOVES
;=============

;Koopa Magic
[State -1, Koopa Magic]
type = Changestate
value = 2200
triggerall = command = "koopamagic"
triggerall = statetype != A
triggerall = var(59) <= 0
triggerall = NumEnemy = 1
triggerall = NumHelper(2200) = 0
triggerall = NumHelper(10600) = 0
trigger1 = Ctrl
;trigger2 = MoveContact
;trigger2 = StateNo < 1000

;;Lightning Bolt (Midair)
;[State -1, Midair Lightning Bolt]
;Type = ChangeState
;Value = 2015
;Triggerall = command = "LitBolt"
;Triggerall = statetype = A
;;triggerall = statetype != S
;;triggerall = statetype != C
;triggerall = stateno < IfElse(Name="Hyper Neo-Kamek",3000,1000)
;triggerall = var(59) <= 0
;Trigger1 = Ctrl
;trigger2 = MoveContact ;|| helper, MoveContact
;;trigger2 = StateNo < 100

;Lightning Bolt
[State -1, Lightning Bolt]
Type = ChangeState
Value = 1000
Triggerall = command = "LitBolt"
Triggerall = statetype != A
triggerall = var(59) <= 0
Trigger1 = Ctrl
trigger2 = MoveContact ;|| helper, MoveContact
trigger2 = StateNo < IfElse(Name="Hyper Neo-Kamek",3000,1000)
trigger2 = stateno != [120,155]

;Lightning Bolt (Anti-Air)
;[State -1, AA Lightning Bolt]
;Type = ChangeState
;value = 2005
;triggerall = command = "AALitBolt"
;triggerall = statetype != A
;triggerall = var(59) <= 0
;trigger1 = Ctrl
;trigger2 = MoveContact ;|| helper, MoveContact
;trigger2 = stateno < IfElse(Name="Hyper Neo-Kamek",3000,1000)

;Tornado
[State -1, Tornado]
Type = ChangeState
Value = 2100
triggerall = command = "AAIceBeam"
triggerall = statetype != A
triggerall = var(59) <= 0
trigger1 = Ctrl
trigger2 = MoveContact ;|| helper, MoveContact
trigger2 = stateno < IfElse(Name="Hyper Neo-Kamek",3000,1000)
trigger2 = stateno != [120,155]
trigger2 = StateNo != 1000

;Ice Beam (midair)
[State -1, Ice Beam]
Type = ChangeState
Value = 2115
;Triggerall = command = "IceBeam"
triggerall = command = "LitBolt"
Triggerall = statetype = A
triggerall = statetype != S
triggerall = statetype != C
triggerall = stateno < IfElse(Name="Hyper Neo-Kamek",3000,1000)
triggerall = var(59) <= 0
triggerall = stateno != [120,155]
Trigger1 = Ctrl
trigger2 = MoveContact ;|| helper, MoveContact

;Summon Toadie
[State -1, Toadie]
type = ChangeState
value = 1300
Triggerall = StateType != A
Triggerall = var(59) <= 0
Triggerall = Command = "toadie"
triggerall = NumHelper(1300) < IfElse(Name = "Hyper Neo-Kamek" || var(46) >= 3, 4, 1)
trigger1 = Ctrl

;Summon Bob-Omb
[State -1, Bob-Omb]
type = ChangeState
value = 1400
Triggerall = StateType != A
Triggerall = var(59) <= 0
Triggerall = Command = "bobomb"
triggerall = NumHelper(1400) < IfElse(Name = "Hyper Neo-Kamek" || var(46) >= 3, 4, 1)
trigger1 = Ctrl

;;Ice Beam
;[State -1, Ice Beam]
;Type = ChangeState
;Value = 1100
;Triggerall = command = "IceBeam"
;Triggerall = statetype != A
;triggerall = var(59) <= 0
;Trigger1 = Ctrl
;trigger2 = MoveContact ;|| helper, MoveContact
;trigger2 = stateno < IfElse(Name="Hyper Neo-Kamek",3000,1000)

;Fire Blast (midair)
[State -1, Fire Blast]
Type = ChangeState
Value = 2215
Triggerall = command = "FireBlast"
Triggerall = statetype = A
triggerall = statetype != S
triggerall = statetype != C
triggerall = stateno < IfElse(Name="Hyper Neo-Kamek",3000,1000)
triggerall = stateno != [120,155]
triggerall = var(59) <= 0
Trigger1 = Ctrl
trigger2 = MoveContact ;|| helper, MoveContact
trigger2 = stateno != 1000

;Fire Blast
[State -1, Fire Blast]
Type = ChangeState
Value = 1200
Triggerall = command = "FireBlast"
Triggerall = statetype != A
triggerall = var(59) <= 0
Trigger1 = Ctrl
trigger2 = MoveContact ;|| helper, MoveContact
trigger2 = stateno < IfElse(Name="Hyper Neo-Kamek",3000,1000)
trigger2 = stateno != [120,155]
trigger2 = stateno != 1000

;Teleport

[State -1, Teleport Far Back]
type = varSet
trigger1 = Facing = 1
trigger1 = command = "TPort_X"
trigger2 = Facing = -1
trigger2 = command = "TPort_C"
v = 26
value = 1

[State -1, Teleport Midway Back]
type = varSet
trigger1 = Facing = 1
trigger1 = command = "TPort_Y"
trigger2 = Facing = -1
trigger2 = command = "TPort_B"
v = 26
value = 2

[State -1, Teleport In Your Face]
type = varSet
trigger1 = Facing = 1
trigger1 = command = "TPort_Z"
trigger2 = Facing = -1
trigger2 = command = "TPort_A"
v = 26
value = 3

[State -1, Teleport Far Front]
type = varSet
trigger1 = Facing = 1
trigger1 = command = "TPort_C"
trigger2 = Facing = -1
trigger2 = command = "TPort_X"
v = 26
value = 4

[State -1, Teleport Mid Front]
type = varSet
trigger1 = Facing = 1
trigger1 = command = "TPort_B"
trigger2 = Facing = -1
trigger2 = command = "TPort_Y"
v = 26
value = 5

[State -1, Teleport Behind You]
type = varSet
trigger1 = Facing = 1
trigger1 = command = "TPort_A"
trigger2 = Facing = -1
trigger2 = command = "TPort_Z"
v = 26
value = 6

[State -1: No Teleporting Allowed In M-NES Games!]
type = PlaySnd
triggerall = statetype != A
triggerall = Ctrl
triggerall = (P2Name = "M-NES Game 1") || (P2Name = "M-NES Game 2") || (P2Name = "M-GB Game 1")
trigger1 = command = "TPort_X"
trigger2 = command = "TPort_Y"
trigger3 = command = "TPort_Z"
trigger4 = command = "TPort_A"
trigger5 = command = "TPort_B"
trigger6 = command = "TPort_C"
value = S11,9


[State -1, Teleport State]
type = ChangeState
value = 2600
triggerall = statetype != A
triggerall = Ctrl
triggerall = (P2Name != "M-NES Game 1") && (P2Name != "M-NES Game 2") && (P2Name != "M-GB Game 1")
trigger1 = command = "TPort_X"
trigger2 = command = "TPort_Y"
trigger3 = command = "TPort_Z"
trigger4 = command = "TPort_A"
trigger5 = command = "TPort_B"
trigger6 = command = "TPort_C"

;================
;STRIKERS/ASSISTS
;================
;[State -1, Tron Bonne Assist]
;Type = Null ; Disabled.
;Value = 2500
;Trigger1 = command = "Tron"
;trigger1 = Statetype = S
;trigger1 = ctrl
;trigger1 = NumHelper(2500) = 0
;trigger1 = NumHelper(2510) = 0
;trigger1 = NumHelper(2520) = 0
;trigger1 = NumHelper(2530) = 0

[State -1, AI Determine Random Assist]
type = varRandom
triggerall = var(59) > 0
trigger1 = NumHelper(2500) = 0
trigger1 = NumHelper(2510) = 0
trigger1 = NumHelper(2520) = 0
trigger1 = NumHelper(2530) = 0
trigger1 = NumHelper(2540) = 0
trigger2 = Name = "Kamek's Rival"
trigger3 = var(46) >= 3
v = 23
range = 1,4

[State -1, AI Calls Dark Butterfree When Full --> Ultima]
type = VarSet
trigger1 = NumHelper(2500) = 0
trigger1 = NumHelper(2510) = 0
trigger1 = NumHelper(2520) = 0
trigger1 = NumHelper(2530) = 0
trigger1 = NumHelper(2540) = 0
trigger1 = Power >= 5000
trigger1 = Var(46) < 5
var(23) = 3

;[State -2, BlockHits Info]
;type = DisplaytoClipboard
;trigger1 = NumHelper(2500) = 0
;trigger1 = NumHelper(2510) = 0
;trigger1 = NumHelper(2520) = 0
;trigger1 = NumHelper(2530) = 0
;trigger1 = NumHelper(2540) = 0
;trigger1 = var(59) > 0
;text = "Assist OK, AI assist %d"
;params = var(23)

[State -1, AI Assist Disable]
type = varSet
triggerall = NumHelper(2500) = 0
triggerall = NumHelper(2510) = 0
triggerall = NumHelper(2520) = 0
triggerall = NumHelper(2530) = 0
triggerall = NumHelper(2540) = 0
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = Name != "Kamek's Rival" && (var(46) < 3 || var(46) = 6)
trigger1 = P2BodyDist X < 50
trigger2 = enemy, NumProj > 0
trigger3 = NumHelper(8000) != 0
trigger4 = NumHelper(10600) != 0
trigger5 = var(46) = 6
var(23) = 0

[State -1, Umbreon Assist]
Type = ChangeState
value = 2529
triggerall = var(46) < 6
triggerall = Statetype = S
triggerall = ctrl
triggerall = NumHelper(2500) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(2510) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(2520) = 0 || var(46) >= 4
triggerall = NumHelper(2530) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(2540) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(8000) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = var(33) = 0 || Name = "Kamek's Rival" || var(46) >= 3
Trigger1 = command = "Umbreon"
trigger2 = var(59) > 0
trigger2 = var(23) = 1
trigger2 = var(10) = 0
trigger2 = var(41) > 0

[State -1, Eefi Assist]
Type = ChangeState
value = 2519
triggerall = var(46) < 6
triggerall = Statetype = S
triggerall = ctrl
triggerall = NumHelper(2500) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(2510) = 0 || var(46) >= 4
triggerall = NumHelper(2520) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(2530) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(2540) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(8000) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = var(33) = 0 || Name = "Kamek's Rival" || var(46) >= 3
Trigger1 = command = "Eefi"
trigger2 = var(59) > 0
trigger2 = var(23) = 2
trigger2 = var(10) = 0
trigger2 = var(40) > 0

[State -1, DarkButterfree Assist]
Type = ChangeState
value = 2539
triggerall = var(46) < 6
triggerall = Statetype = S
triggerall = ctrl
triggerall = NumHelper(2500) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(2510) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(2520) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(2530) = 0 || var(46) = 4
triggerall = NumHelper(2540) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = NumHelper(8000) = 0 || Name = "Kamek's Rival" || var(46) >= 3
triggerall = var(33) = 0 || Name = "Kamek's Rival" || var(46) >= 3
Trigger1 = command = "DarkButterfree"
trigger2 = var(59) > 0
trigger2 = var(23) = 3
trigger2 = var(10) = 0
trigger2 = var(42) > 0

[State -1, Bowser Assist]
Type = ChangeState
value = 2549
triggerall = var(46) < 6
triggerall = Statetype = S
triggerall = ctrl
triggerall = NumHelper(2500) = 0
triggerall = NumHelper(2510) = 0
triggerall = NumHelper(2520) = 0
triggerall = NumHelper(2530) = 0
triggerall = NumHelper(2540) = 0
triggerall = NumHelper(8000) = 0 || var(46) >= 4
triggerall = var(33) = 0
triggerall = power >= 1000 || var(46) >= 3
triggerall = Name != "Kamek's Rival"
Trigger1 = command = "Bowser"
trigger2 = var(59) > 0
trigger2 = var(23) = 4
trigger2 = var(10) = 0
trigger2 = Power > 3000

;==============
;NORMAL ATTACKS
;==============

;Crouching Jab
[State -1, Crouching Jab]
Type = ChangeState
Value = 400
Triggerall = command = "down_a"
Triggerall = statetype !=A
triggerall = var(59) <= 0
trigger1 = ctrl
;trigger2 = MoveContact ;|| helper, MoveContact
;trigger2 = Name = "Hyper Neo-Kamek"
;trigger2 = StateNo < 3000

;AI Crouching Jab
[State -1, AI Crouching Jab]
type = ChangeState
value = 400
triggerall = var(46) < 6
triggerall = Statetype != A
triggerall = ctrl
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = P2StateNo < 3397 || P2StateNo > 3399
triggerall = enemyNear, GetHitvar(Fall.Damage) = 0 || (enemyNear, StateNo = 5100 && enemyNear, Time > 3)
trigger1 = EnemyNear, Pos X - Pos X <= 40
trigger1 = EnemyNear, Pos Y > -20
trigger1 = EnemyNear, MoveType = H

;Launcher
[State -1, Launcher]
Type = ChangeState
Value = 410
Triggerall = command = "down_b"
triggerall = var(59) <= 0
Triggerall = statetype != A
trigger1 = ctrl
trigger2 = MoveContact
trigger2 = stateno = 200
trigger3 = MoveContact
trigger3 = stateno = 210
trigger4 = MoveContact
trigger4 = stateno = 400
trigger5 = MoveContact ;|| helper, MoveContact
trigger5 = Name = "Hyper Neo-Kamek"
trigger5 = StateNo < 3000
trigger5 = stateno != [120,155]
trigger5 = stateno != 1000

;Set up ???
;[State -1, ???]
;type = varSet
;var(44) = -1
;trigger1 = var(59) > 0
;trigger1 = MoveHit
;trigger1 = Stateno = 400

;Cancel ???
;[State -1, Cancel ???]
;type = varSet
;var(44) = 0
;trigger1 = var(44) = -1
;trigger1 = P2MoveType != H

;Choose between normal Launcher or Tornado
[State -1, PickLauncher]
Type = varSet
v = 50
value = IfElse((Random <= 499 || enemyNear, HitFall), 1, 2)
triggerall = var(59) > 0
trigger1 = MoveHit
trigger1 = (stateno = 210)
trigger1 = Power < 2000
trigger2 = MoveHit
trigger2 = Stateno = 400

;Launcher (AI-link)
[State -1, AI Launcher]
type = Changestate
value = 410
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = (var(50) = 1 && P2Dist X < 75)
trigger1 = MoveHit
trigger1 = (stateno = 210)
trigger1 = Power < 2000
trigger2 = MoveHit
trigger2 = Stateno = 400

;Launcher (AI-link)
[State -1, AI Tornado]
type = Changestate
value = 2100
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = (var(50) = 2 || P2Dist X >= 75)
trigger1 = MoveHit
trigger1 = (stateno = 210)
trigger1 = Power < 2000
trigger2 = MoveHit
trigger2 = Stateno = 400

;Trip
[State -1, Trip]
Type = ChangeState
Value = 420
Triggerall = command = "down_c"
triggerall = var(59) <= 0
Triggerall = statetype != A
trigger1 = ctrl
trigger2 = MoveContact
trigger2 = stateno = 200
trigger3 = MoveContact
trigger3 = stateno = 210
trigger4 = MoveContact
trigger4 = stateno = 400
trigger5 = MoveContact ;|| helper, MoveContact
trigger5 = Name = "Hyper Neo-Kamek"
trigger5 = StateNo < 3000
trigger5 = stateno != [120,155]
trigger5 = stateno != 1000

;AI Trip
[State -1, AI Trip]
Type = ChangeState
Value = 420
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
Triggerall = var(59) > 0
trigger1 = MoveHit
trigger1 = stateno = 210
;trigger1 = power < 2000

;Standing Jab
[State -1, Standing Jab]
type = ChangeState
value = 200
triggerall = command = "a"
triggerall = command != "down_a"
triggerall = statetype !=A
triggerall = var(59) <= 0
trigger1 = ctrl
;trigger2 = MoveContact ;|| helper, MoveContact
;trigger2 = Name = "Hyper Neo-Kamek"
;trigger2 = StateNo < 3000

;Standing Energy Ball
[State -1, Standing Eball]
type=Changestate
value = 210
Triggerall = command = "b"
triggerall = command != "down_b"
triggerall = var(59) <= 0
Triggerall = statetype != A
trigger1 = ctrl
trigger2 = MoveContact
trigger2 = stateno = 200
trigger3 = MoveContact
trigger3 = stateno = 400
;trigger4 = MoveContact ;|| helper, MoveContact
;trigger4 = Name = "Hyper Neo-Kamek"
;trigger4 = StateNo < 3000

;Standing Fire Ball (AI Link)
[State -1, Standing Fireball]
type = Changestate
value = 210
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = Statetype != A
trigger1 = MoveContact
trigger1 = stateno = 400
trigger2 = MoveContact
trigger2 = stateno = 200
trigger3 = ctrl
trigger3 = P2Dist X <= 70
trigger3 = P2Dist Y >= -30
trigger3 = Pos X < 100
trigger3 = enemyNear, MoveType != A && Random < 250
trigger3 = EnemyNear, StateType != L

;Standing Polygon Attack
[State -1, Standing Polygon Attack]
Type = ChangeState
Value = 220
Triggerall = command = "c"
Triggerall = command != "down_c"
triggerall = NumHelper(220) = 0 || var(46) >= 4
triggerall = var(59) <= 0
Triggerall = statetype != A
Trigger1 = Ctrl
trigger2 = stateno = 200
trigger2 = MoveContact
trigger3 = stateno = 210
trigger3 = MoveContact
trigger4 = stateno = 400
trigger4 = MoveContact
trigger5 = MoveContact ;|| helper, MoveContact
trigger5 = Name = "Hyper Neo-Kamek"
trigger5 = StateNo < 3000
trigger5 = stateno != [120,155]
trigger5 = stateno != 1000

;AI Polygon Attack
[State -1, AI Polygon Attack]
type = ChangeState
value = 220
triggerall = var(46) < 6
triggerall = !Var(39)
Triggerall = NumHelper(220) = 0 || var(46) >= 4
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
trigger1 = ctrl
triggerall = StateType != A
trigger1 = P2BodyDist X > 100
trigger1 = Random < 5

;Aerial Jab
[State -1, Aerial Jab]
type = ChangeState
value = 600
triggerall = command = "a"
triggerall = statetype = A
triggerall = var(59) <= 0
trigger1 = ctrl
trigger2 = MoveContact ;|| helper, MoveContact
trigger2 = Name = "Hyper Neo-Kamek"
trigger2 = StateNo < 3000
trigger2 = stateno != [120,155]

;AI Air Jab
[State -1, AI Air Jab]
type = ChangeState
value = 600
triggerall = var(46) < 6
triggerall = statetype = A
triggerall = var(59) > 0
triggerall = p2stateno < 10700 || P2StateNo > 10704
trigger1 = ctrl
trigger1 = PrevStateNo = 9040
trigger1 = EnemyNear, MoveType = H
trigger2 = Ctrl
trigger2 = P2Dist X < 50
trigger2 = P2Dist Y < 50
trigger2 = Random < IfElse(Name = "Hyper Neo-Kamek", 500, 125)
trigger2 = enemyNear, MoveType != A && Random < 750
;trigger1 = Time = 0
;trigger1 = (PrevStateNo = 410) || (PrevStateNo = 2100) || (PrevStateNo =
;trigger2 = MoveContact ;|| helper, MoveContact
;trigger2 = Name = "Hyper Neo-Kamek"
;trigger2 = StateNo < 3000

;Aerial Ice Ball
[State -1, Aerial Ice Ball]
type = ChangeState
value = 610
triggerall = command = "b"
triggerall = var(59) <= 0
triggerall = statetype = A
trigger1 = ctrl
trigger2 = MoveContact
trigger2 = stateno = 600
trigger3 = MoveContact ;|| helper, MoveContact
trigger3 = Name = "Hyper Neo-Kamek"
trigger3 = StateNo < 3000
trigger3 = stateno != [120,155]

;Aerial AI Ice Ball
[State -1, Aerial AI Ice Ball]
type = ChangeState
value = 610
triggerall = var(46) < 6
triggerall = p2stateno < 10700 || P2StateNo > 10704
triggerall = var(59) > 0
triggerall = statetype = A
trigger1 = MoveContact
trigger1 = stateno = 600
trigger2 = MoveContact ;|| helper, MoveContact
trigger2 = Name = "Hyper Neo-Kamek"
trigger2 = StateNo < 3000
trigger2 = stateno != [120,155]
trigger2 = HitCount < 7

;Aerial Polygon Attack
[State -1, Aerial Polygon Attack]
Type = ChangeState
Value = 620
Trigger1 = command = "c"
Trigger1 = command != "down_c"
Trigger1 = statetype = A
Triggerall = NumHelper(220) = 0
Trigger1 = Ctrl
trigger1 = var(59) <= 0

;AI Aerial Polygon Atk
[State -1, Aerial Polygon Attack]
Type = ChangeState
Value = 620
triggerall = !Var(39)
Trigger1 = command = "c"
Trigger1 = command != "down_c"
Trigger1 = statetype = A
Triggerall = NumHelper(220) = 0 || var(46) >= 4
Trigger1 = Ctrl
triggerall = p2stateno < 10700 || P2StateNo > 10704
trigger1 = var(59) > 0
trigger1 = P2BodyDist Y < 20
trigger1 = P2BodyDist X > 80

;Aerial Polygon Attack Down
[State -1, Aerial Polygon Attack Down]
Type = ChangeState
Value = 625
Triggerall = NumHelper(220) = 0 || var(46) >= 4
triggerall = var(59) <= 0
Trigger1 = command = "down_c"
Trigger1 = statetype = A
Trigger1 = Ctrl
trigger2 = command = "c"
trigger2 = MoveContact
trigger2 = stateno = 600
trigger3 = command = "c"
trigger3 = MoveContact
trigger3 = stateno = 610

;AI Aerial Polygon Attack Down
[State -1, AI Aerial Polygon Attack Down]
Type = ChangeState
Value = 625
triggerall = !Var(39)
triggerall = p2stateno < 10700 || P2StateNo > 10704
Triggerall = var(59) > 0
trigger1 = MoveContact
trigger1 = stateno = 610
;trigger1 = power < 2000

;Power Up
[State -1, Power Up]
Type = ChangeState
Value = 2000
triggerall = ctrl
trigger1 = var(59) <= 0
Trigger1 = command = "holdstart"
Triggerall = statetype != A
triggerall = P2Life > 0

;AI Power Up
[State -1, AI Power Up]
type = ChangeState
value = 2000
triggerall = var(30) = 0 || power < 4000
triggerall = power < const(data.power) || Life < LifeMax/2
triggerall = statetype != A
triggerall = Ctrl
triggerall = var(59) > 0
triggerall = P2Life > 0
triggerall = P2StateNo != 10700
trigger1 = P2Dist X > 150
trigger1 = P2MoveType = H
trigger2 = P2Dist X > 250
trigger2 = P2MoveType = I
trigger3 = var(46) >= 4
;trigger2 = P2Dist X > 200
;trigger2 = P2MoveType != A
;trigger2 = P2Name != "Evil Ken"

;===========================================================================
;---------------------------------------------------------------------------
;Run Fwd
[State -1, Run Fwd]
type = ChangeState
value = 100
trigger1 = command = "FF"
trigger1 = statetype = S
trigger1 = ctrl

;---------------------------------------------------------------------------
;Run Back
[State -1, Run Back]
type = ChangeState
value = 105
trigger1 = command = "BB"
trigger1 = statetype = S
trigger1 = ctrl

;Super Jump
[State -1, Super Jump]
type = ChangeState
value = 9040
triggerall = !Var(59)
trigger1 = command = "superjump"
trigger1 = statetype != A
Trigger1 = Ctrl

[State -1, Super Jump From Launcher]
type = ChangeState
triggerall = MoveHit
triggerall = StateNo = 410
trigger1 = command = "holdup"
value = 9040
ctrl = 1

[State 410, Super Jump From Tornado]
type = ChangeState
triggerall = var(17) > 0
TriggerAll = NumHelper(2100) = 0
triggerall = Time > 6
triggerall = StateNo = 2100
trigger1 = command = "holdup"
value = 9040
ctrl = 1

;AI Super Jump
[State -1, AI Jump]
type = ChangeState
value = 9040
triggerall = var(46) < 6
triggerall = Var(59) > 0
trigger1 = var(17) > 0
Trigger1 = NumHelper(2100) = 0
trigger1 = Time > 6
trigger1 = StateNo = 2100
trigger2 = MoveHit
trigger2 = StateNo = 410
ctrl = 1

[State -1, Alpha Counter]
type = VarSet
triggerall = Stateno = [150,155]
triggerall = Power >= 1000
triggerall = statetype != A
trigger1 = command = "counter_a"
trigger2 = command = "counter_b"
trigger3 = command = "counter_c"
var(24) = 1

[State -1, Alpha Counter Lightning Bolt]
type = ChangeState
trigger1 = statetype != A
trigger1 = Stateno = [150,155]
trigger1 = Power >= 1000
trigger1 = command = "counter_a"
value = 1000

[State -1, Alpha Counter Tornado]
type = ChangeState
trigger1 = statetype != A
trigger1 = Stateno = [150,155]
trigger1 = Power >= 1000
trigger1 = command = "counter_b"
value = 2100

[State -1, Alpha Counter Fire]
type = ChangeState
trigger1 = statetype != A
trigger1 = Stateno = [150,155]
trigger1 = Power >= 1000
trigger1 = command = "counter_c"
value = 1200
