;==============================================================================
; o3.cns 穴と枠と20
;==============================================================================
;------------------------
;Helper(30),var
; 0     色 (1:黒 / 2:青 / 3:白 / 4:透明)
; 1	防御系
;	 0(1)	HELPER(33)利用
;	 1(2)	無敵化"しない"
; 2	AI-フラグ
; 8	RoundState=[3,4]	(1:八百長ON)
; 9     ヒットシェイクタイプ	(1:GetHitVar/0:original)
; 10	根性値1
; 11	根性値2
; 12	最大被ダメージ割合
; 13	ダメージ減衰時間
; 14	投げ無効化時間
; 15	弾幕有効率
; 16    回復停止
;	 20(1048576)	回復停止ON
; 17    ゾンビ
; 18	ステージシフト
; 19	カラーチェンジ
; 20	P2NAME
; 30    HitDef利用
;	 0(1)	Root - HitDef利用開始
;	 1(2)	Root - 常時
; 31    RevDef耐性
;	 0(1)	耐性発動
;	 1(2)	全耐性
;	 2(4)	HitDef同期OFF(noko)
; 32    RevDef利用
; 33	移動
;	 0-4(31)	目安P2DIST X1 (0-31)	(var(33)&31)
;	 5-9(992)	目安P2DIST X2 (0-31)	(var(33)&992)/32	
;	 10-14(31744)	目安P2DIST X3 (0-31)	(var(33)&31744)/1024	距離を保つ
;	 15-19(1015808)	目安P2DIST X4 (0-31)	(var(33)&1015808)/32768	加速用
;	 20-21(3145728)	接/離/保 (var(33)&3145728)/1048576
; 34    攻撃
;	 0-6(127)	発射インターバル
;	 7-11(3968)	三連射後インターバル(0-31)	((var(34)&3968)/128)*10
;	 12-14(28672)	(0-7) 				(var(34)&28672)/4096)
;			 0 緑
;			 1 青
;			 2 赤
;			 3 黄
;			 4 黒
;			 5 三色	←MUGENのバグで2^5と2^6の計算結果が逆になる
;			 6 白
;			 7 予約
; 35    C1攻撃
;	 15(32768)	同期
; 36    C2攻撃
;	 15(32768)	同期
; 37	汎用即死返し	(0:none / 1:ヘルパー取得 / 2:本体取得)
; 38	RevDef
; 41	前回利用した即死
; 50	汎用即死返し用 StateNoメモリー
; 51-55	汎用即死返し用 StateNo記憶
;Helper(30),FVAR
; 0-3	計算
; 4,5	x,y
; 6,7	abs
; 8	(-57-const(size.draw.offset.y))
; 9	穴の中の色変更トリガ
; 10    特殊回転
; 11    弾幕耐性-継続弾幕感知
; 12	p2dist y
; 13	p2dist x
; 30	angledraw
;Helper(30),sysvar
; 1     弾幕耐性(実体値)
; 2     ダメージ減衰時間(実体値)
; 4     根性値(実体値)
;Helper(20),var
; 9	一度だけのlifesetフラグ
; 10	やられアニメ管理
;------------------------------------------------------------------------------
;******************************************************************************
; 穴
;******************************************************************************
[Statedef 30]
type=A
anim=520
velset=0,0

;==============================================================================
; HELPER_COMMON
[state 12345]
type=changestate
trigger1=!ishelper(30)
trigger2=p1name!="AxAyAzSSX"
value=12345
ignorehitpause=1
[state pal11]
type=changestate
trigger1=root,sysvar(0)>0
value=11000010
ignorehitpause=1

[state 30,BtR]
type=BindToRoot
trigger1=1
time=1
facing=1
pos=0,0+((root,anim=[190,191])||root,numexplod(181))*20181
;--セット-----
[State 無敵]
type=nothitby
trigger1=1
value=SCA,AA,AT,AP
time=100000

[State 無敵]
type=HitOverride
trigger1=1
attr=SCA,AT,AA,AP
slot=6
stateno=stateno
time=-1
;--/セット-----
;/HELPER_COMMON
;==============================================================================

;==============================================================================
[STATE 30,AI SWITCH]
type=VarSet
triggerall=var(2)=2	;AIスイッチ式
triggerall=roundstate=2
trigger1=root,command="up"=helper(16000),command="up"
trigger1=root,command="down"=helper(16000),command="down"
trigger1=root,command="back"=helper(16000),command="back"
trigger1=root,command="fwd"=helper(16000),command="fwd"
trigger1=root,command="a"=helper(16000),command="a"
trigger1=root,command="b"=helper(16000),command="b"
trigger1=root,command="c"=helper(16000),command="c"
trigger1=root,command="x"=helper(16000),command="x"
trigger1=root,command="y"=helper(16000),command="y"
trigger1=root,command="z"=helper(16000),command="z"
trigger1=root,command="start"=helper(16000),command="start"
trigger1=root,command="up"+root,command="down"+root,command="back"+root,command="fwd"+root,command="a"+root,command="b"+root,command="c"+root,command="x"+root,command="y"+root,command="z"+root,command="start">0
var(2)=3	;PLAYER判定

[STATE 30,AISWITCH]
type=VarSet
triggerall=var(2)=2	;AIスイッチ式
triggerall=roundstate=2
trigger1=root,command="up"^^helper(16000),command="up"
trigger2=root,command="down"^^helper(16000),command="down"
trigger3=root,command="back"^^helper(16000),command="back"
trigger4=root,command="fwd"^^helper(16000),command="fwd"
trigger5=root,command="a"^^helper(16000),command="a"
trigger6=root,command="b"^^helper(16000),command="b"
trigger7=root,command="c"^^helper(16000),command="c"
trigger8=root,command="x"^^helper(16000),command="x"
trigger9=root,command="y"^^helper(16000),command="y"
trigger10=root,command="z"^^helper(16000),command="z"
trigger11=root,command="start"^^helper(16000),command="start"
var(2)=0	;AI判定

[STATE 30,AISWITCH]
type=VarSet
triggerall=var(2)!=4	;常時プレイヤー判定以外
trigger1=root,command="AI1"||root,command="AI2"||root,command="AI3"||root,command="AI4"||root,command="AI5"
trigger2=root,command="AI6"||root,command="AI7"||root,command="AI8"||root,command="AI9"||root,command="AI10"
trigger3=root,command="AI11"||root,command="AI12"||root,command="AI13"||root,command="AI14"||root,command="AI15"
trigger4=root,command="AI16"||root,command="AI17"||root,command="AI18"||root,command="AI19"||root,command="AI20"
trigger5=root,command="AI21"||root,command="AI22"||root,command="AI23"||root,command="AI24"||root,command="AI25"
trigger6=root,command="AI26"||root,command="AI27"||root,command="AI28"||root,command="AI29"||root,command="AI30"
trigger5=root,command="AI31"||root,command="AI32"||root,command="AI33"||root,command="AI34"||root,command="AI35"
trigger6=root,command="AI36"||root,command="AI37"||root,command="AI38"||root,command="AI39"||root,command="AI39"
var(2)=0	;AI判定
;==============================================================================

;==============================================================================
; その他
;==============================================================================
[STATE 30,試合終了時黒化]
type=VarSet
trigger1=Root,Alive
trigger1=var(0)!=1
trigger1=helper(57),Var(2) >= 60
var(0)=1
[STATE 30,カラーチェンジ]
type=VarAdd
trigger1=var(19)!=0
trigger1=roundstate=2
trigger1=!root,sysvar(4)
trigger1=roundno>=2||var(19)&512
trigger1=helper(57),var(0)>abs(var(19)&511)*60
trigger1=var(19):=(var(19)|1024)
var(0)=1
persistent=0
[STATE 30,カラーチェンジ]
type=VarAdd
trigger1=(var(19)&1024)
trigger1=helper(57),var(0)>abs(var(19)&511)*60+1200
var(0)=-1
persistent=0
;[state ];カラーテスト
;type=VarSet
;trigger1=root,command="b"
;var(0)=3
;[state ];カラーテスト
;type=VarSet
;trigger1=root,command="c"
;var(0)=1
;[state ];カラーテスト
;type=VarSet
;trigger1=root,command="y"
;var(0)=4
;[state ];カラーテスト
;type=VarSet
;trigger1=root,command="x"
;var(0)=2
;------------------------------------------------------------------------------
; 無敵化
[STATE 30,VAR(1)];helper(3)
type=VarSet
triggerall=var(1):=(var(1)|1)
trigger1=(root,var(15)&1024)
trigger2=helper(57),var(30)>120
trigger3=helper(40),stateno=10100||numhelper(10100)
trigger4=helper(57),var(0)>3000
trigger4=helper(57),var(30)>50
trigger5=numhelper(60)
trigger5=(helper(60),stateno%1000000)=[100,400]
trigger6=helper(57),var(3)>2200-var(0)*500
var(1)=(var(1)|1)-1
ignorehitpause=1
[STATE 30,VAR(1)]
type=VarSet
triggerall=var(1):=(var(1)|2)
trigger1=numhelper(60)
trigger1=(helper(60),stateno%1000000)=300
var(1)=(var(1)|2)-2
ignorehitpause=1
[STATE 30,VAR(1)];完全無敵化
type=VarSet
trigger1=(Enemy(0),Alive=0)+(Enemy(NumEnemy=2),Alive=0)=2	;敵が全て死亡
trigger2=root,alive=0
trigger3=(helper(16000),var(13)&128)	;ベホイミ
trigger4=root,var(18)=11		;P2NAME(F1)
trigger5=var(0)!=[1,3]
trigger6=var(0)=3			;時間で無敵化
trigger6=((gametime%1800)<helper(57),var(4)*3)||helper(57),var(4)>600
var(1)=0
ignorehitpause=1
;------------------------------------------------------------------------------
; HitShakeType
[STATE 30,VAR(9)]
type=VarSet
triggerall=var(9):=1
trigger1=root,palno=12
trigger1=helper(57),var(4)>1800
trigger2=numhelper(60)
trigger2=Helper(60),StateNo=[60000000,70000000]
var(9)=0
ignorehitpause=1
; /その他
;==============================================================================

