;==============================================================================
; o1-2-3.cns -2,-3
;==============================================================================
;------------------------
;------------------------------------------------------------------------------
;root,var
; 0     被弾フラグ(-1リセット/1:被弾)
; 1	GetHitVar(damage)
; 2     ダメージ減衰化時間
; 3     最大被ダメージ割合
; 4     投げ被弾フラグ
; 5	投げダメージ保管1 - 投げダメージ
; 6	投げダメージ保管2 - ライフ上限以上のダメージ
; 7	投げダメージ保管3 - 投げダメージ(2)
; 8	投げ無効化時間
; 9	必殺判定
; 10	イントロアニメ（カラーチェンジ）
; 11	イントロ系 毎フレーム継承される
;	ダメージ系 毎フレーム継承されない
; 12	HitOverride判定
; 13	投げダメージ保管4 - 最大投げダメージ割合
; 14	予約(2)	HitDef関連
; 15	予約(3) 混線
;	 0(1)	即死返しで倒した
;	 1(2)	開幕混線中途停止
;	 10(1024)	開幕混線
; 16	デバッグテスト
; 18	P2NAME
; 19	即死方法継承
; 20    相手GameTime上書きvar(N)
; 21    GT用1、加減算差分数値
; 22    GT用2、乗算差分数値（乗算）
; 23    GT用2、乗算差分数値（更に加減算）
; 28	継承されないVAR o2-16000.cnsでしか使われないStateDef2000000000で初期化されるVAR
; 29	継承されないVAR o2-16000.cnsでしか使われないStateDef2000000000で初期化されるVAR
; 30	STATENO
; 31	イントロアニメ用VAR
;	 (10)1024 タイムカウント
; 32	勝敗ログ
; 40	helper(4500),ID
; 41	helper(30),ID
; 51	即死返し用 anim1
; 52	即死返し用 anim2
; 53	汎用即死返し用 StateNo本体取得型 メモリ1
; 54	汎用即死返し用 StateNo本体取得型 メモリ2
; 55	汎用即死返し用 StateNo(ラウンド継承用)
; 56	特殊動作
;	 0-1(3)	混線バグ
;		 1	type1(5500000)
;		 2	type2(5600000)
;		 3	つかわない
;	 2(4)	OTHキラー用ヘルパー出すか
;	 3(8)	5150
; 57	相手ヘルパーにさせる行動
;	 0-1(3)	ヘルパー保持条件 (0-3)
;		 1	Root直下のみ
;		 2	孫ヘルパーも
;		 3	保持しない
;	 2-4(28) (0-7) var(57)&28/4
;	 	 1	OTHキラー
;	 	 2	P1StateNo(var(55))
;	 	 3	ステートもどす
;		 4	52
;		 5-7	予約
;	 5(32)	PowerSet=0
;	 6(64)	死亡後170
;	 7(128)	死亡後STOP
;	 10-12(7168)	変数書換 (0-7)
;	 	 1	0に
;		 2	1に
;		 3	RANDOM 範囲-500〜500
;		 4	RANDOM 範囲大
;		 5	GAMETIME上書てきとう
;		 6	GAMETIME上書ピンポイント
;		 7	保管
; 58	相手本体にさせる行動
;	 0-1(3)	即死後演出 (0-3)
;		 0	SelfStateさせる
;		 1	即死後演出（球の中に入る）
;		 2	即死後演出（伸びる）
;		 3	予約
;	 2(4)	HitDefを使わせる
;	 3(8)	ライフを0にする
; 59	-2/-3判定
;root,fvar
; 0     helper(60),pos x
; 1     helper(60),pos y
; 2     test
; 39	TEST(引き継がれない)
;sysvar
; 0	palno=11
; 1	色変更ギャップ
; 2	色変更バックアップ
; 3	time
; 4	勝敗ログ
;------------------------------------------------------------------------------
;******************************************************************************
; -2
;******************************************************************************
[Statedef -2]
;.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~  PalNo=11  .~.~.~
[state ]
type=selfstate
trigger1=!ishelper
trigger1=sysvar(0)>0
value=11000000
ignorehitpause=1
[state ]
type=selfstate
trigger1=ishelper&&numexplod
trigger1=root,sysvar(0)>0
trigger1=!ishelper(1)&&!ishelper(2)&&!ishelper(3)&&!ishelper(4)
trigger1=!ishelper(5500000)&&!ishelper(60000301)&&!ishelper(1585)
value=11000010
ignorehitpause=1
[state ]
type=destroyself
trigger1=ishelper
trigger1=!ishelper(1)&&!ishelper(2)&&!ishelper(3)&&!ishelper(4)
trigger1=!ishelper(5500000)&&!ishelper(60000301)&&!ishelper(1585)
trigger1=root,sysvar(0)>0
ignorehitpause=1
;.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~  汎用ishelper  .~.~.~
[state ]
type=screenbound
trigger1=ishelper
value=0
ignorehitpause=1
[state ]
type=SelfState
trigger1=ishelper
trigger1=!ishelper(16000)
trigger1=!ishelper(33)
trigger1=!ishelper(20)
trigger1=!ishelper(222)
trigger1=!ishelper(5600100)
trigger1=!ishelper(10100)
value=5150
ignorehitpause=1
[state ]
type=VarSet
triggerall=ishelper(5600100)
trigger1=(Root,var(15)=16777216)
trigger1=Root,NumTarget=8
trigger2=numhelper(5600000)
trigger2=Helper(5600000),numtarget=8
var(1)=1
ignorehitpause=1
[state ]
type=SelfState
trigger1=ishelper(5600100)
value=IfElse(var(1),5500100,5150)
ignorehitpause=1
;==============================================================================
[STATE -2,]
type=SuperPause
trigger1=!ishelper||ishelper(16000)
trigger1=RoundState>2
time=3
movetime=3
unhittable=0
anim=-1
darken=0
ignorehitpause=1
[STATE -2,]
type=Pause
trigger1=!ishelper||ishelper(16000)
trigger1=RoundState>2
time=3
movetime=3
ignorehitpause=1
;==============================================================================
; VARSET
;==============================================================================
[STATE -2]
type=NULL
trigger1=!ishelper
trigger1=var(59):=var(59)+7||1
trigger1=var(14):=0||1
ignorehitpause=1
[STATE -2]
type=VarSet
triggerall=!ishelper
triggerall=!(var(56)&3=1)&&ProjContact=1&&ProjContact554=0
triggerall=var(12):=0||1
trigger1=!numtarget
trigger1=(var(12):=1)&&0
trigger2=numtarget
var(12)=target,ishelper
ignorehitpause=1
;------------------------------------------------------------------------------
[state debug40]
type=NULL
triggerall=!ishelper
triggerall=enemy(0),alive=0
trigger1=enemy(0),hitpausetime>=2
trigger1=enemy(0),stateno=88000100
trigger1=var(16):=1+(enemy(0),anim=16002)
ignorehitpause=1
;==============================================================================
; PLAYER-HELPER
;==============================================================================
;------------------------------------------------------------------------------
; 5500000
[STATE -2,5500000]
type=TargetState
triggerall=!ishelper
trigger1=(var(56)&3)=1;&&!winko
trigger2=(var(56)&3)=3
trigger2=(var(56)&16)=0
value=5150
ignorehitpause=1
[STATE -2,5500000]
type=ReversalDef
triggerall=!ishelper
trigger1=(var(56)&3)=1;&&!winko
trigger2=(var(56)&3)=3
trigger2=(var(56)&16)=0
reversal.attr=SCA,AA,AP,AT
pausetime=0,0
p2stateno=5150;5500100
ignorehitpause=1
; /HELPER(5500000)
;------------------------------------------------------------------------------
;HELPER(33) - 投げ被弾用ヘルパー
; 投げ抜け／やられキャンセル
[STATE -2,C-ANIM]
type=ChangeAnim
triggerall=ishelper(33)
trigger1=helper(16000),var(42)&3
value=ifelse(helper(16000),var(42)&1,301,302)
ignorehitpause=1
[STATE -2,やられキャンセル]
type=VARRANGESET
triggerall=ishelper(16000)
trigger1=var(42)&2
first=20
last=26
fvalue=0
ignorehitpause=1
;------------------------------------------------------------------------------
; 投げ抜け／やられキャンセルアニメ
[STATE -2,Assert]
type=AssertSpecial
triggerall=ishelper(33)
trigger1=anim!=[301,302]
flag=invisible
ignorehitpause=1
[STATE -2,Assert]
type=AssertSpecial
trigger1=ishelper(33)
flag=noshadow
ignorehitpause=1
[STATE -2,投げ抜け／やられキャンセル]
type=AngleDraw
triggerall=ishelper(33)
trigger1=anim=[301,302]
scale=-0.06*AnimTime,-0.06*AnimTime
ignorehitpause=1
[STATE -2,やられキャンセル]
type=PalFX
triggerall=ishelper(33)
trigger1=anim=302
time=1
mul=155,0,155
add=205,45,205
ignorehitpause=1
[STATE -2,投げ抜け]
type=PalFX
triggerall=ishelper(33)
trigger1=anim=301
time=1
mul=155,155,0
add=205,205,45
ignorehitpause=1
[STATE -2,投げ抜け／やられキャンセル]
type=Trans
triggerall=ishelper(33)
trigger1=anim=[301,302]
trans=add1
ignorehitpause=1
;------------------------------------------------------------------------------
; 投げ被弾管理
[STATE -2,3-V6SET];投げ被ダメージ、ライフ上限以上のダメージをVARに保管
type=varadd
triggerall=!ishelper
triggerall=numhelper(33)
triggerall=var(4)=3
trigger1=helper(33),life<2
var(6)=-lifemax
ignorehitpause=1
[STATE -2,3-保管ダメージリセット]
type=varset
triggerall=!ishelper
trigger1=var(4)!=3
var(6)=0
ignorehitpause=1
[STATE -2,3-全快]
type=lifeset
triggerall=ishelper(33)
trigger1=life<2
trigger2=stateno=12345
trigger3=helper(16000),var(42)&1
value=lifemax
ignorehitpause=1
[STATE -2,3-DESTROY]
type=destroyself
triggerall=ishelper(33)
trigger1=!alive
trigger2=numhelper(33)>1
trigger3=!(helper(30),var(1)&1)	;利用しない
trigger4=roundstate>2
trigger5=gethitvar(hitshaketime)>1200
trigger6=!(gametime%600)
trigger7=stateno=5150&&var(59)!=gametime
trigger8=abs(pos y)>3000
trigger9=abs(pos x)>1000
ignorehitpause=1
[STATE -2,SELF]
type=selfstate
triggerall=ishelper(33)
trigger1=helper(16000),var(42)&1	;投げ抜け
value=5150
ignorehitpause=1
; /HELPER(33)
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; 10100 - 太いビーム
[STATE -2,10100]
type=changeanim
triggerall=ishelper(10100)
trigger1=stateno!=[10100,10102]
value=36
elem=24-var(1)
ignorehitpause=1
[STATE -2,10100]
type=Projectile
triggerall=ishelper(10100)
trigger1=!time&&anim=36
projID=10100
projanim=35999+AnimElemNo(0)
projscale=1,1
projremove=0
projremovetime=2
guard.sparkno=-1
sparkno=-1
sparkxy=0,-5000
projsprpriority=7
projedgebound=500
projstagebound=500
projheightbound=-999,1
offset=0,-50
postype=p1
projshadow=0,0,0
;-hitdef-
attr=SCA,NA
hitflag=MAFD
guardflag=MA
damage=helper(30),var(0)*(1+(random%20)),helper(30),var(0)*(random%7)
ground.type=low
pausetime=0,0	
animtype=back
persistent=0
ignorehitpause=1
[STATE -2,10100DestroySelf]
type=destroyself
triggerall=ishelper(10100)
trigger1=stateno!=[10100,10102]
trigger2=gethitvar(hitshaketime)>1200
trigger3=helper(40),stateno!=10100
ignorehitpause=1
; /HELPER(10100)
;------------------------------------------------------------------------------
; 222 - 汎用即死返し用StateNo取得
[STATE -2,222]
type=DestroySelf
triggerall=ishelper(222)
trigger1=hitpausetime>100
trigger2=!(helper(30),var(37)=1)
trigger3=(Enemy(0),Alive=0)+(Enemy(NumEnemy=2),Alive=0)=2
trigger4=root,var(56)&8
trigger5=gametime-var(1)>20
ignorehitpause=1
[STATE -2,222]
type=VarSet
trigger1=ishelper(222)
trigger1=!Life
trigger1=StateNo!=5150||var(1)!=gametime
var(0)=StateNo
ignorehitpause=0
[STATE -2,222]
type=SelfState
trigger1=ishelper(222)
trigger1=movereversed=1
value=5150
ignorehitpause=1
[STATE -2,222]
type=LifeSet
trigger1=ishelper(222)
value=LifeMax
ignorehitpause=1
; /HELPER(222)
;------------------------------------------------------------------------------
;==============================================================================

