;Helpers

;New kyoob code
[statedef 990]
Physics     = N
Anim        = 1010
SprPriority = -1

[State 990]
Type     = AssertSpecial
Trigger1 = 1
Flag     = NoShadow

[State 990, 反転]
type     = turn
trigger1 = (Facing)!=(root,facing)

;---------------------------------------------[ホーミング]

[State 990, 速度X]
type     = Velset
trigger1 = 1
X        = (rootdist x-48)*0.090

[State 990, 速度Y]
type     = Velset
trigger1 = 1
Y        = (rootdist y-60)*0.090

;---------------------------------------------[透過処理]

;---------------------------------------------[各種支援]

[State 990, 各種支援行動]
type     = ChangeState
trigger1 = root,var(10) > 1
trigger1 = root,movetype != H
value    = root,var(10)

;---------------------------------------------[補正中継]

[State 311, Rate中継]
type     = parentVarset
trigger1 = Var(1) = 6
fvar(0)  = root,fvar(0)*0.98*0.98*0.98*0.98*0.98*0.98

[State 311, Rate中継]
type     = parentVarset
trigger1 = Var(1) = 5
fvar(0)  = root,fvar(0)*0.98*0.98*0.98*0.98*0.98

[State 311, Rate中継]
type     = parentVarset
trigger1 = Var(1) = 4
fvar(0)  = root,fvar(0)*0.98*0.98*0.98*0.98

[State 311, Rate中継]
type     = parentVarset
trigger1 = Var(1) = 3
fvar(0)  = root,fvar(0)*0.98*0.98*0.98

[State 311, Rate中継]
type     = parentVarset
trigger1 = Var(1) = 2
fvar(0)  = root,fvar(0)*0.98*0.98

[State 311, Rate中継]
type     = parentVarset
trigger1 = Var(1) = 1
fvar(0)  = root,fvar(0)*0.98

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

[State a, ボーダークラッシュ]
type           = ParentVarAdd
trigger1       = Var(2) > 0
trigger1       = Root,FVar(20) > 0
fvar(20)       = -2.5

[State a, ボーダークラッシュ]
type           = ParentVarSet
trigger1       = Var(2) > 0
trigger1       = Root,FVar(21) < 60
fvar(21)       = 60

[State 311, 変数リセット]
type     = VarSet
trigger1 = 1
var(1)   = 0

[State 311, 変数リセット]
type     = VarSet
trigger1 = 1
var(2)   = 0

;Wait
[StateDef 1069]
type = A
physics = N
moveType = I
anim = 19999
ctrl = 0
velSet = 0,0

[State 1008, End]
type = DestroySelf
trigger1 = !NumTarget
trigger2 = NumTarget
trigger2 = Target, Time <= 1 && !(Target,HitShakeOver)

;Ehhhhh this?
[StateDef 13305]
type = S
moveType = A
ctrl = 0
sprPriority = 5

[State 3305, ChangeAnim]
type = ChangeAnim
trigger1 = Anim != 3501
value = 3501

[State 3305, Counter Flag]
type = VarSet
trigger1 = NumEnemy
trigger1 = MoveContact != 1
var(9) = (EnemyNear, MoveType = A)

[State 3305, Damage Dampener]
type = VarSet
trigger1 = 1
fvar(11) = (Root, fvar(10)) * ifElse(var(9), 1.2, 1)

[State 3305, HitDef]
type = HitDef
trigger1 = HitCount <= 10
trigger1 = Root, StateNo = 3500
trigger1 = Time = 4 && PrevStateNo = 13306 || (Time = 0 && !var(14))
attr = S, HP
hitFlag = MAFDP
guardFlag = M
;priority = 4,Hit
damage = 57, 1
getPower = 0, 0
givePower = 36, 36
pauseTime = 0, 1
guard.pauseTime = 0, 2
animType = DiagUp
air.animType = DiagUp
fall.animType = DiagUp
ground.type = High
air.type = High
ground.hitTime = 15
ground.slideTime = 15
guard.hitTime = 15
air.hitTime = 60
ground.velocity = 1.15,-2.5
ground.cornerPush.velOff = 0
guard.velocity = -3.5
guard.cornerPush.velOff = 0
air.velocity = ifElse(P2Dist x < -10, -8, 8),-2
air.cornerPush.velOff = 0
yAccel = 0.58
fall = 1
fall.recover = 0
forceStand = 1
hitSound = -1
guardSound = -1
sparkNo = -1
guard.sparkNo = -1
sparkXY = -10, -48
sprPriority = 3
p2Facing = ifElse(P2Dist x < -30, -1, 1)
envshake.time = 4
envshake.ampl = -5
envshake.phase = 90
envshake.freq = 70

