--鈴仙・優曇華院・イナバ用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()

--▼コンボ▼
--コンボ
--A>6B
	elseif ey>0 and (my_act==300 or my_act==301 or my_act==330) and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true and my_rei>=200 then
		print("コンボ：ＡＡ＞６Ｂ");
		key_event2(ACT_B,front);
--AAAAコンボ
	elseif my_act==300 and (enemy_act>=50 and enemy_act<=89) and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		print("コンボ：ＡＡ");
		key_event(ACT_A);
		elseif ey==0 and my_act==320 and (enemy_act>=50 and enemy_act<=89) and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
			print("コンボ：ＡＡＡ");
			key_event(ACT_A);
			
--遠A>6A
	elseif my_act==301 and (enemy_act>=50 and enemy_act<=89) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		key_resetEX();
		print("遠Ａ＞６Ａ");
		key_event2(ACT_A,front);
--遠A>3A
	elseif my_act==301 and (enemy_act>=50 and enemy_act<=89) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		key_resetEX();
		print("遠Ａ＞３Ａ");
		key_event2(ACT_A,d_front);
--2A>2B
	elseif my_act==303 and (enemy_act>=50 and enemy_act<=89) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		key_resetEX();
		print("2A>2B");
		key_event2(ACT_B,ACT_DOWN);
--6A>B
	elseif my_act==302 and (enemy_act>=50 and enemy_act<=89) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		print("３Ａ＞B");
		key_event(ACT_B);
		
--JA>JC
	elseif my_act==306 and enemy_act>=150 and enemy_act<=166 and my_hitstop<=3 and my_hitstop>=2 and ((my_airEX~=0) or (my_airEX==0 and y-(my_yspeed*2+my_yspeed/5*13)<=0)) and is_dir_front==true then
		key_resetEX();
		print("ＪＡ＞ＪＣ");
		key_event(ACT_C);
--JA>J6A
	elseif my_act==306 and enemy_act>=50 and enemy_act<=89 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		key_resetEX();
		print("ＪＡ＞Ｊ６Ａ");
		key_event2(ACT_A,front);
--AAA>6B>6C
	elseif my_act==321 and enemy_act>=50 and enemy_act<=89 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		print("AAA>6B");
		key_event2(ACT_B,front);
		wait(13-2);
		key_event2(ACT_C,front);
		wait(32-2);
		key_event(u_front);
		if my_frontside>=300 then
			wait(5-2);
			key_event2(ACT_A,front);
		end
--J8A>6C
	elseif my_act==309 and my_allframe>=15 and enemy_act>=50 and enemy_act<=89 and my_hitstop<=3 and my_hitstop>=1 then
		key_on(front);
		key_on(ACT_C);
		while my_act==309 and ey>y and not(dis_y<=180 and enemy_yspeed<0) do
			yield();
		end
		key_reset();
		
--J6A or J2A or J8A > 射撃
	elseif (my_act==306 or my_act==307 or my_act==308 or my_act==309) and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and ey>0 and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		print("〜>C");
		key_event(ACT_C);
		
		
--ＤＡ＞スキル
	elseif my_act==305 then
	print("DA>skill");
			
		--新型試作型：
			
		if my_act==305 and my_allframe<=10 and my_card~=100 and card_check(100) then
			card_1st(100);
		elseif my_act==305 and 
		(
			(enemy_act>=50 and enemy_act<=89 and (my_correction<32 or (ey>0 and my_correction>=32))) or 
			(enemy_act>=143 and enemy_act<=166)
		) and my_hitstop<=3 and my_hitstop>=1 and 
		my_card==100 then
			print("ＤＡ＞スキカ：マインドエクスプロージョン");
			key_reset();
			key_event(ACT_BC);
		elseif my_act==305 and 
		((enemy_act>=50 and enemy_act<=89 and (my_correction<32 or (ey>0 and my_correction>=32))) or (enemy_act>=143 and enemy_act<=166)
		) and 
		my_hitstop<=7 and my_hitstop>=5 and 
		get_skill_lv(0,0)>=0 then
			print("ＤＡ＞コマンド：マインドエクスプロージョン");
			key_reset();
			key_on(ACT_D);yield();key_off(ACT_D);yield();
			lvr236(ACT_B);
		end
				  