;==============================================================================
; !ISHELPER - 基本設定
[STATE -2,画面固定]
type=screenbound
triggerall=!ishelper
trigger1=helper(16000),vel x!=[-6,6]
trigger1=helper(16000),screenpos x !=[-5,325]
movecamera=0,1
ignorehitpause=1
[STATE -2,BindToHelper16000]
type=posset
triggerall=!ishelper
triggerall=numhelper(16000)
trigger1=var(4)!=3
x=helper(16000),pos x
y=helper(16000),pos y
ignorehitpause=1
[STATE -2,BindToHelper3]
type=posset
triggerall=!ishelper
triggerall=numhelper(33)
trigger1=var(4)=3
trigger1=abs(helper(33),pos y)<3000
trigger1=abs(helper(33),pos x)<1000
x=helper(33),pos x
y=helper(33),pos y
ignorehitpause=1
[STATE -2,16000BindToHelper3]
type=posset
triggerall=ishelper(16000)
triggerall=numhelper(33)
trigger1=root,var(4)=3
x=helper(33),pos x
y=helper(33),pos y
ignorehitpause=1
[STATE -2,turn]
type=turn
triggerall=!ishelper
trigger1=helper(40),stateno!=10100
trigger1=P2dist X<0
ignorehitpause=1
; /基本設定
;==============================================================================

