--博麗霊夢用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 ex_combo==2 then
--夢想封印割りから。AAA6B
		if my_act==601 and my_allframe>=142 and my_frontside<100 and ey<150 and enemy_act==71 then
			key_reset();
			key_event(ACT_A)
			wait(10)
			key_event(ACT_A)
			wait(12)
			key_event(ACT_A)
			wait(15)
			key_on(front)
			yield()
			key_event(ACT_B)
--夢想封印から6Bか2Cで追撃
		elseif my_act<=5 or my_act==204 or (my_act==200 and my_allframe>=13) or ((my_act==601 or my_act==651) and my_allframe>=143) then
			if my_frontside>160 then
				key_reset()
				key_on(front)
				yield()
				key_event(ACT_B)		
			elseif my_frontside<160 and my_frontside>120 then
				key_reset()
				key_on(front)
				yield()
			else
				key_reset()
				key_on(ACT_DOWN)
				yield()
				key_event(ACT_C)
			end
		else
			key_reset()
			yield()
			--kihon()
		end
--端の高威力コンボ。B>C>J2BかB>C>2A
	elseif ex_combo==1 then
		if my_act==400 and enemy_act>=50 and enemy_act<=65 and (my_allframe==21 or my_allframe==24) then
			key_reset();
			key_event(ACT_C);
		elseif my_act==410 and (enemy_act==52 or enemy_act==58) and my_limit<65 and my_allframe>=33 and my_rei>=300 then
			key_reset();
			key_on(back);
			key_on(ACT_UP)
			wait(3);
			key_reset();
			key_on(ACT_DOWN);
			yield();
			key_event(ACT_B)
			ex_combo = 0;
		elseif my_act==410 and (enemy_act==64 or my_rei<300 or my_limit>=75) and my_allframe>=50 then
			key_reset();
			key_on(ACT_DOWN);
			yield();
			key_event(ACT_A);
			wait(18);
			ex_combo = 0;
		else
			key_reset();
			yield();
			--kihon();
		end
--DCCH確認で鬼縛陣。川霧では距離制限を厳しく
	elseif my_correction==33 and use_kibaku==2 and enemy_act==77 and enemy_allframe<35 and ((my_act<=5 and my_preact[1]==418) or (my_act==418 and my_allframe>25)) and ((weather~=12 and (dis<130 or my_frontside<170)) or (weather==12 and dis<90)) then
		key_reset();
		if my_card==206 then
			key_on(ACT_BC);
			wait(1);
			key_reset();
		elseif my_card~=206 then
			key_on(ACT_AB);
			wait(2);
			key_reset();
		end
--3ACH確認で鬼縛陣。川霧では距離制限を厳しく
	elseif my_correction==33 and use_kibaku==2 and enemy_act==77 and enemy_allframe<40 and my_act==304 and my_allframe>=33 and ((weather~=12 and (dis<90 or my_frontside<170)) or (weather==12 and dis<60)) then
		key_reset();
		if my_card==206 then
			key_on(ACT_BC);
			wait(1);
			key_reset();
		elseif my_card~=206 then
			key_on(ACT_AB);
			wait(2);
			key_reset();
		end
--DBヒット確認で鬼縛陣
	elseif is_card_use and my_card==206 and enemy_act>=70 and enemy_act<=80 and my_act==408 then
		key_reset();
		if my_card==206 then
			key_on(ACT_BC);
			wait(1);
			key_reset();
		end
--JA圏内に入ったらJAで拾ってみる
	elseif ((my_act==202 and my_allframe>=11) or (my_act==203 and my_allframe>=1) or (my_act==214 and my_allframe>=14) or (my_act==208 and my_allframe>=2) or (my_act==209 and my_allframe>=2) or my_act==212 or (my_act==8 and my_allframe>=2) or (my_act==9 and my_allframe>=2)) and enemy_act>=70 and enemy_act<=80 and my_act~=306 and
	((dis<=250 and my_xspeed>=6) or (dis<=220 and my_xspeed<6 and my_xspeed>2) or (dis<=200 and my_xspeed<2 and my_xspeed>-2) or (dis<=190 and my_xspeed<-2 and my_xspeed>-6) or (dis<=180 and my_xspeed<=-6)) and 
	(((y-ey)<90 and (ey-y)<140 and my_yspeed>=10) or ((y-ey)<100 and (ey-y)<120 and my_yspeed<10 and my_yspeed>5) or ((y-ey)<110 and (ey-y)<80 and my_yspeed<5 and my_yspeed>1) or ((y-ey)<120 and (ey-y)<70 and my_yspeed<1 and my_yspeed>-3) or ((y-ey)<130 and (ey-y)<55 and my_yspeed<-3 and my_yspeed>-6) or ((y-ey)<130 and (ey-y)<35 and my_yspeed<-6 and my_yspeed>-10) or ((y-ey)<160 and (ey-y)<20 and my_yspeed<=-10)) then
		key_reset();
		key_event(ACT_A);
--J8A圏内に入ったらJ8Aで拾ってみる。地上B射撃からの場合はJA拾いに切り替え
	elseif ((my_act==202 and my_allframe>=11) or (my_act==203 and my_allframe>=1) or (my_act==214 and my_allframe>=14) or (my_act==208 and my_allframe>=2) or (my_act==209 and my_allframe>=2) or my_act==212 or (my_act==8 and my_allframe>=2) or (my_act==9 and my_allframe>=2)) and enemy_act>=70 and enemy_act<=80 and my_limit<100 and
	((dis<=160 and my_xspeed>=4) or (dis<=130 and my_xspeed<4 and my_xspeed>-4) or (dis<=100 and my_xspeed<=-4)) and
	(((y-ey)<-140 and (ey-y)<310 and my_yspeed>=10) or ((y-ey)<-120 and (ey-y)<290 and my_yspeed<10 and my_yspeed>5) or ((y-ey)<-80 and (ey-y)<270 and my_yspeed<5 and my_yspeed>1) or ((y-ey)<-70 and (ey-y)<260 and my_yspeed<1 and my_yspeed>-3) or ((y-ey)<-55 and (ey-y)<250 and my_yspeed<-3 and my_yspeed>-6) or ((y-ey)<-35 and (ey-y)<230 and my_yspeed<-6 and my_yspeed<=-9) or ((y-ey)<20 and (ey-y)<200 and my_yspeed<=-10)) then
		if my_act==209 and (my_preact[1]==400 or my_preact[2]==400 or my_preact[1]==402 or my_preact[2]==402) then
			key_reset();
			key_event(ACT_A);
		else
			key_reset();
			key_event2(ACT_A,ACT_UP);
		end
--地上の相手がのけぞってたらJAで突いてみる
	elseif ((my_act==202 and my_allframe>=11) or (my_act==203 and my_allframe>=1) or my_act==208 or my_act==209 or my_act==212 or (my_act==214 and my_allframe>=14) or my_act==9) and ((dis<300 and my_xspeed>4) or dis<200) and ((y<250 and my_yspeed<-5) or y<200) and my_xspeed>=0 and my_yspeed<=1 and enemy_act>=50 and enemy_act<=64 then
		if y>40 and my_yspeed>-1 and (my_act==202 or my_act==214) and my_xspeed>=4 and ((enemy_act==51 and enemy_frame<=4) or ((enemy_act==52 or enemy_act==64) and enemy_frame<=8)) then
			key_reset();
			yield();
			--kihon();
		else
			key_reset();
			key_event(ACT_A);
		end
