;Think of StateDef -2 as, "passive" states.
;They are always active. The trigger conditions are checked every single tick the engine renders.
;One immediate exception to this, is if the character is within an enemy's custom state. (e.g. being thrown.)

[Statedef -2]

[State -2, RemoveAfterImage]
type = AfterImageTime
trigger1 = movetype = H
time = 1
ignorehitpause = 1

[State -2, Null]
type = Null
trigger1 = var(30) = -1
trigger1 = var(30) := (random+1)*(random+1)*(random+1) || 1
trigger1 = 0
;msws
trigger2 = var(30) := var(30) * var(30) 	|| 1
trigger2 = var(34) := var(34) -635641175 	|| 1  
trigger2 = var(30) := var(30) + var(34) 	|| 1
trigger2 = var(31) := 0			|| 1
trigger2 = var(31) := var(31) + ((var(30) & 256) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 512) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 1024) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 2048) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 4096) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 8192) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 16385) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 32768) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 65536) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 131072) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 262144) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 524288) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 1048576) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 2097152) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 4194304) / 256)	|| 1
trigger2 = var(31) := var(31) + ((var(30) & 8388608) / 256)	|| 1
trigger2 = var(30) := var(31)
ignorehitpause = 1
;var(50) should now be a pretty evenly distributed random number between 0 and 65536
;probably better to check against as wide an area as possible instead of using modulo, but modulo *should* work fine i.e
;var(50) = [0,32768) instead of var(50) % 2 = 0 (50%)
;var(50) = [0,21845) instead of var(50) % 3 = 0 (33%)
;you can also offset this to get different results as its only set once per frame
;var(50) = [0,floor(65536*0.6)) is a 60% chance
;var(50) = [8192,8192+floor(65536*0.6)) is also a 60% chance
;note that these 2 together won't *probably* trigger a or b 84% of the time

