; Variables
; ----------------------------------------------------------------------------------------------------
; 0 - # of consecutive jumps
; 1 - Low HP Warning
; 2 - Fall or Float?
; 3 - Y Position
; 4 - Shielding Damage Counter
; 5 - Temporary Variable for Parasol Splash
; 10 - Target's X Pos
; 11 - Target's Y Pos
; 12 - Time for an explosion?
; 57 - Last life?
; 58 - Intro/Landing Star randomizer

; Normal States
;---------------------------------------------------------------------------
;Sparring
[Statedef 650]
type    = S
movetype= A
physics = S
juggle  = 4
ctrl = 0
anim = 650
velset = 0,0
sprpriority = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time %6=0
value = S0,2

[State 0, Projectile]
type = Projectile
trigger1 = Time %6=0
ProjID =  655
projanim =  655
projhitanim = 9999
projremovetime = 4
velocity = 4,0
projpriority = 5
projsprpriority = 5
offset = 5,-13+random%10
postype = p1         ;p2,front,back,left,right
projshadow = 0,0,0
supermovetime = 0
pausemovetime = 0
attr = A, SP
damage    = 10,0
animtype  = Med
guardflag = HA
pausetime = 2, 2
sparkno = 0
sparkxy = 10, -2
hitsound = S1, 0
guardsound = 6, 0
ground.type = low
ground.slidetime = 10
ground.hittime = 20
ground.velocity = -1
airguard.velocity = -1, -0.25
air.velocity = -6, -0.50
air.hittime = 5
ownpal = 1

[state 0]
type = changestate
trigger1 = Time = 36
value = 651

;---------------------------------------------------------------------------
;Sparring final
[Statedef 651]
type    = S
movetype= A
physics = S
juggle  = 4
ctrl = 0
anim = 651
velset = 0,0
sprpriority = 2


[State 100, Dashing sound]
type = PlaySnd
trigger1 = AnimElem = 1
value = S100, 0
channel = 0

[State 100, Dashing sound]
type = PlaySnd
trigger1 = AnimElem = 2
value = S0, 1
channel = 2

[State 100, Heavy Dust A]
type = Explod
trigger1 = Time%12=0
anim = ifelse(random>500,7050,7053)
ID = 400
pos = -20, -4
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = 1.75, 0
removetime = -2
sprpriority = 9
ownpal = 1

[state 650, var]
type = velset
trigger1 = animelem = 1
x = 10
y = 0

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 =AnimElem = 2
physics = S

[State 640, 3]
type = HitDef
trigger1 = !time
attr = s, SA
damage    = 50+(var(21)>20 && var(21)<46)*20 +(var(21)>46 && var(21)<110)*35+(var(21)>=110)*70
guardflag = HA
priority = 4
pausetime = 10,8
sparkno = 0
sparkxy = -5,-12
hitsound = S1, 0
guardsound = 6,0
animtype = Med
ground.type = high
ground.slidetime = 15
ground.hittime  = 15
ground.velocity = -3-(var(21)=[10,109])*1.5 -(var(21)>=110)*4,-2
air.velocity = -2,-2

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

[state 230]
type = changestate
trigger1 = frontedgebodydist <= 0
value = 241
ctrl = 0


;---------------------------------------------------------------------------
;Rolling Mini Upper
[Statedef 750]
type    = S
movetype= A
physics = N
juggle  = 4
ctrl = 0
anim = 750
velset = 4,0
sprpriority = 2

[State 0, NotHitBy]
type = NotHitBy
trigger1 =1
value = SCA,NP,SP,HP

[State -3, lv1supershadow]
type=afterimage
trigger1= !time
time=20
timegap=1
framegap=10
length=21
paladd=0,0,0
palmul=.75,.75,.75
palcontrast=255,255,255
palpostbright=0,0,0


[State 0, ChangeState]
type = ChangeState
trigger1 = !AnimTime
value = 751
ctrl = 0

;---------------------------------------------------------------------------
;Rolling Mini Upper GO
[Statedef 751]
type    = S
movetype= A
physics = N
juggle  = 10
poweradd= 20
ctrl = 0
anim = 751
velset = 0,0
sprpriority = 2

