; ____________________________________________________________________________________________________
;/ Apocalypse © OnslaughtX

; ____________________________________________________________________________________________________
;/ AI Trigger
[Statedef 5910]
type = A
anim = 190
ctrl = 0

[State 5910, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = Invisible
flag2 = NoAutoTurn

[State 5910, AI On]
type = ParentVarSet
trigger1 = Parent, Command = "x"
trigger2 = Parent, Command = "y"
trigger3 = Parent, Command = "z"
trigger4 = Parent, Command = "a"
trigger5 = Parent, Command = "b"
trigger6 = Parent, Command = "c"
trigger7 = Parent, Command = "holdfwd"
trigger8 = Parent, Command = "holdback"
trigger9 = Parent, Command = "holdup"
trigger10 = Parent, Command = "holddown"
var(10) = 1

[State 5910, AI Off]
type = ParentVarSet
trigger1 = Command = "x"
trigger1 = Parent, Command = "x"
trigger2 = Command = "y"
trigger2 = Parent, Command = "y"
trigger3 = Command = "z"
trigger3 = Parent, Command = "z"
trigger4 = Command = "a"
trigger4 = Parent, Command = "a"
trigger5 = Command = "b"
trigger5 = Parent, Command = "b"
trigger6 = Command = "c"
trigger6 = Parent, Command = "c"
trigger7 = Command = "holdfwd"
trigger7 = Parent, Command = "holdfwd"
trigger8 = Command = "holdback"
trigger8 = Parent, Command = "holdback"
trigger9 = Command = "holdup"
trigger9 = Parent, Command = "holdup"
trigger10 = Command = "holddown"
trigger10 = Parent, Command = "holddown"
var(10) = -1

[State 5910, DestroySelf]
type = DestroySelf
trigger1 = Parent, Var(10)
trigger2 = RoundState = 3

; ____________________________________________________________________________________________________
;/ AI Constants
[Statedef -3]

[State -3, AI Trigger]
type = Null;Helper
trigger1 = !Var(10)
trigger1 = !NumHelper(5910)
trigger1 = RoundState = 2
name = "AI"
id = 5910
stateno = 5910
keyctrl = 1

[State -3, AI Trigger]
type = VarSet
trigger1 = RoundState = 0
trigger2 = Command = "AI0"
trigger3 = Command = "AI1"
trigger4 = Command = "AI2"
trigger5 = Command = "AI3"
trigger6 = Command = "AI4"
trigger7 = Command = "AI5"
trigger8 = Command = "AI6"
trigger9 = Command = "AI7"
trigger10 = Command = "AI8"
trigger11 = Command = "AI9"
trigger12 = Command = "AI10"
trigger13 = Command = "AI11"
trigger14 = Command = "AI12"
trigger15 = Command = "AI13"
trigger16 = Command = "AI14"
trigger17 = Command = "AI15"
trigger18 = Command = "AI16"
trigger19 = Command = "AI17"
trigger20 = Command = "AI18"
trigger21 = Command = "AI19"
trigger22 = Command = "AI20"
var(10) = 1 - (RoundState = 0) * 2

[State -3, VarRandom]
type = VarRandom
trigger1 = Var(10) > 0
v = 20
range = 0,10

; ____________________________________________________________________________________________________
;/ AI Variables
[State -3, Drill]
type = VarSet
triggerall = Var(10) = 1
triggerall = Power >= 1000
trigger1 = Ctrl
var(14) = 6

[State -3, RunBack]
type = VarSet
triggerall = Var(10) = 1
triggerall = Ctrl
trigger1 = P2Dist X <= -180
var(14) = 1

[State -3, RunFwd]
type = VarSet
triggerall = Var(10) = 1
triggerall = Ctrl
trigger1 = P2Dist X >= 180
var(14) = 2

[State -3, Shockwave Wave Type]
type = VarSet
triggerall = Var(10) = 1
trigger1 = Ctrl
var(19) = 2

[State -3, Shockwave]
type = VarSet
triggerall = Var(10) = 1
triggerall = Ctrl
trigger1 = P2Dist X >= -40
trigger1 = !Var(20)
var(14) = 3

[State -3, Spike]
type = VarSet
triggerall = Var(10) = 1
triggerall = Ctrl
trigger1 = P2Dist X = [-40, 40]
trigger1 = Var(20) = 1
var(14) = 4

[State -3, Shoulder Cannon]
type = VarSet
triggerall = Var(10) = 1
triggerall = Ctrl
trigger1 = Var(20) = 2
trigger1 = P2Dist X > 60
var(14) = 5

[State -3, Homing Shoulder Cannon]
type = VarSet
triggerall = var(10) = 1
triggerall = ctrl
trigger1 = Var(20) = 3
trigger1 = P2Dist X = [-170, -30]
var(14) = 7

[State -3, Walk Forward]
type = VelSet
triggerall = Var(10) = 1
triggerall = Pos Y != 0
triggerall = Ctrl
trigger1 = P2Dist X > 40
x = Const(velocity.walk.fwd.x)

[State -3, Walk Backward]
type = VelSet
triggerall = Var(10) = 1
triggerall = Pos Y != 0
triggerall = Ctrl
trigger1 = P2Dist X < -40
x = Const(velocity.walk.back.x)

[State -3, Walking]
type = VarAdd
triggerall = Var(10) = 1
triggerall = Ctrl
trigger1 = P2Dist X != [-40, 40]
var(11) = 1

[State -3, Walk Stop]
type = VarSet
triggerall = Var(10) = 1
triggerall = Pos Y = 0
triggerall = Ctrl
trigger1 = P2Dist X = [-40, 40]
var(11) = 0