;==============================================================================
; 防御機構管理
;==============================================================================
[STATE 30,回復停止、耐性消去]
type=VarSet
trigger1=(var(16)&65535)>0			;時間による
trigger1=helper(57),var(0)>(var(16)&65535)
trigger2=(helper(16000),var(13)&128)		;ベホイミ
var(16)=var(16)|1048576
persistent=0
;------------------------------------------------------------------------------
; 弾幕耐性
[STATE 30,弾幕耐性増加]
type=VarAdd
;triggerall=!(var(16)&1048576)
triggerall=var(15)>0
trigger1=!(var(31)&1)				;REVDEF耐性を利用しない
trigger1=(root,anim=[19000,19999])&&root,animelemno(0)<2
trigger2=var(31)&1				;REVDEF耐性を利用
trigger2=helper(20),var(10)>16
var(15)=ifelse(helper(57),var(0) < 6000,2 + (helper(57),var(0)<600)*2 + (fvar(11)>100)*3 , random%2)
[STATE 30,継続した弾幕の感知(増加)]
type=VarAdd
;triggerall=!(var(16)&1048576)
trigger1=!(var(31)&1)
trigger1=(root,anim=[19000,19999])&&root,animelemno(0)<2
trigger2=var(31)&1
trigger2=helper(20),var(10)>16
fvar(11)=2
[STATE 30,継続した弾幕の感知(減少)]
type=VarAdd
;triggerall=!(var(16)&1048576)
trigger1=fvar(11)>0
trigger1=var(0)<4				;透明カラー以外
trigger1=helper(16000),time>2			;ヘルパーアーマー待機時間
fvar(11)=-1*((helper(16000),time-2)/10)
[STATE 30,弾幕耐性(実体)]
type=VarSet
trigger1=1
sysvar(1)=ceil(var(15)/140)
[STATE 30,ダメージ減衰時間(実体)]
type=VarSet
trigger1=1
sysvar(2)=var(13)+ceil(var(15)/70)
; /弾幕耐性
;------------------------------------------------------------------------------
;一番うしろ
[STATE 30,根性値]
type=varset
trigger1=1
sysvar(4)=((root,life<root,lifemax*2/3)+(root,life<root,lifemax/2)+(root,life<root,lifemax/3)*2+(root,life<root,lifemax/4)*var(10)+(root,life<root,lifemax/5)*var(11))*var(0)
ignorehitpause=1
; 防御機構管理
;==============================================================================



;==============================================================================
;汎用即死返し
; 50	汎用即死返し用 StateNoメモリー
; 51-53	汎用即死返し用 StateNo保管
; 54-55	汎用即死返し用 StateNo保管(推定超即死)
;------------------------------------------------------------------------------
[STATE 30,PvS]
type=ParentVarSet
trigger1=1
var(41)=ID
ignorehitpause=1
[STATE 30,メモリー1];ヘルパー型ステート取得
type=VarSet
trigger1=numhelper(222)
trigger1=helper(222),var(0)>0
trigger1=abs(var(51))!=helper(222),var(0)
trigger1=abs(var(52))!=helper(222),var(0)
trigger1=abs(var(53))!=helper(222),var(0)
var(50)=helper(222),var(0)
ignorehitpause=1
[STATE 30,メモリー2];本体型ステート取得
type=VarSet
trigger1=helper(30),var(37)=2
trigger1=root,var(54)>0
trigger1=abs(var(51))!=root,var(54)
trigger1=abs(var(52))!=root,var(54)
trigger1=abs(var(53))!=root,var(54)
var(50)=root,var(54)
ignorehitpause=1
[STATE 30,メモリー3];(test)helper3
type=VarSet
trigger1=numhelper(33)
trigger1=helper(33),gethitvar(fall)=0
trigger1=helper(33),gethitvar(damage)=[0,50]
trigger1=helper(33),time=0
trigger1=helper(33),life=0
trigger1=abs(var(51))!=helper(33),StateNo
trigger1=abs(var(52))!=helper(33),StateNo
trigger1=abs(var(53))!=helper(33),StateNo
var(50)=helper(33),StateNo
ignorehitpause=1
[STATE 30,利用可能判別]
type=VarSet
trigger1=(var(50)=[10,12])||var(50)=20||(var(50)=[50,52])	;全部入れる必要は無いんじゃんない
trigger2=(var(50)=[120,122])||(var(50)=[130,132])
trigger3=(var(50)=[120,122])||(var(50)=[130,132])
trigger4=var(50)=140||(var(50)=[150,155])
trigger5=var(50)=5000||var(50)=5001||var(50)=5010||var(50)=5011
trigger6=var(50)=5020||var(50)=5030||var(50)=5035||var(50)=5040
trigger7=var(50)=5050||var(50)=5070||var(50)=5071||var(50)=5080
trigger8=var(50)=5081||var(50)=5100||var(50)=5101||var(50)=5110
trigger9=var(50)=5120||var(50)=5150||var(50)=5200||var(50)=5201
trigger10=var(50)=5210||var(50)=5900
trigger11=var(50)=var(51)||var(50)=var(52)||var(50)=var(53)
var(50)=0
ignorehitpause=1
[STATE 30,PVS]
type=ParentVarSet
trigger1=var(50)>0
var(55)=var(50)
ignorehitpause=1
[STATE 30,TEMP保管、51-53]
type=VarSet
triggerall=var(50)>0
trigger1=var(51)&&var(52)&&!var(53)
trigger1=var(53):=var(50)
trigger2=var(51)&&!var(52)
trigger2=var(52):=var(50)
trigger3=!var(51)
trigger3=var(51):=var(50)
var(50)=0
ignorehitpause=1
[STATE 30,TEMP保管、54-55]
type=ParentVarSet
triggerall=root,var(53)>0
trigger1=root,var(53)=var(51)||root,var(53)=var(52)
trigger2=root,var(53)=var(53)||root,var(53)=var(54)||root,var(53)=var(55)
trigger3=var(54)&&!var(55)
trigger3=var(55):=root,var(53)
trigger4=!var(54)
trigger4=var(54):=root,var(53)
var(53)=0
ignorehitpause=1
[STATE 30,ふつーの即死の優越]
type=VarSet
trigger1=var(55)>0
trigger1=abs(var(55))=abs(var(51))||abs(var(55))=abs(var(52))||abs(var(55))=abs(var(53))
trigger1=var(55):=0
trigger2=var(54)>0
trigger2=abs(var(54))=abs(var(51))||abs(var(54))=abs(var(52))||abs(var(54))=abs(var(53))
trigger2=var(54):=0
var(53)=0
ignorehitpause=1
;------------------------------------------------------------------------------
; 利用後判定
[STATE 30,利用後-失敗]
type=ParentVarSet
triggerall=Enemy(0),Alive
triggerall=(root,var(15)&1)
trigger1=root,var(55)=Enemy(0),StateNo
trigger2=root,var(55)=Enemy(0),PrevStateNo
var(15)=(root,var(15)|1)-1
ignorehitpause=1
[STATE 30,利用後-失敗]
type=ParentVarSet
triggerall=Enemy(0),Alive
trigger1=var(51)=Enemy(0),StateNo||var(51)=Enemy(0),PrevStateNo
trigger1=var(51):=var(51)*-1
trigger2=var(52)=Enemy(0),StateNo||var(52)=Enemy(0),PrevStateNo
trigger2=var(52):=var(52)*-1
trigger3=var(53)=Enemy(0),StateNo||var(53)=Enemy(0),PrevStateNo
trigger3=var(53):=var(53)*-1
var(55)=0
ignorehitpause=1
[STATE 30,利用後-成功]
type=ParentVarSet
triggerall=Enemy(0),Alive=0
trigger1=var(51)=Enemy(0),StateNo||var(51)=Enemy(0),PrevStateNo
trigger1=var(50):=var(51)
trigger2=var(52)=Enemy(0),StateNo||var(52)=Enemy(0),PrevStateNo
trigger2=var(50):=var(52)
trigger3=var(53)=Enemy(0),StateNo||var(53)=Enemy(0),PrevStateNo
trigger3=var(50):=var(53)
var(55)=var(50)+(var(50):=0)
ignorehitpause=1
;==============================================================================



