--小野塚小町用ai
--しなうす式/20220710check

require("function_pun_strage.lua")
head_req_list()

function main()
--シード生成、スレッド生成、base_states設定
	set_seedthreadstates()
--キャラ確認
	char_calling()
--ステージが 核融合炉心部 だと超反応モードに
	set_printsabot()

while true do
--スレッド外初期化
	while_top()

--●どちらかが体力無くなったら待機
	if interbattle_condi()==true then
		interbattle_exe()
--▼開幕行動▼
	elseif kaimaku_condi()==true then
		kaimaku_exe()
--▼移動起き上がり
	elseif my_act==97 or my_act==98 then --基本：画面端より遠ざかる。中央では相手から遠ざか…りたいが、設置技警戒のため、相手側に移動起き上がり。
		movedgetup_exe()

--▼簡易受け身▼：攻撃ないし回避いずれの目的であってもリカバリーポイントは限られるが、そういうことはさておき実装したもの
	elseif recovery_condi()==true then
		recovery_exe()

--▼台風になった時、フラグに従って「緋想の剣」を使用
	elseif y==0 and my_act<=10 and card_check(14) and flag_kishitu==1 then
		print("天候フラグＯＮ　⇒　「緋想の剣」使用");
		card_use(14);

--▼台風▼：近接状態からの強引な状況変更を行う行動。スペカなど使用。
	elseif react_rejecttaihu_condi()==true then
		react_rejecttaihu_exe()

--▼起き攻め▼
	elseif setplay_ongetup_condi()==true then
		setplay_ongetup_exe()
--▼ＨＪＣ▼
	--地上HJC
	elseif hjc_ground_condi()==true then
		hjc_ground_exe()
	--空中HJC
	elseif hjc_air_condi()==true then
		hjc_air_exe()

--▼反応行動
--反応：下段
	elseif 	react_lowattack_condi()==true then
		react_lowattack_exe()
--反応：地対空
	elseif react_g2a_condi()==true then
		react_g2a_exe()
--反応：低空飛翔
	elseif react_lowj6d_condi()==true then
		react_lowj6d_exe()
--上空追いかけ
	elseif ueoikake_condi()==true then
		ueoikake_exe()
--霊撃 or 霊撃札
	elseif reigeki_condi()==true then 
		print("拒否行動：霊撃　⇒　可能ならば使用");
		card_use(0)
		
--▼グレイズ：相手行動に対する反射or一定距離内のオブジェクト感知▼
--モーション反応グレイズ
	elseif
	graze_condition_xrange()==true and
	state_nottrueguard()==true and 
	my_airEX>=1 and 
	my_rei>=0 
	then--近距離時のグレイズ。のさばらせておくと、誤結界の原因となる。ガードの硬直間際ならok
		print("check 1 -> graze act X Range");
		graze_action_xrange()
			
--▼ ガード行動：簡易ガードルーチン▼
--▼ ガード反撃、龍魚の羽衣 13
	elseif hagoromo_1st_condi()==true or hagoromo_condi()==true then
		hagoromo_exe()

--回避結界
	elseif kekkai_condi()==true then
		kekkai_exe()

--▼ 宵越しの銭 12
	elseif yoikoshi_1st_condi()==true or yoikoshi_condi()==true then
		yoikoshi_exe()

--▼汎用中下段ガード
--基本は行動に対して後退入れ込み。下段のみ抽出して反応。通常射撃も同じく下段で受ける(けどメンドウだから今回は省き)。フラグを抜けてくるものは別個に対応
	elseif lowattack_aflags_condi()==true then
		guard_backexpectlowattack_exe()
	elseif overheadattack_aflags_condi()==true then
		guard_backoverheadattack_exe()
--下段判定をフィルタ
	elseif lowattack_flaged_condi()==true then
		guard_backexpectlowattack_exe()
--フラグを抜けてくるものをフィルタ
	elseif lowattack_unflaged_condi()==true then
		guard_backexpectlowattack_exe()
--屈状態では低空昇り攻撃には立てない
	elseif notstand_overhead_upjump_condi()==true then
		guard_backexpectlowattack_exe()
--以下、何もフィルタされなかった場合、立ちガード
	elseif guard_pun_condi()==true then
		guard_backoverheadattack_exe()

--[[▼オブジェが至近距離の場合、着地直前にｈｊを仕込む、タッチ＆ゴーグレイズ
	elseif touchandgo_00_condi() then
		touchandgo_00_exe()
--オブジェが至近距離の場合、ガードの前に、離陸
	elseif touchandgo_01_condi() then
		touchandgo_01_exe()
	elseif touchandgo_02_condi() then
		touchandgo_02_exe()
--]]
--オブジェが至近距離の場合、空中から地上へ飛翔　※咲夜：２D：120.0以上、３D：84.9以上必要
	elseif graze_pun_condi()==true then
		graze_pun_exe()
		