[State -2, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text =  "fvar(10) = %f"
params = fvar(10)
ignorehitpause = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = var(40)>0
value = SCA,NA,SA,HA,NP,SP,HP
;value2 = S,NA
time = 1

[State 0, LifeAdd]
type = LifeAdd
triggerall = numhelper(271)>0 && time%ifelse(movetype=H,10,3)=0 && life>5
trigger1 = helper(271),stateno < 272
value = 1

[State 0, PalFX]
type = PalFX
trigger1 = var(40)>0
time = 1
add = 128,0,0
mul = 256,0,0
sinadd = 60,0,0,10
invertall = 0
color = 256

[State 0, PalFX]
type = null;PalFX
trigger1 = var(40)>0 && teamside=2
time = 1
add = 0,0,128
mul = 0,0,256
sinadd = 0,0,60,10
invertall = 0
color = 256

[State 0, VarAdd]
type = VarAdd
trigger1 = var(40)>0
v = 40    ;fv = 
value = -1

[State 0, VarAdd]
type = VarSet
trigger1 = stateno = 194
trigger1 = 1
v = 16
value = 1

[State -2, VarSet]
type = VarSet
triggerall = NumHelper(213) >= 1
trigger1 = 1
fv = 10
value = 1.3

[State -2, VarSet]
type = VarSet
triggerall = NumHelper(213) <= 0
trigger1 = 1
fv = 10
value = 1

[State -2, PlaySnd]
type = PlaySnd
triggerall = stateno = 210
triggerall = numhelper(211) = 0
trigger1 = 1
volumescale = 100
value = S210,0+random%3
channel = 0
freqmul = 1.0
loop = 0
pan = 0
abspan = 1

[State -2, PlaySnd]
type = PlaySnd
triggerall = stateno = 200
trigger1 = 1
volumescale = 100
value = S200,2+random%10
channel = 0
freqmul = 1.0
loop = 0
pan = 0
abspan = 1

[State -2, PlaySnd]
type = PlaySnd
trigger1 = time = 0
trigger1 = stateno = 5000 || stateno = 5010 || stateno = 5020 || stateno = 5030 || stateno = 5070
trigger1 = random <= 300
value = S5000,0+random%7
volumescale = 100
channel = 0
freqmul = 1.0
loop = 0
abspan = 1

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nostandguard
flag2 = nocrouchguard
flag3 = noairguard

[State -2, Disconnect]
type = Helper
triggerall = roundstate > 1
Triggerall = time%60 = 0
Triggerall = random < 50
Triggerall = NumHelper(10300) = 0
triggerall = stateno!= 170
triggerall = stateno!= 183
triggerall = stateno!= 184
triggerall = stateno!= 186
triggerall = stateno!= 8899
triggerall = stateno!= 8890
trigger1 = alive = 1
name = "Disconnect"
ID = 10300
stateno = 10300
pos = 0,0
postype = p1
facing = 1
ownpal = 1
size.xscale = 0
size.yscale = 0
ignoreHitPause = 1

[State -2, Votekick]
type = Helper
triggerall = roundstate > 1
Triggerall = time%60 = 0
Triggerall = random < 10
Triggerall = NumHelper(10200) = 0
triggerall = stateno!= 170
triggerall = stateno!= 183
triggerall = stateno!= 184
triggerall = stateno!= 186
triggerall = NumHelper(8888) = 0
triggerall = stateno!= 8899
triggerall = stateno!= 8890
trigger1 = alive = 1
name = "Votekick"
ID = 10200
stateno = 10200
pos = 0,0
postype = p1
facing = 1
ownpal = 1
size.xscale = 0
size.yscale = 0
ignoreHitPause = 1

[State -2, SniperMessages]
type = Helper
triggerall = roundstate > 1
Triggerall = time%5 = 0
Triggerall = NumHelper(10100) <= 4
triggerall = stateno!= 170
triggerall = stateno!= 183
triggerall = stateno!= 184
triggerall = stateno!= 186
triggerall = NumHelper(8888) = 0
triggerall = stateno!= 8899
triggerall = stateno!= 8890
trigger1 = alive = 1
name = "SniperMessages"
ID = 10100
stateno = 10100
pos = 0,0
postype = p1
facing = 1
ownpal = 1
size.xscale = 0
size.yscale = 0
ignoreHitPause = 1

[State -2, VoiceMicspam]
type = Helper
triggerall = var(16) = 0
triggerall = roundstate > 1
Triggerall = time%3 + (random%20) = 0
triggerall = alive = 1
triggerall = stateno!= 170
triggerall = stateno!= 183
triggerall = stateno!= 184
triggerall = stateno!= 186
triggerall = NumHelper(8888) = 0
triggerall = stateno!= 8899
triggerall = stateno!= 8890
Trigger1 = NumHelper(10001) = 0
name = "VoiceMicspam"
ID = 10001
stateno = 10001
pos = 0,-50
postype = back
facing = 1
ownpal = 1
size.xscale = 0
size.yscale = 0
ignoreHitPause = 1

[State -2, SSFSS]
type = Helper
triggerall = roundstate > 1
Triggerall = time%120 = 0
Triggerall = random < 1
Triggerall = NumHelper(10400) = 0
triggerall = stateno!= 170
triggerall = stateno!= 183
triggerall = stateno!= 184
triggerall = stateno!= 186
triggerall = NumHelper(8888) = 0
triggerall = stateno!= 8899
triggerall = stateno!= 8890
trigger1 = alive = 1
name = "SSFSS"
ID = 10400
stateno = 10400
pos = 0,0
postype = p1
facing = 1
ownpal = 1
size.xscale = 0
size.yscale = 0
ignoreHitPause = 1

[Statedef 10001]
type    = S
movetype= I
physics = N
ctrl = 0
velset = 0,0
anim = 10001
sprpriority = -2

[State -2, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 9999999

[State -2, PlaySnd]
type = PlaySnd
Trigger1 = time = 1
triggerall = numhelper(252) = 0 
value = S10000,0+random%7
volumescale = 100
channel = 15
freqmul = 1.0
loop = 0
abspan = 1

[State 0, StopSnd]
type = StopSnd
trigger1 = stateno= 170
trigger2 = stateno= 183
trigger3 = stateno= 184
trigger4 = stateno= 186
trigger5 = NumHelper(8888) = 1
channel = 15


[State -2, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State -2, DestroySelf]
type = DestroySelf
trigger1 = time = 360

[Statedef 10002]
type    = S
movetype= I
physics = N
ctrl = 0
velset = 0,0
anim = 10002
sprpriority = -2

[State -2, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 9999999

[State -2, PlaySnd]
type = PlaySnd
Trigger1 = time = 1
value = S10000,0+random%7
volumescale = 100
channel = -1
freqmul = 1.0
loop = 0
abspan = 1

[State -2, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State -2, DestroySelf]
type = DestroySelf
trigger1 = time = 360

[Statedef 10100]
type    = S
movetype= I
physics = N
ctrl = 0
velset = 0,0
sprpriority = -2

[State -2, BindToRoot]
type = BindToRoot
trigger1 = TIME = 1
time = -1
pos = -60+random%120,0-random%100
ignorehitpause = 1

[State -2, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 9999999

[State 0, Turn]
type = Turn
trigger1 = facing != 1

[State -2, Explod]
type = Explod
trigger1 = time = 1 
anim = 10100+random%47
ID = 10100
postype = p1  
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 0.32,0.32
sprpriority = 0
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0

[State -2, DestroySelf]
type = DestroySelf
trigger1 = time = 20

[Statedef 10200]
type    = S
movetype= I
physics = N
ctrl = 0
velset = 0,0
sprpriority = -1

[State -2, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 9999999

[State -2, Explod]
type = Explod
trigger1 = time = 1
anim = 10200
ID = 10200
postype = left 
facing = 1
vfacing = 1
bindtime = -1
pos = 40,70
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 0.5,0.5
sprpriority = -2
ontop = 0
shadow = 0,0,0
ownpal = 1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 1
volumescale = 100
value = S10200,2
channel = -1
freqmul = 1.0
loop = 0
pan = 0
abspan = 1
[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 1
volumescale = 100
value = S10200,2
channel = -1
freqmul = 1.0
loop = 0
pan = 0
abspan = 1
[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 1
volumescale = 100
value = S10200,2
channel = -1
freqmul = 1.0
loop = 0
pan = 0
abspan = 1

[State 0, PlaySnd]
type = PlaySnd
Trigger1 = time%5 + (random%10) = 0
trigger1 = time < 360
volumescale = 100
value = S10200,1
channel = -1
freqmul = 1.0
loop = 0
pan = 0
abspan = 1

[State 0, PlaySnd]
type = PlaySnd
Trigger1 = time = 360
volumescale = 100
value = S10200,0
channel = -1
freqmul = 1.0
loop = 0
pan = 0
abspan = 1
[State 0, PlaySnd]
type = PlaySnd
Trigger1 = time = 360
volumescale = 100
value = S10200,0
channel = -1
freqmul = 1.0
loop = 0
pan = 0
abspan = 1
[State 0, PlaySnd]
type = PlaySnd
Trigger1 = time = 360
volumescale = 100
value = S10200,0
channel = -1
freqmul = 1.0
loop = 0
pan = 0
abspan = 1


[State -2, DestroySelf]
type = DestroySelf
trigger1 = time = 541
trigger2 = NumHelper(8888) = 1

[Statedef 10300]
type    = S
movetype= I
physics = N
ctrl = 0
velset = 0,0
sprpriority = -2

[State -2, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 9999999

[State -2, Explod]
type = Explod
trigger1 = time = 1
anim = 10300+random%6
ID = 10300
postype = left 
facing = 1
vfacing = 1
bindtime = -1
pos = 5,215
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 0.4,0.4
sprpriority = -2
ontop = 0
shadow = 0,0,0
ownpal = 1

[State 0, Trans]
type = Trans
trigger1 = time >= 241
trigger1 = time%5 = 0
trans = add
alpha = 256-15,256

[State -2, DestroySelf]
type = DestroySelf
trigger1 = time = 400

[Statedef 10400]
type    = S
movetype= I
physics = N
ctrl = 0
velset = 0,0
sprpriority = -1

[State -2, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 9999999

[State -2, Explod]
type = Explod
trigger1 = time = 0
anim = 10400
ID = 10400
postype = left 
facing = 1
vfacing = 1
bindtime = -1
pos = 70,350
vel = 0,-15
accel = 0,0
random = 0,0
removetime = 35
pausemovetime = 0
scale = 0.5,0.5
sprpriority = -1
ontop = 0
shadow = 0,0,0
ownpal = 1
[State -2, Explod]
type = ModifyExplod
trigger1 = time = 20
anim = 10400
ID = 10400
postype = left 
facing = 1
vfacing = 1
bindtime = -1
pos = 70,50
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 0.5,0.5
sprpriority = -1
ontop = 0
shadow = 0,0,0
ownpal = 1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S10400,0
volumescale = 100
channel = -1
;lowpriority = -1
freqmul = 1.0
loop = 0
pan = 0
abspan = 1
[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S10400,0
volumescale = 100
channel = -1
;lowpriority = -1
freqmul = 1.0
loop = 0
pan = 0
abspan = 1

[State -2, DestroySelf]
type = DestroySelf
trigger1 = time = 300
trigger2 = NumHelper(8888) = 1