[State 0, VelSet]
type = VelSet
trigger1 =  AnimElem = 2
x = 3.1
y = -10

[State 41, Jumping sound]
type = PlaySnd
trigger1 =  AnimElem = 2
value = S40,0

[State 41, Jump Puff]
type = Explod
trigger1 =  AnimElem = 2
anim = IfElse(var(0) > 5, 7021, 7020)
ID = 7020
pos = 0, 0
postype = p1
facing = 1
vfacing = 1
vel = 0, 0
removetime = -2
sprpriority = -9
ownpal = 1


[State 0, StateTypeSet]
type = StateTypeSet
trigger1 =  AnimElem = 2
statetype = A
physics = A

[State 100, Dashing sound]
type = PlaySnd
trigger1 = AnimElem = 1
value = S100, 0
channel = 0

[State 100, Dashing sound]
type = PlaySnd
trigger1 = AnimElem = 2
value = S0, 1
channel = 2

[State 640, 3]
type = HitDef
trigger1 = !time
attr = s, SA
damage    = 80,10
guardflag = HA
priority = 4
pausetime = 10,8
sparkno = 0
sparkxy = -5,-20
hitsound = S1, 0
guardsound = 6,0
animtype = Diagup
ground.type = Hard
ground.slidetime = 15
ground.hittime  = 15
ground.velocity = -2,-10
air.velocity = -2,-10
fall=1

[state 0]
type = changestate
trigger1 = animtime = 0
value = 50
ctrl = 1

;--------------------------------------------
;bounce back
[statedef 241]
type = S
movetype = I
physics = N
ctrl = 0
velset = 0,0
anim = 241

[state 241]
type = playsnd
trigger1 = time = 0
value = 170,1
volume = 255

[State 0, AfterImageTime]
type = AfterImageTime
trigger1 = time = 0
time = 1

[State 0, EnvShake]
type = EnvShake
trigger1 = time = 0
time = 10
freq = 60
ampl = -3
phase = 90

[state 241]
type = statetypeset
trigger1 = pos Y!= 0
statetype = A
physics = A

[state 241]
type = velset
trigger1 = time = 0
x = -1
y = -5

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = animtime = 0
id = 8200

[state 241]
type = changestate
trigger1 = vel Y> 0 && pos Y>= 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
; Sky Delivery
[Statedef 400]
type = A
movetype = A
physics = N
juggle = 0
ctrl = 0
anim = 400
sprpriority = 2
velset = 0,0

[State 0, VelSet]
type = VelSet
trigger1 = AnimElem = 3
x = 6
y = 12

[State 100, Dashing sound]
type = PlaySnd
trigger1 = AnimElem = 2
value = S0, 3
channel = 0

[State 41, Jump Puff]
type = Explod
trigger1 = Time = 0
anim = IfElse(var(0) > 5, 7021, 7020)
ID = 7020
pos = 0, 0
postype = p1
facing = 1
vfacing = 1
vel = 0, 0
removetime = -2
sprpriority = -9
ownpal = 1

[State 640, 3]
type = HitDef
trigger1 = Time%2=0 && Vel Y >0
attr = A, SA
damage    = 15,7
guardflag = HA
priority = 4
pausetime = 4,8
sparkno = 0
sparkxy = -5,-20
hitsound = S1, 0
guardsound = 6,0
animtype = Hard
ground.type = High
ground.slidetime = 15
ground.hittime  = 15
ground.velocity = -3,0
air.velocity = -1,6

[State 0, Explod]
type = Explod
trigger1 = Time%2=0 && Vel Y >0
anim = 401
ID = 401
pos = 0,0
postype = p1  ;p2,front,back,left,right
sprpriority = -2
ownpal = 1
removeongethit = 1

[State 0, VelAdd]
type = VelAdd
trigger1 = time > 6
y = const(movement.yaccel)

[State 0, ChangeState]
type = ChangeState
trigger1 = Pos Y >=0 && Vel Y >0
value = 420
ctrl = 0

;---------------------------------------------------------------------------
; Sky DeliveryLand
[Statedef 420]
type = S
movetype = I
physics = S
juggle = 0
ctrl = 0
anim = 47
sprpriority = 2
velset = 0,0