--遠距離時のグレイズ
	elseif graze_farground_condi() then
		graze_farground_exe()
	elseif graze_farair_condi() then
		graze_farair_exe()
		
--特定状況におけるガード
	elseif guard_objgimmick_condi()==true then
		guard_backexpectlowattack_exe()
--オブジェが至近距離の場合、ガード:射撃と打撃を重ねられると、しゃがみガードしてしまう。優先順位の変更が必要
	elseif guard_objclosedis_condi()==true then
		guard_backexpectlowattack_exe()
	
--▼起き上がり直後の行動
	elseif move_soonaftergetup_condi()==true then
		move_soonaftergetup_exe()

--▼コンボ▼
--[[▼固め▼
2A
	> 2A：ｎ回ガードさせる基本固め。距離を調整して、そのあとに続く固めの択を広げる。
	> 6A：硬直や判定的にこれを多用する。ただし、下段なのでそのままでは使いづらい。
		> 6C
		> skill
	> 3A：近距離の判定が貧弱なのであまり狙えない。全体が長く、硬直待ちも難しい。しゃがみ相手に確定で振る方向で。
		> 6C
		> skill
	> 5B：しゃがみ相手でなければ通る。霊力削りが小さいため、連続ガード前提の固めパーツ。ｈｊｃまでの時間を稼ぐ。
		> 7hjc
		> 8hjc
		> 9hjc
	> 6C：増長。当てた場合、ｈｊｃ＞ｊ２ｃなどの更なる増長につなげる。
	> skill：人間には見てから判断は難しいので考えなくていい。なお、コンボならB死出の風がある。
	> 4：距離がある程度離れてからの択。遠A（L5A）狙い。
		> L5A
		> 6A
	> 9HJ：増長。生当て狙い。
		> J2C
	> DA：スペカ削りや無間前提振り。一応、死出の風やお迎え体験版があれば振っていける。舟はまあネタ枠で可。
		> skill：
		> spell
	> DB：固めなのでグレイズは勘案しない。誤ガード狙いとスペカ前提
		> spell
--]]

--AA<A:ルートが固定になるため使用しない
--2A<2A
	elseif enemy_act>=150 and enemy_act<180 and 
	my_act==303 and
	my_hitstop<=3 and my_hitstop>=2 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >2A")
		key_event2(ACT_A,ACT_DOWN);
--6A<S5A,L5A,2A,4A
	elseif enemy_act>=150 and enemy_act<180 and 
	(my_act==300 or my_act==301 or my_act==303 or my_act==330) and
	my_hitstop<=3 and my_hitstop>=2 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >6A")
		key_event2(ACT_A,front);
--3A<S5A,L5A,2A,4A
	elseif enemy_act>=150 and enemy_act<180 and 
	(my_act==300 or my_act==301 or my_act==303 or my_act==330) and
	my_hitstop<=3 and my_hitstop>=2 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >3A")
		key_event2(ACT_A,d_front);
--B<S5A,L5A,2A,4A,AA
	elseif enemy_act>=150 and enemy_act<180 and 
	(my_act==300 or my_act==301 or my_act==303 or my_act==320 or my_act==330) and
	my_hitstop<=3 and my_hitstop>=2 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >B")
		key_event(ACT_B);
--6C<S5A,L5A,2A,4A,AA,B
	elseif enemy_act>=150 and enemy_act<180 and 
	(
		(
			(my_act==300 or my_act==301 or my_act==303 or my_act==320 or my_act==330) and my_hitstop<=3 and my_hitstop>=2
		) or
		(
			my_act==400 and enemy_hitstop<=3 and enemy_hitstop>=1 and
			ey==0 and dis<300
		)
	)
	and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >6C")
		key_event2(ACT_B,d_front);
--2C<S5A,L5A,2A,4A,AA,B
	elseif enemy_act>=150 and enemy_act<180 and 
	(
		(
			(my_act==300 or my_act==301 or my_act==303 or my_act==320 or my_act==330) and my_hitstop<=3 and my_hitstop>=2
		) or
		(
			my_act==400 and enemy_hitstop<=3 and enemy_hitstop>=1 and
			ey==0 and dis<300
		)
	) and
	(
		search_state_obj(826,222,260,260,0,900) >0 or 
		search_state_obj(827,223,260,260,0,900) >0 or 
		search_state_obj(855,223,260,260,0,900) >0
	)	and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >2C")
		key_event2(ACT_B,ACT_DOWN);