--JAJ8AJBJ8A。前慣性が利いていて、なおかつJAが空中密着ヒットした時のみ狙う
	elseif my_act==306 and enemy_act>=70 and enemy_act<=80 and dis<100 and my_rei>=200 and (y-ey)<0 and x>240 and x<1040 and my_limit==0 and my_xspeed>2 and my_yspeed>=0 and weather~=12 then
		key_reset();
		key_event2(ACT_A,ACT_UP);
		wait(20);
		key_event(ACT_B);
		wait(18);
		key_event(front);
		key_event(front);
		wait(7);
		key_event2(ACT_A,ACT_UP);
		wait(30);
--JA空中ヒットからJ2B、J6A、J8A
	elseif dis<300 and my_act==306 and enemy_act>=70 and enemy_act<=80 and ey>0 and (my_hitstop>0 or my_allframe>=7) then
		if (dis<100 or (dis<150 and my_xspeed>=4) or (dis<200 and my_xspeed>=8)) and (y-ey)>-40 and (ey-y)<250 and my_rate<0.55 and my_xspeed>=0 and my_limit>=60 then
			key_reset();
			key_event2(ACT_A,ACT_UP);
		elseif my_combo==1 and (dis<100 or my_correction==32) and (y-ey)<160 and (ey-y)<40 and my_xspeed>=4 and my_frontside>600 then
			key_reset();
			key_event2(ACT_B,ACT_DOWN);
		elseif (y-ey)<100 and (ey-y)<100 and my_rate>=0.55 then
			key_reset();
			key_event2(ACT_A,front);
		elseif (dis<100 or (dis<150 and my_xspeed>=4) or (dis<200 and my_xspeed>=8)) and (y-ey)<-20 and (ey-y)<250 and my_xspeed>=0 then
			key_reset();
			key_event2(ACT_A,ACT_UP);
		elseif (y-ey)<200 and (ey-y)<-40 and my_xspeed>=3 and my_yspeed>5 and my_rei>=300 and my_rate>=0.80 then
			key_reset();
			key_event2(ACT_B,ACT_DOWN);			
		end
--JA地上ヒット時の繋ぎ。前慣性が利いてて密着なら着地AかJ2B、そうでなければ2AかDAに繋ぐ
	elseif dis<=400 and (my_act<=10 or my_act==306 or my_act==308) and y<=240 and enemy_act>=50 and enemy_act<=64 then
		if ((dis<(120+my_xspeed) and enemy_act==51) or (dis<(170+my_xspeed) and enemy_act==52)) and my_hitstop>0 and my_hitstop<8 and my_xspeed>=0 and my_air<=1 and y>(20-my_yspeed*5) then
			key_reset();
			key_on(ACT_DOWN)
			yield()
			key_event(ACT_B);
		elseif dis<=400 and dis>280 and (y-my_yspeed*2)<=0 and my_hitstop==0 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
		elseif dis<=280 and dis>180 and (y-my_yspeed*2)<=0 and my_hitstop==0 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
			key_event(ACT_A);
		elseif dis<=180 and dis>80 and (y-my_yspeed*2)<=0 and my_hitstop==0 then
			key_reset();
			key_event2(ACT_A,ACT_DOWN);
		elseif dis<=75 and (enemy_act==51 or enemy_act==63) and my_xspeed>=0 and y<=20 and my_hitstop==0 then
			key_reset();
			key_event(ACT_A);
		end
--J6AJ5C。ある程度壁が近いか、カウンターヒットした時だけ繋げる。端付近かつLimit低めなら軽くディレイ掛けて高度確保+接近。
	elseif my_act==307 and enemy_act>=70 and enemy_act<=80 and my_rei>=200 and ((my_hitstop>0 and my_hitstop<8) or my_frame>=15) then
		if ((x<200 and my_dir==1) or (x>1080 and my_dir==-1)) and y>100 and my_combo<=3 and my_limit<=40 and my_frame<28 then
			key_reset();
			wait(11);
			key_event(ACT_C);
		elseif ((x>480 and my_dir==1) or (x<800 and my_dir==-1)) and my_frame<28 then
			key_reset();
			key_event(ACT_C);
		elseif my_combo==1 and (my_dam>850 or (my_dam>800 and enemy_hp<5000)) then
			key_reset();
			key_event(ACT_C);
		end
--J8Aからの繋ぎ。通常ヒット時はJ5Bに、カウンターヒット時は壁までの距離に応じてディレイJ5Cと溜めJ5Cを使い分ける
--画面端でCHした時は繋がる技が無いので、JBを空撃ちしてキャンセル飛翔で追い掛ける
	elseif my_act==309 and enemy_act>=70 and enemy_act<=80 and my_rei>=200 and y<550 and ((my_hitstop>0 and my_hitstop<8) or my_frame>=9) then
		if my_combo==1 and (my_dam>850 or (my_dam>800 and enemy_hp<5000)) and ((x<650 and my_dir==1) or (x>630 and my_dir==-1)) then
			key_reset();
			wait(21);
			key_event(ACT_C);
		elseif my_combo==1 and my_correction==33 and ((x>=1040 and my_dir==1) or (x<=240 and my_dir==-1)) and my_rei>=400 then
			key_reset();
			key_event(ACT_B)
			wait(6);
			key_on(ACT_UP)
			key_on(ACT_D)
			wait(15)
			if dis<80 then
				key_on(back)
			else
				key_on(front)
			end
			wait(20);
			key_reset();
			wait(5)
			key_event(ACT_A)
		elseif my_combo==1 and my_correction==33 and ((x>=740 and my_dir==1) or (x<=540 and my_dir==-1)) then
			key_reset();
			key_on(ACT_C)
			wait(35)
		elseif (y-ey)<110 and (ey-y)<20 then
			key_reset();
			key_event(ACT_B);
			wait(21);
		elseif (y-ey)<-40 and (ey-y)<80 then
			key_reset();
			wait(6);
			key_event(ACT_B);
			wait(15);
		elseif (y-ey)<-80 and (ey-y)<250 and ((x<1090 and my_dir==1) or (x>190 and my_dir==-1)) then
			key_reset();
			wait(9);
			key_event(ACT_B);
			wait(15);
		end
--遠Aからの繋ぎ。2Bか6Aへ
	elseif my_act==301 and enemy_act>=50 and enemy_act<=80 and my_frame>=11 and my_hitstop>0 and my_hitstop<9 then
		if my_rei>=400 and dis<160 and ((x<840 and my_dir==1) or (x>440 and my_dir==-1)) then
			key_reset();
			key_on(ACT_DOWN)
			yield();
			key_event(ACT_B);
		elseif dis<=190 and ((x>=840 and my_dir==1) or (x<=440 and my_dir==-1) or (dis>120 and (enemy_char==12 or enemy_char==14)) or dis>145 or my_frame>=13) then
			key_reset();
			yield();
			key_event2(ACT_A,front);
		elseif enemy_act>=70 then
			key_reset();
			yield();
			key_event2(ACT_A,front);
		else
			key_reset();
			key_on(ACT_DOWN)
			yield();
			key_event(ACT_B);
		end
