;***************************************************************************
;===========================================================================
;---------------------------------------------------------------------------
[Statedef -2]; 常時監視ステート
;---------------------------------------------------------------------------
;===========================================================================
;***************************************************************************

;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
;Config
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------

;12P 変数リセットスイッチ。
;ONにすると不具合が出る可能性があります
;ONにしても強さ的にはさほどかわりません
[State 1]
type = varset
trigger1 = palno =  12
fv = 37
value = 1        ;1on 0off

;12P 「光を降らす」にヘルパー当身改(トムスイッチ)付加
;ほぼすべてのヘルパーに対応していますが完璧ではありません。バグが出る場合はOFFにしてください
[State 1]
type = varset
trigger1 = palno =  12
fv = 38
value = 2        ;1〜2on 0off

;value = 1       タイプA  バグは少なめだが殺傷力は比較的低い
;value = 2       タイプB  タイプAよりバグは多いが殺傷力は高め
;

常時AIon offスイッチ
[state -2]
type = varset
triggerall = roundstate = 2
trigger1 = !ishelper
var(30) = 1
ignorehitpause = 1

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

[state -2, a];右向き設定
type = varset
trigger1 = var(10) = 0
trigger1 = facing = 1
v = 10
value = 1

[state -2, a];左向き設定
type = varset
trigger1 = var(10) = 0
trigger1 = facing = -1
v = 10
value = 2

[State -2, 1]
type = stopSnd
trigger1 = stateno != 100
channel = 1

[state a]
type = removeexplod
trigger1 = movetype = H
id = 2200


[state a]
type = stopsnd
trigger1 = movetype = H
channel = 3

[state a]
type = stopsnd
trigger1 = stateno != 1055
channel = 5

[State -2, 3]
type = stopSnd
trigger1 = MoveType = H
channel = 2

[State -2, 4]
type = varadd
trigger1 = 1
v = 15
value = -1

[state a]
type = varset
trigger1 = movetype = H
v = 13
value = 0

[State 180, 1]
type = VarRandom
trigger1 = 1
v = 6
range = 0,2

[state -2, a]
type = varset
trigger1 = palno = 1
trigger2 = palno = 2
trigger3 = palno = 3
trigger4 = palno = 4
trigger5 = palno = 5
trigger6 = palno = 6
v = 1
value = 0

[state -2, a]
type = varset
trigger1 = palno = 7
trigger2 = palno = 8
trigger3 = palno = 9
trigger4 = palno = 10
trigger5 = palno = 11
trigger6 = palno = 12
v = 1
value = 1

[state -2, a]
type = varadd
trigger1 = 1
persistent = 0
ignorehitpause = 1
v = 4
value = -1

[state -2, a]
type = pause
trigger1 = var(4) >= 1
trigger1 = gametime % 2
persistent = 0
ignorehitpause = 1
time = 1

[state a];
type = removeexplod
trigger1 = MoveType = H
id = 185

[State 1]
type = removeexplod
trigger1 = MoveType = H
ID = 1470

[State -2 ,a]
type = removeexplod
trigger1 = MoveType = H
ID = 4000

[state -2 ,a]
type = removeexplod
trigger1 = MoveType = H
id = 4200

[state a]
type = removeexplod
trigger1 = MoveType = H
id = 1655

[state a]
type = removeexplod
trigger1 = MoveType = H
id = 1860

[state a]
type = stopsnd
trigger1 = MoveType = H
channel = 1

[state a];第一段階
type = varset
trigger1 = enemy,life >= 400
v = 26
value = 0

[state a];第二段階
type = varset
trigger1 = enemy,life <= 399 && enemy,life >= 150
v = 26
value = 1

[state a];第三段階
type = varset
trigger1 = enemy,life <= 149
v = 26
value = 2

[state -2]
type = destroyself
trigger1 = ishelper

[State 0]
type = ReversalDef
triggerall = roundstate = 2
trigger1 = stateno = 3501
trigger1 = !ishelper
reversal.attr = SCA,AA,AT,AP
hitflag = M-
priority = 99999999999
pausetime = 0,0
numhits = 0
sparkno = -1
hitsound = -1
ignorehitpause = 1
pausemovetime = 9999999
supermovetime = 9999999

[state -2]
type = targetstate
triggerall = roundstate = 2
trigger1 = numtarget
trigger1 = stateno = 3501
trigger1 = !ishelper
value = 600000
ignorehitpause = 1

;***************************************************************************
;===========================================================================
;特殊
;===========================================================================
;***************************************************************************

[State a]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%8) = 1
anim = 22131
sprpriority = 10
postype = p1
pos = var(50),var(51)
bindtime = 1
under = 0
ownpal = 1
persistent = 1
ignorehitpause = 1
vel = 0,-3
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%5) = 1
;trigger1 = time = 0
anim = 22125;22063
sprpriority = 0
postype = p1
pos = 0,0
bindtime = -1
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%20) = 1
anim = 22123
id = 22123
sprpriority = 99
postype = p1
pos = 0,-85
bindtime = -1 
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%35) = 1
anim = 22123
id = 22123
sprpriority = 99
postype = p1
pos = 20,-60
bindtime = -1
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%30) = 1
anim = 22123
id = 22123
sprpriority = 99
postype = p1
pos = -20,-40
bindtime = -1
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%40) = 1
anim = 22122
id = 22123
sprpriority = 99
postype = p1
pos = -10,-10
bindtime = -1
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%46) = 1
anim = 22122
id = 22123
sprpriority = 99
postype = p1
pos = -10,-10
bindtime = -1
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%49) = 1
anim = 22122
id = 22123
sprpriority = 99
postype = p1
pos = 0,-30
bindtime = -1
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%46) = 1
anim = 22124
id = 22123
sprpriority = 99
postype = p1
pos = 10,-10
bindtime = -1 
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%38) = 1
anim = 22124
id = 22123
sprpriority = 99
postype = p1
pos = 10,-10
bindtime = -1
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = Explod
triggerall = anim = 0
triggerall = time >= 20
trigger1 = (GameTime%42) = 1
anim = 22124
id = 22123
sprpriority = 99
postype = p1
pos = 0,-30
bindtime = -1
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999

