;==========================
;下記の記述を取り除くと魔法と攻撃のボタンが逆転します
[Remap]
a = x
b = y
c = z
x = a
y = b
z = c

;AI trigger================
[Command]
name = "AI baby"
command = B,a,b,y
time = 0

[Command]
name = "AI fax"
command = F,a,x
time = 0

[Command]
name = "AI bad"
command = b,a,D
time = 0

[Command]
name = "AI sad"
command = s,a,D
time = 0

[Command]
name = "AI bus"
command = B,U,s
time = 0

[Command]
name = "AI buzz"
command = B,U,z,z
time = 0

[Command]
name = "AI systembusy"
command = s,y,s,B,U,s,y
time = 0

[Command]
name = "AI baca"
command = B,a,c,a
time = 0

[Command]
name = "AI suzy"
command = s,U,z,y
time = 0

[Command]
name = "AIswitch"
command = a,b
time = 0

[Command]
name = "AIswitch"
command = b,c
time = 0

[Command]
name = "AIswitch"
command = a,a,a,a,a,a,a,a,a,a
time = 0

[Command]
name = "AIswitch"
command = b,b,b,b,b,b,b,b,b,b
time = 0


;Hypermotion===============
[Command]
name = "Happa SP"
command = D,DF,F,D,DF,F,a
time = 26

[Command]
name = "R.almond"
command = D,DF,F,D,DF,F,b
time = 26

[Command]
name = "Eat"
command = D,DF,F,D,DF,F,c
time = 26

[Command]
name = "Press"
command = D,DB,B,D,DB,B,a
time = 26
[Command]
name = "Press"
command = D,DB,B,D,DB,B,b
time = 26
[Command]
name = "Press"
command = D,DB,B,D,DB,B,c
time = 26


[Command]
name = "Magic_Overload"
command = D,DB,B,D,DB,B,x
time = 28
[Command]
name = "Magic_Overload"
command = D,DB,B,D,DB,B,y
time = 28
[Command]
name = "Magic_Overload"
command = D,DB,B,D,DB,B,z
time = 28

[Command]
name = "Magic_Nova"
command = D,DF,F,D,DF,F,x
time = 28
[Command]
name = "Magic_Nova"
command = D,DF,F,D,DF,F,y
time = 28
[Command]
name = "Magic_Nova"
command = D,DF,F,D,DF,F,z
time = 28

[Command]
name = "Magic_Recover"
command = B,D,DB,x
time = 15
[Command]
name = "Magic_Recover"
command = B,D,DB,y
time = 15
[Command]
name = "Magic_Recover"
command = B,D,DB,z
time = 15

[Command]
name = "Magic_Shave"
command = D,D,x
time = 15
[Command]
name = "Magic_Shave"
command = D,D,y
time = 15
[Command]
name = "Magic_Shave"
command = D,D,z
time = 15

[Command]
name = "Magic_Power"
command = F,D,DF,x
time = 15
[Command]
name = "Magic_Power"
command = F,D,DF,y
time = 15
[Command]
name = "Magic_Power"
command = F,D,DF,z
time = 15

;Supermotion===============
[Command]
name = "Burst"
command = B,DB,D,DF,F,a
time = 18
[Command]
name = "Burst"
command = B,DB,D,DF,F,b
time = 18
[Command]
name = "Burst"
command = B,DB,D,DF,F,c
time = 18

[Command]
name = "Missile_A"
command = F,D,DF,a
time = 21
[Command]
name = "Missile_A"
command = F,D,DF,b
time = 21


[Command]
name = "Missile_B"
command = F,D,DF,c
time = 21


[Command]
name = "Laser"
command = D,DF,F,a
time = 12
[Command]
name = "Laser"
command = D,DF,F,b
time = 12
[Command]
name = "Laser"
command = D,DF,F,c
time = 12

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

[Command]
name = "leaf"
command = a
time = 12
[Command]
name = "raise hand"
command = b
time = 12
[Command]
name = "tongue"
command = c
time = 12