;==============================================================================
; AI
;==============================================================================
;攻撃
[STATE 30,攻撃/C1,C2(OFF)]
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(35):=0 ||var(36):=0
[STATE 30,攻撃/C1,C2(ON)]
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=2
trigger1=time>600
trigger1=1||	var(36) := (var(36)|32768)
trigger1=root,life<lifemax*.6
trigger1=1||	var(35) := (var(35)|32768)
[STATE 30,攻撃/C1,C2(ON)]
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=3
trigger1=helper(57),var(30)>-450
trigger1=time>1200||helper(57),var(6)>600
trigger1=1||	var(35) := (var(35)|32768)
trigger1=1||	var(36) := (var(36)|32768)
;------------------------------------------------------------------------------
[STATE 30,VAR(34)SET]	;攻撃-三色
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=3
trigger1=!(time<=1200&&helper(57),var(6)<=600)	;試合時間20秒以下&&敵ライフ無変化時間10秒以下
trigger1=1||	var(34) := 0
trigger1=1||	var(34) := (var(34) | 126)
trigger1=1||	var(34) := (var(34) | 30*128)
trigger1=1||	var(34) := (var(34) | 5*4096)
[STATE 30,VAR(34)SET]	;攻撃-三色
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=3
trigger1=!(time<=1200&&helper(57),var(6)>=1200)	;試合時間20秒以下&&敵ライフ無変化時間10秒以下
trigger1=1||	var(34) := 0
trigger1=1||	var(34) := (var(34) | 40)
trigger1=1||	var(34) := (var(34) | 5*128)
trigger1=1||	var(34) := (var(34) | 5*4096)
[STATE 30,VAR(34)SET]	;攻撃-三色
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=3
trigger1=time<480		;試合時間8秒以下
trigger1=1||	var(34) := 0
trigger1=1||	var(34) := (var(34) | 120)
trigger1=1||	var(34) := (var(34) | 31*128)
trigger1=1||	var(34) := (var(34) | 1*4096)
trigger1=1||	var(36) := (var(36)|32768)
[STATE 30,VAR(34)SET]	;攻撃-三色
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=3
trigger1=helper(57),var(30)>25
trigger1=1||	var(34) := 0
trigger1=1||	var(34) := (var(34) | 5)
trigger1=1||	var(34) := (var(34) | 1*128)
trigger1=1||	var(34) := (var(34) | 5*4096)
[STATE 30,VAR(34)SET]	;攻撃-三色
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=1
trigger1=1||	var(34) := 0
trigger1=(GameTime%900)>620
trigger1=1||	var(34) := (var(34) | 70)
trigger1=1||	var(34) := (var(34) | 31*128)
trigger1=1||	var(34) := (var(34) | (random%3)*4096)
[STATE 30,VAR(34)SET]	;攻撃-三色
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=2
trigger1=1||	var(34) := 0
trigger1=(GameTime%700)>200
trigger1=1||	var(34) := (var(34) | 60)
trigger1=1||	var(34) := (var(34) | 31*128)
trigger1=1||	var(34) := (var(34) | (random%3)*4096)
[STATE 30,VAR(34)SET]	;攻撃-三色
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=2
trigger1=root,life<lifemax*.5
trigger1=1||	var(34) := 0
trigger1=1||	var(34) := (var(34) | 24)
trigger1=1||	var(34) := (var(34) | 21*128)
trigger1=1||	var(34) := (var(34) | (random%3)*4096)
[STATE 30,VAR(34)SET]	;攻撃-三色
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=2
trigger1=helper(57),var(20)>3
trigger1=1||	var(34) := 0
trigger1=1||	var(34) := (var(34) | 20)
trigger1=1||	var(34) := (var(34) | 5*128)
trigger1=1||	var(34) := (var(34) | 5*4096)
[STATE 30,VAR(34)SET]	;攻撃-三色
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=helper(57),var(30)<=-450
trigger1=1||	var(34) := 0
trigger1=(GameTime%900)>800||root,life<lifemax*.2
trigger1=1||	var(34) := (var(34) | 95)
trigger1=1||	var(34) := (var(34) | 31*128)
trigger1=1||	var(34) := (var(34) | 5*4096)
[STATE 30,攻撃/C2]
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=3
trigger1=helper(57),var(30)<=-450
trigger1=(GameTime%530)>500
trigger1=1||	var(36) := (var(36) | 32768)-32768
trigger1=1||	var(36) := (var(36) | 7)
trigger1=1||	var(36) := (var(36) | 31*128)
trigger1=1||	var(36) := (var(36) | (random%2)*4096)
[STATE 30,VAR(34)SET]	;攻撃-白
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=helper(57),var(30)<=-450
trigger1=1||	var(34) := 0
trigger1=time<1200&&enemynear,life<enemynear,lifemax*.2
trigger1=1||	var(34) := (var(34) | 127)
trigger1=1||	var(34) := (var(34) | 31*128)
trigger1=1||	var(34) := (var(34) | 6*4096)
;------------------------------------------------------------------------------
;移動
[STATE 30,移動/初期化]
type=VarSet
trigger1=1
var(33)=0
[STATE 30,移動/距離保つ];2400/40秒(old) 1680/28秒(new)
type=VarSet
triggerall=var(2)!=[2,4] ;AION
trigger1=(time=[900,1680])||helper(57),var(2)>360	;試合時間15秒以上/敵ライフ無変化時間6秒以上
trigger1=(gametime%800)>670
trigger1=(gametime%1800)>1200
trigger2=time<=1680	;試合時間40秒未満
trigger2=((gametime%800)=[0,670])||((gametime%1800)=[0,1200])
trigger3=time>1680	;試合時間40秒以上
trigger3=(gametime%800)>670
trigger3=(gametime%1800)>1200
trigger4=root,alive=0		;死んだ
var(33)=3*1048576|15|20*32|15*1024|5*32768
[STATE 30,移動/距離離れる]
type=VarSet
triggerall=var(2)!=[2,4] ;AION
trigger1=time<=900	;試合時間15秒未満
trigger1=helper(57),var(6)<=360	;敵ライフ無変化時間6秒以下
trigger1=(gametime%350)!=[0,250]
trigger2=time>1680	;試合時間40秒未満
trigger2=((gametime%800)=[0,670])||((gametime%1800)=[0,1200])
var(33)=2*1048576|17|20*32|5*32768
[STATE 30,移動/距離狭める]
type=VarSet
triggerall=var(2)!=[2,4] ;AION
triggerall=root,alive&&!winko
trigger1=time<=900	;試合時間15秒未満
trigger1=helper(57),var(6)<=360	;敵ライフ無変化時間6秒以下
trigger1=(gametime%350)=[0,250]
trigger2=(gametime%1100)<80
trigger3=var(0)=1
trigger3=(gametime%800)<380
trigger4=helper(57),var(30)<=-450
trigger4=(gametime%600)<300
var(33)=1*1048576|15|15*32|28*32768
[STATE 30,移動/距離狭める]
type=VarSet
triggerall=var(2)!=[2,4] ;AION
triggerall=root,alive&&!winko
trigger1=numhelper(60)
trigger1=(helper(60),stateno%1000000)=[100,400]
var(33)=3*1048576|8|17*32|19*1024|6*32768
;------------------------------------------------------------------------------
;特殊
[STATE 30,汎用即死返し];(1:Helper/2:Root)
type=VarSet
triggerall=!(root,var(15)&1)
triggerall=var(2)!=[2,4] ;AION
triggerall=var(0)=3
trigger1=time=[650,2000]
trigger1=var(51)<=0||var(52)<=0||var(53)<=0
var(37)=1
[STATE 30,汎用即死返し];(1:Helper/2:Root)
type=VarSet
triggerall=!(root,var(15)&1)
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=3
trigger1=time>3000
trigger1=var(51)<=0
trigger1=var(52)<=0
trigger1=var(53)<=0
var(37)=2
[STATE 30,汎用即死返し];(1:Helper/2:Root)
type=VarSet
triggerall=var(2)!=[2,4] ;AION
trigger1=time>3800
trigger2=helper(57),var(30)<=-450
trigger3=var(37)=1
trigger3=time>2000
trigger4=(Enemy(0),Alive=0)+(Enemy(NumEnemy=2),Alive=0)=2
var(37)=0
;------------------------------------------------------------------------------
;HitDef
[STATE 30,HitDefON]
type=NULL
triggerall=var(2)!=[2,4] ;AION
triggerall=root,alive
trigger1=var(0)=3
trigger1=var(37)=2||(time>5400);-(roundno>=2)*1700)
trigger1=1||	var(30) := (var(30) | 1)
trigger1=time>5400;-(roundno>=2)*1700
trigger1=1||	var(30) := (var(30) | 2)	;常時
[STATE 30,RevDef耐性]
type=NULL
triggerall=var(2)!=[2,4] ;AION
triggerall=root,alive
triggerall=root,var(18)!=10029
trigger1=var(30)&1
trigger1=1||	var(31) := (var(31) | 1)
trigger1=1||	var(31) := (var(31) | 2)	;常時
;------------------------------------------------------------------------------
;RevDef
[STATE 30,RevDef]
type=VarSet
triggerall=roundstate=2
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=[1,2]
trigger2=helper(57),var(30)<10
var(38)=0
[STATE 30,RevDef]
type=VarSet
triggerall=roundstate=2
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=3
trigger1=helper(57),var(30)>=10
var(38)=1
[STATE 30,RevDef]
type=VarSet
triggerall=roundstate=2
triggerall=var(2)!=[2,4] ;AION
triggerall=var(0)=3
trigger1=var(51)>0||var(52)>0||var(53)>0
trigger2=helper(16000),var(30)>0
trigger2=!(helper(16000),var(30)%2)
trigger2=helper(57),var(30)>=10
trigger2=time>1200+(helper(57),var(15)&1)*800
trigger2=var(51)<=0&&var(52)<=0&&var(53)<=0
trigger3=(root,var(15)&1)
var(38)=2
[STATE 30,RevDef]
type=VarSet
triggerall=roundstate=2
triggerall=var(2)!=[2,4] ;AION
triggerall=var(0)=3
triggerall=helper(57),var(30)>=10
trigger1=helper(57),var(30)>500
trigger2=time>5100-(helper(57),var(30)>=180)*1240-(root,var(55)<=0)*400;5400
var(38)=3
[STATE 30,RevDef]
type=VarAdd
triggerall=roundstate=2
triggerall=var(2)!=[2,4] ;AION
triggerall=!(root,var(15)&1)
triggerall=var(0)=3
triggerall=(Enemy(0),Alive=0)+(Enemy(NumEnemy=2),Alive=0)<2;Enemy(0),Alive=0
trigger1=(var(38)&7)=2&&var(41)=300
trigger2=(var(38)&7)=3&&var(41)=400
var(38)=-1
[STATE 30,RevDef]
type=VarSet
triggerall=roundstate=2
triggerall=var(2)!=[2,4] ;AION
trigger1=var(0)=3
trigger1=helper(57),var(30)>-10||time>1660||enemynear,life<enemynear,lifemax*.32
trigger1=time>400
var(38)=var(38)|1024
[STATE 30,継承]
type=VarSet
trigger1=root,roundsexisted>0
trigger1=time<800
var(38)=root,var(19)
[STATE 30,RevDef継承]
type=ParentVarSet
triggerall=var(2)!=[2,4] ;AION
trigger1=roundstate>2
trigger1=helper(57),var(30)>-450
trigger1=(Enemy(0),Alive=0)+(Enemy(NumEnemy=2),Alive=0)=2;Enemy(0),Alive=0
var(19)=(var(38)|1024)-1024-((var(38)&7)=3)*2
[STATE 30,ライフ反転継承];ライフ反転で殺した
type=ParentVarSet
triggerall=var(2)!=[2,4] ;AION
trigger1=RoundState>2
trigger1=helper(30),var(2)!=[2,4]
trigger1=helper(57),var(36)>250&&helper(57),var(37)<400
var(19)=-1241
[STATE 30,凍結継承];凍結で殺した
type=ParentVarSet
triggerall=var(2)!=[2,4] ;AION
trigger1=RoundState=4
trigger1=Enemy(0),HitPauseTime>=2000000000
trigger1=Enemy(0),Life=0||WIN
var(19)=-1242
;------------------------------------------------------------------------------
;==============================================================================