;---------------------
[State -1]
type = Projectile
triggerall = anim = 0
triggerall = time >= 15
trigger1 = (GameTime%2) = 1
attr = S, SA
projanim = 3459
projhitanim = -1
projid = 3459
projpriority = 999999999
projsprpriority = 1
;projedgebound = 220
projremove = 1
projremovetime = 4
postype = p1
offset = 0,0
velocity = 0
animtype  = Light
damage    = 0,0
getpower = 0,0
givepower = 0,0
guardflag = 
hitflag = MAFD
pausetime = 2,8
sparkno = -1
sparkxy = -15,-77
hitsound   = -1
guard.sparkno = -1;s7011
guardsound = -1
ground.type = low
ground.slidetime = 10
ground.hittime  = 10
ground.velocity = -2
air.velocity = -2,-1

[State -2]
type = Helper
triggerall = palno = 12
trigger1 = GameTime%2 = 1
trigger1 = MoveType != H
stateno = 400000
pos = 4,-70
size.xscale = 0.45*sin(6*pi*(GameTime%60)/180)
size.yscale = 0.45
ignorehitpause = 1
supermovetime = 3600
pausemovetime = 3600

[State -2]
type = Helper
triggerall = palno = 12
trigger1 = GameTime%2 = 1
trigger1 = MoveType != H
stateno = 400001
pos = 4,-70
size.xscale = 0.45*sin(-6*pi*(GameTime%60)/180)
size.yscale = 0.45
ignorehitpause = 1
supermovetime = 3600
pausemovetime = 3600

[State -2]
type = Explod
trigger1 = movetype != H
trigger1 = numexplod(10000) <= 0
anim = 10001
id = 10000
pos = 0,-85
bindtime = -1
ownpal = 1
trans = sub
sprpriority = 999
scale = 0.45,0.45
ignorehitpause = 1
supermovetime = 3600
pausemovetime = 3600

[State -2]
type = Explod
triggerall = palno = [7,11]
trigger1 = movetype != H
trigger1 = numexplod(10001) <= 0
anim = 10009
id = 10001
pos = 0,-85
bindtime = -1
ownpal = 1
sprpriority = -999
ignorehitpause = 1
supermovetime = 3600
pausemovetime = 3600

[State -2]
type = RemoveExplod
trigger1 = movetype = H
id = 10000
ignorehitpause = 1
supermovetime = 3600
pausemovetime = 3600

[State -2]
type = RemoveExplod
trigger1 = movetype = H
id = 10001
ignorehitpause = 1
supermovetime = 3600
pausemovetime = 3600

[State -2]
type = RemoveExplod
trigger1 = movetype = H
id = 10002
ignorehitpause = 1
supermovetime = 3600
pausemovetime = 3600

[State -2]
type = RemoveExplod
trigger1 = movetype = H
id = 10003
ignorehitpause = 1
supermovetime = 3600
pausemovetime = 3600

;---------------------------------------------------------------------------
;エフェクトランダム変数
;---------------------------------------------------------------------------

[State 1]
type = varrandom
trigger1 = 1
range = -55,55
v = 50

[State 1]
type = varrandom
trigger1 = 1
range = 0,-60
v = 51

[State 1]
type = varrandom
trigger1 = 1
range = -40,-130
v = 53

[State 1]
type = varrandom
trigger1 = 1
range = -75,75
v = 52

[State -2]
type = Varset
trigger1 = stateno != 22077
var(40) = 0

[State -2]
Type = VarSet
trigger1 = 1
var(35) = 0
IgnoreHitPause = 1

[State -2]
Type = VarSet
trigger1 = Random <= 300
var(35) = 1
IgnoreHitPause = 1

[State -2]
Type = VarSet
trigger1 = Random <= 300
var(35) = 2
IgnoreHitPause = 1

[State -2]
Type = VarSet
trigger1 = Random <= 300
var(35) = 3
IgnoreHitPause = 1

;---------------------------------------------------------------------------
;時間カウント
;---------------------------------------------------------------------------

[state a]
type = varadd
triggerall = palno = 12
trigger1 = roundstate = 2
v = 54
value = 1
IgnoreHitPause = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State a]
type = varset
triggerall = palno = 12
trigger1 = roundstate != 2
trigger2 = roundstate = 2 && fvar(32) != 1
trigger3 = roundstate = 2 && fvar(32)!= 0 && var(54)>=6700
v = 54
value = ((roundstate=2&&fvar(32)!=1)*5800)
IgnoreHitPause = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[state 1]
type = varset
trigger1 = palno=12&&fvar(38)=2&&stateno!=22050
fv = 18
value = 0
ignorehitpause = 1
pausemovetime = 9999999
supermovetime = 9999999