--▼固め▼
--A連
--4A>連打
	elseif my_act==330 and dis<=80 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(4)<=3 then
		print("4A>〜");
		key_event2(ACT_A,back);
--A>AA
	elseif my_act==300 and dis<=80 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(4)<=3 then
		print("A>AA");
		key_event(ACT_A);
--A>B
	elseif (my_act==300 or my_act==330) and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("A>B");
		key_event(ACT_B);
--A>C or ﾎｰﾙﾄﾞC
	elseif (my_act==300 or my_act==330) and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("A>C",dis);
		key_on(ACT_C);
		yield();
		if math.random(16)==1 then
			print("派生：ホールドC");
			wait(16+2);
		end
		key_reset();
--A>カード準備：マインドエクスプロージョン
	elseif (my_act==300 or my_act==330) and my_allframe<=10 and card_check(100) and my_card~=100 and math.random(1)==1 then
		print("A>　カード準備：マインドエクスプロージョン");
		card_1st(100);
	--A>スキルカード使用：マインドエクスプロージョン
		elseif (my_act==300 or my_act==330) and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and my_card==100 and math.random(2)==1 then
			print("A>　スキルカード使用：マインドエクスプロージョン");
			key_reset();
			key_event(ACT_BC);
--A>コマンド：マインドエクスプロージョン
	elseif (my_act==300 or my_act==330) and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=8 and my_hitstop>=7 and my_card~=100 and my_rei>=400 and math.random(16)==1 then
		print("A>コマンド：マインドエクスプロージョン",dis);
		key_on(ACT_D); yield(); key_off(ACT_D); yield();
		lvr236(ACT_B);
--A>待機
	elseif (my_act==300 or my_act==330) and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(1)==1 then
		print("A>待機");
		wait(16-my_allframe+2);
	--J2A
		if math.random(4)==1 then
			print("A>増長ジャンプ");
			key_on(u_front);
			if 16-my_allframe>=1 then
				wait(16-my_allframe+2);
			end
			key_reset();
			wait(2);
			key_event2(ACT_A,ACT_DOWN);
	--６D
		elseif math.random(2)==1 then
			print("A>増長６D");
			key_event2(ACT_D,front);
	--ﾃﾞｨﾚｲ後退
		else
			print("A>ﾃﾞｨﾚｲ後退");
			key_on(back);
			wait(10);
		end
	
--AA>AAA
	elseif my_act==320 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(4)<=3 then
		print("AA>AAA");
		key_event(ACT_A);
--AA>B
	elseif my_act==320 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("AA>B");
		key_event(ACT_B);
--AA>待機
	elseif my_act==320 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(1)==1 then
		print("AA>待機");
		wait(17-my_allframe+2);
	--ﾃﾞｨﾚｲ2A
		if dis<=120 and math.random(2)==1 then
			print("AA>ディレイ２A");
			key_event2(ACT_A,ACT_DOWN);
	--６D
		elseif math.random(4)==1 then
			print("AA>増長６D");
			key_event2(ACT_D,front);
	--ﾃﾞｨﾚｲ後退
		else
			print("AA>ﾃﾞｨﾚｲ後退");
			key_on(back);
			wait(10);
		end
--AAA>カード準備
	elseif my_act==321 and my_allframe<=7 and card_check(200) and my_card~=200 then
		print("AAA>カード準備");
		card_1st(200);
--AAA>AAAA
	elseif my_act==321 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(5)==1 then
		print("AAA>AAAA");
		key_event(ACT_A);
	--AAAA>惑視「離円花冠（カローラヴィジョン）」
		elseif my_act==322 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and my_card==200 then
			print("AAAA>惑視「離円花冠（カローラヴィジョン）」");
			key_reset();
			key_event(ACT_BC);
--AAA>B
	elseif my_act==321 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("AAA>B");
		key_event(ACT_B);