[State 0, PosSet]
type = PosSet
trigger1 =  !time
y = 0

[State 0, EnvShake]
type = EnvShake
trigger1 =  !time
time = 10
freq = 30

[State 4002, land Star generator]
Type = Explod
trigger1 =  !time
anim = 7015
pos = 0,0
ownpal = 1
id = 7015
sprpriority = 3
ignorehitpause = 1
vel = (IfElse(Random <= 499,Random/240+0.5,Random/(-240)-0.5)),Random/(-240)
scale = 1,1
facing = 1
supermove = 9999999
pausemovetime = 999999

[State 52, Landing sound]
type = PlaySnd
trigger1 =  !time
value = 170,1
volume = 255


[State 0, Helper]
type = Helper
trigger1 = !time && !NumHelper(9990)
helpertype = normal ;player
name = "stars"
ID = 9990
stateno =9990
pos = 0,-10
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 1

[State 0, Helper]
type = Helper
trigger1 = !time && !NumHelper(9991)
helpertype = normal ;player
name = "stars"
ID = 9991
stateno =9990
pos = 0,-10
postype = p1    ;p2,front,back,left,right
facing = -1
keyctrl = 0
ownpal = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;Flame Breath
[Statedef 1000]
type    = A
movetype= A
physics = N
juggle  = 4
poweradd= 20
ctrl = 0
anim = 1000
velset = 0,0
sprpriority = 2


[State 100, Dashing sound]
type = PlaySnd
trigger1 = AnimElem = 1
value = S0, 0
channel = 2


[State 0, Helper]
type = Helper
trigger1 = AnimElem = 2
helpertype = normal ;player
name = "fire"
ID = 1010
stateno = 1010
pos = 15,-4
postype = p1
facing = 1
keyctrl = 0
ownpal = 1

[state 0]
type = changestate
trigger1 = Time = 40
value = 1005

;---------------------------------------------------------------------------
;Flame Breath end
[Statedef 1005]
type    = A
movetype= A
physics = N
juggle  = 4
poweradd= 20
ctrl = 0
anim = 1005
velset = 0,0
sprpriority = 2


[state 0]
type = changestate
trigger1 = !AnimTime
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;FX
[Statedef 1010]
type    = A
movetype= A
physics = N
poweradd= 20
ctrl = 0
anim = 1010
velset = 0,0
sprpriority = 10

[State 0, BindToRoot]
type = BindToRoot
trigger1 =1
time = 1
pos = 15,-4
ignorehitpause = 1

[State 0, HitDef]
type = HitDef
trigger1 = !time
attr = A, SP
damage   = 100,20
animtype = heavy
getpower = 0,0
guardflag = MA
hitflag = MAFP
sparkno = 0
pausetime = 0,10
hitsound   = S1,1
guardsound = 6,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.Velocity = -10,-2
fall = 1
air.animtype = Back
air.Velocity = -10,-2
air.juggle = 3
air.fall = 1
palfx.time = 60
palfx.add = 240,50,0
palfx.mul = 250,224,120
palfx.sinadd = 110,55,85,3
Palfx.color = 0

[State 1051, new flame]
type = Explod
triggerall = numtarget && NumExplod(7400)=0
trigger1 = !(target,ishelper) && MoveHit
anim = 7400
ID = 7400
postype = P2
pos = 0,-10
pausemovetime = 9999
supermovetime = 9999
sprpriority = 500
removetime = 60
bindtime = -1
ownpal = 1
scale = 1.25,1.25
ignorehitpause = 1

[State 0, DestroySelf]
type = DestroySelf
trigger1 = !AnimTime

;---------------------------------------------------------------------------
;Fireball
[Statedef 1020]
type    = A
movetype= A
physics = N
juggle  = 4
poweradd= 20
ctrl = 0
anim = 1000
velset = 0,0
sprpriority = 2


[State 100, Dashing sound]
type = PlaySnd
trigger1 = AnimElem = 1
value = S0, 0
channel = 2

