--十六夜咲夜用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()

--▼コンボ▼

--簡易スペカコンボ
--
	elseif card_check(203)==true and my_spell_more(2000) and (my_act==304 or my_act==307 or my_act==308 or my_act==418) and ((enemy_act>=50 and enemy_act<=89)or(enemy_act>=143 and enemy_act<=145)) and my_hitstop<=3 and my_hitstop>=0 and my_hitstop==enemy_hitstop then
		print("簡易コンボ：スペルカード　幻葬「夜霧の幻影殺人鬼」");
		card_use(203);
--
	elseif card_check(205)==true and my_spell_more(2000) and 
	(my_act==302 or my_act==305 or my_act==408 or my_act==418) and 
	((enemy_act>=50 and enemy_act<=89)or(enemy_act>=143 and enemy_act<=145)) and 
	my_hitstop<=3 and my_hitstop>=0 and my_hitstop==enemy_hitstop then
		print("簡易コンボ：スペルカード　傷魂「ソウルスカルプチュア」");
		card_use(205);
--
	elseif card_check(207)==true and my_spell_more(1000) and 
	(my_act==304 or my_act==305 or my_act==408 or my_act==418) and 
	((enemy_act>=50 and enemy_act<=89)or(enemy_act>=143 and enemy_act<=166)) and 
	my_hitstop<=3 and my_hitstop>=0 and my_hitstop==enemy_hitstop then
		print("簡易コンボ：スペルカード　奇術「エターナルミーク」");
		card_use(207);
--
	elseif card_check(208)==true and my_spell_more(1500) and (my_act==305 or my_act==408 or my_act==418) and ((enemy_act>=50 and enemy_act<=89)or(enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=0 and my_hitstop==enemy_hitstop then
		print("簡易コンボ：スペルカード　速符「ルミネスリコシェ」");
		card_use(208);
--
	elseif card_check(212)==true and my_spell_more(1500) and (my_act==408 and my_allframe>=23) and ((enemy_act>=50 and enemy_act<=89)or(enemy_act>=143 and enemy_act<=145)) and my_hitstop<=3 and my_hitstop>=0 and my_hitstop==enemy_hitstop then
		print("簡易コンボ：スペルカード　時計「ルナダイアル」");
		card_use(212);
--3A>クロース
	elseif my_act==304 and my_allframe>=17 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=2 and my_hitstop>=1 and my_limit<100 and my_rei>=200 and math.random(3)==1 then
		print("3A>クロース");
		wait(15);
		lvr623(ACT_B)

--クロース>2B
	elseif my_act==500 and ey==0 and is_dir_front==true and math.random(3)<=2 then
		print("クロース＞2B");
		key_event2(ACT_B,ACT_DOWN);
--遠A>6A
	elseif my_act==301 and ey==0 and my_hitstop<=3 and my_hitstop>=1 and my_hitstop==enemy_hitstop and is_dir_front==true and math.random(3)<=2 then
		print("遠A＞6A");
		key_event2(ACT_A,front);
--遠A>3A
--	elseif my_act==301 and my_hitstop<=3 and my_hitstop>=1 and my_hitstop==enemy_hitstop and is_dir_front==true then
--		print("遠A＞3A");
--		key_event2(ACT_A,d_front);
--6A>2B
	elseif my_act==302 and my_hitstop<=3 and my_hitstop>=1 and my_hitstop==enemy_hitstop and is_dir_front==true then
		print("6Ａ＞2B");
		key_event2(ACT_B,ACT_DOWN);
--A>2B
	elseif ey>0 and (my_act==300 or my_act==330) and my_hitstop<=3 and my_hitstop>=1 and my_hitstop==enemy_hitstop and is_dir_front==true then
		print("コンボ：Ａ＞2B");
		key_event2(ACT_B,ACT_DOWN);
--A>AA
	elseif my_act==300 and dis<=100 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=1 and my_limit<100 then
		print("A>AA",dis);
		key_event(ACT_A);
--AA>A
		elseif my_act==320 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and not(enemy_act>=70 and enemy_act<=78) and my_hitstop<=2 and my_hitstop>=1 and math.random(5)==1 then
			print("AA>A",dis);
			key_event(ACT_A);
	--AAA>6C
			elseif my_act==321 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and not(enemy_act>=70 and enemy_act<=78) and my_hitstop<=2 and my_hitstop>=1 and math.random(10)==1 then
				print("AAA>6C",dis);
				key_event2(ACT_C,front);
	--AAA>B
			elseif my_act==321 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and not(enemy_act>=70 and enemy_act<=78) and my_hitstop<=2 and my_hitstop>=1 and math.random(5)==1 then
				print("AAA>B",dis);
				key_event(ACT_B);
	--AAA>A
			elseif my_act==321 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and not(enemy_act>=70 and enemy_act<=78) and my_hitstop<=2 and my_hitstop>=1 and math.random(10)==1 then
				print("AAA>A",dis);
				key_event(ACT_A);
--AA>2B
		elseif dis<180 and my_act==320 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and not(enemy_act>=70 and enemy_act<=78) and my_hitstop<=2 and my_hitstop>=1 and math.random(5)==1 then
			print("AA>2B",dis);
			key_event2(ACT_B,ACT_DOWN);
			wait(12)
--2B/B/6C>9hjc
			elseif (my_act==402 or my_act==400 or my_act==411) and ey>0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) then
				print("2B>8hjc",dis);
				key_on(ACT_UP);
--2B/B/6C>9hjc
			elseif (my_act==402 or my_act==400 or my_act==411) and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) then
				print("2B>9hjc",dis);
				key_on(u_front);
	--9hjc>J2A
					elseif my_act==209 and y>0 and y<40 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_limit<100 and math.random(10)==1 then
						print("9hjc>J2A",dis);
						yield();
						key_event2(ACT_A,ACT_DOWN);
	--9hjc>J2B
					elseif dis<180 and my_act==209 and y>0 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_limit<100 then
						print("9hjc>J2B",dis);
						yield();
						key_event2(ACT_B,ACT_DOWN);
						wait(12)
						if math.random(10)==1 then
							lvr623(ACT_B)
						end