;==============================================================================
[STATE VAR(30)/VAR(31)SET]
type=VarRangeSet
trigger1=(Root,Var(15)&1024)
first=30
last=31
value=0
[STATE 30]
type=VarSet
trigger1=numhelper(60)
trigger1=Helper(60),time=1
trigger1=Helper(60),StateNo=69999999
var(41)=(helper(60),prevstateno%1000000)
[STATE 30]
type=VarSet
triggerall=root,var(18)=0
triggerall=root,roundsexisted>0
triggerall=root,palno=12
triggerall=helper(57),var(30)>50
trigger1=!numhelper(33000000)
trigger2=numhelper(33000000)
trigger2=helper(33000000),var(0)!=1
var(8)=2-((Enemy(0),Alive=0)+(Enemy(NumEnemy=2),Alive=0)=2)
;==============================================================================



;==============================================================================
; P2NAME
;==============================================================================
;------------------------------------------------------------------------------
[STATE 30,VAR(34)SET]	;攻撃-三色
type=NULL
triggerall=var(2)!=[2,4] ;AION
trigger1=root,var(18)=10029
trigger1=1||	var(34) := 0
trigger1=1||	var(34) := (var(34) | 40)
trigger1=1||	var(34) := (var(34) | 10*128)
trigger1=1||	var(34) := (var(34) | 5*4096)
[STATE 30,移動/距離離れる]
type=VarSet
trigger1=var(2)!=[2,4] ;AION
trigger1=root,var(18)=10029
var(33)=2*1048576|9|13*32|5*32768
[STATE 30,RevDef]
type=VarSet
triggerall=roundstate=2
triggerall=var(2)!=[2,4] ;AION
trigger1=root,var(18)=10029
trigger2=root,var(18)=778999
var(38)=3
[STATE 30,HitDefON]
type=varset
triggerall=var(2)!=[2,4] ;AION
trigger1=root,var(18)=10029
trigger1=enemy,stateno=10029&&enemy,time>60
var(30)=var(30)|1
[STATE 30,ゾンビ]
type=VarSet
triggerall=var(2)!=[2,4] ;AION
trigger1=root,var(18)=10029
var(17)=0
;//////////////////////////////////////
[STATE 30]
type=VarSet
trigger1=root,var(18)=778999
var(8)=3
;//////////////////////////////////////
[STATE 30]
type=VarAdd
trigger1=Enemy(0),NAME="ONI-MIKO-REIMU"	;0のが見た目が好い
trigger1=(var(38)&7)=1
var(38)=-1
;==============================================================================

;==============================================================================
; アニメ
;==============================================================================
;------------------------------------------------------------------------------
; 回転
;------------------------------------------------------------------------------
;計算
;--距離-----
[state 距離]
type=varset
trigger1=numenemy=1
trigger2=numenemy=2
trigger2=enemynear(0),alive
fvar(12)=(enemynear(0),pos y)-root,pos y+fvar(8)
[state 距離]
type=varset
trigger1=numenemy=2
trigger1=!enemynear(0),alive
fvar(12)=(enemynear(1),pos y)-root,pos y+fvar(8)
[state 距離]
type=varadd
trigger1=numenemy=1
trigger1=enemynear(0),const(size.mid.pos.y)>-20
trigger2=numenemy=2
trigger2=enemynear(0),alive
trigger2=enemynear(enemynear(0),alive=0),const(size.mid.pos.y)>-20
fvar(12)=50
[state 距離]
type=varset
trigger1=numenemy=1
trigger2=numenemy=2
trigger2=enemynear(0),alive
fvar(13)=abs(root,pos x-enemynear(0),pos x)
ignorehitpause=1
[state 距離]
type=varset
trigger1=numenemy=2
trigger1=!enemynear(0),alive
fvar(13)=abs(root,pos x-enemynear(1),pos x)
ignorehitpause=1
[state 距離]
type=NULL
trigger1=0 && fvar(6):=abs(fvar(13))
trigger2=0 && fvar(7):=abs(fvar(12))
;x<yなら値を入れ替える
trigger3=0 && fvar(4):=((fvar(6)>fvar(7))*fvar(6))+((fvar(6)<fvar(7))*fvar(7))+(fvar(6)=fvar(7))
trigger4=0 && fvar(5):=((fvar(6)<fvar(7))*fvar(6))+((fvar(6)>fvar(7))*fvar(7))+(fvar(6)=fvar(7))
;/入替end
trigger5=0 && fvar(0):=fvar(5)/fvar(4)	;t=y / x;
trigger6=0 && fvar(1):=fvar(0)*fvar(0)	;t=t * t;
trigger7=0 && fvar(2):=fvar(1)/(4+fvar(1))	;t=t / (4.0 + t);
trigger8=0 && fvar(3):=fvar(4)+2*fvar(4)*fvar(2)	;x=x + 2.0*x*t;