[state 1]
type = varset
trigger1 = palno=12&&(stateno=22100||enemy,numprojid(96968484321)>=1||RoundState!=2)
fv = 19
value = (stateno!=22100)*RoundState=2
ignorehitpause = 1
pausemovetime = 9999999
supermovetime = 9999999

[state 1]
type = varset
trigger1 = palno=12&&numtarget&&target,ishelper=0
fv = 20
value = (RoundState<=2)
ignorehitpause = 1
pausemovetime = 9999999
supermovetime = 9999999

[State 1] 
type = varset
triggerall = palno = 12
trigger1 = RoundState = 2 && (GameTime%50) = 1
trigger2 = RoundState != 2
fv = 22
value = 0+((RoundState = 2)*enemy,life)
ignorehitpause = 1
SuperMoveTime = 999999
PauseMoveTime = 999999

[State 1] 
type = varset
triggerall = palno = 12 && var(54) < 5700
trigger1 = RoundState = 2 && (GameTime%55) = 1
trigger1 = fvar(22) != 0 && enemy,life >= fvar(22)
trigger2 = fvar(22) != 0 && enemy,life < fvar(22)
trigger3 = RoundState != 2
fv = 23
value = IfElse((RoundState = 2),IfElse((fvar(22) != 0 && enemy,life < fvar(22)),0,1),0)
ignorehitpause = 1
SuperMoveTime = 999999
PauseMoveTime = 999999

[state 1]
type = varadd
trigger1 = palno = 12 && roundstate = 2 && fvar(23) = 1 && var(54) < 5700
fv = 24
value = 1+((enemy,life>=enemy,lifemax&&enemy,power>=enemy,powermax)*80)
ignorehitpause = 1
SuperMoveTime = 999999
PauseMoveTime = 999999

[State 1]
type = varset
triggerall = palno = 12
trigger1 = roundstate != 2 || fvar(23) = 0 || numtarget || var(54) >= 5700
fv = 24
value = 0
ignorehitpause = 1
SuperMoveTime = 999999
PauseMoveTime = 999999

[state -2]
type = varset
trigger1 = palno = 12 && RoundState <= 2 && anim = 0 && ctrl = 0 && var(54) <= 40
trigger1 =  enemynear,movetype=A&&(enemynear,numproj>=1||enemynear,numhelper>=1)||enemynear,anim!=0&&p2bodydist X <= 60||enemynear,vel x != 0
trigger2 = palno = 12 && RoundState>=3
fv = 25
value = (RoundState<=2)
ignorehitpause = 1
pausemovetime = 9999999
supermovetime = 9999999

[state -1]
type = varset
triggerall =palno=12
trigger1 = var(29) >= 1
trigger2 = roundstate != 2
trigger3 = life>=lifemax
fv = 26
value = 0
ignorehitpause = 1
supermovetime = 99999999
pausemovetime = 99999999

[state -1]
type = varset
trigger1 =palno=12&&(fvar(28)!=[0,2])
fv = 28
value = 0
ignorehitpause = 1
supermovetime = 99999999
pausemovetime = 99999999

[state -1]
type = varset
trigger1 =palno=12&&fvar(28)!=0&&(fvar(24)>=2150&&var(54)>=2150||fvar(25)=1||fvar(29)!=0&&RoundState<=2&&var(54)<=40&&random<=100)
fv = 28
value = 0
ignorehitpause = 1
supermovetime = 99999999
pausemovetime = 99999999

[state -1]
type = varset
trigger1 =palno=12&&roundstate>=3&&(drawgame||lose||win)
fv = 29
value = (!win)
ignorehitpause = 1
supermovetime = 99999999
pausemovetime = 99999999

[State 1]
type = varset
triggerall = !ishelper && palno = 12
trigger1 = roundno = 1 && roundstate < 2
trigger2 = roundstate >= 2 && var(3) != gametime
fv = 32
value = 1-(roundstate>=2&& var(3)!=gametime)
ignorehitpause = 1
SuperMoveTime = 999999
PauseMoveTime = 999999

[State 1]
type = varset
triggerall = !ishelper && palno = 12
trigger1 = numexplod(2211325)
fv = 32
value = 0
ignorehitpause = 1
SuperMoveTime = 999999
PauseMoveTime = 999999

[State 1]
type = varset
triggerall = !ishelper
trigger1 = palno = 12 && (GameTime%20) = 1
fv = 35
value = power
ignorehitpause = 1
SuperMoveTime = 999999
PauseMoveTime = 999999

[State 1]
type = varset
triggerall = !ishelper
trigger1 = palno=12&&(helper(288888),stateno=288889)&&enemy,numhelper>=2&&enemy,movetype=A
fv = 36
value = enemy,stateno
ignorehitpause = 1
SuperMoveTime = 999999
PauseMoveTime = 999999

;---------------------------------------------------------------------------
;技ダメージ倍率
;---------------------------------------------------------------------------

[State -2] ;パワーアップ中
type = varset 
trigger1 = var(29) >= 1
var(39) = 3-(palno=12)

[State -2] ;通常
type = varset 
trigger1 = var(29) <= 1
var(39) = 1

[state a]
type = varadd
trigger1 = 1
v = 29
value = -1

[state a]
type = varset
trigger1 = palno != 12 && roundstate != 2
v = 29
value = 0