;==============================================================================
; !ISHELPER - 投げダメージ
;==============================================================================
; 投げ抜け
[STATE -2,投げ抜け]
type=VarRangeSet
triggerall=!ishelper
trigger1=helper(16000),var(42)&1
first=4
last=6
value=-1
ignorehitpause=1
;------------------------------------------------------------------------------
; 投げダメージセット
[STATE -2,VAR(4)SET]
type=varset
triggerall=!ishelper
triggerall=numhelper(33)
trigger1=helper(33),movetype=H
trigger1=helper(33),var(59)!=GameTime
trigger1=helper(33),stateno!=12345
trigger1=(helper(33),stateno!=[120,122])||(helper(33),stateno!=[130,132])
trigger1=helper(33),stateno!=140||(helper(33),stateno!=[150,155])
trigger1=helper(33),stateno!=5000||helper(33),stateno!=5001||helper(33),stateno!=5010||helper(33),stateno!=5011
trigger1=helper(33),stateno!=5020||helper(33),stateno!=5030||helper(33),stateno!=5035||helper(33),stateno!=5040
trigger1=helper(33),stateno!=5050||helper(33),stateno!=5070||helper(33),stateno!=5071||helper(33),stateno!=5080
trigger1=helper(33),stateno!=5081||helper(33),stateno!=5100||helper(33),stateno!=5101||helper(33),stateno!=5110
trigger1=helper(33),stateno!=5120||helper(33),stateno!=5150||helper(33),stateno!=5200||helper(33),stateno!=5201
trigger1=helper(33),stateno!=5210||helper(33),stateno!=5900
var(4)=3
ignorehitpause=1
[STATE -2,VAR(4)RESET]
type=varset
triggerall=!ishelper
trigger1=numhelper(33)
trigger1=helper(33),stateno=5150
trigger2=!numhelper(33)
var(4)=-1
ignorehitpause=1
[STATE -2,VAR(5)/VAR(7)SET]
type=NULL
triggerall=!ishelper
trigger1=var(4)=3
trigger1=var(5):=-1*helper(33),var(0)-var(6)-helper(33),life
trigger1=var(7):=var(7)+var(5)
ignorehitpause=1
[STATE -2,VAR(5)SET]
type=VarSet
triggerall=!ishelper
trigger1=var(5)=[1,lifemax*0.1]
trigger1=var(5):=2
trigger2=var(5)
var(5)=var(5);floor( var(5)*IfElse(var(7)-var(5)>20,.7,1) )
ignorehitpause=1
;[STATE -2,VAR(13)SET]
;type=varset
;triggerall=!ishelper
;triggerall=helper(30),var(0)=1
;trigger1=var(4)=3
;trigger1=var(5)>0
;var(13)=IfElse(var(5)<=750,500-(var(5)/250)*100,100)
;ignorehitpause=1
;[STATE -2,VAR(13)SET]
;type=varset
;triggerall=!ishelper
;triggerall=helper(30),var(9)=0	;旧式ヒットシェイク
;trigger1=var(4)=[2,3]
;trigger1=var(5)>0
;var(13)=(IfElse(var(5)<=750,6-ceil(var(5)/250),2)+helper(30),var(0))*100
;ignorehitpause=1
;[STATE -2,VAR(13)SET]
;type=varset
;triggerall=!ishelper
;triggerall=helper(30),var(9)=1	;新式ヒットシェイク
;triggerall=helper(30),var(0)=2
;trigger1=var(4)=3
;trigger1=var(5)>0
;var(13)=IfElse(var(5)<=750,770-(var(5)/250)*100,250)
;ignorehitpause=1
;[STATE -2,VAR(13)SET]
;type=varset
;triggerall=!ishelper
;triggerall=helper(30),var(9)=1	;新式ヒットシェイク
;triggerall=helper(30),var(0)=3
;trigger1=var(4)=3
;trigger1=var(5)>0
;var(13)=IfElse(var(5)<=750,700-(var(5)/250)*100,280)
;ignorehitpause=1
;[STATE -2,VAR(13)SET]
;type=varset
;triggerall=!ishelper
;trigger1=var(13)<0
;var(13)=0
;ignorehitpause=1
;------------------------------------------------------------------------------
; 投げダメージ、ライフ増減
[STATE -2,投げダメージ]
type=lifeadd
triggerall=!ishelper
triggerall=alive&&RoundState=2
triggerall=!(helper(30),var(31)&1)
triggerall=!(helper(16000),var(42)&1);投げ抜けフラグオフ
triggerall=helper(30),var(0)=[1,3]
trigger1=var(5)
trigger1=var(4)=3
;trigger1=var(11):=Floor((var(5)*100<lifemax*100/(var(13)+helper(30),sysvar(4)*82))*var(5)*100+(var(5)*100>=lifemax*100/(var(13)+helper(30),sysvar(4)*82))*lifemax*100/(var(13)+helper(30),sysvar(4)*82))
trigger1=var(11):=IfElse(var(8)>-1,random%2,(var(5)*85<lifemax*85/var(3))*var(5)*85+(var(5)*85>=lifemax*85/var(3))*lifemax*85/var(3))
trigger1=var(11)>0
value=-var(11)+(var(11):=0)
kill=1
ignorehitpause=1
[STATE -2,投げダメージ]
type=LifeAdd
triggerall=ishelper(20)
triggerall=Root,Alive&&RoundState=2
triggerall=helper(30),var(31)&1
triggerall=!(helper(16000),var(42)&1);投げ抜けフラグオフ
triggerall=helper(30),var(0)=[1,3]
trigger1=root,var(5)
trigger1=root,var(4)=3
;trigger1=var(11):=Floor((Root,var(5)*100<lifemax*100/(Root,var(13)+helper(30),sysvar(4)*82))*Root,var(5)*100+(Root,var(5)*100>=lifemax*100/(Root,var(13)+helper(30),sysvar(4)*82))*lifemax*100/(Root,var(13)+helper(30),sysvar(4)*82))
trigger1=var(11):=IfElse(root,var(8)>-1,random%2,(root,var(5)*85<lifemax*85/root,var(3))*root,var(5)*85+(root,var(5)*85>=lifemax*85/root,var(3))*lifemax*85/root,var(3))
trigger1=var(11)>0
value=-var(11)+(var(11):=0)
kill=1
ignorehitpause=1
;------------------------------------------------------------------------------
; 投げ無効化時間
[STATE -2,投げ無効化時間セット]
type=varset
trigger1=!Ishelper
trigger1=!(helper(30),var(31)&1)
trigger1=var(8)=-1
trigger1=var(5)>0
var(8)=(var(3)/100)*helper(30),var(14)
ignorehitpause=1
[STATE -2,投げ無効化時間カウント]
type=varadd
trigger1=!Ishelper
trigger1=!(helper(30),var(31)&1)
trigger1=var(8)>-1
var(8)=-1
ignorehitpause=1
;------------------------------------------------------------------------------
[STATE -2,投げ無効化時間セット]
type=parentvarset
triggerall=ishelper(20)
trigger1=helper(30),var(31)&1
trigger1=root,var(8)=-1
trigger1=root,var(5)>0
var(8)=(root,var(3)/100)*helper(30),var(14)
ignorehitpause=1
[STATE -2,投げ無効化時間カウント]
type=parentvaradd
triggerall=ishelper(20)
trigger1=helper(30),var(31)&1
trigger1=root,var(8)>-1
var(8)=-1
ignorehitpause=1
;------------------------------------------------------------------------------
;フラグリセット
[STATE -2,投げダメージ]
type=VarRangeSet
triggerall=!ishelper
triggerall=!(helper(30),var(31)&1)
triggerall=!(helper(16000),var(42)&1);投げ抜けフラグオフ
trigger1=helper(30),var(0)=[1,3]
trigger1=var(5)
trigger1=var(9):=-1
first=5
last=6
value=0
ignorehitpause=1
[STATE -2,投げダメージ]
type=ParentVarSet
triggerall=ishelper(20)
triggerall=helper(30),var(31)&1
triggerall=!(helper(16000),var(42)&1);投げ抜けフラグオフ
trigger1=helper(30),var(0)=[1,3]
var(9)=-1
ignorehitpause=1
[STATE -2,投げダメージ]
type=ParentVarSet
triggerall=ishelper(20)
triggerall=helper(30),var(31)&1
triggerall=!(helper(16000),var(42)&1);投げ抜けフラグオフ
trigger1=helper(30),var(0)=[1,3]
var(5)=0
ignorehitpause=1
[STATE -2,投げダメージ]
type=ParentVarSet
triggerall=ishelper(20)
triggerall=helper(30),var(31)&1
triggerall=!(helper(16000),var(42)&1);投げ抜けフラグオフ
trigger1=helper(30),var(0)=[1,3]
var(6)=0
ignorehitpause=1
[STATE -2,投げダメージ]
type=LifeSet
triggerall=ishelper(33)
triggerall=!(helper(16000),var(42)&1);投げ抜けフラグオフ
trigger1=helper(30),var(0)=[1,3]
value=lifemax
ignorehitpause=1
;-------------------------------------
[STATE -2,VAR(5)/VAR(6)/VAR(7)SET]
type=VarRangeSet
triggerall=!ishelper
triggerall=!(helper(30),var(31)&1)
trigger1=!numhelper(33)
trigger2=numhelper(33)
trigger2=helper(33),stateno=5150
first=5
last=7
value=0
ignorehitpause=1
[STATE -2,VAR(5)/VAR(6)/VAR(7)SET]
type=ParentVarSet
triggerall=ishelper(20)
triggerall=helper(30),var(31)&1
trigger1=!numhelper(33)
trigger2=numhelper(33)
trigger2=helper(33),stateno=5150
var(5)=0
ignorehitpause=1
[STATE -2,VAR(5)/VAR(6)/VAR(7)SET]
type=ParentVarSet
triggerall=ishelper(20)
triggerall=helper(30),var(31)&1
trigger1=!numhelper(33)
trigger2=numhelper(33)
trigger2=helper(33),stateno=5150
var(6)=0
ignorehitpause=1
[STATE -2,VAR(5)/VAR(6)/VAR(7)SET]
type=ParentVarSet
triggerall=ishelper(20)
triggerall=helper(30),var(31)&1
trigger1=!numhelper(33)
trigger2=numhelper(33)
trigger2=helper(33),stateno=5150
var(7)=0
ignorehitpause=1
[STATE -2,投げ無効化時間カウント]
type=varset
trigger1=!Ishelper
trigger1=helper(57),var(30)<=-450
trigger1=var(9)=[1,3]
var(8)=-1
ignorehitpause=1
;------------------------------------------------------------------------------
; /投げダメージ
;==============================================================================



