; Inteligencia Artificial - Inicio

[Statedef 9999]
anim = 9999
ctrl = 0

[State 9999, 0]
type = Turn
trigger1 = facing != parent, facing

[State 9999, 1]
type = Varset
trigger1 = 1
var(9) = parent, var(9)

[State 9999, 2]
type = ParentVarSet
triggerall = parent, RoundState = 2
trigger1 = parent, command = "x"
trigger2 = parent, command = "y"
trigger3 = parent, command = "z"
trigger4 = parent, command = "a"
trigger5 = parent, command = "holdfwd"
trigger6 = parent, command = "holdback"
trigger7 = parent, command = "holdup"
trigger8 = parent, command = "holddown"
var(9) = 1

[State 9999, 3]
type = ParentVarSet
triggerall = parent, RoundState = 2
trigger1 = (command = "x" && parent, command = "x")
trigger2 = (command = "y" && parent, command = "y")
trigger3 = (command = "z" && parent, command = "z")
trigger4 = (command = "a" && parent, command = "a")
trigger5 = (command = "holdfwd" && parent, command = "holdfwd")
trigger6 = (command = "holdback" && parent, command = "holdback")
trigger7 = (command = "holdup" && parent, command = "holdup")
trigger8 = (command = "holddown" && parent, command = "holddown")
var(9) = -1

[State 9999, 4]
type = varset
trigger1 = var(9) != parent, var(9)
V = 47
value = 0

[State 9999, 5]
type = VarAdd
trigger1 = var(9) = parent, var(9)
V = 47
value = 1

[State 9999, 6]
type = Destroyself
trigger1 = parent, var(9) = -1
trigger1 = var(47) >= 23
trigger2 = parent, var(9) = 2
trigger2 = var(47) >= 23
trigger3 = RoundState = 3

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

[State -2, Landing Explod]
type = Explod
triggerall = Time = 1
trigger1 = stateno = 52
trigger2 = stateno = 106
anim = 6003
ID = 6003
pos = 1,10
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
scale = 1.2,1.2
sprpriority = 0
ontop = 1
shadow = 0,0,0
ownpal = 0
removeongethit = 0

[State -2, Running Explod]
type = Explod
triggerall = Time = 4
trigger1 = StateNo = 100
anim = 6002
ID = 6002
pos = -35,-25
postype = p1  ;p2,front,back,left,right
removetime = -2
facing = 1
vfacing = 1
bindtime = -1
vel = 2,0
accel = 0,0
random = 0,0
scale = 0.4,0.4
sprpriority = 0
ontop = 1
removeongethit = 1

[State -2,VarSet]
type = VarSet
trigger1 = life = 0
v = 2
value = 1




;===================================================================================
;---------------- Inteligencia Artificial  -----------------------------------------
;===================================================================================
[State -2, AI_Check] ; El ayudante siempre presente
type = Helper ; Ayudante
trigger1 = NumHelper(9999) = 0 ; No se repitira si esta presente ya
trigger1 = var(9) = 0 ; Variable que actúa como interruptor
trigger1 = RoundState = 2 ; Solo activado en combate
name = "AI activada" ; Nombre de la AI
id = 9999 ; Su identificador
pos = 1000, 1000 ; posición en su nivel muy alta
stateno = 9999 ; Te manda al stateno 9999
helpertype = normal ; Helper tipo normal
keyctrl = 1

; Con esto le digo cuando está activada
; en este caso, cuando la variable 9 es 1
;[State -2, AI prueba]
;type = VarSet ; Tipo variable
;trigger1 = command ="AI Prueba" ; Nombre del cmd
;var(9) = 1 ; Pone la variable a 9 a 1

;Con esto veo si la IA esta activada en el Debug mode
[State -2,3]
type = DisplayToClipboard ; Pone el nombre en el debug
trigger1 = var(9)=1 ; Condición para que ponga el texto
text = "La Inteligencia Artificial funca" ; Nombre del texto