;--/距離-----
[state 3];x=x + 2.0*x*t;
type=varset
trigger1=1
fvar(3)= ifelse(WINKO&&(RoundState=4||(enemy(0),stateno=5150&&enemy(numenemy=2),stateno=5150)),9,fvar(4) + 2 * fvar(4) * fvar(2))
;--/距離-----
[state kakudo]
type=varset
trigger1=1
fvar(30)=ifelse(WINKO, 90 ,( atan( (fvar(13)-(fvar(13)=0))/((fvar(12))-((fvar(12))=0)) ) * 180/pi ) - ((fvar(12)>0)-(fvar(12)<=0))*90 )
;/計算
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
; 特殊な穴アニメ
;------------------------------------------------------------------------------
;HITSHAKE
[STATE 30,死亡後透過]
type=Trans
triggerall=root,alive	;死亡後はHitShakeさせない
trigger1=helper(16000),fvar(20)
trans=add1
[STATE 30,HITSHAKE_PALFX]
type=PalFX
triggerall=root,alive
trigger1=helper(16000),fvar(20)
time=1
mul=10,10,10
add=20,20,20
[STATE 30,HITSHAKE回転度SET]
type=VarSet
triggerall=root,alive
trigger1=helper(57),var(22)=1
fvar(10)=( atan( (root,p2dist x-(root,p2dist x=0))/(root,p2dist y-(root,p2dist y=0)) ) * 180/pi ) - ((root,p2dist y>0)-(root,p2dist y<=0))*90
[STATE 30,HITSHAKE回転度ADD]
type=VarAdd
triggerall=root,alive
trigger1=helper(16000),fvar(20)
fvar(10)=25
[STATE 30,HITSHAKE回転度RESET]
type=VarSet
triggerall=root,alive
triggerall=helper(16000),fvar(20)
trigger1=fvar(10) != [0,360]
fvar(10)=0
;/HitShake
;------------------------------------------------------------------------------
; 死亡後回転
[STATE 30,死亡後透過]
type=Trans
triggerall=(helper(57),sysvar(1)&1)	;動作不可
trigger1=helper(16000),var(7)=[170,180]
trans=add
[STATE 30,死亡後回転1]
type=varset
triggerall=(helper(57),sysvar(1)&1)
trigger1=helper(16000),var(7)<=1
fvar(10)=( atan( (root,p2dist x-(root,p2dist x=0))/(root,p2dist y-(root,p2dist y=0)) ) * 180/pi ) - ((root,p2dist y>0)-(root,p2dist y<=0))*90
persistetnt= 0
[STATE 30,死亡後回転2]
type=varset
triggerall=(helper(57),sysvar(1)&1)
trigger1=fvar(10)>360 && helper(16000),var(7)= [1,180]
trigger2=fvar(10) < 0 && helper(16000),var(7) >100
fvar(10)=0
[STATE 30,死亡後回転3]
type=varadd
triggerall=(helper(57),sysvar(1)&1)
trigger1=helper(16000),var(7)=[1,180]
fvar(10)=(15 - ((floor((180-helper(16000),var(7))/4)))) * (ifelse(roundno%2=0,1,-1))
[STATE 30,死亡後回転4]
type=varadd
triggerall=(helper(57),sysvar(1)&1)
triggerall=helper(16000),var(7)>180
trigger1=fvar(10)=[91,180]
trigger2=fvar(10)=[271,360]
fvar(10)=-1
[STATE 30,死亡後回転5]
type=varadd
triggerall=(helper(57),sysvar(1)&1)
triggerall=helper(16000),var(7)>180
trigger1=fvar(10)=[0,89]
trigger2=fvar(10)=[181,269]
fvar(10)=1
;------------------------------------------------------------------------------
; DRAWGAME、LOSETIME
[STATE 30,DRAW回転1]
type=varadd
triggerall=root,alive
triggerall=!win
trigger1=helper(16000),var(7)= [1,145]
fvar(10)=(7 - ((floor((20-helper(16000),var(7))/18))))
[STATE 30,DRAW回転2]
type=varadd
triggerall=root,alive
triggerall=!win
trigger1=helper(16000),var(7)>145
fvar(10)=( 30-( helper(16000),var(7)%61) )/4
;/特殊な穴アニメ
;------------------------------------------------------------------------------
;穴アニメ基本
[state 30,ana0]
type=ChangeAnim
triggerall=!(helper(57),sysvar(1)&1)
triggerall=helper(40),stateno!=10100
triggerall=Anim != 520
trigger1=fvar(3)>280
value=520

[state 30,ana1]
type=ChangeAnim
triggerall=!(helper(57),sysvar(1)&1)
triggerall=helper(40),stateno!=10100
triggerall=Anim != 521
trigger1=fvar(3)=[170,279]
value=521

[state 30,ana2]
type=ChangeAnim
triggerall=!(helper(57),sysvar(1)&1)
triggerall=Anim != 522
trigger1=fvar(3)=[130,169]
trigger2=helper(40),stateno=10100;ビーム
value=522

[state 30,ana3]
type=ChangeAnim
triggerall=!(helper(57),sysvar(1)&1)
triggerall=helper(40),stateno!=10100
triggerall=Anim != 523
trigger1=fvar(3)=[70,129]
value=523

[state 30,ana4]
type=ChangeAnim
triggerall=!(helper(57),sysvar(1)&1)
triggerall=helper(40),stateno!=10100
triggerall=Anim != 524
trigger1=fvar(3)=[25,69]
value=524

[state 30,ana5]
type=ChangeAnim
triggerall=!(helper(57),sysvar(1)&1)
triggerall=helper(40),stateno!=10100
triggerall=Anim != 525
trigger1=fvar(3)=[10,24]
value=525

[state 30,ana6]
type=ChangeAnim
triggerall=!(helper(57),sysvar(1)&1)
triggerall=helper(40),stateno!=10100
triggerall=Anim != 526
trigger1=fvar(3) < 10
value=526
;-/穴--------------------------------------------------------------------------
;------------------------------------------------------------------------------
; 穴の中の色変更 - 攻撃時
[state 30,green]
type=PalFX
triggerall=!(helper(57),sysvar(1)&1)
trigger1=helper(40),stateno=10000
time=1
mul=155,155,125
add=0,255,0
[state 30,blue]
type=PalFX
triggerall=!(helper(57),sysvar(1)&1)
trigger1=helper(40),stateno=10001
time=1
mul=155,155,125
add=25,25,255
[state 30,red]
type=PalFX
triggerall=!(helper(57),sysvar(1)&1)
trigger1=helper(40),stateno=10002
time=1
mul=155,155,125
add=255,0,0
[state 30,yellow]
type=PalFX
triggerall=!(helper(57),sysvar(1)&1)
trigger1=helper(40),stateno=10003
time=1
mul=155,155,125
add=255,255,0
[state 30,kuro]
type=PalFX
triggerall=!(helper(57),sysvar(1)&1)
trigger1=helper(40),stateno=10004
time=1
mul=175,175,155
add=150,150,150
[state 30,siro]
type=PalFX
triggerall=!(helper(57),sysvar(1)&1)
trigger1=helper(40),stateno=10005
time=1
mul=175,175,155
add=250,250,250
;--ビーム-----
[state 30,beampalfx];10100
type=PalFX
triggerall=!(helper(57),sysvar(1)&1)
trigger1=helper(40),stateno=10100
time=1
mul=125,125,255
add=120,120,120
[state 30,beamtrans]
type=Trans
triggerall=!(helper(57),sysvar(1)&1)
trigger1=helper(40),stateno=10100
trans=add
alpha=156,56
;-/ビーム-----

[STATE 30,!WIN]
type=PalFX
triggerall=roundstate=4
triggerall=root,alive
trigger1=!win
persistent=0
time=10000
mul=255,111,255
sinadd=126,126,126,ceil((70.0/60.0)*TicksPerSecond)
[STATE 30,WIN]
type=PalFX
triggerall=roundstate=4
triggerall=root,alive
trigger1=win
persistent=0
time=10000
mul=155,255,125
sinadd=66,155,66,ceil((70.0/60.0)*TicksPerSecond)
;------------------------------------------------------------------------------
; 穴の中の色変更 - 通常時
[state 30,色変更フラグ]
type=varset
trigger1=1
fvar(9)=0

[state 30,色変更フラグ]
type=varset
trigger1=(helper(57),sysvar(1)&1)
trigger2=helper(40),stateno=12345040
trigger2=helper(40),var(59)=1
trigger3=roundstate=3
fvar(9)=1

[STATE 30,通常色]
type=PalFX
trigger1=fvar(9)=1
trigger2=time=0
time=-1
mul=135,140,140
sinadd=166,166,166,ceil((120.0/60.0)*TicksPerSecond)
;-/色変化----------------------------------------------------------------------
[STATE 30,SPR]
type=SprPriority
trigger1=1
value=3-(root,var(4)=3)*4
;-/角度とか--------------------------------------------------------------------
;/アニメ
;==============================================================================
[state ]
type=varset
trigger1=helper(16000),var(7)
trigger1=root,alive&&(drawgame||losetime)
trigger2=helper(16000),var(7)
trigger2=(helper(57),sysvar(1)&1)	;動作不能フラグ
trigger3=helper(16000),fvar(20)		;ヒットシェイク
fvar(30)=fvar(10)
[state ]
type=angledraw
;triggerall=gametime=helper(57),var(16)||roundstate>2||root,alive=0	;supermovetime:)
trigger1=helper(40),stateno!=10100	;ビームを出してない
value=fvar(30)
;------------------------
; /穴
;==============================================================================


;******************************************************************************
; 枠
;******************************************************************************
[Statedef 31]
type=a
anim=510
velset=0,0
ctrl=0
;==============================================================================
; HELPER_COMMON
[State changeprev]
type=changestate
trigger1=!ishelper(31)
trigger2=p1name!="AxAyAzSSX"
value=12345
ignorehitpause=1
[state pal11]
type=changestate
trigger1=root,sysvar(0)>0
value=11000010
ignorehitpause=1