;==============================================================================
; !ISHELPER - 自己再生
;==============================================================================
[STATE -2,自己再生1]
type=LifeAdd
triggerall=!ishelper
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=!ishelper
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=!ishelper
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
;/自己再生
;==============================================================================

;==============================================================================
; !ISHELPER - 汎用即死返し - StateNo本体取得型
;==============================================================================
[STATE -2,0-NOKO]
type=AssertSpecial
trigger1=!ishelper
trigger1=helper(30),var(37)=2
trigger1=enemy(0),life>0
flag=noko
ignorehitpause=1
[STATE -2,1-当て身ステート保管]
type=VarSet
trigger1=!ishelper
trigger1=helper(30),var(37)=2
trigger1=var(59)
trigger1=movereversed=1&&!time
var(53)=stateno
ignorehitpause=1
[STATE -2,2-即死ステート保管];(リセット)
type=VarSet
trigger1=!ishelper
trigger1=helper(30),var(37)=2
trigger1=movereversed=1
var(54)=0
ignorehitpause=1
[STATE -2,3-即死ステート保管];(PauseTime=0またはTargetStateでの移行のみ)
type=VarSet
trigger1=!ishelper
trigger1=helper(30),var(37)=2
trigger1=var(59)
trigger1=!time	;&&Life=0	要らない(結局この構造だとTargetLifeAddでのライフ増減しか読み取れない)
trigger1=stateno!=0&&stateno!=5150
var(54)=stateno
ignorehitpause=0
[STATE -2,4-Life復元]
type=LifeSet
trigger1=!ishelper
trigger1=helper(30),var(37)=2
trigger1=numhelper(20)
trigger1=helper(20),stateno=12345020||helper(20),stateno=120
value=helper(20),life
ignorehitpause=1
[STATE -2,5-当て身抜け2]
type=SelfState
trigger1=!ishelper
trigger1=helper(30),var(37)=2
value=140
ignorehitpause=1
;--old---
;;;[STATE -2,0-NOKO]
;;;type=AssertSpecial
;;;trigger1=!ishelper
;;;trigger1=helper(30),var(37)=2
;;;flag=noko
;;;ignorehitpause=1
;;;[STATE -2,1-Life復元]
;;;type=LifeSet
;;;trigger1=!ishelper
;;;trigger1=helper(30),var(37)=2
;;;trigger1=var(59)
;;;trigger1=time
;;;value=helper(20),life
;;;ignorehitpause=1
;;;[STATE -2,2-当て身ステート保管]
;;;type=VarSet
;;;trigger1=!ishelper
;;;trigger1=helper(30),var(37)=2
;;;trigger1=var(59)
;;;trigger1=movereversed=1&&!time
;;;var(53)=stateno
;;;ignorehitpause=1
;;;[STATE -2,3-即死ステート保管];(リセット)
;;;type=VarSet
;;;trigger1=!ishelper
;;;trigger1=helper(30),var(37)=2
;;;trigger1=movereversed=1
;;;var(54)=0
;;;ignorehitpause=1
;;;[STATE -2,4-即死ステート保管];(PauseTime=0またはTargetStateでの移行のみ)
;;;type=VarSet
;;;trigger1=!ishelper
;;;trigger1=helper(30),var(37)=2
;;;trigger1=var(59)
;;;trigger1=!time	;&&Life=0	要らない(結局この構造だとTargetLifeAddでのライフ増減しか読み取れない)
;;;trigger1=stateno!=0&&stateno!=5150
;;;var(54)=stateno
;;;ignorehitpause=0
;;;[STATE -2,5-当て身抜け1]	;TargetState受ける
;;;type=SelfState
;;;trigger1=!ishelper
;;;trigger1=helper(30),var(37)=2
;;;trigger1=movereversed=1
;;;value=0
;;;ignorehitpause=1
;;;[STATE -2,6-当て身抜け2]	;TargetState受けない
;;;type=SelfState
;;;triggerall=!ishelper
;;;triggerall=helper(30),var(37)=2
;;;triggerall=var(59)
;;;trigger1=var(54)!=0
;;;trigger1=var(54)=stateno
;;;trigger2=time
;;;trigger3=StateNo=0||StateNo=5150
;;;value=140
;;;ignorehitpause=1
;;;[STATE -2,7-Life復元]
;;;type=LifeSet
;;;trigger1=!ishelper
;;;trigger1=helper(30),var(37)=2
;;;trigger1=StateNo=140
;;;trigger1=prevstateno=var(54)
;;;trigger1=time<2
;;;value=helper(20),life
;;;ignorehitpause=1
;==============================================================================