; Con esto le digo cuando está desactivada
; en este caso, cuando la variable 9 es 0
;[State -2, AI desactivarlo]
;type = VarSet ; Tipo variable
;trigger1 = command ="AI desactivado" ; Nombre del cmd
;var(9) = 0

;Con esto veo si la IA esta desactivada en el Debug mode
[State -2,3]
type = DisplayToClipboard ; Pone el nombre en el debug
trigger1 = var(9)=0 ; Condición para que ponga el texto
text = "La Inteligencia Artificial desactivada" ; Nombre del texto

;---------------------------------------------------------


[State -2, terminación]
type = VarAdd
trigger1 =  p2life = 0
v =  9
value = 0

; IA de Defensa
[State -2, IA de Defensa]
type = ChangeState
value = 132
triggerall = p2movetype = A || (enemy, NumProj >= 1) ;
triggerall = P2bodydist X <= 40 || (enemy, NumProj >= 1)
triggerall = statetype = A ; Activo unicamente si estas en el Aire
triggerall = random <= 600 ; Aquí le ponemos un poco de aleteoriedad
triggerall = var(9) = 1 ; La variable que activa la AI
triggerall = ctrl
triggerall = stateno != 132
trigger1 = p2statetype = A
trigger2 = (enemy, NumProj >= 1)

[State -2, IA de Defensa]
type = ChangeState
value = 130
triggerall = p2movetype = A || (enemy, NumProj >= 1)
triggerall = P2bodydist X <= 40 || (enemy, NumProj >= 1)
triggerall = random <= 400
triggerall = statetype != A
triggerall = var(9) = 1
triggerall = ctrl
triggerall = stateno != 120
trigger1 = p2statetype = S
trigger2 = (enemy, NumProj >= 1)

;----------------------------------
;combos normales
[State -2, IA puño devil 1 ]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
value = 200
triggerall = P2bodydist X <= 20
triggerall = random = [600,700]
triggerall = statetype != A
triggerall = var(9) = 1
triggerall = ctrl
trigger1 = p2statetype = S

;start using basics
[State -2, puño devil doble]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1 ;&& roundstate = 2
trigger1 = ctrl && statetype = S && p2dist X< 80 && random = [0,200]
value = ifelse(random < 50,200,201)

[State -2, patada devil\puño fuerte]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1  && statetype = S ;&& roundstate = 2
trigger1 = ctrl && statetype = S && p2dist X< 60 && random = [100,300]
trigger2 = stateno = 200 && movecontact && random = [100,300]
trigger3 = stateno = 201 && movecontact && random = [100,300]
trigger4 = stateno = 240 && movecontact && random = [100,300]
trigger5 = stateno = 250 && movecontact && random = [100,300]
value = ifelse(random > 250, 230,210)

[State -2, patadas]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1 && statetype = S ;&& roundstate = 2
trigger1 = ctrl && statetype = S && p2dist X< 60 && random = [100,300]
trigger2 = stateno = 200 && movecontact && random = [100,300]
trigger3 = stateno = 201 && movecontact && random = [100,300]
value = ifelse(random > 200, 230,240)

[State -2, puño abajo\patada abajo]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1  && statetype = S
trigger1 = ctrl && statetype = S && p2dist X< 60 && random = [100,200]
trigger2 = stateno = 200 && movecontact && random = [100,300]
trigger3 = stateno = 201 && movecontact && random = [100,300]
trigger4 = stateno = 230 && movecontact && random = [100,300]
trigger5 = stateno = 240 && movecontact && random = [100,300]
value = ifelse(random < 150, 410,430)

[State -2, Puño Fuerte\Runing barrida]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1  && statetype = S
trigger1 = ctrl && statetype = S && p2dist X< 60 && random = [100,300]
trigger2 = stateno = 200 && movecontact && random = [100,300]
trigger3 = stateno = 201 && movecontact && random = [100,300]
trigger4 = stateno = 230 && movecontact && random = [100,300]
trigger5 = stateno = 240 && movecontact && random = [100,300]
value = ifelse(random < 150, 210,250)