;---------------------------------------------------------------------------
;キー判別
;---------------------------------------------------------------------------

[state a]
type = varset
trigger1 = command = "holdup"
v = 56
value = 2

[state a]
type = varset
trigger1 = command = "holddown"
v = 56
value = 3

[state a]
type = varset
trigger1 = command != "holddown"
trigger1 = command != "holdup"
v = 56
value = 0

[state -2]
type = varset
trigger1 = 1
fv = 33
value = (projhit22183=1)

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

[State a] 
type = Afterimage
trigger1 = roundstate != 0 && !ishelper
trigger1 = TIME = 0
trans = add
PalContrast =  0, 0, 0
PalBright = 0,0,0
time    =  0
length  = 13
TimeGap = 1
FrameGap = 1

[State a]
type = EnvColor
trigger1 = projhit1050 = 1
persistent = 0
ignorehitpause = 1
time = 1
value = 255,255,255
under = 1

[State 1000, 9]
type = Envcolor
trigger1 = projHit22079 = 1 
ignorehitpause = 1
value = 255, 255, 255
time = 1
under = 5
supermove = 1

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

[State 1000, 5]
type = Explod
trigger1 = Projhit3459 = 1 || Projhit35904 = 1 || Projhit22519 = 1
anim = 22109 + var(35)
sprpriority = 6
postype = p2
pos = 0,-60
bindtime = -1
ignorehitpause =0
under = 0
ownpal = 1
PauseMoveTime = 9999999

[State 1000, 5]
type = Explod
trigger1 = ProjHit20000 = 1 || projhit22182 = 1 || projhit22183 = 1
anim = 22109 + var(35)
sprpriority = 100
postype = p2
pos = 0,-60
bindtime = -1
ignorehitpause =0
under = 0
ownpal = 1
PauseMoveTime = 9999999

[State 1000, 5]
type = Explod
trigger1 = ProjHit22079 = 1
anim = 22109 + var(35)
sprpriority = 100
postype = p2
pos = 0,-60
bindtime = -1
ignorehitpause =0
under = 0
ownpal = 1
PauseMoveTime = 9999999

[State 1000, 5]
type = Explod
trigger1 = ProjGuarded22079 = 1
anim = 22113
sprpriority = 100
postype = p2
pos = 0,-60
bindtime = -1
ignorehitpause =0
under = 0
ownpal = 1
PauseMoveTime = 9999999

[State 1000, 5]
type = null;Explod
trigger1 = !ishelper&&palno=12&&roundstate>=2
trigger1 = fvar(32)!=1
trigger1 = !numexplod(2211325)
anim = 0
id=2211325
removetime = -1
sprpriority = 100
postype = left
pos = 0,10000
bindtime = 1
ignorehitpause =1
under = 0
ownpal = 1
PauseMoveTime = 9999999

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

[State -1]
type = palfx
trigger1 = var(29) >= 1
time = 1
add = 60,60,60
color = 1
ignorehitpause = 1

[State -2]
type = EnvColor
trigger1 = projhit35900 = 1
persistent = 0
ignorehitpause = 1
time = 2
value = 255,255,255
under = 1
invertall = 1

[State -2]
type = PlaySnd
trigger1 = projhit22182 = 1 || projhit22183 = 1
value = 2300,2

[State -2]
type = PosSet
triggerall = RoundState = 2
trigger1 = stateno = [0,12]
trigger1 = floor(Pos Y) < -20
y = 0

[State -2]
type = SelfState
trigger1 = ishelper
value = 169992
ignorehitpause = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = CtrlSet
trigger1 = !ishelper && stateno = (104005 || 104006 || 103999 || 104000 || 104001 || 104004) && ctrl = 1
value = 0

[State 1]
type = poweradd
triggerall = roundstate = 2 && var(1)!=1
trigger1 = (GameTime%4) = 1
value =2+((life<lifemax/4)*(powermax/1000))
ignorehitpause = 1
supermovetime = 99999999
pausemovetime = 99999999

[state a]
type = powerset
triggerall = palno = 12
trigger1 = var(54) >= 5700 || fvar(24)>=2150&&var(54)>=2150
value = (Const(data.power))
ignorehitpause = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[state -1]
type = powerset
triggerall = !ishelper
trigger1 = palno=12&&!(stateno=2400||stateno =14020||stateno=2999||stateno=3250||stateno=2300||stateno=2200)&&fvar(35)-power>=1
value = fvar(35)-power
ignorehitpause = 1
supermovetime = 99999999
pausemovetime = 99999999

[State a]
type = PalFX
triggerall = palno = 12
triggerall = var(54) >= 5700 || fvar(24)>=2150&&var(54)>=2150
trigger1 = (GameTime%2) = 1
time = 1
add = 255-((fvar(24)>=2150)*100),100,100+((fvar(24)>=2150)*100)
ignorehitpause = 1

[State 1]
type = targetLifeAdd
triggerall = palno = 12
trigger1 = stateno = 22050 || stateno = 2205 && time >= 20
value = -99999999999
absolute = 1

[state a]
type = targetlifeadd
trigger1 = projhit22079 >= 1
value = Ceil(-0.003 * enemy,Const(data.life))
absolute = 1

[State 22121,1]
type = targetlifeadd
trigger1 = projhit35902 >= 1
value = (Ceil(-0.005 * enemy,Const(data.life))) * var(39)
ignorehitpause = 1
absolute = 1