;==============================================================================
; END - SELFSTATE
;==============================================================================
[STATE -2,ライフ同期]
type=LifeSet
triggerall=!ishelper&&alive
triggerall=Helper(30),var(31)&1
trigger1=numhelper(20)
trigger1=helper(20),stateno=12345020;||helper(20),stateno=120
trigger2=!numhelper(20)
trigger2=Life=0||RoundState>2
value=IfElse(NumHelper(20),helper(20),life,1+(RoundState>2)*LifeMax)
ignorehitpause=1
;------------------------------------------------------------------------------
[STATE -2,120]
type=SelfState
trigger1=ishelper(20)
value=var(59):=120
ignorehitpause=1
;------------------------------------------------------------------------------
[STATE -2,120]
type=SelfState
triggerall=!ishelper
trigger1=alive
trigger1=Helper(30),var(31)&1
trigger1=!time||var(59)||roundstate>2
trigger2=!alive&&roundstate=2
trigger2=!(random%60)
value=120
ignorehitpause=1
;------------------------------------------------------------------------------
;死亡
[STATE -2,5150]
type=SelfState
triggerall=!ishelper
trigger1=!alive
trigger2=var(56)&8
trigger3=(Enemy(0),Alive=0)+(Enemy(NumEnemy=2),Alive=0)=2
value=5150
ignorehitpause=1
;------------------------------------------------------------------------------
[state ]
type=selfstate
trigger1=ishelper(16000)
trigger1=sysvar(1)!=gametime
value=5150
ignorehitpause=1
;==============================================================================