[State -2, combos Agachado - basicos]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1  && statetype != A
trigger1 = ctrl && p2dist X< 60 && random = [100,300]
trigger2 = stateno = 400 && movecontact && random = [100,300]
trigger3 = stateno = 430 && movecontact && random = [100,300]
value =  ifelse(random < 150, 410,440)

[State -2, combos saltando - basicos]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1  && statetype = A
trigger1 = ctrl && p2dist X< 60 && random = [100,200]
trigger2 = stateno = 600 && movecontact && random = [100,300]
trigger3 = stateno = 630 && movecontact && random = [100,300]
value = ifelse(random < 150, 610,640)


;----------------------------------------
;----------------------------------------
;Frezaa Rush - piso
[State -2, Frezaa Rush - piso]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = stateno != 1005
triggerall = p2life > 0
triggerall = stateno < 5000
triggerall = var(9) = 1
triggerall = pos y >= -10
triggerall = ctrl && statetype = S
trigger1 = P2bodydist X >= 100 && random = [500,800]
trigger2 = stateno = 200 && movecontact && random = [20,35]
trigger3 = stateno = 201 && movecontact && random = [20,35]
trigger4 = stateno = 230 && movecontact && random = [20,35]
trigger5 = stateno = 210 && movecontact && random = [20,35]
trigger6 = stateno = 250 && movecontact && random = [20,35]
trigger7 = stateno = 410 && movecontact && random = [20,35]
trigger8 = stateno = 430 && movecontact && random = [20,35]
value = ifelse(P2Bodydist y < 30, 1100, 1110)

[State -2, Frezaa Rush - Aire]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = stateno < 5000
triggerall = pos y <= -50
triggerall = var(9) = 1  && statetype = A
trigger1 = P2bodydist x >= 100 && random = [300,800]
trigger2 = stateno = 610 && movecontact && random = [100,200]
trigger3 = stateno = 640 && movecontact && random = [100,200]
trigger4 = stateno = 1150 && (time >= 10) && random = [100,200]
trigger5 = ctrl && stateno = 1100 && random = [100,200]
trigger6 = stateno = 500 && movecontact && random = [100,200]
trigger7 = stateno = 530 && movecontact && random = [100,200]
trigger8 = (stateno = 1310)  && (time >= 20) && random = [20,35]
value = ifelse(random < 150, 1130,1140)


[State -2, Voltereta Alta]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = stateno < 5000
triggerall = var(9) = 1
triggerall = pos y >= -10
triggerall = ctrl 
trigger1 = P2bodydist Y <= -50 && random = [500,600]
trigger2 = stateno = 200 && movecontact && random = [10,15]
trigger3 = stateno = 201 && movecontact && random = [10,15]
trigger4 = stateno = 220 && movecontact && random = [10,15]
trigger5 = stateno = 210 && movecontact && random = [10,15]
trigger6 = stateno = 250 && movecontact && random = [10,15]
trigger7 = stateno = 410 && movecontact && random = [10,15]
trigger8 = stateno = 430 && movecontact && random = [10,15]
trigger9 = stateno = 610 && movecontact && random = [100,200]
trigger10 = stateno = 640 && movecontact && random = [100,200]
trigger11 = stateno = 1150 && (time >= 10) && random = [100,200]
trigger12 = stateno = 500 && movecontact && random = [100,200]
trigger13 = stateno = 530 && movecontact && random = [100,200]
trigger14 = (stateno = 1310)  && (time >= 20) && random = [20,35]
value = 1200

[State -2, Voltereta Larga]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = stateno < 5000
triggerall = var(9) = 1
triggerall = pos y >= -10
triggerall = ctrl
trigger1 = P2bodydist X >= 75 && random = [500,600]
trigger2 = stateno = 200 && movecontact && random = [10,15]
trigger3 = stateno = 201 && movecontact && random = [10,15]
trigger4 = stateno = 220 && movecontact && random = [10,15]
trigger5 = stateno = 210 && movecontact && random = [10,15]
trigger6 = stateno = 250 && movecontact && random = [10,15]
trigger7 = stateno = 410 && movecontact && random = [10,15]
trigger8 = stateno = 430 && movecontact && random = [10,15]
trigger9 = stateno = 610 && movecontact && random = [100,200]
trigger10 = stateno = 640 && movecontact && random = [100,200]
trigger11 = stateno = 1150 && (time >= 10) && random = [100,200]
trigger12 = stateno = 500 && movecontact && random = [100,200]
trigger13 = stateno = 530 && movecontact && random = [100,200]
trigger14 = (stateno = 1310)  && (time >= 20) && random = [20,35]
value = 1220