--J2B>3飛翔
					elseif my_act==406 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) then
						print("J2B>3飛翔",dis);
						key_resetEX();
						key_event2(ACT_D,d_front);
						key_on(u_front);
--3飛翔>JA
						elseif my_act==214 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_limit<100 then
							print("3飛翔>JA",dis);
							key_resetEX();
							key_event(ACT_A);
--JA>(着地)A
							elseif y==0 and ey==0 and dis<=140 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_preact[1]==306 and my_limit<100 then
								print("JA>(着地)A",dis);
								key_event(ACT_A);
--JA>(着地)6D>A
							elseif y==0 and ey==0 and dis>=140 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_preact[1]==306 and my_limit<100 then
								print("JA>(着地)6D>A",dis);
								key_event2(ACT_D,front);
								wait(10);
								key_event(ACT_A);

--AA>3A
--		elseif my_act==300 and dis>=100 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=1 and my_limit<100 then
--			print("AA>3A",dis);
--			key_event2(ACT_A,d_front);
--AA>AAA
		elseif my_act==320 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=2 and my_hitstop>=1 and my_limit<100 then
			print("AA>AAA",dis);
			key_event(ACT_A);
--AAA>2B
		elseif my_act==321 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=2 and my_hitstop>=1 and math.random(4)==1 then
			print("AAA>2B",dis);
			key_event2(ACT_B,ACT_DOWN);
--2A>3A
--		elseif my_act==303 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=1 and my_limit<100 then
--			print("2A>3A",dis);
--			key_event2(ACT_A,d_front);

--JA>J6A
	elseif my_act==306 and ey>0 and dis_y<=80 and (enemy_act>=50 and enemy_act<=89) and my_hitstop<=3 and my_hitstop>=1 and my_limit<100 then
		print("JA>J6A",dis);
		key_event2(ACT_A,front);