[State -2]
type = targetLifeAdd
triggerall = palno = 12
trigger1 = enemy,life <= (Ceil(0.3 * enemy,Const(data.life)))
value = -99999999999
ignorehitpause = 1
absolute = 1

[State -2]
type = targetpowerAdd
triggerall = palno = 12
trigger1 = enemy,life <= (Ceil(0.3 * enemy,Const(data.life)))
value = -(Ceil(1 * enemy,Const(data.power)))
ignorehitpause = 1

[State 1]
type = Targetlifeadd
trigger1 = helper(2401),stateno=2410&&helper(2401),animtime = 0
value = Ceil(-0.35 * enemy,Const(data.life)) - 1
ignorehitpause = 1
absolute = 1

[State -2]
type = StateTypeSet
triggerall = var(1) = 1
trigger1 = stateno = [40,52]
MoveType = I

[State -2]
type = screenbound
trigger1 = ishelper
value = 0
movecamera = 0

[State -2]
type = NotHitBy
triggerall = var(1) = 1
triggerall = stateno = [40,52]
trigger1 = time = 0
value = SCA,AA,AT,AP
Time = 25

[State -2]
type = NotHitBy
triggerall = palno = 12
trigger1 = RoundState != 2 || RoundState=2&&var(54)<=100
trigger2 = fvar(32) != 1
value = SCA

[State -2]
type = Trans
trigger1 = palno = 12 && !ishelper && fvar(32) != 1
trans = sub
alpha = 50,230

[State -2]
Type = LifeSet
triggerall = palno = 12 && alive
trigger1 = var(29) >= 1
trigger2 = fvar(32) != 1
trigger3 = roundstate < 2
trigger4 = var(30)=0&&fvar(26)<=36&&life<=1
trigger5 = var(30)!=0&&fvar(26)<=88&&fvar(28)=0&&life<=1
trigger6 = var(30)!=0&&fvar(28)=0&&roundstate>=3
Value = lifemax
IgnoreHitPause = 1

[State -2]
Type = LifeSet
triggerall = var(1) = 1 && palno != 12 && alive
trigger1 = var(29) >= 1
Value = fvar(39)
IgnoreHitPause = 1

[State -2]
type = attackMulSet
trigger1 = 1
value = 1+((var(29)>=1)*(2-(palno=12)))
ignorehitpause = 1

[State -2]
type = defenceMulSet
trigger1 = var(1) != 1
value = 1.2
ignorehitpause = 1

[State -2]
type = AssertSpecial
trigger1 = var(1) = 1 || var(1) != 1 && var(29) >= 1
flag = NoStandGuard
flag2 = NoCrouchGuard
flag3 = NoairGuard

[State -2]
type = assertspecial
trigger1 = palno = 12 && !ishelper && fvar(32) != 1
flag = timerfreeze
ignorehitpause = 1
pausemovetime = 999999999999999
supermovetime = 999999999999999

[State -2]
type = PlayerPush
triggerall = palno = 12
trigger1 = var(29) >= 1
value = 0

[State 1]
type = ChangeState
triggerall = var(1) = 1
trigger1 = !alive && stateno = [5000,5050]
value = 10380

[state a]
type = targetstate
trigger1 = enemy,alive = 0 && enemy,statetype = S
value = 10380

[state a]
type = targetstate
trigger1 = stateno = 22050 && enemy,alive = 0
value = 104010

[state 1]
type = targetstate
triggerall = palno = 12
trigger1 = (target,stateno != [49000,49100]) && stateno = 22050 && time >= 150
value = 49000

[State 1]
type = Targetstate
trigger1 = helper(2401),stateno=2410&&helper(2401),animtime = 0
value = 2416

[State 1]
type = HitOverride
triggerall = alive && var(1) = 1
triggerall = statetype != A
trigger1 = 1
time = 1
attr = SCA, NA, SA, HA, NT,ST,HT, NP, SP, HP,AA,AT,AP
stateno = 10051
ignorehitpause = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State 1]
type = HitOverride
triggerall = alive && var(1) = 1
triggerall = var(29) <= 1
triggerall = statetype = A
trigger1 = 1
time = 1
attr = SCA, NA, SA, HA, NT,ST,HT, NP, SP, HP,AA,AT,AP
stateno = 38853
ignorehitpause = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State 1]
type = HitOverride
triggerall = alive && var(1) = 1
triggerall = var(29) <= 1
triggerall = stateno = 40 || stateno = 52
trigger1 = 1
time = 1
attr = SCA, NA, SA, HA, NT,ST,HT, NP, SP, HP,AA,AT,AP
stateno = 38852
ignorehitpause = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State 1]
type = HitOverride
triggerall = alive && var(1) = 1
triggerall = var(29) >= 1
triggerall = stateno = 40 || stateno = 52
trigger1 = 1
time = 1
attr = SCA, NA, SA, HA, NT,ST,HT, NP, SP, HP,AA,AT,AP
stateno = 18000
ignorehitpause = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State 1]
type = HitOverride
triggerall = alive && var(1) = 1
triggerall = var(29) >= 1
triggerall = statetype = A
trigger1 = 1
time = 1
attr = SCA, NA, SA, HA, NT,ST,HT, NP, SP, HP,AA,AT,AP
stateno = 18000
ignorehitpause = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[State -1]
type = helper
triggerall = palno=12&&(stateno=22050&&time<150)&&!ishelper&&fvar(32)!=0&&fvar(38)!=0
trigger1 = numhelper(169992)=0&&enemy,numprojid(169994)>=1
id = 169992
persistent = 0
name = "Alsiel Orochi"
pos = 0,0
postype = P1
stateno = 169992
helpertype = player
keyctrl = 0
ownpal = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