;Cola Tornado - Adelante/Arriba
[State -2, Cola Tornado - Adelante/Arriba]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = pos y >= -10
triggerall = ctrl && statetype = S
trigger1 = P2bodydist X <= 75 && random = [300,800]
trigger2 = stateno = 200 && movecontact && random = [20,35]
trigger3 = stateno = 201 && movecontact && random = [20,35]
trigger4 = stateno = 230 && movecontact && random = [20,35]
trigger5 = stateno = 210 && movecontact && random = [20,35]
trigger6 = stateno = 250 && movecontact && random = [20,35]
trigger7 = stateno = 410 && movecontact && random = [20,35]
trigger8 = stateno = 430 && movecontact && random = [20,35]
value = ifelse(P2bodydist Y <= -50, 1310, 1300)


[State -2, Pataditas]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl && statetype = A && pos Y <= -50
trigger1 = random = [500,600]
trigger2 = stateno = 1150 && (time >= 10) && random = [100,200]
trigger3 = (stateno = 1310)  && (time >= 20) && random = [20,35]
value = ifelse(random < 550, 1450,1400)

[State -2, Pataditas 2]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
trigger1 = stateno = 1450 && (Movecontact = 1)
trigger2 = stateno = 1400 && (Movecontact = 1)
value = 1401


[State -2, Pataditas 2]
type = ChangeState
triggerall = var(9) = 1
trigger1 = stateno = 1401 && (Movecontact = 1)
value = 1402

[State -2, Pataditas 3]
type = ChangeState
triggerall = var(9) = 1
trigger1 = stateno = 1402 && (Movecontact = 1)
value = 1403

[State -2, Pataditas remate]
type = ChangeState
triggerall = var(9) = 1
trigger1 = stateno = 1403 && (Movecontact = 1)
value = 1460

;-----------------------------------------------
;Speciales de ki

[State -2, Freezer Beam]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl && statetype != A
triggerall = power >= 400
trigger1 = P2bodydist x >= 100 && random = [300,800]
trigger2 = stateno = 200 && movecontact && random = [60,150]
trigger3 = stateno = 201 && movecontact && random = [60,150]
trigger4 = stateno = 230 && movecontact && random = [60,150]
trigger5 = stateno = 210 && movecontact && random = [60,150]
trigger6 = stateno = 250 && movecontact && random = [60,150]
trigger7 = stateno = 410 && movecontact && random = [60,150]
trigger8 = stateno = 430 && movecontact && random = [60,150]
value = 2100

[State -2, Daichiretsuzan pequeño]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = stateno < 5000
triggerall = var(9) = 1
triggerall = ctrl
triggerall = power > 200
triggerall = numhelper(6109) = 0
triggerall = numhelper(6110) = 0
trigger1 = P2bodydist x >= 100 && random = [300,800]
trigger2 = stateno = 200 && movecontact && random = [60,150]
trigger3 = stateno = 201 && movecontact && random = [60,150]
trigger4 = stateno = 230 && movecontact && random = [60,150]
trigger5 = stateno = 210 && movecontact && random = [60,150]
trigger6 = stateno = 250 && movecontact && random = [60,150]
trigger7 = stateno = 410 && movecontact && random = [60,150]
trigger8 = stateno = 430 && movecontact && random = [60,150]
trigger9 = stateno = 610 && movecontact && random = [100,200]
trigger10 = stateno = 640 && movecontact && random = [100,200]
trigger11 = stateno = 1150 && (time >= 10) && random = [100,200]
trigger12 = stateno = 500 && movecontact && random = [100,200]
trigger13 = stateno = 530 && movecontact && random = [100,200]
trigger14 = (stateno = 1310)  && (time >= 20) && random = [20,35]
value = 2200