--JA>J8A
	elseif my_act==306 and ey>0 and ey>y and (enemy_act>=50 and enemy_act<=89) and my_hitstop<=3 and my_hitstop>=1 and my_limit<100 then
		print("JA>J8A",dis);
		key_event2(ACT_A,ACT_UP);
--JA or J8A>JB
	elseif (my_act==306 or my_act==309) and ey>0 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=1 and my_limit<100 and my_rei>=200 then
		print("JA/J8A>JB",dis);
		key_event(ACT_B);--]]
	
			
			
--▼攻撃▼
--マジックスターソード102
	elseif --get_skill_lv(0,2)>=0 and 
		my_rfunc>=0.65 and 
		dis>340 and
		ey-y>-0.1*(ex-x+500)*my_dir+125 and 
		ey-y<0.1*(ex-x+500)*my_dir+125 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(64)==1 then
			--print("マジックスターソード");
			lvr236(ACT_B);
			
	elseif --get_skill_lv(0,2)>=0 and 
		my_rfunc>=0.65 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(64)==1 then
			--print("マジックスターソード");
			lvr236(ACT_C);
--バウンスノーバウンス101
	elseif --get_skill_lv(0,1)>=0 and 
		my_rfunc>=0.65 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(64)==1 then
			--print("バウンスノーバウンス");
			lvr214(ACT_B);
			
	elseif --get_skill_lv(0,1)>=0 and 
		my_rfunc>=0.65 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(64)==1 then
			--print("バウンスノーバウンス");
			lvr214(ACT_C);

--]]

--▼攻撃▼

