;======================================
; Touhou 12.3 style Striker Gauge
;======================================
; Code by Ricepigeon. Feel free to edit/modify as long as credit is given.

; Variables:
;
; Var(0) = stores difference between var(1) and var(2) if parent's
;          var(33) is not -1 (when strikers cannot be used). Stores
;          value of -1 otherwise.
; Var(1) = Sets itself -1 when a striker cannot be used. When a
;          striker can be used, sets itself to the parent's var(33)
;          and increases by 1 each tick (since parent's var(33)
;          always decreases by 1 each tick, var(1) sets itself to
;          whatever the parent's var(33) was initialized to when
;          the striker was called.
;          Whenever var(2) is equal to -1, var(1) is set to -1.
; Var(2) = stores the same value as the parent's var(33)

[statedef 10900]
movetype = I
physics = N
anim = 99999
ctrl = 0

[state 10900, VS]
type = null
trigger1 = root,numpartner!=0
trigger1 = (partner,ID) < (root,ID)
trigger1 = partner,authorname = "Kohaku"
trigger1 = var(4):=1

[State 10900, DTCB]
type = displaytoclipboard
trigger1 = 1
text = "Timer: %d \t Timer Max: %d \t Var(2): %d"
params = var(0),var(1),var(2)

[State 10900, Timer Initialize]
type = null
trigger1 = time = 0
trigger1 = var(2) := -1
trigger1 = var(1) := -1
trigger2 = var(2) = -1
trigger2 = var(1) := -1
trigger3 = var(2) > var(1)
trigger3 = var(1) := var(2)

[State 10900, Timer]
type = null
trigger1 = var(2) != -1
trigger1 = var(0) := var(1)-var(2)
trigger2 = var(2) = -1
trigger2 = var(0) := -1

[State 10900, Timer Set]
type = null
trigger1 = 1
trigger1 = var(2) := root,var(33)

[State 10900, Sakuya Bar]
type = explod
trigger1 = time = 0
trigger1 = numexplod(9000)=0
id = 9000
anim = 10910
pos = Ifelse(Teamside = 1,25,295),230-30*(var(4));45
postype = left
scale = 0.5,0.5
ownpal = 1
bindtime = -1
removetime = -1
pausemovetime = -1
supermove = 1
ontop = 1
facing = ifelse(teamside=1,1,-1)

[State 10900, Sakuya Bar Filler]
type = explod
trigger1 = time = 0
id = 9001
anim = 10900
pos = Ifelse(Teamside = 1,25,295),230-30*(var(4));45
postype = left
scale = 0.5,1
ownpal = 1
bindtime = -1
removetime = -1
pausemovetime = -1
supermove = 1
ontop = 1
facing = ifelse(teamside=1,1,-1)

[State 10900, MEX]
type = modifyexplod
trigger1 = 1
id = 9001
scale = (var(0)*1.0/var(1))*0.5,1
;scale = 0.5,1.0

[State 10900, Remilia Bar]
type = explod
trigger1 = time = 0
id = 9010
anim = 10911
pos = Ifelse(Teamside = 1,89,231),230-30*(var(4));45
postype = left
scale = 0.5,0.5
ownpal = 1
bindtime = -1
removetime = -1
pausemovetime = -1
supermove = 1
ontop = 1
facing = ifelse(teamside=1,1,-1)

[State 10900, Remilia Bar Filler]
type = explod
trigger1 = time = 0
id = 9011
anim = 10900
pos = Ifelse(Teamside = 1,89,231),230-30*(var(4));45
postype = left
scale = 0.5,1
ownpal = 1
bindtime = -1
removetime = -1
pausemovetime = -1
supermove = 1
ontop = 1
facing = ifelse(teamside=1,1,-1)

[State 10900, MEX Suwako]
type = modifyexplod
trigger1 = 1
id = 9011
scale = (var(0)*1.0/var(1))*0.5,1

[State 10900, MEX Suwako]
type = modifyexplod
trigger1 = 1
id = 9011
scale = (var(0)*1.0/var(1))*0.5,1

[State 10900, RemoveExplod]
type = RemoveExplod
trigger1 = Roundstate = 4
id = 9000

[State 10900, RemoveExplod]
type = RemoveExplod
trigger1 = Roundstate = 4
id = 9001

[State 10900, RemoveExplod]
type = RemoveExplod
trigger1 = Roundstate = 4
id = 9010

[State 10900, RemoveExplod]
type = RemoveExplod
trigger1 = Roundstate = 4
id = 9011

[State 10900, MEX Sakuya]
type = modifyexplod
trigger1 = 1
id = 9000
trans = addalpha
alpha = 256*(var(2)!=-1),256*(var(2)=-1)

[State 10900, MEX Remilia]
type = modifyexplod
trigger1 = 1
id = 9001
scale = (var( 0)*1.0/var(1))*0.5,1
trans = addalpha
alpha = 256*(var(2)!=-1),256*(var(2)=-1)

[State 10900, MEX Sakuya]
type = modifyexplod
trigger1 = 1
id = 9010
trans = addalpha
alpha = 256*(var(2)!=-1),256*(var(2)=-1)

[State 10900, MEX Remilia]
type = modifyexplod
trigger1 = 1
id = 9011
scale = (var( 0)*1.0/var(1))*0.5,1
trans = addalpha
alpha = 256*(var(2)!=-1),256*(var(2)=-1)