;常時ヘルパかき消し当身ヘルパ
[State -2]
type = helper
triggerall = palno = [7,12]
trigger1 = numhelper(288888)=0
id = 288888
persistent = 0
name = "godfild"
pos = 0,0
postype = P1
stateno = 288888
helpertype = normal
keyctrl = 0
ownpal = 1
SuperMoveTime = 9999999
PauseMoveTime = 9999999

[state -2]
type = selfstate
triggerall = roundstate = 2
trigger1 = stateno = [0,20]
trigger1 = ctrl = 0
value = 0
ignorehitpause = 1
SuperMoveTime = 99999999
PauseMoveTime = 99999999

[State -2];パワーゲージ自動回復
type = poweradd
trigger1 = (palno=[7,12])
trigger1 = alive && roundstate = 2
trigger1 = gametime%10 = 0
value = 10
ignorehitpause = 1
supermovetime = 9999999
sausemovetime = 9999999

[state -2];パワーゲージ200以下でMAX
type = powerset
trigger1 = life <= 200
value = 6000
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[state -2];パワーゲージMAX
type = powerset
trigger1 = (palno=[1,6])
value = 6000
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State -2]
type = null;Helper
triggerall = roundstate = 2
trigger1 = NumHelper(2500) = 0
trigger1 = stateno = 0
trigger1 = stateno != 3501
trigger1 = !ishelper
helpertype = normal
name = "p"
ID = 2500
postype = p1
pos = 0,0
ownpal = 1
stateno = 2500
size.xscale = 0.8
size.yscale = 0.8

[State -2]
type = null;Helper
triggerall = roundstate = 2
trigger1 = NumHelper(2506) = 0
trigger1 = stateno = 0
trigger1 = stateno != 3501
trigger1 = !ishelper
helpertype = normal
name = "p"
ID = 2506
postype = p1
pos = 0,-60
ownpal = 1
stateno = 2506
size.xscale = 1.2
size.yscale = 1.2


[State -2]
type = null;Helper
triggerall = roundstate = 2
trigger1 = NumHelper(2507) = 0
trigger1 = stateno = 0
trigger1 = stateno != 3501
trigger1 = !ishelper
helpertype = normal
name = "p"
ID = 2507
postype = p1
pos = 0,0
ownpal = 1
stateno = 2507
size.xscale = 1.2
size.yscale = 1.2

;アーマーとかステート抜けとか