--▼spell card▼

	--▼cost2

		--幻符「殺人ドール」,200,600,g
			--Ground
				elseif card_check(200)==true and
					my_spell_more(1000) and
					--dis2<200 and
					y==0 and
					--ey<50 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

		--銀符「シルバーバウンド」,206,606,g,a
			--Ground
			--air
				elseif card_check(206)==true and
					my_spell_more(1000) and
					--dis<320 and
					--y==0 and
					--ey<50 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

		--奇術「エターナルミーク」,207,607,g
			--Ground
				elseif card_check(207)==true and
					my_spell_more(1000) and
					--dis<320 and
					y==0 and
					--ey<50 and
					dis_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(64)==1 then
						print("奇術「エターナルミーク」");
						for i=1,10 do
							card_use(207);
							yield()
						end


	--▼cost3

		--時符「プライベートスクウェア」,201,601,g
			--Ground
				elseif card_check(201)==true and
					my_spell_more(1500) and
					--dis>150 and
					--dis<350 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

		--傷符「インスクライブレッドソウル」,202,602,g
			--Ground
				elseif card_check(202)==true and
					my_spell_more(1500) and
					dis<400 and
					y==0 and
					dis_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(64)==1 then
						print("傷符「インスクライブレッドソウル」");
						for i=1,10 do
							card_use(202);
							yield()
						end

		--速符「ルミネスリコシェ」,208,608,g
			--Ground
				elseif card_check(208)==true and
					my_spell_more(1500) and
					--dis<600 and
					y==0 and
					dis_y<50 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(208);
							yield()
						end

		--時符「イマジナリバーチカルタイム」,211,611,g
			--Ground
				elseif card_check(211)==true and
					my_spell_more(1500) and
					--dis<300 and
					y==0 and
					--ey>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(64)==1 then
						print("時符「イマジナリバーチカルタイム」");
						for i=1,10 do
							card_use(211);
							yield()
						end

		--時計「ルナダイアル」,212,612,g
			--Ground
				elseif card_check(212)==true and
					my_spell_more(1500) and
					--dis<600 and
					y==0 and
					dis_y<50 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(212);
							yield()
						end

	--▼cost4

		--幻葬「夜霧の幻影殺人鬼」,203,603,g
			--Ground
				elseif card_check(203)==true and
					my_spell_more(2000) and
					--dis2<300 and
					y==0 and
					--ey>180 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

		--傷魂「ソウルスカルプチュア」,205,605,g
			--Ground
				elseif card_check(205)==true and
					my_spell_more(2000) and
					dis<800 and
					y==0 and
					dis_y<300 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

		--時符「咲夜特製ストップウォッチ」,209,609,g
			--Ground
			elseif card_check(209)==true and
				my_spell_more(2000) and
				--dis2<300 and
				y==0 and
				--ey>180 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(209);
						yield()
					end

		--光速「Ｃ.リコシェ」,210,610,g
			--Ground
				elseif card_check(210)==true and
					my_spell_more(2000) and
					--dis<200 and
					y==0 and
					--dis_y<100 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(210);
							yield()
						end

	--▼cost5

		--「咲夜の世界」,204,604,g
			--Ground
				elseif card_check(204)==true and
					my_spell_more(2500) and
					--dis<250 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,500,g,a
			--g,a
				elseif get_skill_lv(0,0)>=0 and my_rei>=400 and 
					dis>300 and
					dis_y<50 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("博麗アミュレット");
						lvr236(ACT_B);
				
				elseif get_skill_lv(0,0)>=0 and my_rei>=400 and 
					dis>450 and
					dis_y<50 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("博麗アミュレット");
						lvr236(ACT_C);
					
				elseif card_check(100)==true and my_rei>=400 and
					dis>300 and
					dis_y<50 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("博麗アミュレット");
						card_use(100);
		
		--妖怪バスター,104,505,g,a
			--g,a
				elseif get_skill_lv(0,4)>=0 and my_rei>=400 and 
					dis>200 and
					dis_y<50 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("妖怪バスター");
						lvr236(ACT_B);
					
				elseif get_skill_lv(0,4)>=0 and my_rei>=400 and 
					dis>300 and
					dis_y<50 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("妖怪バスター");
						lvr236(ACT_C);
					
				elseif card_check(104)==true and my_rei>=400 and
					dis>300 and
					dis_y<50 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("妖怪バスター");
						card_use(104);
		
		--拡散アミュレット,108,510,g

				elseif get_skill_lv(0,8)>=0 and my_rei>=400 and 
					dis>300 and
					dis_y<50 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("拡散アミュレット");
						lvr236(ACT_B);
					
				elseif get_skill_lv(0,8)>=0 and my_rei>=400 and 
					dis>300 and
					dis_y<50 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("拡散アミュレット");
						lvr236(ACT_C);
					
				elseif card_check(108)==true and my_rei>=400 and
					dis>300 and
					dis_y<50 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("拡散アミュレット");
						card_use(108);
		
	--▼スキル623

		--昇天脚,103,560,g

				elseif get_skill_lv(0,3)>=0 and my_rei>=400 and 
					dis<150 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("昇天脚");
						lvr623(ACT_B);
					
				elseif get_skill_lv(0,3)>=0 and my_rei>=400 and 
					dis<150 and
					y==0 and
					ey<300 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("昇天脚");
						lvr623(ACT_C);
					
				elseif card_check(103)==true and my_rei>=400 and
					dis<150 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("昇天脚");
						card_use(103);
		
		--抄地昇天脚,107,565,g
			--g
				elseif get_skill_lv(0,7)>=0 and my_rei>=400 and 
					dis<200 and
					y==0 and
					ey<50 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("抄地昇天脚");
						lvr623(ACT_B);
					
				elseif get_skill_lv(0,7)>=0 and my_rei>=400 and 
					dis<300 and
					y==0 and
					ey<50 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("抄地昇天脚");
						lvr623(ACT_C);
					
				elseif card_check(107)==true and my_rei>=400 and
					dis<200 and
					y==0 and
					ey<50 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("抄地昇天脚");
						card_use(107);
		
		--雨乞祈り,111,570,g,a
			--g,a
				elseif get_skill_lv(0,11)>=0 and my_rei>=400 and 
					dis<200 and
					dis_y<50 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("雨乞祈り");
						lvr623(ACT_B);
					
				elseif get_skill_lv(0,11)>=0 and my_rei>=400 and 
					dis<200 and
					dis_y<50 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("雨乞祈り");
						lvr623(ACT_C);
					
				elseif card_check(111)==true and my_rei>=400 and
					dis<200 and
					dis_y<50 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("雨乞祈り");
						card_use(111);

	--▼スキル421
		--亜空穴,102,540,g,a
			--g,a
				elseif get_skill_lv(0,2)>=0 and my_rei>=400 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("亜空穴");
						lvr421(ACT_B);
					
				elseif get_skill_lv(0,2)>=0 and my_rei>=400 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("亜空穴");
						lvr421(ACT_C);
					
				elseif card_check(102)==true and my_rei>=400 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("亜空穴");
						card_use(102);
		
		--封魔亜空穴,106,545,g,a
			--g,a
				elseif get_skill_lv(0,6)>=0 and my_rei>=400 and 
					dis<300 and
					ey<50 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("封魔亜空穴");
						lvr421(ACT_B);
					
				elseif get_skill_lv(0,6)>=0 and my_rei>=400 and 
					dis>300 and
					ey<50 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("封魔亜空穴");
						lvr421(ACT_C);
					
				elseif card_check(106)==true and my_rei>=400 and
					dis<300 and
					ey<50 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("封魔亜空穴");
						card_use(106);
		
		--刹那亜空穴,110,550,g
			--g
				elseif get_skill_lv(0,10)>=0 and my_rei>=400 and 
					dis2<300 and
					y==0 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					enemy_act>300 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("刹那亜空穴");
						lvr421(ACT_B);
					
				elseif get_skill_lv(0,10)>=0 and 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)==true and 
					--is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("刹那亜空穴");
						lvr421(ACT_C);
					
				elseif card_check(110)==true and my_rei>=400 and
					dis2<300 and
					y==0 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					enemy_act>300 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("刹那亜空穴");
						card_use(110);

	--▼スキル214
		--警醒陣,101,520,g,a
			--g,a
				elseif get_skill_lv(0,1)>=0 and my_rei>=400 and 
					dis>200 and dis<500 and
					dis_y<50 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("警醒陣");
						lvr214(ACT_B);
					
				elseif get_skill_lv(0,1)>=0 and my_rei>=400 and 
					dis>300 and dis<600 and
					dis_y<50 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("警醒陣");
						lvr214(ACT_C);
					
				elseif card_check(101)==true and my_rei>=400 and
					dis>200 and dis<500 and
					dis_y<50 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("警醒陣");
						card_use(101);	
		
		--繋縛陣,105,525,g,a
			--g,a
				elseif get_skill_lv(0,5)>=0 and my_rei>=400 and 
					dis2>300 and
					math.abs(enemy_xspeedEX)>5 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("繋縛陣");
						lvr214(ACT_B);
					
				elseif get_skill_lv(0,5)>=0 and my_rei>=400 and 
					dis2>300 and
					math.abs(enemy_yspeed)>5 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("繋縛陣");
						lvr214(ACT_C);
					
				elseif card_check(105)==true and my_rei>=400 and
					dis2>300 and
					math.abs(enemy_xspeedEX)>5 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("繋縛陣");
						card_use(105);
		
		--常置陣,109,530,g
			--g
				elseif get_skill_lv(0,9)>=0 and my_rei>=400 and 
					dis2>300 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(64)==1 then
						print("常置陣");
						lvr214(ACT_B);
					
				elseif get_skill_lv(0,9)>=0 and my_rei>=400 and 
					dis2>500 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(64)==1 then
						print("常置陣");
						lvr214(ACT_C);
					
				elseif card_check(109)==true and my_rei>=400 and
					dis2>300 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(64)==1 then
						print("常置陣");
						card_use(109);