--AAA>待機
	elseif my_act==321 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 then
		print("AAA>待機");
		wait(28-my_allframe+2);
		key_reset();
	--ﾃﾞｨﾚｲ遠A
		if dis>=120 and math.random(4)==1 then
			print("AAA>ﾃﾞｨﾚｲ遠A");
			key_event(ACT_A);
	--ﾃﾞｨﾚｲ6A
		elseif dis<=120 and math.random(4)==1 then
			print("AAA>ﾃﾞｨﾚｲ6A");
			key_event2(ACT_A,front);
	--ﾃﾞｨﾚｲ2A
		elseif dis<=120 and math.random(4)==1 then
			print("AAA>ﾃﾞｨﾚｲ2A");
			key_event2(ACT_A,ACT_DOWN);
	--ﾃﾞｨﾚｲ3A
		elseif dis>=120 and math.random(4)==1 then
			print("AAA>ﾃﾞｨﾚｲ3A");
			key_event2(ACT_A,d_front);
	--ﾃﾞｨﾚｲ後退
		else
			print("AAA>ﾃﾞｨﾚｲ後退");
			key_on(back);
			wait(10);
		end
		
--遠A
--遠A>6A
	elseif my_act==301 and dis<=110 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("遠A>6A",dis);
		key_event2(ACT_A,front);
--遠A>3A
	elseif my_act==301 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("遠A>3A");
		key_event2(ACT_A,d_front);
--遠A>B
	elseif my_act==301 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(4)<=3 then
		print("遠A>B");
		key_event(ACT_B);
--遠A>C or ﾎｰﾙﾄﾞC
	elseif my_act==301 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(3)<=2 then
		print("遠A>C",dis);
		key_on(ACT_C);
		yield();
		if math.random(16)==1 then
			print("派生：ホールドC");
			wait(16+2);
		end
		key_reset();
--遠A>カード準備：マインドエクスプロージョン
	elseif my_act==301 and my_allframe<=10 and card_check(100) and my_card~=100 then
		print("遠A>　カード準備：マインドエクスプロージョン");
		card_1st(100);
	--遠A>スキルカード使用：マインドエクスプロージョン
		elseif my_act==301 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and my_card==100 and math.random(2)==1 then
			print("遠A>　スキルカード使用：マインドエクスプロージョン");
			key_reset();
			key_event(ACT_BC);
--遠A>コマンド：マインドエクスプロージョン
	elseif my_act==301 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=8 and my_hitstop>=7 and my_card~=100 and my_rei>=400 and math.random(16)==1 then
		print("遠A>コマンド：マインドエクスプロージョン",dis);
		key_on(ACT_D); yield(); key_off(ACT_D); yield();
		lvr236(ACT_B);
--遠A>待機
	elseif my_act==301 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(1)==1 then
		print("遠A>待機");
		wait(34-my_allframe+2);
		key_reset();
	--遠A
		if math.random(4)==1 then
			print("遠A>ディレイ遠A");
			key_event(ACT_A);
	--６D
		elseif math.random(2)==1 then
			print("遠A>増長６D");
			key_event2(ACT_D,front);
	--ﾃﾞｨﾚｲ後退
		else
			print("遠A>ﾃﾞｨﾚｲ後退");
			key_on(back);
			wait(10);
		end
		
--６A
--６A>B
	elseif my_act==302 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("６A>B");
		key_event(ACT_B);
--６A>C or ﾎｰﾙﾄﾞC
	elseif my_act==302 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("６A>C",dis);
		key_on(ACT_C);
		yield();
		if math.random(16)==1 then
			print("派生：ホールドC");
			wait(16+2);
		end
		key_reset();
--６A>カード準備：マインドエクスプロージョン
	elseif my_act==302 and my_allframe<=10 and card_check(100) and my_card~=100 then
		print("６A>　カード準備：マインドエクスプロージョン");
		card_1st(100);
	--６A>スキルカード使用：マインドエクスプロージョン
		elseif my_act==302 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and my_card==100 and math.random(2)==1 then
			print("６A>　スキルカード使用：マインドエクスプロージョン");
			key_reset();
			key_event(ACT_BC);