--J5A<J5Atag,J6Atag,J2Atag,JBac,J6Bac,J6Cac
--J6A<J5A,J6Atag,J2Atag,JBac,J6Bac,J6Cac
	elseif enemy_act>=150 and enemy_act<180 and 
	my_act==306 and
	my_hitstop<=3 and my_hitstop>=2 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >J6A")
		key_event2(ACT_A,front);
--J8A<J5A,J6Atag,J2Atag,JBac,J6Bac,J6Cac
	elseif enemy_act>=150 and enemy_act<180 and 
	my_act==306 and
	my_hitstop<=3 and my_hitstop>=2 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >J8A")
		key_event2(ACT_A,ACT_UP);
--J5B<J5Atc,J6Atc,J2Atc,JBac,J6Bac,J6Cac
	elseif enemy_act>=150 and enemy_act<180 and 
	(my_act==306 or my_act==307 or my_act==308 or my_act==309) and
	my_hitstop<=3 and my_hitstop>=2 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >J5B")
		key_event(ACT_B);
--J6B<J5Atc,J6Atc,J2Atc,JBac,J6Bac,J6Cac
	elseif enemy_act>=150 and enemy_act<180 and 
	(my_act==306 or my_act==307 or my_act==308) and
	my_hitstop<=3 and my_hitstop>=2 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >J6B")
		key_event2(ACT_B,front);
--J2B<J5Atc,J6Atc,J2Atc,JBac,J6Bac,J6Cac
	elseif enemy_act>=150 and enemy_act<180 and 
	(my_act==306 or my_act==307 or my_act==308) and
	my_hitstop<=3 and my_hitstop>=2 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >J2B")
		key_event2(ACT_B,ACT_DOWN);
--J6C<J5Atc,J6Atc,J2Atc,JBac,J6Bac,J6Cac
	elseif enemy_act>=150 and enemy_act<180 and 
	(my_act==306 or my_act==307 or my_act==308 or my_act==309 or my_act==404 or my_act==405 or my_act==406) and
	my_hitstop<=3 and my_hitstop>=1 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >J6C")
		key_event2(ACT_C,front);
--J2C<J5Atc,J6Atc,J2Atc,JBac,J6Bac,J6Cac
	elseif enemy_act>=150 and enemy_act<180 and 
	(my_act==306 or my_act==307 or my_act==308 or my_act==309 or my_act==404 or my_act==405 or my_act==406) and
	my_hitstop<=3 and my_hitstop>=1 and
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)>=2 then
		print("LOCK : >J2C")
		key_event2(ACT_C,ACT_DOWN);
--死出の風<S5A,L5A,2A,4A,DA,B,6C,2C
--お迎え体験版<S5A,L5A,2A,4A,DA,B,6C,2C
--霊符「何処にでもいる浮遊霊」<S5A,L5A,2A,4A,DA,B,6C,2C
--地獄「無間の狭間」<S5A,L5A,2A,4A,DA

--▼攻撃▼

--▼spell card▼

--▼cost1

--舟符「河の流れのように」
	--Ground
	elseif card_check(200)==true and
		my_spell_more(500) and
		dis<200 and
		y==0 and
		ey<100 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
			print("舟符「河の流れのように」");
			for i=1,10 do
				card_use(200);
				yield()
			end

--霊符「何処にでもいる浮遊霊」
	--Ground
	elseif card_check(202)==true and
		my_spell_more(500) and
		dis<200 and
		y==0 and
		ey<200 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
			print("霊符「何処にでもいる浮遊霊」");
			for i=1,10 do
				card_use(202);
				yield()
			end

--▼cost3

--死歌「八重霧の渡し」
	--Ground
	elseif card_check(203)==true and
		my_spell_more(1500) and
		--dis<200 and
		y==0 and
		--ey<200 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		--is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
			print("死歌「八重霧の渡し」");
			for i=1,10 do
				card_use(203);
				yield()
			end

--恨符「未練がましい緊縛霊」
	--Ground
	elseif card_check(205)==true and
		my_spell_more(1500) and
		--dis<600 and
		y==0 and
		--ey<100 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		--is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
			print("恨符「未練がましい緊縛霊」");
			for i=1,10 do
				card_use(205);
				yield()
			end

--地獄「無間の狭間」
	--Ground
	elseif card_check(211)==true and
		my_spell_more(1500) and
		dis<200 and
		y==0 and
		ey<100 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
			print("地獄「無間の狭間」");
			for i=1,10 do
				card_use(211);
				yield()
			end