[State -2, Telekinesis piedras - invocación 1]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl
triggerall = Power > 200
triggerall = Numhelper(2356) < 1
trigger1 = random = [800,900]
value = ifelse(numhelper(2355) = 1, 2305, ifelse(numhelper(2354) = 1,2304,ifelse(numhelper(2353) = 1,2303,ifelse(numhelper(2352) = 1,2302,ifelse(numhelper(2351) = 1,2301,2300)))))
[State -2, Telekinesis piedras - invocación 2]
type = ChangeState
triggerall = var(9) = 1
trigger1 = stateno = 2300 && time > 7 && random = [0,50]
value = 2301
[State -2, Telekinesis piedras - invocación 3]
type = ChangeState
triggerall = var(9) = 1
trigger1 = stateno = 2301 && time > 7 && random = [0,100]
value = 2302
[State -2, Telekinesis piedras - invocación 4]
type = ChangeState
triggerall = var(9) = 1
trigger1 = stateno = 2302 && time > 7 && random = [0,150]
value = 2303
[State -2, Telekinesis piedras - invocación 5]
type = ChangeState
triggerall = var(9) = 1
trigger1 = stateno = 2303 && time > 7 && random = [0,200]
value = 2304
[State -2, Telekinesis piedras - invocación 6]
type = ChangeState
triggerall = var(9) = 1
trigger1 = stateno = 2304 && time > 7 && random = [0,250]
value = 2305


[State -2, Telekinesis piedras - Lanzamiento 1]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl
triggerall = Power > 200 
triggerall = Numhelper(2351) = 1 || Numhelper(2352) = 1 || Numhelper(2353) = 1 || Numhelper(2354) = 1|| Numhelper(2355) = 1 || Numhelper(2356) = 1
trigger1 = random = [100,600]
value = ifelse(numhelper(2351) = 1, 2310, ifelse(numhelper(2352) = 1,2311,ifelse(numhelper(2353) = 1,2312,ifelse(numhelper(2354) = 1,2313,ifelse(numhelper(2355) = 1,2314,2315)))))
[State -2, Telekinesis piedras - Lanzamiento 2]
type = ChangeState
triggerall = var(9) = 1
triggerall = Numhelper(2351) = 1 || Numhelper(2352) = 1 || Numhelper(2353) = 1 || Numhelper(2354) = 1|| Numhelper(2355) = 1 || Numhelper(2356) = 1
trigger1 = stateno = 2310 && time > 7 && random = [0,50]
value = 2311
[State -2, Telekinesis piedras - Lanzamiento 3]
type = ChangeState
triggerall = var(9) = 1
triggerall = Numhelper(2351) = 1 || Numhelper(2352) = 1 || Numhelper(2353) = 1 || Numhelper(2354) = 1|| Numhelper(2355) = 1 || Numhelper(2356) = 1
trigger1 = stateno = 2311 && time > 7 && random = [0,100]
value = 2312
[State -2, Telekinesis piedras - Lanzamiento 4]
type = ChangeState
triggerall = var(9) = 1
triggerall = Numhelper(2351) = 1 || Numhelper(2352) = 1 || Numhelper(2353) = 1 || Numhelper(2354) = 1|| Numhelper(2355) = 1 || Numhelper(2356) = 1
trigger1 = stateno = 2312 && time > 7 && random = [0,150]
value = 2313
[State -2, Telekinesis piedras - Lanzamiento 5]
type = ChangeState
triggerall = var(9) = 1
triggerall = Numhelper(2351) = 1 || Numhelper(2352) = 1 || Numhelper(2353) = 1 || Numhelper(2354) = 1|| Numhelper(2355) = 1 || Numhelper(2356) = 1
trigger1 = stateno = 2313 && time > 7 && random = [0,200]
value = 2314
[State -2, Telekinesis piedras - Lanzamiento 6]
type = ChangeState
triggerall = var(9) = 1
triggerall = Numhelper(2351) = 1 || Numhelper(2352) = 1 || Numhelper(2353) = 1 || Numhelper(2354) = 1|| Numhelper(2355) = 1 || Numhelper(2356) = 1
trigger1 = stateno = 2314 && time > 7 && random = [0,250]
value = 2315