--]]
			
--▼攻撃▼
--▼空中打撃▼
--J8A:309,19-127,106-243,9-10,7F(初速y8.5,gs0.5),y+16.5-24
	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(16)==1 and
	(y+my_yspeed*8+(8*(7*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*17		<=	120+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*17		>=	20-30 	and
				(ey+enemy_yspeed*17+(17*(16*e_gs))/2)	-	(y+(my_yspeed*8+(8*(7*m_gs))/2)+(8.5*4+(4*(3*(-0.5)))/2))	<=	220-40		and
				(ey+enemy_yspeed*17+(17*(16*e_gs))/2)	-	(y+(my_yspeed*8+(8*(7*m_gs))/2)+(8.5*4+(4*(3*(-0.5)))/2))	>=	160-160 	then
					print("J8A");
					key_event2(ACT_A,ACT_UP)
--J2A:308,b0:1-19F(静止),b1:21-nF(落下:y==0まで),b2:n+1F(スタンプ),v-25
	--落下:-50-47,-48-44,21-n,v-25
	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(16)==1 and
	(y+my_yspeed*6+(6*(5*m_gs))/2)>0 	and
				(ex-x)*my_dir-(enemy_xspeedEX)*17		<=	80+30 	and
				(ex-x)*my_dir-(enemy_xspeedEX)*17		>=	30-30 	and
				(ey+enemy_yspeed*17+(17*(16*e_gs))/2)	<=	100-40	and
				(ey+enemy_yspeed*17+(17*(16*e_gs))/2)	>=	10-160 	then
					print("J2A-fall");
					key_event2(ACT_A,ACT_DOWN);
--J6A:307,
	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+enemy_xspeedEX)*11		<=	160+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*11		>=	20-30 	and
				(ey+enemy_yspeed*11+(11*(10*e_gs))/2)	-	(y+my_yspeed*11+(11*(10*m_gs))/2)	<=	120-40 		and --自ヒットボックスの上端を、相手ヒットボックスの下端に当てた高さ
				(ey+enemy_yspeed*11+(11*(10*e_gs))/2)	-	(y+my_yspeed*11+(11*(10*m_gs))/2)	>=	40-160 	then  --自ヒットボックスの下端を、相手ヒットボックスの上端に当てた高さ
					print("J6A");
					key_event2(ACT_A,frontEX());
--J5A:306,
	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*10+(10*(9*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*10		<=	120+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*10		>=	20-30 	and
				(ey+enemy_yspeed*10+(10*(9*e_gs))/2)	-	(y+my_yspeed*10+(10*(9*m_gs))/2)	<=	100-40 		and --自ヒットボックスの上端を、相手ヒットボックスの下端に当てた高さ
				(ey+enemy_yspeed*10+(10*(9*e_gs))/2)	-	(y+my_yspeed*10+(10*(9*m_gs))/2)	>=	40-160 	then  --自ヒットボックスの下端を、相手ヒットボックスの上端に当てた高さ
					print("J5A");
					key_event(ACT_A);
					
--▼対空行動

--対空9HJ>J5A:
--j/hj攻撃不能時間:6f
--J5A:306,22-120,45-124,9-12
--9/7hj	:x18.0,y16.5(初速),gs0.85,1-5F(地上)
	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	-	(18*9+enemy_xspeedEX*15)		<=	120+30 	and --自機のhj時におけるx軸速度*発生
				(ex-x)*my_dir	-	(18*9+enemy_xspeedEX*15)		>=	22-30 	and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+16.5*9+(9*(8*(-0.85)))/2)	<=	124-40 		and --自機のhj時におけるy軸速度*発生(hj時の落下加速度を17としている)
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+16.5*9+(9*(8*(-0.85)))/2)	>=	45-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:
--j/hj攻撃不能時間:6f
--J5A:306,22-120,45-124,9-12
--8hj	:x 0.0,y22.5(初速),gs0.85,1-5F(地上)
	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*15)		<=	120+30 	and --自機のhj時におけるx軸速度*発生
				(ex-x)*my_dir	-	(enemy_xspeedEX*15)		>=	22-30 	and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+22.5*9+(9*(8*(-0.85)))/2)	<=	124-40 		and --自機のhj時におけるy軸速度*発生(hj時の落下加速度を17としている)
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+22.5*9+(9*(8*(-0.85)))/2)	>=	45-160 	then --hj時の落下加速度を-0.75としている
					print("AA:9HJ>J5A");
					key_event2(ACT_D,u_front)
					wait(3)
					key_event(ACT_A);
					wait(3)

