;---------------------------------------------------------------------------
; Cast button
[statedef 2000]
type = S
movetype = I
physics = S
velset = 0,0
anim = 2000
ctrl = 0

[state 2000, end]
type = changestate
trigger1 = animtime = 0
value = 2001

; Casting
[statedef 2001]
type = S
movetype = I
physics = S
anim = 2001
ctrl = 0

[State 2001, Explod]
type = Explod
trigger1 = time = 0
anim = 2005
ID = 2005
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = Const(size.xscale), Const(size.yscale)
sprpriority = 5
ownpal = 1
trans = addalpha
alpha = 256, 256

[State 2001, Helper]
type = Helper
trigger1 = time = 0
helpertype = normal ;player
name = "castcircle"
ID = 2006
stateno = 2006
pos = 0,0
scale = Const(size.xscale), Const(size.yscale)
bindtime = -1
postype = p1    ;p2,front,back,left,right
facing = 1

[State 2001, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = 2000,0

[state 2001, end]
type = changestate
trigger1 = time >= 100
value = 2002

; Casting end
[statedef 2002]
type = S
movetype = I
physics = S
anim = 2002
ctrl = 0

[state 2001, end]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

;cast circle
[statedef 2006]
type = S
movetype = I
physics = S
anim = 1
ctrl = 0

[State 2001, StartCastCircle]
type = Explod
trigger1 = time = 0
anim = 2006
ID = 2006
pos = -18,-4
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 30
scale = Const(size.xscale), Const(size.yscale)*0.15
sprpriority = -5
ownpal = 1
trans = addalpha
alpha = 0, 256

[State 2001, StartCastCircle]
type = ModifyExplod
trigger1 = time < 20
anim = 2006
ID = 2006
pos = -18,-4
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 30
scale = Const(size.xscale)* (time * .1), Const(size.yscale) * (.15 + (time * .01))
sprpriority = -5
ownpal = 1
trans = addalpha
alpha = time * 6.4, 256

[State 2006, CastCircle]
type = ModifyExplod
trigger1 = time = 20 && (root, stateno = 2001)
anim = 2006
ID = 2006
pos = -18,-4
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 135
scale = 2 * Const(size.xscale), Const(size.yscale) * .35
sprpriority = -5
ownpal = 1
trans = addalpha
alpha = 128,256

[state 2001, set25]
type = varset
trigger1 = root, stateno != 2001
var(7) = time + 25
persistent = 0

[State 0, ModifyExplod]
type = ModifyExplod
;trigger1 = time >= 100
trigger1 = root, stateno != 2001
anim = 2006
ID = 2006
pos = -18,-4
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = var(7);115
scale = 2 * Const(size.xscale), Const(size.yscale) * .35
sprpriority = -5
ownpal = 1
trans = addalpha
alpha = (var(7) - time) * 5.12,256 ;(125 - time) * 5.12,256


[State 2006, DestroySelf]
type = DestroySelf
trigger1 = time >= 125



;---------------------------------------------------------------------------
; Napalm Beat (Move)
[statedef 2010]
type = S
movetype = A
physics = S
anim = 2010
ctrl = 0
poweradd = -50

[State 2010, TextBoxHelper]
type = Helper
trigger1 = time = 0
helpertype = normal ;player
name = "napalmtext"
ID = 2000
stateno = 2012
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[State 2010, NapalmProjectile]
type = Helper
trigger1 = animelem = 13
helpertype = normal ;player
name = "napalmbeat"
ID = 2013
stateno = 2013
pos = -14,-70
postype = p1    ;p2,front,back,left,right
facing = 1

[state 2010, end]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

; Spell text box
[statedef 2012]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0

[state 2012, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2007
removetime = 1

[state 2012, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2012
removetime = 1

[state 2012, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2012, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2012, textbox]
type = Explod
trigger1 = time = 0
anim = 2007
ID = 2007
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2012, textofspell]
type = Explod
trigger1 = time = 0
anim = 2012 ;spell id
ID = 2012
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2012, end]
type = destroyself
trigger1 = time > 70

; Napalm Beat (Projectile)
[statedef 2013]
type = A
movetype = A
physics = N
anim = 2013
ctrl = 0
velset = 6, 0

[State 2013, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 2014
time = 1
ignorehitpause = 1

[state 2013, init]
type = varset
trigger1 = time = 0
var(3) = 0

[State 2013, init]
type = varset
trigger1 = time = 0
v = 1
value = -13

[State 2013, HitDef]
type = HitDef
trigger1 = var(3) < 3 && time = var(1) + 13
attr = S,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
getpower = 0,0
animtype = light          ;light,medium,hard,back,up,diagup
air.animtype = light
priority = 4,Hit   ;Hit,Miss,Dodge
damage = ceil(12 * (root, fvar(4)))
pausetime = 0,5
sparkno = -1
sparkxy = 0,0
hitsound = S2,0
guardsound = S1,0
ground.type = low      ;Low,Trip,None
ground.slidetime = 10
ground.hittime = 10
air.hittime = 20
ground.velocity = -4,0;,-4.5
air.velocity = -4,-9
palfx.time = 30
palfx.mul = 256,128,128
palfx.sinadd = 50,25,25,7

[state 2013, enablehitspark]
type = varset
trigger1 = movecontact = 1
var(7) = var(7) + 1

[state 2013, resethitspark]
type = varset
trigger1 = movecontact != 1
var(7) = 0

[state 2013, nexthit]
type = varset
trigger1 = var(7) = 1
var(1) = time

[state 2013, hitspark]
type = Explod
trigger1 = var(7) = 1
anim = 201
ID = 201
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
random = 120,120
scale = const(size.xscale),const(size.yscale)
sprpriority = 5
ownpal = 1
trans = addalpha
alpha = 256,256
ignorehitpause = 1

[state 2013, napalmspark]
type = Explod
trigger1 = var(7) = 1
anim = 2011
ID = 2011
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
random = 120,120
scale = 2*const(size.xscale),2*const(size.yscale)
sprpriority = 5
ownpal = 1
trans = addalpha
alpha = 256,256
ignorehitpause = 1

[state 2013, increasehits]
type = varset
trigger1 = var(7) = 1
var(3) = var(3) + 1

[state 2013, end]
type = destroyself
trigger1 = time > 500
trigger2 = var(3) >= 3

; Destroy napalm beat
[Statedef 2014]
type    = A
movetype= H
physics = N

[state 2014, destroy]
type = destroyself
trigger1 = 1






;---------------------------------------------------------------------------
; Soul Strike Ground (Move)
[statedef 2020]
type = S
movetype = A
physics = S
anim = 2020
ctrl = 0
poweradd = -300
sprpriority = 0

[State 2020, CastAura]
type = Explod
trigger1 = time = 0
anim = 2005
ID = 2005
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
sprpriority = 1
ownpal = 1
scale = const(size.xscale), const(size.yscale)
trans = addalpha
alpha = 256, 256

[State 2020, TextBoxHelper]
type = Helper
trigger1 = time = 0
helpertype = normal ;player
name = "soulstriketext"
ID = 2000
stateno = 2024
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[State 2020, SoulStrikeMaker]
type = Helper
trigger1 = time = 8
helpertype = normal ;player
name = "soulstrikemaker"
ID = 2021
stateno = 2021
pos = const(size.mid.pos.x),const(size.mid.pos.y)
postype = p1    ;p2,front,back,left,right
facing = 1

[state 2020, castdelay]
type = varset
trigger1 = time = 0
var(8) = cond(var(19) = 2, 180, 135)

[state 2020, end]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

; Soul Striker Maker
[statedef 2021]
type = A
movetype = A
physics = N
anim = 2
ctrl = 0

[State 2012, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[State 2021, Strike]
type = Helper
trigger1 = time = 0
trigger2 = time = 8
trigger3 = time = 16
trigger4 = time = 24
trigger5 = time = 32
helpertype = normal ;player
name = "soulstrikeball"
ID = 2022
stateno = 2022
pos = const(size.mid.pos.x),const(size.mid.pos.y)
postype = p1    ;p2,front,back,left,right
facing = 1

[state 2021, SoulStrikeSound]
type = playsnd
trigger1 = time = 0
trigger2 = time = 8
trigger3 = time = 16
trigger4 = time = 24
trigger5 = time = 32
value = 2020,0

[state 2021, end]
type = destroyself
trigger1 = time > 40

; Soul Strike Ball
; Since this is a helper, it can disregard all variables used by the root
;  and use its own variables how it likes. Since there are 20 orbs, there
;  will be 38 variables in use to get the position of the 19 other orbs.
;  fvar(0)  - y acceleration
;  var(0) - 0 if soul strike still going, 1 otherwise
;  var(1) - x pos of 2nd orb
;  var(2) - y pos of 2nd orb
;  var(3-38) - x and y pos of subsequent orbs
;  var(39&40) - x and y positions for integer calculations)
; Soul Strike Ball
[statedef 2022]
type = A
movetype = A
physics = N
anim = 2026
ctrl = 0

[State 2022, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 2027
time = 1
ignorehitpause = 1
persistent = 1

[state 2022, inithitdefstate]
type = varset
trigger1 = time = 0 && var(0) = 0
var(41) = 0

[state 2022, sethitdefstate]
type = varset
trigger1 = enemynear, stateno != 100
var(41) = var(41) + 1
ignorehitpause = 1

[state 2022, unhit]
type = changestate
trigger1 = (var(41)) && enemynear, stateno = 100 && var(0) = 0
value = 2022

[state 2022, inityvar]
type = varset
trigger1 = var(42) = 0
fvar(0) = (random / 75.0) + 7.5

[state 2022, yvelset]
type = velset
trigger1 = var(42) = 0
y = fvar(0) * -1
x = -25

[state 2022, secondyvar]
type = varset
trigger1 = var(42) = 20
fvar(0) = ( ( (p2bodydist y) + (enemynear, const(size.mid.pos.y) ) + ((random * 18 / 40) - 225) ) * 25) / (p2bodydist x)

[state 2022, xorb20]
type = varset
trigger1 = 1
var(37) = var(35)

[state 2022, yorb20]
type = varset
trigger1 = 1
var(38) = var(36)

[state 2022, xorb19]
type = varset
trigger1 = 1
var(35) = var(33)

[state 2022, yorb19]
type = varset
trigger1 = 1
var(36) = var(34)

[state 2022, xorb18]
type = varset
trigger1 = 1
var(33) = var(31)

[state 2022, yorb18]
type = varset
trigger1 = 1
var(34) = var(32)

[state 2022, xorb17]
type = varset
trigger1 = 1
var(31) = var(29)

[state 2022, yorb17]
type = varset
trigger1 = 1
var(32) = var(30)

[state 2022, xorb16]
type = varset
trigger1 = 1
var(29) = var(27)

[state 2022, yorb16]
type = varset
trigger1 = 1
var(30) = var(28)

[state 2022, xorb15]
type = varset
trigger1 = 1
var(27) = var(25)

[state 2022, yorb15]
type = varset
trigger1 = 1
var(28) = var(26)

[state 2022, xorb14]
type = varset
trigger1 = 1
var(25) = var(23)

[state 2022, yorb14]
type = varset
trigger1 = 1
var(26) = var(24)

[state 2022, xorb13]
type = varset
trigger1 = 1
var(23) = var(21)

[state 2022, yorb13]
type = varset
trigger1 = 1
var(24) = var(22)

[state 2022, xorb12]
type = varset
trigger1 = 1
var(21) = var(19)

[state 2022, yorb12]
type = varset
trigger1 = 1
var(22) = var(20)

[state 2022, xorb11]
type = varset
trigger1 = 1
var(19) = var(17)

[state 2022, yorb11]
type = varset
trigger1 = 1
var(20) = var(18)

[state 2022, xorb10]
type = varset
trigger1 = 1
var(17) = var(15)

[state 2022, yorb10]
type = varset
trigger1 = 1
var(18) = var(16)

[state 2022, xorb9]
type = varset
trigger1 = 1
var(15) = var(13)

[state 2022, yorb9]
type = varset
trigger1 = 1
var(16) = var(14)

[state 2022, xorb8]
type = varset
trigger1 = 1
var(13) = var(11)

[state 2022, yorb8]
type = varset
trigger1 = 1
var(14) = var(12)

[state 2022, xorb7]
type = varset
trigger1 = 1
var(11) = var(9)

[state 2022, yorb7]
type = varset
trigger1 = 1
var(12) = var(10)

[state 2022, xorb6]
type = varset
trigger1 = 1
var(9) = var(7)

[state 2022, yorb6]
type = varset
trigger1 = 1
var(10) = var(8)

[state 2022, xorb5]
type = varset
trigger1 = 1
var(7) = var(5)

[state 2022, yorb5]
type = varset
trigger1 = 1
var(8) = var(6)

[state 2022, xorb4]
type = varset
trigger1 = 1
var(5) = var(3)

[state 2022, yorb4]
type = varset
trigger1 = 1
var(6) = var(4)

[state 2022, xorb3]
type = varset
trigger1 = 1
var(3) = var(1)

[state 2022, yorb3]
type = varset
trigger1 = 1
var(4) = var(2)

[state 2022, xorb2]
type = varset
trigger1 = 1
var(1) = pos x

[state 2022, yorb2]
type = varset
trigger1 = 1
var(2) = pos y

[state 2022, veladd]
type = veladd
trigger1 = var(0) = 0
x = 1.25
y = fvar(0) / 20.0

[state 2022, explod1]
type = Explod
trigger1 = var(0) = 0
anim = 2021
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 3
ignorehitpause = 1

[state 2022, getintx]
type = varset
trigger1 = 1
var(39) = pos x

[state 2022, getinty]
type = varset
trigger1 = 1
var(40) = pos y

[state 2022, explod2]
type = Explod
triggerall = var(1) != 0 && var(2) != 0
trigger1 = var(1) != var(39)
trigger1 = var(2) != var(40)
anim = 2021
pos = facing * (var(1) - pos x),var(2) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .95 * const(size.xscale),.95 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod3]
type = Explod
triggerall = var(3) != 0 && var(4) != 0
trigger1 = var(3) != var(39)
trigger1 = var(4) != var(40)
anim = 2021
pos = facing * (var(3) - pos x),var(4) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .90 * const(size.xscale),.90 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod4]
type = Explod
triggerall = var(5) != 0 && var(6) != 0
trigger1 = var(5) != var(39)
trigger1 = var(6) != var(40)
anim = 2021
pos = facing * (var(5) - pos x),var(6) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .85 * const(size.xscale),.85 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod5]
type = Explod
triggerall = var(7) != 0 && var(8) != 0
trigger1 = var(7) != var(39)
trigger1 = var(8) != var(40)
anim = 2021
pos = facing * (var(7) - pos x),var(8) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .80 * const(size.xscale),.80 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod6]
type = Explod
triggerall = var(9) != 0 && var(10) != 0
trigger1 = var(9) != var(39)
trigger1 = var(10) != var(40)
anim = 2021
pos = facing * (var(9) - pos x),var(10) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .75 * const(size.xscale),.75 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod7]
type = Explod
triggerall = var(11) != 0 && var(12) != 0
trigger1 = var(11) != var(39)
trigger1 = var(12) != var(40)
anim = 2021
pos = facing * (var(11) - pos x),var(12) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .7 * const(size.xscale),.7 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod8]
type = Explod
triggerall = var(13) != 0 && var(14) != 0
trigger1 = var(13) != var(39)
trigger1 = var(14) != var(40)
anim = 2021
pos = facing * (var(13) - pos x),var(14) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .65 * const(size.xscale),.65 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod9]
type = Explod
triggerall = var(15) != 0 && var(16) != 0
trigger1 = var(15) != var(39)
trigger1 = var(16) != var(40)
anim = 2021
pos = facing * (var(15) - pos x),var(16) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .6 * const(size.xscale),.6 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod10]
type = Explod
triggerall = var(17) != 0 && var(18) != 0
trigger1 = var(17) != var(39)
trigger1 = var(18) != var(40)
anim = 2021
pos = facing * (var(17) - pos x),var(18) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .55 * const(size.xscale),.55 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod11]
type = Explod
triggerall = var(19) != 0 && var(20) != 0
trigger1 = var(19) != var(39)
trigger1 = var(20) != var(40)
anim = 2021
pos = facing * (var(19) - pos x),var(20) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .5 * const(size.xscale),.5 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod12]
type = Explod
triggerall = var(21) != 0 && var(22) != 0
trigger1 = var(21) != var(39)
trigger1 = var(22) != var(40)
anim = 2021
pos = facing * (var(21) - pos x),var(22) - pos y
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .45 * const(size.xscale),.45 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod13]
type = Explod
triggerall = var(23) != 0 && var(24) != 0
trigger1 = var(23) != var(39) && var(24) != var(40)
pos = facing * (var(23) - pos x), var(24) - pos y
anim = 2021
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .4 * const(size.xscale),.4 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod14]
type = Explod
triggerall = var(25) != 0 && var(26) != 0
trigger1 = var(25) != var(39) && var(26) != var(40)
pos = facing * (var(25) - pos x), var(26) - pos y
anim = 2021
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .35 * const(size.xscale),.35 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod15]
type = Explod
triggerall = var(27) != 0 && var(28) != 0
trigger1 = var(27) != var(39) && var(28) != var(40)
pos = facing * (var(27) - pos x), var(28) - pos y
anim = 2021
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .30 * const(size.xscale),.30 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod16]
type = Explod
triggerall = var(29) != 0 && var(30) != 0
trigger1 = var(29) != var(39) && var(30) != var(40)
pos = facing * (var(29) - pos x), var(30) - pos y
anim = 2021
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .25 * const(size.xscale),.25 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod17]
type = Explod
triggerall = var(31) != 0 && var(32) != 0
trigger1 = var(31) != var(39) && var(32) != var(40)
pos = facing * (var(31) - pos x), var(32) - pos y
anim = 2021
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .20 * const(size.xscale),.20 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod18]
type = Explod
triggerall = var(33) != 0 && var(34) != 0
trigger1 = var(33) != var(39) && var(34) != var(40)
pos = facing * (var(33) - pos x), var(34) - pos y
anim = 2021
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .15 * const(size.xscale),.15 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod19]
type = Explod
triggerall = var(35) != 0 && var(36) != 0
trigger1 = var(35) != var(39) && var(36) != var(40)
pos = facing * (var(35) - pos x), var(36) - pos y
anim = 2021
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .10 * const(size.xscale),.10 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[state 2022, explod20]
type = Explod
triggerall = var(37) != 0 && var(38) != 0
trigger1 = var(37) != var(39) && var(38) != var(40)
pos = facing * (var(37) - pos x), var(38) - pos y
anim = 2021
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = 1
scale = .05 * const(size.xscale),.05 * const(size.yscale)
sprpriority = 2
ignorehitpause = 1

