[Statedef -2]


[State 0, VarSet]
type = null;VarSet
trigger1 = 1
var(52)=3000

[State 0, PowerSet]
type = null;PowerSet
trigger1 = 1
value = 3000
;ignorehitpause = 
;persistent = 


[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "var(31) = %d, var(33) = %d, var(59) = %d"
params = var(31), var(33), var(59)

[State 0, VarRandom]
type = VarRandom
trigger1 = AILEVEL
trigger1 = RoundState <2
v = 59
range = 0,3

[State -2, EXPLODsive Buffering Helper]
type = Helper
trigger1 = !NumHelper(90000005)
stateNo = 90000005
ID = 90000005
name = "EXPLODsive Buffering helper"
posType = P1
facing = ifElse(Facing = 1, 1, -1)
keyCtrl = 1
ignoreHitPause = 1

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = Var(29)=0
id = 9000
ignorehitpause = 1

[State 0, Explod]
type = Explod
triggerall = !NumExplod(98000000)
trigger1 = StateNo = [0,20]
trigger2 = StateNo = [120,152]
anim = 15999
ID = 98000000
removetime = -1
removeongethit = 1
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = StateNo != [0,20]
trigger1 = StateNo != [120,152]
id = 98000000

;training mode detector thanks to 2OS
[State ]
type=null
trigger1=stateno=5900&&time<=2
trigger1=var(36):=0
trigger2=var(36)<3
trigger2=var(36):=var(36)+1
ignorehitpause=1
 
[State ]
type=assertspecial
trigger1=var(36)=1
flag=noko
ignorehitpause=1
 
[State ]
type=lifeset
trigger1=var(36)<=2
value=lifemax*(var(36)=2)
ignorehitpause=1
 
[State ]
type=null
trigger1=var(36)=1
trigger1=var(35):=life
ignorehitpause=1
 
[State ]
type=null;displaytoclipboard
trigger1=1
text="Training Mode=%d 0=No 1=Yes"
params=var(35)
ignorehitpause=1

[State -2,D1]
type = Explod
triggerAll = NumExplod(91111128)
triggerAll = NumHelper(90000005) && !IsHelper && !AILevel
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = Helper(90000005), command = "down" || Helper(90000005), command = "dfwd" || Helper(90000005), command = "dback"
trigger1 = Helper(90000005), command != "up"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = Helper(90000005), command = "up" || Helper(90000005), command = "ufwd" || Helper(90000005), command = "uback"
trigger2 = Helper(90000005), command != "down"
anim = 1
ID = 91111112
removeTime = 20
pauseMoveTime = 20
superMoveTime = 20
ignoreHitPause = 1

;=======================================================
;SSJ3 Zone
;=======================================================

;SSJ3 SHIELD
[State -2, SSJ3 SHIELD]
type = helper
triggerall = Var(29)=1
triggerall = !NumHelper(916)
trigger1 = roundstate=2 ;do not play in winposes
ID = 916
stateno = 916
pos = 0, 0
postype = p1
name = "SSJ3 Shield"
pausemovetime = 999999
supermovetime = 999999
sprpriority = 7
ownpal = 1
keyctrl = 0
ignorehitpause = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = StateNo != 170
trigger1 = fVar(17)=1
trigger1 = Var(29)=0
trigger1 = StateType !=A
trigger1 = StateNo != 5150
trigger1 = !NumExplod(3607)
trigger1 = StateNo != [3690,3999]
trigger1 = enemy, Alive
value = 170
ignorehitpause = 1

[State 0, LifeSet]
type = LifeSet
trigger1 = var(29)=0
trigger1 = fvar(17)=1
trigger1 = StateNo != [3690,3999]
trigger1 = roundstate <3
trigger1 = StateNo != 111
trigger1 = enemy, Alive
value = 0

[State -2, SSJ3 NotHitBy NEW]
type = NotHitBy
trigger1 = Var(29)=1
value = SCA,AT
time = 1
ignorehitpause = 1

[State -2, SSJ3 NotHitBy NEW]
type = NotHitBy
triggerall = Var(29)=1
triggerall = NumHelper(916)
trigger1 = Helper(916),stateno=[916,919]
value = SCA,AA,AP
time = 1
ignorehitpause = 1

[State -2, SSJ3 HitBy NEW]
type = HitBy
triggerall = Var(29)=1
triggerall = NumHelper(916)
trigger1 = Helper(916),stateno=920
value = SCA,AA,AP
time = 1

[State -2, SSJ3 LifeAdd]
type = LifeAdd
trigger1 = NumHelper(916)  ;SSJ3 Shield
trigger1 = Helper(916),stateno=[916,919]
value = -ceil(var(28)/4)
kill = 0
absolute = 0
ignorehitpause = 1

[State 0, HitOverride]
type = HitOverride
trigger1 = Var(26)<=200
trigger1 = Var(29)=1
attr = SCA,AA,AP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = Cond(StateType = A,3611,3610)
time = 1
forceair = 0
ignorehitpause = 1
[State 0, HitOverride]
type = HitOverride
trigger1 = Var(26)>200
trigger1 = Var(29)=1
attr = SCA,AA,AP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 3615
time = 1
forceair = 0
ignorehitpause = 1

[State 0, VarSet]
type = VarSet
trigger1 = Var(26)<0
var(26) = 0

[State 0, VarAdd]
type = VarAdd
trigger1 = NumHelper(916)
trigger1 = Helper(916),stateno=920
trigger1 = Var(26)>0
trigger1 = StateNo != [3610,3619]
trigger1 = GameTime%2 = 0
var(26) = -1

[State 0, VarSet]
type = VarSet
trigger1 = NumHelper(916)
trigger1 = Helper(916),stateno=[916,919]
var(26) = helper(916),Var(1)

[State 0, VarAdd] ;Counter
type = VarAdd
trigger1 = Var(29)=1
trigger1 = StateNo = [3610,3619]
trigger1 = time=1
var(26) = 10   ;Normal 1 hit
ignorehitpause = 1

[State 0, PowerAdd]
type = PowerAdd
triggerall = RoundState = 2
trigger1 = Var(29)=1
trigger1 = StateNo != 3601
trigger1 = StateNo != [3700,3999]
value = -3
ignorehitpause = 1

[State 0, ChangeState]
type = ChangeState
triggerall = Var(29)=1
triggerall = MoveType !=H
triggerall = StateNo != [3690,3999]
triggerall = RoundState = 2
trigger1 = Power = 0
trigger2 = var(35)=1
trigger2 = NumExplod(90012602)
trigger2 = NumExplod(90000210) && NumExplod(90000240) || NumExplod(90000215) && NumExplod(90000245)
trigger2 = StateNo != 3601
value = 3690
ignorehitpause = 1

[State 0, VarSet]
type = VarSet
triggerall = Var(29)=1
trigger1 = RoundState=3
trigger2 = !Alive
var(52) = 0

[State 0, VarSet]
type = VarSet
triggerall = Var(29)=1
trigger1 = MoveType !=H
trigger1 = StateNo = 3690
trigger2 = !Alive
var(29)=0

[State 0, VarSet]
type = VarSet
trigger1 = Power = 0
fvar(38)=0

[State 0, ChangeState]
type = ChangeState
trigger1 = NumProjId(3700)
value = 3700
ignorehitpause = 1

;=======================================================
;Advanced EXPLODsive buffer turning
;=======================================================
;disable MUGEN's hardcoded turning
[State -2, AssertSpecial]
type = AssertSpecial
trigger1 = P2DisT x >= -12
flag = noautoturn

[State -2, No walk during turning animation]
type = PosFreeze
triggerall = MoveType != H
trigger1 = anim=5
trigger2 = anim=3605
value = 1
[State 0, AssertSpecial]
type = AssertSpecial
triggerall = MoveType != H
trigger1 = Anim = 5
flag = nowalk

;When to play standing turn anim
[State -2, ChangeAnim]
type = ChangeAnim
triggerall = MoveType != H
triggerall = Var(29)=0
triggerall = ctrl
triggerall = Anim !=5
triggerall = StateType !=A
trigger1 = prevstateno !=50
trigger1 = P2DisT x < -12
trigger1 = StateNo = [0,20]
trigger1 = (!AILEVEL && !NumExplod(90000001) && !NumExplod(90000002) && !NumExplod(90000003)) || AILEVEL && command != "holddown"
value = 5
;When to play crouching turn anim
[State -2, ChangeAnim]
type = ChangeAnim
triggerall = MoveType != H
triggerall = StateType !=A
trigger1 = Var(29)=0
trigger1 = Anim !=6
trigger1 = P2DisT x < -12
trigger1 = ctrl
trigger1 = StateNo = [0,20]
trigger1 = (!AILEVEL && NumExplod(90000001) || NumExplod(90000002) || NumExplod(90000003)) || AILEVEL && command = "holddown"
value = 6

[State 0, ChangeState]
type = ChangeState
triggerall = MoveType != H
triggerall = Var(29)=0
triggerall = (!AILEVEL && !NumExplod(90000001) && !NumExplod(90000002) && !NumExplod(90000003)) || AILEVEL && command != "holddown"
triggerall = ctrl
triggerall = Anim !=5
triggerall = P2DisT x < -12
triggerall = StateType !=A
trigger1 = StateNo != [0,20]
trigger1 = MoveType = I
value = 0
ctrl = 1
[State 0, ChangeState]
type = ChangeState
triggerall = MoveType != H
triggerall = Var(29)=0
triggerall = (!AILEVEL && NumExplod(90000001) || NumExplod(90000002) || NumExplod(90000003)) || AILEVEL && command = "holddown"
triggerall = ctrl
triggerall = Anim !=6
triggerall = P2DisT x < -12
triggerall = StateType !=A
trigger1 = StateNo != [0,20]
trigger1 = MoveType = I
value = 11
ctrl = 1

;When to play standing turn anim
[State -2, ChangeAnim]
type = ChangeAnim
triggerall = MoveType != H
trigger1 = Var(29)=1
trigger1 = Anim !=3605
trigger1 = P2DisT x < -12
trigger1 = ctrl
trigger1 = StateNo = 3600
trigger1 = StateType !=A
value = 3605

;When to actually turn(notice this is below the turn anim code blocks)
[State -2, Turn]
type = Turn
triggerall = P2DisT x < -12
trigger1 = MoveType != H || (StateNo !=[120,155]) 
trigger1 = StateType != A
trigger1 = ctrl
trigger1 = stateno !=52
trigger1 = StateNo = 3600 || StateNo = [0,20]
trigger2 = PrevStateNo = 5120
trigger2 = ctrl=0


[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = Var(29)=1
flag = nostandguard
flag2 = nocrouchguard
flag3 = noairguard
[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = Var(29)=1
flag = nojugglecheck
flag2 = nowalk

;------------------------------
;Palette Selection Code
[State 0, VarSet]
type = VarSet
triggerall = var(5) = 1
trigger1 = var(58) <= 0
trigger2 = var(58) > 66;when you add a palette increase this number by 1
var(58) = 1

[State 0, VarSet]
type = VarSet
triggerall = var(5) = 1
trigger1 = Facing = -1
trigger1 = P2Name = "Gotenks Z2"
trigger1 = enemy, var(58) = var(58)
var(58) = var(58) + 1

[State 0, VarAdd]
type = VarAdd
triggerall = var(5) = 1
triggerall = RoundState = 1
triggerall = RoundNo = 1
triggerall = !NumExplod(21)
trigger1 = Facing = 1
trigger1 = command = "fwd"
trigger2 = Facing = -1
trigger2 = command = "back"
var(58) = Cond((P2Name = "Gotenks Z2") && enemy, var(58) = var(58) + 10,11,Cond((Var(58) >= 56), -56,10));You will edit this portion Cond((Var(58) >= ##), -##,10)) increase the ## by 1
[State 0, VarAdd]
type = VarAdd
triggerall = var(5) = 1
triggerall = RoundState = 1
triggerall = RoundNo = 1
triggerall = !NumExplod(21)
trigger1 = Facing = 1
trigger1 = command = "back"
trigger2 = Facing = -1
trigger2 = command = "fwd"
var(58) = Cond((P2Name = "Gotenks Z2") && enemy, var(58) = var(58) - 10,-11,Cond((Var(58) <= 10), 56,-10));You will edit this portion Cond((Var(58) <= 10), ##,-10) increase the ## by 1
[State 0, VarAdd]
type = VarAdd
triggerall = var(5) = 1
triggerall = RoundState = 1
triggerall = RoundNo = 1
triggerall = !NumExplod(21)
trigger1 = command = "up"
var(58) = Cond((P2Name = "Gotenks Z2") && enemy, var(58) = var(58) + 1,2,Cond((Var(58) >= 66), -65,1));You will edit this portion Cond((Var(58) >= ##), -##,1)) increase the ## by 1
[State 0, VarAdd]
type = VarAdd
triggerall = var(5) = 1
triggerall = RoundState = 1
triggerall = RoundNo = 1
triggerall = !NumExplod(21)
trigger1 = command = "down"
var(58) = Cond((P2Name = "Gotenks Z2") && enemy, var(58) = var(58) - 1,-2,Cond((Var(58) <= 1), 65,-1));You will edit this portion Cond((Var(58) <= 1), ##,-1)) increase the ## by 1

[State 0, Explod]
type = Explod
triggerall = !NumExplod(21)
triggerall = var(5) = 1
triggerall = RoundState <= 1
triggerall = RoundNo = 1
triggerall = Anim = 0
trigger1 = command = "start"
anim = 1606
ID = 21
removetime = -1

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = RoundState = 2
id = 21
;End of Palette Selection Code
;------------------------------

;ghost taunt gives power
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumProjID(30100)
value = Cond(Var(50)>0,40,10)
ignorehitpause = 1
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumProjID(30101)
value = Cond(Var(50)>0,40,10)
ignorehitpause = 1
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumProjID(30102)
value = Cond(Var(50)>0,40,10)
ignorehitpause = 1
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumProjID(30103)
value = Cond(Var(50)>0,40,10)
ignorehitpause = 1
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumProjID(30104)
value = Cond(Var(50)>0,40,10)
ignorehitpause = 1

[State 0, VarAdd]
type = VarAdd
triggerall = Power>=3000
trigger1 = Var(50)>0
trigger1 = NumProjID(30100)
var(51) = 40
[State 0, VarAdd]
type = VarAdd
triggerall = Power>=3000
trigger1 = Var(50)>0
trigger1 = NumProjID(30101)
var(51) = 40
[State 0, VarAdd]
type = VarAdd
triggerall = Power>=3000
trigger1 = Var(50)>0
trigger1 = NumProjID(30102)
var(51) = 40
[State 0, VarAdd]
type = VarAdd
triggerall = Power>=3000
trigger1 = Var(50)>0
trigger1 = NumProjID(30103)
var(51) = 40
[State 0, VarAdd]
type = VarAdd
triggerall = Power>=3000
trigger1 = Var(50)>0
trigger1 = NumProjID(30104)
var(51) = 40

[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = NumProjID(30100)
var(52) = 30
[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = NumProjID(30101)
var(52) = 30
[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = NumProjID(30102)
var(52) = 30
[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = NumProjID(30103)
var(52) = 30
[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = NumProjID(30104)
var(52) = 30

;ghost taunt gives power
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumProjID(30105)
value = Cond(Var(50)>0,80,40)
ignorehitpause = 1
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumProjID(30106)
value = Cond(Var(50)>0,80,40)
ignorehitpause = 1
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumProjID(30107)
value = Cond(Var(50)>0,80,40)
ignorehitpause = 1
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumProjID(30108)
value = Cond(Var(50)>0,80,40)
ignorehitpause = 1
[State 0, PowerAdd]
type = PowerAdd
trigger1 = NumProjID(30109)
value = Cond(Var(50)>0,80,40)
ignorehitpause = 1

[State 0, VarAdd]
type = VarAdd
triggerall = Power>=3000
trigger1 = Var(50)>0
trigger1 = NumProjID(30105)
var(51) = 80
[State 0, VarAdd]
type = VarAdd
triggerall = Power>=3000
trigger1 = Var(50)>0
trigger1 = NumProjID(30106)
var(51) = 80
[State 0, VarAdd]
type = VarAdd
triggerall = Power>=3000
trigger1 = Var(50)>0
trigger1 = NumProjID(30107)
var(51) = 80
[State 0, VarAdd]
type = VarAdd
triggerall = Power>=3000
trigger1 = Var(50)>0
trigger1 = NumProjID(30108)
var(51) = 80
[State 0, VarAdd]
type = VarAdd
triggerall = Power>=3000
trigger1 = Var(50)>0
trigger1 = NumProjID(30109)
var(51) = 80

[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = NumProjID(30105)
var(52) = 50
[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = NumProjID(30106)
var(52) = 50
[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = NumProjID(30107)
var(52) = 50
[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = NumProjID(30108)
var(52) = 50
[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = NumProjID(30109)
var(52) = 50

;this resets the var so he will go to state 5170 correctly in all instances
 [State -2, System Variable Set]
type = VarSet
trigger1 = StateType = S || Statetype = C
sysvar(0) = 0
ignorehitpause = 1

;air basic juggle limiter
[State 0, VarSet]
type = VarSet
trigger1 = P2MoveType != H
var(1) = 0

;don't miss Volley Ball spike
[State 52, 4]
type = ChangeState
triggerall = StateNo != [3200,3203]
triggerall = Var(9) = 1
triggerall = NumTarget
trigger1 = target, StateNo = 3205
value = 3201
ctrl = 0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = RoundState !=4
trigger1 = WinKo
trigger1 = MoveContact = 1
value = 3003,0+random%4
channel = 0

[State 0, PlaySnd]
type = PlaySnd
triggerall = var(55)=0
triggerall = !Time
trigger1 = Anim = 20
trigger2 = Anim = 21
value = 1,0+random%4
channel = 0

;[State 0, PlaySnd]
;type = PlaySnd
;triggerall = var(55)=2
;triggerall = !Time
;trigger1 = Anim = 20
;trigger2 = Anim = 21
;value = 1,10+random%2
;channel = 0

[State 0, PlaySnd]
type = PlaySnd
triggerall = Anim = 0
triggerall = Time = 432
trigger1 = StageVar(info.name) = "Namek"
trigger2 = StageVar(info.name) = "Namek (Porunga)"
trigger3 = StageVar(info.name) = "Namek dying"
value = 2,0
channel = 0

[State 0, Helper]
type = Helper
trigger1 = !NumHelper(20000)
trigger1 = 1
name = "GhostMaker 20000"
ID = 20000
stateno = 20000
supermovetime = 9999999

;DieDie limiter
[State 0, Explod]
type = ModifyExplod
trigger1 = StateNo != [3100,3110]
trigger1 = P2MoveType != H
anim = 1606
ID = 3111
bindtime = -1
removetime = 40

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = NumHelper(3410)
id = 3111

;DieDie LVL2 limiter
[State 0, Explod]
type = ModifyExplod
trigger1 = StateNo != [3100,3110]
trigger1 = P2MoveType != H
anim = 1606
ID = 3112
bindtime = -1
removetime = 40

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = NumHelper(3410)
id = 3112

;Ghost exist?
[State 0, Explod]
type = Explod
triggerall = !NumExplod(3000)
trigger1 = NumHelper(20000)
trigger1 = helper(20000), Var(53)>0
anim = 1606
ID = 3000
bindtime = -1
removetime = -1

;Air Ki Blast Limiter
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = MoveType = H
trigger2 = StateType != A
trigger3 = NumExplod(1036) = 1
id = 1035
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = MoveType = H
trigger2 = StateType != A
id = 1036
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = MoveType = H
trigger2 = StateType != A
id = 1037

;EX Air Ki Blast Limiter
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = MoveType = H
trigger2 = StateType != A
trigger3 = NumExplod(1038) = 1
id = 1037
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = MoveType = H
trigger2 = StateType != A
id = 1038

;jump link infinite prevention on tall chars--see state 50 in override
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = P2MoveType != H
trigger2 = P2StateType = A
trigger3 = NumHelper(3410)
trigger4 = P2StateNo = 3312 && P2MoveType = H
id = 52

;Ki Blast Combo Limiter
[State 0, Explod]
type = Explod
trigger1 = NumExplod(1033)<7
trigger1 = NumProjID(1033)
anim = 1
ID = 1033
removetime = -1
removeongethit = 1

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = P2MoveType != H
trigger2 = NumHelper(3410)
trigger3 = P2StateNo = 3312 && P2MoveType = H
trigger4 = NumHelper(1110)
trigger5 = NumHelper(1116)
id = 1033

[State 0, VarSet]
type = VarSet
trigger1 = NumExplod(1033)=6
var(1) = 22

;dash cancel limiter
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = P2MoveType != H
trigger2 = NumHelper(3410)
trigger3 = P2StateNo = 3312 && P2MoveType = H
trigger4 = NumHelper(1110)
trigger5 = NumHelper(1116)
id = 220

;jHK state 659 degredation
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = P2MoveType != H
trigger2 = NumHelper(3410)
trigger3 = P2StateNo = 3312 && P2MoveType = H
id = 659

;sj cancel infinite prevention
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = P2MoveType != H
trigger2 = NumHelper(3410)
trigger3 = P2StateNo = 3312 && P2MoveType = H
id = 1000

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = StateNo !=[220,227]
trigger1 = StateNo !=[240,241]
id = 225

;dash SP limiter
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = P2MoveType != H
trigger2 = NumHelper(3410)
trigger3 = P2StateNo = 3312 && P2MoveType = H
id = 270

[State 0, TargetState]
type = TargetState
trigger1 = NumTarget(270)
trigger1 = StateNo!=[120,155]
trigger1 = movehit=1
value = 274

;remove spinning arm
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = StateNo !=224
id = 214
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = StateNo !=224
id = 216
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = StateNo !=224
id = 228

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = Var(18) >0
flag = nojugglecheck

[State 0, VarSet]
type = VarSet
trigger1 = NumProjId(30000)
var(18) = 1

[State 0, VarSet]
type = VarSet
trigger1 = P2MoveType != H
trigger2 = !NumProjId(30000)
var(18) = 0

[State 0, VarSet]
type = VarSet
trigger1 = P2MoveType != H
var(16) = 0

[State -2,U2]
type = Explod
triggerAll = NumExplod(91111118)
triggerAll = NumHelper(90000005) && !IsHelper && !AILevel
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = Helper(90000005), command = "up" || Helper(90000005), command = "ufwd" || Helper(90000005), command = "uback"
trigger1 = Helper(90000005), command != "down"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = Helper(90000005), command = "down" || Helper(90000005), command = "dfwd" || Helper(90000005), command = "dback"
trigger2 = Helper(90000005), command != "up"
anim = 1
ID = 91111128
removeTime = 20
pauseMoveTime = 20
superMoveTime = 20
ignoreHitPause = 1

; ------- Custom State Check --------
[State -2, VarAdd]
type = VarAdd
trigger1 = GameTime
var(48) = 1

[State 0, Explod]
type = Explod
triggerall = !NumExplod(3501)
triggerall = StateNo != [120,155]
trigger1 = enemy, HitDefAttr = SCA,HA,HP,HT
trigger2 = enemy, StateNo = [3000,3999]
anim = 1606
ID = 3501
bindtime = -1
removetime = 10

[State 0, Explod]
type = Explod
trigger1 = NumExplod(3501)
trigger1 = !NumExplod(3502)
trigger1 = MoveType = H
anim = 1606
ID = 3502
bindtime = -1
removetime = -1

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = StateNo = [120,155]
id = 3501
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = MoveType != H
id = 3502

;===============================================================================
; ------- CvS2 Cornerpush System by Vans & Jesuszilla --------
;===============================================================================
[State -2, Reset Time counter]
type = VarSet
trigger1 = movecontact = 1
var(3) = 0

[State -2, Accel]
type = Null; VarSet
triggerall = roundstate = 2
triggerall = numtarget ;>= 1
triggerall = target, HitShakeOver
trigger1 = StateNo != 3000 && StateNo != 3100 && StateNo != 3300 && stateno != 4000
trigger2 = StateNo = 3000 && Time > 45
trigger3 = StateNo = 3100 && Time > 45
trigger4 = StateNo = 3300 && Time > 45
trigger5 = stateno = 4000 && time > 45
fvar(39) = (target,GetHitVar(Xvel)*exp((-0.1886)*((Var(3)))))

[State -2, Push]
type = PosAdd
triggerall = roundstate = 2
triggerall = numtarget >= 1
triggerall = (target, BackEdgeBodyDist <= 0) || (target, FrontEdgeBodyDist <= 0)
triggerall = P2StateType != A
triggerall = Stateno != [1020, 1021]
triggerall = StateNo != 240 
triggerall = StateNo != 251
triggerall = stateno != 440 && Var(4)=1
triggerall = stateno != 441 && Var(4)=1
triggerall = StateNo != [800,839]
triggerall = StateNo != [102,106]
triggerall = StateNo != [1080,1091]
trigger1 = StateNo != 3000 && StateNo != 3100 && StateNo != 3300
trigger2 = StateNo = 3000 && Time > 45
;trigger3 = StateNo = 3100 && Time > 45
trigger3 = StateNo = 3300 && Time > 45
x = ifelse(facing = -1,FVar(39),-FVar(39))

[State -2, Increase]
type = VarSet
triggerall = numtarget ;>= 1
triggerall = target, HitShakeOver
triggerall = Var(3)
trigger1 = StateNo != 3000 && StateNo != 3100 && StateNo != 3300 && stateno != 4000
trigger2 = StateNo = 3000 && Time > 45
trigger3 = StateNo = 3100 && Time > 45
trigger4 = StateNo = 3300 && Time > 45
trigger5 = stateno = 4000 && time > 45
var(3) = Var(3)+1

[State -2, Time counter]
type = VarSet
trigger1 = !Var(3)
trigger1 = FVar(39)
var(3) = 1

[State -2, Freeze Pos During Superpause]
type = PosFreeze
trigger1 = StateNo = 3000 && Time <= 45
trigger2 = StateNo = 3100 && Time <= 45
trigger3 = stateno = 3300 && time <= 45
trigger4 = stateno = 4000 && time <= 45
value = 1

[State -2, Drop]
type = VarSet
triggerall = FVar(39)
trigger1 = !NumTarget
trigger2 = movecontact = 1
trigger3 = projcontact = 1
fvar(39) = 0


;===============================================================================
; ------- Remove various explods --------
;===============================================================================

[state -2, remove Flip KO FX]
type = removeexplod
trigger1 = anim!=5937
id = 5938
[state -2, remove Twist KO FX]
type = removeexplod
trigger1 = anim!=5052
id = 20152

[state -2, remove charge dust]
type = removeexplod
trigger1 = stateno != 900
trigger1 = stateno != 901
trigger1 = stateno != 902
trigger1 = stateno != 903
trigger1 = stateno != 2700
id = 908

[state -2, remove Piccolo]
type = removeexplod
trigger1 = StateNo = 777 || stateno = 778 || stateno = 702  || stateno = 701
id = 2000
[state -2, remove Piccolo]
type = removeexplod
trigger1 = StateNo = 777 || stateno = 778 || stateno = 702  || stateno = 701
id = 19300
[state -2, remove Piccolo]
type = removeexplod
trigger1 = StateNo = 777 || stateno = 778 || stateno = 702  || stateno = 701
id = 19301

;===============================================================================
; ------- SpinSpinSpin --------
;===============================================================================
; Stop Spin SND
[State -2, StopSnd]
type = StopSnd
trigger1 = stateno != 224 && stateno != 1020 
trigger2 = MoveType = H
channel = 2

[State -2, StopSnd]
type = StopSnd
trigger1 = prevstateno = 224 
trigger2 = MoveType = H
channel = 4

;===============================================================================
; ------- Damage Dampener --------
;===============================================================================
 
[State -2, Counter Flag] 
type = VarSet
trigger1 = NumEnemy
fvar(8) = (EnemyNear, MoveType = A)
ignoreHitPause = 1
 
;Damage Dampener Variable (by POTS)
[State -2, Hit Count] 
type = VarAdd 
trigger1 = !IsHelper
trigger1 = MoveHit = 1 
trigger1 = !HitPauseTime 
trigger1 = !(HitDefAttr = SCA, AT) 
trigger2 = NumProjID(1760)
fvar(13) = 1 

[State -2, Hit Count] 
type = VarAdd 
trigger1 = NumProjID(1761)
fvar(13) = -1 
 
[State -2, Hit Count Reset] 
type = VarSet 
trigger1 = NumEnemy && fvar(13) 
trigger1 = (EnemyNear, MoveType != H) && (EnemyNear, StateNo != 5300) 
trigger2 = NumHelper(3410)
trigger2 = helper(3410), StateNo = 3420
trigger2 = helper(3410), Time = 1
fvar(13) = 0
ignoreHitPause = 1
 
[State -2, Dampener] 
type = VarSet 
trigger1 = 1 
fvar(10) = ifElse(fvar(13) < 3, 24, ifElse(fvar(13) >= 23, 1, 24 - fvar(13))) / 24.0 
ignoreHitPause = 1 
 
[State -2, Dampener Limit] 
type = VarSet 
trigger1 = fvar(10) < 0 
fvar(10) = 0 
ignoreHitPause = 1 

[State -2, Root Dampener] 
type = VarSet 
trigger1 = 1 
fvar(11) = fvar(10) * ifElse(fvar(8), 1.2, 1) 
ignoreHitPause = 1


;===============================================================================
; ------- VarSets --------
;===============================================================================

[State -2, L2]
type = Explod
triggerAll = NumExplod(91111116)
triggerAll = NumHelper(90000005) && !IsHelper && !AILevel
trigger1 = Helper(90000005), command = "back" && Helper(90000005), command != "fwd" && Helper(90000005), command != "up" && Helper(90000005), command != "down"
anim = 1
ID = 91111124
removeTime = 20 
pauseMoveTime = 20 
superMoveTime = 20 
ignoreHitPause = 1

;VolleyBall Hyper Max DMG calculator
[State 0, VarSet]
type = VarSet
trigger1 = RoundState=2
trigger1 = Var(25) = 0
var(25) = Ceil((enemy, Life / 100)*30)

[State -2, VarSet Reset ghost var]
type = VarSet
trigger1 = Var(12)>0
var(12) = 0
ignorehitpause = 1

[State -2, Super Jump reset var when Gotenks lands]
type=varset
trigger1= statetype!=A
var(22) = 0

[State -2, Air dash reset var when Gotenks lands]
type=varset
trigger1= statetype!=A
var(10) = 0

[State -2, VarSet]
type = VarSet
trigger1 = MoveType = H 
var(15) = 0

[State -2, 2OS Helper to detect life removal]
type = helper
trigger1 = !numhelper(2)
id = 2
keyctrl = 0
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)
stateno = 2
ignorehitpause = 1
persistent = 1
pausemovetime = 9999999
supermovetime = 9999999

[State -2, 2OS Damage detection]
type = varset
trigger1 = 1
fvar(2) = life - helper(2),var(2)
ignorehitpause = 1
persistent = 1

;Slashing Chop
[State -2, Focus Attack meter reset when no longer charging]
type = VarSet
trigger1 = (stateno !=[1300,1301]) && ((stateno=[5000,5099]) && prevstateno != 1300)
trigger2 = stateno = [100,105]
trigger3 = stateno = 301
fv = 9
value = 0

[State 0, Explod]
type = Explod
triggerALL = NumExplod(91111230)
triggerALL = NumProjID(8008)
trigger1 = command = "start"
anim = 1
ID = 91111195
removetime = 10
pausemovetime = 10
supermovetime = 10
ignorehitpause = 1

[State varset];a.HK juggle limiter
type = VarSet
trigger1= numenemy
trigger1= (enemynear,movetype=H) && var(6)>0
var(7) = 1
[State -2, Reset var when the opponent recovers]
type=varset
trigger1= numenemy
trigger1= (enemynear,movetype!=H)
trigger2= !numenemy
var(7)=0

[State -2, OTG]
type= varset
trigger1= numenemy
trigger1= (enemynear,movetype!=H)
trigger2= movecontact=1 && p2statetype!=L
var(6) = 0
ignorehitpause = 1
[State -2, Free Juggling]
type = assertspecial
trigger1 = var(6)=1
trigger2 = NumProjID(30000)
flag = nojugglecheck
ignorehitpause = 1

;[state -2, P2 ID Single Mode]
;type = varset
;trigger1 = numenemy = 1
;var(28) = (enemy,ID)
 
;[state -2, P2 ID Simul Mode]
;type = varset
;trigger1 = numenemy > 1
;var(28) = (enemy(0),ID)
 
;[state -2, P4 ID Simul Mode]
;type = varset
;trigger1 = numenemy > 1
;var(29) = (enemy(1),ID)

[State -2, Throws Allowed]
type = VarSet
triggerall = numenemy
trigger1 = EnemyNear, MoveType != H
trigger1 = EnemyNear, StateNo != 140
trigger1 = (EnemyNear, ctrl && EnemyNear, Time >= 1) || (EnemyNear, Time >= 8)
trigger2 = EnemyNear, MoveType = A
trigger3 = (EnemyNear, StateNo != [0,52]) && (EnemyNear, StateNo != [120,155]) && (EnemyNear, StateNo != [5000,5120])
trigger4 = var(22)
var(38) = 0

[State -2, Throws Disallowed]
type = VarSet
triggerAll = NumEnemy
trigger1 = EnemyNear, StateNo = [150,155]
trigger2 = (EnemyNear, StateNo = 51 || EnemyNear, StateNo = 140) && (EnemyNear, PrevStateNo = [150, 155])
trigger3 = EnemyNear, MoveType = H && EnemyNear, StateType != A && !var(20) && !var(21) && !var(22)
trigger4 = (EnemyNear, StateNo = [5020,5040]) && EnemyNear, HitFall = 0
trigger5 = EnemyNear, StateNo = 40 && EnemyNear, PrevStateNo != 52 && (EnemyNear, Anim != [0, 29])
var(38) = 1
ignorehitpause = 1

[State -2, KO snd]
type = varset
trigger1 = alive && var(8) > 0
trigger2 = !alive && var(8) < 2
var(8) = ifelse(alive, 0, var(8) + 1)
ignorehitpause = 1

[State 0, Explod]
type = Explod
triggerALL = NumExplod(91111240)
triggerALL = NumHelper(20000)
triggerALL = helper(20000),NumExplod(91111241)
trigger1 = command = "a"
anim = 1
ID = 91111230
removetime = 30
pausemovetime = 30
supermovetime = 30
ignorehitpause = 1

;===============================================================================
; ------- SSJ2 Mode --------
;===============================================================================

[State -2, SSJ2 MODE VARS - Buffer]
type = varset
trigger1 = var(50) < 0
var(50) = 0
ignorehitpause = 1

[State -2, SSJ2 MODE VARS - Zero]
type = varset
trigger1 = var(51)<0
trigger2 = Var(50)<=0
var(51) = 0
ignorehitpause = 1

[State -2, SSJ2 MODE VARS - Zero]
type = varset
trigger1 = var(52)<0
trigger2 = Var(50)<=0
var(52) = 0
ignorehitpause = 1

[State -2, SSJ2 MODE VARS - Flame]
type = varset
trigger1 = var(51)>3000
var(51) = 3000
ignorehitpause = 1

[State -2, SSJ2 MODE VARS - Flame]
type = varset
trigger1 = var(52)>3000
var(52) = 3000
ignorehitpause = 1

[State 0, VarAdd]
type = VarAdd
trigger1 = Var(50)>0
trigger1 = Power >= 3000
trigger1 = MoveType = H && HitShakeOver
trigger1 = Time = 1
var(51) = Cond(GetHitVar(AnimType) = 0,35, 10) 

[State 0, VarSet]
type = VarSet
trigger1 = !Alive
trigger2 = Power <= 0 && Var(51) < 1000
var(50) = 0

;DefenceMulSet fix ; Thanks to Jesuszilla
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive 
triggerall = (FVar(12) - life)>0
trigger1 = Var(50)>0
;trigger1 = Var(51)>=1000
;trigger2 = Power >= 1000
value = floor((0.6 - 1.0) * ifElse((FVar(12)-life) < life, -(FVar(12) - life),0))

[State -2, Combo]
type = VarSet
trigger1 = Var(50)>0
;trigger1 = Var(51)>=1000
;trigger2 = Power >= 1000
fvar(12) = life
ignorehitpause = 1

[State 0, AttackMulSet]
type = AttackMulSet
trigger1 = Var(50)>0
;trigger1 = Var(51)>=2000
;trigger2 = Power >= 2000
value = 1.15

[State 0, RemapPal]
type = RemapPal
trigger1 = teamside = 1
trigger1 = NumHelper(2750)
trigger1 = helper(2750),Var(0)<=0
trigger2 = teamside = 2
trigger2 = NumHelper(2760)
trigger2 = helper(2760),Var(0)<=0
source = 1,1
dest = 1,Var(58)

[State 0, PlaySnd]
type = PlaySnd
trigger1 = P2MoveType = H
trigger1 = enemy, StateNo = 4104
trigger1 = enemy, Time = 1
value = 3700,0


;===============================================================================
; ------- SSJ2 Mode Gauge --------
;===============================================================================

; SSJ2 MODE GAUGE P1
[State -2, Hope Gauge]
type = helper
triggerall = !NumHelper(2750) && teamside = 1
trigger1 = var(50) > 0
ID = 2750
stateno = 2750
pos = 20, 0
postype = left
helpertype = normal
name = "SSJ2"
pausemovetime = 999999
supermovetime = 999999
sprpriority = 7
ownpal = 1
keyctrl = 0
ignorehitpause = 1
size.xscale = 0.5
size.yscale = 0.5

; SSJ2 MODE GAUGE P2
[State -2, Hope Gauge]
type = helper
triggerall = !NumHelper(2760) && teamside = 2
trigger1 = var(50) > 0
ID = 2760
stateno = 2760
pos = 20, 0
postype = left
helpertype = normal
name = "SSJ2"
pausemovetime = 999999
supermovetime = 999999
sprpriority = 7
ownpal = 1
keyctrl = 0
ignorehitpause = 1
size.xscale = 0.5
size.yscale = 0.5


;===============================================================================
; ------- Miscelaneous Stuff --------
;===============================================================================

[State -2, KO snd English]
type = playsnd
triggerall = var(55)=0
trigger1 = !alive && var(8) = 1
trigger1 = var(8) := 2
value = 11, 1 + (1+random%4)*(stateno = 5950)
ignorehitpause = 1
volumescale = 300

[State -2, KO snd English]
type = playsnd
triggerall = var(55)=2
trigger1 = !alive && var(8) = 1
trigger1 = var(8) := 2
value = 11, 10 + (1+random%4)*(stateno = 5950)
ignorehitpause = 1
volumescale = 300

[State -2, ctrlset]
type = CtrlSet
trigger1 = roundstate=0 || roundstate=1
value = 0

[State 1001, stop power charging sound]
type = stopsnd
trigger1 = PrevStateNo = 900 || PrevStateNo = 902 || PrevStateNo = 2700
trigger2 = MoveType = H
channel = 3
persistent = 0

[State 1001, stop power charging sound]
type = stopsnd
trigger1 = PrevStateNo = 900 || PrevStateNo = 902 || PrevStateNo = 2700
trigger2 = MoveType = H
channel = 4
persistent = 0

[State 1001, stop taunt sound]
type = stopsnd
trigger1 = (prevstateno = 195) && (movetype = H)
channel = 4
persistent = 0

[State -2, Explod];State 5052 Twist FX
type = playsnd
trigger1 = anim=5052 && !(gametime%10) && animelemtime(4)>=0
value = 5052,0
volumescale = 100

[State -2, Explod];State 5052 Twist FX
type = Explod
triggerall = NumExplod(20152) = 0
trigger1 = anim=5052 && animelemtime(4)=0
anim = 20152
pos = 0,-50
postype = P1
removetime = -1
;supermovetime = 99999
sprpriority = 3
id = 20152
bindtime = -1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1

[state 17100, Flip KO FX]
type=explod
trigger1 = Anim=5937 && !numexplod(59370) && animelemtime(3)=0
anim = 5938
id = 5938
pos = 0,-50
postype = P1
sprpriority = 3
ownpal = 1
;supermovetime = -1
removetime = -1
persistent = 0
bindtime = -1
ignorehitpause = 1



;================================================================================
; ------- Gotenks only effects --------
;===============================================================================
[State 810, 2] ;P2 Hit Ground Spark (front)
type = Explod
triggerall = Numtarget
triggerall = !NumExplod(8400)
trigger1 = target,StateNo=718 
trigger2 = target,StateNo=3208 && target, Time = 1
persistent = 0
ID = 8400
anim = 8400
postype = p2
pos = -4, -3
velocity = 0, 0
accel = 0, 0
removetime = -2
sprpriority = 3
ignorehitpause = 1
[State 810, 3] ;P2 Hit Ground Spark (back)
type = Explod
triggerall = Numtarget
triggerall = !NumExplod(8401)
trigger1 = target,StateNo=718 
trigger2 = target,StateNo=3208 && target, Time = 1
persistent = 0
ID = 8401
anim = 8401
postype = p2
pos = -4, -3
velocity = 0, 0
accel = 0, 0
removetime = -2
sprpriority = -3
ignorehitpause = 1
 
[State -2, P2 Hit Wall Spark (front)]
type = Explod
triggerall = Numtarget
triggerall = !NumExplod(8402)
trigger1 = target,  StateNo = 1052
trigger2 = target,  StateNo = 1225
ID		= 8402
anim		= 8402
pos		= -20, -50
postype		= p2
velocity	= 0, 0
accel		= 0, 0
removetime	=-2
sprpriority	= 3
ignorehitpause	= 1
persistent	= 0
facing		=-1
[State -2, P2 Hit Wall Spark (back)]
type		= Explod
triggerall	= Numtarget
triggerall = !NumExplod(8403)
trigger1 = target,  StateNo = 1052
trigger2 = target,  StateNo = 1225
ID		= 8403
anim		= 8403
pos		= -20, -50
postype		= p2
velocity	= 0, 0
accel		= 0, 0
removetime	=-2
sprpriority	=-3
ignorehitpause	= 1
persistent	= 0
facing		=-1
 
[State -2, Hitting wall/ground sound effect]
type = PlaySnd
triggerall = NumTarget
triggerall = target, Time = 1
trigger1 = target, StateNo = 1226
;trigger2 = target, StateNo = 652   ;custom state: a.SP
value = 15000, 2
channel	= 23

[state 17100, Shocked FX]
type=explod
trigger1 = (Anim=7696 || anim=9010) && !numexplod(9011)
anim = 9011
id = 9011
pos = 0,0
postype = P1
sprpriority = -5
ownpal = 1
removetime = -1
persistent = 0
bindtime = -1
ignorehitpause = 1

[state 17100, Shocked FX]
type = removeexplod
trigger1 = (Anim != 7696 && anim != 9010) && numexplod(9011)
ID = 9011


;These controllers play the "hit ground" sound effect everytime the enemy hits the ground, 
;during different custom states.
[State -2, Hitting ground sound effect];Strong sound effect, first bounce.
type		= PlaySnd
triggerall          = Enemy, MoveType = H
triggerall	= Enemy, Time = 1
trigger1		= Enemy, StateNo = 652	;custom state: a.SP
trigger2		= Enemy, StateNo = 807	;custom state: bwd throw
trigger3		= Enemy, StateNo = 3208	;custom state: Serve Bounce 1
trigger4		= Enemy, StateNo = 2781	;custom state: Lvl 0 Finisher Gekiretsu Ranbu
value		= 15000, 2
ignorehitpause	= 1
[State -2, Hitting ground sound effect];Medium sound effect, first bounce
type		= PlaySnd
triggerall          = Enemy, MoveType = H
triggerall	= Enemy, Time = 1
trigger1		= Enemy, StateNo = 1115100	;custom state: Dizzy/Stun, falling
value		= 15000, 1
ignorehitpause	= 1
[State -2, Hitting ground sound effect];Weak sound effect, second bounce
type		= PlaySnd
triggerall          = Enemy, MoveType = H
triggerall	= Enemy, Time = 1
trigger1		= Enemy, StateNo = 1115110	;custom state: Dizzy/Stun, falling
trigger2		= Enemy, StateNo = 3209	;custom state: Serve Bounce 2
value		= 15000, 0
ignorehitpause	= 1

[State -2, flash]
type = PalFX
trigger1 = NumHelper(1606) >= 1
add = 40, 30, -40
time=1
ignorehitpause = 1

;===============================================================================
; ------- Compatibility with V.Akiha by Kohaku --------
;===============================================================================

[State -2, LifeAdd]
type = LifeAdd
triggerall = NumEnemy
triggerall = Enemy,AuthorName = "Kohaku" && Enemy,Name = "VAkiha_K"
trigger1 = Enemy,Var(30) = 1
value = -5
kill = 0

[State -2, PowerAdd]
type = PowerAdd
triggerall = NumEnemy
triggerall = Enemy,AuthorName = "Kohaku" && Enemy,Name = "VAkiha_K"
trigger1 = Enemy,Var(30) = 1
value = -26

;=======================================================================
; External coding for Hyper Pause Fixes (Fighting SyN'S Characters only)
;=======================================================================
[State -2, Camera focus on player for Hyper Pause]
type = ScreenBound
triggerall = NumEnemy
triggerall = enemynear,authorname = "ImmortaL -SyN-"
trigger1 = enemynear,numhelper(4999)
value = 1

;===============================================================================
; ------- Compatibility with Warachia by Rajaaboy --------
;===============================================================================

[state -2,RajaaBoy:_Warachia]
type = lifeadd
trigger1 = numenemy
trigger1 = enemy,authorname="RajaaBoy"
trigger1 = enemy,name="RajaaWarachia"
trigger1 = enemy,var(32)=1||enemy,var(33)=1||enemy,var(34)=1
value = (-14*enemy,var(32))+(-21*enemy,var(33))+(-28*enemy,var(34))
kill = 0
ignorehitpause = 1

[state -2,RajaaBoy:_Warachia]
type = poweradd
trigger1 = numenemy
trigger1 = enemy,authorname="RajaaBoy"
trigger1 = enemy,name="RajaaWarachia"
trigger1 = enemy,var(32)=1||enemy,var(33)=1||enemy,var(34)=1
value = 10
ignorehitpause = 1

;===============================================================================
; ------- Super Background Helper Triggers --------
;===============================================================================

; SUPER BG HELPER
[State -2, Hyper Kill bg]
type = helper
triggerall = winKO && !NumHelper(19875)
triggerall = var(19) < 2
triggerall = RoundState = 3
trigger1 = NumProjId(3000) || NumProjId(3001)	
ID = 19875
pos = 20-20*(var(19)=0),-250+250*(var(19)=0)
postype = left
stateno = 19875 + 25*var(19)
helpertype = normal
name = "superbackground"
pausemovetime = 999999
supermovetime = 999999
sprpriority = -5
ownpal = 1
keyctrl = 0
ignorehitpause = 1

; SUPER BG HELPER - Super DBZ Physic
[State -2, Hyper Kill bg]
type = helper
triggerall = winKO && !NumHelper(19875)
triggerall = var(19) = 2
trigger1 = NumProjId(3001) 
ID = 19875
pos = 0,0
postype = left
stateno = 19885
helpertype = normal
name = "superbackground"
pausemovetime = 999999
supermovetime = 999999
sprpriority = -5
ownpal = 1
keyctrl = 0
ignorehitpause = 1
persistent = 0

; SUPER BG HELPER - Super DBZ Ki
[State -2, Hyper Kill bg]
type = helper
triggerall = winKO && !NumHelper(19875)
triggerall = var(19) = 2
triggerall = RoundState = 3
trigger1 = NumProjId(3000) 
ID = 19875
pos =  0,0
postype = left
stateno = 19892
helpertype = normal
name = "superbackground"
pausemovetime = 999999
supermovetime = 999999
sprpriority = -5
ownpal = 1
keyctrl = 0
ignorehitpause = 1
persistent = 0

;===============================================================================
; ------- Display To Clipboard --------
;===============================================================================

[State -2, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = (authorname="Balthazar & Cybaster") || (authorname="Balthazar, Cybaster & XGargoyle")
text = "PrevState=%d, Vel Y=%f, PosX=%d, v1=%d, target=%d\n"
params = PrevStateno, vel y, Pos X, var(1), numtarget ;(Helper(19730),rootdist X) ;19725 ;1000-P2Life ;var(34) ;helper(3331),vel X ;var(4) ;IfElse(WinKO=1,1,0) ; random*(var(53)/4.0)
ignorehitpause = 1

[State -2, Debug]
type = appendtoclipboard
triggerall = var(1) = 1
trigger1 = (authorname="Balthazar & Cybaster") || (authorname="Balthazar, Cybaster & XGargoyle")
text = "by Balthazar & Cybaster - http://network.mugenguild.com/balthazar/"
ignorehitpause = 1

[State -2, VS Thieves]
type = DisplayToClipboard
triggerall = var(1) = 1
trigger1 = ((authorname="Balthazar & Cybaster") || (authorname="Balthazar, Cybaster & XGargoyle")) = 0
text = "This character was created by Balthazar and Cybaster. Don't even try to deny\it thief! Original version available at http://network.mugenguild.com/balthazar/\n"
ignorehitpause = 1

[State -2, Debug]
type = appendtoclipboard
triggerall = var(1) = 2
trigger1 = (authorname="Balthazar & Cybaster") || (authorname="Balthazar, Cybaster & XGargoyle")
text = "by Balthazar & Cybaster & XGargoyle - http://network.mugenguild.com/balthazar/"
ignorehitpause = 1

[State -2, VS Thieves]
type = DisplayToClipboard
triggerall = var(1) = 2
trigger1 = ((authorname="Balthazar & Cybaster") || (authorname="Balthazar, Cybaster & XGargoyle")) = 0
text = "This character was created by Balthazar, Cybaster & XGargoyle. Don't even try to deny\it thief! Original version available at http://network.mugenguild.com/balthazar/\n"
ignorehitpause = 1

[State -2, VarSet];Checks if opponent is in attack state
type = VarSet
triggerall = numenemy
trigger1 = enemy, movetype = A
var(56) = 1
ignorehitpause = 1

[State -2, VarSet];This resets the condition if counter not succesful and succesful
type = VarSet
triggerall = numenemy
trigger1 = enemy, movetype = I || var(57) >= 1  ;Enemy is Idle | Counter was Succesful
trigger2 = var(57) > 10 && enemy, movetype = H  ;10 ticks passed & enemy is on gethit state
var(56) = 0
ignorehitpause = 1

[State -2, VarSet];Counter Hit Succesful
type = VarSet
triggerall = stateno != [3320,3330]  ;Don't activate during Big Bang
trigger1 = var(56) = 1 && movehit ;Counter Check Ok, Move Hit Succesfully.
trigger1 = stateno != [190,199] ;Does not activate during intros.
trigger1 = stateno != [800,820] ;Does not activate during throws.
trigger1 = stateno != [950,951] ;Don't activate during throws.
trigger2 = var(56) = 1 && projhit = 1  ;Counter Check Ok, Projectile Hit Succesfully.
var(57) = 1
ignorehitpause = 1

[State -2, VarAdd];Counter Hit Timer
type = VarAdd
trigger1 = var(57) >= 1 ;Counter was succesful
var(57) = 1
ignorehitpause = 1

[State -2, VarSet];Counter Hit Reset
type = VarSet
trigger1 = var(57) >= 22 && movehit ;Reset if 22 ticks passed and move hit
trigger2 = p2movetype != H ;Reset if P2 is no longer in gethit state
trigger3 = movetype = H ;Reset if P1 is getting hit
trigger4 = var(57) >= 22 && projhit = 1 ;Reset if 22 ticks passed and projectile hit
var(57) = 0
ignorehitpause = 1

[State -2, AssertSpecial];This will award free juggles for Counter Hit.
type = AssertSpecial
trigger1 = var(57) > 0
flag = nojugglecheck

[State -2, EnvColor];This will produce a flash a la KOF2K2
type = EnvColor
triggerall = numenemy
triggerall = stateno != [190,199] ;Does not activate during intros.
triggerall = stateno != [800,820] ;Does not activate during throws.
triggerall = stateno != [950,951] ;Don't activate during throws.
triggerall = stateno != [3320,3330]  ;Don't activate during Big Bang
triggerall = enemy, movetype = h ;Enemy was indeed HIT, otherwise this'd be retarded.
trigger1 = var(56) = 1 && movehit  ;Move hit, Ok
trigger2 = var(56) = 1 && projhit = 1 ;Projectile hit, Ok
value = 255,255,255
time = 1
under = 1
ignorehitpause = 1
persistent = 0

[State -2, Explod];Counter Explod for P1 Side.
type = Explod
triggerall = numenemy
triggerall = var(56) = 1 && numexplod(13000) = 0 && teamside = 1 ;Counter Ok, Explod has not played, P1 Side
triggerall = enemy, movetype = h ;Enemy was indeed HIT, otherwise this'd be retarded.
triggerall = stateno != [800,825] ;Does not activate during throws.
triggerall = stateno != [950,951] ;Does not activate during throws.
trigger1 = movehit ;Move hits
trigger2 = projhit = 1 ;Projectile Hits
anim = 13000
pos = 10,100
postype = left  ;p2,front,back,left,right
removetime = -2
supermove = 1
;scale = 0.5,0.5
sprpriority = 0
id = 13000
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1

[State -2, Explod];Counter Explod for P2 Side.
type = Explod
triggerall = numenemy
triggerall = var(56) = 1 && numexplod(13000) = 0 && teamside = 2 ;Counter Ok, Explod has not played, P2 Side
triggerall = enemy, movetype = h ;Enemy was indeed HIT, otherwise this'd be retarded.
triggerall = stateno != [800,825] ;Does not activate during throws.
triggerall = stateno != [950,951] ;Does not activate during throws.
trigger1 = movehit ;Move hits
trigger2 = projhit = 1 ;Projectile Hits
anim = 13001
pos = -82,100
postype = right  ;p2,front,back,left,right
removetime = -2
supermove = 1
;scale = 0.5,0.5
sprpriority = 0
id = 13000
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1

[State -1, R2]
type = Explod
triggerAll = NumExplod(91111124)
triggerAll = NumProjID(707110)
triggerAll = NumHelper(90000005) && !IsHelper && !AILevel
trigger1 = Helper(90000005), command = "fwd" && Helper(90000005), command != "back" && Helper(90000005), command != "up" && Helper(90000005), command != "down"
anim = 1
ID = 91111126
removeTime = 20 
pauseMoveTime = 20 
superMoveTime = 20 
ignoreHitPause = 1

;===============================================================================
; FIRST ATTACK NOTIFICATION
;===============================================================================

[State -2, First Attack]
type = VarSet
triggerall = Var(27) = 0
triggerall = RoundState = 2
trigger1 = p2stateno = [5000,5199]
trigger1 = p2movetype = H
v = 27
value = 1
ignorehitpause = 1

[State -2, First Attack - in F1 is pressed]
type = VarSet
triggerall = Var(27) = 0
triggerall = RoundState = [0,1]
trigger1 = p2stateno = [5000,5199]
trigger1 = p2movetype = H
v = 27
value = 2
ignorehitpause = 1

[State -2, Explod];P1 Side.
type = Explod
trigger1 = var(27)= 1 && numexplod(13100)=0 && teamside = 1
anim = 13100
pos = 10,ifelse(numexplod(13000),80,100)
postype = left  ;p2,front,back,left,right
removetime = -2
supermove = 1
;scale = 0.5,0.5
sprpriority = 0
id = 13100
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1
persistent = 0

[State -2, Explod];P2 Side.
type = Explod
trigger1 = var(27)= 1 && numexplod(13100)=0 && teamside = 2
anim = 13101
pos = -117,ifelse(numexplod(13000),80,100)
postype = right  ;p2,front,back,left,right
removetime = -2
supermove = 1
;scale = 0.5,0.5
sprpriority = 0
id = 13100
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1
persistent = 0

[State -2, Powaa !!!]
type = PowerAdd
trigger1 = Var(27) = 1
value = 200
persistent = 0

[State -2, First Attack]
type = VarSet
trigger1 = Var(27) = 1
trigger2 = movetype = H && Var(27) = 0 && stateno != [150,159]
v = 27
value = 2

;===============================================================================
; COUNTER HIT (Taken from Vans, who based his on Sander's Method)
;===============================================================================

[State -2, VarSet];Checks if opponent is in attack state
type = VarSet
triggerall = numenemy
trigger1 = enemy, movetype = A
var(56) = 1
ignorehitpause = 1

[State -2, VarSet];This resets the condition if counter not succesful and succesful
type = VarSet
triggerall = numenemy
trigger1 = enemy, movetype = I || var(57) >= 1  ;Enemy is Idle | Counter was Succesful
trigger2 = var(57) > 10 && enemy, movetype = H  ;10 ticks passed & enemy is on gethit state
var(56) = 0
ignorehitpause = 1

[State -2, VarSet];Counter Hit Succesful
type = VarSet
triggerall = stateno != [3320,3330]  ;Don't activate during Big Bang
trigger1 = var(56) = 1 && movehit ;Counter Check Ok, Move Hit Succesfully.
trigger1 = stateno != [190,199] ;Does not activate during intros.
trigger1 = stateno != [800,820] ;Does not activate during throws.
trigger1 = stateno != [950,951] ;Don't activate during throws.
trigger2 = var(56) = 1 && projhit = 1  ;Counter Check Ok, Projectile Hit Succesfully.
var(57) = 1
ignorehitpause = 1

[State -2, VarAdd];Counter Hit Timer
type = VarAdd
trigger1 = var(57) >= 1 ;Counter was succesful
var(57) = 1
ignorehitpause = 1

[State -2, VarSet];Counter Hit Reset
type = VarSet
trigger1 = var(57) >= 22 && movehit ;Reset if 22 ticks passed and move hit
trigger2 = p2movetype != H ;Reset if P2 is no longer in gethit state
trigger3 = movetype = H ;Reset if P1 is getting hit
trigger4 = var(57) >= 22 && projhit = 1 ;Reset if 22 ticks passed and projectile hit
var(57) = 0
ignorehitpause = 1

[State -2, AssertSpecial];This will award free juggles for Counter Hit.
type = AssertSpecial
trigger1 = var(57) > 0
flag = nojugglecheck

[State -2, EnvColor];This will produce a flash a la KOF2K2
type = EnvColor
triggerall = numenemy
triggerall = stateno != [190,199] ;Does not activate during intros.
triggerall = stateno != [800,820] ;Does not activate during throws.
triggerall = stateno != [950,951] ;Don't activate during throws.
triggerall = stateno != [3320,3330]  ;Don't activate during Big Bang
triggerall = enemy, movetype = h ;Enemy was indeed HIT, otherwise this'd be retarded.
trigger1 = var(56) = 1 && movehit  ;Move hit, Ok
trigger2 = var(56) = 1 && projhit = 1 ;Projectile hit, Ok
value = 255,255,255
time = 1
under = 1
ignorehitpause = 1
persistent = 0

[State -2, Explod];Counter Explod for P1 Side.
type = Explod
triggerall = numenemy
triggerall = var(56) = 1 && numexplod(13000) = 0 && teamside = 1 ;Counter Ok, Explod has not played, P1 Side
triggerall = enemy, movetype = h ;Enemy was indeed HIT, otherwise this'd be retarded.
triggerall = stateno != [800,820] ;Does not activate during throws.
triggerall = stateno != [950,951] ;Don't activate during throws.
triggerall = stateno != [3320,3330]  ;Don't activate during Big Bang
trigger1 = movehit ;Move hits
trigger2 = projhit = 1 ;Projectile Hits
anim = 13000
pos = 10,100
postype = left  ;p2,front,back,left,right
removetime = -2
supermove = 1
scale = 0.5,0.5
sprpriority = 0
id = 13000
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1

[State -2, Explod];Counter Explod for P2 Side.
type = Explod
triggerall = numenemy
triggerall = var(56) = 1 && numexplod(13000) = 0 && teamside = 2 ;Counter Ok, Explod has not played, P2 Side
triggerall = enemy, movetype = h ;Enemy was indeed HIT, otherwise this'd be retarded.
triggerall = stateno != [800,820] ;Does not activate during throws.
triggerall = stateno != [950,951] ;Don't activate during throws.
triggerall = stateno != [3320,3330]  ;Don't activate during Big Bang
trigger1 = movehit ;Move hits
trigger2 = projhit = 1 ;Projectile Hits
anim = 13001
pos = -1,100
postype = left  ;p2,front,back,left,right
removetime = -2
supermove = 1
scale = 0.5,0.5
sprpriority = 0
id = 13000
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1

[State 0, Projectile]
type = Projectile
triggerAll = NumExplod(91111124)
triggerAll = NumHelper(90000005) && !IsHelper && !AILevel
trigger1 = Helper(90000005), command = "back" && Helper(90000005), command != "fwd" && Helper(90000005), command != "up" && Helper(90000005), command != "down"
ProjID = 707110
projanim = 1
projremovetime = 10
supermovetime = 10
pausemovetime = 10
ignorehitpause = 1

;===============================================================================
; FIRST ATTACK NOTIFICATION
;===============================================================================

[State -2, First Attack]
type = VarSet
triggerall = Var(27) = 0
triggerall = RoundState = 2
trigger1 = p2stateno = [5000,5199]
v = 27
value = 1
ignorehitpause = 1

[State -2, Explod];P1 Side.
type = Explod
trigger1 = var(27)= 1 && numexplod(13100)=0 && teamside = 1
anim = 13100
pos = 10,ifelse(numexplod(13000),80,100)
postype = left  ;p2,front,back,left,right
removetime = -2
supermove = 1
scale = 0.5,0.5
sprpriority = 0
id = 13100
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1
persistent = 0

[State -2, Explod];P2 Side.
type = Explod
trigger1 = var(27)= 1 && numexplod(13100)=0 && teamside = 2
anim = 13101
pos = -48,ifelse(numexplod(13000),80,100)
postype = left  ;p2,front,back,left,right
removetime = -2
supermove = 1
scale = 0.5,0.5
sprpriority = 0
id = 13100
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1
persistent = 0

[State -2, Powaa !!!]
type = PowerAdd
trigger1 = Var(27) = 1
value = 200
persistent = 0

[State -2, First Attack]
type = VarSet
trigger1 = Var(27) = 1
trigger2 = movetype = H && Var(27) = 0 && stateno != [150,159]
v = 27
value = 2


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

[State -3, Wrong StateType] ;DEBUG
type= null;superpause
triggerall = roundstate=2
trigger1= pos y!=0 && statetype!=A && statetype!=L
trigger1 = StateNo != 224
time= 99999
ignorehitpause= 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = NumHelper(20000)
trigger1 = helper(20000),Var(40)=1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1

;SSJ2 Lightning Aura
[State 2800, lightning aura]
type = explod
triggerall = Alive
triggerall = StateNo != [3700,3999]
triggerall = StateNo != 170 && StateNo != 171
trigger1 = Var(29)=0
trigger1 = Var(50)>0
trigger1 = gametime%(16) = 0
trigger2 = Var(29)=1
trigger2 = gametime%(8) = 0
trigger2 = NumHelper(916)
trigger2 = helper(916), StateNo != 920
anim = 2810+(random%12);2805+(random%4)
id = 2805
pos = 38-(random%76),-95+(Random%80);10-5*(random%5),-55
sprpriority = 4
bindtime = -1
ownpal = 1
removeongethit = 1
ignorehitpause = 1
facing = IfElse(random%2=0,1,-1)
removetime = -2
scale = 0.5+0.1*(random%4), 0.5+0.1*(random%4)
pausemovetime = 99999
supermovetime = 99999

; ------- Custom State Check --------
[State 0, VarSet]
type = VarSet
trigger1 = MoveType != H
var(49) = Var(48)

[State 0, VarAdd]
type = VarAdd
trigger1 = MoveType = H
trigger1 = gametime
var(48) = 1

;This controller plays a sound everytime the player lands from a jump, or from a back-dash.
[State -3, Landing Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 52 ;Jump land
trigger2 = stateno = 106 && prevstateno != 107 ;back dash land and no flik flak
;trigger3 = stateno=0 && prevstateno=5120
trigger3 = stateno = 5201
trigger4 = stateno=130 && ((prevstateno=132)||(prevstateno=[154,155]))
value = 40, 0

[state 52, Land FX]
type = helper
triggerall = Time = 1
trigger1 = stateno = 52
trigger2 = stateno = 106 && prevstateno != 107
trigger3 = stateno = 5201
trigger4= stateno=130 && ((prevstateno=132)||(prevstateno=[154,155]))
trigger5 = StateNo = 1153 
trigger6 = StateNo = 3652
trigger7 = PrevStateNo = 3652
name = "LandFX"
stateno = 17100
id = 17100
postype = P1
ownpal = 1
keyctrl = 0
supermovetime = 99999
pausemovetime = 99999

[State -3,D2]
type = Explod
triggerAll = NumExplod(91111112) 
triggerAll = NumHelper(90000005) && !IsHelper && !AILevel
trigger1 = !NumExplod(92828282) && !NumExplod(92468246)
trigger1 = Helper(90000005), command = "down" || Helper(90000005), command = "dfwd" || Helper(90000005), command = "dback"
trigger1 = Helper(90000005), command != "up"
trigger2 = NumExplod(92828282) || NumExplod(92468246)
trigger2 = Helper(90000005), command = "up" || Helper(90000005), command = "ufwd" || Helper(90000005), command = "uback"
trigger2 = Helper(90000005), command != "down"
anim = 1
ID = 91111122
removeTime = 20
pauseMoveTime = 20
superMoveTime = 20
ignoreHitPause = 1

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

; Fall from airborn SPINSPINSPIN
[State -3, VelAdd]
type = veladd
triggerall = movetype = H && Pos Y < 0
trigger1 = prevstateno = 224 
trigger2 = prevstateno = 221
trigger3 = prevstateno = 222
trigger4 = prevstateno = 223
y = const(movement.yaccel)

; Don't go below ground!
[State -3, posset]
type = posset
triggerall = movetype = H && Pos Y > 0
trigger1 = prevstateno = 224 
trigger2 = prevstateno = 221
trigger3 = prevstateno = 222
trigger4 = prevstateno = 223
y = 0


[State -3, GetHitSnd Light]
type = playsnd
triggerall = var(55)=0		;Voice=English
triggerall = alive && (time = 1)
triggerall = stateno=5000||stateno=5010||stateno=5020||stateno=5070||stateno=5080
trigger1 = numenemy > 0
trigger1 = enemynear,hitdefattr = SCA,SA,HA
trigger2 = gethitvar(animtype)=0 && random<250
value = s5000,random%6
channel = 0
ignorehitpause = 1
persistent = 0
volumescale = 200

[State -3, GetHitSnd Light]
type = playsnd
triggerall = var(55)=2		;Voice=English
triggerall = alive && (time = 1)
triggerall = stateno=5000||stateno=5010||stateno=5020||stateno=5070||stateno=5080
trigger1 = numenemy > 0
trigger1 = enemynear,hitdefattr = SCA,SA,HA
trigger2 = gethitvar(animtype)=0 && random<250
value = s5000,20+random%5
channel = 0
ignorehitpause = 1
persistent = 0
volumescale = 200

[State -3, GetHitSnd Medium]
type = playsnd
triggerall = var(55)=0		;Voice=English
triggerall = alive && (time = 1)
triggerall = stateno=5000||stateno=5010||stateno=5020||stateno=5070||stateno=5080
trigger1 = numenemy > 0
trigger1 = enemynear,hitdefattr = SCA,SA,HA
trigger2 = gethitvar(animtype)=1 && random<375
value = s5000,10+random%5
channel = 0
ignorehitpause = 1
persistent = 0
volumescale = 200

[State -3, GetHitSnd Medium]
type = playsnd
triggerall = var(55)=2		;Voice=English
triggerall = alive && (time = 1)
triggerall = stateno=5000||stateno=5010||stateno=5020||stateno=5070||stateno=5080
trigger1 = numenemy > 0
trigger1 = enemynear,hitdefattr = SCA,SA,HA
trigger2 = gethitvar(animtype)=1 && random<375
value = s5000,24+random%4
channel = 0
ignorehitpause = 1
persistent = 0
volumescale = 200

;[State -3, GetHitSnd Hard]
;type = playsnd
;triggerall = var(55)=0		;Voice=English
;triggerall = alive && (time = 1)
;triggerall = stateno=5000||stateno=5010||stateno=5020||stateno=5070||stateno=5080
;trigger1 = numenemy > 0
;trigger1 = enemynear,hitdefattr = SCA,SA,HA
;trigger2 = gethitvar(animtype)>=2 && random<500
;value = s5000,20+random%7
;channel = 0
;ignorehitpause = 1
;persistent = 0
;volumescale = 200

[State -3, GetHitSnd Hard]
type = playsnd
triggerall = var(55)=2		;Voice=English
triggerall = alive && (time = 1)
triggerall = stateno=5000||stateno=5010||stateno=5020||stateno=5070||stateno=5080
trigger1 = numenemy > 0
trigger1 = enemynear,hitdefattr = SCA,SA,HA
trigger2 = gethitvar(animtype)>=2 && random<500
value = s5000,28+random%5
channel = 0
ignorehitpause = 1
persistent = 0
volumescale = 200

;===============================================================================
; Slashing Chop / Saving Strike code (Part B)
;===============================================================================
[state -3, animelem set frame 1]
type = varset
trigger1 = stateno = 1300 && time = 1
var(23) = 1
 
[state -3, animelem set frame 2]
type = varset
trigger1 = stateno = 1300 && animelem = 2
var(23) = 2

[state -3, animelem set frame 3]
type = varset
trigger1 = stateno = 1300 && animelem = 3
var(23) = 3
 
[State -3, Change to second state]
type = HitOverride
trigger1 = stateno = 1300
attr = SCA,NA,SA,HA,NP,SP,HP
slot = 0
stateno = 1301
time = 1
forceair = 0
ignorehitpause = 1
persistent = 1
 
[state -3, varset for first state]
type = varset
trigger1 = stateno = 1300
var(20) = 1
 
[state -3, varset for second state]
type = varset
trigger1 = stateno = 1301
var(20) = 0

[State -3, health removal in second state]
type = LifeAdd
trigger1 = stateno = 1301
value = -(gethitvar(damage))
kill = 1

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

[state -3, remove afterimage]
type = afterimagetime
trigger1 = Movetype = H
trigger2 = stateno != [10230,10233]  ;Super Jump
trigger2 = stateno != [110,115]  ;air dash
trigger2 = stateno != 50
trigger2 = stateno != [3620,3622]
trigger2 = stateno != 3650
time = 0

[State -3, Prevent Crossup]
type = width
triggerall = numenemy
trigger1 = movetype != H
trigger1 = facing != enemynear, facing
edge = 4, 0
ignorehitpause = 1

[State -3, stopsnd if skip intro]
type = stopsnd
triggerall = stateno=0
trigger1 = prevstateno=[191,194]
;trigger2 = prevstateno=[700,745]
trigger2 = prevstateno=[700,749]
channel = 0
[State -3, stopsnd if skip intro]
type = stopsnd
triggerall = stateno=0
trigger1 = prevstateno=[191,194]
;trigger2 = prevstateno=[700,745]
trigger2 = prevstateno=[700,749]
channel = 1
[State -3, stopsnd if skip intro]
type = stopsnd
triggerall = stateno=0
trigger1 = prevstateno=[191,194]
;trigger2 = prevstateno=[700,745]
trigger2 = prevstateno=[700,749]
channel = 3

[State -3, stopsnd if skip intro]
type = stopsnd
triggerall = stateno=777 || stateno = 778 
trigger1 = Time<200
channel = 0
[State -3, stopsnd if skip intro]
type = stopsnd
triggerall = stateno=777 || stateno = 778 
trigger1 = Time<200
channel = 1
[State -3, stopsnd if skip intro]
type = stopsnd
triggerall = stateno=777 || stateno = 778 
trigger1 = Time<200
channel = 3

[State 730, Explod]
type = Explod
trigger1 = roundstate = 1
trigger1 = !NumExplod(735)
trigger1 = !NumExplod(736)
trigger1 = StateNo = 0
trigger1 = Time <=5
trigger1 = PrevStateNo = 52
anim =  736
ID =  736
pos = -10,-35
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 1,1
sprpriority = 0
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0

[State 730, Explod]
type = Explod
trigger1 = !NumExplod(735)
trigger1 = !NumExplod(737)
trigger1 = StateNo = 2710
trigger1 = Time =99
anim =  736
ID =  737
pos = -10,-35
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 1,1
sprpriority = 0
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0

[State -3, Variable Height]
type= playerpush
triggerall= statetype=A && movetype!=H && numenemy
triggerall= p2bodydist x = [-(enemynear,const(size.ground.back) + enemynear,const(size.ground.front)), 0]; checks if both characters are within each other's width
trigger1= p2statetype=S
trigger1= p2dist y >= (enemynear,const(size.height))
trigger2= p2statetype=C
trigger2= p2dist y >= (enemynear,const(size.height) - 48)
trigger3= p2statetype=L
trigger3= p2dist y >= 11
value= 0
ignorehitpause= 1

;================================================================================
; ------- Cheap K.O. system By Warusaki3 & POTS --------
;===============================================================================
;[State -2, 3]
;type = ChangeState
;trigger1 = !Alive
;trigger1 = PrevStateNo = 130 || PrevStateNo = 131 || PrevStateNo = [150,153]
;trigger1 = StateNo = [5000,5050]
;value = 5950

[State -3, Cheap KO]
type = changestate
trigger1 = !alive && (StateNo = [5000, 5010])
trigger1 = (PrevStateNo = [130, 131]) || (PrevStateNo = [140, 141]) || (PrevStateNo = [150, 153])
value = 5950
ignorehitpause = 1

[State -2,KO]
type = VarSet
triggerall = StateNo = [120,159]
trigger1 = StateType = S
ignorehitpause = 1
fvar(1) = 0

[State -2,KO]
type = VarSet
triggerall = StateNo = [120,159]
trigger1 = StateType = C
ignorehitpause = 1
fvar(1) = 1

[State -2,KO]
type = VarSet
triggerall = StateNo = [120,159]
trigger1 = StateType = A
ignorehitpause = 1
fvar(1) = 2