[Remap] ;These are all mandatory. Do not remove any of them!
x = x
y = y
z = z
a = a
b = b
c = c
s = s

[Defaults]
command.time = 15
command.buffer.time = 1

;======================================;
;         DASHING AND RECOVERY         ;
;======================================;

[Command]
name = "FF"     ;Required (do not remove)
command = F, F
time = 10

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

[Command]
name = "recovery";Required (do not remove)
command = x+y
time = 1

;======================================;
;          DIRECTIONAL INPUTS          ;
;======================================;
[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

;======================================;
;         BUTTON INPUTS          ;
;======================================;

[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

;======================================;

[StateDef -1] ;How the character reads button inputs, or is controlled by the AI.
;A better explanation would be how a character is allowed to change from state to state.

;var(59) = 1 ;AI variable
;var(50) = Difficulty variable

[State -1, AI ON] ; Turn the AI on when
Type = VarSet
TriggerAll = Var(59) < 1; it is not on yet and
TriggerAll = RoundState=2 ; the fight has started and is not over yet and
Trigger1 = AILevel>0 ; the computer is playing the character
v = 59
value= 1 ; value of 1 will mean the AI is on
Ignorehitpause=1

[State -1, AI OFF] ; Turn the AI off when
Type=VarSet
Trigger1=var(59)>0 ; it is on and
Trigger1=RoundState!=2 ; the round is not started yet or is already over
Trigger2=!IsHelper ; OR if we are a player, but
Trigger2=AILevel=0 ; the computer is not in control
v=59
value=0 ; value of 0 will mean the AI is off. values other than 0 and 1 are not used in this example, we have only one AI mode, the normal one.
Ignorehitpause=1

[State -1]
Type=VarSet
Trigger1=1
var(50)=(AILevel=1)*3+(AILevel=2)*7+(AILevel=3)*16+(AILevel=4)*30+(AILevel=5)*58+(AILevel=6)*90+ (AILevel=7)*150+(AILevel=8)*300


;===========================================================================
;---------------------------------------------------------------------------
[State -1, Run Fwd] ;You need a state controller in -1 for a character to load. I used Run Forward as an example.
type = ChangeState
value = 100
trigger1 = var(59) = 0
trigger1 = command = "FF"
trigger1 = statetype = S
trigger1 = ctrl

;---------------------------------------------------------------------------
;SP
[State -1, SP]
type = ChangeState
value = 300
triggerall = var(59) = 0
triggerall = power >= 2000
triggerall = command = "z"
triggerall = command != "holddown"
triggerall = stateno != 300
triggerall = ctrl
trigger1 = statetype != A

;SP Pumpkin Drop
[State -1, SP]
type = ChangeState
value = 305
triggerall = var(59) = 0
triggerall = power >= 500
triggerall = command = "y"
triggerall = command != "holddown"
triggerall = stateno != 309
triggerall = ctrl
trigger1 = statetype != A

;Lob Big Candy
[State -1, Lob Big Candy]
type = ChangeState
value = 220
triggerall = var(59) = 0
triggerall = command = "c"
triggerall = command != "holddown"
triggerall = stateno != 210
triggerall = ctrl
trigger1 = !numhelper(410)
trigger1 = statetype != A

;Lob Candy
[State -1, Lob Candy]
type = ChangeState
value = 210
triggerall = var(59) = 0
triggerall = command = "b"
triggerall = command != "holddown"
triggerall = stateno != 210
triggerall = ctrl
trigger1 = numhelper(400) < 9
trigger1 = statetype != A	

;Swing Swivel
[State -1, Swing Swivel]
type = ChangeState
value = 200
triggerall = var(59) = 0
triggerall = command = "a"
triggerall = command != "holddown"
triggerall = stateno != 200
triggerall = ctrl
trigger1 = statetype != A	

;===========================================================================
;           AI COMMANDS                                                    ;
;===========================================================================
;SP
[State -1, SP]
type = ChangeState
value = 300
triggerall = var(59) > 0
triggerall = power >= 2000
triggerall = P2StateType != L
triggerall = random<var(50)*1.1
triggerall = ctrl
trigger1 = statetype != A

;Pumpkin Drop
[State -1, Pumpkin Drop]
type = ChangeState
value = 304
triggerall = var(59) > 0
triggerall = P2StateType = A
triggerall = stateno != [300,310]
triggerall = stateno != 200
trigger1 = !numhelper(310)

;SP Pumpkin Drop 2
;[State -1, SP Pumpkin Drop 2]
;type = ChangeState
;value = 305
;triggerall = var(59) > 0
;triggerall = power >= 500
;triggerall = P2StateType = A && P2movetype != H
;triggerall = stateno != [300,310]
;triggerall = stateno != 200
;triggerall = !numhelper(310)
;trigger1 = random<var(50)*1.1
;trigger2 = random < 10

;SP Pumpkin Drop
;[State -1, SP]
;type = ChangeState
;value = 305
;triggerall = var(59) > 0
;triggerall = power >= 500
;triggerall = P2StateType = A
;triggerall = ctrl
;trigger1 = statetype = A && movetype = H

;Roll in any direction or dodge
[State -1, AI2]
type = ChangeState
value = 200
triggerall = roundstate = 2
triggerall = var(59) > 0
;triggerall = movetype != H
;triggerall = stateno != 5000 && stateno != 5010 && stateno != 5020 && stateno != 5070 && stateno != 5080 && stateno != 5100
triggerall = (StateType != A)
triggerall = stateno != [300,310]
triggerall = stateno != 200
triggerall = random<var(50)*1.1
trigger1 = random < 400
trigger1 = P2movetype = A
trigger1 = abs(p2bodydist x) < 70
;trigger1 = ctrl
;trigger2 = ctrl
trigger2 = P2movetype = A
trigger2 = random < 650
trigger2 = abs(p2bodydist x) < 70
trigger3 = abs(p2bodydist x) < 60

;---------------------------------------------------------------------------
;Noguard
[State -1]; The engine will still guard by through pressing the back button, we need to disable that.
Type=Assertspecial
Triggerall=StateNo!=[120,160]
Trigger1=var(59)>0
flag=noairguard
flag2=nocrouchguard
flag3=nostandguard

;---------------------------------------------------------------------------
;Lob Candy
[State -1, Lob Candy]
type = ChangeState
value = 210
Triggerall = var(59)>0
triggerall = !Inguarddist
triggerall = ctrl
triggerall = random<var(50)*1.1
trigger1 = numhelper(400) < 9
trigger1 = statetype != A

;Lob Big Candy
[State -1, Lob Big Candy]
type = ChangeState
value = 220
Triggerall = var(59)>0
triggerall = !Inguarddist
triggerall = ctrl
triggerall = random<var(50)*1.1
trigger1 = !numhelper(410)
trigger1 = statetype != A

;AI Charge
[State -1, AI Charge] 
Type=Changestate
value= 0
Triggerall = var(59)>0
triggerall = !Inguarddist
Triggerall = alive = 1
Triggerall = ctrl
triggerall = statetype != A
triggerall = stateno != 0
trigger1 = P2StateType = L
Trigger2 = abs(p2bodydist x) >= 70