[State -2, Telekinesis]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = stateno != 1005
triggerall = p2life > 0
triggerall = P2bodydist y >= -2
triggerall = var(9) = 1
triggerall = ctrl && statetype = S
trigger1 = random = [500,600]
value = ifelse(P2bodydist X <= 150, 2400, 2405)

[State -2, Telekinesis - Acciones]
type = ChangeState
triggerall = var(9) = 1
triggerall = stateno = 2401 && time >= 50
trigger1 = random = [0,800]
value = ifelse(random >= 600, 2440,ifelse(random >=401 && random < 600, 2430, ifelse(random >=201 && random < 400, 2420, 2410)))


[State -2, Kienzan]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl && statetype != A
triggerall = power >= 400
triggerall = numhelper(6550) = 0
trigger1 = P2bodydist x >= 100 && random = [500,600]
trigger2 = stateno = 200 && movecontact && random = [60,150]
trigger3 = stateno = 201 && movecontact && random = [60,150]
trigger4 = stateno = 230 && movecontact && random = [60,150]
trigger5 = stateno = 210 && movecontact && random = [60,150]
trigger6 = stateno = 250 && movecontact && random = [60,150]
trigger7 = stateno = 410 && movecontact && random = [60,150]
trigger8 = stateno = 430 && movecontact && random = [60,150]
value = 2500

;fireball
[state -2]
type = changestate
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1 && power >= 100
triggerall = random = [900,999]
triggerall = ctrl
triggerall = pos y >= -2
trigger1 = P2bodydist X >= 200
value = 1000
;fireball  2
[state -2]
type = changestate
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1 && power >= 100
trigger1 = stateno = 1000 && time > 15 && random = [100,200]
value = 1001
;fireball  3
[state -2]
type = changestate
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = var(9) = 1 && power >= 100
trigger1 = stateno = 1001 && time > 15 && random = [100,200]
value = 1002

;----------------------------------------
;Supers

[State -2, strong daichiretsuzan]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl && statetype != A
triggerall = power >= 1000
trigger1 = P2bodydist x >= 100 && random = [100,600]
trigger2 = stateno = 200 && movecontact && random = [60,150]
trigger3 = stateno = 201 && movecontact && random = [60,150]
trigger4 = stateno = 230 && movecontact && random = [60,150]
trigger5 = stateno = 210 && movecontact && random = [60,150]
trigger6 = stateno = 250 && movecontact && random = [60,150]
trigger7 = stateno = 410 && movecontact && random = [60,150]
trigger8 = stateno = 430 && movecontact && random = [60,150]
value = 3000

[State -2, strong daichiretsuzan]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl && statetype != A
triggerall = power >= 1000
trigger1 = P2bodydist x >= 100 && random = [100,600]
trigger2 = stateno = 200 && movecontact && random = [60,150]
trigger3 = stateno = 201 && movecontact && random = [60,150]
trigger4 = stateno = 230 && movecontact && random = [60,150]
trigger5 = stateno = 210 && movecontact && random = [60,150]
trigger6 = stateno = 250 && movecontact && random = [60,150]
trigger7 = stateno = 410 && movecontact && random = [60,150]
trigger8 = stateno = 430 && movecontact && random = [60,150]
value = 3100