--▼cost4

--死符「死者選別の鎌」
	--Ground
	elseif card_check(206)==true and
		my_spell_more(2000) and
		--dis<600 and
		y==0 and
		--ey<100 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		--is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
			print("死符「死者選別の鎌」");
			for i=1,10 do
				card_use(206);
				yield()
			end

--魂符「生魂流離の鎌」
	--Ground
	elseif card_check(207)==true and
		my_spell_more(2000) and
		dis<200 and
		y==0 and
		ey<100 and
		my_frontside>600 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
			print("魂符「生魂流離の鎌」");
			for i=1,10 do
				card_use(207);
				yield()
			end

--▼cost5

--薄命「余命幾許も無し」
	--Ground
	elseif card_check(201)==true and
		my_spell_more(2500) and
		dis<200 and
		y==0 and
		ey<100 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
			print("薄命「余命幾許も無し」");
			for i=1,10 do
				card_use(201);
				yield()
			end

--換命「不惜身命、可惜身命」
	--Ground
	elseif card_check(204)==true and
		my_spell_more(2500) and
		dis<200 and
		y==0 and
		ey<100 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		--enemy_obj_range_in(150,60)==false) and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
			print("換命「不惜身命、可惜身命」");
			for i=1,10 do
				card_use(204);
				yield()
			end


--▼skill card▼

--▼スキル236

--迷わず生きた人霊100

	elseif get_skill_lv(0,0)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("迷わず生きた人霊");
			lvr236(ACT_B);
			
	elseif get_skill_lv(0,0)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("迷わず生きた人霊");
			lvr236(ACT_C);
			
	elseif card_check(100)==true and my_rei>=400 and
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("迷わず生きた人霊");
			for i=1,10 do
				card_use(100);
				yield()
			end


--死神の大鎌104
--ground
	elseif get_skill_lv(0,4)>=0 and my_rei>=400 and 
		dis2>270 and dis2<330 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("死神の大鎌B");
			lvr236(ACT_B);
			
	elseif get_skill_lv(0,4)>=0 and my_rei>=400 and 
		dis2>770 and dis2<870 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("死神の大鎌");
			lvr236(ACT_C);
			
	elseif card_check(104)==true and my_rei>=400 and
		dis2>770 and dis2<870 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("死神の大鎌");
			for i=1,10 do
				card_use(104);
				yield()
			end
--air
	elseif get_skill_lv(0,4)>=0 and my_rei>=400 and 
		dis2>340 and dis2<400 and
		y>0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("死神の大鎌");
			lvr236(ACT_B);
			
	elseif get_skill_lv(0,4)>=0 and my_rei>=400 and 
		dis2>340 and dis2<400 and
		y>0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("死神の大鎌");
			lvr236(ACT_C);
			
	elseif card_check(104)==true and my_rei>=400 and
		dis2>340 and dis2<400 and
		y>0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("死神の大鎌");
			for i=1,10 do
				card_use(104);
				yield()
			end
			
--通りすがりの人霊108

	elseif get_skill_lv(0,8)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("通りすがりの人霊");
			lvr236(ACT_B);
			
	elseif get_skill_lv(0,8)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("通りすがりの人霊");
			lvr236(ACT_C);
			
	elseif card_check(108)==true and my_rei>=400 and
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("通りすがりの人霊");
			for i=1,10 do
				card_use(108);
				yield()
			end
			
--▼スキル623

--浮かばれない地縛霊101

	elseif get_skill_lv(0,1)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("浮かばれない地縛霊");
			lvr623(ACT_B);
			
	elseif get_skill_lv(0,1)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("浮かばれない地縛霊");
			lvr623(ACT_C);
			
	elseif card_check(101)==true and my_rei>=400 and
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("浮かばれない地縛霊");
			for i=1,10 do
				card_use(101);
				yield()
			end
			
--死出の風105

	elseif get_skill_lv(0,5)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("死出の風");
			lvr623(ACT_B);
			
	elseif get_skill_lv(0,5)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("死出の風");
			lvr623(ACT_C);
			
	elseif card_check(105)==true and my_rei>=400 and
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("死出の風");
			for i=1,10 do
				card_use(105);
				yield()
			end
			
--三途の舟109

	elseif get_skill_lv(0,9)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("三途の舟");
			lvr623(ACT_B);
			
	elseif get_skill_lv(0,9)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("三途の舟");
			lvr623(ACT_C);
			
	elseif card_check(109)==true and my_rei>=400 and
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("三途の舟");
			for i=1,10 do
				card_use(109);
				yield()
			end