[state 31,BtR]
type=BindToRoot
trigger1=winko;&&root,anim=[180,189]
trigger2=root,anim=[190,191]
time=1
facing=1
pos=0,0+((root,anim=[190,191])||root,numexplod(181))*20181
[state bindtoroot]
type=posset
trigger1=helper(57),var(0)<5
x=0
y=0
persistent=0
[state bindtoroot]
type=turn
trigger1=!winko
trigger1=root,facing!=facing
[state bindtoroot]
type=OffSet
trigger1=!winko
x=(-.5+rootdist x)*root,facing
y=-.5+rootdist y+(root,numexplod(181))*20181
;--セット-----
[State 無敵]
type=nothitby
trigger1=1
value=SCA,AA,AT,AP
time=100000
[State 無敵]
type=HitOverride
trigger1=1
attr=SCA,AT,AA,AP
slot=6
stateno=stateno
time=-1
;--/セット-----
;/HELPER_COMMON
;posは常に画面初期の中心位置
;==============================================================================

[state ];八百長
type=changestate
triggerall=lose&&prevstateno!=32
trigger1=helper(30),var(8)=1
trigger2=!numhelper(30)
value=32
;.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~  枠アニメ  .~.~.~
[state ]
type=angledraw
trigger1=helper(40),stateno!=10100
value=helper(30),fvar(30)
[state ]
type=SprPriority
trigger1=1
value=3-(root,var(4)=3)*4
[state ]
type=Trans
trigger1=1
trans=addalpha
alpha=256,180
[state ]
type=ChangeAnim
trigger1=1
value=helper(30),anim-10

;.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~  ガードさせる  .~.~.~
[STATE 60000100]
type=StateTypeSet
trigger1=1
movetype=I
[STATE 60000100]
type=StateTypeSet
trigger1=numhelper(60)
trigger1=Helper(60),StateNo=60000100
trigger1=(Enemy(0),Alive=0)+(Enemy(NumEnemy=2),Alive=0)<2
movetype=A
[STATE 60000100]
type=AttackDist
trigger1=1
value=400
;------------------------------------------------------------------------------

;==============================================================================
;雑多ステート
;==============================================================================
[STATE ParentVarSet]
type=ParentVarSet
trigger1=NumHelper(33000000)
trigger1=RoundState=3&&(Enemy(0),Alive=0)+(Enemy(NumEnemy=2),Alive=0)<2
var(58)=Root,Var(58)|2|8
;==============================================================================
[STATE NOKOSLOW]
type=AssertSpecial
trigger1=root,alive=0
flag=nokoslow
[STATE NOKO]
type=AssertSpecial
trigger1=root,fvar(39)=2
trigger2=root,alive=0
trigger2=helper(57),sysvar(1)&2
trigger3=root,alive=0
trigger3=!(helper(57),sysvar(1)&1024)
flag=noko
ignorehitpause=1
[STATE NOBGNOFG]
type=AssertSpecial
triggerall=NumHelper(4600)
trigger1=Helper(4600),StateNo=[4610,4650]
flag=nobg
flag2=nofg
ignorehitpause=1
[STATE ParentVarSet]
type=ParentVarSet
triggerall=root,var(20)=[1,100]
trigger1=!numhelper(60)
trigger2=(helper(60),stateno%1000000)!=400
trigger2=(helper(60),prevstateno%1000000)!=400
var(57)=(Root,Var(57)|7168)-1024
[STATE EnvShakeCancel]
type=EnvShake
triggerall=numhelper(4600)
trigger1=helper(4600),stateno=[4602,4604]
trigger2=helper(4600),stateno=4610
trigger3=helper(4600),stateno=4630
trigger4=helper(4600),stateno=4640
time=2
freq=0
ampl=0
phase=0
ignorehitpause=1
[state ]
type=helper
trigger1=numhelper(60)
trigger1=helper(60),stateno=60000000||helper(60),stateno=60000200||helper(60),stateno=60000300||helper(60),stateno=60000400||helper(60),stateno=69999999||helper(60),stateno=6124
trigger2=numhelper(60)
trigger2=helper(60),var(11)
trigger3=numhelper(4600)
trigger3=helper(4600),stateno=[4660,4700]
id=5
name="palfx"
stateno=2004
helpertype=player
ignorehitpause=1
pausemovetime=99990000000
supermovetime=99990000000
[STATE ｼｽﾃﾑﾍﾙﾊﾟｰが壊れてます]
type=explod
pausemovetime=99990000000
supermovetime=99990000000
triggerall=roundstate=2
triggerall=!numexplod(2450)||!(gametime%2)
trigger1=numhelper(16000)
trigger1=helper(16000),stateno!=5150
trigger2=numhelper(30)
trigger2=helper(30),stateno!=30&&helper(30),stateno!=25
trigger3=numhelper(57)
trigger3=helper(57),stateno!=57
trigger4=numhelper(40)
trigger4=helper(40),stateno!=[1234500,1234509]
trigger4=helper(40),stateno!=[12345000,12345099]
trigger4=helper(40),stateno!=[123450000,123450999]
trigger4=helper(40),stateno!=[10000,10102]
trigger5=numhelper(4500)
trigger5=helper(4500),stateno!=[4500,4599]
trigger6=!numhelper(16000)
trigger7=!numhelper(30)
trigger8=!numhelper(31)
trigger9=!numhelper(57)
trigger10=!numhelper(40)
trigger11=!numhelper(4500)
id=2450
anim=2450
scale=1,1
postype=left
pos=floor(((root,numexplod(2450)+numexplod(2450))%72)/24)*120,((root,numexplod(2450)+numexplod(2450))%24)*10
ontop=1
sprpriority=9000
removetime=180;-1
bindtime=-1
ownpal=1
;/雑多ステート
;==============================================================================
;==============================================================================
; 雑多音声
;==============================================================================
[STATE 31,!WIN-SND]
type=PlaySnd
trigger1=!win&&root,alive
trigger1=roundstate=4
trigger1=helper(57),var(2)=131
value=1000, 1
volume= 240
channel=0
lowpriority=1
freqmul=1.1	;1
persistent=0
[STATE 31,WIN-SND]
type=PlaySnd
trigger1=win&&root,alive
trigger1=root,numexplod(181)=0
trigger1=helper(57),var(2)=131
value=1000, 2
volume= 240
channel=0
lowpriority=1
freqmul=1.36	;1.3
persistent=0
[STATE 31,WIN-SND-STOP]
type=StopSND
trigger1=root,numexplod(181)=1
channel=0
persistent=0
; /雑多音声
;==============================================================================

;==============================================================================
; HELPERS
;==============================================================================
; Helper(33)		投げ被弾
; Helper(10)		死の宣告
; Helper(15)		霧effect
; Helper(1585)		CLSN2
; helper(4600)		ステージ補助
; Helper(10010)		たま
; Helper(10020)		たまたま
; Helper(10100)		太いビーム
; Helper(22100000)	221X
; Helper(222)	222X
; Helper(5500000)	混線バグ1
; Helper(5600000)	混線バグ2
; Helper(5600100)	混線バグ2
;-------------------------------------------------superpause--
[state ];時間停止解除しない
type=varset
triggerall=var(29):=1
triggerall=p2name!="order-sol=badguy"
triggerall=roundstate<4
trigger1=numhelper(60)
trigger1=helper(60),stateno=60000000
trigger2=helper(57),var(11)>0	;超必殺判定
trigger3=helper(4500),stateno=[4501,4504]
trigger4=numhelper(4600)
trigger4=helper(4600),stateno=4603
trigger5=p2name="ONI-MIKO-REIMU"
trigger6=p2name="H-REIMU"
var(29)=0
ignorehitpause=1
[state ]
type=helper
triggerall=var(29)
trigger1=roundstate>2
trigger2=roundstate=2
trigger2=root,palno=12
trigger2=root,alive=0
trigger3=numhelper(60)
trigger3=(helper(60),stateno=60000100||helper(60),stateno=60000300)&&helper(60),var(36)=1
trigger4=numhelper(60)
trigger4=(helper(60),stateno=60000200||helper(60),stateno=60000400)
id=2
name="superpausecancel"
stateno=2001
helpertype=player
ignorehitpause=1
pausemovetime=99990000000
supermovetime=99990000000
;-------------------------------------------------
[state ];33
type=helper
triggerall=helper(30),var(1)&1
trigger1=!numhelper(33)
trigger1=roundstate=2
name="33"
id=33
stateno=5150
ownpal=1
helpertype=player
persistent=99
ignorehitpause=1
pausemovetime=99990000000
supermovetime=99990000000
;-------------------------------------------------
[state ];stage4600
type=helper
trigger1=roundstate=2
trigger1=!numhelper(4600)
trigger1=helper(16000),var(14)&1
trigger1=helper(30),var(18)
name="stage4600"
id=4601
stateno=131
helpertype=normal
ignorehitpause=1
pausemovetime=99990000000
supermovetime=99990000000
;-------------------------------------------------
[state ];fogeffect
type=Helper
triggerall=!numhelper(15)
triggerall=roundstate=2
trigger1=numhelper(4600)
trigger1=helper(4600),var(20)
trigger1=!(helper(16000),var(1)&64)
trigger1=root,var(18)!=10029
persistent=60
name="fog"
id=15
stateno=131
ownpal=1
helpertype=normal
ignorehitpause=1
pausemovetime=99990000000
supermovetime=99990000000
;-------------------------------------------------
[state ];sinosenkoku
type=helper
triggerall=!numhelper(10)
triggerall=roundstate=2
triggerall=helper(30),var(0)=3
trigger1=helper(57),var(0)=[61,399]
id=10
name="sino-senkoku"
stateno=131
helpertype=normal
ignorehitpause=1
pausemovetime=99990000000
supermovetime=99990000000
;-------------------------------------------------
[state ]
type=helper
trigger1=helper(30),var(37)=1
trigger1=!numhelper(222)
trigger1=roundstate=2
trigger1=!(root,var(56)&8)
persistent=60
name="222"
id=222
stateno=5150
helpertype=player
ignorehitpause=1
pausemovetime=99990000000
supermovetime=99990000000
;-------------------------------------------------
[STATE 31,HELPER(10010)]
type=Helper
trigger1=(root,var(56)&3)=0
trigger1=helper(16000),var(13)&32
trigger1=helper(40),stateno=12345040
trigger1=!numhelper(10100)
name="tama"
id=10010
ownpal=1
helpertype=normal
ignorehitpause=1
pausemovetime=9
supermovetime=9