[Command]
name = "Test"
command = a,b
time = 12



;Required==================
[Command]
name = "FF"
command = F,F
time = 10
[Command]
name = "BB"
command = B,B
time = 10
[Command]
name = "recovery"
command = x+y
time = 1
[Command]
name = "holdfwd"
command = /$F
time = 1
[Command]
name = "holdback"
command = /$B
time = 1
[Command]
name = "holdup"
command = /$U
time = 1
[Command]
name = "holddown"
command = /$D
time = 1

;1Button command==========
[Command]
name = "x"
command = x
time = 1
[Command]
name = "y"
command = y
time = 1
[Command]
name = "z"
command = z
time = 1
[Command]
name = "a"
command = a
time = 1
[Command]
name = "b"
command = b
time = 1
[Command]
name = "c"
command = c
time = 1
[Command]
name = "s"
command = s
time = 1




;=======================
;Specification
;=======================

[Statedef -1]


[State -1, "Happa SP"]
type = ChangeState
value = 3000
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = power >= 1000
triggerall = statetype = S
trigger1 = var(59) = 0 && command = "Happa SP" && ctrl
;Below is AI
; 2 : 適度に近ければ 
trigger2 = ctrl && var(59) > 0 && (p2BodyDist X = [0,60]) && (p2BodyDist Y = [-160,1]) && random < 12

[State -1, "Eat"]
type = ChangeState
value = 3200
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = power >= 1000
triggerall = ctrl
triggerall = statetype = S
trigger1 = command = "Eat"
;Below is AI
; 2:相手が目の前で着地したとき(相手が空中にいて静止しておらず、相手が落下中でxが近く、攻撃中で一定フレーム経過後)
; 3:アーモンド使用後の追撃として、一定フレーム後の敵のおおよその位置から判断して使用
trigger2 = Var(59) > 0 && (p2BodyDist X = [5,80]) && p2StateType = A && EnemyNear,Vel y != 0
trigger2 = (var(5) & 2) = 0 && (Floor(EnemyNear,Pos Y*10 / EnemyNear,Vel y) = [-70,-5])
trigger2 = !((p2BodyDist X = [5,40 - EnemyNear,Vel x*2]) && p2MoveType = A && EnemyNear,Time < (9 - (Random&7)))
trigger3 = var(59) > 0 && (var(5) & 3) = 1 && p2moveType = H && (p2BodyDist X + EnemyNear,vel X * 5 = [0,47]) && (EnemyNear,Pos y + EnemyNear,vel Y * 6 = [-50,50])

[State -1, "R.almond"]
type = ChangeState
value = 3100
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = power >= 1000 && ctrl
triggerall = statetype = S
trigger1 = command = "R.almond"
;Below is AI
; 2:攻撃中に隙を見せた場合 3:脈絡無く(Lv6以上は発生率1/2) 4:相手がやられ吹っ飛び中。アーモンドヒット後に再アーモンドは効かないので抑止されてる
trigger2 = Var(59) > 0 && (var(5) & 1) = 0 && (p2BodyDist Y = [-140,1]) && (EnemyNear,Vel Y = [-9,8]) && p2movetype = A && EnemyNear,Time >= abs(10 - Var(59)) && EnemyNear,AnimTime < -5 
trigger3 = Var(59) > 0 && (var(5) & 1) = 0 && (p2BodyDist X > 30) && (random < 1 + Var(59)%3) && IfElse(Var(59) < 6,(Time & 1)=0,(Time & 3) = 0)
trigger4 = Var(59) > 0 && (var(5) & 1) = 0 && (p2StateNo = [5030,5059]) && (p2BodyDist Y + (EnemyNear,vel y * 4) = [-90,-50]) && EnemyNear,Vel Y = [-9,8]