--▼スキル22

--脱魂の儀102
--ground
	elseif get_skill_lv(0,2)>=0 and my_rei>=400 and 
		dis2>640 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(1280)==1 then
			print("脱魂の儀");
			lvr22(ACT_B);
			
	elseif get_skill_lv(0,2)>=0 and my_rei>=400 and 
		dis2>640 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(1280)==1 then
			print("脱魂の儀");
			lvr22(ACT_C);
			
	elseif card_check(102)==true and my_rei>=400 and
		dis2>640 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(1280)==1 then
			print("脱魂の儀");
			for i=1,10 do
				card_use(102);
				yield()
			end
--air
	elseif get_skill_lv(0,2)>=0 and my_rei>=400 and 
		dis2>640 and
		y>0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(1280)==1 then
			print("脱魂の儀");
			lvr22(ACT_B);
			
	elseif get_skill_lv(0,2)>=0 and my_rei>=400 and 
		dis2>640 and
		y>0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(1280)==1 then
			print("脱魂の儀");
			lvr22(ACT_C);
			
	elseif card_check(102)==true and my_rei>=400 and
		dis2>640 and
		y>0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(1280)==1 then
			print("脱魂の儀");
			for i=1,10 do
				card_use(102);
				yield()
			end
			
--無間の道106

	elseif get_skill_lv(0,6)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(640)==1 then
			print("無間の道");
			lvr22(ACT_B);
			
	elseif get_skill_lv(0,6)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(640)==1 then
			print("無間の道");
			lvr22(ACT_C);
			
	elseif card_check(106)==true and my_rei>=400 and
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(640)==1 then
			print("無間の道");
			for i=1,10 do
				card_use(106);
				yield()
			end
			
--お迎え体験版110

	elseif get_skill_lv(0,10)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("お迎え体験版");
			lvr22(ACT_B);
			
	elseif get_skill_lv(0,10)>=0 and my_rei>=400 and 
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("お迎え体験版");
			lvr22(ACT_C);
			
	elseif card_check(110)==true and my_rei>=400 and
		dis>0 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("お迎え体験版");
			for i=1,10 do
				card_use(110);
				yield()
			end

--▼スキル214

--怠惰に生きた浮遊霊103

	elseif get_skill_lv(0,3)>=0 and my_rei>=400 and 
		dis>340 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("怠惰に生きた浮遊霊");
			lvr214(ACT_B);
			
	elseif get_skill_lv(0,3)>=0 and my_rei>=400 and 
		dis>340 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("怠惰に生きた浮遊霊");
			lvr214(ACT_C);
			
	elseif card_check(103)==true and my_rei>=400 and
		dis>340 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("怠惰に生きた浮遊霊");
			for i=1,10 do
				card_use(103);
				yield()
			end
			
--寂しがり屋の緊縛霊107

	elseif get_skill_lv(0,7)>=0 and my_rei>=400 and 
		dis>340 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("寂しがり屋の緊縛霊");
			lvr214(ACT_B);
			
	elseif get_skill_lv(0,7)>=0 and my_rei>=400 and 
		dis>340 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("寂しがり屋の緊縛霊");
			lvr214(ACT_C);
			
	elseif card_check(107)==true and my_rei>=400 and
		dis>340 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("寂しがり屋の緊縛霊");
			for i=1,10 do
				card_use(107);
				yield()
			end
			
--離魂の鎌111

	elseif get_skill_lv(0,11)>=0 and my_rei>=400 and 
		dis>340 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("離魂の鎌");
			lvr214(ACT_B);
			
	elseif get_skill_lv(0,11)>=0 and my_rei>=400 and 
		dis>340 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("離魂の鎌");
			lvr214(ACT_C);
			
	elseif card_check(111)==true and my_rei>=400 and
		dis>340 and
		y==0 and
		not(my_act>=50 and my_act<180) and my_act<600 and 
		get_fflags(0,32)==true and
		get_fflags(0,8)==false and get_fflags(1,8)==false and 
		enemy_obj_range_in(150,60)==false and 
		is_dir_front==true and 
		subs_count>=530 and nega_count ~= 1 and math.random(160)==1 then
			print("離魂の鎌");
			for i=1,10 do
				card_use(111);
				yield()
			end

--▼空中打撃▼