--2A2Bか2A6A。鬼縛陣セット中か中央なら2B。それ以外では6Aに繋ぐ。遠過ぎる場合は2A全段当て。
--画面端かつ密着で2Aが当たったらBに繋げて画面端コンボに。失敗すると勿体無いので使用条件は厳しく設定
	elseif my_act==303 and enemy_act>=50 and enemy_act<=64 and my_frame>6 then
		if dis<85 and ((ex>1235 and my_dir==1) or (ex<45 and my_dir==-1)) and my_limit<45 and my_rei>=600 and enemy_char~=12 and
		((enemy_act==57 and enemy_char~=2 and enemy_char~=3 and enemy_char~=7 and enemy_char~=14) or
		(enemy_act==63 and enemy_char~=0 and enemy_char~=4 and enemy_char~=5 and enemy_char~=8)) then
			if dis<60 then
				wait(3);
				ex_combo = 1;
				key_reset();
				yield();
				key_event(ACT_B);
			else
				ex_combo = 1;
				key_reset();
				yield();
				key_event(ACT_B);
			end
		elseif my_rei>=400 and dis<160 and my_frontside>400 then
			if (my_preact[1]==306 or my_preact[1]==308) then
				key_reset();
				key_on(ACT_DOWN)
				yield();
				key_event(ACT_B);
			elseif dis<150 and (dis>120 or my_frame>=13) then
				key_reset();
				key_on(ACT_DOWN)
				key_on(ACT_D)
				yield();
				key_off(ACT_D);
				key_event(ACT_B);
			end
		elseif is_card_use and my_rei>=200 and dis<160 and my_card==206 then
			if (my_preact[1]==306 or my_preact[1]==308) then
				key_reset();
				key_on(ACT_DOWN)
				yield();
				key_event(ACT_B);
			elseif dis<150 and (dis>120 or my_frame>=13) then
				key_reset();
				key_on(ACT_DOWN)
				key_on(ACT_D)
				yield();
				key_off(ACT_D);
				key_event(ACT_B);
			end
		elseif dis<=220 and ((my_frontside>120 and my_frontside<=400) or (dis>120 and (enemy_char==12 or enemy_char==14)) or dis>145 or my_frame>=13) then
			key_reset();
			yield();
			key_event2(ACT_A,front);
		elseif my_frame>=14 and enemy_frame<=1 and is_card_use and my_card==209 and dis<280 then
			key_reset();
			key_on(ACT_BC);
			yield();
			key_reset();
		end
--AAA(Aヒット時にAA)
	elseif my_act==300 and enemy_act>=50 and enemy_act<=64 then
		key_reset();
		key_event(ACT_A);
	elseif my_act==320 and enemy_act>=50 and enemy_act<=64 then
		key_reset();
		yield();
		key_event(ACT_A);
--4A。適当に刻んだ後、コンボにはならないが確率で2Bや6Aに連携。たまに不意打ちでクラッシュも狙ってみる
	elseif my_act==330 and enemy_act>=50 and enemy_act<=64 and my_hitstop>0 and my_hitstop<8 then
		if dis<100 and my_combo==1 then
			key_reset();
			key_event2(ACT_A,back)
		elseif my_rei>600 and math.random(4)==1 then
			key_reset();
			key_event2(ACT_B,ACT_DOWN)
		elseif math.random(3)==1 then
			key_reset()
			key_event2(ACT_A,front)
		elseif enemy_rei>=600 and muteki_sp==0 and math.random(20)==1 then
			if math.random(2)==1 then
				key_reset();
				yield();
				key_on(ACT_A);
				key_on(front);
				wait(25);
				key_reset();
			else
				key_reset();
				yield();
				key_on(ACT_A);
				key_on(front);
				key_on(ACT_DOWN)
				wait(25);
				key_reset();
			end
		else
			key_reset();
			wait(15)
		end
--AAABかAAA2BかAAAA。鬼縛陣が有ればAAA2B鬼縛陣。無ければ端までの距離と霊力で決める。空中ヒット時はAAA6B
--AAABはキャラ限定や端限定などの制限事項が多いので使用条件をかなり厳しく
	elseif my_act==321 and enemy_act>=50 and enemy_act<=80 and ((my_hitstop>0 and my_hitstop<8) or my_frame>9) then
		if dis<85 and ((ex>1235 and my_dir==1) or (ex<45 and my_dir==-1)) and my_limit<45 and my_rei>=600 and enemy_act<=64 and enemy_char~=12 and
		((enemy_act==57 and enemy_char~=2 and enemy_char~=3 and enemy_char~=7 and enemy_char~=14) or
		(enemy_act==63 and enemy_char~=0 and enemy_char~=4 and enemy_char~=5 and enemy_char~=8)) then
			ex_combo = 1;
			key_reset();
			yield();
			key_event(ACT_B);
		elseif my_rei>=400 and ((ex>1200 and my_dir==1) or (ex<80 and my_dir==-1)) and my_limit==0 and enemy_act<=64 then
			key_reset();
			key_event(ACT_A);
		elseif is_card_use and my_rei>=200 and my_card==206 and my_limit<40 and enemy_act<=64 then
			key_reset();
			yield();
			key_event2(ACT_B,ACT_DOWN);
		elseif is_card_use and my_card==209 and ((x<=610 and my_dir==-1) or (x>=670 and my_dir==1)) and enemy_act<=64 then
			key_reset();
			key_event(ACT_A);
		elseif is_card_use and my_card==209 and my_rei>=200 and dis<100 and ((x<680 and my_dir==1) or (x>600 and my_dir==-1)) and my_limit<75 and enemy_act<=64 and enemy_char~=5 and enemy_char~=12 and enemy_char~=14 and
		((enemy_act==57 and enemy_char~=2 and enemy_char~=3 and enemy_char~=7) or
		(enemy_act==63 and enemy_char~=0 and enemy_char~=4 and enemy_char~=8)) then
			key_reset();
			yield();
			key_event(ACT_B);
		elseif my_rei>=700 and ((x<680 and my_dir==1) or (x>600 and my_dir==-1)) and my_limit<60 and enemy_act<=64 then
			key_reset();
			yield();
			key_event2(ACT_B,ACT_DOWN);
		elseif ey>=40 then
			key_reset();
			key_on(front)
			yield()
			key_event(ACT_B);
		else
			key_reset()
			key_event(ACT_A)
		end
--2Bからの繋ぎ。八方鬼縛陣をセットしていたら使い、無ければ昇天脚。霧雨もしくは鬼縛陣が引けていない時は宝玉も使用
	elseif my_act==402 and enemy_act>=50 and enemy_act<=80 then
		if is_card_use and (enemy_act<=64 or enemy_xspeed<=1) and my_card==206 and dis<200 then
			key_reset();
			key_on(ACT_BC);
			wait(1);
			key_reset();
		elseif my_card==209 and dis<270 and dis>100 and (weather==1 or my_spell>=2000) then
			key_reset();
			key_on(ACT_BC);
			wait(1);
			key_reset();
		elseif dis<230 and my_allframe>5 then
			key_reset();
			lvr623(ACT_B);
		end