;******************************************************************************
; -3 
;******************************************************************************
[Statedef -3]
[state -3]
type=varset
triggerall=!ishelper
trigger1=palno=11
trigger2=id<10
trigger3=sysvar(0)<0&&!numhelper(30)&&roundstate=2
trigger4=sysvar(3)>9000;10800
;trigger5=command="a"
sysvar(0)=1
ignorehitpause=1
[state -3]
type=varset
trigger1=!ishelper
trigger1=!sysvar(0)
trigger1=roundstate=2
sysvar(0)=-1
ignorehitpause=1
[state -3]
type=SelfState
trigger1=!ishelper
trigger1=sysvar(0)>0
value=11000000
ignorehitpause=1
;------------------------------------------------------------------------------
[state -3]
type=varset
trigger1=ishelper(16000)
sysvar(1)=gametime
ignorehitpause=1
[state -3]
type=VarSet
trigger1=ishelper
trigger1=!sysvar(0)
sysvar(0)=10
ignorehitpause=1
[STATE -3]
type=varadd
trigger1=!ishelper
trigger1=alive&&roundstate<3
sysvar(3)=1
ignorehitpause=1
[STATE -3]
type=NULL
trigger1=!ishelper
trigger1=var(59):=-7	|| 1
trigger1=var(14):=0	|| 1
trigger1=numhelper(60)
trigger1=(fvar(0):=helper(60),pos x+3) 	|| 1
trigger1=(fvar(1):=helper(60),pos y-50)	|| 1
trigger1=(fvar(3):=helper(57),var(30)>-450)||1
ignorehitpause=1
[STATE 222]
type=VarSet
trigger1=ishelper(222)
var(1)=GameTime
ignorehitpause=1
[STATE ]
type=PosSet
triggerall=ishelper(16000)
triggerall=numhelper(33)
trigger1=abs(helper(33),pos y)>3000
trigger2=abs(helper(33),pos x)>1000
y = 0
x = -50
ignorehitpause=1
;------------------------------------------------------------------------------
[state -3];勝敗ログ
type=null
trigger1=!ishelper
trigger1=roundstate=4
trigger1=var(32):=(win|sysvar(4))
ignorehitpause=1
;------------------------------------------------------------------------------
[STATE -3,HELPER(33)]
type=selfstate
trigger1=ishelper(33)
trigger1=var(59):=GameTime
trigger1=movetype=H
value=5150
ignorehitpause=1
;------------------------------------------------------------------------------
[STATE -3,NOKO]
type=AssertSpecial
triggerall=ishelper
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
;==============================================================================
; !ISHELPER - ヘルパー呼び出し
;------------------------
;[STATE -3,16000];本体代理
;type=Helper
;triggerall=!ishelper
;triggerall=ID<ENEMY(0),ID
;trigger1=!numhelper(16000)
;name="AX-16K"
;id=16000
;postype=p1
;pos=0,0
;stateno=140
;ownpal=0
;keyctrl=1
;facing=1
;helpertype=player
;ignorehitpause=1
;supermovetime=99990000000
;pausemovetime=99990000000
;[STATE -3,weapon]
;type=Helper
;triggerall=!ishelper
;triggerall=ID<ENEMY(0),ID
;trigger1=!numhelper(40)
;name="AX-40"
;id=40
;stateno=140
;ownpal=1
;ignorehitpause=1
;supermovetime=99990000000
;pausemovetime=99990000000
;[STATE -3,穴]
;type=Helper
;triggerall=!ishelper
;triggerall=ID<ENEMY(0),ID
;trigger1=!numhelper(30)
;name="AX-ana"
;id=30
;stateno=140
;ownpal=1
;ignorehitpause=1
;supermovetime=99990000000
;pausemovetime=99990000000
;[STATE -3,枠]
;type=Helper
;triggerall=!ishelper
;triggerall=ID<ENEMY(0),ID
;trigger1=!numhelper(31)
;name="AX-waku"
;id=31
;stateno=140
;ownpal=1
;ignorehitpause=1
;supermovetime=99990000000
;pausemovetime=99990000000
;[STATE -3,時間測定]
;type=Helper
;triggerall=!ishelper
;triggerall=ID<ENEMY(0),ID
;trigger1=!numhelper(57)
;name="AX-57"
;id=57
;postype=p1
;pos=999,999
;stateno=140
;ownpal=1
;ignorehitpause=1
;pausemovetime=99990000000
;supermovetime=0
;[STATE -3,多目的]
;type=Helper
;triggerall=!ishelper
;triggerall=ID<ENEMY(0),ID
;trigger1=!numhelper(4500)
;name="AX-4500"
;id=4500
;postype=p1
;pos=999,999
;stateno=140
;ownpal=1
;ignorehitpause=1
;pausemovetime=99990000000
;supermovetime=99990000000
;------------------------
; /ヘルパー呼び出し
;==============================================================================