[STATE 31,HELPER(10020)]
type=Helper
trigger1=(root,var(56)&3)=0
trigger1=helper(16000),var(13)&64
trigger1=helper(40),stateno=12345040
trigger1=numhelper(10020)<5
name="tamatama"
id=10020
ownpal=1
helpertype=normal
ignorehitpause=1
pausemovetime=9
supermovetime=9

[STATE 31,HELPER(10100)]
type=Helper
trigger1=helper(40),stateno=10100
trigger1=!numhelper(10100)
trigger1=root,alive
name="hutoibi-mu"
id=10100
postype=p1
pos=0,0
stateno=10100
ownpal=1
helpertype=player
ignorehitpause=1
pausemovetime=9
supermovetime=9



[STATE 31,HELPER(60000301)]
type=Helper
triggerall=root,var(18)!=778999
trigger1=!numhelper(60000301)
trigger1=numhelper(60)
trigger1=(helper(60),stateno%1000000)=[200,400]
name="AX-301"
id=60000301
postype=p1
pos=0,800000
stateno=5150
helpertype=player
ignorehitpause=1
pausemovetime=99990000000
supermovetime=99990000000
; /HELPERS
;==============================================================================
; /枠
;==============================================================================


;******************************************************************************
; HELPER
;******************************************************************************
;==============================================================================
; 15 - 待機
[Statedef 2015]
;--セット-----
[State changeprev]
type=changestate
trigger1=!ishelper(15)
trigger2=p1name!="AxAyAzSSX"
value=12345
ignorehitpause=1
[State 無敵]
type=nothitby
trigger1=1
value=SCA,AA,AT,AP
time=100000
ignorehitpause=1
[State 無敵]
type=HitOverride
trigger1=1
attr=SCA,AT,AA,AP
slot=1
stateno=stateno
time=-1
ignorehitpause=1
;-/セット-----
;------------------------------------------------------------------------------
; fog
[state fog]
type=palfx
trigger1=helper(4600),stateno=4620
trigger2=helper(4600),stateno=4640
trigger3=helper(4600),stateno=4680
trigger4=helper(4600),stateno=4690
trigger5=helper(4600),stateno=4700
time=2
mul=27,27,25
add=42,31,5
[state fog]
type=palfx
trigger1=helper(4600),stateno=4630
trigger2=helper(4600),stateno=4670
time=2
mul=23,23,18
add=12,11,72
[state fog]
type=palfx
trigger1=helper(4600),stateno=4660
time=2
mul=20,20,20
add=10,10,10
[state fog]
type=explod
triggerall=numexplod(4858)<8
triggerall=enemy,numhelper<8
trigger1=helper(4600),var(20)=1
persistent=2
id=4858
anim=4858
facing=ifelse(random%2,1,-1)
vfacing=ifelse(random%2,1,-1)
scale= (50+(random%30))*.01,.5
postype=left
pos=60,ceil(helper(4600),screenpos y)-10
random=350,20
velocity=1.3+(random%23)*.1, 0
removetime=60
bindtime=1
sprpriority=ifelse(random%2,-80,random%15)
ownpal=0
shadow=0,0,0
[state fog]
type=removeexplod
trigger1=numexplod(4858)
trigger1=helper(4600),var(20)!=1
id=4858
;/fog
;------------------------------------------------------------------------------
;hitdef
[state ]
type=StateTypeSet
trigger1=1
movetype=a
ignorehitpause=1
[state ]
type=StateTypeSet
trigger1=(helper(16000),var(1)&64)
movetype=i
ignorehitpause=1
[state ]
type=PosSet
trigger1=1
x=(random%300)-150
y=-(random%160)+20
ignorehitpause=1
[state ]
type=changeanim
trigger1=anim!=16004
value=16004
ignorehitpause=1
[state ]
type=hitdef
trigger1=1
ignorehitpause=1
[state ]
type=hitdef
trigger1=helper(4600),var(20)
id=0
priority=7,hit
animtype=light
sparkno=-1
attr=,AT
hitflag=MA
ground.type=none
damage=30+(random%55)
guard.sparkno=-1
ground.slidetime=14
ground.hittime =14
air.hittime=14
ground.velocity=-4,0
airguard.velocity=-1.9,-.8
air.velocity=-3,-1
numhits=0
ignorehitpause=1
[state ]
type=projectile
trigger1=1
persistent=40
projid=16011
projanim=16011
projscale=1,1
projremove=1
projremovetime=5
velmul=0, 0
projhits=1
projmisstime=1
projpriority=999999
projedgebound=10000
projstagebound=10000
projheightbound=-10000,10000
postype=p2
offset=0,enemynear,const(size.mid.pos.y)
sparkno=-1
guard.sparkno=-1
;-hitdef-
attr=SCA,NA
numhits=0
hitflag=MA
guardflag=NoNe
ground.type=none
ground.slidetime=24
ground.hittime=24
air.hittime=24
damage=35+(random%20),35+(random%20)
pausetime=0,0
ground.type=high
pausemovetime=99990000000
supermovetime=99990000000
[state ]
type=TargetDrop
trigger1=1
ID=-1
ignorehitpause=1
[state ];end
type=DestroySelf
trigger1=!numhelper(4600)
trigger2=helper(4600),var(20)=0
trigger2=helper(4600),StateNo!=4699
trigger2=helper(4600),StateNo!=[4602,4604]
ignorehitpause=1
;==============================================================================

;==============================================================================
;やあ （´・ω・｀)
;
;ようこそ、Helper20へ。
;==============================================================================
[Statedef 12345020]
type=u
movetype=u
physics=u
velset=0,0
sprpriority=0
ctrl=0
hitdefpersist=1

[State changeprev]
type=changestate
trigger1=!ishelper(20)
trigger2=p1name!="AxAyAzSSX"
value=12345
ignorehitpause=1
;------------------------------------------------------------------------------
[state BtR]
type=BindToRoot
trigger1=1
time=10000
facing=1
pos=0,0
ignorehitpause=1
[State 無敵]
type=nothitby
trigger1=1
value=SCA,AA,AT,AP
time=100000
ignorehitpause=1
[STATE HitOverride]
type=HitOverride
trigger1=1
attr=SCA
slot=1
stateno=-1
time=0
ignorehitpause=1
[STATE HitOverride]
type=HitOverride
trigger1=1
attr=SCA
slot=2
stateno=-1
time=0
ignorehitpause=1
[STATE HitOverride]
type=HitOverride
trigger1=1
attr=SCA
slot=3
stateno=-1
time=0
ignorehitpause=1
[STATE HitOverride]
type=HitOverride
trigger1=1
attr=SCA
slot=4
stateno=-1
time=0
ignorehitpause=1
[STATE HitOverride]
type=HitOverride
trigger1=1
attr=SCA
slot=5
stateno=-1
time=0
ignorehitpause=1
[STATE HitOverride]
type=HitOverride
trigger1=1
attr=SCA
slot=6
stateno=-1
time=0
ignorehitpause=1
[STATE HitOverride]
type=HitOverride
trigger1=1
attr=SCA,AA,AT,AP
slot=7
stateno=0
time=-1
ignorehitpause=1
[STATE 20,StS]
type=StateTypeSet
trigger1=!(helper(30),var(31)&1)
movetype=I
ignorehitpause=1
;------------------------------------------------------------------------------