--6Aからの繋ぎ。端近くなら昇天脚。ちょっと端が遠ければ5B、もう少し遠いは5C。CHしたら5Cか溜め6B。端コン中は2C
	elseif my_act==302 and enemy_act>=70 and enemy_act<=80 and my_rei>=200 and ((my_hitstop>0 and my_hitstop<8) or my_frame>=16) then
		if ((x<=160 and my_dir==-1) or (x>=1120 and my_dir==1)) and dis<100 and (my_preact[1]==322 or my_preact[2]==322) and my_rei>=400 then
			key_reset();
			key_event2(ACT_C,ACT_DOWN);
		elseif my_combo==1 and my_correction==34 and my_frontside>=120 and my_frontside<=360 then
			key_reset();
			key_on(front);
			key_on(ACT_B);
			wait(16);
			key_reset();
		elseif my_conbo==1 and my_frontside>120 and my_frontside<220 and ey>50 and my_rei>=200 then
			key_reset();
			key_on(front)
			yield()
			key_event(ACT_B);
		elseif ((x<=390 and x>130 and my_dir==-1) or (x>=890 and x<1150 and my_dir==1)) and dis>150 and dis<270 and my_limit<50 then
			key_reset();
			key_event(ACT_B);
		elseif ((x<=280 and my_dir==-1) or (x>=1000 and my_dir==1)) and dis<200 then
			if my_limit>=60 then
				key_reset();
				lvr623(ACT_C);
			else
				key_reset();
				lvr623(ACT_B);
			end
		elseif (my_combo==1 and (my_dam>750 or (my_dam>800 and enemy_hp<5000))) or ((x<=520 and my_dir==-1) or (x>=760 and my_dir==1)) then
			key_reset();
			key_event(ACT_C);
		elseif my_rei==1000 then
			if ((x<=700 and my_dir==-1) or (x>=580 and my_dir==1)) and math.random(2)==1 then
				key_reset();
				lvr214(ACT_B);
			elseif ((x<=700 and my_dir==-1) or (x>=580 and my_dir==1)) then
				key_reset();
				lvr214(ACT_C);	
			else
				key_reset();
				wait(7+math.random(6));
				lvr214(ACT_C);
			end
		end
--5Bが地上ヒットした時の繋ぎ。スペカか低空J6Aに
	elseif my_act==400 and enemy_act>=50 and enemy_act<=64 and enemy_hitstop>0 then
		if my_allframe>=26 and is_card_use and my_card==206 and dis<200 then
			key_reset();
			key_on(ACT_BC);
			yield();
			key_reset();
		elseif my_allframe>=26 and is_card_use and my_card==209 and dis<300 then
			key_reset();
			key_on(ACT_BC);
			yield();
			key_reset();
		elseif my_allframe==17 and enemy_act==51 and dis<260 then
			key_reset();
			key_on(front)
			key_on(ACT_UP)
			wait(5)
			key_off(ACT_UP)
			key_event(ACT_A)
		end
--A、AA、4Aが空中ヒットしたら3Aに。4Aは空中ガード狩りなので狙える位置なら6Bに繋ぐ
	elseif (((my_act==300 or my_act==330) and my_frame>=5) or (my_act==320 and my_frame>=4)) and my_hitstop>0 and enemy_act>=70 and enemy_act<=80 then
		if my_act==330 and ey>=35 and (my_frontside<100 or dis<=50) then
			key_reset()
			key_event2(ACT_B,front)
		else
			key_reset();
			key_on(ACT_DOWN);
			key_event2(ACT_A,front);
		end
--3A根元ヒットからの繋ぎ。画面端ならC昇天脚。手札に有れば八方鬼縛陣
	elseif my_act==304 and dis<120 and my_allframe<16 and y==0 and my_hitstop>0 and my_hitstop<8 and enemy_act==77 then
		if card_check(206) and my_spell_more(2000) and my_correction==1 then
			key_reset();
			card_use(206);
		elseif ((x<=180 and my_dir==-1) or (x>=1100 and my_dir==1)) and ey<80 then
			key_reset();
			lvr623(ACT_C);
		end
--DA通常ヒットからの繋ぎ。手札にあれば宝玉か鬼縛陣、無ければ昇天脚。しゃがみヒットには距離制限を厳しく。
	elseif my_act==305 and enemy_act>=50 and enemy_act<=80 and enemy_act~=53 and enemy_act~=65 and my_frame>8 then
		if dis>150 and (my_combo>=2 or my_correction==4) and my_hitstop>0 and card_check(209) and my_spell_more(1500) then
			key_reset();
			card_use(209);
		elseif (dis<120 or (weather==12 and dis<70)) and ((enemy_act==52 or enemy_act==64) or (ey>0 and my_frontside<140)) and (my_correction~=32 or ey>50) and my_combo<=2 and my_hitstop>0 and use_kibaku==2 and card_check(206) then
			key_reset();
			key_on(ACT_BC);
			yield();
			key_reset();
		elseif dis<100 and my_frontside<120 and my_hitstop>0 and ey>20 and my_hitstop<9 and my_limit==0 and (my_combo==1 or (is_card_use and (my_card==201 or my_card==208 or my_card==209))) then
			key_reset();
			lvr623(ACT_C);
		elseif dis<95 and my_hitstop>0 and my_hitstop<9 and ey>0 and (my_combo>1 or my_correction~=32 or (x>1100 and my_dir==1) or (x<180 and my_dir==-1)) then
			key_reset();
			card_use(103);
		elseif dis<95 and my_hitstop>0 and my_hitstop<9 and ey>0 and (my_combo>1 or my_correction~=32 or (x>1100 and my_dir==1) or (x<180 and my_dir==-1)) then
			key_reset();
			lvr623(ACT_B);
		elseif ((dis<130 and enemy_act==52 and enemy_frame>4 and enemy_frame<7) or (dis<90 and enemy_act==64 and enemy_frame>4 and enemy_frame<8) or (dis<70 and enemy_act==52 and enemy_frame==0) or (dis<60 and enemy_act==64 and enemy_frame==0)) and is_card_use and (my_card==209 or ((my_card==201 or my_card==208) and my_frontside<120)) then
			key_reset();
			lvr623(ACT_C);
		elseif (dis<140 and enemy_act==52 and enemy_frame>4 and enemy_frame<7) or (dis<100 and enemy_act==64 and enemy_frame>4 and enemy_frame<8) or (dis<80 and enemy_act==52 and enemy_frame==0) or (dis<60 and enemy_act==64 and enemy_frame==0) then
			key_reset();
			card_use(103);
		elseif (dis<140 and enemy_act==52 and enemy_frame>4 and enemy_frame<7) or (dis<100 and enemy_act==64 and enemy_frame>4 and enemy_frame<8) or (dis<80 and enemy_act==52 and enemy_frame==0) or (dis<60 and enemy_act==64 and enemy_frame==0) then
			key_reset();
			lvr623(ACT_B);
		elseif my_combo==1 and my_frontside<100 and ey>0 and my_frame>=32 then
			key_reset()
			key_event(ACT_A)
		elseif dis<300 and card_check(104) and ((x<940 and my_dir==1) or (x>340 and my_dir==-1)) then
			key_reset();
			--print("DA(ch)＞妖怪バスター");
			card_use(104);
		elseif dis<300 and get_skill_lv(0,4)>=0 and ((x<940 and my_dir==1) or (x>340 and my_dir==-1)) then
			key_reset();
			--print("DA(ch)＞妖怪バスター");
			key_on(ACT_D);
			wait(2);
			key_reset();
			lvr236(ACT_B);
		end