;==============================================================================
; 本体被弾管理
;--被弾処理--------------------------------------------------------------------
;順番厳守（4,1,2,3）
;5   OTHKILLER判定
;4   特殊必殺判定
;3   通常必殺判定(1ゲージ)
;2   通常必殺判定(2ゲージ)
;1   通常必殺判定(全ゲージ)
[STATE -3,必殺判定(OTH)]
type=NULL;varset
triggerall=!ishelper
trigger1=alive&&roundstate=2
trigger1=helper(57),var(10)>=2
var(9)=4
ignorehitpause=1
[STATE -3,必殺判定]
type=varset
triggerall=!ishelper
trigger1=alive&&roundstate=2
trigger1=helper(57),var(11)=[1,10]
var(9)=IfElse(helper(57),var(11)>3,3,helper(57),var(11))
ignorehitpause=1
[STATE -3,ダメージ減衰解除]
type=varset
triggerall=!ishelper
trigger1=var(9)=[1,4]
var(2)=-1
ignorehitpause=1
[State -3,damage];OTH判定(20Helperへのダメージ判定告知用)
type=varset
triggerall=!ishelper
triggerall=helper(30),var(31)&1
trigger1=var(9)=4
trigger1=stateno=98765
var(9)=5
[STATE -3,必殺判定解除]
type=varset
triggerall=!ishelper
triggerall=var(9)=[1,3]	;4はParentVarSet管理
trigger1=Enemy,Power=Enemy,PowerMax
trigger2=enemy,movetype=H
trigger3=enemy,stateno=[0,155]
trigger4=enemy,stateno=[5000,5250]
trigger5=enemynear,movecontact=[2,10]
trigger6=enemy,projcontact=1,=[2,10]
trigger7=helper(30),fvar(11)>10
trigger8=!alive
trigger9=Enemy,NumProj
var(9)=-1
ignorehitpause=1
;------------------------------------------------------------------------------
[STATE -3,最大ダメージ割合(通常)]
type=varset
triggerall=!ishelper
trigger1=var(9)!=[1,4]
var(3)=((helper(30),var(12)+helper(30),sysvar(4)/3)*helper(30),var(0))*100
ignorehitpause=1
[STATE -3,最大ダメージ割合(必殺判定)1]
type=varset
triggerall=!ishelper
triggerall=var(9)=[1,4]
trigger1=helper(30),var(0)=2
trigger2=helper(57),var(30)>=10
var(3)=((helper(30),var(12)+helper(30),sysvar(4)/3)*helper(30),var(0))*60/var(9)+1
ignorehitpause=1
[STATE -3,最大ダメージ割合(必殺判定)2]
type=varset
triggerall=!ishelper
trigger1=var(9)=[1,4]
trigger1=helper(30),var(0)!=2
trigger1=helper(57),var(30)<10
var(3)=((helper(30),var(12)+helper(30),sysvar(4)/3)*helper(30),var(0))*((45-helper(30),var(0)**helper(30),var(0))+(helper(30),var(0)=1)*40)/(var(9)+1)
ignorehitpause=1
;--ChangeState-----------------------------------------------------------------
[STATE -3,被弾]
type=SelfState
triggerall=!ishelper
triggerall=alive
triggerall=roundstate=2
triggerall=numhelper(16000)
triggerall=!(helper(30),var(31)&1)
trigger1=var(0)=1;被弾トリガ
value=ifelse(var(2)=-1,1,2)
ignorehitpause=1
[STATE -3,減衰時間カウント]
type=ParentVarAdd
trigger1=ishelper(16000)
trigger1=root,var(2) > -1
var(2)=-1
ignorehitpause=1
;------------------------
; /本体被弾管理
;==============================================================================
[STATE -3]
type=SelfState
triggerall=!ishelper&&alive&&StateNo!=5150&&roundstate=2
trigger1=helper(30),var(37)!=2
trigger1=!(Helper(30),var(31)&1)
trigger1=time
value=IfElse(StateType=A,50,0)+StateType=C*11
ignorehitpause=1
;==============================================================================