[State 2022, HitDef]
type = HitDef
trigger1 = var(41) = 1 && var(0) = 0 ;enemynear, stateno != 100 ;time = 0
attr = A,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
getpower = 0,0
animtype = medium          ;light,medium,hard,back,up,diagup
air.animtype = medium
priority = 3,Miss   ;Hit,Miss,Dodge
damage = ceil(54 * (root, fvar(4))), ceil(5 * (root, fvar(4)))
pausetime = 5,5
sparkno = S201
sparkxy = 40,0
hitsound = S2, ifelse(random < 500, 0, 1)
guardsound = S1,0
ground.type = high      ;Low,Trip,None
ground.slidetime = 10
ground.hittime = 10
air.hittime = 20
ground.velocity = -10,0;,-4.5
air.velocity = -6,-12
ignorehitpause = 1
persistent = 0

[state 2022, increasevar]
type = varset
trigger1 = var(0) > 0
var(0) = var(0) + 1
ignorehitpause = 1

[state 2022, StopSoulStrike]
type = varset
triggerall = var(0) = 0
trigger1 = movecontact
trigger2 = pos y >= 0
var(0) = 1
ignorehitpause = 1

[state 2022, stopmoving]
type = velset
trigger1 = var(0) = 1
x = 0
y = 0
ignorehitpause = 1