--DAカウンターヒットからの繋ぎ。陰陽宝玉セット中で端が遠ければ繋げる。端ならAか2Aで追撃。
--妖怪バスタールート追加。
	elseif (my_act<=10 or my_act==305) and (enemy_act==53 or enemy_act==65) then
	--print("DA(ch)＞");
		if dis<300 and card_check(104) and card_check(209) and my_spell_more(1500) and ((x<940 and my_dir==1) or (x>340 and my_dir==-1)) then
			key_reset();
			--print("DA(ch)＞バスター＞宝玉");
			while (my_act==305 and not(my_act>=505 and my_act<=508)) do
				card_use(104);
				yield();
			end
			while (my_act>=505 and my_act<=508) do
				card_use(209);
				yield();
			end
		elseif dis<300 and get_skill_lv(0,4)>=0 and card_check(209) and my_spell_more(1000) and ((x<940 and my_dir==1) or (x>340 and my_dir==-1)) then
			key_reset();
			--print("DA(ch)＞バスター＞宝玉");
			while (my_act==305 and not(my_act>=505 and my_act<=508)) do
				wait(2);
				lvr236(ACT_B);
			end
			while (my_act>=505 and my_act<=508) do
				card_use(209);
				yield();
			end
		elseif dis<300 and card_check(209) and my_spell_more(1000) and ((x<940 and my_dir==1) or (x>340 and my_dir==-1)) then
			key_reset();
			--print("DA(ch)＞宝玉");
			loop_count = 0
			while (card_check(209) and my_card~=209) do
				card_1st(209);
				yield();
				loop_count = loop_count + 1
			end
			wait(20-loop_count);
			card_use(209);
			yield();
			key_reset();
		elseif dis<300 and card_check(104) and ((x<940 and my_dir==1) or (x>340 and my_dir==-1)) then
			key_reset();
			--print("DA(ch)＞妖怪バスター");
			card_use(104);
		elseif dis<300 and get_skill_lv(0,4)>=0 and ((x<940 and my_dir==1) or (x>340 and my_dir==-1)) then
			key_reset();
			--print("DA(ch)＞妖怪バスター");
			key_on(ACT_D);
			wait(2);
			key_reset();
			lvr236(ACT_B);
		elseif dis<=260 and (dis>80 or weather==12) and my_frame>=32 then
			key_reset();
			--print("DA(ch)＞２Ａ");
			key_event2(ACT_A,ACT_DOWN);
		elseif dis<=80 and my_frame>=32 then
			--print("DA(ch)＞５Ａ");
			key_reset();
			key_event(ACT_A);
		end
--2Cからの繋ぎ。Limitが高い場合はコンボ後半と判断して昇天脚で締める
	elseif my_act==412 and enemy_act>=70 and enemy_act<=80 and dis<200 then
		if my_limit>=80 and my_rei>=200 and get_skill_lv(0,3)>=0 then
			key_reset();
			wait(2);
			lvr623(ACT_C);
		elseif my_limit<80 then
			key_reset();
			key_on(ACT_UP);
			wait(1);
			key_event(ACT_A)
		end
--B昇天脚がカウンターヒットした時、夢想封印が有れば繋ぐ
--C昇天脚追加。拡散結界を追加。
	elseif (my_act==560 or my_act==561) and my_correction==34 and my_combo==1 and my_hitstop>0 and card_check(201) and my_spell_more(2500) and my_frontside>300 then
		key_reset();
		wait(14)
		card_use(201);
		key_reset();
	elseif (my_act==560 or my_act==561) and my_correction==34 and my_combo==1 and my_hitstop>0 and card_check(207) and my_spell_more(1500) and my_frontside>300 then
		key_reset();
		wait(14)
		card_use(207);
		key_reset();
--C昇天脚がヒットした時、株・陰陽宝玉・夢想封印が有れば繋ぐ
	elseif my_act==561 and my_hitstop>0 and card_check(208) and dis<150 and my_limit<=40 and my_frontside<150 and (ex<90 or ex>1150) then
		key_reset();
		card_use(208);
	elseif my_act==561 and my_hitstop>0 and card_check(201) and my_spell_more(2500) and dis<150 and my_limit<=40 and my_frontside<150 and (ex<90 or ex>1150) then
		key_reset();
		card_use(201);
	elseif my_act==561 and y==0 and ey<=20 and my_hitstop>0 and card_check(209) and my_spell_more(1000) and dis<250 then
		key_reset();
		card_use(209);
--相手が浮いてたらJAやJ6Aで拾いを試みる(地上)
	elseif (my_act==400 or my_act==401 or my_act==402 or my_act==410 or my_act==500) and enemy_act>=70 and enemy_act<=80 and dis<=550 then
		if dis<330 and (ey>=100 or (my_act==400 and my_allframe>=28) or (my_act==401 and my_allframe>=28)) then
			key_reset();
			key_on(ACT_UP);
			key_on(front);
			yield()
		elseif my_act~=400 and my_act~=401 and dis<330 and ey<100 then
			key_reset();
			key_on(ACT_D);
			key_on(ACT_UP);
			key_on(front);
			wait(5);
			key_reset();
			key_event2(ACT_A,front);
		elseif my_act~=400 and my_act~=401 then
			key_reset();
			key_on(ACT_D);
			key_on(ACT_UP);
			key_on(front);
			yield();
		end
--相手が浮いてたらJAやJ8Aで拾いを試みる(空中・画面端)
	elseif (my_act==9 or (my_allframe>=21 and (my_act==414 or my_act==502))) and enemy_act>=70 and enemy_act<=80 and dis<95 and (x<150 or x>1130) and y>0 and my_air<=1 and weather~=12 then
		if ((y-ey)<30 and (ey-y)<250 and my_rate<0.64) or ((y-ey)<-80 and (ey-y)<250) then
			key_reset();
			key_event(back)
			key_on(back);
			yield();
			key_reset();
			key_on(ACT_UP)
			yield();
			key_event(ACT_A);
		else
			key_reset();
			key_event(back);
			key_on(back);
			yield();
		end
--相手が浮いてたらとりあえず前ダッシュして拾いに行ってみる(空中)
	elseif (my_act==9 or (my_allframe>=22 and (my_act==414 or my_act==502))) and my_act~=202 and my_preact[1]~=202 and enemy_act>=70 and enemy_act<=80 and my_air<=1 and dis<500 then
		if (y-ey)<300 and (ey-y)<-150 then
			key_reset();
			key_on(ACT_DOWN);
			key_on(ACT_D)
			key_on(front);
			yield();
		else
			key_reset();
			key_event(front);
			key_event(front);
		end
--空中射撃がヒットしたら空中ダッシュか飛翔で追撃に向かう
	elseif ((my_act==404 and my_allframe>=22) or (my_act==406 and my_allframe>=21) or (my_act==414 and my_allframe>=22) or my_act==416 or ((my_act==404 or my_act==406) and (y-my_yspeed*4)<0)) and y>0 and enemy_act>=50 and enemy_act<=80 and my_rei>=100 and my_air<=1 then
		if dis<200 and ((x<100 and my_dir==-1) or (x>1180 and my_dir==1)) and (y-ey)<90 and (ey-y)<100 and enemy_act>=70 then
			key_reset();
			key_event(back);
			key_on(back);
			yield();
		elseif (y<200 and ey==0 and (dis>300 or (ex<60 or ex>1220))) or (y<120 and ey==0) then
			key_reset();
			key_on(ACT_D);
			key_on(front);
			yield();
		elseif (y-ey)<100 and (ey-y)<150 and y>40 then
			key_reset();
			key_event(front);
			key_event(front);
		elseif (y-ey)<140 and (ey-y)<50 and ey>20 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
			yield();
		elseif (y-ey)<-150 and (ey-y)<260 and dis<300 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
			key_on(ACT_UP)
			yield();
		elseif (((y-ey)<400 and (ey-y)<-100) or (y<400 and ey==0)) and dis<400 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
			key_on(ACT_DOWN)
			yield();
		else
			key_reset();
			key_event(front);
			key_event(front);
		end