--ダッシュ＞4Ａ
	elseif dis<=180 and my_act==200 and my_allframe>=10 and ey==0 and enemy_obj_range_in(150,60)==false and not(enemy_act>=97 and enemy_act<=98) and not(enemy_act>=197 and enemy_act<=199) and is_dir_front==true and 
	((not(enemy_act>=50 and enemy_act<=166)and math.random(5)==1) or (enemy_act>=50 and enemy_act<=166)) and subs_count>=530 and nega_count ~= 1 then
		print("ダッシュ４Ａ");
		key_event2(ACT_A,back);
--ダッシュ＞２Ａ
	elseif dis<=220 and my_act==200 and my_allframe>=10 and ey==0 and enemy_obj_range_in(150,60)==false and not(enemy_act>=97 and enemy_act<=98) and not(enemy_act>=197 and enemy_act<=199) and is_dir_front==true and 
	((not(enemy_act>=50 and enemy_act<=166)and math.random(5)==1) or (enemy_act>=50 and enemy_act<=166)) and subs_count>=530 and nega_count ~= 1 then
		print("ダッシュ２Ａ");
		key_event2(ACT_A,ACT_DOWN);--]]
--刻み4Ａ
	elseif (dis<=120 or (dis<=180 and my_xspeed>0)) and my_act==330 and ey==0 and my_hitstop<=3 and my_hitstop>=1 and enemy_obj_range_in(150,60)==false and 
	((enemy_act>=143 and enemy_act<=166) or (enemy_act>=50 and enemy_act<=89 and math.random(3)<=2)) and subs_count>=530 and nega_count ~= 1 then
		print("刻み４Ａ");
		key_event2(ACT_A,back);
		wait(3);