[State 3000, Eff2]
type = Projectile
trigger1 = Time = 11
projID = 1025
projanim = 1025
projhitanim = 1026
projremanim = 1026
projhits = 1
projmisstime = 1
projshadow = -1
projpriority = 5
projid = 1025
velocity = 4,4
offset = 15,-4
attr = S, HP
damage   = 80,20
animtype = heavy
getpower = 0,0
guardflag = MA
hitflag = MAFP
sparkno = 0
sparkxy = 0, 0
pausetime = 3,6
hitsound   = S1,1
guardsound = 6,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.Velocity = -6,-4
fall = 1
air.animtype = Back
air.Velocity = -6,-4
air.juggle = 3
air.fall = 1
palfx.time = 60
palfx.add = 240,50,0
palfx.mul = 250,224,120
palfx.sinadd = 110,55,85,3
Palfx.color = 0

[state 0]
type = changestate
trigger1 = Time = 30
value = 1005

;---------------------------------------------------------------------------
;Blazing Dive
[Statedef 1200]
type    = A
movetype= A
physics = N
juggle  = 4
poweradd= 20
ctrl = 0
anim = 1200
velset = 0,0
sprpriority = 2


[State 100, Dashing sound]
type = PlaySnd
trigger1 = Time = 11
value = S0, 4

[State 0, VelSet]
type = VelSet
trigger1 = Time = 11
x = 6
y = ifelse(command="holddown",16,6)

[State 0, VelAdd]
type = VelAdd
trigger1 = 1
y = -0.25;ifelse(command="holddown",-0.35,-0.25)

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 20
value = 1205

[State 0, HitDef]
type = HitDef
trigger1 = !time
attr = A, SA
damage   = 100,20
animtype = heavy
getpower = 0,0
guardflag = MA
hitflag = MAFP
sparkno = 0
pausetime = 10,10
hitsound   = S1,1
guardsound = 6,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.Velocity = -10,-4
fall = 1
air.animtype = Back
air.Velocity = -10,-4
air.juggle = 3
air.fall = 1
palfx.time = 60
palfx.add = 240,50,0
palfx.mul = 250,224,120
palfx.sinadd = 110,55,85,3
Palfx.color = 0

[State 1051, new flame]
type = Explod
triggerall = numtarget && NumExplod(7400)=0
trigger1 = !(target,ishelper) && MoveHit
anim = 7400
ID = 7400
postype = P2
pos = 0,-10
pausemovetime = 9999
supermovetime = 9999
sprpriority = 500
removetime = 60
bindtime = -1
ownpal = 1
scale = 1.25,1.25
ignorehitpause = 1

[State -3, lv1supershadow]
type=afterimage
trigger1= !time
time=60
timegap=1
framegap=10
length=21
paladd=0,0,0
palmul=.75,.75,.75
palcontrast=255,255,255
palpostbright=0,0,0

[state 0]
type = changestate
trigger1 = Anim = 1205 && Time = 55
trigger2 = Pos Y < -190 && Time > 30
value = 1210

;---------------------------------------------------------------------------
;Blazing Dive end
[Statedef 1210]
type    = A
movetype= A
physics = N
juggle  = 4
poweradd= 20
ctrl = 0
anim = 1210
sprpriority = 2

[State 0, VelAdd]
type = VelAdd
trigger1 = 1
x = -0.1
y = 0.1

[State 0, ChangeState]
type = ChangeState
trigger1 = Time = 10
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;Fire rain
[Statedef 2100]
type    = A
movetype= A
physics = N
juggle  = 4
poweradd= 20
ctrl = 0
anim = 2100
velset = 0,-1
sprpriority = 2

[State 100, Dashing sound]
type = PlaySnd
trigger1 = AnimElem = 1
value = S0, 1

[state 0]
type = changestate
trigger1 = Time = 30
value = 2105

;---------------------------------------------------------------------------
;Fire rain GO
[Statedef 2105]
type    = A
movetype= A
physics = N
juggle  = 4
poweradd= 20
ctrl = 0
anim = 2105
velset = 0,0
sprpriority = 2

[State 100, Dashing sound]
type = PlaySnd
trigger1 = AnimElem = 1
value = S0, 3
channel = 2