--壁バウンドの拾い各種。基本的にJAで拾い、端密着くらいの時のみDAか6Aを使う。真上にバウンドしてきた時は時々拾い損ねる。
--ある程度壁から離れていて、手札に陰陽宝玉があれば繋ぐ。そこから更に拾えそうならDA、DC、昇天脚で追撃するかもしれない
	elseif dis<=400 and ((my_act<=5 and my_preact[1]==322 and my_frame<=1) or (my_act==322 and my_frame>=44)) and (enemy_act==76 or enemy_act==78) and ((x<=530 and x>190 and my_dir==-1) or (x>=750 and x<1090 and my_dir==1)) and my_rate>0.63 and card_check(209) and my_spell_more(1000) then
		key_reset();
		card_use(209);
	elseif dis<=350 and ((my_act<=5 and my_preact[1]==609) or (my_act==609 and my_allframe>110)) and (enemy_act==76 or enemy_act==78) and ((x<=390 and x>120 and my_dir==-1) or (x>=890 and x<1120 and my_dir==1)) then
		if dis<280 and my_rate>0.54 and ey>50 and my_act==609 and card_check(103) then
			key_reset();
			card_use(103);
		elseif dis<280 and my_rate>0.54 and ey>50 and my_act==609 and get_skill_lv(0,3)>=0 then
			key_reset();
			lvr623(ACT_B);
		elseif (my_act<=5 or (my_act==609 and my_allframe>=115)) then
			key_reset();
			key_on(ACT_D);
			key_on(front);
			yield();
			key_event2(ACT_A,front)
			key_reset();
		end
	elseif dis<=250 and ey>50 and ((my_act<=5 and my_preact[1]==322) or (my_act==322 and my_frame>40)) and (enemy_act==76 or enemy_act==78) and ((x<=390 and x>120 and my_dir==-1) or (x>=890 and x<1120 and my_dir==1)) and (my_limit>=60 or my_rate<0.60) and card_check(103) then
		key_reset();
		card_use(103);
	elseif dis<=250 and ey>50 and ((my_act<=5 and my_preact[1]==322) or (my_act==322 and my_frame>40)) and (enemy_act==76 or enemy_act==78) and ((x<=390 and x>120 and my_dir==-1) or (x>=890 and x<1120 and my_dir==1)) and (my_limit>=60 or my_rate<0.60) and get_skill_lv(0,3)>=0 then
		key_reset();
		lvr623(ACT_B);
	elseif dis<=400 and dis>250 and (my_act<=5 or my_act==200 or (my_act==322 and my_frame>=44)) and (enemy_act==76 or enemy_act==78) and ((x<=440 and my_dir==-1) or (x>=840 and my_dir==1)) then
		if my_rate<0.60 or my_preact[1]==322 or my_preact[2]==322 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
			yield();
			key_event2(ACT_C,front)
			key_reset();
		else
			key_reset();
			key_on(ACT_D);
			key_event2(ACT_UP,front);
			wait(3);
			key_event(ACT_A);
			key_reset();
		end
	elseif dis<=250 and dis>100 and (my_act<=5 or (my_act==322 and my_frame>=44)) and (enemy_act==76 or enemy_act==78) and ((x<=440 and my_dir==-1) or (x>=840 and my_dir==1)) then
		key_reset();
		key_event2(ACT_UP,front);
		wait(1);
		key_event(ACT_A);
		key_reset();
	elseif dis<=250 and (my_act<=5 or (my_act==322 and my_frame>=44)) and (enemy_act==76 or enemy_act==78) and ((x>=1040 and my_dir==-1) or (x<=240 and my_dir==1)) then
		key_reset();
		key_on(front);
		key_event(ACT_UP);
		wait(1);
		key_reset();
		key_event(ACT_A);
		key_reset();
	elseif dis<=50 and (my_act<=5 or my_act==200 or (my_act==322 and my_frame>=43)) and (enemy_act==76 or enemy_act==78) and ((x<=120 and my_dir==-1) or (x>=1160 and my_dir==1)) and ey<110 then
		if enemy_char~=2 and enemy_char~=5 and enemy_char~=13 and my_combo<=4 and my_rei>180 and weather~=10 and weather~=12 then
			key_reset();
			wait(11)
			command("A(10)A(10)A(9)");
				if my_hitstop>0 then
					key_on(front)
					yield();
					key_event(ACT_B)
				end
		elseif my_limit<=55 then
			key_reset();
			key_event2(ACT_A,front);
			key_reset();
		else
			key_reset();
			key_on(ACT_D);
			key_on(front);
			yield();
			key_event2(ACT_A,front)
			key_reset();
		end		
	elseif dis<=100 and (my_act<=5 or (my_act==322 and my_frame>=44)) and (enemy_act==76 or enemy_act==78) and ((x<=240 and my_dir==-1) or (x>=990 and my_dir==1)) and ey>=110 then
		if my_rate<0.60 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
			yield();
			key_event2(ACT_A,front)
			key_reset();
		else
			key_reset();
			key_on(back);
			key_event(ACT_UP);
			wait(1);
			key_reset();
			key_event(ACT_A);
			key_reset();
		end
--亜空穴BがカウンターヒットしたらJ2Bで拾う。
	elseif dis<=300 and enemy_act==89 and my_act<=10 then
		if dis<80 and (ex<60 or ex>1180) then
			key_reset();
			key_event(ACT_UP);
			wait(1);
			key_event2(ACT_B,ACT_DOWN);
			wait(18)
			key_event(back)
			key_event(back)
		else
			key_reset();
			key_event(ACT_UP);
			wait(1);
			key_event2(ACT_B,ACT_DOWN);
			wait(18)
			key_event(front)
			key_event(front)
		end
--近距離で行動可能時に相手がのけぞっていたら適当な技で追撃
	elseif dis<=300 and enemy_act>=50 and enemy_act<=64 and y==0 and (my_act<=5 or my_act==200 or my_act==204) then
		if dis<=300 and dis>240 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
		elseif dis<=220 and dis>160 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
			key_event(ACT_A);
		elseif dis<=160 and dis>70 then
			key_reset();
			key_event2(ACT_A,ACT_DOWN);
		elseif dis<=70 then
			key_reset();
			yield();
			key_event(ACT_A);
		end
--近距離〜中距離で相手が浮いていたら追い掛ける
	elseif dis<=500 and enemy_act>=50 and enemy_act<=80 and y==0 and (my_act<=5 or my_act==200) then
		if enemy_act<=64 or dis>280 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
		elseif dis<=280 and ey>=20 and enemy_frame<=10 then
			key_reset();
			key_on(ACT_D);
			key_on(front);
			key_on(ACT_UP);
		end
--▲輸入コンボ▲
--AAAA連携
--AA
	elseif my_act==300 and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		--print("コンボ：A>ＡＡ");
		key_event(ACT_A);
	--AAA
		elseif ey==0 and my_act==320 and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
			--print("コンボ：AA>ＡＡＡ");
			key_event(ACT_A);
		--AAAA：霊力がない場合のみ派生
			elseif ey==0 and my_act==321 and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true and my_rei<200 then
				--print("コンボ：AAA>ＡＡＡＡ");
				key_event(ACT_A);
--A>6C
	elseif (my_act==300 or my_act==330) and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=145)) and ey>0 and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true and my_rei>=200 then
		--print("近A or 4A>C");
		key_event(ACT_C);
--遠A>C
	elseif my_act==301 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=2 and my_allframe>=18 and is_dir_front==true and my_rei>=200 then
		key_resetEX();
		--print("遠Ａ＞C");
		key_event(ACT_C);
--遠A>3A
	elseif my_act==301 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true and my_rei<200 then
		key_resetEX();
		--print("遠Ａ＞３Ａ");
		key_event2(ACT_A,d_front);