;[State -1, "AI ONLY - Powercharge" ]
;type = ChangeState
;value = 230
;triggerall = var(53) != 0
;triggerall = var(3) > 757 && var(59) > 0 && ctrl && statetype != A
;triggerall = random < var(59) * 5 + (var(3) < 850) * 30
;triggerall = Power <= 950 && PalNo != 12
;trigger1 = random > (Power / 128) * (10 + (PalNo = 3 || PalNo = 9) * 20)
;trigger1 = Power < 900 || random = 1

[State -1,"MagOverLoad"]
type = ChangeState
value = 4444
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = var(52) > 25
triggerall = statetype = S
trigger1 = var(59) = 0 && command = "Magic_Overload" && ctrl
;Below is AI
; 2:お互いのライフが95%以上の場合。12Pカラーは必要ないので使わない
trigger2 = Var(59) > 0 && ctrl && PalNo != 12 && Life*100/LifeMax > 95 && EnemyNear,Life*100/EnemyNear,LifeMax > 95

[State -1, "MagNova"]
type = ChangeState
value = 3040
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = var(52) >= 10
triggerall = statetype = S
trigger1 = var(59) = 0 && command = "Magic_Nova" && ctrl
;Below is AI
; 2:MAXからのライフ率で5〜30%ぶん劣勢なとき。ただし自分のライフが3割以下の場合は抑制
; 3:脈絡無く使用。2,8Pカラーは使用率が高い。 
; 4:敵の攻撃に合わせて使用。AILVが高くなるほど反応が早く、ばらつきが小さくなる。(使用直後に食らうと技硬直が無くなる使用なので食らった方がおいしい)
trigger2 = var(59) > 0 && ctrl &&  Life*100/LifeMax + (random & 7) + (random & 7) + (random & 3) > 30 && ((Life*100/LifeMax) - (EnemyNear,Life*100/EnemyNear,LifeMax) = [-30,-5])
trigger3 = var(59) > 0 && ctrl && (p2BodyDist x = [-10,48]) && p2MoveType = A && (EnemyNear,Time = [10-Var(59),(10-Var(59))*2+1])
trigger4 = Var(59) > 0 && ctrl && random <= 1 + (PalNo = 2)*2 + (PalNo = 8)*2 && Time&7 < 4



[State -1, "MagPower"]
type = ChangeState
value = 1040
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = var(52) >= 5
triggerall = StateType = S
triggerall = ctrl
trigger1 = var(59) = 0 && command = "Magic_Power" 
;Below is AI
; 2:ゲージがある程度ある場合。かつ、ライフ15%以上。  3:脈絡無く(かなり低確率)。
; いずれも2,8Pカラーは使用率高し。AILv2以下では使用しない。すでに攻撃Up時には抑制。
trigger2 = var(59) > 2 && var(21) = 0 && Power > 200 + (random - (PalNo=2) * 100 - (PalNo=8) * 100) && Life*100/LifeMax > 15
trigger3 = var(59) > 2 && var(21) < 4 &&random < 3 && ((GameTime & 255) = [45 - (PalNo=2) * 12 - (PalNo=8) * 12,53])

[State -1, "MagRecover"]
type = ChangeState
value = 3050
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = var(52) >= 20
triggerall = Statetype = S
triggerall = ctrl
trigger1 = var(59) = 0 && command = "Magic_Recover"
;Below is AI
; 2:敵が離れているか一部のやられ中の場合。かつ、ライフ50%未満。3:脈絡無く(低率)
; 2,8Pカラーは使用率補正。
trigger2 = var(59) > 0 && Life*100/LifeMax < 50 && (p2BodyDist X > 55 || p2StateNo = [5050,5110])
trigger3 = var(59) > 0 && random < 3 && ((GameTime & 255) = [113 - (PalNo=2) * 138 - (PalNo=8) * 12,53])

[State -1, "MagShave"]
type = ChangeState
value = 1030
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = var(52) >= 3
triggerall = statetype = S
triggerall = ctrl
trigger1 = var(59) = 0 && command = "Magic_Shave"
;Below is AI
; 2:敵のゲージが90%または2500(Pal2,8は2200)以上の時。3:脈絡無く。
trigger2 = var(59) > 0 && (EnemyNear,Power*100 / EnemyNear,PowerMax >= 90 || EnemyNear,Power > (2500 - (PalNo=2)*300 - (PalNo=8)*300)) && random < 38 && var(52) & 4 = 0
trigger3 = var(59) > 0 && random = 1 + (PalNo = 2) + (PalNo = 8)