[State 3000, Eff2]
type = Projectile
trigger1 = Time = 11
projID = 1025
projanim = 1025
projhitanim = 1026
projremanim = 1026
projhits = 1
projmisstime = 1
projshadow = -1
projpriority = 5
projid = 1025
velocity = 2,4
offset = 0,-4
attr = S, HP
damage   = 40,20
animtype = heavy
getpower = 0,0
guardflag = MA
hitflag = MAFP
sparkno = 0
sparkxy = 0, 0
pausetime = 3,6
hitsound   = S1,1
guardsound = 6,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.Velocity = -6,-4
fall = 1
air.animtype = Back
air.Velocity = -6,-4
air.juggle = 3
air.fall = 1
palfx.time = 60
palfx.add = 240,50,0
palfx.mul = 250,224,120
palfx.sinadd = 110,55,85,3
Palfx.color = 0

[State 3000, Eff2]
type = Projectile
trigger1 = Time = 11
projID = 1025
projanim = 1025
projhitanim = 1026
projremanim = 1026
projhits = 1
projmisstime = 1
projshadow = -1
projpriority = 5
projid = 1025
velocity = 4,4
offset = 0,-4
attr = S, HP
damage   = 40,20
animtype = heavy
getpower = 0,0
guardflag = MA
hitflag = MAFP
sparkno = 0
sparkxy = 0, 0
pausetime = 3,6
hitsound   = S1,1
guardsound = 6,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.Velocity = -6,-4
fall = 1
air.animtype = Back
air.Velocity = -6,-4
air.juggle = 3
air.fall = 1
palfx.time = 60
palfx.add = 240,50,0
palfx.mul = 250,224,120
palfx.sinadd = 110,55,85,3
Palfx.color = 0

[State 3000, Eff2]
type = Projectile
trigger1 = Time = 11
projID = 1025
projanim = 1025
projhitanim = 1026
projremanim = 1026
projhits = 1
projmisstime = 1
projshadow = -1
projpriority = 5
projid = 1025
velocity = 0,4
offset = 0,-4
attr = S, HP
damage   = 40,20
animtype = heavy
getpower = 0,0
guardflag = MA
hitflag = MAFP
sparkno = 0
sparkxy = 0, 0
pausetime = 3,6
hitsound   = S1,1
guardsound = 6,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.Velocity = -6,-4
fall = 1
air.animtype = Back
air.Velocity = -6,-4
air.juggle = 3
air.fall = 1
palfx.time = 60
palfx.add = 240,50,0
palfx.mul = 250,224,120
palfx.sinadd = 110,55,85,3
Palfx.color = 0

[State 3000, Eff2]
type = Projectile
trigger1 = Time = 11
projID = 1025
projanim = 1025
projhitanim = 1026
projremanim = 1026
projhits = 1
projmisstime = 1
projshadow = -1
projpriority = 5
projid = 1025
velocity = -2,4
offset = 0,-4
attr = S, HP
damage   = 40,20
animtype = heavy
getpower = 0,0
guardflag = MA
hitflag = MAFP
sparkno = 0
sparkxy = 0, 0
pausetime = 3,6
hitsound   = S1,1
guardsound = 6,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.Velocity = -6,-4
fall = 1
air.animtype = Back
air.Velocity = -6,-4
air.juggle = 3
air.fall = 1
palfx.time = 60
palfx.add = 240,50,0
palfx.mul = 250,224,120
palfx.sinadd = 110,55,85,3
Palfx.color = 0

[State 3000, Eff2]
type = Projectile
trigger1 = Time = 11
projID = 1025
projanim = 1025
projhitanim = 1026
projremanim = 1026
projhits = 1
projmisstime = 1
projshadow = -1
projpriority = 5
projid = 1025
velocity = -4,4
offset = 0,-4
attr = S, HP
damage   = 40,20
animtype = heavy
getpower = 0,0
guardflag = MA
hitflag = MAFP
sparkno = 0
sparkxy = 0, 0
pausetime = 3,6
hitsound   = S1,1
guardsound = 6,0
ground.type = Low
ground.slidetime = 25
ground.hittime  = 25
ground.Velocity = -6,-4
fall = 1
air.animtype = Back
air.Velocity = -6,-4
air.juggle = 3
air.fall = 1
palfx.time = 60
palfx.add = 240,50,0
palfx.mul = 250,224,120
palfx.sinadd = 110,55,85,3
Palfx.color = 0