--3A>C
	elseif (my_act==302 or my_act==304) and 
	(
	(enemy_act>=50 and enemy_act<=89 and weather==18) or 
	(enemy_act>=50 and enemy_act<=89 and my_correction>=32 and ((my_dir==1 and x>=880)or(my_dir==-1 and x<=400))) or
	(enemy_act>=150 and enemy_act<=166)
	) and 
	my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		--print("３Ａ＞Ｃ");
		key_event(ACT_C);
--JC>J66>JA
	elseif my_act==414 and my_frame+1>=20 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and is_dir_front==true and (my_air<=1 or (my_air<=2 and weather==10)) then
		key_resetEX();
		--print("JC＞Ｊ66");
		lvr66();
	elseif my_act==202 and my_allframe>=0 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and is_dir_front==true and (my_air<=1 or (my_air<=2 and weather==10)) then
		key_resetEX();
		--print("Ｊ66>JA");
		key_event(ACT_A);
	
--JA>J8A>JC
	elseif my_act==306 and ey>=y and ey>0 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		key_resetEX();
		if my_hitstop>=1 then
			wait(my_hitstop);
		end
		--print("ＪＡ＞Ｊ８Ａ"); --空中のみ
		key_event2(ACT_A,ACT_UP);
	elseif my_act==309 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		key_resetEX();
		if my_hitstop>=1 then
			wait(my_hitstop);
		end
		--print("Ｊ8Ａ＞ＪＣ");
		key_event(ACT_C);
--JA>J6A>JC or J6B or J6C
	elseif my_act==306 and ey<=y and ey>0 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		key_resetEX();
		--print("ＪＡ＞Ｊ６Ａ"); --空中のみ
		key_event2(ACT_A,front);
		elseif my_act==308 and ((my_dir==1 and x>=880)or(my_dir==-1 and x<=400)) and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
			key_resetEX();
			if my_hitstop>=1 then
				wait(my_hitstop+5);
			end
			--print("Ｊ8Ａ＞ＪＣ");
			key_event(ACT_C);
		elseif my_act==308 and ((my_dir==1 and x>=580)or(my_dir==-1 and x<=700)) and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
			key_resetEX();
			--print("Ｊ8Ａ＞Ｊ6B");
			key_event2(ACT_C,front);
		elseif my_act==308 and ((my_dir==1 and x>=80)or(my_dir==-1 and x<=1200)) and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
			key_resetEX();
			--print("Ｊ8Ａ＞Ｊ6C");
			key_event2(ACT_C,front);
--JA>JC
	elseif my_act==306 and  y+my_yspeed/5*17>=1 and
	((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=145)) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		key_resetEX();
		--print("ＪＡ＞ＪＣ");
		key_event(ACT_C);
--J6A>234B
	elseif my_act==307 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		key_resetEX();
		--print("Ｊ６Ａ＞コマンド：２３６B");
		lvr236(ACT_B);
--J2A>214コマンド
	elseif my_act==308 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=2 and my_allframe>=24 and is_dir_front==true then
		key_resetEX();
		--print("Ｊ２Ａ＞２１４スキル");
		lvr214(ACT_C);
		
--AAA>C>スキル
--AAA>C
	elseif my_act==321 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=145)) and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true then
		--print("AAA>C");
		if math.random(2)==1 then
			wait(4);
			if enemy_act>=220 and enemy_act<=226 then
				key_event(ACT_A);
			else
				key_event2(ACT_A,d_front);
			end
		elseif math.random(2)==2 then
			key_event(ACT_C);
			wait(2);
		end
	--C>スキル
		
--J6A or J2A > C
	elseif (my_act==307 or my_act==308 or my_act==309) and enemy_act>=143 and enemy_act<=166 and my_hitstop<=3 and my_hitstop>=2 and is_dir_front==true and ((my_yspeed*1/5*20>=1 and my_yspeed*1/5*30<=0)or(my_air<=1 or (my_air<=2 and weather==10))) then
			--print("〜>C");
			key_event(ACT_C);
	
		
				  
--▼固め▼
--AAA or 3A >C>9hj>J2A>JC>66>JA>AAA (以下ループ)
--AAA>C
	elseif my_act==321 and (enemy_act>=150 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 then
		--print("AAA>C");
		key_resetEX();
		key_event(ACT_C);
--3A>C
	elseif my_act==304 and (enemy_act>=150 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 then
		--print("3A>C");
		key_resetEX();
		key_event(ACT_C);
	--C>9hj
		elseif my_act==410 and (enemy_act>=143 and enemy_act<=166) and my_allframe>=28 then
			--print("C>9hj");
			key_resetEX();
			key_on(u_front);
		--9hj>J2A
			elseif my_act==209 and
				(ex-x)*my_dir-(my_xspeedEX/2*17+enemy_xspeed*17)		<=	100+30 	and
				(ey+enemy_yspeed*5+(5*(4*e_gs))/2)	-	(y+my_yspeed/5*17)	<=	120  and (enemy_act>=143 and enemy_act<=166) and my_allframe>=6 then
				--print("9hj>J2A");
				key_resetEX();
				key_event2(ACT_A,ACT_DOWN);
			--J2A>C
				elseif my_act==308 and (enemy_act>=150 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 then
					--print("J2A>C");
					key_resetEX();
					key_event(ACT_C);
		----9hj>J6A
			elseif my_act==209 and 
				(ex-x)*my_dir-(my_xspeedEX/5*15+enemy_xspeedEX*15)		<=	220+30 	and
				(ey+enemy_yspeed*5+(5*(4*e_gs))/2)	-	(y+my_yspeed/5*15)	<=	140 and (enemy_act>=143 and enemy_act<=166) and my_allframe>=6 then
				--print("9hj>J6A");
				key_resetEX();
				key_event2(ACT_A,front);
			--J6A>C
				elseif my_act==307 and (enemy_act>=150 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=2 then
					--print("J6A>C");
					key_resetEX();
					key_event(ACT_C);----
				--C>J66
					elseif my_act==414 and (enemy_act>=150 and enemy_act<=166) and my_allframe>=25 then
						--print("C>9hj");
						key_resetEX();
						lvr66();
						wait(2)
					--J66>JA
						elseif my_act==202 and (enemy_act>=150 and enemy_act<=166) and my_allframe>=4 then
							--print("9hj>J2A");
							key_resetEX();
							key_event(ACT_A);
						--JA>着地
							elseif my_act==306 and (enemy_preact[1]==202 or enemy_preact[1]==214) and y<=150 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=145)) and my_hitstop>=1 then
								wait(my_hitstop+2);
								--print("飛翔・空中ダッシュ>JA>着地");
								key_resetEX();
								if y/my_yspeed>=1 then
									wait(y/my_yspeed);
								end
--]]
		
--▼攻撃▼