[state 2022, stophitting]
type = changeanim
trigger1 = var(0) = 1
value = 2
ignorehitpause = 1

[state 2022, createdisapation]
type = Helper
trigger1 = var(0) = 1
helpertype = normal ;player
name = "soulstrikedisappate"
stateno = 2027
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
ignorehitpause = 1

[state 2022, actualtime]
type = varset
trigger1 = 1
var(42) = var(42) + 1
ignorehitpause = 1

[state 2022, end]
type = destroyself
trigger1 = var(42) >= 180 && var(0) = 0
trigger2 = (var(0)) && var(37) = var(39) && var(38) = var(40)
ignorehitpause = 1


; Spell text box
[statedef 2024]
type = A
movetype = I
physics = N
anim = 2
ctrl = 0

[state 2024, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2007
removetime = 1

[state 2024, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2024
removetime = 1

[state 2024, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2024, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2024, textbox]
type = Explod
trigger1 = time = 0
anim = 2007
ID = 2007
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2024, textofspell]
type = Explod
trigger1 = time = 0
anim = 2024 ;spell id
ID = 2024
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2024, end]
type = destroyself
trigger1 = time > 70



;---------------------------------------------------------------------------
; Soul Strike Air (Move)
[statedef 2025]
type = A
movetype = A
physics = A
anim = 2025
ctrl = 0
poweradd = -300
sprpriority = 0

[state 2025, velset]
type = velset
trigger1 = time = 0
y = -8
x = -4

[State 2020, TextBoxHelper]
type = Helper
trigger1 = time = 7
helpertype = normal ;player
name = "soulstriketext"
ID = 2000
stateno = 2024
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[State 2020, SoulStrikeMaker]
type = Helper
trigger1 = time = 8
helpertype = normal ;player
name = "soulstrikemaker"
ID = 2021
stateno = 2021
pos = -12, -80
postype = p1    ;p2,front,back,left,right
facing = 1

[state 2020, castdelay]
type = varset
trigger1 = time = 0
var(8) = cond(var(19) = 2, 180, 135)

;Soul Strike disapates
[statedef 2027]
movetype = H
physics = N
type = S
velset = 0,0
ctrl = 0
anim = 2027