--DC
	elseif dis<=500 and y==0 and ey<50 and enemy_act>=400 and enemy_act<500 and enemy_act~=408 and enemy_act~=418 and enemy_allframe<=3 and my_act<=10 and not(enemy_act>=97 and enemy_act<=98) and not(enemy_act>=197 and enemy_act<=199) and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("DB");
		key_on(frontEX());
		key_event2(ACT_D,ACT_B);
--DB
	elseif dis<=500 and dis>=300 and y==0 and ey<50 and enemy_obj_range_in(150,60)==false and my_act<=10 and not(enemy_act>=97 and enemy_act<=98) and not(enemy_act>=197 and enemy_act<=199) and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("DB");
		key_on(frontEX());
		key_event2(ACT_D,ACT_B);
--DA
	elseif dis<=300 and dis>=260 and y==0 and ey<50 and enemy_obj_range_in(150,60)==false and my_act<=10 and not(enemy_act>=97 and enemy_act<=98) and not(enemy_act>=197 and enemy_act<=199) and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("ＤＡ");
		key_on(frontEX());
		key_event2(ACT_D,ACT_A);
--B：硬直差し込み
	elseif dis<=500 and y==0 and ey==0 and enemy_obj_range_in(150,60)==false and my_act<=10 and enemy_act>=300 and not(enemy_act>=97 and enemy_act<=98) and not(enemy_act>=197 and enemy_act<=199) and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("硬直差し込み：B");
		key_event(ACT_B);
--2B：対空
	elseif dis>250 and y==0 and ey-y>=0.7*(ex-x)*my_dir and ey-y<=4*(ex-x)*my_dir and enemy_obj_range_in(150,60)==false and my_act<=10 and not(enemy_act>=97 and enemy_act<=98) and not(enemy_act>=197 and enemy_act<=199) 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);