[State -1, "Missile B"]
type = ChangeState
value = 1060
triggerall = var(53) != 0
triggerall = NumProjID(1050) = 0
triggerall = var(3) > 757
triggerall = Power >= 600
triggerall = statetype != A
triggerall = ctrl
trigger1 = var(59) = 0 && command = "Missile_B"
;Below is AI
;2 :そこそこの距離があり、パワーゲージがそこまで多すぎなければ出る。(多くてもライフが少ないと出やすい)
;3 :すでにミサイルが4か8発出ている時に出す。実質12Pカラー専用。64フレームごとに使用するかしないか切り替わる。
trigger2 = var(59) > 0 && (p2BodyDist X = [50 + var(59) * 2,90 + var(59) * 9]) && (random >= Power || (random + var(59) * 8) >= Power + (Life*100/LifeMax) )
trigger3 = var(59) > 7 && Time = 1 && (NumProjID(3040) = 4 || NumProjID(3040) = 8) && (GameTime & 64) = 0


[State -1, "Missile A"]
type = ChangeState
value = 1050
triggerall = var(53) != 0
triggerall = NumProjID(1050) = 0
triggerall = var(3) > 757
triggerall = Power >= 150
triggerall = statetype != A
triggerall = ctrl
trigger1 = var(59) = 0 && command = "Missile_A"
;Below is AI
; 2 : 緊急脱出用。敵よりライフの割合が10%以上低いとき。
; 3 : 遠くにいた敵が急速に迫ったとき。
trigger2 = var(59) > 0 && (p2BodyDist X = [0,95 - Var(59)]) && (p2BodyDist Y + EnemyNear,vel y * 3 = [-40, 15]) && (Life*100 / LifeMax - EnemyNear,Life*100 / EnemyNear,LifeMax = [-50,-10]) && random < 30
trigger3 = var(59) > 0 && p2BodyDist X > 160 && EnemyNear,vel x > 5 && !((Power = [850,1000]) && random > (11 - Var(59))*2)


[State -1]
type = ChangeState
value = 100
triggerall = var(53) != 0
trigger1 = command = "FF"
trigger1 = statetype = S
trigger1 = ctrl
;Below is AI

[State -1]
type = ChangeState
value = 105
triggerall = var(53) != 0
trigger1 = command = "BB"
trigger1 = statetype = S
trigger1 = ctrl
;Below is AI


[State -1, "Burst"]
type = ChangeState
value = 210
triggerall = var(53) != 0
triggerall = NumHelper(200) = 0
triggerall = var(3) > 757
triggerall = Power >= 650
triggerall = Statetype = S
triggerall = ctrl
trigger1 = var(59) = 0 && command = "Burst"
;Below is AI
;2 :多少距離が離れていた場合。ゲージが900以上なら抑制。
trigger2 = var(59) > 0 && (p2BodyDist X = [30 + var(59) * 2,60 + var(59) * 4]) && (power < 900 || random - var(59) > 989)
trigger3 = var(59) > 0 && random = 0

[State -1 "Lifting"]
type = ChangeState
value = 1070
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = NumprojID(240) = 0
triggerall = Power >= 300
triggerall = Statetype = S
triggerall = ctrl
trigger1 = var(59) = 0 && command = "Lifting"
;Below is AI
;2:一定距離(26〜100くらいだが少し後ろに動くのを考慮)。ゲージが満タンに近い場合は抑制。
trigger2 = var(59) > 0 && (p2BodyDist X - (EnemyNear,vel x*2) = [30,87]) && !((Power = [850,1000]) && random > (11 - Var(59))*2) && EnemyNear,Vel y > -2 && random < 14