--６A>コマンド：マインドエクスプロージョン
	elseif my_act==302 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=8 and my_hitstop>=7 and my_card~=100 and my_rei>=400 and math.random(16)==1 then
		print("６A>コマンド：マインドエクスプロージョン",dis);
		key_on(ACT_D); yield(); key_off(ACT_D); yield();
		lvr236(ACT_B);
--６A>待機
	elseif my_act==302 and (enemy_act>=159 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(1)==1 then
		print("６A>待機");
		wait(56-my_allframe+2);
		key_reset();
	--2A
		if math.random(2)==1 then
			print("６A>ディレイ2A");
			key_event(ACT_A);
	--ﾃﾞｨﾚｲ後退
		else
			print("６A>ﾃﾞｨﾚｲ後退");
			key_on(back);
			wait(10);
		end
		
--２A
--２A>連打
	elseif my_act==303 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(5)<=4 then
		print("２A>〜",dis);
		key_event2(ACT_A,ACT_DOWN);
--２A>6A
	elseif my_act==303 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("２A>6A");
		key_event2(ACT_A,front);
--２A>3A
	elseif my_act==303 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("２A>3A");
		key_event2(ACT_A,d_front);
--２A>B
	elseif my_act==303 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("２A>B");
		key_event(ACT_B);
--２A>C or ﾎｰﾙﾄﾞC
	elseif my_act==303 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)==1 then
		print("２A>C",dis);
		key_on(ACT_C);
		yield();
		if math.random(16)==1 then
			print("派生：ホールドC");
			wait(16+2);
		end
		key_reset();
--２A>カード準備：マインドエクスプロージョン
	elseif my_act==303 and my_allframe<=5 and card_check(100) and my_card~=100 then
		print("２A>　カード準備：マインドエクスプロージョン");
		card_1st(100);
	--２A>スキルカード使用：マインドエクスプロージョン
		elseif my_act==303 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and my_card==100 and math.random(2)==1 then
			print("２A>　スキルカード使用：マインドエクスプロージョン");
			key_reset();
			key_event(ACT_BC);
--２A>コマンド：マインドエクスプロージョン
	elseif my_act==303 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=8 and my_hitstop>=7 and my_card~=100 and my_rei>=400 and math.random(32)==1 then
		print("２A>コマンド：マインドエクスプロージョン",dis);
		key_on(ACT_D); yield(); key_off(ACT_D); yield();
		lvr236(ACT_B);
--２A>待機
	elseif my_act==303 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(1)==1 then
		print("２A>待機");
		wait(21-my_allframe+2);
		key_reset();
	--J2A
		if math.random(4)==1 then
			print("A>増長ジャンプ");
			key_on(u_front);
			if 21-my_allframe>=1 then
				wait(21-my_allframe+2);
			end
			key_reset();
			wait(2);
			key_event2(ACT_A,ACT_DOWN);
	--近A
		elseif math.random(4)==1 then
			print("２A>ディレイ近A");
			key_event(ACT_A);
	--６D
		elseif math.random(2)==1 then
			print("２A>増長６D");
			key_event2(ACT_D,front);
	--ﾃﾞｨﾚｲ後退
		else
			print("６A>ﾃﾞｨﾚｲ後退");
			key_on(back);
			wait(10);
		end
		
--3A
--3A>B
	elseif my_act==304 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(5)<=4 then
		print("3A>B");
		key_event(ACT_B);
--3A>C or ﾎｰﾙﾄﾞC
	elseif my_act==304 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(4)<=3 then
		print("3A>C",dis);
		key_on(ACT_C);
		yield();
		if math.random(16)==1 then
			print("派生：ホールドC");
			wait(16+2);
		end
		key_reset();
--3A>カード準備：マインドエクスプロージョン
	elseif my_act==304 and my_allframe<=10 and card_check(100) and my_card~=100 then
		print("3A>　カード準備：マインドエクスプロージョン");
		card_1st(100);
	--3A>スキルカード使用：マインドエクスプロージョン
		elseif my_act==304 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and my_card==100 and math.random(1)==1 then
			print("3A>　スキルカード使用：マインドエクスプロージョン");
			key_reset();
			key_event(ACT_BC);
