[StateDef -2]

[State -2, SelfState::Helper]
Type       = SelfState
Trigger1   = IsHelper
Value      = 15900
IgnoreHitPause = 1


;---------------------------------------------------------------------
[State -2, AssertSpecial]
Type = AssertSpecial
Trigger1   = RoundState != 2
Flag       = NoKO
IgnoreHitPause = 1

[State -2, AssertSpecial]
Type       = AssertSpecial
TriggerAll = RoundState = 4
Trigger1   = Anim = 170 && AnimElemTime(3) < 140
Trigger2   = Anim = 180 && AnimElemTime(4) < 140
Flag       = RoundNotOver
IgnoreHitPause = 1

[State -2, Boost]
Type       = Null
Trigger1   = Var(10) <= 0 && !Var(11)
Trigger1   = Var(11) := 1000                                                               && 0
Trigger2   = Var(11)  > 0
Trigger2   = MoveType != A && StateNo != 110
Trigger2   = Var(11) := Var(11) - 2 - 2 * (PalNo >= 7) - 2 * (PalNo = 12)                  || 1
Trigger2   = Var(11) <= 0
Trigger2   = Var(10) := 1000 && Var(11) := 0
Trigger3   = Var(10)  < 0
Trigger3   = Var(10) := 0
Trigger4   = !Var(11)
Trigger4   = Var(10)  < 1000
Trigger4   = MoveType != A && StateNo != 110
Trigger4   = Var(10) := Var(10) + 2 + 3 * (!StateNo) + 3 * (PalNo >= 7) + 3 * (PalNo = 12) && 0
Trigger5   = Var(10)  > 1000
Trigger5   = Var(10) := 1000
IgnoreHitPause = 1

[State -2, PlaySnd]
Type       = PlaySnd
Trigger1   = !Alive
Trigger1   = !(SysVar(0) & 8)
Value      = 5005, 0
IgnoreHitPause = 1

[State -2, SysVar(0)Set]
Type       = Varset
Trigger1   = !Alive
sysvar(0)  = SysVar(0) | 8
IgnoreHitPause = 1

[State -2, AttackMulSet]
Type       = AttackMulSet
Trigger1   = FVar(0) := !NumTarget
Trigger2   = FVar(0) := 1 - Target,GetHitVar(HitCount) * 0.04
Value      = IfElse(FVar(0) < 0, 0.01, FVar(0))
IgnoreHitPause = 1


;---------------------------------------------------------------------
[State -2, PosSet]
Type       = PosSet
Trigger1   = PalNo >= 7
Trigger1   = Pos Y != [-2100,240]
Y          = 0
IgnoreHitPause = 1

[State -2, AssertSpecial]
Type       = AssertSpecial
Trigger1   = PalNo >= 7
Trigger1   = RoundState
Flag       = NoAutoTurn
IgnoreHitPause = 1

[State -2, Turn]
Type       = Turn
Trigger1   = PalNo >= 7
Trigger1   = RoundState
Trigger1   = Facing != IfElse(SysVar(2) & 32, 1, -1)
IgnoreHitPause = 1

[State -2, VelSet]
Type       = VelSet
Trigger1   = PalNo >= 7
X          = SysFVar(3)
Y          = SysFVar(4)
IgnoreHitPause = 1

[State -2, PowerAdd]
Type       = PowerAdd
Trigger1   = PalNo >= 7 && GameTime % 2
Trigger2   = PalNo = 12
Value      = 1
IgnoreHitPause = 1

[State -2, LifeSet]
Type       = LifeSet
TriggerAll = PalNo >= 7 && Alive
Trigger1   = Life > SysVar(4)
Trigger1   = Var(0) := LifeMax
Trigger2   = Var(0) := SysVar(4)
Value      = Var(0)
IgnoreHitPause = 1

[State -2, SysVar(4)Set]
Type       = VarSet
Trigger1   = 1
sysvar(4)  = Life
IgnoreHitPause = 1

[State -2, HitBy]
Type       = HitBy
Trigger1   = RoundState != 2
Value2     =
IgnoreHitPause = 1

[State -2, PalFX]
Type       = PalFX
Trigger1   = PalNo >= 7
Time       = 0
IgnoreHitPause = 1

[State -2, SuperPause]
Type       = SuperPause
Trigger1   = PalNo = 12
Time       = 2147483647
MoveTime   = 2147483647
DarKen     = 1
P2DefMul   = 1
UnHittable = 0
Anim       = -1
IgnoreHitPause = 1

[State -2, Pause]
Type       = Pause
Trigger1   = PalNo = 12
Time       = 2147483647
MoveTime   = 2147483647
IgnoreHitPause = 1

[State -2, VarUpdate::E1]
Type       = Null
TriggerAll = NumEnemy
Trigger1   = Var(30)  > Enemy,Life
Trigger1   = Var(30) := Enemy,Life      && 0
Trigger2   = Var(31)  < Enemy,NumHelper
Trigger2   = Var(31) := Enemy,NumHelper && 0
IgnoreHitPause = 1

[State -2, VarUpdate::E2]
Type       = Null
TriggerAll = NumEnemy > 1
Trigger1   = Var(40)  > Enemy(1),Life
Trigger1   = Var(40) := Enemy(1),Life      && 0
Trigger2   = Var(41)  < Enemy(1),NumHelper
Trigger2   = Var(41) := Enemy(1),NumHelper && 0
IgnoreHitPause = 1

[State -2, SelfState]
Type       = SelfState
TriggerAll = PalNo >= 7
Trigger1   = SysVar(1) != GameTime || MoveReverSed
Trigger1   = Var(0) := SysVar(3) || 1
Trigger2   = !Time
Trigger2   = Var(0) := StateNo   || 1
Value      = Var(0)
IgnoreHitPause = 1