[state 0]
type = changestate
trigger1 = Time = 60
value = 1005
ctrl = 1

;---------------------------------------------------------------------------
; STARS
[Statedef 9990]
type = S
movetype = I
physics = S
juggle = 0
ctrl = 0
anim = 9990
sprpriority = 10
velset =10,0

[State 0, Explod]
type = Explod
trigger1 =time = 1 && !NumExplod(9996)
anim = 9996
ID = 9996
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
scale = 1,1
sprpriority = 9
ownpal = 0

[State 0, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,AA,AT,AP
time = 10
stateno = 9991
ignorehitpause = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = Time >= 120
value = 9995
ctrl = 0

;---------------------------------------------------------------------------
; STARS ATTACK
[Statedef 9991]
type = S
movetype = A
physics = N
juggle = 0
ctrl = 0
anim = 9990
sprpriority = 2

[State 0, VelSet]
type = VelSet
trigger1 = !time
x = -3
y = gethitvar(yvel)

[State 640, 3]
type = HitDef
trigger1 = !time
attr = A, NA
damage    = 80,10
guardflag = HA
priority = 4
pausetime = 2,2
sparkno = 0
sparkxy = -5,0
hitsound = S1, 0
guardsound = 6,0
animtype = Med
ground.type = low
ground.slidetime = 15
ground.hittime  = 15
ground.velocity = 1,-1
air.velocity = -1,6
affectteam = F
p1stateno = 9995

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,AA,AT,AP
time = 10

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = Time >=35
id = 9996
;ignorehitpause =
;persistent =

[State 0, DestroySelf]
type = DestroySelf
trigger1 = Time >=35

;---------------------------------------------------------------------------
; STARS  END
[Statedef 9995]
type = S
movetype = I
physics = S
juggle = 0
ctrl = 0
anim = 9991
sprpriority = 2
velset = 0,0

[State 632, 1]
type = palfx
trigger1 = time > 0
time = 1
add = -time*10,-time*10,-time*10
trans = add

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = Time >=35
id = 9996
;ignorehitpause =
;persistent =

[State 0, DestroySelf]
type = DestroySelf
trigger1 = Time >=35



;---------------------------------------------------------------------------
; Lost a Life
[Statedef 7050]
type = S
movetype = I
physics = S
anim = 5000
velset = 0, 0

[State 7050, ]
type = AngleDraw ;activacte Angle modification
trigger1 = time >= 2

[State 7050, ]
type = AngleAdd ; add Value to rotate, more value, more fast its rotate.
trigger1 = time >= 2
value = 14 ; modify this value to spin. Negative numbers are allowed.

[State 7050, Ach! Ah'm dead!]
type = PlaySnd
trigger1 = Time = 0
value = S170, 1

[State 7050, Pause for a little bit.]
type = Pause
trigger1 = Time = 0
time = 30
movetime = 1

[State 7050, Shake the screen a little bit.]
type = EnvShake
trigger1 = Time = 0
time = 10
freq = 100
ampl = -4
phase = 250

[State 7050, Ach! Ah'm ded!]
type = PlaySnd
trigger1 = Time = 2
value = S170, 2

[State 7050, Death Star - Up]
type = Explod
trigger1 = Time = 2
anim = 7016
ID = 7016
pos = 0, -15
postype = p1
facing = 1
vfacing = 1
vel = 0, -7.5
removetime = -2
sprpriority = 9
ownpal = 1

[State 7050, Death Star - Up-Right]
type = Explod
trigger1 = Time = 2
anim = 7016
ID = 7016
pos = 0, -15
postype = p1
facing = 1
vfacing = 1
vel = 5, -5
removetime = -2
sprpriority = 9
ownpal = 1

[State 7050, Death Star - Right]
type = Explod
trigger1 = Time = 2
anim = 7016
ID = 7016
pos = 0, -15
postype = p1
facing = 1
vfacing = 1
vel = 7.5, 0
removetime = -2
sprpriority = 9
ownpal = 1

[State 7050, Death Star - Down-Right]
type = Explod
trigger1 = Time = 2
anim = 7016
ID = 7016
pos = 0, -15
postype = p1
facing = 1
vfacing = 1
vel = 5, 5
removetime = -2
sprpriority = 9
ownpal = 1

[State 7050, Death Star - Down]
type = Explod
trigger1 = Time = 2
anim = 7016
ID = 7016
pos = 0, -15
postype = p1
facing = 1
vfacing = 1
vel = 0, 7.5
removetime = -2
sprpriority = 9
ownpal = 1

[State 7050, Death Star - Down-Left]
type = Explod
trigger1 = Time = 2
anim = 7016
ID = 7016
pos = 0, -15
postype = p1
facing = 1
vfacing = 1
vel = -5, 5
removetime = -2
sprpriority = 9
ownpal = 1

[State 7050, Death Star - Left]
type = Explod
trigger1 = Time = 2
anim = 7016
ID = 7016
pos = 0, -15
postype = p1
facing = 1
vfacing = 1
vel = -7.5, 0
removetime = -2
sprpriority = 9
ownpal = 1

[State 7050, Death Star - Up-Left]
type = Explod
trigger1 = Time = 2
anim = 7016
ID = 7016
pos = 0, -15
postype = p1
facing = 1
vfacing = 1
vel = -5, -5
removetime = -2
sprpriority = 9
ownpal = 1

[State 7050, Gravity applies to it.]
type = Gravity
trigger1 = Time > 2

[State 7050, Spinning out...]
type = ChangeAnim
trigger1 = Time = 2
value = 193

[State 7050, Up we go...!]
type = VelSet
trigger1 = Time = 2
y = -10

[State 7050, Flicker]
type = PalFX
trigger1 = TimeMod = 6, 2
add = 0, 0, 0
time = 3

[State 7050, Don't follow Parasol Waddle Dee.]
type = ScreenBound
trigger1 = 1
value = 0

[State 7050, Don't bother giving it a shadow when it's below the ground.]
type = AssertSpecial
trigger1 = Pos Y > 0
flag = NoShadow

[State 7050, After we're off screen, we're dead.]
type = ChangeState
trigger1 = Pos Y > 200
value = 5150




;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------

[Statedef -2]

[State 1051, new flame]
type = Explod
triggerall = numtarget && NumExplod(7400)=0
trigger1 = !(target,ishelper) && ProjHit(1025) =1
anim = 7400
ID = 7400
postype = P2
pos = 0,-10
pausemovetime = 9999
supermovetime = 9999
sprpriority = 500
removetime = 60
bindtime = -1
ownpal = 1
scale = 1.25,1.25
ignorehitpause = 1


[State -2, No auto guard!]
type = AssertSpecial
trigger1 = 1
flag  = NoStandGuard
flag2 = NoCrouchGuard
flag3 = NoAirGuard

[State -2, Auto-Turn Off]
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State -2, Turn to face your opponent.]
type = Turn
trigger1 = Command = "holdback" && Command != "holdfwd"
trigger1 = Ctrl = 1
trigger1 = RoundState >= 2

[State -2, Reset jumps counter]
type = VarSet
trigger1 = StateType = A
var(0) = 0

[State -2, Danger, Will Robinson! - Sound]
type = PlaySnd
trigger1 = Life < 150 && var(1) = 0
value = S170,0

[State -2, Danger, Will Robinson! - Variable]
type = VarSet
trigger1 = Life < 150
var(1) = 1

[State -2, Danger, Will Robinson! - False Alarm...]
type = VarSet
trigger1 = var(1) = 1 && Life > 150
var(1) = 0

[State -2, Danger, Will Robinson! - Flashing]
type = PalFX
trigger1 = var(1) = 1 && Life != 0
trigger1 = TimeMod = 8, 2
add = 128, -64, -64
time = 4

[State -2, Y Position, please.]
type = VarSet
trigger1 = 1
var(3) = ceil(Pos Y)

[State -2, Go to "Lost a Life" state.]
type = ChangeState
trigger1 = Life = 0 && StateNo = [5000, 5149]
value = 7050
ctrl = 0

[State -2, Show me a few variables!]
type = DisplayToClipboard
trigger1 = 1
text = "Jumps: %d, LowHP: %d, Fall: %d, YPos: %d, LastChance?: %d"
params = var(0), var(1), var(2), var(3), var(57)

[State -2, Show me MORE few variables!]
type = AppendToClipboard
trigger1 = 1
text = "\nDamage: %d - Helpers: %d - scale: %d - P2 X: %.0f"
params = var(30),var(42),var(41), p2bodydist X



[State -2, Keep an eye on the target's X Position!]
type = VarSet
triggerall = NumTarget
trigger1 = Target, var(37) = 10538
var(10) = Target, Pos X

[State -2, Keep an eye on the target's Y Position!]
type = VarSet
triggerall = NumTarget
trigger1 = Target, var(37) = 10538
var(11) = Target, Pos Y

[State -2, Blow it up now!]
type = VarSet
triggerall = NumTarget
trigger1 = Target, var(37) = 10538
var(12) = 1

[State -2, Drop it!]
type = TargetDrop
triggerall = NumTarget
trigger1 = Target, var(37) = 10538
excludeID = -1

[State -2, Don't die again...]
type = VarSet
trigger1 = !Alive
var(57) = 1

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

[State -2, Remove HyperBG]
type = RemoveExplod
trigger1 = MoveType = H || Stateno <3000
ID = 8200

[State 0, flames]
type = Explod
triggerall = stateno!=7050
trigger1 = Time%10=1
anim = 1
ID = 1
pos = 0,-25
postype = p1  ;p2,front,back,left,right
bindtime = 1
random = 30,20
sprpriority = 20
ownpal = 1
removeongethit = 0
accel = 0,-0.1

;---------------------------------------------------------------
[statedef -3]

;-----new armor

[State 0, NotHitBy]
type = NotHitBy
trigger1 = RoundState !=2
value = SCA

[State -3, FILHA DA PUTA DE CODIGO]
type = HitOverride
trigger1 = 1
attr = SCA,NA ,SA ,HA ,NP ,SP ,HP, NT, ST, HT
slot = 0
stateno = 5000
forceair = 1
ignorehitpause = 1
time = -1

;----------------------------------------------
[State -3, Physics]
type=varset
trigger1=movetype=H
var(6)=0

;---Physics---
[State -3, Limit]
type=velset
trigger1=pos y>10&&vel y>0&&stateno!=5150 &&stateno!=7050
trigger2=Pos Y <-150 &&stateno!=5150 &&stateno!=7050 && command!="holddown"
y=0

[State -3, Limit]
type=posset
trigger1=pos y>10&&stateno!=5150&&stateno!=7050
y=10

[State -3, Stop]
type=velset
triggerall=var(5)
trigger1=ctrl*(command!="holdfwd"&&command!="holdback")&&abs(vel x)<.2 &&stateno!=7050
trigger2=(vel x>0&&frontedgebodydist<=0)||(vel x<0&&backedgebodydist<=0)
x=0

[State -3, Stop]
type=velset
triggerall=var(6)&&stateno!=7050
trigger1=ctrl*(command!="holdup"&&command!="holddown")&&(pos y=[-100,-20])&&abs(vel y)<.2
trigger2=vel y>0&&pos y>=0
y=0

[State -3, Slow]
type=velmul
triggerall=var(6)
trigger1=!ctrl
trigger2=ctrl&&command!="holdfwd"&&command!="holdback"
trigger3=abs(vel x)>=2.01
x=.95

[State -3, Slow]
type=velmul
triggerall=(pos y=[-150,-20]) &&stateno!=7050
trigger1=!ctrl
trigger2=ctrl&&command!="holdup"&&command!="holddown"
trigger3=abs(vel y)>=2.01
y=.95

[State -3, Limit]
type=veladd
trigger1=var(6) &&stateno!=7050
trigger1=pos y>-20||pos y<-150
y=ifelse(pos y>-20,-.1,ifelse(pos y<-180,.1,0))

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

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


[State -3]
type = null;NotHitBy
trigger1 = 1
value = ,NT,ST,HT

[State -3, hitoverride]
type=null;hitoverride
trigger1=1
attr=SCA,AA,AP,AT
time=-1
stateno=10010
ignorehitpause=1

[State -3, hitby]
type=null;hitby
trigger1=1
value=SCA,NA,SA,HA,NP,SP,HP
time=-1
ignorehitpause=1