[State -1, "Powercharge" ]
type = ChangeState
value = 400
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = ctrl && statetype != A
triggerall = PalNo != 12
trigger1 = statetype = C && var(59) = 0 && command = "holddown" && command = "leaf"
trigger2 = statetype = C && var(59) = 0 && command = "holddown" && command = "tongue"
trigger3 = statetype = C && var(59) = 0 && command = "holddown" && command = "raise hand"
;Below is AI
;4:ゲージ750以上では完全に出さない。(離れているorライフ半分以上or敵と背中合わせ)で、ランダムでAIレベルに応じて使う
trigger4 = var(59) > 0 && random > power + 250 && (p2BodyDist X > 60 || Life > LifeMax/2 || Facing = EnemyNear,Facing) && random < 70 + var(59) * 2
trigger5 = var(59) > 0 && power < 750 && Life > 450 && random < 10 && (var(4) = 0 || (random & 3) = 0)

[State -1 "Laser(alpha,beta, or RC)"]
type = ChangeState
value = 200
triggerall = var(53) != 0
triggerall = ctrl
triggerall = var(3) > 757
triggerall = statetype = S
triggerall = Power >= 200
triggerall = NumHelper(200) = 0
trigger1 = var(59) = 0 && command = "Laser"
;Below is AI
;2 : ある程度距離がある場合。
;3 : ある程度距離があり、相手が食らい中で、Projがいくつかある場合(Novaの追撃)
;4 : Eatの後(実質12Pカラー)
trigger2 = EnemyNear,Vel Y != 0
trigger2 = var(59) > 0 && (p2BodyDist Y / EnemyNear,vel Y = [-36,-1]) && p2BodyDist X - EnemyNear,vel X * 2 > 60 + var(59) && random > power + 30
trigger3 = var(59) > 0 && p2BodyDist X > 70 && (p2StateNo = [5000,5999]) && NumProjID(3040) > 3
trigger4 = var(59) > 0 && p2StateNo = 5050 && p2BodyDist X < 15 && EnemyNear,Pos y + EnemyNear,Vel y * 8 = [-45,45]

[State -1, "Big Tongue"]
type = ChangeState
value = 220
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = statetype = S
triggerall = ctrl
trigger1 = var(59) = 0 && command = "tongue" && command != "holddown"
;Below is AI
;50〜130位の距離で当たるが、判定が出るまでが遅い。
trigger2 = var(59) > 0 && (p2BodyDist X + EnemyNear,Vel X * 6 = [60,150]) && Random > EnemyNear,NumProj*180 && random < 40 && EnemyNear,Pos y + EnemyNear,vel y * abs(EnemyNear,Pos y / 32) = [-25,160]

[State -1, "Leaf" ]
type = ChangeState
value = 230
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = statetype = S
triggerall = ctrl
trigger1 = var(59) = 0 && command = "leaf" && command != "holddown"
;Below is AI
trigger2 = var(59) > 0 && (p2BodyDist X = [15,50]) && random < 45
trigger2 = PrevStateNo = 140 && EnemyNear,AnimTime < -8
trigger3 = var(59) > 0 && (p2BodyDist X = [0,50]) && (p2BodyDist Y = [-60,0]) && random < 6


[State -1 "Raise Hand" ]
type = ChangeState
value = 240
triggerall = var(53) != 0
triggerall = var(3) > 757
triggerall = NumprojID(240) = 0
triggerall = statetype = S
triggerall = ctrl
trigger1 = var(59) = 0 && command = "raise hand" && command != "holddown"
;Below is AI
trigger2 = var(59) > 0 && (p2BodyDist X + EnemyNear,Vel X * 3 = [26,100]) && random < 35 && (p2BodyDist Y + EnemyNear,Vel Y * 4 = [-5,65])

[State -1, "Taunt"]
type = ChangeState
value = 500
triggerall = var(53) != 0
trigger1 = command = "s"
trigger1 = statetype != A
trigger1 = ctrl
;Below is AI





;Written by Nicious.