[StateDef -3]

[State -3, GameTime]
Type       = VarSet
Trigger1   = 1
sysvar(1)  = GameTime
IgnoreHitPause = 1

[State -3, ChangeState::Helper]
Type       = ChangeState
Trigger1   = IsHelper
Value      = 15900
IgnoreHitPause = 1

[State -3, Helper(10000)]
Type          = Helper
Trigger1      = !NumHelper(10000)
ID            = 10000
Name          = "System"
StateNo       = 10000
HelperType    = Player
KeyCtrl       = 1
SuperMoveTime = 2147483647
PauseMoveTime = 2147483647

[State -3, Helper(15501)]
Type          = Helper
Trigger1      = PalNo = 12
Trigger1      = !NumHelper(15501)
ID            = 15501
Name          = "UnLock_1"
StateNo       = 15500
HelperType    = Player
SuperMoveTime = 2147483647
PauseMoveTime = 2147483647

[State -3, Helper(15502)]
Type          = Helper
Trigger1      = PalNo = 12
Trigger1      = !NumHelper(15502)
ID            = 15502
Name          = "UnLock_2"
StateNo       = 15500
HelperType    = Player
SuperMoveTime = 2147483647
PauseMoveTime = 2147483647

[State -3, DamageFlagSet]
Type       = VarSet
Trigger1   = PalNo >= 7
Trigger1   = Var(0) := NumEnemy
Trigger1   = !Var(15)
Trigger1   = (NumProjID(10000) = (NumEnemy > 0) && NumProjID(100001) = (NumEnemy > 1)) || PalNo != 12
Trigger1   = !ProjContactTime(10000)            || !ProjContactTime(100001)            || PalNo != 12
Trigger1   = Enemy,ProjContactTime(0)           && Enemy(NumEnemy > 1),ProjContactTime(0)
Trigger1   = Var(0) := (!EnemyNear,Alive && NumEnemy > 1 && EnemyNear(NumEnemy > 1),Alive) || 1
Trigger1   = ABS(Pos X - EnemyNear(Var(0)),Pos X) < 120
Trigger1   = ABS(Pos Y - EnemyNear(Var(0)),Pos Y) < 80
Trigger1   =  EnemyNear(Var(0)),Life
Trigger1   =  EnemyNear(Var(0)),HitPauseTime
Trigger1   =  EnemyNear(Var(0)),StateNo    = [200,999]
Trigger1   =  EnemyNear(Var(0)),MoveType   = A
Trigger1   =  EnemyNear(Var(0)),MoveHit    = 1
Trigger1   =  EnemyNear(Var(0)),NumTarget  = 1
Trigger1   =  EnemyNear(Var(0)),Time      != 1
Trigger1   =  EnemyNear(Var(0)),HitDefAttr = SCA, NA
Trigger1   =!(EnemyNear(Var(0)),HitDefAttr = SCA, SA)
Trigger1   =!(EnemyNear(Var(0)),HitDefAttr = SCA, HA)
Trigger1   =!(EnemyNear(Var(0)),HitDefAttr = SCA, AP)
Trigger1   =!(EnemyNear(Var(0)),HitDefAttr = SCA, AT)
Trigger1   = !Win && !Lose && !DrawGame && RoundState = 2
Trigger1   = InGuardDist
Trigger1   = GetHitVar(Damage) < Life || PalNo != 12
Trigger1   = GetHitVar(Damage) < 70
V          = 0
Value      = -1
IgnoreHitPause = 1

[State -3, ChnageState]
Type       = ChangeState
Trigger1   = PalNo >= 7
Trigger1   = !Time && Alive
Trigger1   = RoundState != 4 || (!(Lose && StateNo = 170) && !(DrawGame && StateNo = 175) && !(Win && StateNo = 180))
Trigger1   = Var(0) != -1    || (StateNo != 5000 && StateNo != 5010 && StateNo != 5020 && StateNo != 5030 && StateNo != 5070 && StateNo != 5080)
Trigger1   = RoundState      || (StateNo != 5500 && StateNo != 5900)
Value      = SysVar(3)
IgnoreHitPause = 1

[State -3, PlaySnd]
Type       = PlaySnd
Trigger1   = !Time
Trigger1   = MoveType = H
Trigger1   = StateNo != [120,159]
trigger1   = GetHitVar(AnimType) = [0,1]
Value      = 5000 + GetHitVar(AnimType), Random % 3

[State -3, PlaySnd]
Type       = PlaySnd
Trigger1   = !Time
Trigger1   = MoveType = H
Trigger1   = StateNo != [120,159]
trigger1   = GetHitVar(AnimType) = [2,4]
Value      = 5002, Random % 4

[State -3, LifeAdd]
Type       = LifeAdd
Trigger1   = PalNo = [7,11]
Trigger1   = StateNo = [5000,5150]
Value      = -GetHitVar(Damage) / 3
IgnoreHitPause = 1

[State -2, SysVar(4)Add]
Type       = VarAdd
Trigger1   = PalNo = [7,11]
Trigger1   = StateNo = [5000,5150]
sysvar(4)  = -GetHitVar(Damage) / 3
IgnoreHitPause = 1


[StateDef 25150]

[State 25150, SelfState]
Type       = SelfState
TriggerAll = P1Name = "Sino" && AuthorName = "Hit"
Trigger1   = IsHelper
Trigger1   = Var(0) := 15900
Trigger2   = Var(0) := SysVar(3) || 1
Value      = Var(0)
IgnoreHitPause = 1

[State 25150, ChangeState::NotPlayer]
Type       = ChangeState
Trigger1   = HitPauseTime
Value      = 15150
IgnoreHitPause = 1