--3A>コマンド：マインドエクスプロージョン
	elseif my_act==304 and dis<=100 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=8 and my_hitstop>=7 and my_card~=100 and my_rei>=400 and math.random(16)==1 then
		print("６A>コマンド：マインドエクスプロージョン",dis);
		key_on(ACT_D); yield(); key_off(ACT_D); yield();
		lvr236(ACT_B);
--JA
	elseif my_act==306 and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 and math.random(2)<=1 then
		print("JA>B");
		if ey==0 then
			key_on(ACT_DOWN);
		end
		if y+my_yspeed/5*(27+2)>=1 then
			key_event(ACT_B);
			while my_act>=404 and my_act<=406 and my_allframe<=25 do
				yield();
			end
		end
--B>待機
	elseif (my_act>=400 and my_act<=406) and my_allframe<=10 then
		print("B>待機");
		while ((my_act==400 and my_act<=403 and y==0) or (my_act==404 and my_act<=406 and y>=10)) and my_allframe<=26 do
			yield();
			if enemy_act>=200 and enemy_act<=226 then
				break;
			end
		end
	--2飛翔
		if math.random(5)==1 and dis<=300 then
			print("A>JB");
			key_event(u_front);
			wait(2);
			while y<100 and my_act>=208 and my_act<=210 do
				yield();
			end
			key_event2(ACT_D,ACT_DOWN);
	--J2A
		elseif math.random(3)==1 and dis<=300 then
			print("B>J2A");
			key_event(u_front);
			wait(2);
			key_event2(ACT_A,ACT_DOWN);
	--JB
		elseif math.random(3)<=2 and dis<=300 then
			print("A>JB");
			key_event(u_front);
			wait(2);
			if ey>0 then
				key_on(ACT_DOWN);
			end
			key_event(ACT_B);
		end
			
--▼攻撃▼

--▼spell card▼

--▼cost1

--惑視「離円花冠(カローラヴィジョン)」,200,600,g,a
	--Ground,air
		elseif card_check(200)==true and
			my_spell_more(500) and
			--dis<400 and
			--y==0 and
			dis_y<50 and
			--ey<200 and
			--my_frontside>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(160)==1 then
				print("惑視「離円花冠(カローラヴィジョン)」");
				for i=1,10 do
					card_use(200);
					yield()
				end

--弱心「喪心喪意(ディモチヴェイション)」,206,606,g
	--Ground
		elseif card_check(206)==true and
			my_spell_more(500) and
			dis<300 and
			--dis>200 and
			y==0 and
			dis_y<100 and
			--ey<200 and
			my_frontside>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(160)==1 then
				print("弱心「喪心喪意(ディモチヴェイション)」");
				for i=1,10 do
					card_use(206);
					yield()
				end

--▼cost2

--毒煙幕「瓦斯織物の玉」.208,608,g
	--Ground
		elseif card_check(208)==true and
			my_spell_more(1000) and
			--dis<500 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(208);
					yield()
				end

--長視「赤月下(インフレアドムーン)」,211,611,g
	--Ground
		elseif card_check(211)==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(211);
					yield()
				end

--▼cost3

--幻爆「近眼花火(マインドスターマイン)」,202,602,g,a
	--Ground
		elseif card_check(202)==true and
			my_spell_more(1500) and
			dis2<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(202);
					yield()
				end

--幻惑「花冠視線(クラウンヴィジョン)」,203,603,g
	--Ground
		elseif card_check(203)==true and
			my_spell_more(1500) and
			--dis<300 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(203);
					yield()
				end

--喪心「喪心創痍(ディスカーダー)」,207,607,g
	--Ground
		elseif card_check(207)==true and
			my_spell_more(1500) and
			--dis<300 and
			y==0 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("喪心「喪心創痍(ディスカーダー)」");
				for i=1,10 do
					card_use(207);
					yield()
				end