;==============================================================================
; ライフ管理
;==============================================================================
[State ライフ]
type=LifeSet
trigger1=!(helper(30),var(31)&1)
trigger1=!(helper(30),var(37)=2)
trigger2=!var(9)
trigger2=var(9):=1
value=root,life
ignorehitpause=1
[State ライフ]
type=LifeSet
trigger1=root,life=lifemax
trigger1=root,power>=powermax
trigger1=!(helper(30),var(37)=2)
value=lifemax
ignorehitpause=1
[State ライフ]
type=LifeSet
trigger1=life=0
value=1
ignorehitpause=1
;------------------------------------------------------------------------------
[STATE 20,本体アニメのモザイク化]
type=VarSet
trigger1=helper(30),var(31)&1
trigger1=Root,Var(0)=1
trigger1=Root,Var(2)>-1
var(10)=18
ignorehitpause=1
[STATE 20,本体アニメのモザイク化（時間経過）]
type=VarAdd
trigger1=var(10)>0
var(10)=-1
ignorehitpause=1
;------------------------------------------------------------------------------
; 減衰やられ
[STATE 130,減衰ダメージ(黒)]
type=LifeAdd
triggerall=RoundState=2
triggerall=helper(30),var(0)=1
trigger1=helper(30),var(31)&1
trigger1=Root,Var(0)=1
trigger1=Root,Var(2)>-1
value=-( (Root,var(1) < floor(lifemax/100)) * Root,var(1) + (Root,var(1) >= floor(lifemax/100)) * floor(lifemax/100))
ignorehitpause=1

[STATE 130,減衰ダメージ(青)]
type=LifeAdd
triggerall=RoundState=2
triggerall=helper(30),var(0)=2
triggerall=helper(30),sysvar(1)!=0 ;MODULES BY ZERO 対策
triggerall=(gametime % helper(30),sysvar(1))=[0,2]
trigger1=helper(30),var(31)&1
trigger1=Root,Var(0)=1
trigger1=Root,Var(2)>-1
value=-( (Root,var(1) < floor(lifemax/(200+helper(30),sysvar(4)) )) * Root,var(1) + (Root,var(1) >= floor(lifemax/(200+helper(30),sysvar(4)) )) * floor(lifemax/(200+helper(30),sysvar(4)) ))
ignorehitpause=1

[STATE 130,減衰ダメージ(白)]
type=LifeAdd
triggerall=RoundState=2
triggerall=helper(30),var(0)=3
triggerall=helper(30),sysvar(1)!=0 ;MODULES BY ZERO 対策
triggerall=(gametime % helper(30),sysvar(1))=0
trigger1=helper(30),var(31)&1
trigger1=Root,Var(0)=1
trigger1=Root,Var(2)>-1
value=-( (Root,var(1) < floor(lifemax/(170+helper(30),sysvar(4)) )) * Root,var(1) + (Root,var(1) >= floor(lifemax/(170+helper(30),sysvar(4)) )) * floor(lifemax/(170+helper(30),sysvar(4)) ))
ignorehitpause=1

[STATE やられSND]
type=PlaySnd
trigger1=roundstate=2
trigger1=helper(30),var(31)&1
trigger1=Root,Var(0)=1
trigger1=Root,Var(2)>-1
value=210,random%4
volume=-25
channel=9
lowpriority=0
freqmul =1.45
loop=0
ignorehitpause=1
; /減衰やられ
;------------------------------------------------------------------------------
[STATE 120,ダメージ]
type=LifeAdd
trigger1=roundstate=2
trigger1=helper(30),var(31)&1	;REVDEF耐性あり
trigger1=Root,Var(0)=1
trigger1=Root,Var(2)=-1	;減衰中でない
trigger1=helper(57),var(0)>2
trigger1=helper(30),var(0)=[1,3]	;黒・青・白時のみ
trigger1=var(11):=floor((Root,var(1)*100<lifemax*100/Root,var(3))*Root,var(1)*100+(Root,var(1)*100>=lifemax*100/Root,var(3))*lifemax*100/Root,var(3))
;trigger1=var(11):=floor((Root,var(1)*75<lifemax*75/Root,var(3))*Root,var(1)*75+(Root,var(1)*75>=lifemax*75/Root,var(3))*lifemax*75/Root,var(3))
trigger1=var(11)>0
value=-var(11)+(var(11):=0)
ignorehitpause=1

[STATE やられSND]
type=PlaySnd
trigger1=roundstate=2
trigger1=helper(30),var(31)&1	;REVDEF耐性あり
trigger1=Root,Var(0)=1
trigger1=Root,Var(2)=-1	;減衰中でない
value=200,0
volume=0
channel=9
lowpriority=0
freqmul=1.3
loop=0
ignorehitpause=1

[STATE 120,必殺判定セット]
type=ParentVarSet
trigger1=helper(30),var(31)&1	;REVDEF耐性あり
trigger1=Root,Var(0)=1
trigger1=Root,Var(2)=-1
var(9)=-1
ignorehitpause=1

[STATE 120,ダメージ減衰化時間セット]
type=ParentVarSet
trigger1=helper(30),var(31)&1	;REVDEF耐性あり
trigger1=Root,Var(0)=1
trigger1=Root,Var(2)=-1
var(2)=helper(30),sysvar(2)*helper(30),var(0)
ignorehitpause=1
; /やられ
;-------------------------
[STATE 120,被弾フラグ解除]
type=ParentVarSet
trigger1=helper(30),var(31)&1	;REVDEF耐性あり
trigger1=Root,Var(0)=1
var(0)=-1
ignorehitpause=1
;------------------------------------------------------------------------------
; 投げダメージ(-2)
;/投げ
;------------------------------------------------------------------------------
;自己再生
[STATE -2,自己再生1]
type=LifeAdd
triggerall=ALIVE
triggerall=RoundState=2
triggerall=helper(30),var(31)&1
triggerall=!(helper(30),var(16)&1048576)
trigger1=(GameTime % 20 )=0
value=1
ignorehitpause=1
[STATE -2,自己再生2]
type=LifeAdd
triggerall=ALIVE
triggerall=RoundState=2
triggerall=helper(30),var(31)&1
triggerall=helper(30),var(0)=[2,3]
triggerall=!(helper(30),var(16)&1048576)
trigger1=(GameTime % ifelse(40-ceil(helper(30),sysvar(4)/2)<1,1,40-ceil(helper(30),sysvar(4)/2)) )=0
value=1
ignorehitpause=1
[STATE -2,ライフ変動]
type=LifeAdd
triggerall=ALIVE
triggerall=RoundState=2
triggerall=helper(30),var(31)&1
triggerall=life>30
triggerall=!(helper(30),var(16)&1048576)
trigger1=(GameTime % (45 + (RANDOM%80)) )=0
value=-(RANDOM%3)
kill=0
ignorehitpause=1
;/自己再生
;------------------------------------------------------------------------------
[STATE ベホイミ]
type=LifeAdd
trigger1=(helper(16000),var(13)&128)
value=1
ignorehitpause=1
;------------------------------------------------------------------------------


;==============================================================================
; 同期
;==============================================================================
[STATE 20,ANIM]
type=ChangeAnim
trigger1=ANIM!=16200
value=16200
ignorehitpause=1
[STATE 20,StS]
type=StateTypeSet
trigger1=helper(30),var(31)&1
trigger1=!(helper(30),var(37)=2)
movetype=A
ignorehitpause=1

[STATE 20,MoveHitReset]
type=MoveHitReset
trigger1=1
ignorehitpause=1

[STATE HitDefC]
type=HitDef
trigger1=1
ignorehitpause=1

[STATE 20,同期]
type=HitDef
triggerall=helper(30),var(31)&1
triggerall=!(helper(30),var(37)=2)
triggerall=anim=16200
trigger1=Root,Var(59)=0
trigger2=helper(30),var(31)&2
trigger3=roundstate>2
attr=,HA
hitflag=HLMAFDP
guardflag=HLMA
priority=7,hit
sparkxy	= 999,999
sparkno=-1
Guard.dist=0
guard.sparkno=-1
ground.slidetime=0
numhits=0
damage=Root,Life-Life
pausetime=0,3
affectteam=F
hitonce=0
P2GetP1State=0
p2stateno=140
p2sprpriority=2-(root,var(4)=3)*4
persistent=1
ignorehitpause=1

[STATE 20,TLA]
type=targetlifeadd
trigger1=numtarget
trigger1=target,ID=root,ID
trigger1=helper(30),var(31)&1
trigger1=!(helper(30),var(37)=2)
value=-(root,life-life)
ignorehitpause=1

[STATE 20,TS]
type=targetstate
triggerall=numtarget
triggerall=target,ID=root,ID
trigger1=roundstate>2
value=140
ignorehitpause=1

[STATE 20,TD]
type=targetdrop
triggerall=numtarget
trigger1=target,ID!=root,ID
trigger2=!(helper(30),var(31)&1)
ignorehitpause=1
[STATE 20,TD]
type=changestate
trigger1=var(59)=12345020
value=120
ignorehitpause=1

;/同期
;==============================================================================
;------------------------
; /20
;==============================================================================
;八百長
[STATEDEF 32]
[state 12345]
type=ChangeState
trigger1=p1name!="AxAyAzSSX"
trigger2=!ishelper(31)
value=12345
ignorehitpause=1
[state ]
type=assertspecial
trigger1=roundstate=3
flag=roundnotover
ignorehitpause=1
[state ]
type=assertspecial
trigger1=1
flag=invisible
ignorehitpause=1
[state ]
type=helper
trigger1=1
id=2+!time
name="superpausecancel"
stateno=2001+!time
helpertype=player
ignorehitpause=1
pausemovetime=99990000000
supermovetime=99990000000
[state ]
type=changestate
trigger1=roundstate=4
value=31
ignorehitpause=1
;==============================================================================