;NOKO。この順番通りじゃないと死にやすくなるかも。
;アーマー記述&reversaldefヘルパー記述はステート抜け記述より後に書いてください
;本体hitdefありで即死を防ぐ場合ステコンの順番にも気をつけましょう
;順番はこの通りにしてください。でないとセレスティアルあたりを喰らうと消えてなくなります(爆

;NOKOフラグ
;これは常時アーマーの場合は特に必要ありません。あくまで投げを喰らうようにして且つ即死無効にしたい場合
[State -2]
type = assertspecial
triggerall =numhelper(1007)
trigger1 =(movetype=H&&helper(1007),var(1)>0||var(1)!=gametime&&helper(1007),var(1)>0||roundstate>=2&&!alive&&helper(1007),var(1)>0)
flag = noko
ignorehitpause = 1
pausemovetime = 9999999
supermovetime = 9999999

;上記トリガー説明

;movetype=H&&helper(1007),var(1)>0
;保存して置いたライフが0より大きくてダメージ状態

;var(1)!=gametime&&helper(1007),var(1)>0
;保存して置いたライフが0より大きくてステートを奪われた場合

;roundstate>=2&&!alive&&helper(1007),var(1)>0
;保存して置いたライフが0より大きくて死んだ場合

;ライフ維持
;lifesetでもかまいませんがトレーニングモードでの見栄え等を考慮するとlifeaddの方がいいです
[State -2]
type = lifeadd
triggerall = roundstate=2
trigger1 = numhelper(1007)
trigger1 = helper(1007),var(1)-life>lifemax*0.1;保存していたライフから現在ライフを引いた数がライフ最大値の1割以上
value=(helper(1007),var(1)-life)
ignorehitpause = 1
supermovetime = 9999999
sausemovetime = 9999999

;---------------------------------------------------------------------------
;アーマー記載
;アーマーヘルパーを出す
;当たり判定用アーマー
[State -2]
type = helper
trigger1 = numhelper(13000) = 0
triggerall = roundstate = 2
trigger1 = stateno != 3501
trigger1 = !ishelper
id = 13000
persistent = 1
name = "Alsiel Orochi"
pos = 0,0
postype = P1
stateno = 13000
helpertype = normal
keyctrl = 0
ownpal = 1
ignorehitpause = 1
supermovetime = 9999999999
pausemovetime = 9999999999

[State -2];ライフ保存用ヘルパー出す
type = helper
trigger1 = !numhelper(12001) && !ishelper   
id = 12001
persistent = 1
name = "Alsiel Orochi"
pos = 0,0
postype = P1
stateno = 12001
helpertype = normal
keyctrl = 0
ownpal = 1
ignorehitpause = 1
supermovetime = 9999999
sausemovetime = 9999999

[State -2];ガード出来ない
type = AssertSpecial
trigger1 = 1
flag = NoStandGuard
flag2 = NoCrouchGuard
flag3 = NoairGuard
ignorehitpause = 1
pausemovetime = 9999999
supermovetime = 9999999

[state -2];本体は常時無敵
type = NotHitBy 
trigger1 = (palno=[11,12]) && !ishelper
value = SCA,AA,AP,AT
time = 9999999
ignorehitpause = 1
supermovetime = 999999999999999
pausemovetime = 999999999999999

[State -2];本体用アーマー
type = HitOverride
trigger1 = (palno=[1,12]) && !ishelper  
trigger1 = alive 
time = 1
slot=1
attr = SCA,NA,SA,HA,NT,ST,HT,NP,SP,HP,AA,AT,AP
stateno = 14000                                   
ignorehitpause = 1
supermovetime = 9999999
pausemovetime = 9999999

[State -2];ライフ維持
type = lifeadd
triggerall = roundstate = 2 && alive && (palno=[11,12]) && !ishelper 
trigger1 = helper(12001),var(1)-life>lifemax*0.01
value= helper(12001),var(1)-life
ignorehitpause = 1
supermovetime = 999999999999999
pausemovetime = 999999999999999

[State -2];ライフ処理
type = lifeadd
triggerall = alive && roundstate=2 && (palno=[1,12]) && !ishelper
trigger1 = numhelper(13000) && (helper(13000),GetHitVar(Damage) = [1,(lifemax*0.1)])
trigger1 = helper(13000),projcontact(0)!= 1
value=-(ifelse(helper(13000),GetHitVar(Damage)>=lifemax*0.01,lifemax*0.005,(helper(13000),GetHitVar(Damage))/2))
ignorehitpause = 1

[State -2]
type = LifeSet
triggerall = life < 1000
triggerall = alive
triggerall = p2life>=enemy,lifemax*0.9
trigger1 = roundstate != 2
trigger1 = enemy,alive = 1
value = lifemax

[State -2]
type = lifeadd
triggerall = roundstate = 2
triggerall = gametime%90 = 0
triggerall = life > 200
trigger1 = p2name = "D-mizuchi" 
trigger2 = p2name = "G OROCHI"
trigger3 = p2name = "Phantom"         
value = -1
ignorehitpause = 1
supermovetime = 9999999
sausemovetime = 9999999

[State -2]
Type = AssertSpecial
triggerall = !ishelper
Trigger1 = 1
flag = UnGuardable
ignorehitpause = 1

[State -2]
type = helper
triggerall = roundstate = 2
trigger1 =!numhelper(1007)
trigger1 = !ishelper
trigger1 = stateno != 3501
id = 1007
persistent = 1
name = "P"
pos = 0,0
postype = P1
stateno = 1007
helpertype = normal
keyctrl = 0
ownpal = 1
ignorehitpause = 1
supermovetime = 9999999
sausemovetime = 9999999

[State -2]
type = VarSet
trigger1 = palno = [7,12]
trigger1 = !((stateno=[5000,5150])||stateno=14000)
v = 41
value = stateno
ignorehitpause = 1
supermovetime = 9999999
pausemovetime = 9999999

[State -2]
type = VarSet
triggerall = palno = [7,12]
trigger1 = movetype=A                             
trigger2 = stateno!=14000 && movetype!=A          
v = 43
value = movetype=A                                
ignorehitpause = 1
supermovetime = 9999999
pausemovetime = 9999999

[state 0]
type=attackmulset
trigger1=roundstate>0
value=ceil(ifelse(life>900&&power<ifelse(powermax<3000,powermax,3000),.00001,.000015)*ifelse(enemy,const(data.defence)>100,enemy,const(data.defence),100)*ifelse(enemy,const(data.life)>1000,enemy,const(data.life),1000))

[State -2]
type = NotHitBy
triggerall = IsHelper(13000)
trigger1 = ScreenPos X != [0,320]
trigger2 = ScreenPos Y != [0,240]
trigger3 = enemynear,ScreenPos X != [0,320]
trigger4 = enemynear,ScreenPos Y != [0,240]
time = 300
value = SCA
ignorehitpause = 1

[state -2]
type = varset
triggerall = roundstate = 2
triggerall = !ishelper
triggerall = stateno = 0
trigger1 = var(30) != [0,1]
var(30) = 0
ignorehitpause = 1

;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;---------------------------------------------------------------------------
;reversaldefの永続ターゲットバグ
;---------------------------------------------------------------------------
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

[State -2];reversaldefヘルパー
type = Helper
triggerall = alive
triggerall = !numhelper(30000) && (palno=12)
trigger1 = NumHelper(30000) = 0
name = "reversaldef"
ID = 30000
stateno = 30000
supermovetime = 999999999999
pausemovetime = 999999999999
ignorehitpause = 1

[state 0]
type=projectile
trigger1=roundstate=2
trigger1 = palno= [10,11]
projanim=99998
projremovetime=2
attr=S,NP
hitflag=ma-
priority=7
damage=random+1
hitonce=0
numhits=0
getpower=0
givepower=0
ignorehitpause = 1
pausemovetime = 999999999999
supermovetime = 999999999999

[state 0]
type=projectile
trigger1=roundstate=2
trigger1 = palno= [10,11]
projanim=99999
projremovetime=2
attr=s,na
hitflag=ma-
priority=7
damage=random+1
hitonce=0
numhits=0
getpower=0
givepower=0
p2stateno=100000
ignorehitpause = 1
pausemovetime = 999999999999
supermovetime = 999999999999

[state 0]
type=null;projectile
triggerall = palno = [1,12]
trigger1=(roundstate>2||!alive)&&palno=12
projanim=99999
projremovetime=2
attr=s,na
hitflag=ma-
priority=7
damage=21474836
p2stateno=100000
hitonce=0
numhits=0
getpower=0
givepower=0

[state 0]
type=varset
triggerall = palno = [1,12]
trigger1=projcontact=1
v=4
value=numtarget=0

[state 0]
type=varset
triggerall = palno = [1,12]
trigger1=1
v=17
value=(var(17)+1)*var(4)

[state 0]
type=projectile
triggerall = palno = 12
trigger1=roundstate>0&&palno=12
trigger1=var(4)=1&&stateno!=750||!alive||enemynear,movetype!=h&&!enemynear,alive
projanim=99999
projremovetime=2
attr=s,na
hitflag=mafd
priority=7
damage=ifelse(alive,ceil(var(17)/4),21474836)
pausetime=0,1
ground.velocity=-3,15
air.velocity=-3,15
fall=1
fall.recover=0
hitonce=0
numhits=0
getpower=0
givepower=0

[state 0]
type=targetlifeadd
triggerall = palno = 12
trigger1=(roundstate>2||!alive)&&palno=12
value=-2147483647
absolute=1

[state 0]
type=targetstate
triggerall = palno = 12
trigger1=stateno<200&&time>=180&&roundstate>1
value=5150

[state 0]
type=targetdrop
triggerall = palno = 12
trigger1=stateno<200||numtarget>6||roundstate=4

[State -2];透明処理
type = Trans
triggerall = !ishelper&&palno = [11,12]
trigger1 = var(35) != 10
trigger1 = 1
trigger2 = var(35) = 10
trigger2 = var(32) <= 1000
trigger2 = 1
trans = addalpha
alpha = 200,200;60,256

[State -2]
type = Trans
triggeall = !ishelper&&palno = [11,12]
trigger1 = var(35) = 10
trigger1 = var(32) >= 1001
trigger1 = 1
trans = addalpha
alpha = 250,256

[State -2]
type = Trans
triggerall = !ishelper&&palno != [10,12]
trigger1 = 1
trigger1 = p2life >= lifemax/2
trans = addalpha
alpha = 100,256

[State -2]
type = Trans
triggerall = !ishelper&&palno != [10,12]
trigger1 = 1
trigger1 = p2life <= lifemax/2
trigger1 = p2life >= 200
trans = addalpha
alpha = 160,256

[State -2]
type = Trans
triggerall = !ishelper&&palno != [10,12]
trigger1 = 1
trigger1 = p2life <= lifemax/2
trigger1 = p2life < 200
;trigger1 = p2life != 0 
trans = addalpha
alpha = 220,256

[State -2]
type = Trans
triggerall = !ishelper
trigger1 = numhelper(11355) != 0
trigger1 = 1
trans = addalpha
alpha = 10,256

[State -2]
type = Trans
trigger1 = numhelper(113550) != 0
trigger1 = 1
trans = addalpha
alpha = 10,256

[State -2]
type = PalFx
trigger1 = GameTime%40 = 0
add = -84,-84,-84;-64,-64,-64
sinadd = 84,84,84,80
time = 40
ignorehitpause = 1

[State -2];色
type = PalFx
;triggerall = roundstate >= 2
triggerall = !ishelper
triggerall = roundstate >= 0
triggerall = var(38) <= 1849
triggerall = stateno != 191
triggerall =var(14)=2&&var(20)=3&&var(21)=4&&var(22)=5&&var(23)=6&&var(24)=7&&var(25)=8&&var(26)=9&&var(27)=0&&var(28)=1&&var(29)=2&&var(30)=3&&var(39)=4&&var(40)=5&&var(41)=6&&var(42)=7&&var(43)=8&&var(44)=9&&var(45)=0&&var(46)=1
triggerall =var(47)=2&&var(48)=3&&var(49)=4&&var(50)=5&&var(51)=6&&var(52)=7&&var(53)=8&&var(54)=9&&var(55)=0&&var(56)=1&&var(57)=2&&var(58)=3&&fvar(4)=1&&fvar(5)=2&&fvar(6)=3&&fvar(7)=4&&fvar(8)=5&&fvar(9)=6&&fvar(10)=7&&fvar(11)=8
triggerall =fvar(12)=9&&fvar(13)=0&&fvar(14)=1&&fvar(15)=2&&fvar(16)=3&&fvar(17)=4&&fvar(18)=5&&fvar(19)=6&&fvar(20)=7&&fvar(21)=8&&fvar(22)=9&&fvar(23)=0&&fvar(24)=1&&fvar(25)=2&&fvar(26)=3&&fvar(27)=4&&fvar(28)=5&&fvar(29)=6&&fvar(30)=7&&fvar(31)=8
triggerall =fvar(32)=9&&fvar(33)=0&&fvar(34)=1&&fvar(35)=2&&fvar(36)=3&&fvar(37)=4&&fvar(38)=5&&fvar(39)=6
trigger1 = GameTime%80 = 0
add = 0,0,0
sinadd = 100,100,100,80
time = 80
ignorehitpause = 1