--生薬「国士無双の薬」,209,609,g
	--Ground
		elseif card_check(209)==true and
			my_spell_more(1500) and
			--dis<300 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(209);
					yield()
				end

--短視「超短脳波（エックスウェイブ）」,210,610,g
	--Ground
		elseif card_check(210)==true and
			my_spell_more(1500) and
			dis<300 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(210);
					yield()
				end

--▼cost4

--赤眼「望見円月（ルナティックブラスト）」,204,604,g
	--Ground
		elseif card_check(204)==true and
			my_spell_more(2000) and
			ey-y<(ex-x)+200 and
			ey-y>0.5*(ex-x)+50 and
			--dis<500 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

--▼cost5

--「幻朧月睨(ルナティックレッドアイズ)」,205,605,g,a
	--Ground
		elseif card_check(205)==true and
		my_spell_more(2500) and
		dis2<600 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(205);
				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);
--]]
			
--▼攻撃▼
--ＪＡ
	elseif	y>0 and 
	(my_act<=10 or (my_act>=180 and my_act<300)) and 
	not(enemy_act>=98 and enemy_act<=98) and
	not(enemy_act>=197 and enemy_act<=199) and
	enemy_obj_range_in(150,60)==false and
	is_dir_front and 
	(y+my_yspeed*11+(11*(9*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*9		<=	110+30 	and
				--(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*9		>=	20-30 	and
				(ey+enemy_yspeed*9+(9*(8*e_gs))/2)	-	(y+my_yspeed*9+(9*(8*m_gs))/2)	<=	80 		and
				(ey+enemy_yspeed*9+(9*(8*e_gs))/2)	-	(y+my_yspeed*9+(9*(8*m_gs))/2)	>=	40-120 	and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
					print("ＪＡ");
					key_resetEX();
					key_event(ACT_A);
--[[Ｊ６Ａ
	elseif	y>0 and 
	(my_act<=10 or (my_act>=180 and my_act<300)) and 
	not(enemy_act>=98 and enemy_act<=98) and
	not(enemy_act>=197 and enemy_act<=199) and
	enemy_obj_range_in(150,60)==false and
	is_dir_front and ((weather~=13) or (weather==13 and my_backside>=300)) and math.random(5)==1 and
	(y+my_yspeed*15+(15*(14*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		<=	160+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		>=	30-30 	and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	<=	160 		and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	>=	60-120 	and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
					print("Ｊ６Ａ");
					key_resetEX();
					key_event2(ACT_A,front); --]]
--Ｊ８Ａ
	elseif	y>0 and 
	(my_act<=10 or (my_act>=180 and my_act<300)) and 
	not(enemy_act>=98 and enemy_act<=98) and
	not(enemy_act>=197 and enemy_act<=199) and
	enemy_obj_range_in(150,60)==false and
	is_dir_front and my_airEX>=1 and 
	(y+my_yspeed*12+(12*(11*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*12		<=	80+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*12		>=	30-30 	and
				(ey+enemy_yspeed*12+(12*(11*e_gs))/2)	-	(y+my_yspeed*12+(12*(11*m_gs))/2)	<=	240 		and
				(ey+enemy_yspeed*12+(12*(11*e_gs))/2)	-	(y+my_yspeed*12+(12*(11*m_gs))/2)	>=	160-120 	and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
					print("Ｊ８Ａ");
					key_resetEX();
					key_event2(ACT_A,ACT_UP);

--対空Ａ
	elseif y==0 and ey>0 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
	((not(enemy_act>=50 and enemy_act<=166)and math.random(1+5)==1) or (enemy_act>=50 and enemy_act<=166)) and
		(	
			(	dis>=120 and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*14		<=	180+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*14		>=	50-30 	and
				(ey+enemy_yspeed*14+(14*(13*e_gs))/2)	-	(y+my_yspeed*14+(14*(13*m_gs))/2)	<=	150 		and
				(ey+enemy_yspeed*14+(14*(13*e_gs))/2)	-	(y+my_yspeed*14+(14*(13*m_gs))/2)	>=	50-180
			) or
			(	dis<120 and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*8		<=	80+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*8		>=	20-30 	and
				(ey+enemy_yspeed*8+(8*(7*e_gs))/2)	-	(y+my_yspeed*8+(8*(7*m_gs))/2)	<=	180 		and
				(ey+enemy_yspeed*8+(8*(7*e_gs))/2)	-	(y+my_yspeed*8+(8*(7*m_gs))/2)	>=	60-180
			)
		) and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("対空Ａ");
		key_event(ACT_A);
--対空9HJ>JＡ:14F それなりに機能する。対地上りJAも兼ねる。
	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 
	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
	(
		(not(enemy_act>=50 and enemy_act<=166)) or (enemy_act>=50 and enemy_act<=166)
	) and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and 
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		<=	170+30 	and
				--(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		>=	80-30 	and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	<=	150 		and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	>=	110-120 	then
		print("対空9HJ>JＡ");
		key_event2(ACT_D,u_front)
		key_reset()
		wait(2)
		key_event(ACT_A);--]]
--対空8HJ>JＡ:14F
	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 
	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
	(
		(not(enemy_act>=50 and enemy_act<=166)) or (enemy_act>=50 and enemy_act<=166)
	) and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and 
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		<=	50+30 	and
				--(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		>=	-40-30 	and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	<=	181 		and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	>=	121-120 	then
		print("対空8HJ>JＡ");
		key_event2(ACT_D,ACT_UP)
		key_reset()
		wait(2)
		key_event(ACT_A);--]]
--ダッシュ＞2Ａ
	elseif dis<=150 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 and math.random(4)==1 then
		print("ダッシュ2Ａ");
		key_event2(ACT_A,ACT_DOWN);
--刻み2Ａ
	elseif (dis<=50+30 or (dis<=80 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>=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 and math.random(4)==1 then
		print("刻み2Ａ");
		key_event2(ACT_A,ACT_DOWN);
		wait(3);
--Ａ
	elseif dis<=140 and y==0 and ey<100 and enemy_obj_range_in(150,60)==false and my_act<=10 and (enemy_act~=97 and enemy_act~=98 and enemy_act~=197 and enemy_act~=198 and enemy_act~=199 and enemy_act~=300 and enemy_act~=303 and enemy_act~=320 and enemy_act~=321 and enemy_act~=322 and enemy_act~=330) and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("Ａ");
		key_event(ACT_A);
--ＤＡ
	elseif dis<=240 and y==0 and ey<100 and enemy_obj_range_in(150,60)==false and my_act<=10 and (enemy_act~=97 and enemy_act~=98 and enemy_act~=197 and enemy_act~=198 and enemy_act~=199 and enemy_act~=300 and enemy_act~=303 and enemy_act~=320 and enemy_act~=321 and enemy_act~=322 and enemy_act~=330) 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);
--5Ｂ
	elseif dis>150 and dis<=600 and y==0 and ey-y<=0.5*my_dir*(ex-x) 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_event(ACT_B);
--6Ｂ
	elseif dis>150 and dis<=600 and y==0 and ey-y>=0.5*my_dir*(ex-x) and ey-y<=2*my_dir*(ex-x) 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_event2(ACT_B,front);
--5C
	elseif dis>500 and dis<=1000 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("５C");
		key_on(ACT_C);
		yield();
		if math.random(16)==1 then
			wait(20);
		end
		key_reset();
--J2Ｂ
	elseif dis2>100 and dis<=600 and y>=200 and ey<y and my_air==0 and my_rei>800 and y+my_yspeed/5*15>=1 and enemy_obj_range_in(150,60)==false and my_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("６Ｂ");
		key_event2(ACT_B,ACT_DOWN);
--J2C
	elseif dis>200 and dis<=800 and y>=200 and ey<y and my_air==0 and my_rei>800 and y+my_yspeed/5*20>=1 and enemy_obj_range_in(150,60)==false and my_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("J2C",math.floor(y));
		key_on(ACT_DOWN);
		key_on(ACT_C);
		yield();
		if math.random(16)==1 then
			wait(20);
		end
		key_reset();
--]]
--中距離以上からの８ｈｊ
	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