--6C/J6C
	elseif my_rfunc>0.65 and
	dis>280 and
	--y>0 and
	ey-y>-0.1*(ex-x+500)*my_dir+125 and 
	ey-y<0.1*(ex-x+500)*my_dir+125 and
	not(my_act>=50 and my_act<180) and my_act~=200 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(16)==1 then
		print("6C/J6C");
		key_event2(ACT_C,frontEX());
--C/JC
	elseif my_rfunc>0.65 and
	dis>280 and
	--y>0 and
	--ey-y>-0.1*(ex-x+500)*my_dir+125 and 
	ey-y<0*(ex-x+500)*my_dir+125 and
	not(my_act>=50 and my_act<180) and my_act~=200 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(16)==1 then
		print("5C/J5C");
		key_event(ACT_C);
--3Ah(13):304(b1),-32-213,59-264,30-32,+0-18.65
	elseif dis<=213+18+30+(enemy_xspeedEX)*32 and
	y==0 and 
	(ey+enemy_yspeed*32+(32*(31*e_gs))/2)<=264-40 and
	not(my_act>=50 and my_act<180) and my_act~=200 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("3AHr");
		key_on(ACT_A)
		key_on(d_front);
		wait(13+2)
--3A:304,43-186,69-242,15-17,+0-7.4
	elseif dis<=186+7+30+(enemy_xspeedEX)*17 and
	y==0 and 
	(ey+enemy_yspeed*17+(17*(16*e_gs))/2)<=242-40 and
	not(my_act>=50 and my_act<180) and my_act~=200 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("3A");
		key_event2(ACT_A,d_front);
--6Ah(9):302(b1),
	elseif dis<=127+215+30+(enemy_xspeedEX)*41 and
	y==0 and 
	(ey+enemy_yspeed*41+(41*(40*e_gs))/2)<=40-40 and
	not(my_act>=50 and my_act<180) and my_act~=200 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(32)==1 then
		print("6AHr");
		key_on(ACT_A)
		key_on(frontEX());
		wait(9+2)
--6A:302,
	elseif dis<=175+90+30+(enemy_xspeedEX)*23 and
	y==0 and 
	(ey+enemy_yspeed*23+(23*(22*e_gs))/2)<=50-40 and
	not(my_act>=50 and my_act<180) and my_act~=200 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("6A");
		key_event2(ACT_A,front);
--2A:303,
	elseif dis<=127+30+(enemy_xspeedEX)*10 and
	y==0 and 
	(ey+enemy_yspeed*10+(10*(9*e_gs))/2)<=68-40 and
	not(my_act>=50 and my_act<180) and my_act~=200 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("2A");
		key_event2(ACT_A,ACT_DOWN);
--L5A(>=140):301,
	elseif dis>=140 and 
	dis<=154+39+30+(enemy_xspeedEX)*15 and
	y==0 and 
	(ey+enemy_yspeed*15+(15*(14*e_gs))/2)<=165-40 and
	not(my_act>=50 and my_act<180) and my_act~=200 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("L5A");
		key_event(ACT_A);
--4A:330,24-118,73-130,9-10
	elseif --dis<=120 and 
	dis<=118+30+(enemy_xspeedEX)*10 and
	y==0 and 
	(ey+enemy_yspeed*10+(10*(9*e_gs))/2)<=130-40 and
	not(my_act>=50 and my_act<180) and my_act~=200 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("4A");
		key_event2(ACT_A,back);
--S5A(<140):300,
	elseif dis<=140 and 
	dis<=118+30+(enemy_xspeedEX)*10 and
	y==0 and 
	(ey+enemy_yspeed*10+(10*(9*e_gs))/2)<=130-40 and
	not(my_act>=50 and my_act<180) and my_act~=200 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("S5A");
		key_event(ACT_A);
--]]
--中距離以上からの８ｈｊ
	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