--J5A:
	elseif	y>0 and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and
	is_dir_front==true and
	subs_count>=530 and nega_count ~= 1 and math.random(2)==1 and
	(y+my_yspeed*11+(11*(10*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*11		<=	120+20 	and
				--(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*11		>=	10-20 	and
				(ey+enemy_yspeed*11+(11*(10*e_gs))/2)	-	(y+my_yspeed*11+(11*(10*m_gs))/2)	<=	80-40 		and --自ヒットボックスの上端を、相手ヒットボックスの下端に当てた高さ
				(ey+enemy_yspeed*11+(11*(10*e_gs))/2)	-	(y+my_yspeed*11+(11*(10*m_gs))/2)	>=	40-160 	then  --自ヒットボックスの下端を、相手ヒットボックスの上端に当てた高さ
					print("J5A");
					key_event(ACT_A);
					
--J6A
	elseif	y>0 and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and
	is_dir_front==true and
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and
	(y+my_yspeed*16+(16*(15*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*16		<=	270+20 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*16		>=	60-20 	and
				(ey+enemy_yspeed*16+(16*(15*e_gs))/2)	-	(y+my_yspeed*16+(16*(15*m_gs))/2)	<=	140-40	and
				(ey+enemy_yspeed*16+(16*(15*e_gs))/2)	-	(y+my_yspeed*16+(16*(15*m_gs))/2)	>=	60-160 	then
					print("J6A");
					key_event2(ACT_A,front);
							
--J2A
	elseif	y>0 and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and
	is_dir_front==true and
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and
	(y+my_yspeed*19+(19*(18*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*19		<=	140+20 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*19		>=	-190-20 	and
				(ey+enemy_yspeed*19+(19*(18*e_gs))/2)	-	(y+my_yspeed*19+(19*(18*m_gs))/2)	<=	30-40	and
				(ey+enemy_yspeed*19+(19*(18*e_gs))/2)	-	(y+my_yspeed*19+(19*(18*m_gs))/2)	>=	-50-160 	then
					print("J2A");
					key_event(ACT_UP)
					key_event2(ACT_A,ACT_DOWN);

--[[J8A:
	elseif	y>0 and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and
	is_dir_front==true and
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and
	(y+my_yspeed*11+(11*(10*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX*11+2*2+enemy_xspeedEX*13)*1		<=	120+20 	and
				(ex-x)*my_dir-(my_xspeedEX*11+2*2+enemy_xspeedEX*13)*1		>=	-60-20 	and
				(ey+enemy_yspeed*13+(13*(12*e_gs))/2)	-	(y+my_yspeed*11+(11*(10*m_gs))/2)+15*2	<=	290-40		and
				(ey+enemy_yspeed*13+(13*(12*e_gs))/2)	-	(y+my_yspeed*11+(11*(10*m_gs))/2)+15*2	>=	95-160 	then
					print("J8A");
					key_event2(ACT_A,ACT_UP); --]]

--▼対空行動

--対空9HJ>J5A:
--j/hj攻撃不能時間:6f
	elseif y==0 and 
	(ey>0 or --空中か
		(
			(enemy_char~=19 and (enemy_act==0 or (enemy_act>=5 and enemy_act<=10) or (enemy_act>=150 and enemy_act<=153) or (enemy_act>=159 and enemy_act<=162)) --諏訪子以外の立ち状態か
			) or
			(enemy_char==19 and ((enemy_act>=1 and enemy_act<=3) or (enemy_act>=154 and enemy_act<=157) or (enemy_act>=163 and enemy_act<=166)) --諏訪子のしゃがみ状態
			)
		)
	) and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and
	is_dir_front==true and
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and 
				(ex-x)*my_dir	-	(10*11+enemy_xspeedEX*17)		<=	120+20 	and --自機のhj時におけるx軸速度*発生
				(ex-x)*my_dir	-	(10*11+enemy_xspeedEX*17)		>=	60-20 	and
				(ey+enemy_yspeed*17+(17*(16*e_gs))/2)	-	(y+17*11+(11*(10*-0.75))/2)	<=	180-40 		and --自機のhj時におけるy軸速度*発生(hj時の落下加速度を17としている)
				(ey+enemy_yspeed*17+(17*(16*e_gs))/2)	-	(y+17*11+(11*(10*-0.75))/2)	>=	120-160 	then --hj時の落下加速度を-0.75としている
					print("AA:9HJ>J5A");
					key_event2(ACT_D,u_front)
					wait(3)
					key_event(ACT_A);
					wait(3)
					
--対空8HJ>J5A:
	elseif y==0 and 
	(ey>0 or --空中か
		(
			(enemy_char~=19 and (enemy_act==0 or (enemy_act>=5 and enemy_act<=10) or (enemy_act>=150 and enemy_act<=153) or (enemy_act>=159 and enemy_act<=162)) --諏訪子以外の立ち状態か
			) or
			(enemy_char==19 and ((enemy_act>=1 and enemy_act<=3) or (enemy_act>=154 and enemy_act<=157) or (enemy_act>=163 and enemy_act<=166)) --諏訪子のしゃがみ状態
			)
		)
	) and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and
	is_dir_front==true and
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and 
				(ex-x)*my_dir	-	(enemy_xspeedEX*17)		<=	120+20 	and --自機のhj時におけるx軸速度*発生
				(ex-x)*my_dir	-	(enemy_xspeedEX*17)		>=	60-20 	and
				(ey+enemy_yspeed*17+(17*(16*e_gs))/2)	-	(y+20*11+(11*(10*-0.75))/2)	<=	180-40 		and --自機のhj時におけるy軸速度*発生(hj時のy軸速度を20としている)
				(ey+enemy_yspeed*17+(17*(16*e_gs))/2)	-	(y+20*11+(11*(10*-0.75))/2)	>=	120-160 	then --hj時の落下加速度を-0.75としている
					print("AA:9HJ>J5A");
					key_event2(ACT_D,u_front)
					wait(3)
					key_event(ACT_A);
					wait(3)
					
--対空5A:
	elseif y==0 and 
	dis<120 and
	ey>0 and
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and
	is_dir_front==true and
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and 
				(ex-x)*my_dir	-	(enemy_xspeedEX*10)				<=	120+20		and
				(ex-x)*my_dir	-	(enemy_xspeedEX*10)				>=	120-20		and
				(ey+enemy_yspeed*10+(10*(9*e_gs))/2)			<=	210-40			and
				(ey+enemy_yspeed*10+(10*(9*e_gs))/2)			>=	210+160	then
					print("AA:S5A");
					key_event(ACT_A);
		
--▼刻み▼
		
--刻み2Ａ
	elseif (dis<=120 or (dis<=150 and my_xspeed>0)) and 
	my_act==303 and ey==0 and 
	my_hitstop<=3 and my_hitstop>=2 and 
	enemy_obj_range_in(150,60)==false and 
	(
		(enemy_act>=50 and enemy_act<=89 and math.random(1)<=1) or
		(enemy_act>=143 and enemy_act<=166 and math.random(3)<=2)
	) and 
	subs_count>=530 and nega_count ~= 1 then
		print("刻み2Ａ");
		key_event2(ACT_A,ACT_DOWN);
		wait(5);
		
--▼通常技/Arts▼

--J2Ch：高空下方から隙を見て
--J2C：下方
	elseif my_rei>=400 and my_air==0 and dis<160 and
	y>50 and ey-y<=200  and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		print("J2C");
		key_event2(ACT_C,ACT_DOWN);
		key_event(ACT_UP)
		wait(10)
--J6Ch：正面中距離以内
--J6C：正面中距離以内
	elseif my_rei>=400 and my_air==0 and dis<240 and dis_y<200 and
	y>50 and ey+80<=dis/2 and
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		print("J6C");
		key_event2(ACT_C,front);
--JC ：中距離中空以遠から。C射objは一つなのに注意
	elseif my_rei>=400 and my_air==0 and dis>240 and
	y>100 and ey-y<=0 and
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		print("JC");
		key_reset();
		key_event(ACT_C);
--J2B：正面から下方向け。たまに撃つ
	elseif my_rei>=400 and my_air==0 and dis>120 and dis<=300 and
	y>100 and ey-y<=dis/3 and ey-y>=-dis and
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		print("J2B");
		key_event2(ACT_B,ACT_DOWN);
		key_event(ACT_UP)
		wait(10)
--J6B：正面
	elseif my_rei>=400 and my_air==0 and dis>120 and dis<=300 and dis_y<80 and
	y>100 and
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		print("J6B");
		key_reset();
		key_event(ACT_B);
--J5B：あんまり使われない
--2C：起爆。使っているところをみなくなった。ある程度以上の専用構築が必要
--赤魂残滓、青魂残滓：act826-img222、スキル青魂：act827-img223、スペカ青魂：act855-img223
	elseif my_rei>=400 and y==0 and
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and
	--is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and 
	my_obj_n>0 and
	(
		search_state_obj(826,222,200,200,0,900) >0 or 
		search_state_obj(827,223,200,200,0,900) >0 or 
		search_state_obj(855,223,200,200,0,900) >0
	) then
		print("2C");
		key_event2(ACT_C,ACT_DOWN);
		key_event(ACT_UP);
		wait(10)
--6C：素振りに向かない。ガード前提。発生と同時にヒットさせる距離感で。
	elseif my_rei>=400 and dis>340 and
	y==0 and ey+80<=dis/2 and
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("6C");
		key_event2(ACT_C,front);
--C：素撃ちに向かない。低速。中強度射撃。
	elseif my_rei>=400 and dis>480 and
	y==0 and ey+80<=dis/2 and
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(8)==1 then
		print("6C");
		key_event2(ACT_C,front);
--DC：CH時の追撃か。差し込みで見かけることは少ない
--DB：人によっては見かける
--DA：対空拾いに間に合わない場合か。普段は見かけない
--2Bh：
--2B：素撃ち可。ほぼ直情の相手のみ。
	elseif my_rei>=400 and y==0 and
	dis<150 and ey>200 and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("2B");
		key_event2(ACT_B,ACT_DOWN);
		key_event(ACT_UP);
		wait(10)
--6Bh：
--6B：素撃ち可。中距離以上。正面から上方へ向かって順次別角度に扇状に打ち出される。
	elseif my_rei>=400 and dis>300 and 
	y==0 and ey-y+80<=dis/3 and
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("6B");
		key_reset();
		key_event2(ACT_B,front);
--5Bh
--5B：素撃ち可。中距離以内。正面から下方へ向かって順次別角度に扇状に打ち出される。
	elseif my_rei>=400 and dis>120 and dis<=300 and 
	y==0 and ey==0 and
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("5Ｂ");
		key_reset();
		key_event(ACT_B);
--6Ah
--6A：下段。素振り向き。遠Aと対にして使う。
	elseif dis>120 and 
	dis<=(enemy_xspeedEX)*16+240 and
	y==0 and 
	ey<100 and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("6A");
		key_reset();
		key_event2(ACT_A,front);
--3Ah
--3A：下段。素振りに向かない。コンボや固め用
--遠A：中段。素振り向き。相手の近Aや２Aを積極的に使えないため、後退からこれを使用する機会が多い。ただし、相手の出方次第ではある。
	elseif dis>120 and 
	dis<=(enemy_xspeedEX)*16+240 and
	y==0 and 
	ey<100 and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	--get_key_stat(ACT_DOWN)==0 and
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("L5A");
		key_reset();
		key_event(ACT_A);
--近A：上段。素振りに向かない。グレイズからの差し返しや画面端でのお手玉など、特定状況用。
	elseif dis<=120 and 
	dis<=120+(enemy_xspeedEX)*10 and
	y==0 and 
	ey==0 and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	--get_key_stat(ACT_DOWN)==0 and
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("S5A");
		key_reset();
		key_event(ACT_A);
--4A：高速で突っ込んでくる相手を地対空で迎撃する用途くらいしか思いつかない。
--2A：これ自体は優秀だが、いかんせんダッシュが遅いため、頻繁には使う機会に恵まれない
	elseif dis<=120+(enemy_xspeedEX)*9 and
	y==0 and ey==0 and 
	not(my_act>=50 and my_act<180) and my_act<600 and 
	get_fflags(0,32)==true and
	get_fflags(0,8)==false and get_fflags(1,8)==false and 
	enemy_obj_range_in(150,60)==false and 
	--get_key_stat(ACT_DOWN)==0 and
	is_dir_front==true and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("2A");
		key_reset();
		key_event2(ACT_A,ACT_DOWN);

--]]
--中距離以上からの８ｈｊ
	elseif move_8hjattakeovermidrange_condi()==true then
		print("中距離以上で８ＨＪ");
		key_event2(ACT_D,ACT_UP);
--中距離からのダッシュ
	elseif move_6dattakeovermidrange_condi()==true then
		print("ダッシュ接近");
		key_event2(ACT_D,front);
--低空飛翔で接近
	elseif move_approachbylowflaying_condi()==true then
		move_approachbylowflaying_exe()
--８８３飛翔
	elseif move_approachby883d_condi()==true then
		move_approachby883d_exe()
--▼ 終端運動
--▼ 相手上空へ飛び上がった際の処理
	elseif move_attakeoverhead_condi()==true then
		move_attakeoverhead_exe()
--▼ 終端機動
	--▼ 対台風時
	elseif move_terminationtaihu_condi()==true then
		move_terminationtaihu_exe()
	--▼ 終端機動1
	--台風じゃない時だが…
	elseif move_termination1_condi()==true then
		move_termination1_exe()
	--▼ 終端機動2
	--ただ動く事で自律性を錯覚させる事が目的の機動。静止やラインの設定に大きな根拠はない。
	--霊力が一定の評価を下回った場合、実行しない。
	elseif move_termination2_condi()==true then
		move_termination2_exe()
	end
	
	yield()
end
end