[State -2, Super Nova]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2401 || stateno != 2430 || stateno != 2435
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl
triggerall = power > 2000
trigger1 = P2bodydist x >= 150 && random = [300,800]
trigger2 = stateno = 200 && movecontact && random = [60,150]
trigger3 = stateno = 201 && movecontact && random = [60,150]
trigger4 = stateno = 230 && movecontact && random = [60,150]
trigger5 = stateno = 210 && movecontact && random = [60,150]
trigger6 = stateno = 250 && movecontact && random = [60,150]
trigger7 = stateno = 410 && movecontact && random = [60,150]
trigger8 = stateno = 430 && movecontact && random = [60,150]
trigger9 = stateno = 610 && movecontact && random = [100,200]
trigger10 = stateno = 640 && movecontact && random = [100,200]
trigger11 = stateno = 1150 && (time >= 10) && random = [100,200]
trigger12 = stateno = 500 && movecontact && random = [100,200]
trigger13 = stateno = 530 && movecontact && random = [100,200]
trigger14 = (stateno = 1310)  && (time >= 20) && random = [20,35]
value = 3200

[State -2, Giga Death Blast]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl && statetype = A && pos Y <= -50
triggerall = power >= 2000
trigger1 = random = [100,600]
trigger2 = stateno = 1150 && (time >= 10) && random = [100,200]
trigger3 = (stateno = 1310)  && (time >= 20) && random = [20,35]
value = 3300

[State -2, Death Ball]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl && statetype = A && pos Y <= -50
triggerall = power >= 3000
trigger1 = random = [100,600]
trigger2 = stateno = 1150 && (time >= 10) && random = [100,200]
trigger3 = (stateno = 1310)  && (time >= 20) && random = [20,35]
value = 3400

[State -2, Torvellino Infernal]
type = ChangeState
triggerall = stateno != 3000 ; esto es para que no corte los supers
triggerall = stateno != 3100
triggerall = stateno != 3200 || stateno != 3205
triggerall = stateno != 3300 || stateno != 3310 || stateno != 3320
triggerall = stateno != 3400
triggerall = stateno != 2100 || stateno != 2200 || stateno != 2500
triggerall = stateno != 1100 || stateno != 1110 || stateno != 1130 || stateno != 1140
triggerall = stateno != 1200 || stateno != 1220
triggerall = stateno != 1300 || stateno != 1310
triggerall = stateno != 1400 || stateno != 1450
triggerall = p2life > 0
triggerall = var(9) = 1
triggerall = ctrl && statetype = A
triggerall = power >= 2000
triggerall = p3name = "Cell Perfecto By Team OS"
trigger1 = random = [50,150]
trigger2 = ((StateType != A) && (Ctrl))
value = 3600




;-------------------------------- Inteligencia Artificial --------------------------------------------
;Run Forward
;[State -3:		ChangeState]
;type = ChangeState
;triggerall = (Var(9) = 1) && (StateType != A) && (StateNo != [100,101]) && (P2MoveType != A) && (EnemyNear, NumProj = 0) && (StateNo != [3000,3400])
;triggerall = random = [300,400]
;trigger1 = (P2BodyDist X > 75) && (EnemyNear, Pos Y = 0) && (EnemyNear, Anim = 5300) && (P2MoveType != A)
;trigger2 = ((P2Dist X > 150) || ((P2Dist X > 75) && (P2StateNo = 105)))
;value = 100

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

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

[State -3, Landing Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 52 ;Jump land
trigger2 = stateno = 106 ;Run-back land
value = S40, 1

[State -3, Running Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = StateNo = 100
value = S2,0

[State -3, Remove Explod]
type = RemoveExplod
trigger1 = stateno != 3205
id = 3220

[State -3, Null]
type = Null
;triggerall = (PalNo = [7,12])
trigger1 = (RoundState = 2) && ((Command = "AI2") || (Command = "AI3") || (Command = "AI4") || (Command = "AI5"))
trigger1 = (var(9) := 1)
trigger2 = (RoundState = 2) && ((Command = "AI6") || (Command = "AI7") || (Command = "AI8") || (Command = "AI9") || (Command = "AI10"))
trigger2 = (Var(9) := 1)
trigger3 = ((!Time) * (TicksPerSecond)) && (IsHomeTeam) && (NumEnemy = 1) && (!NumPartner) && (TeamSide = 2) && (Alive)
trigger3 = (Var(9) := 1)
trigger4 = (RoundState = 2) && ((Command = "AI11") || (Command = "AI12") || (Command = "AI13") || (Command = "AI14"))
trigger4 = (Var(9) := 1)