[State 3305, Miss]
type = HitDef
trigger1 = (Root, var(16))
attr = S, HP
hitFlag =
sparkXY = -10,0

[State 3305, End]
type = ChangeState
trigger1 = MoveContact
value = 13306
ignoreHitPause = 1

[State 3305, End]
type = ChangeState
trigger1 = Root, MoveType = H
trigger2 = Root, StateNo != 3500
trigger3 = AnimElemTime(24) >= 2
value = 13337
ignoreHitPause = 1

;Disappear
[StateDef 13337]
type = A
physics = N
moveType = A
anim = 19999
ctrl = 0
velSet = 0,0
sprPriority = 3
moveHitPersist = 1

[State 3007, End]
type = ChangeState
trigger1 = !AnimTime
value = 1069

;Hit Pause
[StateDef 13306]
type = A
physics = N
moveType = A
ctrl = 0
sprPriority = 3
moveHitPersist = 1
hitCountPersist = 1

[State 3306, PosFreeze]
type = PosFreeze
trigger1 = 1
value = 1

[State 3306, VarSet]
type = VarSet
trigger1 = 1
var(14) = 1

[State 3306, VelSet]
type = VelSet
trigger1 = MoveContact = 1 && NumTarget && (Parent, StateNo = 3500)
x = 0

[State 3306, Hit Spark]
type = Helper
trigger1 = MoveContact = 1 ;&& NumTarget
;trigger1 = !(Target, HitShakeOver)
;trigger2 = movecontact && p2stateno = [75000,75999]
helperType = Normal
stateNo = ifElse(MoveGuarded, 7500, 7502)
ID = 7500
name = "Spark"
posType = P1
pos = ifElse(P2Dist x < -10, -10, ifElse(P2Dist x < 64, ceil(P2Dist x), 64)), ceil(P2Dist y - 35)
facing = 1
ownPal = 1
size.xScale = 1
size.yScale = 1
pauseMoveTime = 65535
superMoveTime = 65535
ignoreHitPause = 1

[State 3306, Parent Hit Count]
type = ParentVarAdd
trigger1 = !Time
trigger1 = MoveContact && NumTarget
var(13) = 1

[State 3306, Self Hit Count]
type = VarAdd
trigger1 = !Time
trigger1 = MoveContact && NumTarget
var(13) = 1

[State 3306, Juggle Points]
type = ParentVarAdd
trigger1 = !Time
trigger1 = MoveContact && NumTarget
var(15) = 1

[State 3306, ProjContact]
type = VarSet
trigger1 = MoveContact && NumTarget
var(18) = 1

[State 3306, ProjContact]
type = ParentVarSet
triggerAll = MoveContact && NumTarget
trigger1 = Root, StateNo = 3500
var(18) = 1

[State 3306, End]
type = ChangeState
trigger1 = Time >= 0
value = 13305

;Guard Spark (Normal)
[StateDef 7500]
type = A
physics = N
moveType = I
anim = 19999
velset = 0,0
sprPriority = 5

[state 1000]
type = gamemakeAnim
trigger1 = !time
value = 40
pos = ifElse(P2Dist x < -5, -5, ifElse(P2Dist x < 64, ceil(P2Dist x), 64)), ceil(P2Dist y - 35)
ignorehitpause = 1

[state 1000]
type = playsnd
trigger1 = time = 0
value = F6,0

[State 8000, Assert: No Shadow]
type = AssertSpecial
trigger1= 1
flag = NoShadow

[State 8000, End]
type = DestroySelf
trigger1 = Time >= 9

;Special Move Hit Spark
[StateDef 7550]
type = A
physics = N
moveType = I
anim = 19999
velSet = 0,0
sprPriority = 5

[State 8010, Assert: NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow

[state 1000]
type = playsnd
trigger1 = time = 0
value = F5,1

[state 1000]
type = gamemakeAnim
trigger1 = !time
value = 1
ignorehitpause = 1

[State 8010, End]
type = DestroySelf
trigger1 = Time >= 15

;Special Move Hit Spark
[StateDef 7502]
type = A
physics = N
moveType = I
anim = 19999
velSet = 0,0
sprPriority = 5

[State 8010, Assert: NoShadow]
type = AssertSpecial
trigger1 = 1
flag = NoShadow

[state 1000]
type = playsnd
trigger1 = time = 0
value = F5,3

[state 1000]
type = gamemakeAnim
trigger1 = !time
value = 3
ignorehitpause = 1

[State 8010, End]
type = DestroySelf
trigger1 = Time >= 15