--▼spell card▼

	--▼cost1

		--珠符「明珠暗投」 208,608,658,g,a
			--Ground,air
				elseif card_check(208)==true and
					my_spell_more(500) and
					dis>500 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

	--▼cost2

		--霊符「夢想妙珠」 200,600,650,g,a
			--Ground,air
				elseif card_check(200)==true and
					my_spell_more(1000) 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("霊符「夢想妙珠」");
						for i=1,10 do
							card_use(200);
							yield()
						end

		--宝符「陰陽宝玉」 209,609,g
			--Ground
				elseif card_check(209)==true and
					my_spell_more(1000) 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("宝符「陰陽宝玉」");
						for i=1,10 do
							card_use(209);
							yield()
						end
			
		--夢符「封魔陣」 204,604,g
			--Ground
				elseif card_check(204)==true and
					my_spell_more(1000) and
					dis<150 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(204);
							yield()
						end

	--▼cost3

		--神技「天覇風神脚」 214,614,g
			--Ground
				elseif card_check(214)==true and
					my_spell_more(1500) and
					dis<150 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(214);
							yield()
						end

		--結界「拡散結界」 207,607,657,g,a
			--Ground,air
				elseif card_check(207)==true and
					my_spell_more(1500) and
					dis2>300 and
					dis2<600 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					--is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("結界「拡散結界」");
						for i=1,10 do
							card_use(207);
							yield()
						end

	--▼cost4

		--神技「八方鬼縛陣」 206,606,g
			--Ground
				elseif card_check(206)==true and
					my_spell_more(2000) and
					dis<150 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("神技「八方鬼縛陣」");
						for i=1,10 do
							card_use(206);
							yield()
						end

		--宝具「陰陽鬼神玉」 210,610,g
			--Ground
				elseif card_check(210)==true and
					my_spell_more(2000) and
					dis>250 and
					dis<450 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(64)==1 then
						print("宝具「陰陽鬼神玉」");
						for i=1,10 do
							card_use(210);
							yield()
						end

	--▼cost5

		--神霊「夢想封印」 201,601,651,g,a
			--Ground,air
				elseif card_check(201)==true and
					my_spell_more(2500) 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("神霊「夢想封印」");
						for i=1,10 do
							card_use(201);
							yield()
						end

		--「夢想天生」 219,-,669,g,a
			--Ground
				elseif card_check(210)==true and
					my_spell_more(2500) 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

--▼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 subs_count>=530 and nega_count ~= 1 and math.random(2)==1 and
	(y+my_yspeed*14+(14*(13*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*14		<=	240+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*14		>=	20-30 	and
				(ey+enemy_yspeed*14+(14*(13*e_gs))/2)	-	(y+my_yspeed*14+(14*(13*m_gs))/2)	<=	180 	and
				(ey+enemy_yspeed*14+(14*(13*e_gs))/2)	-	(y+my_yspeed*14+(14*(13*m_gs))/2)	>=	40-120 	then
					--print("ＪＡ");
					key_resetEX();
					key_event(ACT_A);
--Ｊ６Ａ
	elseif	y>0 and (my_xspeed<0 or y<100) 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 subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and ((weather~=13) or (weather==13 and my_backside>=300)) and
	(y+my_yspeed*6+(6*(5*m_gs))/2)>0 	and
				(ex-x)*my_dir-(enemy_xspeedEX)*16		<=	160+80+30 	and
				(ex-x)*my_dir-(enemy_xspeedEX)*16		>=	0-30 	and
				(ey+enemy_yspeed*16+(16*(15*e_gs))/2)	-	(y+my_yspeed*2+(2*(1*m_gs))/2)	<=	140 		and
				(ey+enemy_yspeed*16+(16*(15*e_gs))/2)	-	(y+my_yspeed*2+(2*(1*m_gs))/2)	>=	90-120 	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 weather~=13 and my_airEX>=1 and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and
	(y+my_yspeed*19+(19*(18*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*19		<=	120+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*19		>=	30-30 	and
				(ey+enemy_yspeed*19+(19*(18*e_gs))/2)	-	(y+my_yspeed*19+(19*(18*m_gs))/2)	<=	130 			and
				(ey+enemy_yspeed*19+(19*(18*e_gs))/2)	-	(y+my_yspeed*19+(19*(18*m_gs))/2)	>=	-20-120 	then
					--print("Ｊ２Ａ");
					key_resetEX();
					key_event2(ACT_A,ACT_DOWN);
--Ｊ８Ａ
	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 subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and 
	(y+my_yspeed*6+(6*(5*m_gs))/2)>0 	and
				(ex-x)*my_dir-(enemy_xspeedEX)*11		<=	120+30 	and
				(ex-x)*my_dir-(enemy_xspeedEX)*11		>=	20-30 	and
				(ey+enemy_yspeed*11+(11*(10*e_gs))/2)	-	(y+my_yspeed*6+(6*(5*m_gs))/2)	<=	200+60 		and
				(ey+enemy_yspeed*11+(11*(10*e_gs))/2)	-	(y+my_yspeed*6+(6*(5*m_gs))/2)	>=	80-120 	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)==1) or (enemy_act>=50 and enemy_act<=166)) and
		(	
			(	dis>=120 and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		<=	210+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)	<=	110 		and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	>=	80-180
			) or
			(	dis<120 and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*10		<=	100+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)	<=	130 		and
				(ey+enemy_yspeed*10+(10*(9*e_gs))/2)	-	(y+my_yspeed*10+(10*(9*m_gs))/2)	>=	50-180
			)
		) and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		--print("対空Ａ");
		key_event(ACT_A);
--対空６Ａ
	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 subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*18		<=	180+90+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*18		>=	20+90-30 	and
				(ey+enemy_yspeed*18+(18*(17*e_gs))/2)	-	(y+my_yspeed*18+(18*(17*m_gs))/2)	<=	150 		and
				(ey+enemy_yspeed*18+(18*(17*e_gs))/2)	-	(y+my_yspeed*18+(18*(17*m_gs))/2)	>=	20-180		then
		--print("対空６Ａ");
		key_event2(ACT_A,front);
--対空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);--]]
--ダッシュ＞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 and math.random(4)==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 and math.random(4)==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 and math.random(4)==1 then
		--print("刻み４Ａ");
		key_event2(ACT_A,back);
		wait(3);
--Ａ
	elseif dis<=200 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<=300 and dis>=200 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);
--２Ａ
	elseif dis<=300 and dis>=0 and y==0 and ey==0 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_event2(ACT_A,ACT_DOWN);
--２Ｂ
	elseif dis<=300 and dis>=150 and y==0 and ey==0 and enemy_obj_range_in(150,60)==false and my_act<=10 and enemy_act>=300 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 
	my_rei>=600 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);
--６Ｂ
	elseif ey-y<=2*(ex-x)*my_dir and ey-y>=0.5*(ex-x)*my_dir and dis>=300 and y==0 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 
	enemy_obj_range_in(150,60)==false and 
	my_rei>=600 and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		--print("５Ｂ");
		key_event(ACT_B);
--５Ｂ
	elseif ey-y<=1*(ex-x)*my_dir and ey-y>=-1*(ex-x)*my_dir and dis>300 and y==0 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 
	enemy_obj_range_in(150,60)==false and 
	my_rei>=600 and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		--print("５Ｂ");
		key_event(ACT_B);
--Ｊ２Ｂ
	elseif ey-y<=-0.5*(ex-x)*my_dir and ey-y>=-4*(ex-x)*my_dir and y>0 and 
	my_act<300 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 
	enemy_obj_range_in(150,60)==false and 
	my_rei>=600 and is_dir_front==true and ((my_air==0 and y>=250) or (y-(my_yspeed*2+my_yspeed/5*18)<=0)) and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		--print("５Ｃ");
		key_resetEX();
		key_event(ACT_C);
--５Ｃ
	elseif ey-y<=1*(ex-x)*my_dir+80 and ey-y>=-1*(ex-x)*my_dir-80 and y>0 and 
	my_act<300 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 
	enemy_obj_range_in(150,60)==false and 
	my_rei>=600 and is_dir_front==true and ((my_air==0 and y>=250) or (y-(my_yspeed*2+my_yspeed/5*13)<=0)) and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		--print("５Ｃ");
		key_resetEX();
		key_event(ACT_C);
--]]
--中距離以上からの８ｈｊ
	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