[State 2027, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1
ignorehitpause = 1

[state 2027, destroyself]
type = destroyself
trigger1 = animtime = 0




;---------------------------------------------------------------------------
; Energy Coat
[statedef 2030]
type = S
movetype = I
physics = S
anim = 2030
ctrl = 0
poweradd = -300
sprpriority = 0

[State 2030, TextBoxHelper]
type = Helper
trigger1 = time = 0
helpertype = normal ;player
name = "energycoat"
ID = 2000
stateno = 2032
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[State 2030, Explod]
type = Explod
trigger1 = animelem = 15
anim = 2031
ID = 2031
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
sprpriority = 1
scale = const(size.xscale), const(size.yscale)
ownpal = 1
trans = addalpha
alpha = 256,256

[State 2030, PlaySnd]
type = PlaySnd
trigger1 = animelem = 15
value = 2030,0

;Set Energy Coat Time
[state 2030, StartCoat]
type = varset
trigger1 = animelem = 15
var(9) = 1800

[state 2030, StartCoatPal]
type = PalFX
trigger1 = animelem = 15
time = 1800
add = 0,0,50
mul = 256,256,256
;sinadd = 0,0,0,10
invertall = 0
color = 256

[state 2030, end]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

; Spell text box
[statedef 2032]
type = A
movetype = I
physics = N
anim = 2
ctrl = 0

[state 2032, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2007
removetime = 1

[state 2032, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2032
removetime = 1

[state 2032, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2032, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2032, textbox]
type = Explod
trigger1 = time = 0
anim = 2007
ID = 2007
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2032, textofspell]
type = Explod
trigger1 = time = 0
anim = 2032 ;spell id
ID = 2032
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2032, end]
type = destroyself
trigger1 = time > 70





;---------------------------------------------------------------------------
; Thunder Bolt
[statedef 2040]
type = S
movetype = A
physics = S
anim = 2040
ctrl = 0
poweradd = 260;-290 = lvl 30
sprpriority = 0

[State 2010, TextBoxHelper]
type = Helper
trigger1 = time = 0
helpertype = normal ;player
name = "thunderbolttext"
ID = 2000
stateno = 2043
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[state 2040, end]
type = changestate
trigger1 = animtime = 0
value = 2041

; Thunder bolt middle
[statedef 2041]
type = S
movetype = A
physics = S
anim = 2041
ctrl = 0
sprpriority = 0

[state 2041, create bolt dist]
type = varset
trigger1 = time = 25
var(7) = cond(p2dist x < 25, 25, cond(p2dist x > 400, 400, p2dist x))

[state 2041, create bolt]
type = Helper
trigger1 = time = 27
helpertype = normal ;player
name = "thunderbolt"
stateno = 2045
pos = var(7), 0
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 2 * const(size.xscale)
size.yscale = 2 * const(size.yscale)

[state 2041, end]
type = changestate
trigger1 = time = 39
value = 2042

; Thunder bolt end
[statedef 2042]
type = S
movetype = I
physics = S
anim = 2042
ctrl = 0
sprpriority = 0

[state 2040, end]
type = changestate
trigger1 = animtime = 0
ctrl = 1
value = 0

; Spell text box
[statedef 2043]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0

[state 2043, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2043
removetime = 1

[state 2043, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2044
removetime = 1

[state 2043, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2043, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2043, textbox]
type = Explod
trigger1 = time = 0
anim = 2043
ID = 2043
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2043, textofspell]
type = Explod
trigger1 = time = 0
anim = 2044 ;spell id
ID = 2044
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2043, end]
type = destroyself
trigger1 = time > 70

;Thunder Bolt Spell
[statedef 2045]
type = S
movetype = A
physics = N
anim = 2045
ctrl = 0
sprpriority = 3

[state 2045, start]
type = varset
trigger1 = time = 0
var(1) = 0

[state 2045, sound]
type = PlaySnd
trigger1 = time = 0
value = S2030,0

[State 2045, GroundExplod]
type = Explod
trigger1 = time = 0
anim = 2046
ID = 2046
pos = 0,0
postype = p1  ;p2,front,back,left,right
bindtime = 1
removetime = -1
scale = 2 * const(size.xscale), 2 * const(size.yscale)
sprpriority = 4
ownpal = 0

[State 2045, EnvShake]
type = EnvShake
trigger1 = time = 0
time = 2
freq = 180
ampl = -2
ignorehitpause = 1

[State 2045, HitDef]
type = HitDef
trigger1 = (time - 2) % 5 = 0
attr = S,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
getpower = 0,0
animtype = light          ;light,medium,hard,back,up,diagup
air.animtype = light
priority = 4,Hit   ;Hit,Miss,Dodge
damage = ceil(31 * (root, fvar(4))), ceil(3 * (root, fvar(4)))
pausetime = 6,6
sparkno = S201
sparkxy = - (random/25), (p2dist y) - (random/12) - (( enemy, const(size.height) ) / 2)
hitsound = S2,0
guardsound = S1,0
ground.type = low      ;Low,Trip,None
ground.slidetime = 10
ground.hittime = 10
air.hittime = 20
ground.velocity = -4,0
air.velocity = -1,-6

[state 2045, end]
type = varset
trigger1 = (root, var(19)) != 3 && time = 35
trigger2 = (root, var(19)) = 3 && time = 50
var(1) = 1

[State 2045, ModifyExplod]
type = ModifyExplod
trigger1 = var(1)
ID = 2046
anim = 2046
removetime = 1

[State 2045, GroundExplodLast]
type = Explod
trigger1 = var(1)
anim = 2048
ID = 2048
pos = 0,0
postype = p1  ;p2,front,back,left,right
bindtime = 1
removetime = -2
scale = 2 * const(size.xscale), 2 * const(size.yscale)
sprpriority = 4
ownpal = 0

[state 2045, end]
type = destroyself
trigger1 = var(1)


;---------------------------------------------------------------------------
; Fire Bolt Start
[statedef 2050]
type = S
movetype = A
physics = S
anim = 2050
ctrl = 0
poweradd = -120
sprpriority = 0

[State 2050, PowerAdd]
type = PowerAdd
triggerall = time = 0
trigger1 = var(19) = 1
trigger2 = var(19) = 3
value = cond(var(19)=1, -10, -20)

[State 2050, TextBoxHelper]
type = Helper
trigger1 = time = 0
helpertype = normal ;player
name = "firebolttext"
ID = 2000
stateno = 2053
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[state 2050, end]
type = changestate
trigger1 = animtime = 0
value = 2051

; Fire bolt middle
[statedef 2051]
type = S
movetype = A
physics = S
anim = 2051
ctrl = 0
sprpriority = 0

[state 2051, create bolt]
type = Helper
trigger1 = (time - 2) % 6 = 0 && time > 6
helpertype = normal ;player
name = "firebolt"
stateno = 2055
pos = ((random / 10) + 0) * const(size.xscale), (-525 - (random / 10)) * const(size.yscale)
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 2 * const(size.xscale)
size.yscale = 2 * const(size.yscale)
persistent = 1

[state 2051, end]
type = changestate
;trigger = time = 3 + (skill level * 6)
trigger1 = var(19) = 0 && time = 9
trigger2 = var(19) = 1 && time = 45
trigger3 = var(19) = 2 && time = 33
trigger4 = var(19) = 3 && time = 63
value = 2052

; Fire bolt end
[statedef 2052]
type = S
movetype = I
physics = S
anim = 2052
ctrl = 0
sprpriority = 0

[state 2052, end]
type = changestate
trigger1 = animtime = 0
ctrl = 1
value = 0

; Spell text box
[statedef 2053]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0

[state 2053, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2053
removetime = 1

[state 2053, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2054
removetime = 1

[state 2053, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2053, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2053, textbox]
type = Explod
trigger1 = time = 0
anim = 2053
ID = 2053
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2053, textofspell]
type = Explod
trigger1 = time = 0
anim = 2054 ;spell id
ID = 2054
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2053, end]
type = destroyself
trigger1 = time > 70

; Fire Bolt Bolt
[statedef 2055]
type = A
movetype = A
physics = N
anim = 2055
ctrl = 0
sprpriority = 4
velset = 2 * (root, const(size.xscale)), 4.5 * (root, const(size.yscale))

[State 2055, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 2056
time = 1
ignorehitpause = 1

[State 2055, PlaySnd]
type = PlaySnd
trigger1 = animelem = 10
value = S2050,0

[State 2055, VelSet]
type = VelSet
trigger1 = animelem = 10
x = 8 * (root, const(size.xscale))
y = 25 * (root, const(size.yscale))

[State 2055, HitDef]
type = HitDef
trigger1 = time = 0
attr = A,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
getpower = 0,0
animtype = medium          ;light,medium,hard,back,up,diagup
air.animtype = medium
priority = 5,Hit   ;Hit,Miss,Dodge
damage = ceil(77 * (root, fvar(4))), ceil(19 * (root, fvar(4)))
pausetime = 6,6
sparkno = S201
sparkxy = (random / 25) - 40, (random / 25) - 40
hitsound = S2, ifelse(random < 500, 0, 1)
guardsound = S1,0
ground.type = high      ;Low,Trip,None
ground.slidetime = 10
ground.hittime = 10
air.hittime = 20
ground.velocity = -10,0;,-4.5
air.velocity = -6,-12

[State 2055, End]
type = changestate
trigger1 = movecontact
trigger2 = pos y >= 0
value = 2056

; Fire Bolt explod
[statedef 2056]
type = A
movetype = I
physics = N
anim = 2056
ctrl = 0
sprpriority = 5
velset = 0, -6 * const(size.yscale)

[state 2056, end]
type = destroyself
trigger1 = animtime = 0






;---------------------------------------------------------------------------
; Cold Bolt Start
[statedef 2060]
type = S
movetype = A
physics = S
anim = 2060
ctrl = 0
poweradd = -100
sprpriority = 0

[State 2060, PowerAdd]
type = PowerAdd
triggerall = time = 0
trigger1 = var(19) != 0
value = cond(var(19)=1, -90, cond(var(19)=2, -50, -180) )

[State 2060, TextBoxHelper]
type = Helper
trigger1 = time = 0
helpertype = normal ;player
name = "coldbolttext"
ID = 2000
stateno = 2063
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[state 2060, end]
type = changestate
trigger1 = animtime = 0
value = 2061

; Cold bolt middle
[statedef 2061]
type = S
movetype = A
physics = S
anim = 2061
ctrl = 0
sprpriority = 0

[state 2061, create bolt]
type = Helper
trigger1 = (time - 7) % 6 = 0 && time > 6
helpertype = normal ;player
name = "coldbolt"
stateno = 2065
pos = (random * 0.63) - 60, (-525 - (random / 10)) * const(size.yscale)
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 2 * const(size.xscale)
size.yscale = 2 * const(size.yscale)
persistent = 1

[state 2061, end]
type = changestate
;5 + (skill level * 6) except for lvl 1 where it is 4
trigger1 = var(19) = 0 && time = 59;4
trigger2 = var(19) = 1 && time = 41
trigger3 = var(19) = 2 && time = 29
trigger4 = var(19) = 3 && time = 59
value = 2062

; Cold bolt end
[statedef 2062]
type = S
movetype = I
physics = S
anim = 2062
ctrl = 0
sprpriority = 0

[state 2061, create bolt]
type = Helper
trigger1 = time = 3
helpertype = normal ;player
name = "coldbolt"
stateno = 2065
pos = (random * 0.5) - 60, (-525 - (random / 10)) * const(size.yscale)
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 2 * const(size.xscale)
size.yscale = 2 * const(size.yscale)

[state 2062, end]
type = changestate
trigger1 = animtime = 0
ctrl = 1
value = 0

; Spell text box
[statedef 2063]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0

[state 2063, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2063
removetime = 1

[state 2063, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2064
removetime = 1

[state 2063, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2063, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2063, textbox]
type = Explod
trigger1 = time = 0
anim = 2063
ID = 2063
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2063, textofspell]
type = Explod
trigger1 = time = 0
anim = 2064 ;spell id
ID = 2064
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2063, end]
type = destroyself
trigger1 = time > 70

; Cold Bolt Bolt
[statedef 2065]
type = A
movetype = A
physics = N
anim = 2065
ctrl = 0
sprpriority = 3
velset = 0, 0

[State 2065, VelSet]
type = VelSet
trigger1 = time = 4
x = 4 * (root, const(size.xscale))
y = 12.5 * (root, const(size.yscale))

[State 2065, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 2066
time = 1
ignorehitpause = 1

[State 2065, Explod]
type = Explod
trigger1 = time % 30 = 0
pos = 10 - (random * 0.04), -(random * 0.14)
postype = p1  ;p2,front,back,left,right
anim = 2067
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = const(size.xscale),const(size.yscale)
sprpriority = 4
ownpal = 1
persistent = 1

[State 2065, HitDef]
type = HitDef
trigger1 = time = 0
attr = A,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
getpower = 0,0
animtype = medium          ;light,medium,hard,back,up,diagup
air.animtype = medium
priority = 4,Miss   ;Hit,Miss,Dodge
damage = ceil(53 * (root, fvar(4))), ceil(5 * (root, fvar(4)))
pausetime = 12,12
sparkno = S201
sparkxy = (random / 25) - 40, (random / 25) - 40
hitsound = S2, ifelse(random < 500, 0, 1)
guardsound = S1,0
ground.type = high      ;Low,Trip,None
ground.slidetime = 10
ground.hittime = 10
air.hittime = 20
ground.velocity = -10,0;,-4.5
air.velocity = -6,-12

[State 2065, End]
type = changestate
trigger1 = movecontact
trigger2 = pos y >= 0
value = 2066

; Cold Bolt explod
[statedef 2066]
type = A
movetype = I
physics = N
anim = 2066
ctrl = 0
sprpriority = 4
velset = 0, 0

[State 2066, EnvShake]
type = EnvShake
trigger1 = time = 0
time = 4
freq = 60
ampl = -8
phase = 90
ignorehitpause = 1

[State 2066, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2060,0

; Puff of smoke explod
[State 2066, Explod]
type = Explod
trigger1 = time = 0
anim = 2068
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0.2, 0
removetime = -2
scale = const(size.xscale), const(size.yscale)
sprpriority = 4
ignorehitpause = 1

[state 2066, end]
type = destroyself
trigger1 = animtime = 0







;---------------------------------------------------------------------------
; Fire Ball Start
[statedef 2070]
type = S
movetype = A
physics = S
anim = 2070
ctrl = 0
poweradd = -350
sprpriority = 0

[State 2070, TextBoxHelper]
type = Helper
trigger1 = time = 0
helpertype = normal ;player
name = "coldbolttext"
ID = 2000
stateno = 2073
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[state 2071, create ball]
type = Helper
trigger1 = animelem = 17
helpertype = normal ;player
name = "fireball"
stateno = 2075
pos = 40, -70
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 2 * const(size.xscale)
size.yscale = 2 * const(size.yscale)
persistent = 1

[state 2070, end]
type = changestate
trigger1 = animtime = 0
value = 2071

; Fire Ball middle
[statedef 2071]
type = S
movetype = A
physics = S
anim = 2071
ctrl = 0
sprpriority = 0

[state 2071, end]
type = changestate
trigger1 = time = 11
value = 2072

; Fire Ball end
[statedef 2072]
type = S
movetype = I
physics = S
anim = 2072
ctrl = 0
sprpriority = 0

[state 2072, end]
type = changestate
trigger1 = animtime = 0
ctrl = 1
value = 0

; Spell text box
[statedef 2073]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0

[state 2073, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2073
removetime = 1

[state 2073, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2074
removetime = 1

[state 2073, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2073, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2073, textbox]
type = Explod
trigger1 = time = 0
anim = 2073
ID = 2073
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2073, textofspell]
type = Explod
trigger1 = time = 0
anim = 2074 ;spell id
ID = 2074
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2073, end]
type = destroyself
trigger1 = time > 70

;000000000000000000000000000000
; var(1) - Damage
; var(2) - End Var
; fvar(1) - X Vel
; fvar(2) - Y Vel
; Fire Ball
[statedef 2075]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0
velset = 0, -const(size.yscale) * 3
sprpriority = 4

[state 2075, setdamage]
type = varset
trigger1 = time = 0
var(1) = 97

[state 2075, setdamage]
type = varset
trigger1 = time = 0
var(2) = 0

[State 2075, Explod]
type = Explod
trigger1 = time = 0 ;time < 14
anim = 2075
ID = 2075
pos = 0, 0
vel = 0, -const(size.yscale) * 3
postype = p1
facing = 1
removetime = 14
scale = .1, .1
sprpriority = 4
ownpal = 1
removeongethit = 1
ignorehitpause = 1

[State 2075, ModifyExplod]
type = ModifyExplod
trigger1 = time < 14
ID = 2075
scale = ((time + 1.0) / 15.0) * const(size.xscale), ((time + 1.0) / 15.0) * const(size.yscale)
persistent = 1

[State 2075, InitVelset]
type = VelSet
trigger1 = time = 14
x = 0
y = 0

[State 2075, gethit]
type = destroyself
trigger1 = time < 14 && ((root, stateno) != [2070,2072])

[state 2075, move ball]
type = changestate
trigger1 = time = 14
value = 2076

;1111111111111111111111111111111111111
; Fire Ball projectile middle
[statedef 2076]
type = A
movetype = I
physics = N
anim = 2075
ctrl = 0
velset = 0, 0
sprpriority = 4

[State 2076, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 2078
time = 1
ignorehitpause = 1

[state 2076, setvelx]
type = varset
trigger1 = time = 0
fvar(1) = 0

[state 2076, setvely]
type = varset
trigger1 = time = 0
fvar(2) = 0

[State 2076, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2070,0

[State 2075, SecondVelset]
type = VelSet
trigger1 = time = 3
x = 2
y = 0

[State 2075, PushVelsetX]
type = VarSet
trigger1 = time = 9 && (root, stateno) = [2070,2072]
fvar(1) = const(size.xscale) * 10.0; 17.5 = what it is in RBO, but too big for MUGEN

[State 2075, PushVelsetY]
type = VarSet
trigger1 = time = 9 && (root, stateno) = [2070,2072]
fvar(2) = -const(size.yscale)

[State 2075, ChangeState]
type = ChangeState
trigger1 = time = 9
value = 2079

;111111111111111111111111
; Fire Ball Bomb
[statedef 2077]
type = C
movetype = A
physics = C
anim = 2077
ctrl = 0
sprpriority = 4

[state 2077, getdamage]
type = varset
trigger1 = time = 0
var(1) = parent, var(1)

[state 2077, endfb]
type = ParentVarSet
trigger1 = time = 0
v = 2
value = 1

[State 2077, Explod]
type = Explod
trigger1 = time = 0
anim = 2076
ID = 2076
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = const(size.xscale),const(size.yscale)
sprpriority = 5
ontop = 0
shadow = 0,0,0
ownpal = 1

[State 2077, EnvShake]
type = EnvShake
trigger1 = time = 0
time = 5
freq = 60
ampl = -5
phase = 90
ignorehitpause = 1

[State 2077, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2070,1

[State 2077, HitDef]
type = HitDef
trigger1 = time = 0
attr = A,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
getpower = 0,0
animtype = hard          ;light,medium,hard,back,up,diagup
air.animtype = hard
priority = 6,Hit   ;Hit,Miss,Dodge
damage = ceil((var(1) * 1.50) * (root, fvar(4))), ceil((var(1) * 0.15) * (root, fvar(4)))
pausetime = 9,9
sparkno = S201
sparkxy = 20, 0
hitsound = S2, ifelse(random < 500, 0, 1)
guardsound = S1,0
ground.type = high      ;Low,Trip,None
ground.slidetime = 10
ground.hittime = 10
air.hittime = 20
fall = 1
ground.velocity = -10,-10
air.velocity = -10, -10

[state 2077, End]
type = destroyself
trigger1 = animtime = 0

;111111111111111111111111111111111
; Fire Ball Projectile got hit
[statedef 2078]
type = A
movetype = H
physics = N
anim = 2075
ctrl = 0
sprpriority = 4

[state 2078, decreasedmg]
type = varset
trigger1 = 1
var(1) = var(1) - GetHitVar(damage)

[State 2077, PlaySnd]
type = PlaySnd
trigger1 = var(1) <= 0
value = S2070,1

[state 2078, dead]
type = destroyself
trigger1 = var(1) <= 0

[state 2078, checkdamage]
type = varset
trigger1 = var(1) < 0
var(1) = 0

[state 2078, xvel]
type = varset
trigger1 = 1
fvar(1) = fvar(1) + GetHitVar(xvel)

[state 2078, yvel]
type = varset
trigger1 = 1
fvar(2) = fvar(2) + GetHitVar(yvel)

[state 2078, end]
type = changestate
trigger1 = 1
value = 2079

;111111111111111111111111111111111
; Fire Ball Projectile move
[statedef 2079]
type = A
movetype = A
physics = N
anim = 2075
ctrl = 0
sprpriority = 4

[State 2079, VelSet]
type = VelSet
trigger1 = time = 0
x = fvar(1)
y = fvar(2)

[State 2076, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 2078
time = 1
ignorehitpause = 1

[State 2079, gravity]
type = VelAdd
trigger1 = 1
y = 0.3 * const(size.yscale)

[State 2079, HitDef]
type = HitDef
trigger1 = time = 0
attr = A,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
getpower = 0,0
animtype = hard          ;light,medium,hard,back,up,diagup
air.animtype = hard
priority = 1,Hit   ;Hit,Miss,Dodge
damage = ceil(var(1) * (root, fvar(4))), ceil((var(1) / 10.0) * (root, fvar(4)))
pausetime = 9,9
sparkno = S201
sparkxy = 20, 0
hitsound = S2, ifelse(random < 500, 0, 1)
guardsound = S1,0
ground.type = high      ;Low,Trip,None
ground.slidetime = 10
ground.hittime = 10
air.hittime = 20
ground.velocity = -8,0;,-4.5
air.velocity = -4,-7
persistent = 0

[State 2079, Helper]
type = Helper
trigger1 = numhelper(2077) = 0
trigger1 = pos y >= -25 * const(size.yscale)
helpertype = normal ;player
name = "fireballbomb"
ID = 2077
stateno = 2077
pos = 0, 0
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = root, const(size.xscale)
size.yscale = root, const(size.yscale)

[state 2079, end]
type = destroyself
trigger1 = var(2)

;---------------------------------------------------------------------------
; Frost Driver
[statedef 2080]
type = S
movetype = A
physics = S
anim = 2080
ctrl = 0
poweradd = -100
sprpriority = 0

[State 2080, TextBoxHelper]
type = Helper
trigger1 = animelem = 17
helpertype = normal ;player
name = "frostdrivertext"
ID = 2000
stateno = 2081
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[State 2080, PlaySnd]
type = PlaySnd
trigger1 = animelem = 17
value = S2080,0

[state 2071, create driver]
type = Helper
trigger1 = animelem = 18
helpertype = normal ;player
name = "frostdriver"
stateno = 2082
pos = 0, 0
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 2 * const(size.xscale)
size.yscale = 2 * const(size.yscale)
persistent = 1

[state 2080, end]
type = changestate
trigger1 = animtime = 0
ctrl = 1
value = 0

; Spell text box
[statedef 2081]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0

[state 2081, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2007
removetime = 1

[state 2081, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2081
removetime = 1

[state 2081, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2081, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2081, textbox]
type = Explod
trigger1 = time = 0
anim = 2007
ID = 2007
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2081, textofspell]
type = Explod
trigger1 = time = 0
anim = 2081 ;spell id
ID = 2081
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2081, end]
type = destroyself
trigger1 = time > 70

; Velocity in game is 62, but reduced it to 31 (times scale) for balance
; cloud puff and spike appear every 2 frames in game but increased to 3 to reduce spam
; Frost Driver Spell
[statedef 2082]
type = A
movetype = A
physics = N
anim = 2082
velset = 31 * (root, const(size.xscale)),0
ctrl = 0

[state 2082, choosespike]
type = varset
trigger1 = time % 2 = 0
var(1) = random / 167

[State 2082, spire]
type = Explod
trigger1 = time % 2 = 0
anim = 2084 + var(1)
postype = p1  ;p2,front,back,left,right
pos = 0,0
removetime = -2
scale = .6 * const(size.xscale),.6 * const(size.yscale)
sprpriority = 4
ownpal = 1

[State 2082, cloudpuff]
type = Explod
trigger1 = time % 2 = 0
anim = 2083
pos = 0,-2.5 * const(size.yscale)
postype = p1  ;p2,front,back,left,right
vel = (random / 100 - 5) * (root, const(size.xscale)), (random / 100 - 5) * (root, const(size.yscale))
removetime = -2
scale = const(size.xscale),const(size.yscale)
sprpriority = 5
ownpal = 1

[State 2082, HitDef]
type = HitDef
trigger1 = time = 0 && p2stateno != 2090 ;TODO replace with does iceberg exist?
attr = A,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = M        ;HLAFD+-
guardflag = M         ;HLA
getpower = 0,0
animtype = light          ;light,medium,hard,back,up,diagup
air.animtype = light
priority = 6,Hit   ;Hit,Miss,Dodge
damage = ceil(12 * (root, fvar(4))), 0
pausetime = 0,0
sparkno = -1
sparkxy = 0, 0
hitsound = S2080, 1
guardsound = S1,0
ground.type = Low      ;Low,Trip,None
ground.slidetime = 0
ground.hittime = 0
air.hittime = 20
ground.velocity = 0,0
p2stateno = 2090

[state 2082, iceberg]
type = helper
trigger1 = movehit
ignorehitpause = 1
helpertype = normal ;player
name = "iceberg"
stateno = 2091
pos = p2bodydist x, 0
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 1.25 * const(size.xscale)
size.yscale = 1.25 * const(size.yscale)

[state 2082, end]
type = destroyself
trigger1 = movecontact
trigger2 = time > (600 / (31 * (root, const(size.xscale))))


; --------------------------------------------
; Taken from Sub-Zero by binho
; Frozen State
[Statedef 2090]
movetype = H
velset = 0,0
ctrl = 0

[State 001, 3]
type = PosFreeze
trigger1 = time > 1
value = 1
persistent = 1
ignorehitpause = 1

[State 001, 2]
type = changeanim
trigger1 = 1
value = (anim)
elem = (animelemno(0))
persistent = 1
ignorehitpause = 1

[State 2090, ChangeAnim]
type = ChangeAnim
trigger1 = time = 180
value = 5000
elem = (animelemno(0))

; Ice Cage
[Statedef 2091]
type = S
movetype = I
sprpriority = 5
ctrl = 0
anim = 2090

[state 2091, reposition]
type = posset
trigger1 = 1
x = enemy, pos x
y = enemy, pos y

[state 2091, end]
type = changestate
trigger1 = p2stateno != 2090
value = 2093
ignorehitpause = 1

[state 2091, end]
type = changestate
trigger1 = time = 149
value = 2092

; Ice Cage Timeout
[Statedef 2092]
type = A
movetype = A
sprpriority = 5
ctrl = 0
anim = 1

[State 2092, HitDef]
type = HitDef
trigger1 = time = 0 ;TODO replace with does iceberg exist?
attr = A,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAFD        ;HLAFD+-
getpower = 0,0
animtype = light          ;light,medium,hard,back,up,diagup
air.animtype = light
priority = 7,Hit   ;Hit,Miss,Dodge
damage = 0, 0
pausetime = 0,0
sparkno = -1
sparkxy = 0, 0
ground.type = Low      ;Low,Trip,None
ground.slidetime = 10
ground.hittime = 10
air.hittime = 20
ground.velocity = -2,0

[state 2092, end]
type = changestate
trigger1 = p2stateno != 2090
value = 2093
ignorehitpause = 1

; Ice Cage end (explode)
[Statedef 2093]
type = S
movetype = H
sprpriority = 5
ctrl = 0
anim = -1

[State 2093, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2060, 0

[state 2093, end]
type = destroyself
trigger1 = animtime = 0











;---------------------------------------------------------------------------
; Stone Curse
[statedef 2100]
type = S
movetype = A
physics = S
anim = 2100
ctrl = 0
poweradd = -150
sprpriority = 0

[State 2100, TextBoxHelper]
type = Helper
trigger1 = animelem = 7
helpertype = normal ;player
name = "stonecursetext"
ID = 2000
stateno = 2101
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[state 2100, create curse]
type = Helper
trigger1 = animelem = 29
helpertype = normal ;player
name = "stonecurse"
stateno = 2102
pos = 50, -75
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[state 2100, end]
type = changestate
trigger1 = animtime = 0
ctrl = 1
value = 0

; Spell text box
[statedef 2101]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0

[state 2101, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2007
removetime = 1

[state 2101, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2101
removetime = 1

[state 2101, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2101, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2101, textbox]
type = Explod
trigger1 = time = 0
anim = 2007
ID = 2007
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2101, textofspell]
type = Explod
trigger1 = time = 0
anim = 2101 ;spell id
ID = 2101
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2101, end]
type = destroyself
trigger1 = time > 70

; Stone Curse Projectile
[statedef 2102]
type = S
movetype = A
physics = N
anim = 2102
ctrl = 0

[State 2102, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2100,0

[State 2102, HitDef]
type = HitDef
trigger1 = time = 0
attr = S,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
animtype = medium          ;light,medium,hard,back,up,diagup
priority = 4,Dodge
damage = cond(NumHelper(2106), 6, 9),0
pausetime = 2,2
sparkno = -1
sparkxy = 0,0
hitsound = S0,0
guardsound = S1,0
ground.type = Low
ground.slidetime = 30
ground.hittime = 20
air.hittime = 20
ground.velocity = -10,0
guard.velocity = -25
air.velocity = -5,-2
p2stateno = 2105
getpower = 0,0

[State 2106, Helper]
type = Helper
trigger1 = movehit
helpertype = normal ;player
ID = 2106
stateno = 2106
pos = 0,0
postype = p2    ;p2,front,back,left,right
persistent = 0

[State 2102, DestroySelf]
type = DestroySelf
trigger1 = animtime = 0

; Slow State
[statedef 2103]
type = S
movetype = H
physics = N
ctrl = 0
velset = 0,0

[state 2104, land]
type = posset
trigger1 = time = 0
y = 0

[state 2103, animfwd]
type = changeanim
triggerall = pos y = 0 && anim != 20
trigger1 = command = "holdfwd"
value = 20

[state 2103, animback]
type = changeanim
triggerall = pos y = 0 && anim != 21
trigger1 = command = "holdback"
value = 21

[state 2103, stopmoving]
type = changeanim
triggerall = pos y = 0 && anim != 0
trigger1 = command != "holdback"
trigger1 = command != "holdfwd"
value = 0

[state 2103, move]
type = posadd
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
x = cond(command = "holdfwd", const(velocity.walk.fwd.x) / 2.0, const(velocity.walk.back.x) / 2.0)

[State 2103, PalFX]
type = PalFX
trigger1 = 1
time = 1
mul = 128,128,128
color = 128

[state 2103, gotocurse]
type = changestate
trigger1 = time = 240
value = 2104

; Curse state
[statedef 2104]
type = S
movetype = H
physics = N
ctrl = 0
velset = -3, -6

[State 2104, ChangeAnim2]
type = ChangeAnim2
trigger1 = time = 0
value = 2104

[state 2104, gravity]
type = veladd
trigger1 = pos y < 0
y = const(movement.yaccel)

[state 2104, stopmovement]
type = velset
trigger1 = pos y >= 0 && time > 0
x = 0
y = 0

[state 2104, setground]
type = posset
trigger1 = pos y > 0
y = 0

[State 2104, PalFX]
type = PalFX
trigger1 = 1
time = 1
mul = 128,128,128
color = 128

[State 2104, Poison]
type = LifeAdd
trigger1 = time = 120
trigger2 = time = 240
value = -(const(data.life)/100)
kill = 0
absolute = 1

[State 2104, SelfState]
type = SelfState
trigger1 = time = 300
ctrl = 1
value = 0

; Hit with stone curse
[statedef 2105]
type = A
movetype = H
physics = N
ctrl = 0

[State 2105, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 5002

[state 2105, changeanimagain]
type = changeanim
trigger1 = animtime = 0
value = cond(pos y < 0, 44, 0)

[state 2105, velset]
type = velset
trigger1 = time = 0
x = -gethitvar(xvel)
y = cond(pos y < 0, gethitvar(yvel), 0)

[state 2105, velset]
type = velset
trigger1 = time >= 0 && (vel x) != 0
x = (vel x) * const(movement.stand.friction)

[state 2105, gravity]
type = velset
trigger1 = pos y < 0
y = (vel y) + const(movement.yaccel)

[state 2105, land]
type = changestate
trigger1 = pos y >= 0
trigger1 = time > gethitvar(hittime)
value = 2103

; Dust maker
[Statedef 2106]
type = A
movetype = I
physics = N
anim = 1

[State 2106, PosSet]
type = PosSet
trigger1 = 1
x = enemynear, pos x
y = enemynear, pos y

[State 2106, Dust]
type = Explod
trigger1 = time % 20 = 0
trigger1 = enemynear, stateno = 2103
anim = 2103
ID = 2103
pos = 0, -(enemynear, const(size.height)) / 2
postype = p1  ;p2,front,back,left,right
facing = 1
random = (enemynear, const(size.ground.back)) + (enemynear, const(size.ground.front)), (enemynear, const(size.height))
removetime = -2
scale = const(size.xscale),const(size.yscale)
sprpriority = 5
shadow = 0,0,0
ownpal = 1
removeongethit = 1

[State 2106, Dust2]
type = Explod
trigger1 = time % 8 = 0
trigger1 = enemynear, stateno = 2104
anim = 2106
ID = 2106
pos = 0, -(enemynear, const(size.height)) / 2
postype = p1  ;p2,front,back,left,right
facing = 1
random = (enemynear, const(size.ground.back)) + (enemynear, const(size.ground.front)), (enemynear, const(size.height))
removetime = -2
scale = const(size.xscale),const(size.yscale)
sprpriority = 5
shadow = 0,0,0
ownpal = 1
removeongethit = 1

[State 2106, DestroySelf]
type = DestroySelf
trigger1 = (enemynear, stateno) != 2103
trigger1 = (enemynear, stateno) != 2104
trigger1 = (enemynear, stateno) != 2105












;---------------------------------------------------------------------------
; Thunder Storm Start
[statedef 2110]
type = S
movetype = A
physics = S
anim = 2110
ctrl = 0
poweradd = -600
sprpriority = 0

[State 2110, PowerAdd]
type = PowerAdd
triggerall = time = 0
trigger1 = var(19) = 1
trigger2 = var(19) = 3
value = -400
ignorehitpause = 1

[State 2110, TextBoxHelper]
type = Helper
trigger1 = time = 0
helpertype = normal ;player
name = "thunderstormtext"
ID = 2000
stateno = 2115
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[state 2110, end]
type = changestate
trigger1 = animtime = 0
value = 2111

; Thunder Storm Cast
[statedef 2111]
type = S
movetype = A
physics = S
anim = 2111
ctrl = 0
sprpriority = 0

[state 2111, end]
type = changestate
trigger1 = time = 57
value = 2112

; Thunder Storm Middle
[statedef 2112]
type = S
movetype = A
physics = S
anim = 2112
ctrl = 0
sprpriority = 0

[state 2112, end]
type = changestate
trigger1 = animtime = 0
value = 2113

; Thunder Storm Attack
[statedef 2113]
type = S
movetype = A
physics = S
anim = 2113
ctrl = 0
sprpriority = 0

[State 2113, PlaySnd]
type = PlaySnd
trigger1 = time % 6 = 0
value = S2110,0

[State 2113, Bolt1]
type = Explod
trigger1 = time % 6 = 0
anim = 2045
ID = 2110
pos = (random / 1.1) - 450, 0
removetime = 10
scale = 2,2
sprpriority = 4
ownpal = 1

[State 2113, Bolt2]
type = Explod
trigger1 = time % 6 = 0
anim = 2045
ID = 2111
pos = (random / 1.1) - 450, 0
removetime = 10
scale = 2,2
sprpriority = 4
ownpal = 1

[State 2113, Bolt3]
type = Explod
trigger1 = time % 6 = 0
anim = 2045
ID = 2112
pos = (random / 1.1) - 450, 0
removetime = 10
scale = 2,2
sprpriority = 4
ownpal = 1

[State 2113, Bolt4]
type = Explod
trigger1 = time % 6 = 0
anim = 2045
ID = 2113
pos = (random / 1.1) - 450, 0
removetime = 10
scale = 2,2
sprpriority = 4
ownpal = 1

[State 2113, HitDef]
type = HitDef
trigger1 = time % 6 = 0
attr = S,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAFD        ;HLAFD+-
guardflag = MA         ;HLA
getpower = 0,0
animtype = hard          ;light,medium,hard,back,up,diagup
air.animtype = hard
priority = 7,Hit   ;Hit,Miss,Dodge
damage = ceil(69 * fvar(4)), ceil(7 * fvar(4))
pausetime = 2,8
sparkno = S201
sparkxy = - (random/25), (p2dist y) - (random/12) - (( enemy, const(size.height) ) / 2)
hitsound = S2,0
guardsound = S1,0
fall = 1
air.hittime = 20
air.velocity = -1,-6

[state 2113, end]
type = changestate
trigger1 = (var(19) = 1 || var(19) = 3) && time = 54
trigger2 = var(19) = 2 && time = 36
value = 2114

; Thunder Storm End
[statedef 2114]
type = S
movetype = A
physics = S
anim = 2114
ctrl = 0
sprpriority = 0

[state 2114, end]
type = changestate
trigger1 = animtime = 0
ctrl = 1
value = 0

; Spell text box
[statedef 2115]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0

[state 2115, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2115
removetime = 1

[state 2115, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2116
removetime = 1

[state 2115, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2115, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2115, textbox]
type = Explod
trigger1 = time = 0
anim = 2115
ID = 2115
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2115, textofspell]
type = Explod
trigger1 = time = 0
anim = 2116 ;spell id
ID = 2116
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2115, end]
type = destroyself
trigger1 = time > 70















;---------------------------------------------------------------------------
; Safety Wall Start
[statedef 2120]
type = S
movetype = A
physics = S
anim = 2120
ctrl = 0
poweradd = -500
sprpriority = 0

[State 2120, UseBGem]
type = varset
trigger1 = time = 0
var(22) = var(22) - 1

[State 2120, TextBoxHelper]
type = Helper
trigger1 = animelem = 32
helpertype = normal ;player
name = "safetywalltext"
ID = 2000
stateno = 2123
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[State 2120, PlaySnd]
type = PlaySnd
trigger1 = animelem = 32
value = S2120,0

[State 2120, SafetyWall]
type = Helper
trigger1 = animelem = 32
helpertype = normal
name = "SafetyWall"
ID = 2124
stateno = 2124
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 0
size.xscale = 3 * const(size.xscale)
size.yscale = 3 * const(size.yscale)

[state 2120, end]
type = changestate
trigger1 = animtime = 0
value = 2121

; Safety Wall Middle
[statedef 2121]
type = S
movetype = A
physics = S
anim = 2121
ctrl = 0
sprpriority = 0

[state 2121, end]
type = changestate
trigger1 = time = 22
value = 2122

; Safety Wall End
[statedef 2122]
type = S
movetype = A
physics = S
anim = 2122
ctrl = 0
sprpriority = 0

[state 2122, end]
type = changestate
trigger1 = animtime = 0
ctrl = 1
value = 0

; Spell text box
[statedef 2123]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0

[state 2123, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2007
removetime = 1

[state 2123, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2123
removetime = 1

[state 2123, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2123, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2123, textbox]
type = Explod
trigger1 = time = 0
anim = 2007
ID = 2007
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2123, textofspell]
type = Explod
trigger1 = time = 0
anim = 2123 ;spell id
ID = 2123
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2123, end]
type = destroyself
trigger1 = time > 70

; Safety Wall Appear
[statedef 2124]
type = S
movetype = I
physics = S
anim = 2124
ctrl = 0
sprpriority = 4

[State 2124, InitTime]
type = VarSet
trigger1 = time = 0
var(1) = 1800

[State 2124, InitHits]
type = VarSet
trigger1 = time = 0
var(2) = 14

[state 2124, end]
type = changestate
trigger1 = animtime = 0
value = 2125

; Safety Wall
[statedef 2125]
type = S
movetype = I
physics = S
anim = 2125
ctrl = 0
sprpriority = 4

[state 2125, safetycoatexplod]
type = explod
trigger1 = (root, stateno) = 3100
trigger1 = (root, time) >= 10
anim = 2031
ownpal = 1
sprpriority = 4
trans = alpha
addalpha = 256, 256

[state 2125, safetycoat]
type = changestate
trigger1 = (root, stateno) = 3100
trigger1 = (root, time) >= 10
value = 2128

[state 2125, timelower]
type = varset
trigger1 = 1
var(1) = var(1) - 1

[State 2125, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 2127
time = 1
ignorehitpause = 1

[state 2125, end]
type = changestate
trigger1 = var(1) <= 0
trigger2 = var(2) <= 0
trigger3 = (root, stateno = 2140) && (root, anim = 2001)
value = 2126

; Safety Wall Disappear
[statedef 2126]
type = S
movetype = I
physics = S
anim = 2126
ctrl = 0
sprpriority = 4

[state 2124, end]
type = destroyself
trigger1 = animtime = 0

; Safety Wall Get Hit
[statedef 2127]
type = S
movetype = I
physics = S
anim = 2125
ctrl = 0
sprpriority = 4

[state 2127, timelower]
type = varset
trigger1 = time = 0
var(2) = var(2) - 1

[State 2127, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2120,1

[state 2127, end]
type = changestate
trigger1 = 1
value = 2125

; Safety Coat
[statedef 2128]
type = A
movetype = I
physics = N
anim = 2128
ctrl = 0

[State 2128, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 1

[state 2128, timelower]
type = varset
trigger1 = 1
var(1) = var(1) - 1

[State 2128, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 2129
time = 1
ignorehitpause = 1

[state 2128, end]
type = destroyself
trigger1 = var(1) <= 0
trigger2 = var(2) <= 0

; Safety Coat Get Hit
[statedef 2129]
type = A
movetype = I
physics = N
anim = 2128
ctrl = 0

[state 2129, timelower]
type = varset
trigger1 = time = 0
var(2) = var(2) - 1

[State 2129, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2120,1

[state 2129, end]
type = changestate
trigger1 = 1
value = 2128

; Dispell Safety Wall
[statedef 2140]
type = S
movetype = A
physics = S
anim = 2000
ctrl = 0
poweradd = -10
sprpriority = 0

[State 2140, PlaySnd]
type = PlaySnd
trigger1 = anim = 2000 && animtime = 0
value = S2140,0

[State 2140, animchange1]
type = changeanim
trigger1 = anim = 2000 && animtime = 0
value = 2001

[State 2140, animchange2]
type = changeanim
trigger1 = anim = 2001 && animtime = 0
value = 2002

[state 2140, end]
type = changestate
trigger1 = anim = 2002 && animtime = 0
value = 0
ctrl = 1







;---------------------------------------------------------------------------
; Firewall Start
[statedef 2150]
type = S
movetype = A
physics = S
anim = 2150
ctrl = 0
poweradd = -450
sprpriority = 0

[state 2150, cast_delay]
type = varset
trigger1 = time = 0
var(8) = 180

[State 2150, TextBoxHelper]
type = Helper
trigger1 = time = 0
helpertype = normal ;player
name = "firewalltext"
ID = 2000
stateno = 2153
pos = ifelse(facing=1,backedgedist,frontedgedist),0
postype = left    ;p2,front,back,left,right
facing = 1

[state 2150, end]
type = changestate
trigger1 = animtime = 0
value = 2151


; Firewall Middle
[statedef 2151]
type = S
movetype = A
physics = S
anim = 2151
ctrl = 0
sprpriority = 0

[State 2151, FireWall1]
type = Helper
trigger1 = time = 0
helpertype = normal
name = "FireWall"
ID = 2155
stateno = 2155
pos = 60,20
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 3.5 * const(size.xscale)
size.yscale = 3.5 * const(size.yscale)

[State 2151, FireWall2]
type = Helper
trigger1 = time = 0
helpertype = normal
name = "FireWall"
ID = 2156
stateno = 2155
pos = 130,10
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 3 * const(size.xscale)
size.yscale = 3 * const(size.yscale)

[State 2151, FireWall]
type = Helper
trigger1 = time = 0
helpertype = normal
name = "FireWall"
ID = 2157
stateno = 2155
pos = 190,0
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 2.5 * const(size.xscale)
size.yscale = 2.5 * const(size.yscale)

[State 2151, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S2150,0

[state 2151, end]
type = changestate
trigger1 = time = 34
value = 2152


; Firewall End
[statedef 2152]
type = S
movetype = A
physics = S
anim = 2152
ctrl = 0
sprpriority = 0

[state 2152, end]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1



; Spell text box
[statedef 2153]
type = A
movetype = I
physics = N
anim = 1
ctrl = 0

[state 2153, destroyBox]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2153
removetime = 1

[state 2153, destroyText]
type = modifyexplod
trigger1 = time > 1
trigger1 = numhelper(2000) > 1
ID = 2154
removetime = 1

[state 2153, OneAtATime]
type = destroyself
trigger1 = time > 1
trigger1 = numhelper(2000) > 1

[State 2153, BindToRoot]
type = BindToRoot
trigger1 = 1
time = 1
facing = 0
pos = 0,0

[state 2153, textbox]
type = Explod
trigger1 = time = 0
anim = 2153
ID = 2153
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 4

[state 2153, textofspell]
type = Explod
trigger1 = time = 0
anim = 2154 ;spell id
ID = 2154
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = 70
ownpal = 1
scale = const(size.xscale), const(size.yscale)
sprpriority = 5

[state 2153, end]
type = destroyself
trigger1 = time > 70




; Firewall Create
[statedef 2155]
type = S
movetype = A
physics = N
anim = 2155
ctrl = 0
sprpriority = 4

[state 2155, init]
type = varset
trigger1 = time = 0
var(1) = 330

[state 2155, change]
type = changestate
trigger1 = animtime = 0
value = 2156

; Firewall Flame
[statedef 2156]
type = S
movetype = A
physics = N
anim = 2156
ctrl = 0
sprpriority = 4

[state 2156, usedinblast]
type = destroyself
triggerall = numhelper(2165)
trigger1 = ishelper((helper(2165), var(2)))

[state 2156, turn]
type = turn
trigger1 = facing = enemynear, facing

[State 2156, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 2158
time = 1
ignorehitpause = 1

[State 2156, HitDef]
type = HitDef
trigger1 = time = 0
attr = S,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
getpower = 0,0
animtype = light          ;light,medium,hard,back,up,diagup
air.animtype = light
priority = 4,Hit   ;Hit,Miss,Dodge
damage = ceil(12 * (root, fvar(4))) ; Game value is 30
pausetime = 3,3
sparkno = S201
sparkxy = -40, (enemynear, pos y) - ((enemynear, const(size.height)) / 2)
hitsound = S2,0
guardsound = S1,0
ground.type = low      ;Low,Trip,None
ground.slidetime = 10
ground.hittime = 10
air.hittime = 20
ground.velocity = -1,-8
air.velocity = -1,-8

[state 2156, decrementhits]
type = varset
trigger1 = movecontact
var(1) = var(1) - 12
persistent = 0

[state 2156, decrementtime]
type = varset
trigger1 = 1
var(1) = var(1) - 1
persistent = 1

[state 2156, destroy]
type = destroyself
trigger1 = (root, stateno = 3201) && (root, time > 5)

[state 2156, end]
type = changestate
trigger1 = var(1) <= 0
value = 2157

[state 2156, restart]
type = changestate
trigger1 = animtime = 0
value = 2156

; Firewall Disapate
[statedef 2157]
type = S
movetype = A
physics = N
anim = 2157
ctrl = 0
sprpriority = 4

[state 2157, destroyself]
type = destroyself
trigger1 = animtime = 0

; Firewall Gethit
[statedef 2158]
type = S
movetype = H
physics = N
anim = 2156
ctrl = 0
sprpriority = 4

[state 2158, decreasedmg]
type = varset
trigger1 = 1
var(1) = var(1) - GetHitVar(damage)

[state 2158, change]
type = changestate
trigger1 = 1
value = 2156







;---------------------------------------------------------------------------
; Fire Blast
[statedef 2160]
type = S
movetype = A
physics = S
anim = 2160
ctrl = 0
poweradd = -300
sprpriority = 0

[state 2160, cast_delay]
type = varset
trigger1 = time = 0
var(8) = 180

[State 2160, Fireblast]
type = Helper
trigger1 = animelem = 29
helpertype = normal
name = "FireBlast"
ID = 2165
stateno = 2165
pos = 55,-70
postype = p1    ;p2,front,back,left,right
facing = 1
ownpal = 1
size.xscale = 2 * const(size.xscale)
size.yscale = 2 * const(size.yscale)

[state 2160, end]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1


; Fire Blast Flame
[statedef 2165]
type = A
movetype = A
physics = N
anim = 2165
ctrl = 0
sprpriority = 5

[State 2165, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 2166
time = 1
ignorehitpause = 1

[state 2165, playsnd]
type = playsnd
trigger1 = time = 0
value = S2070, 0

[state 2165, fireone]
type = varset
triggerall = time = 0 && numhelper(2155) > 0 && var(1) = 0
trigger1 = (parent, pos x) - (helper(2155), pos x) = [-90, 90]
var(2) = 2155

[state 2165, fireoneb]
type = varset
triggerall = time = 0 && numhelper(2155) > 0 && var(1) = 0
trigger1 = (parent, pos x) - (helper(2155), pos x) = [-90, 90]
var(1) = (helper(2155), var(1)) / 2

[state 2165, firetwo]
type = varset
triggerall = time = 0 && numhelper(2156) > 0 && var(1) = 0
trigger1 = (parent, pos x) - (helper(2156), pos x) = [-70, 70]
var(2) = 2156

[state 2165, firetwob]
type = varset
triggerall = time = 0 && numhelper(2156) > 0 && var(1) = 0
trigger1 = (parent, pos x) - (helper(2156), pos x) = [-70, 70]
var(1) = (helper(2156), var(1)) / 2

[state 2165, firethree]
type = varset
triggerall = time = 0 && numhelper(2157) > 0 && var(1) = 0
trigger1 = (parent, pos x) - (helper(2157), pos x) = [-70, 70]
var(2) = 2157

[state 2167, firetwob]
type = varset
triggerall = time = 0 && numhelper(2157) > 0 && var(1) = 0
trigger1 = (parent, pos x) - (helper(2157), pos x) = [-50, 50]
var(1) = (helper(2157), var(1)) / 2

[State 2165, HitDef]
type = HitDef
trigger1 = time = 0
attr = S,SP        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
getpower = 0,0
animtype = hard          ;light,medium,hard,back,up,diagup
air.animtype = hard
priority = 5,Hit   ;Hit,Miss,Dodge
damage = ceil(var(1) * (root, fvar(4))), ceil(0.25 * var(1) * (root, fvar(4)))
pausetime = 0,10
sparkno = S201
sparkxy = -50, 0
hitsound = S2,0
guardsound = S1,0
ground.type = low      ;Low,Trip,None
ground.slidetime = 10
ground.hittime = 10
air.hittime = 20
ground.velocity = -8,0
air.velocity = -5,-3

[state 2165, end]
type = destroyself
trigger1 = animtime = 0

; Fire Blast End
[statedef 2166]
type = A
movetype = H
physics = N

[state 2166, only]
type = destroyself
trigger1 = 1
